From 888ddfd5315c58a943818619a3a0c9a2d3f15716 Mon Sep 17 00:00:00 2001 From: Trevor Woerner Date: Thu, 24 Sep 2015 22:55:07 -0400 Subject: [PATCH] more gcc5 fixes gcc5 is pickier about inline code in header files. Signed-off-by: Trevor Woerner --- recipes-bsp/u-boot/u-boot-sunxi.bb | 5 +- .../u-boot/u-boot-sunxi/0002-gcc5-fixes.patch | 197 ++++++++++++++++++ .../linux/linux-sunxi/0001-gcc5-fixes.patch | 135 ++++++++++++ recipes-kernel/linux/linux-sunxi_3.4.bb | 1 + 4 files changed, 337 insertions(+), 1 deletion(-) create mode 100644 recipes-bsp/u-boot/u-boot-sunxi/0002-gcc5-fixes.patch create mode 100644 recipes-kernel/linux/linux-sunxi/0001-gcc5-fixes.patch diff --git a/recipes-bsp/u-boot/u-boot-sunxi.bb b/recipes-bsp/u-boot/u-boot-sunxi.bb index cdf0fda..2ce5a32 100644 --- a/recipes-bsp/u-boot/u-boot-sunxi.bb +++ b/recipes-bsp/u-boot/u-boot-sunxi.bb @@ -18,7 +18,10 @@ UBOOT_MACHINE_olinuxino-a20 = "A20-OLinuXino-Micro_config" UBOOT_MACHINE_olinuxino-a10s = "A10s-OLinuXino-Micro_config" UBOOT_MACHINE_meleg = "Mele_A1000G_config" -SRC_URI = "git://github.com/linux-sunxi/u-boot-sunxi.git;protocol=git;branch=sunxi" +SRC_URI = " \ + git://github.com/linux-sunxi/u-boot-sunxi.git;protocol=git;branch=sunxi \ + file://0002-gcc5-fixes.patch \ + " PE = "1" diff --git a/recipes-bsp/u-boot/u-boot-sunxi/0002-gcc5-fixes.patch b/recipes-bsp/u-boot/u-boot-sunxi/0002-gcc5-fixes.patch new file mode 100644 index 0000000..7744b1a --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-sunxi/0002-gcc5-fixes.patch @@ -0,0 +1,197 @@ +From a5e50d6fd7321d0bc60fda2db938c170d09f9dee Mon Sep 17 00:00:00 2001 +From: Trevor Woerner +Date: Thu, 24 Sep 2015 22:36:02 -0400 +Subject: [PATCH] gcc5 fixes + +gcc5 is pickier about inline functions defined in headers. + +Signed-off-by: Trevor Woerner +--- + arch/arm/include/asm/io.h | 12 ++++---- + common/board_f.c | 18 ++++++------ + common/main.c | 2 +- + include/linux/compiler-gcc5.h | 65 +++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 81 insertions(+), 16 deletions(-) + create mode 100644 include/linux/compiler-gcc5.h + +diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h +index 6a1f05a..2f6925b 100644 +--- a/arch/arm/include/asm/io.h ++++ b/arch/arm/include/asm/io.h +@@ -75,7 +75,7 @@ static inline phys_addr_t virt_to_phys(void * vaddr) + #define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v)) + #define __arch_putl(v,a) (*(volatile unsigned int *)(a) = (v)) + +-extern inline void __raw_writesb(unsigned long addr, const void *data, ++static inline void __raw_writesb(unsigned long addr, const void *data, + int bytelen) + { + uint8_t *buf = (uint8_t *)data; +@@ -83,7 +83,7 @@ extern inline void __raw_writesb(unsigned long addr, const void *data, + __arch_putb(*buf++, addr); + } + +-extern inline void __raw_writesw(unsigned long addr, const void *data, ++static inline void __raw_writesw(unsigned long addr, const void *data, + int wordlen) + { + uint16_t *buf = (uint16_t *)data; +@@ -91,7 +91,7 @@ extern inline void __raw_writesw(unsigned long addr, const void *data, + __arch_putw(*buf++, addr); + } + +-extern inline void __raw_writesl(unsigned long addr, const void *data, ++static inline void __raw_writesl(unsigned long addr, const void *data, + int longlen) + { + uint32_t *buf = (uint32_t *)data; +@@ -99,21 +99,21 @@ extern inline void __raw_writesl(unsigned long addr, const void *data, + __arch_putl(*buf++, addr); + } + +-extern inline void __raw_readsb(unsigned long addr, void *data, int bytelen) ++static inline void __raw_readsb(unsigned long addr, void *data, int bytelen) + { + uint8_t *buf = (uint8_t *)data; + while(bytelen--) + *buf++ = __arch_getb(addr); + } + +-extern inline void __raw_readsw(unsigned long addr, void *data, int wordlen) ++static inline void __raw_readsw(unsigned long addr, void *data, int wordlen) + { + uint16_t *buf = (uint16_t *)data; + while(wordlen--) + *buf++ = __arch_getw(addr); + } + +-extern inline void __raw_readsl(unsigned long addr, void *data, int longlen) ++static inline void __raw_readsl(unsigned long addr, void *data, int longlen) + { + uint32_t *buf = (uint32_t *)data; + while(longlen--) +diff --git a/common/board_f.c b/common/board_f.c +index f285bad..72b421c 100644 +--- a/common/board_f.c ++++ b/common/board_f.c +@@ -78,24 +78,24 @@ DECLARE_GLOBAL_DATA_PTR; + ************************************************************************ + * May be supplied by boards if desired + */ +-inline void __coloured_LED_init(void) {} ++void __coloured_LED_init(void) {} + void coloured_LED_init(void) + __attribute__((weak, alias("__coloured_LED_init"))); +-inline void __red_led_on(void) {} ++void __red_led_on(void) {} + void red_led_on(void) __attribute__((weak, alias("__red_led_on"))); +-inline void __red_led_off(void) {} ++void __red_led_off(void) {} + void red_led_off(void) __attribute__((weak, alias("__red_led_off"))); +-inline void __green_led_on(void) {} ++void __green_led_on(void) {} + void green_led_on(void) __attribute__((weak, alias("__green_led_on"))); +-inline void __green_led_off(void) {} ++void __green_led_off(void) {} + void green_led_off(void) __attribute__((weak, alias("__green_led_off"))); +-inline void __yellow_led_on(void) {} ++void __yellow_led_on(void) {} + void yellow_led_on(void) __attribute__((weak, alias("__yellow_led_on"))); +-inline void __yellow_led_off(void) {} ++void __yellow_led_off(void) {} + void yellow_led_off(void) __attribute__((weak, alias("__yellow_led_off"))); +-inline void __blue_led_on(void) {} ++void __blue_led_on(void) {} + void blue_led_on(void) __attribute__((weak, alias("__blue_led_on"))); +-inline void __blue_led_off(void) {} ++void __blue_led_off(void) {} + void blue_led_off(void) __attribute__((weak, alias("__blue_led_off"))); + + /* +diff --git a/common/main.c b/common/main.c +index 8b6f274..3312b90 100644 +--- a/common/main.c ++++ b/common/main.c +@@ -27,7 +27,7 @@ DECLARE_GLOBAL_DATA_PTR; + /* + * Board-specific Platform code can reimplement show_boot_progress () if needed + */ +-void inline __show_boot_progress (int val) {} ++void __show_boot_progress (int val) {} + void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress"))); + + #define MAX_DELAY_STOP_STR 32 +diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h +new file mode 100644 +index 0000000..c8c5659 +--- /dev/null ++++ b/include/linux/compiler-gcc5.h +@@ -0,0 +1,65 @@ ++#ifndef __LINUX_COMPILER_H ++#error "Please don't include directly, include instead." ++#endif ++ ++#define __used __attribute__((__used__)) ++#define __must_check __attribute__((warn_unused_result)) ++#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) ++ ++/* Mark functions as cold. gcc will assume any path leading to a call ++ to them will be unlikely. This means a lot of manual unlikely()s ++ are unnecessary now for any paths leading to the usual suspects ++ like BUG(), printk(), panic() etc. [but let's keep them for now for ++ older compilers] ++ ++ Early snapshots of gcc 4.3 don't support this and we can't detect this ++ in the preprocessor, but we can live with this because they're unreleased. ++ Maketime probing would be overkill here. ++ ++ gcc also has a __attribute__((__hot__)) to move hot functions into ++ a special section, but I don't see any sense in this right now in ++ the kernel context */ ++#define __cold __attribute__((__cold__)) ++ ++#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) ++ ++#ifndef __CHECKER__ ++# define __compiletime_warning(message) __attribute__((warning(message))) ++# define __compiletime_error(message) __attribute__((error(message))) ++#endif /* __CHECKER__ */ ++ ++/* ++ * Mark a position in code as unreachable. This can be used to ++ * suppress control flow warnings after asm blocks that transfer ++ * control elsewhere. ++ * ++ * Early snapshots of gcc 4.5 don't support this and we can't detect ++ * this in the preprocessor, but we can live with this because they're ++ * unreleased. Really, we need to have autoconf for the kernel. ++ */ ++#define unreachable() __builtin_unreachable() ++ ++/* Mark a function definition as prohibited from being cloned. */ ++#define __noclone __attribute__((__noclone__)) ++ ++/* ++ * Tell the optimizer that something else uses this function or variable. ++ */ ++#define __visible __attribute__((externally_visible)) ++ ++/* ++ * GCC 'asm goto' miscompiles certain code sequences: ++ * ++ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 ++ * ++ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. ++ * ++ * (asm goto is automatically volatile - the naming reflects this.) ++ */ ++#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) ++ ++#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP ++#define __HAVE_BUILTIN_BSWAP32__ ++#define __HAVE_BUILTIN_BSWAP64__ ++#define __HAVE_BUILTIN_BSWAP16__ ++#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ +-- +2.6.0.rc3 + diff --git a/recipes-kernel/linux/linux-sunxi/0001-gcc5-fixes.patch b/recipes-kernel/linux/linux-sunxi/0001-gcc5-fixes.patch new file mode 100644 index 0000000..038214d --- /dev/null +++ b/recipes-kernel/linux/linux-sunxi/0001-gcc5-fixes.patch @@ -0,0 +1,135 @@ +From 83b0b8a7b9cb658d3cc980b4fbcbb2cc8b257ccf Mon Sep 17 00:00:00 2001 +From: Trevor Woerner +Date: Thu, 24 Sep 2015 17:07:26 -0400 +Subject: [PATCH] gcc5 fixes + +gcc5 is pickier about inline functions defined in headers. + +Signed-off-by: Trevor Woerner +--- + drivers/net/wireless/rtl8188eu/include/ieee80211.h | 4 ++-- + drivers/net/wireless/rtl8189es/include/ieee80211.h | 4 ++-- + drivers/net/wireless/rtl8192cu/include/ieee80211.h | 8 ++++---- + drivers/net/wireless/rtl8723as/include/ieee80211.h | 4 ++-- + drivers/staging/rtl8712/ieee80211.h | 4 ++-- + 5 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/drivers/net/wireless/rtl8188eu/include/ieee80211.h b/drivers/net/wireless/rtl8188eu/include/ieee80211.h +index 1ae96a5..7a301c5 100644 +--- a/drivers/net/wireless/rtl8188eu/include/ieee80211.h ++++ b/drivers/net/wireless/rtl8188eu/include/ieee80211.h +@@ -1188,12 +1188,12 @@ enum ieee80211_state { + (((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \ + (((Addr[5]) & 0xff) == 0xff)) + #else +-extern __inline int is_multicast_mac_addr(const u8 *addr) ++static __inline int is_multicast_mac_addr(const u8 *addr) + { + return ((addr[0] != 0xff) && (0x01 & addr[0])); + } + +-extern __inline int is_broadcast_mac_addr(const u8 *addr) ++static __inline int is_broadcast_mac_addr(const u8 *addr) + { + return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ + (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); +diff --git a/drivers/net/wireless/rtl8189es/include/ieee80211.h b/drivers/net/wireless/rtl8189es/include/ieee80211.h +index 1ae96a5..7a301c5 100644 +--- a/drivers/net/wireless/rtl8189es/include/ieee80211.h ++++ b/drivers/net/wireless/rtl8189es/include/ieee80211.h +@@ -1188,12 +1188,12 @@ enum ieee80211_state { + (((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \ + (((Addr[5]) & 0xff) == 0xff)) + #else +-extern __inline int is_multicast_mac_addr(const u8 *addr) ++static __inline int is_multicast_mac_addr(const u8 *addr) + { + return ((addr[0] != 0xff) && (0x01 & addr[0])); + } + +-extern __inline int is_broadcast_mac_addr(const u8 *addr) ++static __inline int is_broadcast_mac_addr(const u8 *addr) + { + return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ + (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); +diff --git a/drivers/net/wireless/rtl8192cu/include/ieee80211.h b/drivers/net/wireless/rtl8192cu/include/ieee80211.h +index 86e9726..950691d 100644 +--- a/drivers/net/wireless/rtl8192cu/include/ieee80211.h ++++ b/drivers/net/wireless/rtl8192cu/include/ieee80211.h +@@ -1149,12 +1149,12 @@ enum ieee80211_state { + #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" + #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5] + +-extern __inline int is_multicast_mac_addr(const u8 *addr) ++static __inline int is_multicast_mac_addr(const u8 *addr) + { + return ((addr[0] != 0xff) && (0x01 & addr[0])); + } + +-extern __inline int is_broadcast_mac_addr(const u8 *addr) ++static __inline int is_broadcast_mac_addr(const u8 *addr) + { + return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ + (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); +@@ -1177,7 +1177,7 @@ typedef struct tx_pending_t{ + #define IEEE_G (1<<2) + #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) + +-extern __inline int ieee80211_is_empty_essid(const char *essid, int essid_len) ++static __inline int ieee80211_is_empty_essid(const char *essid, int essid_len) + { + /* Single white space is for Linksys APs */ + if (essid_len == 1 && essid[0] == ' ') +@@ -1193,7 +1193,7 @@ extern __inline int ieee80211_is_empty_essid(const char *essid, int essid_len) + return 1; + } + +-extern __inline int ieee80211_get_hdrlen(u16 fc) ++static __inline int ieee80211_get_hdrlen(u16 fc) + { + int hdrlen = 24; + +diff --git a/drivers/net/wireless/rtl8723as/include/ieee80211.h b/drivers/net/wireless/rtl8723as/include/ieee80211.h +index bf24c3b..f8046ee 100644 +--- a/drivers/net/wireless/rtl8723as/include/ieee80211.h ++++ b/drivers/net/wireless/rtl8723as/include/ieee80211.h +@@ -1176,12 +1176,12 @@ enum ieee80211_state { + (((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \ + (((Addr[5]) & 0xff) == 0xff)) + #else +-extern __inline int is_multicast_mac_addr(const u8 *addr) ++static __inline int is_multicast_mac_addr(const u8 *addr) + { + return ((addr[0] != 0xff) && (0x01 & addr[0])); + } + +-extern __inline int is_broadcast_mac_addr(const u8 *addr) ++static __inline int is_broadcast_mac_addr(const u8 *addr) + { + return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ + (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); +diff --git a/drivers/staging/rtl8712/ieee80211.h b/drivers/staging/rtl8712/ieee80211.h +index 3c0092b..1e7b55b 100644 +--- a/drivers/staging/rtl8712/ieee80211.h ++++ b/drivers/staging/rtl8712/ieee80211.h +@@ -734,7 +734,7 @@ enum ieee80211_state { + #define IEEE_G (1<<2) + #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) + +-extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) ++static inline int ieee80211_is_empty_essid(const char *essid, int essid_len) + { + /* Single white space is for Linksys APs */ + if (essid_len == 1 && essid[0] == ' ') +@@ -748,7 +748,7 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) + return 1; + } + +-extern inline int ieee80211_get_hdrlen(u16 fc) ++static inline int ieee80211_get_hdrlen(u16 fc) + { + int hdrlen = 24; + +-- +2.6.0.rc3 + diff --git a/recipes-kernel/linux/linux-sunxi_3.4.bb b/recipes-kernel/linux/linux-sunxi_3.4.bb index e86ebbb..5c652b9 100644 --- a/recipes-kernel/linux/linux-sunxi_3.4.bb +++ b/recipes-kernel/linux/linux-sunxi_3.4.bb @@ -13,6 +13,7 @@ MACHINE_KERNEL_PR_append = "a" SRC_URI += "git://github.com/linux-sunxi/linux-sunxi.git;branch=sunxi-3.4;protocol=git \ file://0001-compiler-gcc5.patch \ file://0002-use-static-inline-in-ARM-ftrace.patch \ + file://0001-gcc5-fixes.patch \ file://defconfig \ "