uboot-lantiq: fix build with gcc5
[openwrt/svn-archive/archive.git] / package / boot / uboot-lantiq / patches / 0047-add-gcc5-support.patch
1 From 478b02f1a7043b673565075ea5016376f3293b23 Mon Sep 17 00:00:00 2001
2 From: Hans de Goede <hdegoede@redhat.com>
3 Date: Sat, 7 Feb 2015 22:52:40 +0100
4 Subject: [PATCH] Add linux/compiler-gcc5.h to fix builds with gcc5
5
6 Add linux/compiler-gcc5/h from the kernel sources at:
7
8 commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b
9 Author: Steven Noonan <steven@uplinklabs.net>
10 Date: Sat Oct 25 15:09:42 2014 -0700
11
12 compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles
13
14 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
15 ---
16 include/linux/compiler-gcc5.h | 65 +++++++++++++++++++++++++++++++++++++++++
17 1 file changed, 65 insertions(+)
18 create mode 100644 include/linux/compiler-gcc5.h
19
20 diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h
21 new file mode 100644
22 index 0000000..c8c5659
23 --- /dev/null
24 +++ b/include/linux/compiler-gcc5.h
25 @@ -0,0 +1,65 @@
26 +#ifndef __LINUX_COMPILER_H
27 +#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
28 +#endif
29 +
30 +#define __used __attribute__((__used__))
31 +#define __must_check __attribute__((warn_unused_result))
32 +#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
33 +
34 +/* Mark functions as cold. gcc will assume any path leading to a call
35 + to them will be unlikely. This means a lot of manual unlikely()s
36 + are unnecessary now for any paths leading to the usual suspects
37 + like BUG(), printk(), panic() etc. [but let's keep them for now for
38 + older compilers]
39 +
40 + Early snapshots of gcc 4.3 don't support this and we can't detect this
41 + in the preprocessor, but we can live with this because they're unreleased.
42 + Maketime probing would be overkill here.
43 +
44 + gcc also has a __attribute__((__hot__)) to move hot functions into
45 + a special section, but I don't see any sense in this right now in
46 + the kernel context */
47 +#define __cold __attribute__((__cold__))
48 +
49 +#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
50 +
51 +#ifndef __CHECKER__
52 +# define __compiletime_warning(message) __attribute__((warning(message)))
53 +# define __compiletime_error(message) __attribute__((error(message)))
54 +#endif /* __CHECKER__ */
55 +
56 +/*
57 + * Mark a position in code as unreachable. This can be used to
58 + * suppress control flow warnings after asm blocks that transfer
59 + * control elsewhere.
60 + *
61 + * Early snapshots of gcc 4.5 don't support this and we can't detect
62 + * this in the preprocessor, but we can live with this because they're
63 + * unreleased. Really, we need to have autoconf for the kernel.
64 + */
65 +#define unreachable() __builtin_unreachable()
66 +
67 +/* Mark a function definition as prohibited from being cloned. */
68 +#define __noclone __attribute__((__noclone__))
69 +
70 +/*
71 + * Tell the optimizer that something else uses this function or variable.
72 + */
73 +#define __visible __attribute__((externally_visible))
74 +
75 +/*
76 + * GCC 'asm goto' miscompiles certain code sequences:
77 + *
78 + * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
79 + *
80 + * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
81 + *
82 + * (asm goto is automatically volatile - the naming reflects this.)
83 + */
84 +#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
85 +
86 +#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
87 +#define __HAVE_BUILTIN_BSWAP32__
88 +#define __HAVE_BUILTIN_BSWAP64__
89 +#define __HAVE_BUILTIN_BSWAP16__
90 +#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
91 --
92 1.7.10.4
93