summaryrefslogtreecommitdiff
path: root/Makefile.mk
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2024-08-23 01:01:36 +0200
committerElyes Haouas <ehaouas@noos.fr>2024-11-06 04:55:09 +0000
commit01dfc9b18730189445353422a5569e9d9865f5e3 (patch)
tree35d6490c9a71b5fa77a4c1019a4b393da48681ed /Makefile.mk
parente15b584961e682ba73210f96dfcab8ebfc5551bb (diff)
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>
Diffstat (limited to 'Makefile.mk')
-rw-r--r--Makefile.mk4
1 files changed, 3 insertions, 1 deletions
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"