[clang] 5b02be0 - [Clang] Pass -z max-page-size to linker for Fuchsia

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Sat May 9 13:45:13 PDT 2020


Author: Petr Hosek
Date: 2020-05-09T13:44:20-07:00
New Revision: 5b02be0b973a0d792bf8ce39170487f48b6cbd08

URL: https://github.com/llvm/llvm-project/commit/5b02be0b973a0d792bf8ce39170487f48b6cbd08
DIFF: https://github.com/llvm/llvm-project/commit/5b02be0b973a0d792bf8ce39170487f48b6cbd08.diff

LOG: [Clang] Pass -z max-page-size to linker for Fuchsia

Currently all Fuchsia ABIs use a 4k page size, departing from
the recommended page sizes in the respective psABI documents.

Differential Revision: https://reviews.llvm.org/D79667

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Fuchsia.cpp
    clang/test/Driver/fuchsia.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index 9a8f14de5c07..8f485802887f 100644
--- a/clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -46,6 +46,9 @@ void fuchsia::Linker::ConstructJob(Compilation &C, const JobAction &JA,
   // handled somewhere else.
   Args.ClaimAllArgs(options::OPT_w);
 
+  CmdArgs.push_back("-z");
+  CmdArgs.push_back("max-page-size=4096");
+
   CmdArgs.push_back("-z");
   CmdArgs.push_back("now");
 

diff  --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c
index 3aceba70d7f8..359a2797da21 100644
--- a/clang/test/Driver/fuchsia.c
+++ b/clang/test/Driver/fuchsia.c
@@ -23,7 +23,7 @@
 // CHECK-X86_64: "-fsanitize=safe-stack"
 // CHECK: "-stack-protector" "2"
 // CHECK-NOT: "-fcommon"
-// CHECK: {{.*}}ld.lld{{.*}}" "-z" "now" "-z" "rodynamic" "-z" "separate-loadable-segments" "--pack-dyn-relocs=relr"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "max-page-size=4096" "-z" "now" "-z" "rodynamic" "-z" "separate-loadable-segments" "--pack-dyn-relocs=relr"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
 // CHECK: "--build-id"


        


More information about the cfe-commits mailing list