From patchwork Tue Feb 28 17:39:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 733704 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vXm8q2fkrz9s8K for ; Wed, 1 Mar 2017 04:41:31 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 39142307DF; Tue, 28 Feb 2017 17:41:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Qm3mykQN1Vge; Tue, 28 Feb 2017 17:41:14 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 92592307B1; Tue, 28 Feb 2017 17:40:48 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id B92261C2B73 for ; Tue, 28 Feb 2017 17:40:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 53BFD89A74 for ; Tue, 28 Feb 2017 17:40:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4NM0r-z-dcuQ for ; Tue, 28 Feb 2017 17:40:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exchange.essensium.com (220.77.144.195.ipv4.evonet.be [195.144.77.220]) by hemlock.osuosl.org (Postfix) with ESMTPS id 1C18289A79 for ; Tue, 28 Feb 2017 17:40:26 +0000 (UTC) Received: from vandecaa-laptop.local.ess-mail.com (10.3.4.138) by beleexch01.local.ess-mail.com (10.3.7.8) with Microsoft SMTP Server (TLS) id 15.0.847.32; Tue, 28 Feb 2017 18:40:04 +0100 From: "Arnout Vandecappelle (Essensium/Mind)" To: Date: Tue, 28 Feb 2017 18:39:59 +0100 Message-ID: <20170228174001.23830-6-arnout@mind.be> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170228174001.23830-1-arnout@mind.be> References: <20170228174001.23830-1-arnout@mind.be> MIME-Version: 1.0 X-Originating-IP: [10.3.4.138] X-ClientProxiedBy: beleexch01.local.ess-mail.com (10.3.7.8) To beleexch01.local.ess-mail.com (10.3.7.8) Subject: [Buildroot] [PATCH 5/7] via_imx6_vab820_defconfig: fix build with gcc5 X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Kernel doesn't have the compiler-gcc5.h header, so include the universal patch that fixes this issue. U-Boot doesn't have the compiler-gcc5.h header and has several other problems. Get upstream patches to fix those. U-Boot patches are needed for several defconfigs, but they differ slightly in the context. However, the patches have been written in a generic way so they are almost identicat between boards. Cc: Gergely Imreh Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- ....h-remove-dependency-on-compiler-gcc-345.patch} | 84 +++++++++++++-------- .../0002-ARM-asm-io.h-use-static-inline.patch | 81 ++++++++++++++++++++ ...mon-main.c-make-show_boot_progress-__weak.patch | 35 +++++++++ .../patches/uboot/0004-arm-board-use-__weak.patch | 88 ++++++++++++++++++++++ configs/via_imx6_vab820_defconfig | 3 + 5 files changed, 258 insertions(+), 33 deletions(-) copy board/{linux-gcc-patches/linux/0001-compiler-gcc-integrate-the-various-compiler-gcc-345-.patch => via/imx6_vab820/patches/uboot/0001-compiler-gcc.h-remove-dependency-on-compiler-gcc-345.patch} (63%) create mode 100644 board/via/imx6_vab820/patches/uboot/0002-ARM-asm-io.h-use-static-inline.patch create mode 100644 board/via/imx6_vab820/patches/uboot/0003-common-main.c-make-show_boot_progress-__weak.patch create mode 100644 board/via/imx6_vab820/patches/uboot/0004-arm-board-use-__weak.patch diff --git a/board/linux-gcc-patches/linux/0001-compiler-gcc-integrate-the-various-compiler-gcc-345-.patch b/board/via/imx6_vab820/patches/uboot/0001-compiler-gcc.h-remove-dependency-on-compiler-gcc-345.patch similarity index 63% copy from board/linux-gcc-patches/linux/0001-compiler-gcc-integrate-the-various-compiler-gcc-345-.patch copy to board/via/imx6_vab820/patches/uboot/0001-compiler-gcc.h-remove-dependency-on-compiler-gcc-345.patch index 2435d21be0..867cbf2126 100644 --- a/board/linux-gcc-patches/linux/0001-compiler-gcc-integrate-the-various-compiler-gcc-345-.patch +++ b/board/via/imx6_vab820/patches/uboot/0001-compiler-gcc.h-remove-dependency-on-compiler-gcc-345.patch @@ -1,43 +1,35 @@ -From cb984d101b30eb7478d32df56a0023e4603cba7f Mon Sep 17 00:00:00 2001 -From: Joe Perches -Date: Thu, 25 Jun 2015 15:01:02 -0700 -Subject: [PATCH] compiler-gcc: integrate the various compiler-gcc[345].h files +From 1ed5595fc67a19ccd1503659e3845452369c96ae Mon Sep 17 00:00:00 2001 +From: "Arnout Vandecappelle (Essensium/Mind)" +Date: Tue, 28 Feb 2017 13:32:48 +0100 +Subject: [PATCH] compiler-gcc.h: remove dependency on compiler-gcc[345].h -As gcc major version numbers are going to advance rather rapidly in the -future, there's no real value in separate files for each compiler -version. +This is based on commit 9b2c282b348dfe966bbba967dc7a45ce817cce50 upstream. -Deduplicate some of the macros #defined in each file too. +Copy these from Linux v4.5-rc6 tag. -Neaten comments using normal kernel commenting style. +This is needed so that we can keep up with newer gcc versions. Note +that we don't have the uapi/ hierarchy from the kernel so continue to +use -[Arnout: don't remove compiler-gcc[345].h to make the patch more universal. - These headers are not used anymore, but it doesn't hurt if the files - still exist. - Also, add GCC_VERSION definition (introduced in v3.9) so the same - patch can be applied to pre- and post-v3.9 kernels.] +[Arnout: limit the changes to purely what is needed to get rid of + compiler-gcc[345].h. This gives us the best chance that the + patch applies to some random U-Boot version. Also, don't + remove compiler-gcc[345].h, in case they have changed or don't + exist yet.] -Signed-off-by: Joe Perches -Cc: Andi Kleen -Cc: Michal Marek -Cc: Segher Boessenkool -Cc: Sasha Levin -Cc: Anton Blanchard -Cc: Alan Modra -Signed-off-by: Andrew Morton -Signed-off-by: Linus Torvalds +Signed-off-by: Tom Rini Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- - include/linux/compiler-gcc.h | 120 ++++++++++++++++++++++++++++++++++++++++-- - 4 files changed, 116 insertions(+), 185 deletions(-) + include/linux/compiler-gcc.h | 155 +++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 151 insertions(+), 4 deletions(-) diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h -index 5c2c14e3c647..dfaa7b3e9ae9 100644 +index 73dcf804bc..1ad6c64b47 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h -@@ -122,10 +122,128 @@ - #define __maybe_unused __attribute__((unused)) - #define __always_unused __attribute__((unused)) +@@ -81,7 +81,154 @@ + #define __maybe_unused __attribute__((unused)) + #define __always_unused __attribute__((unused)) -#define __gcc_header(x) #x -#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) @@ -132,11 +124,31 @@ index 5c2c14e3c647..dfaa7b3e9ae9 100644 + +#if GCC_VERSION >= 40600 +/* -+ * Tell the optimizer that something else uses this function or variable. ++ * When used with Link Time Optimization, gcc can optimize away C functions or ++ * variables which are referenced only from assembly code. __visible tells the ++ * optimizer that something else uses this function or variable, thus preventing ++ * this. + */ +#define __visible __attribute__((externally_visible)) +#endif + ++ ++#if GCC_VERSION >= 40900 && !defined(__CHECKER__) ++/* ++ * __assume_aligned(n, k): Tell the optimizer that the returned ++ * pointer can be assumed to be k modulo n. The second argument is ++ * optional (default 0), so we use a variadic macro to make the ++ * shorthand. ++ * ++ * Beware: Do not apply this to functions which may return ++ * ERR_PTRs. Also, it is probably unwise to apply it to functions ++ * returning extra information in the low bits (but in that case the ++ * compiler should see some alignment anyway, when the return value is ++ * massaged by 'flags = ptr & 3; ptr &= ~3;'). ++ */ ++#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__))) ++#endif ++ +/* + * GCC 'asm goto' miscompiles certain code sequences: + * @@ -164,10 +176,16 @@ index 5c2c14e3c647..dfaa7b3e9ae9 100644 +#define KASAN_ABI_VERSION 3 +#endif + ++#if GCC_VERSION >= 40902 ++/* ++ * Tell the compiler that address safety instrumentation (KASAN) ++ * should not be applied to that function. ++ * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 ++ */ ++#define __no_sanitize_address __attribute__((no_sanitize_address)) ++#endif ++ +#endif /* gcc version >= 40000 specific checks */ - - #if !defined(__noclone) - #define __noclone /* not needed */ -- 2.11.0 diff --git a/board/via/imx6_vab820/patches/uboot/0002-ARM-asm-io.h-use-static-inline.patch b/board/via/imx6_vab820/patches/uboot/0002-ARM-asm-io.h-use-static-inline.patch new file mode 100644 index 0000000000..9eb42d6c31 --- /dev/null +++ b/board/via/imx6_vab820/patches/uboot/0002-ARM-asm-io.h-use-static-inline.patch @@ -0,0 +1,81 @@ +From 158ec652dcd8ae228eeae3ae92a3d6ba48ca228e Mon Sep 17 00:00:00 2001 +From: Jeroen Hofstee +Date: Sun, 22 Jun 2014 23:10:39 +0200 +Subject: [PATCH] ARM:asm:io.h use static inline + +When compiling u-boot with W=1 the extern inline void for +read* is likely causing the most noise. gcc / clang will +warn there is never a actual declaration for these functions. +Instead of declaring these extern make them static inline so +it is actually declared. + +[Arnout: rewrite for U-Boot < v2014.01 + This patch is needed for gcc5] + +cc: Albert ARIBAUD +Signed-off-by: Jeroen Hofstee +(cherry picked from commit 8863aa5c984460ce1112d8db895cbf8b13a6ac9d) +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) +--- + arch/arm/include/asm/io.h | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h +index 1fbc531a08..2f6925b78c 100644 +--- a/arch/arm/include/asm/io.h ++++ b/arch/arm/include/asm/io.h +@@ -75,42 +75,45 @@ 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 int addr, const void *data, int bytelen) ++static inline void __raw_writesb(unsigned long addr, const void *data, ++ int bytelen) + { + uint8_t *buf = (uint8_t *)data; + while(bytelen--) + __arch_putb(*buf++, addr); + } + +-extern inline void __raw_writesw(unsigned int addr, const void *data, int wordlen) ++static inline void __raw_writesw(unsigned long addr, const void *data, ++ int wordlen) + { + uint16_t *buf = (uint16_t *)data; + while(wordlen--) + __arch_putw(*buf++, addr); + } + +-extern inline void __raw_writesl(unsigned int addr, const void *data, int longlen) ++static inline void __raw_writesl(unsigned long addr, const void *data, ++ int longlen) + { + uint32_t *buf = (uint32_t *)data; + while(longlen--) + __arch_putl(*buf++, addr); + } + +-extern inline void __raw_readsb(unsigned int 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 int 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 int 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--) +-- +2.11.0 + diff --git a/board/via/imx6_vab820/patches/uboot/0003-common-main.c-make-show_boot_progress-__weak.patch b/board/via/imx6_vab820/patches/uboot/0003-common-main.c-make-show_boot_progress-__weak.patch new file mode 100644 index 0000000000..686d448661 --- /dev/null +++ b/board/via/imx6_vab820/patches/uboot/0003-common-main.c-make-show_boot_progress-__weak.patch @@ -0,0 +1,35 @@ +From 9cc7a26c35be56cd3f8fa3e3990b9b7e69aed031 Mon Sep 17 00:00:00 2001 +From: Jeroen Hofstee +Date: Thu, 26 Jun 2014 20:18:31 +0200 +Subject: [PATCH] common: main.c: make show_boot_progress __weak + +This not only looks a bit better it also prevents a +warning with W=1 (no previous prototype). + +[Arnout: this patch is needed to fix the build with gcc5] + +Signed-off-by: Jeroen Hofstee +Acked-by: Simon Glass +(cherry picked from commit 3422299dc28fa8257677d03cc1253e3c9bf17e9f) +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) +--- + common/main.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/common/main.c b/common/main.c +index 145ded1fc9..b5c9bb0f35 100644 +--- a/common/main.c ++++ b/common/main.c +@@ -62,8 +62,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) __attribute__((weak, alias("__show_boot_progress"))); ++__weak void show_boot_progress(int val) {} + + #if defined(CONFIG_UPDATE_TFTP) + int update_tftp (ulong addr); +-- +2.11.0 + diff --git a/board/via/imx6_vab820/patches/uboot/0004-arm-board-use-__weak.patch b/board/via/imx6_vab820/patches/uboot/0004-arm-board-use-__weak.patch new file mode 100644 index 0000000000..7a96183af3 --- /dev/null +++ b/board/via/imx6_vab820/patches/uboot/0004-arm-board-use-__weak.patch @@ -0,0 +1,88 @@ +From 99bd7b7fb4d58092f020a808bb57be3b4d4cfc51 Mon Sep 17 00:00:00 2001 +From: "Arnout Vandecappelle (Essensium/Mind)" +Date: Tue, 28 Feb 2017 14:07:30 +0100 +Subject: [PATCH] arm: board: use __weak + +[Arnout: this patch is needed to fix the build with gcc5] + +Signed-off-by: Jeroen Hofstee +Acked-by: Albert ARIBAUD +(cherry picked from commit 8590c800ee60e46f15d6085e3c1fed0d6881fc62) +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) +--- + arch/arm/lib/board.c | 40 ++++++++++++---------------------------- + 1 file changed, 12 insertions(+), 28 deletions(-) + +diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c +index 51b8628b3f..3685e65134 100644 +--- a/arch/arm/lib/board.c ++++ b/arch/arm/lib/board.c +@@ -82,25 +82,15 @@ extern void dataflash_print_info(void); + ************************************************************************ + * May be supplied by boards if desired + */ +-inline 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) __attribute__((weak, alias("__red_led_on"))); +-inline 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) __attribute__((weak, alias("__green_led_on"))); +-inline 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) __attribute__((weak, alias("__yellow_led_on"))); +-inline 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) __attribute__((weak, alias("__blue_led_on"))); +-inline void __blue_led_off(void) {} +-void blue_led_off(void) __attribute__((weak, alias("__blue_led_off"))); ++__weak void coloured_LED_init(void) {} ++__weak void red_led_on(void) {} ++__weak void red_led_off(void) {} ++__weak void green_led_on(void) {} ++__weak void green_led_off(void) {} ++__weak void yellow_led_on(void) {} ++__weak void yellow_led_off(void) {} ++__weak void blue_led_on(void) {} ++__weak void blue_led_off(void) {} + + /* + ************************************************************************ +@@ -215,27 +205,21 @@ typedef int (init_fnc_t) (void); + + int print_cpuinfo(void); + +-void __dram_init_banksize(void) ++__weak void dram_init_banksize(void) + { + gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; + gd->bd->bi_dram[0].size = gd->ram_size; + } +-void dram_init_banksize(void) +- __attribute__((weak, alias("__dram_init_banksize"))); + +-int __arch_cpu_init(void) ++__weak int arch_cpu_init(void) + { + return 0; + } +-int arch_cpu_init(void) +- __attribute__((weak, alias("__arch_cpu_init"))); + +-int __power_init_board(void) ++__weak int power_init_board(void) + { + return 0; + } +-int power_init_board(void) +- __attribute__((weak, alias("__power_init_board"))); + + /* Record the board_init_f() bootstage (after arch_cpu_init()) */ + static int mark_bootstage(void) +-- +2.11.0 + diff --git a/configs/via_imx6_vab820_defconfig b/configs/via_imx6_vab820_defconfig index fa646f07dc..d7ebeef62c 100644 --- a/configs/via_imx6_vab820_defconfig +++ b/configs/via_imx6_vab820_defconfig @@ -3,6 +3,9 @@ BR2_arm=y BR2_cortex_a9=y BR2_ARM_ENABLE_VFP=y +# Older Linux and U-Boot require the gcc5 patch +BR2_GLOBAL_PATCH_DIR="board/linux-gcc-patches board/via/imx6_vab820/patches" + # Linux headers same as kernel, a 3.10 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_10=y