Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Android flexible page sizes #4068

Merged
merged 2 commits into from
Sep 11, 2024
Merged

Conversation

sauwming
Copy link
Member

@sauwming sauwming commented Sep 9, 2024

As specified in Android official doc: https://developer.android.com/guide/practices/page-sizes#ndk-build, Android now supports 16 KB page sizes.

Historically, Android has only supported 4 KB memory page sizes, which has optimized system memory performance for the average amount of total memory that Android devices have typically had. Beginning with Android 15, AOSP supports devices that are configured to use a page size of 16 KB (16 KB devices). If your app uses any [NDK](https://developer.android.com/ndk) libraries, either directly or indirectly through an SDK, then you will need to rebuild your app for it to work on these 16 KB devices.

Note that as described in the doc above, the patch in this PR requires NDK r27 and higher. For r26 or below, you can supply the flags CFLAGS="-D__BIONIC_NO_PAGE_SIZE_MACRO" LDFLAGS="-Wl,-z,max-page-size=16384" to configure-android.

@sauwming sauwming self-assigned this Sep 9, 2024
@sauwming sauwming added this to the release-2.15 milestone Sep 9, 2024
@sauwming sauwming marked this pull request as ready for review September 10, 2024 06:08
@nanangizz
Copy link
Member

  • What happens when using NDK 26 or below without the additional CFLAGS & LDFLAGS (success/failed, silently ignored, etc)?
  • Don't forget to also add this to Android getting started docs.

@sauwming
Copy link
Member Author

Without the additional flags, the library will build and run as usual without the 16 KB page size support.

@sauwming sauwming merged commit a85f793 into master Sep 11, 2024
36 checks passed
@sauwming sauwming deleted the android-page-size branch September 11, 2024 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants