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

Jeroen Hofstee
2013-09-27T17:57:23Z

Hello Masahiro,

On 09/27/2013 04:09 AM, Masahiro Yamada wrote:
>
>> The problem here is that except for whatever arches don't support
>> - -fstack-usage, we always want to generate this information, to assist in
>> debugging stack usage problems (which can be a real problem within SPL
>> for example). How about ifneq($(CONFIG_M68K)$(CONFIG_...),y) ... endif
>> around it?
> OK. This works.
>
> But I'm kind of afraid ifneq($(CONFIG_M68K)$(CONFIG_...),y) ... endif
> might be too arch-specific to be written in the top config.mk.
>
> Instead, we can add
> CONFIG_CC_STACKUSAGE=y
> to arch/{arm, powerpc, x86, microblaze ...}/config.mk

I guess below patch should work as well. Anyone aware
of any side affects it might cause?

---
Regards,
Jeroen

diff --git a/config.mk b/config.mk
index 48913f6..177f685 100644
--- a/config.mk
+++ b/config.mk
@@ -117,7 +117,7 @@ CC_TEST_OFILE :=
$(OBJTREE)/include/generated/cc_test_file.o
-include $(CC_OPTIONS_CACHE_FILE)

cc-option-sys = $(shell mkdir -p $(dir $(CC_TEST_OFILE)); \
- if $(CC) $(CFLAGS) $(1) -S -xc /dev/null -o
$(CC_TEST_OFILE) \
+ if $(CC) -Werror $(CFLAGS) $(1) -S -xc /dev/null -o
$(CC_TEST_OFILE) \
> /dev/null 2>&1; then \
echo 'CC_OPTIONS += $(strip $1)' >>
$(CC_OPTIONS_CACHE_FILE); \
echo "$(1)"; fi)