Index: lib/Driver/ToolChains/Fuchsia.cpp =================================================================== --- lib/Driver/ToolChains/Fuchsia.cpp +++ lib/Driver/ToolChains/Fuchsia.cpp @@ -48,6 +48,9 @@ CmdArgs.push_back("gnu"); } + CmdArgs.push_back("-z"); + CmdArgs.push_back("rodynamic"); + if (!D.SysRoot.empty()) CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); Index: test/Driver/fuchsia.c =================================================================== --- test/Driver/fuchsia.c +++ test/Driver/fuchsia.c @@ -5,6 +5,7 @@ // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include" // CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu" +// CHECK: "-z" "rodynamic" // CHECK: "--sysroot=[[SYSROOT]]" // CHECK: "-pie" // CHECK: "--build-id" Index: test/Driver/fuchsia.cpp =================================================================== --- test/Driver/fuchsia.cpp +++ test/Driver/fuchsia.cpp @@ -7,6 +7,7 @@ // CHECK: "-internal-isystem" "{{.*[/\\]}}x86_64-fuchsia{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include" // CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu" +// CHECK: "-z" "rodynamic" // CHECK: "--sysroot=[[SYSROOT]]" // CHECK: "-pie" // CHECK: "--build-id"