aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compiler-gcc.h
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@redhat.com>2017-07-25 10:44:51 -0400
committerIngo Molnar <mingo@kernel.org>2017-07-25 10:54:07 -0400
commit1ee6f00d1164955b7bdadd36fc0f2736754784d9 (patch)
treedb21ec0742819644bdd017ad0ab7821bf928abd7 /include/linux/compiler-gcc.h
parentaa5d1b81500e6059190f18fe25a7617682321910 (diff)
x86/asm: Make objtool unreachable macros independent from GCC version
The ASM_UNREACHABLE macro isn't GCC version-specific, so move it outside the GCC 4.5+ check. Otherwise the 0-day robot will report objtool warnings for uses of ASM_UNREACHABLE with GCC 4.4. Also move the annotate_unreachable() macro so the related macros can stay together. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Kees Cook <keescook@chromium.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Fixes: aa5d1b81500e ("x86/asm: Add ASM_UNREACHABLE") Link: http://lkml.kernel.org/r/fb18337dbf230fd36450d9faf19a2b2533dbcba1.1500993873.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/compiler-gcc.h')
-rw-r--r--include/linux/compiler-gcc.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 179375b2d862..17cbe3cffc0e 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -128,6 +128,22 @@
128#define __always_unused __attribute__((unused)) 128#define __always_unused __attribute__((unused))
129#define __mode(x) __attribute__((mode(x))) 129#define __mode(x) __attribute__((mode(x)))
130 130
131#ifdef CONFIG_STACK_VALIDATION
132#define annotate_unreachable() ({ \
133 asm("%c0:\n\t" \
134 ".pushsection .discard.unreachable\n\t" \
135 ".long %c0b - .\n\t" \
136 ".popsection\n\t" : : "i" (__LINE__)); \
137})
138#define ASM_UNREACHABLE \
139 "999:\n\t" \
140 ".pushsection .discard.unreachable\n\t" \
141 ".long 999b - .\n\t" \
142 ".popsection\n\t"
143#else
144#define annotate_unreachable()
145#endif
146
131/* gcc version specific checks */ 147/* gcc version specific checks */
132 148
133#if GCC_VERSION < 30200 149#if GCC_VERSION < 30200
@@ -201,22 +217,6 @@
201#endif 217#endif
202#endif 218#endif
203 219
204#ifdef CONFIG_STACK_VALIDATION
205#define annotate_unreachable() ({ \
206 asm("%c0:\n\t" \
207 ".pushsection .discard.unreachable\n\t" \
208 ".long %c0b - .\n\t" \
209 ".popsection\n\t" : : "i" (__LINE__)); \
210})
211#define ASM_UNREACHABLE \
212 "999:\n\t" \
213 ".pushsection .discard.unreachable\n\t" \
214 ".long 999b - .\n\t" \
215 ".popsection\n\t"
216#else
217#define annotate_unreachable()
218#endif
219
220/* 220/*
221 * Mark a position in code as unreachable. This can be used to 221 * Mark a position in code as unreachable. This can be used to
222 * suppress control flow warnings after asm blocks that transfer 222 * suppress control flow warnings after asm blocks that transfer