From patchwork Tue Oct 15 08:24:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 283540 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 146292C0185 for ; Tue, 15 Oct 2013 19:25:06 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6D6D14A0A2; Tue, 15 Oct 2013 10:25:02 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JAc2S28IHCCi; Tue, 15 Oct 2013 10:25:02 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 420B64A099; Tue, 15 Oct 2013 10:24:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C08CD4A099 for ; Tue, 15 Oct 2013 10:24:51 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id F2Wq3dmd32pd for ; Tue, 15 Oct 2013 10:24:46 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp.mei.co.jp (smtp.mei.co.jp [133.183.100.20]) by theia.denx.de (Postfix) with ESMTP id 7D6A64A098 for ; Tue, 15 Oct 2013 10:24:39 +0200 (CEST) Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile12) with ESMTP id r9F8OUSB003907; Tue, 15 Oct 2013 17:24:30 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili16) with ESMTP id r9F8OUL31038; Tue, 15 Oct 2013 17:24:30 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi16) id r9F8OUNn025033; Tue, 15 Oct 2013 17:24:30 +0900 Received: from poodle by lomi16.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id r9F8OUfH024962; Tue, 15 Oct 2013 17:24:30 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id 4D26D2743A5C; Tue, 15 Oct 2013 17:24:30 +0900 (JST) From: Masahiro Yamada To: u-boot@lists.denx.de Date: Tue, 15 Oct 2013 17:24:17 +0900 Message-Id: <1381825457-25971-1-git-send-email-yamada.m@jp.panasonic.com> X-Mailer: git-send-email 1.8.1.2 Cc: Tom Rini , Jeroen Hofstee Subject: [U-Boot] [PATCH v2] config.mk: disable -fstack-usage for blackfin and m68k X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Currently gcc does not seem to support -fstack-usage option for some targets, such as blackfin and m68k. If -fstack-usage option is given for those targets, gcc displays a warning message as follows: warning: -fstack-usage not supported for this target [enabled by default] But it still exits with status 0. So, # Report stack usage if supported CFLAGS_STACK := $(call cc-option,-fstack-usage) CFLAGS += $(CFLAGS_STACK) does not work as we expect because cc-option sees exit status to judge whether the given option is supported or not. Adding -Werror option to cc-option function does not work either, because gcc always succeeds in compiling /dev/null input with -fstack-usage option. We cannot rely on cc-option. To suppress warnings for such targets that -fstack-usage is not supported, this commit surrounds the concerned lines with ifdef CONFIG_CC_STACKUSAGE .. endif. And it adds CONFIG_CC_STACKUSAGE=y to arch/${ARCH}/config.mk except blackfin and m68k. Signed-off-by: Masahiro Yamada Cc: Tom Rini Cc: Michal Simek Cc: Jeroen Hofstee --- arch/arm/config.mk | 2 ++ arch/avr32/config.mk | 2 ++ arch/microblaze/config.mk | 2 ++ arch/mips/config.mk | 2 ++ arch/nds32/config.mk | 2 ++ arch/nios2/config.mk | 2 ++ arch/openrisc/config.mk | 2 ++ arch/powerpc/config.mk | 2 ++ arch/sandbox/config.mk | 2 ++ arch/sh/config.mk | 2 ++ arch/sparc/config.mk | 2 ++ arch/x86/config.mk | 2 ++ config.mk | 6 +++--- 13 files changed, 27 insertions(+), 3 deletions(-) diff --git a/arch/arm/config.mk b/arch/arm/config.mk index bdabcf4..f63336d 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -103,3 +103,5 @@ ALL-y += checkarmreloc # such usage by requiring word relocations. PLATFORM_CPPFLAGS += $(call cc-option, -mword-relocations) endif + +CONFIG_CC_STACKUSAGE=y diff --git a/arch/avr32/config.mk b/arch/avr32/config.mk index 4ab4745..39776fc 100644 --- a/arch/avr32/config.mk +++ b/arch/avr32/config.mk @@ -13,3 +13,5 @@ PLATFORM_RELFLAGS += -ffixed-r5 -fPIC -mno-init-got -mrelax PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections LDFLAGS_u-boot = --gc-sections --relax + +CONFIG_CC_STACKUSAGE=y diff --git a/arch/microblaze/config.mk b/arch/microblaze/config.mk index fc545a9..84a2325 100644 --- a/arch/microblaze/config.mk +++ b/arch/microblaze/config.mk @@ -15,3 +15,5 @@ CONFIG_STANDALONE_LOAD_ADDR ?= 0x80F00000 PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__ LDSCRIPT ?= $(SRCTREE)/$(CPUDIR)/u-boot.lds + +CONFIG_CC_STACKUSAGE=y diff --git a/arch/mips/config.mk b/arch/mips/config.mk index c3f81b5..c182956 100644 --- a/arch/mips/config.mk +++ b/arch/mips/config.mk @@ -51,3 +51,5 @@ PLATFORM_LDFLAGS += -G 0 -static -n -nostdlib $(ENDIANNESS) PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections LDFLAGS_FINAL += --gc-sections -pie OBJCFLAGS += --remove-section=.dynsym + +CONFIG_CC_STACKUSAGE=y diff --git a/arch/nds32/config.mk b/arch/nds32/config.mk index e93e3a8..97cb937 100644 --- a/arch/nds32/config.mk +++ b/arch/nds32/config.mk @@ -17,3 +17,5 @@ PLATFORM_RELFLAGS += -gdwarf-2 PLATFORM_CPPFLAGS += -DCONFIG_NDS32 -D__nds32__ -G0 -ffixed-10 -fpie LDFLAGS_u-boot = --gc-sections --relax + +CONFIG_CC_STACKUSAGE=y diff --git a/arch/nios2/config.mk b/arch/nios2/config.mk index 7d546ef..7ca6323 100644 --- a/arch/nios2/config.mk +++ b/arch/nios2/config.mk @@ -15,3 +15,5 @@ PLATFORM_CPPFLAGS += -G0 LDFLAGS_FINAL += --gc-sections PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections + +CONFIG_CC_STACKUSAGE=y diff --git a/arch/openrisc/config.mk b/arch/openrisc/config.mk index 13015eb..8694c1c 100644 --- a/arch/openrisc/config.mk +++ b/arch/openrisc/config.mk @@ -14,3 +14,5 @@ PLATFORM_CPPFLAGS += -DCONFIG_OPENRISC -D__OR1K__ -ffixed-r10 CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000 LDSCRIPT ?= $(SRCTREE)/$(CPUDIR)/u-boot.lds + +CONFIG_CC_STACKUSAGE=y diff --git a/arch/powerpc/config.mk b/arch/powerpc/config.mk index e6bb935..33fcc16 100644 --- a/arch/powerpc/config.mk +++ b/arch/powerpc/config.mk @@ -34,3 +34,5 @@ endif ifneq ($(CONFIG_SPL_BUILD),y) ALL-y += checkgcc4 endif + +CONFIG_CC_STACKUSAGE=y diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk index 6142dd4..49919f9 100644 --- a/arch/sandbox/config.mk +++ b/arch/sandbox/config.mk @@ -7,3 +7,5 @@ PLATFORM_LIBS += -lrt # Support generic board on sandbox __HAVE_ARCH_GENERIC_BOARD := y + +CONFIG_CC_STACKUSAGE=y diff --git a/arch/sh/config.mk b/arch/sh/config.mk index 758c070..10da053 100644 --- a/arch/sh/config.mk +++ b/arch/sh/config.mk @@ -15,3 +15,5 @@ endif PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__ PLATFORM_LDFLAGS += -e $(CONFIG_SYS_TEXT_BASE) --defsym reloc_dst=$(CONFIG_SYS_TEXT_BASE) LDFLAGS_FINAL = --gc-sections + +CONFIG_CC_STACKUSAGE=y diff --git a/arch/sparc/config.mk b/arch/sparc/config.mk index e94e7cb..c7a1b89 100644 --- a/arch/sparc/config.mk +++ b/arch/sparc/config.mk @@ -10,3 +10,5 @@ CROSS_COMPILE ?= sparc-elf- CONFIG_STANDALONE_LOAD_ADDR ?= 0x00000000 -L $(gcclibdir) -T sparc.lds PLATFORM_CPPFLAGS += -DCONFIG_SPARC -D__sparc__ + +CONFIG_CC_STACKUSAGE=y diff --git a/arch/x86/config.mk b/arch/x86/config.mk index b22959f..3a3b723 100644 --- a/arch/x86/config.mk +++ b/arch/x86/config.mk @@ -35,3 +35,5 @@ NORMAL_LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) PREFIXED_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/$(shell basename $(NORMAL_LIBGCC)) export USE_PRIVATE_LIBGCC=$(shell dirname $(PREFIXED_LIBGCC)) + +CONFIG_CC_STACKUSAGE=y diff --git a/config.mk b/config.mk index 3441387..811c10f 100644 --- a/config.mk +++ b/config.mk @@ -278,9 +278,9 @@ CFLAGS_WARN := $(call cc-option,-Wno-format-nonliteral) \ $(call cc-option,-Wno-format-security) CFLAGS += $(CFLAGS_WARN) -# Report stack usage if supported -CFLAGS_STACK := $(call cc-option,-fstack-usage) -CFLAGS += $(CFLAGS_STACK) +ifdef CONFIG_CC_STACKUSAGE +CFLAGS += $(call cc-option,-fstack-usage) +endif BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%))