Skip to content

ANDROID: AArch64: Change default max-page-size from 4k to 16k #70251

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

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions clang/lib/Driver/ToolChains/Linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,18 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
ExtraOpts.push_back("relro");
}

// Android ARM/AArch64 use max-page-size=4096 to reduce VMA usage. Note, lld
// from 11 onwards default max-page-size to 65536 for both ARM and AArch64.
if ((Triple.isARM() || Triple.isAArch64()) && Triple.isAndroid()) {
ExtraOpts.push_back("-z");
ExtraOpts.push_back("max-page-size=4096");
// Note, lld from 11 onwards default max-page-size to 65536 for both ARM and
// AArch64.
if (Triple.isAndroid()) {
if (Triple.isARM()) {
// Android ARM uses max-page-size=4096 to reduce VMA usage.
ExtraOpts.push_back("-z");
ExtraOpts.push_back("max-page-size=4096");
} else if (Triple.isAArch64()) {
// Android AArch64 uses max-page-size=16384 to support 4k/16k page sizes.
ExtraOpts.push_back("-z");
ExtraOpts.push_back("max-page-size=16384");
}
}

if (GCCInstallation.getParentLibPath().contains("opt/rh/"))
Expand Down
3 changes: 2 additions & 1 deletion clang/test/Driver/android-link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
//
// RUN: %clang -target aarch64-none-linux-android \
// RUN: -### -v %s 2> %t
// RUN: FileCheck -check-prefix=MAX-PAGE-SIZE < %t %s
// RUN: FileCheck -check-prefix=MAX-PAGE-SIZE-AARCH64 < %t %s
//
// GENERIC-ARM: --fix-cortex-a53-843419
// CORTEX-A53: --fix-cortex-a53-843419
// CORTEX-A57-NOT: --fix-cortex-a53-843419
// MAX-PAGE-SIZE: "-z" "max-page-size=4096"
// MAX-PAGE-SIZE-AARCH64: "-z" "max-page-size=16384"