summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Kay <chris.kay@arm.com>2023-01-26 18:31:52 +0000
committerChris Kay <chris.kay@arm.com>2023-04-17 16:53:19 +0100
commitcef66c3e68d0398e2fe0f440df6894ca543a9abb (patch)
treee44d3326014b1c8f8921b9d8016ccede3eddb213
parentee62ab3f309100ebf62979cad11446ae79c7b488 (diff)
downloadarm-trusted-firmware-cef66c3e68d0398e2fe0f440df6894ca543a9abb.tar.gz
build(bl2): sort sections by alignment by default
This change forces LD to sort all input sections by alignment when allocating them within an output section. This is done in some places explicitly in the linker scripts today, but this makes sure we don't miss any easy targets. Change-Id: Id70be2a5399c4c75fcf2a736cab0991d20a6b863 Signed-off-by: Chris Kay <chris.kay@arm.com>
-rw-r--r--bl2/bl2.mk6
1 files changed, 6 insertions, 0 deletions
diff --git a/bl2/bl2.mk b/bl2/bl2.mk
index 778e2c3b6..41bcd127b 100644
--- a/bl2/bl2.mk
+++ b/bl2/bl2.mk
@@ -15,6 +15,12 @@ ifeq (${ARCH},aarch64)
BL2_SOURCES += common/aarch64/early_exceptions.S
endif
+ifneq ($(findstring gcc,$(notdir $(LD))),)
+ BL2_LDFLAGS += -Wl,--sort-section=alignment
+else ifneq ($(findstring ld,$(notdir $(LD))),)
+ BL2_LDFLAGS += --sort-section=alignment
+endif
+
ifeq (${ENABLE_RME},1)
# Using RME, run BL2 at EL3
include lib/gpt_rme/gpt_rme.mk