Skip to contentSkip to conversation

Stack protector Makefile breakage on x86_64

PATCH Superseded George Spelvin 2 participants 3 messages Mar 19, 2014 – May 7, 2014 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Stack protector Makefile breakage on x86_64

If you are using a 64-bit kernel with 32-bit userland, then scripts/gcc-x86_64-has-stack-protector.sh invokes -32-bit gcc with -mcmodel=kernel, which produces:

<stdin>:1:0: error: code model 'kernel' not supported in the 32 bit mode

and trips the "broken compiler" test at arch/x86/Makefile:118.

There are several places a fix is possible, but the following seems cleanest. (But it's minimal; it would also be possible to factor out a bunch of stuff from the two btanches of the if.)

arch/x86/Makefile +1 -0
index eeda43abed..c6c61361c3 100644
@@ -79,6 +79,7 @@ else
         UTS_MACHINE := x86_64
         CHECKFLAGS += -D__x86_64__ -m64
 
+        biarch := -m64
         KBUILD_AFLAGS += -m64
         KBUILD_CFLAGS += -m64
#1 lore raw

PATCH RESEND 1/1 Fix stack protector Makefile breakage on x86_64

If you are using a 64-bit kernel with 32-bit userland, then scripts/gcc-x86_64-has-stack-protector.sh invokes 32-bit gcc with -mcmodel=kernel, which produces:

<stdin>:1:0: error: code model 'kernel' not supported in the 32 bit mode

and trips the "broken compiler" test at arch/x86/Makefile:120.

There are several places a fix is possible, but the following seems cleanest. (But it's minimal; it would also be possible to factor out a bunch of stuff from the two branches of the if.)

---
Originally sent March 19 (but elicited no response), this is still an issue with 3.15-rc4, and still applies without changes.

Sending to some general Linux-x86 people as well as the authors of the stack-protector patch that caused the problem. Feel free to fix it a different way, but could we please fix it?

arch/x86/Makefile +1 -0
index eeda43abed..c6c61361c3 100644
@@ -79,6 +79,7 @@ else
         UTS_MACHINE := x86_64
         CHECKFLAGS += -D__x86_64__ -m64
 
+        biarch := -m64
         KBUILD_AFLAGS += -m64
         KBUILD_CFLAGS += -m64
 
#2 lore raw

[tip:x86/urgent] x86-64, build: Fix stack protector Makefile breakage with 32-bit userland

x86-64, build: Fix stack protector Makefile breakage with 32-bit userland
Commit-ID:  14262d67fe348018af368a07430fbc06eadeabb1
Gitweb:     http://git.kernel.org/tip/14262d67fe348018af368a07430fbc06eadeabb1
Author:     George Spelvin <[email protected]>
AuthorDate: Wed, 7 May 2014 17:05:52 -0400
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Wed, 7 May 2014 14:14:44 -0700

x86-64, build: Fix stack protector Makefile breakage with 32-bit userland

If you are using a 64-bit kernel with 32-bit userland, then scripts/gcc-x86_64-has-stack-protector.sh invokes 32-bit gcc with -mcmodel=kernel, which produces:

<stdin>:1:0: error: code model 'kernel' not supported in the 32 bit mode

and trips the "broken compiler" test at arch/x86/Makefile:120.

There are several places a fix is possible, but the following seems cleanest. (But it's minimal; it would also be possible to factor out a bunch of stuff from the two branches of the if.)

---
 arch/x86/Makefile | 1 +
 1 file changed, 1 insertion(+)
arch/x86/Makefile +1 -0
index ce6ad7e..33f71b0 100644
@@ -79,6 +79,7 @@ else
         UTS_MACHINE := x86_64
         CHECKFLAGS += -D__x86_64__ -m64
 
+        biarch := -m64
         KBUILD_AFLAGS += -m64
         KBUILD_CFLAGS += -m64