]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.113/compiler.h-update-definition-of-unreachable.patch
Linux 4.9.170
[thirdparty/kernel/stable-queue.git] / releases / 4.14.113 / compiler.h-update-definition-of-unreachable.patch
1 From 55aa856ef228dac6708a7ca0e8b678d49f47e59a Mon Sep 17 00:00:00 2001
2 From: "ndesaulniers@google.com" <ndesaulniers@google.com>
3 Date: Mon, 15 Oct 2018 10:22:21 -0700
4 Subject: compiler.h: update definition of unreachable()
5
6 [ Upstream commit fe0640eb30b7da261ae84d252ed9ed3c7e68dfd8 ]
7
8 Fixes the objtool warning seen with Clang:
9 arch/x86/mm/fault.o: warning: objtool: no_context()+0x220: unreachable
10 instruction
11
12 Fixes commit 815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h
13 mutually exclusive")
14
15 Josh noted that the fallback definition was meant to work around a
16 pre-gcc-4.6 bug. GCC still needs to work around
17 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365, so compiler-gcc.h
18 defines its own version of unreachable(). Clang and ICC can use this
19 shared definition.
20
21 Link: https://github.com/ClangBuiltLinux/linux/issues/204
22 Suggested-by: Andy Lutomirski <luto@amacapital.net>
23 Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
24 Tested-by: Nathan Chancellor <natechancellor@gmail.com>
25 Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
26 Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
27 Signed-off-by: Sasha Levin <sashal@kernel.org>
28 ---
29 include/linux/compiler.h | 5 ++++-
30 1 file changed, 4 insertions(+), 1 deletion(-)
31
32 diff --git a/include/linux/compiler.h b/include/linux/compiler.h
33 index a704d032713b..67c3934fb9ed 100644
34 --- a/include/linux/compiler.h
35 +++ b/include/linux/compiler.h
36 @@ -119,7 +119,10 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
37 # define ASM_UNREACHABLE
38 #endif
39 #ifndef unreachable
40 -# define unreachable() do { annotate_reachable(); do { } while (1); } while (0)
41 +# define unreachable() do { \
42 + annotate_unreachable(); \
43 + __builtin_unreachable(); \
44 +} while (0)
45 #endif
46
47 /*
48 --
49 2.19.1
50