Skip to contentSkip to conversation

x86-64, build: Always pass in -mno-sse

tip:x86/urgent tip-bot for H. Peter Anvin 3 participants 4 messages Dec 4, 2013 x86

lore
Share & tools
lore
#0 lore raw
Commit-ID:  5551a34e5aeab868f8d37f70d8754868921b4ee5
Gitweb:     http://git.kernel.org/tip/5551a34e5aeab868f8d37f70d8754868921b4ee5
Author:     H. Peter Anvin <[email protected]>
AuthorDate: Wed, 20 Nov 2013 13:31:49 -0800
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Tue, 3 Dec 2013 17:40:22 -0800

x86-64, build: Always pass in -mno-sse

Always pass in the -mno-sse argument, regardless if -preferred-stack-boundary is supported. We never want to generate SSE instructions in the kernel unless we *really* know what we're doing.

According to H. J. Lu, any version of gcc new enough that we support it at all should handle the -mno-sse option, so just add it unconditionally.

---
 arch/x86/Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/Makefile +7 -1
index 41250fb..eda00f9 100644
@@ -31,6 +31,9 @@ ifeq ($(CONFIG_X86_32),y)
 
         KBUILD_CFLAGS += -msoft-float -mregparm=3 -freg-struct-return
 
+        # Don't autogenerate SSE instructions
+	KBUILD_CFLAGS += -mno-sse
+
         # Never want PIC in a 32-bit kernel, prevent breakage with GCC built
         # with nonstandard options
         KBUILD_CFLAGS += -fno-pic
@@ -57,8 +60,11 @@ else
         KBUILD_AFLAGS += -m64
         KBUILD_CFLAGS += -m64
 
+        # Don't autogenerate SSE instructions
+	KBUILD_CFLAGS += -mno-sse
+
 	# Use -mpreferred-stack-boundary=3 if supported.
-	KBUILD_CFLAGS += $(call cc-option,-mno-sse -mpreferred-stack-boundary=3)
+	KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=3)
 
         # FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu)
         cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
#1 lore raw
Quoted 43 lines · tip-bot for H. Peter Anvin
Commit-ID:  5551a34e5aeab868f8d37f70d8754868921b4ee5
Gitweb:     http://git.kernel.org/tip/5551a34e5aeab868f8d37f70d8754868921b4ee5
Author:     H. Peter Anvin <[email protected]>
AuthorDate: Wed, 20 Nov 2013 13:31:49 -0800
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Tue, 3 Dec 2013 17:40:22 -0800

x86-64, build: Always pass in -mno-sse

Always pass in the -mno-sse argument, regardless if -preferred-stack-boundary is supported. We never want to generate SSE instructions in the kernel unless we *really* know what we're doing.

According to H. J. Lu, any version of gcc new enough that we support it at all should handle the -mno-sse option, so just add it unconditionally.

---
 arch/x86/Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/Makefile +3 -0
index 41250fb..eda00f9 100644
@@ -31,6 +31,9 @@ ifeq ($(CONFIG_X86_32),y)
 
         KBUILD_CFLAGS += -msoft-float -mregparm=3 -freg-struct-return
 
+        # Don't autogenerate SSE instructions
+	KBUILD_CFLAGS += -mno-sse
+
         # Never want PIC in a 32-bit kernel, prevent breakage with GCC built
         # with nonstandard options
         KBUILD_CFLAGS += -fno-pic
@@ -57,8 +60,11 @@ else
         KBUILD_AFLAGS += -m64
         KBUILD_CFLAGS += -m64

arch/x86/Makefile else · line 70

Quoted 10 lines
arch/x86/Makefile +4 -1
 
+        # Don't autogenerate SSE instructions
+	KBUILD_CFLAGS += -mno-sse
+
 	# Use -mpreferred-stack-boundary=3 if supported.
-	KBUILD_CFLAGS += $(call cc-option,-mno-sse -mpreferred-stack-boundary=3)
+	KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=3)
 
         # FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu)
         cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)

Just a detail I noticed: in kbuild we intentionally use 8 spaces for tabs in Makefiles and only use tabs for commands where tabs are required.

The above code introduces tabs in the middle of 8-space sequences. It works but is inconsistent.

Thanks,

Ingo

#2 lore raw

I can regenerate the patch if you want.

Quoted 74 lines · Ingo Molnar
Quoted 2 lines · tip-bot for H. Peter Anvin

Commit-ID: 5551a34e5aeab868f8d37f70d8754868921b4ee5 Gitweb:

http://git.kernel.org/tip/5551a34e5aeab868f8d37f70d8754868921b4ee5

Quoted 9 lines
Author:     H. Peter Anvin <[email protected]>
AuthorDate: Wed, 20 Nov 2013 13:31:49 -0800
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Tue, 3 Dec 2013 17:40:22 -0800

x86-64, build: Always pass in -mno-sse

Always pass in the -mno-sse argument, regardless if -preferred-stack-boundary is supported. We never want to generate

SSE

Quoted 10 lines

instructions in the kernel unless we *really* know what we're doing.

According to H. J. Lu, any version of gcc new enough that we support it at all should handle the -mno-sse option, so just add it unconditionally.

Link:

http://lkml.kernel.org/n/[email protected]

arch/x86/Makefile ifeq ($(CONFIG_X86_32),y) · line 32

Quoted 12 lines
Cc <[email protected]> # build fix only
---
 arch/x86/Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/Makefile +0 -0
index 41250fb..eda00f9 100644
@@ -31,6 +31,9 @@ ifeq ($(CONFIG_X86_32),y)
 
         KBUILD_CFLAGS += -msoft-float -mregparm=3

-freg-struct-return

arch/x86/Makefile ifeq ($(CONFIG_X86_32),y)

Quoted 5 lines
arch/x86/Makefile +3 -0
+        # Don't autogenerate SSE instructions
+	KBUILD_CFLAGS += -mno-sse
+
         # Never want PIC in a 32-bit kernel, prevent breakage with

GCC built

arch/x86/Makefile else · line 61

Quoted 11 lines
arch/x86/Makefile +3 -1
         # with nonstandard options
         KBUILD_CFLAGS += -fno-pic
@@ -57,8 +60,11 @@ else
         KBUILD_AFLAGS += -m64
         KBUILD_CFLAGS += -m64
 
+        # Don't autogenerate SSE instructions
+	KBUILD_CFLAGS += -mno-sse
+
 	# Use -mpreferred-stack-boundary=3 if supported.
-	KBUILD_CFLAGS += $(call cc-option,-mno-sse

-mpreferred-stack-boundary=3)

arch/x86/Makefile else

Quoted 3 lines
arch/x86/Makefile +1 -0
+	KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=3)
 
         # FIXME - should be integrated in Makefile.cpu

(Makefile_32.cpu)

arch/x86/Makefile else · line 70

Quoted 1 line
arch/x86/Makefile +0 -0
         cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)

Just a detail I noticed: in kbuild we intentionally use 8 spaces for tabs in Makefiles and only use tabs for commands where tabs are required.

The above code introduces tabs in the middle of 8-space sequences. It works but is inconsistent.

Thanks,

Ingo

Signature · 1 line
Sent from my mobile phone.  Please pardon brevity and lack of formatting.
#3 lore raw
Quoted 1 line · H. Peter Anvin

I can regenerate the patch if you want.

No need, I think a separate cleanup patch might be better (in a non-urgent branch), because currently a number of other lines in arch/x86/Makefile are violating this kbuild convention as well.

Thanks,

Ingo