[U-Boot] [PATCH] config.mk: enable -fstack-usage only when it is desired

Masahiro Yamada
2013-09-26T02:17:46Z

As far as I know, gcc does not support -fstack-usage
for some targets such as blackfin, m68k, microblaze, etc.

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.

To suppress warnings for such targets that -fstack-usage is not supported,
this commit surrounds the concerned lines with
ifdef CONFIG_CC_STACKUSAGE .. endif.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Rini <trini@ti.com>
---
config.mk | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/config.mk b/config.mk
index 48913f6..d405ab4 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)%=%))

--
1.8.1.2