8000 [BUG] Setting -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=OFF does not revert back to 4k pages. · Issue #2145 · android/ndk · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

[BUG] Setting -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=OFF does not revert back to 4k pages. #2145

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

Open
1 task done
asakovets opened this issue May 6, 2025 · 3 comments
Open
1 task done
Assignees
Labels

Comments

@asakovets
Copy link

Description

Per the changelog:

The default alignment of shared libraries for arm64-v86 and x86_64 is now 16k. To revert to 4k alignment, set APP_SUPPORT_FLEXIBLE_PAGE_SIZES (ndk-build) or ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES (CMake) to false. See https://developer.android.com/guide/practices/page-sizes for more information.

However, setting ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES does not revert back to 4k alignment. -z max-page-size=16384 is now default in clang (as well as in ndk r28) (https://github.com/llvm/llvm-project/blob/6a99d817204dfa39afc42f1f6a810d82f6a8794f/clang/lib/Driver/ToolChains/Linux.cpp#L248).

When ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES is turned off, the only thing NDK's cmake files do is defining __BIONIC_DEPRECATED_PAGE_SIZE_MACRO macro to make PAGE_SIZE macro visible. However -z max-page-size=4096 is not appended to the list of linker flags:

https://android.googlesource.com/platform/ndk.git/+/refs/tags/ndk-r28b/build/cmake/flags.cmake#41
https://android.googlesource.com/platform/ndk.git/+/refs/tags/ndk-r28b/build/cmake/android-legacy.toolchain.cmake#475

I am using a supported NDK

  • I have checked and the NDK I'm using is currently supported

Affected versions

r28

@asakovets asakovets added the bug label May 6, 2025
@DanAlbert
Copy link
Member

Ugh, I could have sworn we had a test for this, but apparently we only test the default and the "on" mode, not the "off" mode.

I'm a little torn on whether it's better to fix this, which would alter the behavior for existing builds that set this to off but aren't actually getting that behavior, or to leave it as-is and fix the docs.

@asakovets since you're the first person to notice, could you help me out with some background info? Did you just recently upgrade to r28? Also, what are your reasons for opting out?

@github-project-automation github-project-automation bot moved this to Unconfirmed in NDK r28c May 6, 2025
@asakovets
Copy link
Author

@DanAlbert ,

I just upgraded a few days ago. I didn't actually intend to opt out, but wanted to see how 16k alignment impacts DSO size. This is when I found out ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES is incomplete.

@DanAlbert
Copy link
Member

Thanks for the info. I'm leaning towards fixing it rather than updating the docs to reflect the situation, but I'm open to being swayed either way. Thanks for the report either way!

@DanAlbert DanAlbert moved this from Unconfirmed to Needs cherry-pick in NDK r28c May 8, 2025
@DanAlbert DanAlbert added this to NDK r29 May 8, 2025
@github-project-automation github-project-automation bot moved this to Unconfirmed in NDK r29 May 8, 2025
@DanAlbert DanAlbert moved this from Unconfirmed to Needs cherry-pick in NDK r29 May 8, 2025
@DanAlbert DanAlbert added this to NDK r30 May 8, 2025
@github-project-automation github-project-automation bot moved this to Unconfirmed in NDK r30 May 8, 2025
@DanAlbert DanAlbert moved this from Unconfirmed to Triaged in NDK r30 May 8, 2025
@DanAlbert DanAlbert self-assigned this May 8, 2025
@DanAlbert DanAlbert moved this from Triaged to Merged in NDK r30 May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Needs cherry-pick
Status: Needs cherry-pick
Status: Merged
Development

No branches or pull requests

2 participants
0