Skip to content

Commit

Permalink
ta: link.mk: set linker max-page-size to 4K
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Jens Wiklander <[email protected]>
  • Loading branch information
jforissier committed Feb 8, 2019
1 parent 1095cc2 commit ce0bad5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ta/arch/arm/link.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ce0bad5

Please sign in to comment.