1 From eea58226f0b604d3047c495985197113838d3a7a Mon Sep 17 00:00:00 2001
2 From: Trevor Woerner <twoerner@gmail.com>
3 Date: Tue, 20 Jun 2017 13:25:20 -0400
4 Subject: [PATCH] fix build for gcc7
6 | In file included from .../include/linux/compiler.h:54:0,
7 | from .../include/uapi/linux/stddef.h:1,
8 | from .../include/linux/stddef.h:4,
9 | from .../include/uapi/linux/posix_types.h:4,
10 | from .../include/uapi/linux/types.h:13,
11 | from .../include/linux/types.h:5,
12 | from .../include/linux/mod_devicetable.h:11,
13 | from .../scripts/mod/devicetable-offsets.c:2:
14 | .../include/linux/compiler-gcc.h:121:1: fatal error: linux/compiler-gcc7.h: No such file or directory
15 | #include gcc_header(__GNUC__)
17 Upstream-Status: Pending
19 Signed-off-by: Trevor Woerner <twoerner@gmail.com>
20 Signed-off-by: Fabio Berton <fabio.berton@gmail.com>
21 Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
23 include/linux/compiler-gcc7.h | 66 +++++++++++++++++++++++++++++++++++++++++++
24 1 file changed, 66 insertions(+)
25 create mode 100644 include/linux/compiler-gcc7.h
27 diff --git a/include/linux/compiler-gcc7.h b/include/linux/compiler-gcc7.h
29 index 0000000..cdd1cc2
31 +++ b/include/linux/compiler-gcc7.h
33 +#ifndef __LINUX_COMPILER_H
34 +#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
37 +#define __used __attribute__((__used__))
38 +#define __must_check __attribute__((warn_unused_result))
39 +#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
41 +/* Mark functions as cold. gcc will assume any path leading to a call
42 + to them will be unlikely. This means a lot of manual unlikely()s
43 + are unnecessary now for any paths leading to the usual suspects
44 + like BUG(), printk(), panic() etc. [but let's keep them for now for
47 + Early snapshots of gcc 4.3 don't support this and we can't detect this
48 + in the preprocessor, but we can live with this because they're unreleased.
49 + Maketime probing would be overkill here.
51 + gcc also has a __attribute__((__hot__)) to move hot functions into
52 + a special section, but I don't see any sense in this right now in
53 + the kernel context */
54 +#define __cold __attribute__((__cold__))
56 +#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
59 +# define __compiletime_warning(message) __attribute__((warning(message)))
60 +# define __compiletime_error(message) __attribute__((error(message)))
61 +#endif /* __CHECKER__ */
64 + * Mark a position in code as unreachable. This can be used to
65 + * suppress control flow warnings after asm blocks that transfer
66 + * control elsewhere.
68 + * Early snapshots of gcc 4.5 don't support this and we can't detect
69 + * this in the preprocessor, but we can live with this because they're
70 + * unreleased. Really, we need to have autoconf for the kernel.
72 +#define unreachable() __builtin_unreachable()
74 +/* Mark a function definition as prohibited from being cloned. */
75 +#define __noclone __attribute__((__noclone__))
78 + * Tell the optimizer that something else uses this function or variable.
80 +#define __visible __attribute__((externally_visible))
83 + * GCC 'asm goto' miscompiles certain code sequences:
85 + * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
87 + * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
88 + * Fixed in GCC 4.8.2 and later versions.
90 + * (asm goto is automatically volatile - the naming reflects this.)
92 +#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
94 +#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
95 +#define __HAVE_BUILTIN_BSWAP32__
96 +#define __HAVE_BUILTIN_BSWAP64__
97 +#define __HAVE_BUILTIN_BSWAP16__
98 +#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */