diff options
author | ndesaulniers@google.com <ndesaulniers@google.com> | 2018-10-15 13:22:21 -0400 |
---|---|---|
committer | Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> | 2018-10-19 02:47:14 -0400 |
commit | fe0640eb30b7da261ae84d252ed9ed3c7e68dfd8 (patch) | |
tree | 60b6fe584227bfc65fcc7ec15e9ab251716b1c2a | |
parent | f0604f63033d4020f019d2aaee805c1075b1077b (diff) |
compiler.h: update definition of unreachable()
Fixes the objtool warning seen with Clang:
arch/x86/mm/fault.o: warning: objtool: no_context()+0x220: unreachable
instruction
Fixes commit 815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h
mutually exclusive")
Josh noted that the fallback definition was meant to work around a
pre-gcc-4.6 bug. GCC still needs to work around
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365, so compiler-gcc.h
defines its own version of unreachable(). Clang and ICC can use this
shared definition.
Link: https://github.com/ClangBuiltLinux/linux/issues/204
Suggested-by: Andy Lutomirski <luto@amacapital.net>
Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
-rw-r--r-- | include/linux/compiler.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index b5fb034fa6fa..2e0b6322588b 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -124,7 +124,10 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, | |||
124 | # define ASM_UNREACHABLE | 124 | # define ASM_UNREACHABLE |
125 | #endif | 125 | #endif |
126 | #ifndef unreachable | 126 | #ifndef unreachable |
127 | # define unreachable() do { annotate_reachable(); do { } while (1); } while (0) | 127 | # define unreachable() do { \ |
128 | annotate_unreachable(); \ | ||
129 | __builtin_unreachable(); \ | ||
130 | } while (0) | ||
128 | #endif | 131 | #endif |
129 | 132 | ||
130 | /* | 133 | /* |