diff mbox series

Makefile: Enable warnings for excessive stack usage

Message ID 20261014113848.2202759-1-samuel.holland@sifive.com
State New
Headers show
Series Makefile: Enable warnings for excessive stack usage | expand

Commit Message

Samuel Holland Oct. 14, 2026, 11:36 a.m. UTC
The default OpenSBI per-hart stack size is 4096 bytes
(SBI_PLATFORM_DEFAULT_HART_STACK_SIZE - SBI_SCRATCH_SIZE). Warn for any
function which uses over 25% of the stack, as this increases the risk
of a stack overflow. Currently only four functions have stack frames
larger than 10% of the default stack size when compiled with either gcc
or clang: fdt_parse_aplic_node(), fdt_reserved_memory_fixup(),
sbi_misaligned_v_ld_emulator(), and sbi_misaligned_v_st_emulator().

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
---

 Makefile | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 90bf7d5d..12e2a837 100644
--- a/Makefile
+++ b/Makefile
@@ -385,6 +385,7 @@  GENFLAGS	+=	$(platform-genflags-y)
 GENFLAGS	+=	$(firmware-genflags-y)
 
 CFLAGS		=	-g -Wall -Werror -ffreestanding -nostdlib -fno-stack-protector -fno-strict-aliasing -ffunction-sections -fdata-sections
+CFLAGS		+=	-Wframe-larger-than=1024
 CFLAGS		+=	-fno-omit-frame-pointer -fno-optimize-sibling-calls
 CFLAGS		+=	-fno-asynchronous-unwind-tables -fno-unwind-tables
 CFLAGS		+=	-std=gnu11