From 64d0d088725b7ad70080068c3eb9f5dccec9bd32 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Thu, 14 Apr 2016 11:55:38 +0300 Subject: BBB: enable kernel to build with gcc5 Change-Id: Iee04165267b5aa8e0056abb1b8210eb1789ba669 Reviewed-by: Teemu Holappa --- conf/distro/include/beaglebone.conf | 2 +- ...LLVMLinux-use-static-inline-in-ARM-ftrace.patch | 52 ++++++++ ...001-Change-extern-inline-to-static-inline.patch | 133 +++++++++++++++++++++ .../0001-kernel-add-support-for-gcc-5.patch | 99 +++++++++++++++ .../recipes/linux/linux-mainline_3.8.bbappend | 4 + 5 files changed, 289 insertions(+), 1 deletion(-) create mode 100644 meta-beagleboard-extras/recipes/linux/linux-mainline/0001-ARM-8158-1-LLVMLinux-use-static-inline-in-ARM-ftrace.patch create mode 100644 meta-beagleboard-extras/recipes/linux/linux-mainline/0001-Change-extern-inline-to-static-inline.patch create mode 100644 meta-beagleboard-extras/recipes/linux/linux-mainline/0001-kernel-add-support-for-gcc-5.patch diff --git a/conf/distro/include/beaglebone.conf b/conf/distro/include/beaglebone.conf index 8a2c3e2..c034200 100644 --- a/conf/distro/include/beaglebone.conf +++ b/conf/distro/include/beaglebone.conf @@ -40,7 +40,7 @@ PREFERRED_VERSION_omap3-sgx-modules = "4.10.00.01" PREFERRED_PROVIDER_virtual/egl = "libgles-omap3" PREFERRED_PROVIDER_virtual/libgles2 = "libgles-omap3" -PREFERRED_PROVIDER_u-boot = "u-boot" +PREFERRED_PROVIDER_u-boot = "u-boot-ti-staging" EXTRA_IMAGEDEPENDS_remove = "u-boot-denx" UBOOT_MACHINE = "am335x_boneblack_config" KERNEL_IMAGETYPE = "zImage" diff --git a/meta-beagleboard-extras/recipes/linux/linux-mainline/0001-ARM-8158-1-LLVMLinux-use-static-inline-in-ARM-ftrace.patch b/meta-beagleboard-extras/recipes/linux/linux-mainline/0001-ARM-8158-1-LLVMLinux-use-static-inline-in-ARM-ftrace.patch new file mode 100644 index 0000000..ee61a74 --- /dev/null +++ b/meta-beagleboard-extras/recipes/linux/linux-mainline/0001-ARM-8158-1-LLVMLinux-use-static-inline-in-ARM-ftrace.patch @@ -0,0 +1,52 @@ +From ef372125fd64fc181869be4cf528488f9e8b46c2 Mon Sep 17 00:00:00 2001 +From: Behan Webster +Date: Wed, 24 Sep 2014 01:06:46 +0100 +Subject: [PATCH] ARM: 8158/1: LLVMLinux: use static inline in ARM ftrace.h + +With compilers which follow the C99 standard (like modern versions of gcc and +clang), "extern inline" does the wrong thing (emits code for an externally +linkable version of the inline function). In this case using static inline +and removing the NULL version of return_address in return_address.c does +the right thing. + +Signed-off-by: Behan Webster +Reviewed-by: Mark Charlebois +Acked-by: Steven Rostedt +Signed-off-by: Russell King +--- + arch/arm/include/asm/ftrace.h | 2 +- + arch/arm/kernel/return_address.c | 5 ----- + 2 files changed, 1 insertion(+), 6 deletions(-) + +diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h +index f89515a..2bb8cac 100644 +--- a/arch/arm/include/asm/ftrace.h ++++ b/arch/arm/include/asm/ftrace.h +@@ -45,7 +45,7 @@ void *return_address(unsigned int); + + #else + +-extern inline void *return_address(unsigned int level) ++static inline void *return_address(unsigned int level) + { + return NULL; + } +diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c +index fafedd8..f6aa84d 100644 +--- a/arch/arm/kernel/return_address.c ++++ b/arch/arm/kernel/return_address.c +@@ -63,11 +63,6 @@ void *return_address(unsigned int level) + #warning "TODO: return_address should use unwind tables" + #endif + +-void *return_address(unsigned int level) +-{ +- return NULL; +-} +- + #endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) / else */ + + EXPORT_SYMBOL_GPL(return_address); +-- +1.9.1 + diff --git a/meta-beagleboard-extras/recipes/linux/linux-mainline/0001-Change-extern-inline-to-static-inline.patch b/meta-beagleboard-extras/recipes/linux/linux-mainline/0001-Change-extern-inline-to-static-inline.patch new file mode 100644 index 0000000..66f031f --- /dev/null +++ b/meta-beagleboard-extras/recipes/linux/linux-mainline/0001-Change-extern-inline-to-static-inline.patch @@ -0,0 +1,133 @@ +From 0873625fb43dda5a54919b7414f235cdfdd98ddc Mon Sep 17 00:00:00 2001 +From: Samuli Piippo +Date: Wed, 13 Apr 2016 15:42:49 +0300 +Subject: [PATCH] Change "extern inline" to "static inline" + +With compilers which follow the C99 standard (like modern versions of gcc and +clang), "extern inline" does the wrong thing (emits code for an externally +linkable version of the inline function). "static inline" is the correct choice +instead. +--- + drivers/staging/rtl8192u/ieee80211/ieee80211.h | 10 +++++----- + drivers/staging/rtl8712/ieee80211.h | 4 ++-- + lib/mpi/mpi-inline.h | 2 +- + lib/mpi/mpi-internal.h | 16 ++++++++-------- + 4 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h +index 502bfdb..1c8d026 100644 +--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h ++++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h +@@ -2254,7 +2254,7 @@ static inline void *ieee80211_priv(struct net_device *dev) + return ((struct ieee80211_device *)netdev_priv(dev))->priv; + } + +-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] == ' ') +@@ -2270,7 +2270,7 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) + return 1; + } + +-extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) ++static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) + { + /* + * It is possible for both access points and our device to support +@@ -2296,7 +2296,7 @@ extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mod + return 0; + } + +-extern inline int ieee80211_get_hdrlen(u16 fc) ++static inline int ieee80211_get_hdrlen(u16 fc) + { + int hdrlen = IEEE80211_3ADDR_LEN; + +@@ -2582,12 +2582,12 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee); + + extern const long ieee80211_wlan_frequencies[]; + +-extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) ++static inline void ieee80211_increment_scans(struct ieee80211_device *ieee) + { + ieee->scans++; + } + +-extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) ++static inline int ieee80211_get_scans(struct ieee80211_device *ieee) + { + return ieee->scans; + } +diff --git a/drivers/staging/rtl8712/ieee80211.h b/drivers/staging/rtl8712/ieee80211.h +index 21515c3..7518061 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; + +diff --git a/lib/mpi/mpi-inline.h b/lib/mpi/mpi-inline.h +index e2b3985..c245ea3 100644 +--- a/lib/mpi/mpi-inline.h ++++ b/lib/mpi/mpi-inline.h +@@ -30,7 +30,7 @@ + #define G10_MPI_INLINE_H + + #ifndef G10_MPI_INLINE_DECL +-#define G10_MPI_INLINE_DECL extern inline ++#define G10_MPI_INLINE_DECL static inline + #endif + + G10_MPI_INLINE_DECL mpi_limb_t +diff --git a/lib/mpi/mpi-internal.h b/lib/mpi/mpi-internal.h +index 77adcf6..4566d11 100644 +--- a/lib/mpi/mpi-internal.h ++++ b/lib/mpi/mpi-internal.h +@@ -172,20 +172,20 @@ void mpi_rshift_limbs(MPI a, unsigned int count); + int mpi_lshift_limbs(MPI a, unsigned int count); + + /*-- mpihelp-add.c --*/ +-mpi_limb_t mpihelp_add_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +- mpi_size_t s1_size, mpi_limb_t s2_limb); ++//mpi_limb_t mpihelp_add_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, ++// mpi_size_t s1_size, mpi_limb_t s2_limb); + mpi_limb_t mpihelp_add_n(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, + mpi_ptr_t s2_ptr, mpi_size_t size); +-mpi_limb_t mpihelp_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, +- mpi_ptr_t s2_ptr, mpi_size_t s2_size); ++//mpi_limb_t mpihelp_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, ++// mpi_ptr_t s2_ptr, mpi_size_t s2_size); + + /*-- mpihelp-sub.c --*/ +-mpi_limb_t mpihelp_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +- mpi_size_t s1_size, mpi_limb_t s2_limb); ++//mpi_limb_t mpihelp_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, ++// mpi_size_t s1_size, mpi_limb_t s2_limb); + mpi_limb_t mpihelp_sub_n(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, + mpi_ptr_t s2_ptr, mpi_size_t size); +-mpi_limb_t mpihelp_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, +- mpi_ptr_t s2_ptr, mpi_size_t s2_size); ++//mpi_limb_t mpihelp_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, ++// mpi_ptr_t s2_ptr, mpi_size_t s2_size); + + /*-- mpihelp-cmp.c --*/ + int mpihelp_cmp(mpi_ptr_t op1_ptr, mpi_ptr_t op2_ptr, mpi_size_t size); +-- +1.9.1 + diff --git a/meta-beagleboard-extras/recipes/linux/linux-mainline/0001-kernel-add-support-for-gcc-5.patch b/meta-beagleboard-extras/recipes/linux/linux-mainline/0001-kernel-add-support-for-gcc-5.patch new file mode 100644 index 0000000..13a89fb --- /dev/null +++ b/meta-beagleboard-extras/recipes/linux/linux-mainline/0001-kernel-add-support-for-gcc-5.patch @@ -0,0 +1,99 @@ +From 376075b9598d602950b73cc78743735585c0a18c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Oct 2014 15:51:05 -0700 +Subject: [PATCH] kernel: add support for gcc 5 + +commit 71458cfc782eafe4b27656e078d379a34e472adf upstream. + +We're missing include/linux/compiler-gcc5.h which is required now +because gcc branched off to v5 in trunk. + +Just copy the relevant bits out of include/linux/compiler-gcc4.h, +no new code is added as of now. + +This fixes a build error when using gcc 5. + +Signed-off-by: Sasha Levin +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/compiler-gcc5.h | 66 +++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 66 insertions(+) + create mode 100644 include/linux/compiler-gcc5.h + +diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h +new file mode 100644 +index 0000000..cdd1cc2 +--- /dev/null ++++ b/include/linux/compiler-gcc5.h +@@ -0,0 +1,66 @@ ++#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. ++ * Fixed in GCC 4.8.2 and later versions. ++ * ++ * (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 */ +-- +1.9.1 + diff --git a/meta-beagleboard-extras/recipes/linux/linux-mainline_3.8.bbappend b/meta-beagleboard-extras/recipes/linux/linux-mainline_3.8.bbappend index a945ea8..0e6d423 100644 --- a/meta-beagleboard-extras/recipes/linux/linux-mainline_3.8.bbappend +++ b/meta-beagleboard-extras/recipes/linux/linux-mainline_3.8.bbappend @@ -26,6 +26,9 @@ SRC_URI += "\ file://0003-video-da8xx-fb-Add-API-to-register-wait-for-vsync-ca.patch \ file://ARM-perf-add-support-for-perf-registers-API.diff \ file://ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch \ + file://0001-ARM-8158-1-LLVMLinux-use-static-inline-in-ARM-ftrace.patch \ + file://0001-kernel-add-support-for-gcc-5.patch \ + file://0001-Change-extern-inline-to-static-inline.patch \ " INSANE_SKIP_${PN} = "installed-vs-shipped" @@ -37,4 +40,5 @@ do_configure_prepend() { -e '/CONFIG_USB_FUNCTIONFS_RNDIS=/d' \ -i ${WORKDIR}/defconfig echo "CONFIG_FHANDLE=y" >> ${WORKDIR}/defconfig + echo "CONFIG_MOUSE_PS2=n" >> ${WORKDIR}/defconfig } -- cgit v1.2.3-54-g00ecf