Commit 5b1f1f4aff912d8c8a98113d1af1fdaa2c9038a4
Committed by
Tom Rini
1 parent
ad21fbc118
Exists in
master
and in
49 other branches
Makefile: add a new script to check -fstack-usage support
If -fstack-usage option is given to crosstools that do not support it, gcc displays a warning message but still exits with status 0. This means we can not rely on $(call cc-option,...) to detect if -fstack-usage option is supported or not. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Showing 2 changed files with 21 additions and 1 deletions Side-by-side Diff
Makefile
... | ... | @@ -547,7 +547,9 @@ |
547 | 547 | KBUILD_AFLAGS += -g |
548 | 548 | |
549 | 549 | # Report stack usage if supported |
550 | -KBUILD_CFLAGS += $(call cc-option,-fstack-usage) | |
550 | +ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-stack-usage.sh $(CC)),y) | |
551 | + KBUILD_CFLAGS += -fstack-usage | |
552 | +endif | |
551 | 553 | |
552 | 554 | KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) |
553 | 555 |
scripts/gcc-stack-usage.sh
1 | +#!/bin/sh | |
2 | +# Test for gcc '-fstack-usage' support | |
3 | +# Copyright (C) 2013, Masahiro Yamada <yamada.m@jp.panasonic.com> | |
4 | +# | |
5 | +# SPDX-License-Identifier: GPL-2.0+ | |
6 | +# | |
7 | + | |
8 | +TMP="$$" | |
9 | + | |
10 | +cat <<END | $@ -Werror -fstack-usage -x c - -c -o $TMP >/dev/null 2>&1 \ | |
11 | + && echo "y" | |
12 | +int main(void) | |
13 | +{ | |
14 | + return 0; | |
15 | +} | |
16 | +END | |
17 | + | |
18 | +rm -f $TMP $TMP.su |