Skip to content

Commit 856ce49

Browse files
Kalesh-SinghKalesh Singh
andauthored
ANDROID: AArch64: Change default max-page-size from 4k to 16k (#70251)
File size increase were found negligible from sparseness and zero block compression in f2fs and ext4 (supported filesystems for Android's userdata partition). Signed-off-by: Kalesh Singh <[email protected]> Co-authored-by: Kalesh Singh <[email protected]>
1 parent be8f987 commit 856ce49

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

clang/lib/Driver/ToolChains/Linux.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,18 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
237237
ExtraOpts.push_back("relro");
238238
}
239239

240-
// Android ARM/AArch64 use max-page-size=4096 to reduce VMA usage. Note, lld
241-
// from 11 onwards default max-page-size to 65536 for both ARM and AArch64.
242-
if ((Triple.isARM() || Triple.isAArch64()) && Triple.isAndroid()) {
243-
ExtraOpts.push_back("-z");
244-
ExtraOpts.push_back("max-page-size=4096");
240+
// Note, lld from 11 onwards default max-page-size to 65536 for both ARM and
241+
// AArch64.
242+
if (Triple.isAndroid()) {
243+
if (Triple.isARM()) {
244+
// Android ARM uses max-page-size=4096 to reduce VMA usage.
245+
ExtraOpts.push_back("-z");
246+
ExtraOpts.push_back("max-page-size=4096");
247+
} else if (Triple.isAArch64()) {
248+
// Android AArch64 uses max-page-size=16384 to support 4k/16k page sizes.
249+
ExtraOpts.push_back("-z");
250+
ExtraOpts.push_back("max-page-size=16384");
251+
}
245252
}
246253

247254
if (GCCInstallation.getParentLibPath().contains("opt/rh/"))

clang/test/Driver/android-link.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
//
1818
// RUN: %clang -target aarch64-none-linux-android \
1919
// RUN: -### -v %s 2> %t
20-
// RUN: FileCheck -check-prefix=MAX-PAGE-SIZE < %t %s
20+
// RUN: FileCheck -check-prefix=MAX-PAGE-SIZE-AARCH64 < %t %s
2121
//
2222
// GENERIC-ARM: --fix-cortex-a53-843419
2323
// CORTEX-A53: --fix-cortex-a53-843419
2424
// CORTEX-A57-NOT: --fix-cortex-a53-843419
2525
// MAX-PAGE-SIZE: "-z" "max-page-size=4096"
26+
// MAX-PAGE-SIZE-AARCH64: "-z" "max-page-size=16384"

0 commit comments

Comments
 (0)