From 2ed0936dd07da8faed8748ac7e7eb5433c4c5081 Mon Sep 17 00:00:00 2001 From: Chris Kay Date: Thu, 26 Jan 2023 18:31:52 +0000 Subject: [PATCH] build(trp): 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: Ife89a8bb9e592b55c761d9a3dfefc2aeeb07802f Signed-off-by: Chris Kay --- services/std_svc/rmmd/trp/trp.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/std_svc/rmmd/trp/trp.mk b/services/std_svc/rmmd/trp/trp.mk index e511bf5d1..b7bd31762 100644 --- a/services/std_svc/rmmd/trp/trp.mk +++ b/services/std_svc/rmmd/trp/trp.mk @@ -10,6 +10,12 @@ RMM_SOURCES += services/std_svc/rmmd/trp/trp_entry.S \ RMM_DEFAULT_LINKER_SCRIPT_SOURCE := services/std_svc/rmmd/trp/linker.ld.S +ifneq ($(findstring gcc,$(notdir $(LD))),) + RMM_LDFLAGS += -Wl,--sort-section=alignment +else ifneq ($(findstring ld,$(notdir $(LD))),) + RMM_LDFLAGS += --sort-section=alignment +endif + # Include the platform-specific TRP Makefile # If no platform-specific TRP Makefile exists, it means TRP is not supported # on this platform. -- 2.39.5