Repository navigation
Android: link every native library for 16 KB pages (#41) - #70
Merged
Merged
Conversation
libSDL2.so, the four adrenotools hook libraries and a libmain.so linked on a PC had 4 KB LOAD alignment, so Android 15+ showed the "isn't 16 KB compatible" dialog and a 16 KB-page kernel would refuse to load them. The NDK r27 toolchain links with -z max-page-size=16384 when ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES is on (the default only from r28): turn it on for the dependency builds, the core's and the game's toolchain files. The on-device zig link already passed the flag; libc++_shared.so from r27c is already 16 KB aligned. apk_pack.py now warns about any lib/*.so aligned below 16 KB. Tested on the Android 15 16 KB page-size emulator image (x86_64, arm64 apps through translation): the current APK dies with SIGSEGV (SEGV_ACCERR) as its libraries load; with the 16 KB-aligned libraries libSDL2/libmain load, SDL starts and the game window opens. On a 4 KB device (Shield, Android 11) the new libraries load too. Fixes #41 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every native library in the Android APK is now linked for 16 KB pages.
libSDL2.so, the four adrenotools hook libraries and alibmain.solinked on a PC had 4 KB LOAD alignment. NDK r27 only links with-z max-page-size=16384whenANDROID_SUPPORT_FLEXIBLE_PAGE_SIZESis on (the default from r28), so it is now turned on for the dependency builds (android/build_deps.py), the core's toolchain file and the game's (android_build.py write_toolchain). The on-device zig link already passed the flag, and r27c'slibc++_shared.sois already aligned.apk_pack.pynow warns about anylib/*.soaligned below 16 KB;docs/android.mdnotes it.Tested:
.soat 0x4000; alibmain.solinked through the new toolchain file: 0x4000; the Android core still compiles with-D__BIONIC_NO_PAGE_SIZE_MACRO.Fixes #41
Release notes
🤖 Generated with Claude Code