summaryrefslogtreecommitdiff
path: root/make_helpers
diff options
context:
space:
mode:
authorBoyan Karatotev <boyan.karatotev@arm.com>2026-02-02 09:26:03 +0000
committerBoyan Karatotev <boyan.karatotev@arm.com>2026-02-02 09:29:51 +0000
commitee0f27388fcad40e8ef3b094ef7c84215727d00b (patch)
treee273b3a76e59d3f7d064faa66867bfe66fbe0414 /make_helpers
parent19b6c707b09db7379d97ba9b12242c95f930a38d (diff)
downloadarm-trusted-firmware-ee0f27388fcad40e8ef3b094ef7c84215727d00b.tar.gz
arm-trusted-firmware-ee0f27388fcad40e8ef3b094ef7c84215727d00b.zip
fix(build): pass -flto-partition to the linker and not the compiler
It's irrelevant to the compiler, although most of the times it gets enabled when compiler==linker so this doesn't show up. It is possible that compiler!=linker (eg compiler=armclang, linker=gcc) with LTO enabled though. Then this blows up since the check was done on the linker and the argument passed to the compiler. Change-Id: Ibc740599c71e892cae873976fed35e1b57658ff4 Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Diffstat (limited to 'make_helpers')
-rw-r--r--make_helpers/cflags.mk12
1 files changed, 6 insertions, 6 deletions
diff --git a/make_helpers/cflags.mk b/make_helpers/cflags.mk
index e8afa0079..680567396 100644
--- a/make_helpers/cflags.mk
+++ b/make_helpers/cflags.mk
@@ -140,12 +140,6 @@ ifneq ($(PIE_FOUND),)
cflags-common += -fno-PIE
endif
-ifeq ($(ENABLE_LTO),1)
-ifeq ($($(ARCH)-ld-id),gnu-gcc)
- cflags-common += -flto-partition=one
-endif
-endif
-
cflags-common += $(TF_CFLAGS_$(ARCH))
cflags-common += $(CPPFLAGS) $(CFLAGS) # some platforms set these
TF_CFLAGS += $(cflags-common)
@@ -176,6 +170,12 @@ else
ldflags-common := -fuse-ld=lld
endif
+ ifeq ($(ENABLE_LTO),1)
+ ifeq ($($(ARCH)-ld-id),gnu-gcc)
+ ldflags-common += -flto-partition=one
+ endif
+ endif
+
ldflags-common += $(call ld_option,--no-warn-rwx-segments)
# ld.lld reports section type mismatch warnings,
# so don't add --fatal-warnings to it.