Skip to content

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

@asakovets

Description

@asakovets

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Merged

Status

Merged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions