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 <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84044
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Arthur Heymans 2024-08-23 01:01:36 +02:00 committed by Elyes Haouas
commit 01dfc9b187

View file

@ -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"