Skip to content

Commit 85e76e9

Browse files
committed
Use 64K alignment on ARM
1 parent 40a293a commit 85e76e9

4 files changed

Lines changed: 19 additions & 3 deletions

File tree

natives/cmake/toolchains/linux-aarch64-gnu.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ else()
2424
set(CMAKE_SYSROOT "/usr/aarch64-linux-gnu")
2525
set(CMAKE_FIND_ROOT_PATH "/usr/aarch64-linux-gnu")
2626
endif()
27-
endif()
27+
endif()
28+
29+
# Force 64K page alignment for compatibility with 16K/64K page-size kernels (e.g. Android, RHEL on ARM).
30+
set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-z,max-page-size=65536")
31+
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-z,max-page-size=65536")

natives/cmake/toolchains/linux-aarch64-musl.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ else()
2424
set(CMAKE_SYSROOT "/usr/aarch64-linux-musl")
2525
set(CMAKE_FIND_ROOT_PATH "/usr/aarch64-linux-musl")
2626
endif()
27-
endif()
27+
endif()
28+
29+
# Force 64K page alignment for compatibility with 16K/64K page-size kernels (e.g. Android, RHEL on ARM).
30+
set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-z,max-page-size=65536")
31+
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-z,max-page-size=65536")

natives/cmake/toolchains/linux-armhf-gnu.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@ else()
2424
set(CMAKE_SYSROOT "/usr/arm-linux-gnueabihf")
2525
set(CMAKE_FIND_ROOT_PATH "/usr/arm-linux-gnueabihf")
2626
endif()
27-
endif()
27+
endif()
28+
29+
# Force 64K page alignment for compatibility with 16K/64K page-size kernels (e.g. Android, RHEL on ARM).
30+
set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-z,max-page-size=65536")
31+
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-z,max-page-size=65536")

natives/cmake/toolchains/linux-armhf-musl.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ else()
2525
set(CMAKE_FIND_ROOT_PATH "/usr/arm-linux-musleabihf")
2626
endif()
2727
endif()
28+
29+
# Force 64K page alignment for compatibility with 16K/64K page-size kernels (e.g. Android, RHEL on ARM).
30+
set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-z,max-page-size=65536")
31+
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,-z,max-page-size=65536")

0 commit comments

Comments
 (0)