mirror of
https://github.com/linux-sunxi/meta-sunxi.git
synced 2024-12-27 13:38:21 +01:00
198 lines
7.2 KiB
Diff
198 lines
7.2 KiB
Diff
From a5e50d6fd7321d0bc60fda2db938c170d09f9dee Mon Sep 17 00:00:00 2001
|
|
From: Trevor Woerner <twoerner@gmail.com>
|
|
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 <twoerner@gmail.com>
|
|
---
|
|
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 <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 */
|
|
--
|
|
2.6.0.rc3
|
|
|