From ac98b82a1f2e1ee323967a8a80e496e82ad9a832 Mon Sep 17 00:00:00 2001 From: Chris Kay Date: Thu, 22 Dec 2022 13:26:37 +0000 Subject: [PATCH] build: communicate correct page size to linker This change communicates the common and maximum page sizes to the linker, which allows us to use the built-in constants that it provides to deal with page alignments. We only support 4K pages today so the fact these are fixed is not too much of an issue, but we will need to revisit this if we ever support other page sizes. Change-Id: I3358c51e70df794025ddf25209ae0e2a96550b0e Signed-off-by: Chris Kay --- Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 578083221..a69bfbb3b 100644 --- a/Makefile +++ b/Makefile @@ -456,6 +456,10 @@ else ifneq ($(findstring gcc,$(notdir $(LD))),) # Pass ld options with Wl or Xlinker switches TF_LDFLAGS += -Wl,--fatal-warnings -O1 TF_LDFLAGS += -Wl,--gc-sections + +TF_LDFLAGS += -Wl,-z,common-page-size=4096 # Configure page size constants +TF_LDFLAGS += -Wl,-z,max-page-size=4096 + ifeq ($(ENABLE_LTO),1) ifeq (${ARCH},aarch64) TF_LDFLAGS += -flto -fuse-linker-plugin @@ -473,6 +477,10 @@ TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH))) else TF_LDFLAGS += -O1 TF_LDFLAGS += --gc-sections + +TF_LDFLAGS += -z common-page-size=4096 # Configure page size constants +TF_LDFLAGS += -z max-page-size=4096 + # ld.lld doesn't recognize the errata flags, # therefore don't add those in that case. # ld.lld reports section type mismatch warnings,