Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1695795

[PATCH] x86/asm: Make objtool unreachable macros independent from GCC version

From Josh Poimboeuf <jpoimboe@redhat.com>
Newsgroups linux.kernel
Subject [PATCH] x86/asm: Make objtool unreachable macros independent from GCC version
Date 2017-07-25 16:50 +0200
Message-ID <u79jP-420-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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>
Fixes: aa5d1b81500e ("x86/asm: Add ASM_UNREACHABLE")
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 include/linux/compiler-gcc.h | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 09428df81873..2a34493e4d04 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -128,6 +128,22 @@
 #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
@@ -203,22 +219,6 @@
 #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
-- 
2.13.3

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] x86/asm: Make objtool unreachable macros independent from GCC version Josh Poimboeuf <jpoimboe@redhat.com> - 2017-07-25 16:50 +0200
  [tip:x86/asm] x86/asm: Make objtool unreachable macros independent  from GCC version tip-bot for Josh Poimboeuf <tipbot@zytor.com> - 2017-07-25 17:10 +0200

csiph-web