[PATCH] D77746: [Driver] Default arm-linux-androideabi to -z max-page-size=4096
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 8 10:51:42 PDT 2020
MaskRay created this revision.
MaskRay added reviewers: rprichard, srhines, thieta.
Herald added subscribers: cfe-commits, danielkiss, kristof.beyls.
Herald added a project: clang.
Similar to D55029 <https://reviews.llvm.org/D55029>. The requirement arises when discussing increasing
default max-page-size for lld ARM (D77330 <https://reviews.llvm.org/D77330>).
For the record, the default max-page-size on the 3 commonly used linkers:
- GNU ld since
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=7572ca8989ead4c3425a1500bc241eaaeffa2c89
defaults to 65536
- GNU gold remains 4096
- lld currently uses 4096 but may increase to 65536 (D77330 <https://reviews.llvm.org/D77330>)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77746
Files:
clang/lib/Driver/ToolChains/Linux.cpp
clang/test/Driver/android-aarch64-link.cpp
clang/test/Driver/android-link.cpp
Index: clang/test/Driver/android-link.cpp
===================================================================
--- clang/test/Driver/android-link.cpp
+++ clang/test/Driver/android-link.cpp
@@ -1,4 +1,7 @@
-// Check that we automatically add relevant linker flags for Android aarch64.
+// Check that we add relevant linker flags for Android ARM/AArch64.
+
+// RUN: %clang -### -target arm-linux-androideabi %s 2>&1 | \
+// RUN: FileCheck --check-prefix=MAX-PAGE-SIZE %s
// RUN: %clang -target aarch64-none-linux-android \
// RUN: -### -v %s 2> %t
@@ -19,4 +22,4 @@
// GENERIC-ARM: --fix-cortex-a53-843419
// CORTEX-A53: --fix-cortex-a53-843419
// CORTEX-A57-NOT: --fix-cortex-a53-843419
-// MAX-PAGE-SIZE: max-page-size=4096
+// MAX-PAGE-SIZE: "-z" "max-page-size=4096"
Index: clang/lib/Driver/ToolChains/Linux.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Linux.cpp
+++ clang/lib/Driver/ToolChains/Linux.cpp
@@ -253,10 +253,9 @@
ExtraOpts.push_back("relro");
}
- // The lld default page size is too large for Aarch64, which produces much
- // larger .so files and images for arm64 device targets. Use 4KB page size
- // for Android arm64 targets instead.
- if (Triple.isAArch64() && Triple.isAndroid()) {
+ // Android ARM/AArch64 use max-page-size=4096 to reduce VMA usage. Note, the
+ // lld default for both ARM/AArch64 is 65536.
+ if ((Triple.isARM() || Triple.isAArch64()) && Triple.isAndroid()) {
ExtraOpts.push_back("-z");
ExtraOpts.push_back("max-page-size=4096");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77746.256066.patch
Type: text/x-patch
Size: 1572 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200408/42c97ef9/attachment.bin>
More information about the cfe-commits
mailing list