All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@linux.intel.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: "Måns Rullgård" <mans@mansr.com>,
	"Russell King - ARM Linux" <linux@arm.linux.org.uk>,
	"Nicolas Pitre" <nico@fluxnic.net>,
	"Will Deacon" <Will.Deacon@arm.com>,
	lkml <linux-kernel@vger.kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	sam@ravnborg.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] Disable -fconserve-stack on ARM
Date: Tue, 31 May 2011 11:01:07 -0700	[thread overview]
Message-ID: <20110531180107.GA9261@alboin.amr.corp.intel.com> (raw)
In-Reply-To: <20110531163026.GB771@e102109-lin.cambridge.arm.com>

> 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@linux.intel.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: ak@linux.intel.com (Andi Kleen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] Disable -fconserve-stack on ARM
Date: Tue, 31 May 2011 11:01:07 -0700	[thread overview]
Message-ID: <20110531180107.GA9261@alboin.amr.corp.intel.com> (raw)
In-Reply-To: <20110531163026.GB771@e102109-lin.cambridge.arm.com>

> 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@linux.intel.com>

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

  reply	other threads:[~2011-05-31 18:01 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 11:16 [PATCH] ARM: Do not allow unaligned accesses when CONFIG_ALIGNMENT_TRAP Catalin Marinas
2011-05-23 12:30 ` Måns Rullgård
2011-05-23 13:25   ` Russell King - ARM Linux
2011-05-23 13:21 ` Russell King - ARM Linux
2011-05-23 13:51   ` Catalin Marinas
2011-05-23 14:37     ` Måns Rullgård
2011-05-23 14:41       ` Catalin Marinas
2011-05-23 14:52       ` Russell King - ARM Linux
2011-05-24  9:39   ` Catalin Marinas
2011-05-24 14:17     ` Måns Rullgård
2011-05-24 15:26       ` Catalin Marinas
2011-05-24 16:23         ` Måns Rullgård
2011-05-24 17:26           ` Nicolas Pitre
2011-05-24 17:13         ` Dave Martin
2011-05-25 11:14           ` Catalin Marinas
2011-05-25 12:43             ` Dave Martin
2011-05-25 13:32               ` Måns Rullgård
2011-05-25 14:05                 ` Dave Martin
2011-05-25 14:48                   ` Måns Rullgård
2011-05-25 14:50                 ` Catalin Marinas
2011-05-25 14:53                   ` Måns Rullgård
2011-05-26 17:10                   ` Will Deacon
2011-05-26 17:10                     ` Will Deacon
2011-05-26 18:14                     ` Måns Rullgård
2011-05-26 18:14                       ` Måns Rullgård
2011-05-26 19:58                     ` Andi Kleen
2011-05-26 19:58                       ` Andi Kleen
2011-05-26 21:03                     ` Nicolas Pitre
2011-05-26 21:03                       ` Nicolas Pitre
2011-05-26 21:10                       ` Andi Kleen
2011-05-26 21:10                         ` Andi Kleen
2011-05-26 21:26                         ` Måns Rullgård
2011-05-26 21:26                           ` Måns Rullgård
2011-05-27 10:05                         ` Will Deacon
2011-05-27 10:05                           ` Will Deacon
2011-05-27 16:53                           ` Andi Kleen
2011-05-27 16:53                             ` Andi Kleen
2011-05-26 21:51                       ` Russell King - ARM Linux
2011-05-26 21:51                         ` Russell King - ARM Linux
2011-05-26 22:29                         ` Andi Kleen
2011-05-26 22:29                           ` Andi Kleen
2011-05-27  8:38                         ` Catalin Marinas
2011-05-27  8:38                           ` Catalin Marinas
2011-05-27  8:54                           ` Russell King - ARM Linux
2011-05-27  8:54                             ` Russell King - ARM Linux
2011-05-27  9:51                             ` Catalin Marinas
2011-05-27  9:51                               ` Catalin Marinas
2011-05-27  9:56                               ` Catalin Marinas
2011-05-27  9:56                                 ` Catalin Marinas
2011-05-27 12:46                               ` Måns Rullgård
2011-05-27 12:46                                 ` Måns Rullgård
2011-05-28 15:34                                 ` [PATCH] Disable -fconserve-stack on ARM Andi Kleen
2011-05-28 15:34                                   ` Andi Kleen
2011-05-31 16:30                                   ` Catalin Marinas
2011-05-31 16:30                                     ` Catalin Marinas
2011-05-31 18:01                                     ` Andi Kleen [this message]
2011-05-31 18:01                                       ` Andi Kleen
2011-06-02 13:08                                       ` Catalin Marinas
2011-06-02 13:08                                         ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110531180107.GA9261@alboin.amr.corp.intel.com \
    --to=ak@linux.intel.com \
    --cc=Will.Deacon@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mans@mansr.com \
    --cc=nico@fluxnic.net \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.