Skip to content

Commit

Permalink
build: communicate correct page size to linker
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
CJKay committed Feb 15, 2023
1 parent be2a050 commit ac98b82
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit ac98b82

Please sign in to comment.