public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: ynorov@caviumnetworks.com (Yury Norov)
To: linux-arm-kernel@lists.infradead.org
Subject: [question] kernel build fails with O0 gcc optimization flag
Date: Wed, 25 Nov 2015 22:56:52 +0300	[thread overview]
Message-ID: <20151125195652.GB8415@yury-N73SV> (raw)
In-Reply-To: <20151125180606.GM8644@n2100.arm.linux.org.uk>

On Wed, Nov 25, 2015 at 06:06:08PM +0000, Russell King - ARM Linux wrote:
> On Wed, Nov 25, 2015 at 08:12:29PM +0300, Yury Norov wrote:
> > Hi all.
> > 
> > I changed optimization from O2 to O0 in Makefile:
> >         609 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
> >         610 KBUILD_CFLAGS   += -Os $(call cc-disable-warning,maybe-uninitialized,)
> >         611 else
> >         612 KBUILD_CFLAGS   += -O2 <-- here
> >         613 endif
> 
> -O0 is not supported, sorry.
> 

If so, why not to notify explicitly?

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
 Makefile            | 2 +-
 arch/arm64/Makefile | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 418e98a..a2e8d3a 100644
--- a/Makefile
+++ b/Makefile
@@ -602,7 +602,6 @@ all: vmlinux
 ARCH_CPPFLAGS :=
 ARCH_AFLAGS :=
 ARCH_CFLAGS :=
-include arch/$(SRCARCH)/Makefile
 
 KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
 
@@ -775,6 +774,7 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
 	KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
 endif
 
+include arch/$(SRCARCH)/Makefile
 include scripts/Makefile.kasan
 include scripts/Makefile.extrawarn
 
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 432b69a..d865544 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -20,6 +20,10 @@ KBUILD_DEFCONFIG := defconfig
 # Check for binutils support for specific extensions
 lseinstr := $(call as-instr,.arch_extension lse,-DCONFIG_AS_LSE=1)
 
+# Check KBUILD_CFLAGS for  '-O0' as it's not supported now.
+$(if $(findstring -O0,$(KBUILD_CFLAGS)), \
+	$(error ARM64 does not support O0 optimization level. Try O1 or higher))
+
 ifeq ($(CONFIG_ARM64_LSE_ATOMICS), y)
   ifeq ($(lseinstr),)
 $(warning LSE atomics not supported by binutils)
-- 
2.5.0

      reply	other threads:[~2015-11-25 19:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 17:12 [question] kernel build fails with O0 gcc optimization flag Yury Norov
2015-11-25 17:45 ` Vladimir Murzin
2015-11-25 18:06 ` Russell King - ARM Linux
2015-11-25 19:56   ` Yury Norov [this message]

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=20151125195652.GB8415@yury-N73SV \
    --to=ynorov@caviumnetworks.com \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox