uboot-omap: fix build with gcc-5

This fixes some problems with gcc-5.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

SVN-Revision: 47539
This commit is contained in:
Hauke Mehrtens 2015-11-20 23:38:39 +00:00
parent 605621fc3f
commit 53d94f89e8
7 changed files with 280 additions and 6 deletions

View file

@ -1,4 +1,4 @@
--- a/include/configs/omap4_common --- a/include/configs/omap4_common.h
+++ b/include/configs/omap4_common.h +++ b/include/configs/omap4_common.h
@@ -143,7 +143,7 @@ @@ -143,7 +143,7 @@
"vram=16M\0" \ "vram=16M\0" \

View file

@ -17,11 +17,9 @@ Cc: Chris Ruehl <chris.ruehl@gtsys.com.hk>
fs/jffs2/jffs2_1pass.c | 2 +- fs/jffs2/jffs2_1pass.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index c856983..a7dbe79 100644
--- a/fs/jffs2/jffs2_1pass.c --- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c +++ b/fs/jffs2/jffs2_1pass.c
@@ -1438,7 +1438,7 @@ jffs2_1pass_build_lists(struct part_info * part) @@ -1438,7 +1438,7 @@ jffs2_1pass_build_lists(struct part_info
{ {
struct b_lists *pL; struct b_lists *pL;
struct jffs2_unknown_node *node; struct jffs2_unknown_node *node;
@ -30,5 +28,3 @@ index c856983..a7dbe79 100644
u32 i; u32 i;
u32 counter4 = 0; u32 counter4 = 0;
u32 counterF = 0; u32 counterF = 0;
--
1.8.3.1

View file

@ -0,0 +1,87 @@
From: Hans de Goede <hdegoede@redhat.com>
Date: Sat, 7 Feb 2015 21:52:40 +0000 (+0100)
Subject: Add linux/compiler-gcc5.h to fix builds with gcc5
X-Git-Tag: v2015.04-rc2~31
X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=478b02f1a7043b673565075ea5016376f3293b23
Add linux/compiler-gcc5.h to fix builds with gcc5
Add linux/compiler-gcc5/h from the kernel sources at:
commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b
Author: Steven Noonan <steven@uplinklabs.net>
Date: Sat Oct 25 15:09:42 2014 -0700
compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
--- /dev/null
+++ b/include/linux/compiler-gcc5.h
@@ -0,0 +1,65 @@
+#ifndef __LINUX_COMPILER_H
+#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> 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 */

View file

@ -0,0 +1,69 @@
From: Jeroen Hofstee <jeroen@myspectrum.nl>
Date: Sun, 22 Jun 2014 21:10:39 +0000 (+0200)
Subject: ARM:asm:io.h use static inline
X-Git-Tag: v2014.10-rc2~47
X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=8863aa5c984460ce1112d8db895cbf8b13a6ac9d
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.
cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
---
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -75,42 +75,42 @@ static inline phys_addr_t virt_to_phys(v
#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 int 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 int 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 int 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 int 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 int 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 int addr, void *data, int longlen)
{
uint32_t *buf = (uint32_t *)data;
while(longlen--)

View file

@ -0,0 +1,80 @@
From: Jeroen Hofstee <jeroen@myspectrum.nl>
Date: Wed, 8 Oct 2014 20:57:21 +0000 (+0200)
Subject: arm: board: use __weak
X-Git-Tag: v2015.01-rc1~176
X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=8590c800ee60e46f15d6085e3c1fed0d6881fc62
arm: board: use __weak
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
---
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -62,25 +62,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) {}
/*
************************************************************************
@@ -199,27 +189,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)

View file

@ -0,0 +1,27 @@
From: Jeroen Hofstee <jeroen@myspectrum.nl>
Date: Thu, 26 Jun 2014 18:18:31 +0000 (+0200)
Subject: common: main.c: make show_boot_progress __weak
X-Git-Tag: v2014.10-rc1~130
X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=3422299dc28fa8257677d03cc1253e3c9bf17e9f
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).
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
Acked-by: Simon Glass <sjg@chromium.org>
---
--- a/common/main.c
+++ b/common/main.c
@@ -27,8 +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) __attribute__((weak, alias("__show_boot_progress")));
+__weak void show_boot_progress(int val) {}
#define MAX_DELAY_STOP_STR 32

View file

@ -0,0 +1,15 @@
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -96,11 +96,10 @@ static void omap_ehci_soft_phy_reset(int
}
#endif
-inline int __board_usb_init(void)
+static int board_usb_init(void)
{
return 0;
}
-int board_usb_init(void) __attribute__((weak, alias("__board_usb_init")));
#if defined(CONFIG_OMAP_EHCI_PHY1_RESET_GPIO) || \
defined(CONFIG_OMAP_EHCI_PHY2_RESET_GPIO) || \