x86/asm: Make objtool unreachable macros independent from GCC version
authorJosh Poimboeuf <jpoimboe@redhat.com>
Tue, 25 Jul 2017 14:44:51 +0000 (09:44 -0500)
committerIngo Molnar <mingo@kernel.org>
Tue, 25 Jul 2017 14:54:07 +0000 (16:54 +0200)
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>
include/linux/compiler-gcc.h

index 179375b2d862c18dbdeb5f0d74fe466e5620e246..17cbe3cffc0e17bfb6623ed7f8927105798951bf 100644 (file)
 #define __always_unused                __attribute__((unused))
 #define __mode(x)               __attribute__((mode(x)))
 
+#ifdef CONFIG_STACK_VALIDATION
+#define annotate_unreachable() ({                                      \
+       asm("%c0:\n\t"                                                  \
+           ".pushsection .discard.unreachable\n\t"                     \
+           ".long %c0b - .\n\t"                                        \
+           ".popsection\n\t" : : "i" (__LINE__));                      \
+})
+#define ASM_UNREACHABLE                                                        \
+       "999:\n\t"                                                      \
+       ".pushsection .discard.unreachable\n\t"                         \
+       ".long 999b - .\n\t"                                            \
+       ".popsection\n\t"
+#else
+#define annotate_unreachable()
+#endif
+
 /* gcc version specific checks */
 
 #if GCC_VERSION < 30200
 #endif
 #endif
 
-#ifdef CONFIG_STACK_VALIDATION
-#define annotate_unreachable() ({                                      \
-       asm("%c0:\n\t"                                                  \
-           ".pushsection .discard.unreachable\n\t"                     \
-           ".long %c0b - .\n\t"                                        \
-           ".popsection\n\t" : : "i" (__LINE__));                      \
-})
-#define ASM_UNREACHABLE                                                        \
-       "999:\n\t"                                                      \
-       ".pushsection .discard.unreachable\n\t"                         \
-       ".long 999b - .\n\t"                                            \
-       ".popsection\n\t"
-#else
-#define annotate_unreachable()
-#endif
-
 /*
  * Mark a position in code as unreachable.  This can be used to
  * suppress control flow warnings after asm blocks that transfer