Re: [PATCH] Disable -fconserve-stack on ARM
From: Andi Kleen
Date: Tue May 31 2011 - 14:01:14 EST
> Didn't work, on the gcc command line we get -fno-conserve-stack followed
> by -fconserve-stack from the top makefile and it seems that the latter
> takes priority.
Ah ok need to move it up then too in the top level Makefile.
Like this.
-Andi
---
Disable -fconserve-stack on ARM v2
There are reports that -fconserve-stack misaligns variables on the stack.
Disable it for ARM to work around this gcc bug.
v2: Move top level flags definition up
Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
diff --git a/Makefile b/Makefile
index 529d93f..08d848f 100644
--- a/Makefile
+++ b/Makefile
@@ -564,6 +564,10 @@ else
KBUILD_CFLAGS += -O2
endif
+# conserve stack if available
+# do this early so that an architecture can override it.
+KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)
+
include $(srctree)/arch/$(SRCARCH)/Makefile
ifneq ($(CONFIG_FRAME_WARN),0)
@@ -629,9 +633,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign)
# disable invalid "can't wrap" optimizations for signed / pointers
KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
-# conserve stack if available
-KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)
-
# use the deterministic mode of AR if available
KBUILD_ARFLAGS := $(call ar-option,D)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index f5b2b39..902fec9 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -41,6 +41,10 @@ ifeq ($(CONFIG_CC_STACKPROTECTOR),y)
KBUILD_CFLAGS +=-fstack-protector
endif
+# ARM gcc developers unfortunately broke -fconserve-stack. It misaligns
+# variables on the stack
+KBUILD_CFLAGS += $(call cc-option,-fno-conserve-stack)
+
ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
KBUILD_CPPFLAGS += -mbig-endian
AS += -EB
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/