From patchwork Tue Oct 15 10:11:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 283563 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 90D4C2C011F for ; Tue, 15 Oct 2013 21:12:05 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 47BDF4A099; Tue, 15 Oct 2013 12:12:01 +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 tQ4IzFgApqap; Tue, 15 Oct 2013 12:12:01 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3722C4A09B; Tue, 15 Oct 2013 12:11:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EF9024A09B for ; Tue, 15 Oct 2013 12:11: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 CDQ22G+zLjDx for ; Tue, 15 Oct 2013 12:11: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 3B0FE4A099 for ; Tue, 15 Oct 2013 12:11:40 +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 r9FABUbE016442; Tue, 15 Oct 2013 19:11:30 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili12) with ESMTP id r9FABUo17075; Tue, 15 Oct 2013 19:11:30 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi14) id r9FABUcV000807; Tue, 15 Oct 2013 19:11:30 +0900 Received: from poodle by lomi14.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id r9FABUp5000782; Tue, 15 Oct 2013 19:11:30 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id 736122743A5C; Tue, 15 Oct 2013 19:11:30 +0900 (JST) From: Masahiro Yamada To: u-boot@lists.denx.de Date: Tue, 15 Oct 2013 19:11:26 +0900 Message-Id: <1381831886-26329-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 v3] config.mk: fix -fstack-usage support test 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 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,...) . Signed-off-by: Masahiro Yamada Cc: Tom Rini Cc: Michal Simek Cc: Jeroen Hofstee Cc: Albert ARIBAUD --- 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 +# +# 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