Skip to content

Commit

Permalink
Build with 16K page sizes in mind on aarch64
Browse files Browse the repository at this point in the history
By default binutils on buildroot aligns sections to 4kb boundaries, but
there are several 16k only linux distros out there now that default to
16kb pages.

With this change the elf files will have their sections aligned to 16kb
boundaries which should ensure binaries produced with the toolchain work
on most aarch64 linuxes.
  • Loading branch information
hpvb committed Dec 12, 2023
1 parent d18f672 commit 689b43e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions arch/arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ GCC_TARGET_FLOAT_ABI := $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI))
GCC_TARGET_MODE := $(call qstrip,$(BR2_GCC_TARGET_MODE))

# Explicitly set LD's "max-page-size" instead of relying on some defaults
ifeq ($(BR2_ARC_PAGE_SIZE_4K)$(BR2_ARM64_PAGE_SIZE_4K),y)
ifeq ($(BR2_ARC_PAGE_SIZE_4K),y)
ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
else ifeq ($(BR2_ARC_PAGE_SIZE_8K),y)
ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192 -Wl,-z,common-page-size=8192
else ifeq ($(BR2_ARC_PAGE_SIZE_16K),y)
ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384
else ifeq ($(BR2_ARM64_PAGE_SIZE_64K),y)
ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=65536 -Wl,-z,common-page-size=65536
else ifeq ($(BR2_aarch64),y)
ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384
else
endif

# Include any architecture specific makefiles.
Expand Down

0 comments on commit 689b43e

Please sign in to comment.