Skip to content

Commit 82017e2

Browse files
nickdesaulniersgregkh
authored andcommitted
compiler.h: update definition of unreachable()
[ Upstream commit fe0640e ] 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 <[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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 05e7885 commit 82017e2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

include/linux/compiler.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
119119
# define ASM_UNREACHABLE
120120
#endif
121121
#ifndef unreachable
122-
# define unreachable() do { annotate_reachable(); do { } while (1); } while (0)
122+
# define unreachable() do { \
123+
annotate_unreachable(); \
124+
__builtin_unreachable(); \
125+
} while (0)
123126
#endif
124127

125128
/*

0 commit comments

Comments
 (0)