Skip to contentSkip to conversation

fix cc1 options to disable -fPIE when compiling with CONFIG_CC_STACKPROTECTOR=y

PATCH In review [email protected] 1 participant 2 messages Sep 13, 2010 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix cc1 options to disable -fPIE when compiling with CONFIG_CC_STACKPROTECTOR=y

The arch/x86/Makefile uses scripts/gcc-x86_$(BITS)-has-stack-protector.sh to check if cc1 supports -fstack-protector. When -fPIE is passed to cc1, these scripts fail causing stack protection to be disabled even when it is available.

This fix is similar to commit c47efe5548abbf53c2f66e06dcb46183b11d6b22

---
 arch/x86/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/Makefile +1 -1
index 8aa1b59..e8c8881 100644
@@ -74,7 +74,7 @@ endif
 
 ifdef CONFIG_CC_STACKPROTECTOR
 	cc_has_sp := $(srctree)/scripts/gcc-x86_$(BITS)-has-stack-protector.sh
-        ifeq ($(shell $(CONFIG_SHELL) $(cc_has_sp) $(CC) $(biarch)),y)
+        ifeq ($(shell $(CONFIG_SHELL) $(cc_has_sp) $(CC) $(KBUILD_CPPFLAGS) $(biarch)),y)
                 stackp-y := -fstack-protector
                 KBUILD_CFLAGS += $(stackp-y)
         else
#1 lore raw

[tip:x86/urgent] x86, build: Disable -fPIE when compiling with CONFIG_CC_STACKPROTECTOR=y

Commit-ID:  08c2b394b98786ebb067e2a54d08f1f6f0d247da
Gitweb:     http://git.kernel.org/tip/08c2b394b98786ebb067e2a54d08f1f6f0d247da
Author:     [email protected] <[email protected]>
AuthorDate: Mon, 13 Sep 2010 06:13:19 -0400
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Mon, 13 Sep 2010 15:53:16 -0700

x86, build: Disable -fPIE when compiling with CONFIG_CC_STACKPROTECTOR=y

The arch/x86/Makefile uses scripts/gcc-x86_$(BITS)-has-stack-protector.sh to check if cc1 supports -fstack-protector. When -fPIE is passed to cc1, these scripts fail causing stack protection to be disabled even when it is available.

This fix is similar to commit c47efe5548abbf53c2f66e06dcb46183b11d6b22

LKML-Reference: <[email protected]>

---
 arch/x86/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/Makefile +1 -1
index 8aa1b59..e8c8881 100644
@@ -74,7 +74,7 @@ endif
 
 ifdef CONFIG_CC_STACKPROTECTOR
 	cc_has_sp := $(srctree)/scripts/gcc-x86_$(BITS)-has-stack-protector.sh
-        ifeq ($(shell $(CONFIG_SHELL) $(cc_has_sp) $(CC) $(biarch)),y)
+        ifeq ($(shell $(CONFIG_SHELL) $(cc_has_sp) $(CC) $(KBUILD_CPPFLAGS) $(biarch)),y)
                 stackp-y := -fstack-protector
                 KBUILD_CFLAGS += $(stackp-y)
         else