From ce0bad5535aa5813f30da471a694d6cf5bc1d959 Mon Sep 17 00:00:00 2001 From: Jerome Forissier Date: Thu, 7 Feb 2019 15:15:51 +0100 Subject: ta: link.mk: set linker max-page-size to 4K TA binaries contain a lot of zero padding (almost 64 KiB) between sections .ta_head and .text. This value can be reduced to 4 KiB by reducing the linker's max-page-size parameter. Since the OP-TEE ELF loader always aligns on small page boundaries, it does not make sense to request a larger alignment. This patch adds "-z max-page-size=4096" to the linker flags so that the alignment constraints are relaxed from 64 KiB (the default for our 32 and 64 targets as it seems) to what OP-TEE is actually expecting (4 KiB). The TA file size is reduced by 60 KiB. It changes nothing to the layout of the TA in memory. Signed-off-by: Jerome Forissier Reviewed-by: Jens Wiklander --- ta/arch/arm/link.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'ta/arch') diff --git a/ta/arch/arm/link.mk b/ta/arch/arm/link.mk index c465629f..21ceb471 100644 --- a/ta/arch/arm/link.mk +++ b/ta/arch/arm/link.mk @@ -19,6 +19,7 @@ link-ldflags = -pie link-ldflags += -T $(link-script-pp$(sm)) link-ldflags += -Map=$(link-out-dir$(sm))/$(user-ta-uuid).map link-ldflags += --sort-section=alignment +link-ldflags += -z max-page-size=4096 # OP-TEE always uses 4K alignment link-ldadd = $(user-ta-ldadd) $(addprefix -L,$(libdirs)) link-ldadd += --start-group $(addprefix -l,$(libnames)) --end-group -- cgit v1.2.3