From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752389AbdGYPCc (ORCPT ); Tue, 25 Jul 2017 11:02:32 -0400 Received: from terminus.zytor.com ([65.50.211.136]:54853 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752068AbdGYPCb (ORCPT ); Tue, 25 Jul 2017 11:02:31 -0400 Date: Tue, 25 Jul 2017 07:57:48 -0700 From: tip-bot for Josh Poimboeuf Message-ID: Cc: linux-kernel@vger.kernel.org, keescook@chromium.org, torvalds@linux-foundation.org, hpa@zytor.com, tglx@linutronix.de, fengguang.wu@intel.com, peterz@infradead.org, jpoimboe@redhat.com, mingo@kernel.org Reply-To: fengguang.wu@intel.com, tglx@linutronix.de, hpa@zytor.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, keescook@chromium.org, mingo@kernel.org, jpoimboe@redhat.com, peterz@infradead.org In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86/asm: Make objtool unreachable macros independent from GCC version Git-Commit-ID: 1ee6f00d1164955b7bdadd36fc0f2736754784d9 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 1ee6f00d1164955b7bdadd36fc0f2736754784d9 Gitweb: http://git.kernel.org/tip/1ee6f00d1164955b7bdadd36fc0f2736754784d9 Author: Josh Poimboeuf AuthorDate: Tue, 25 Jul 2017 09:44:51 -0500 Committer: Ingo Molnar CommitDate: Tue, 25 Jul 2017 16:54:07 +0200 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 Signed-off-by: Josh Poimboeuf Cc: Kees Cook Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Fixes: aa5d1b81500e ("x86/asm: Add ASM_UNREACHABLE") Link: http://lkml.kernel.org/r/fb18337dbf230fd36450d9faf19a2b2533dbcba1.1500993873.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar --- 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 179375b..17cbe3c 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 @@ -201,22 +217,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