summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann Gautier <yann.gautier@foss.st.com>2023-03-09 13:45:24 +0100
committerYann Gautier <yann.gautier@st.com>2023-10-16 13:47:59 +0200
commit7762531216a599d98dcf88aef8f8e980e0db90ed (patch)
treeaee212f763e006396ab6f0b5b83febce074f1947
parentcfe6767f7dd483f1bd76b2ba88a75809e013c5bd (diff)
feat(st): support gcc as linker
One of the internal make rules for ST platforms uses the linker, but with dedicated options for ld. Adapt the rule to check if the linker is gcc and use updated options. Signed-off-by: Yann Gautier <yann.gautier@foss.st.com> Change-Id: If566dccfa329f9d34a80673a60c6fadd642a0231
-rw-r--r--plat/st/common/common_rules.mk4
1 files changed, 4 insertions, 0 deletions
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 $< $@