From 20439b488e4e9449afbbf293373214114ad37b21 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 14 Oct 2015 11:03:41 -0400 Subject: [PATCH] gcc: build with -fstack-usage will generate an extra file that specifies the maximum amount of stack used, on a per-function basis. Using a static stack checker the data can be analysed, for example: http://dlbeer.co.nz/oss/avstack.html Change-Id: I23bd8ce7c4516bd0c7ffb74504e6d379677f25f8 Signed-off-by: Anas Nashif --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index acdf13648f0..9a4bfbf4243 100644 --- a/Makefile +++ b/Makefile @@ -670,6 +670,10 @@ KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign) # disable invalid "can't wrap" optimizations for signed / pointers KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) +# generate an extra file that specifies the maximum amount of stack used, +# on a per-function basis. +KBUILD_CFLAGS += $(call cc-option,-fstack-usage) + # conserve stack if available KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)