toolchain: detect use of large stack variables

partition/fs_gpt.c:384:5: warning: stack usage might be 288 bytes [-Wstack-usage=]
  384 | int parse_gpt_partition(FAR struct partition_state_s *state,

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2023-08-15 17:16:01 +08:00 committed by Petro Karashchenko
parent d3bca3c2cf
commit 88f3bc77f1
7 changed files with 31 additions and 0 deletions

View File

@ -2073,6 +2073,13 @@ config STACK_USAGE
on a per-function basis. Please use https://github.com/HBehrens/puncover
or tools/showstack.sh to generate the more useful report.
config STACK_USAGE_WARNING
int "Detect use of large stack variables"
default 0
help
Set the stack warning threshold, if the stack usage exceeds the
threshold, a warning will be generated
config ARCH_HAVE_HEAPCHECK
bool
default n

View File

@ -58,6 +58,10 @@ ifeq ($(CONFIG_STACK_USAGE),y)
ARCHOPTIMIZATION += -fstack-usage
endif
ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
endif
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
endif

View File

@ -69,6 +69,10 @@ ifeq ($(CONFIG_STACK_USAGE),y)
ARCHOPTIMIZATION += -fstack-usage
endif
ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
endif
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
endif

View File

@ -65,6 +65,10 @@ if(CONFIG_STACK_USAGE)
add_compile_options(-fstack-usage)
endif()
if(CONFIG_STACK_USAGE_WARNING)
add_compile_options(-Wstack-usage=${CONFIG_STACK_USAGE_WARNING})
endif()
if(CONFIG_ARCH_COVERAGE)
add_compile_options(-fprofile-generate -ftest-coverage)
endif()

View File

@ -79,6 +79,10 @@ ifeq ($(CONFIG_STACK_USAGE),y)
ARCHOPTIMIZATION += -fstack-usage
endif
ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
endif
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
endif

View File

@ -79,6 +79,10 @@ ifeq ($(CONFIG_STACK_USAGE),y)
ARCHOPTIMIZATION += -fstack-usage
endif
ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
endif
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
endif

View File

@ -68,6 +68,10 @@ ifeq ($(CONFIG_STACK_USAGE),y)
ARCHOPTIMIZATION += -fstack-usage
endif
ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
endif
ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y)
ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage
endif