public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3] config.mk: fix -fstack-usage support test
Date: Tue, 15 Oct 2013 12:21:45 +0200	[thread overview]
Message-ID: <20131015122145.3f5ac830@lilith> (raw)
In-Reply-To: <1381831886-26329-1-git-send-email-yamada.m@jp.panasonic.com>

Hi Masahiro,

On Tue, 15 Oct 2013 19:11:26 +0900, Masahiro Yamada
<yamada.m@jp.panasonic.com> wrote:

> If -fstack-usage option is given for such architecures
> that do not support it, gcc displays a warning message
> but still exits with status 0.
> 
> This commits adds a new scripts to test -fstack-usage support
> because we cannot rely on $(call cc-option,...) .

Much better than the previous one (with a nitpick: superfluous "s" in
"This commits")... But now we lack the rationale part, which was
dropped rather than moved after the '---' line. 

Regarding the patch itself, why a shell script rather than a variant
of cc-option?

> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Jeroen Hofstee <jeroen@myspectrum.nl>
> Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
> ---
>  config.mk                  |  5 +++--
>  scripts/gcc-stack-usage.sh | 18 ++++++++++++++++++
>  2 files changed, 21 insertions(+), 2 deletions(-)
>  create mode 100755 scripts/gcc-stack-usage.sh
> 
> diff --git a/config.mk b/config.mk
> index 3441387..8a82ab4 100644
> --- a/config.mk
> +++ b/config.mk
> @@ -279,8 +279,9 @@ CFLAGS_WARN := $(call cc-option,-Wno-format-nonliteral) \
>  CFLAGS += $(CFLAGS_WARN)
>  
>  # Report stack usage if supported
> -CFLAGS_STACK := $(call cc-option,-fstack-usage)
> -CFLAGS += $(CFLAGS_STACK)
> +ifeq ($(shell $(SHELL) $(SRCTREE)/scripts/gcc-stack-usage.sh $(CC)), y)
> +	CFLAGS += -fstack-usage
> +endif
>  
>  BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%))
>  
> diff --git a/scripts/gcc-stack-usage.sh b/scripts/gcc-stack-usage.sh
> new file mode 100755
> index 0000000..53eb10a
> --- /dev/null
> +++ b/scripts/gcc-stack-usage.sh
> @@ -0,0 +1,18 @@
> +#!/bin/sh
> +# Test for gcc '-fstack-usage' support
> +# Copyright (C) 2013, Masahiro Yamada <yamada.m@jp.panasonic.com>
> +#
> +# SPDX-License-Identifier:	GPL-2.0+
> +#
> +
> +TMP=${OBJTREE}/"$$"
> +
> +cat << "END" | $@ -Werror -fstack-usage -x c - -c -o $TMP >/dev/null 2>&1 \
> +							&& echo "y"
> +int main(void)
> +{
> +	return 0;
> +}
> +END
> +
> +rm -f $TMP $TMP.su


Amicalement,
-- 
Albert.

  reply	other threads:[~2013-10-15 10:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-15 10:11 [U-Boot] [PATCH v3] config.mk: fix -fstack-usage support test Masahiro Yamada
2013-10-15 10:21 ` Albert ARIBAUD [this message]
2013-10-15 11:15   ` Masahiro Yamada
2013-10-15 11:29     ` Albert ARIBAUD

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=20131015122145.3f5ac830@lilith \
    --to=albert.u.boot@aribaud.net \
    --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