summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManish Pandey <manish.pandey2@arm.com>2023-10-23 17:59:26 +0200
committerTrustedFirmware Code Review <review@review.trustedfirmware.org>2023-10-23 17:59:26 +0200
commit3018854b5f229939544ad09c93199ec7b66df358 (patch)
tree4a306110d9df1cc7ce6bb464d522658190d5b6f4
parenteab006e5910e831ef043ce7cfdc42aebfa36fd40 (diff)
parent7762531216a599d98dcf88aef8f8e980e0db90ed (diff)
Merge changes from topic "gcc_linker_aarch32" into integration
* changes: feat(st): support gcc as linker fix(build): allow gcc linker on Aarch32 platforms
-rw-r--r--Makefile6
-rw-r--r--plat/st/common/common_rules.mk4
2 files changed, 8 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 907ae21d4..6a2eeca1a 100644
--- a/Makefile
+++ b/Makefile
@@ -370,8 +370,10 @@ else ifneq ($(findstring gcc,$(notdir $(LD))),)
# GCC automatically adds fix-cortex-a53-843419 flag when used to link
# which breaks some builds, so disable if errata fix is not explicitly enabled
- ifneq (${ERRATA_A53_843419},1)
- TF_LDFLAGS += -mno-fix-cortex-a53-843419
+ ifeq (${ARCH},aarch64)
+ ifneq (${ERRATA_A53_843419},1)
+ TF_LDFLAGS += -mno-fix-cortex-a53-843419
+ endif
endif
TF_LDFLAGS += -nostdlib
TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
diff --git a/plat/st/common/common_rules.mk b/plat/st/common/common_rules.mk
index fa48dfcff..d2d2fb13a 100644
--- a/plat/st/common/common_rules.mk
+++ b/plat/st/common/common_rules.mk
@@ -57,7 +57,11 @@ $(eval $(call MAKE_LD,${STM32_TF_LINKERFILE},$(STM32_LD_FILE),bl2))
tf-a-%.elf: $(PLAT)-%.o ${STM32_TF_LINKERFILE}
@echo " LDS $<"
+ifneq ($(findstring gcc,$(notdir $(LD))),)
+ ${Q}${LD} -o $@ $(subst --,-Wl$(comma)--,${STM32_TF_ELF_LDFLAGS}) -nostartfiles -Wl,-Map=$(@:.elf=.map) -Wl,-dT ${STM32_TF_LINKERFILE} $<
+else
${Q}${LD} -o $@ ${STM32_TF_ELF_LDFLAGS} -Map=$(@:.elf=.map) --script ${STM32_TF_LINKERFILE} $<
+endif
tf-a-%.bin: tf-a-%.elf
${Q}${OC} -O binary $< $@