Skip to content

Commit fe0640e

Browse files
nickdesaulniersojeda
authored andcommitted
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 815f0dd ("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: ClangBuiltLinux/linux#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>
1 parent f0604f6 commit fe0640e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎include/linux/compiler.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
124124
# define ASM_UNREACHABLE
125125
#endif
126126
#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)
128131
#endif
129132

130133
/*

0 commit comments

Comments
 (0)