From: Jeroen Hofstee <jeroen@myspectrum.nl>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] config.mk: enable -fstack-usage only when it is desired
Date: Tue, 08 Oct 2013 21:46:30 +0200 [thread overview]
Message-ID: <52546116.1060105@myspectrum.nl> (raw)
In-Reply-To: <20130930170150.6DA6.AA925319@jp.panasonic.com>
Hello Masahiro,
On 09/30/2013 10:01 AM, Masahiro Yamada wrote:
> Hello 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)
>
>
> It looks like this was already suggested by Tom too.
> See http://patchwork.ozlabs.org/patch/183174/
>
> I tested this patch but unfortunatelly it did not work.
>
>
> I downloaded bfin-linux-gcc 4.6.3 from
> ftp://ftp.kernel.org/pub/tools/crosstool/index.html
>
> I added -Werror to config.mk and I tried:
>
> CROSS_COMPILE=bfin-linux- ./MAKEALL -a blackfin
>
> The log message was still sprinkled with lots of warnings like
> warning: -fstack-usage not supported for this target [enabled by default]
>
> So, I looked into it more closely and
> I found gcc can compile the input file /dev/null successfully
> even if -fstack-usage is not supported.
>
>
> $ bfin-uclinux-gcc -fstack-usage -S -xc /dev/null
> $ echo $?
> 0
> $ bfin-uclinux-gcc -Werror -fstack-usage -S -xc /dev/null
> $ echo $?
> 0
>
>
>
> Instead of /dev/null, I prepared a very simple C source code as an input.
>
> $ cat test.c
> int test(void)
> {
> return 0;
> }
> $ bfin-uclinux-gcc -fstack-usage -S -xc test.c
> test.c: In function 'test':
> test.c:4:1: warning: -fstack-usage not supported for this target [enabled by default]
> $ echo $?
> 0
> $ bfin-uclinux-gcc -fstack-usage -Werror -S -xc test.c
> test.c: In function 'test':
> test.c:4:1: error: -fstack-usage not supported for this target [-Werror]
> cc1: all warnings being treated as errors
> $ echo $?
> 1
>
> This time we can detect unsupported -fstack-usage by the exit status.
>
> So, along with -Werror, I think /dev/null should also be replaced
> with some _REAL_ C source file.
> But my concern about this treak is we might go far from Kbuild.
> In Linux Kernel, cc-option is impilemented in scripts/Kbuild.include.
> It uses /dev/null as input.
> I wish U-Boot would someday adopt (not nessarily the same but very
> similar) Kbuild.
>
> If you see Linux Kernel top Makefile,
> many of optional CFLAGS are provided thru cc-option and
> also can be turned on/off by CONFIG_ switch.
>
> That is one reason I suggested to introduce CONFIG_CC_STACKUSAGE option.
> But this is just my opinion and I would not necessarily stick to this idea.
> Please feel free to suggest your thought.
>
>
I tried to google this a bit, one thing I found was
http://sourceware.org/bugzilla/show_bug.cgi?id=5210, but I fail
to (easily) find a reliable gcc reference. Perhaps we should
file a bug? -Werror doesn't work with /dev/null when
-fstack-usage is not supported...
I cannot comment on your concern regarding Kbuild, since I
am unaware of its internals. I just suggested above since
it would be a cleaner approach (if it worked...).
Regards,
Jeroen
next prev parent reply other threads:[~2013-10-08 19:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-26 2:17 [U-Boot] [PATCH] config.mk: enable -fstack-usage only when it is desired Masahiro Yamada
2013-09-26 11:52 ` Tom Rini
2013-09-26 14:32 ` Michal Simek
2013-09-27 2:23 ` Masahiro Yamada
2013-09-27 8:13 ` Michal Simek
2013-09-27 2:09 ` Masahiro Yamada
2013-09-27 17:57 ` Jeroen Hofstee
2013-09-30 8:01 ` Masahiro Yamada
2013-10-08 19:46 ` Jeroen Hofstee [this message]
2013-10-15 10:51 ` Masahiro Yamada
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=52546116.1060105@myspectrum.nl \
--to=jeroen@myspectrum.nl \
--cc=u-boot@lists.denx.de \
/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