From 01dfc9b18730189445353422a5569e9d9865f5e3 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Fri, 23 Aug 2024 01:01:36 +0200 Subject: [PATCH] Makefile.mk: Suppress stack-usage LTO link warning Suppress the following warning during linking with gcc: src/drivers/spi/spi_flash.c: In function 'spi_flash_cmd_write': src/drivers/spi/spi_flash.c:138:5: error: stack usage might be unbounded [-Werror=stack-usage=] 138 | int spi_flash_cmd_write(const struct spi_slave *spi, const u8 *cmd, Change-Id: If08d6d543a4fcff07003af8d1f8dd59ab79f42f8 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/84044 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- Makefile.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.mk b/Makefile.mk index 18ec01af49..ca79d053ad 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -1339,12 +1339,14 @@ ifeq ($(CONFIG_CBFS_VERIFICATION),y) fi endif # CONFIG_CBFS_VERIFICATION +LTO_LINK_CFLAGS := -Wno-stack-usage + define link_stage # $1 stage name ifeq ($(CONFIG_LTO),y) $$(objcbfs)/$(1).debug: $$$$($(1)-libs) $$$$($(1)-objs) @printf " LINK $$(subst $$(obj)/,,$$(@))\n" - $$(CC_$(1)) $$(CPPFLAGS_$(1)) $$(CFLAGS_$(1)) $$(LDFLAGS_$(1):%=-Wl,%) -o $$@ -L$$(obj) $$(COMPILER_RT_FLAGS_$(1):%=-Wl,%) -Wl,--whole-archive -Wl,--start-group $$(filter-out %.ld,$$($(1)-objs)) $$($(1)-libs) -Wl,--no-whole-archive $$(COMPILER_RT_$(1)) -Wl,--end-group -T $(call src-to-obj,$(1),$(CONFIG_MEMLAYOUT_LD_FILE)) + $$(CC_$(1)) $$(CPPFLAGS_$(1)) $$(CFLAGS_$(1)) $$(LDFLAGS_$(1):%=-Wl,%) $(LTO_LINK_CFLAGS) -o $$@ -L$$(obj) $$(COMPILER_RT_FLAGS_$(1):%=-Wl,%) -Wl,--whole-archive -Wl,--start-group $$(filter-out %.ld,$$($(1)-objs)) $$($(1)-libs) -Wl,--no-whole-archive $$(COMPILER_RT_$(1)) -Wl,--end-group -T $(call src-to-obj,$(1),$(CONFIG_MEMLAYOUT_LD_FILE)) else $$(objcbfs)/$(1).debug: $$$$($(1)-libs) $$$$($(1)-objs) @printf " LINK $$(subst $$(obj)/,,$$(@))\n"