From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754369AbbG0Pwk (ORCPT ); Mon, 27 Jul 2015 11:52:40 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36023 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751910AbbG0Pwi (ORCPT ); Mon, 27 Jul 2015 11:52:38 -0400 Date: Mon, 27 Jul 2015 08:51:31 -0700 From: tip-bot for Andy Lutomirski Message-ID: Cc: luto@kernel.org, torvalds@linux-foundation.org, luto@amacapital.net, hpa@zytor.com, brgerst@gmail.com, bp@alien8.de, jack@suse.cz, dvlasenk@redhat.com, peterz@infradead.org, linux-kernel@vger.kernel.org, mingo@kernel.org, tglx@linutronix.de Reply-To: torvalds@linux-foundation.org, luto@kernel.org, hpa@zytor.com, luto@amacapital.net, bp@alien8.de, jack@suse.cz, dvlasenk@redhat.com, brgerst@gmail.com, tglx@linutronix.de, peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86/build: Fix detection of GCC -mpreferred-stack-boundary support Git-Commit-ID: b2c51106c7581866c37ffc77c5d739f3d4b7cbc9 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: b2c51106c7581866c37ffc77c5d739f3d4b7cbc9 Gitweb: http://git.kernel.org/tip/b2c51106c7581866c37ffc77c5d739f3d4b7cbc9 Author: Andy Lutomirski AuthorDate: Tue, 21 Jul 2015 09:27:18 -0700 Committer: Ingo Molnar CommitDate: Wed, 22 Jul 2015 08:20:29 +0200 x86/build: Fix detection of GCC -mpreferred-stack-boundary support As per: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383 GCC only allows -mpreferred-stack-boundary=3 on x86_64 if -mno-sse is set. That means that cc-option will not detect -mpreferred-stack-boundary=3 support, because we test for it before setting -mno-sse. Fix it by reordering the Makefile bits. Compile-tested only. This should help avoid code generation issues such as the one that was worked around in: b96fecbfa8c8 ("x86/fpu: Fix boot crash in the early FPU code") I'm a bit concerned that we could still have problems on older GCC versions given that our asm code does not respect GCC's idea of the ABI-required stack alignment. Signed-off-by: Andy Lutomirski Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Jan Kara Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/f5297c192969adfa0d28b84cf8a22d59573db26d.1436126872.git.luto@kernel.org Signed-off-by: Ingo Molnar --- arch/x86/Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 118e6de..054ff96 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -39,6 +39,16 @@ ifdef CONFIG_X86_NEED_RELOCS LDFLAGS_vmlinux := --emit-relocs endif +# +# Prevent GCC from generating any FP code by mistake. +# +# This must happen before we try the -mpreferred-stack-boundary, see: +# +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383 +# +KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow +KBUILD_CFLAGS += $(call cc-option,-mno-avx,) + ifeq ($(CONFIG_X86_32),y) BITS := 32 UTS_MACHINE := i386 @@ -167,9 +177,6 @@ KBUILD_CFLAGS += -pipe KBUILD_CFLAGS += -Wno-sign-compare # KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -# prevent gcc from generating any FP code by mistake -KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -KBUILD_CFLAGS += $(call cc-option,-mno-avx,) KBUILD_CFLAGS += $(mflags-y) KBUILD_AFLAGS += $(mflags-y)