Skip to content

Commit 0f4fb39

Browse files
committed
Ensure apps are linked with 4k page size
All our lds assume a 4k alignment. Without this, on archs like aarch64 where the linker may assume a larger page size (64k), gnu ld will end up merging .text and .data sections into the same segment. This results in the segment being RWE which will cause a fatal warning (and is a bad thing anyways) Signed-off-by: Benjamin Herrenschmidt <[email protected]>
1 parent d51a8ff commit 0f4fb39

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

apps/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ LDFLAGS += --defsym=EFI_SUBSYSTEM=$(SUBSYSTEM)
8282

8383
endif
8484

85+
# On some archs, binutils can have a larger max page size. All our .lds
86+
# assume 4k however, and without this, they might end up blending .text
87+
# and .data into the same segment, making it RWE
88+
LDFLAGS += -z max-page-size=4096
89+
8590
TARGETS = $(TARGET_APPS) $(TARGET_BSDRIVERS) $(TARGET_RTDRIVERS)
8691

8792
all: $(TARGETS)

0 commit comments

Comments
 (0)