Skip to content

build(android): 16 KB ELF page alignment for all bundled .so - #25

Open
KLCLAU wants to merge 1 commit into
fadi-labib:mainfrom
KLCLAU:android-16kb-page-alignment
Open

build(android): 16 KB ELF page alignment for all bundled .so#25
KLCLAU wants to merge 1 commit into
fadi-labib:mainfrom
KLCLAU:android-16kb-page-alignment

Conversation

@KLCLAU

@KLCLAU KLCLAU commented Sep 1, 2026

Copy link
Copy Markdown

Why

Android 15+ boots a 16 KB-page kernel and Google Play has required 16 KB compatibility for app updates since Nov 2025. A 4 KB-aligned .so:

  • fails to load on a real 16 KB device;
  • on devices still on a 4 KB kernel (current Galaxy S26 retail), triggers the system "this app isn't compatible with 16 KB pages / ELF alignment check failed" dialog on first launch, listing every bundled library (libdxvk_d3d8.so, libgsl_alloc_hook.so, libSDL3.so, libgamespy.so, libSDL3_image.so, libopenal.so, …).

libmain.so and the vcpkg/FetchContent libs mostly inherit the NDK default, but the two out-of-tree builds don't: DXVK (its own meson cross build) and libadrenotools + the linker-namespace hooks (standalone CMake).

Change

Add -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384:

  • DXVKc_link_args / cpp_link_args in meson-arm64-android-cross.ini.in
  • libadrenotoolsCMAKE_SHARED_LINKER_FLAGS in build-adrenotools.sh
  • android-vulkan presetCMAKE_SHARED_LINKER_FLAGS / CMAKE_EXE_LINKER_FLAGS, covering libmain.so / libSDL3 / libopenal / libgamespy regardless of NDK default

Result

readelf -l on every .so in the packaged APK now reports p_align 0x4000; the install-time warning is gone. Verified on a Galaxy S26+ (Adreno 840).

Related: #23, #24

Android 15+ boots a 16 KB-page kernel and Google Play requires 16 KB
compatibility for updates since Nov 2025. On a 16 KB device a 4 KB-aligned
.so fails to load; on the ones still running a 4 KB kernel (e.g. current
Galaxy S26) the installer shows a 'this app isn't 16 KB compatible / ELF
alignment check failed' warning listing every bundled library.

libmain.so and the vcpkg/FetchContent .so already inherit the NDK default,
but the two out-of-tree builds do not:

- DXVK (meson cross build): add -Wl,-z,max-page-size=16384 to
  c_link_args / cpp_link_args in meson-arm64-android-cross.ini.in.
- libadrenotools + hooks (standalone CMake): add the same via
  CMAKE_SHARED_LINKER_FLAGS in build-adrenotools.sh.
- Also pin it on the android-vulkan preset (CMAKE_SHARED/EXE_LINKER_FLAGS)
  so libmain.so / libSDL3 / libopenal / libgamespy are aligned regardless
  of NDK default.

After this, readelf -l on every .so in the APK reports p_align 0x4000
and the install-time warning is gone (verified on a Galaxy S26+).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant