]> Git Repo - linux.git/commitdiff
compiler.h: update definition of unreachable()
author[email protected] <[email protected]>
Mon, 15 Oct 2018 17:22:21 +0000 (10:22 -0700)
committerMiguel Ojeda <[email protected]>
Fri, 19 Oct 2018 06:47:14 +0000 (08:47 +0200)
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 <[email protected]>
Suggested-by: Josh Poimboeuf <[email protected]>
Tested-by: Nathan Chancellor <[email protected]>
Signed-off-by: Nick Desaulniers <[email protected]>
Signed-off-by: Miguel Ojeda <[email protected]>
include/linux/compiler.h

index b5fb034fa6fa161e2b8a29b3a7996bce2edf702b..2e0b6322588be044b84391e27741eb984d462104 100644 (file)
@@ -124,7 +124,10 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 # define ASM_UNREACHABLE
 #endif
 #ifndef unreachable
-# define unreachable() do { annotate_reachable(); do { } while (1); } while (0)
+# define unreachable() do {            \
+       annotate_unreachable();         \
+       __builtin_unreachable();        \
+} while (0)
 #endif
 
 /*
This page took 0.05971 seconds and 4 git commands to generate.