Merge changes from topic "gcc_linker_aarch32" into integration
* changes:
feat(st): support gcc as linker
fix(build): allow gcc linker on Aarch32 platforms
diff --git a/Makefile b/Makefile
index 907ae21..6a2eeca 100644
--- a/Makefile
+++ b/Makefile
@@ -370,8 +370,10 @@
# 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 fa48dfc..d2d2fb1 100644
--- a/plat/st/common/common_rules.mk
+++ b/plat/st/common/common_rules.mk
@@ -57,7 +57,11 @@
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 $< $@