diff --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp b/clang/lib/Driver/ToolChains/Fuchsia.cpp --- a/clang/lib/Driver/ToolChains/Fuchsia.cpp +++ b/clang/lib/Driver/ToolChains/Fuchsia.cpp @@ -46,6 +46,9 @@ // 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 --- 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"