[Driver] Always use -z separate-code with lld on Fuchsia
authorPetr Hosek <phosek@chromium.org>
Mon, 5 Aug 2019 01:15:33 +0000 (01:15 +0000)
committerPetr Hosek <phosek@chromium.org>
Mon, 5 Aug 2019 01:15:33 +0000 (01:15 +0000)
Previously -z separate-code was the default lld behavior, but now it
has to be explicitly requested by specifying the flag.

llvm-svn: 367796

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

index 1f5ec9e..84e5027 100644 (file)
@@ -51,6 +51,8 @@ void fuchsia::Linker::ConstructJob(Compilation &C, const JobAction &JA,
       llvm::sys::path::stem(Exec).equals_lower("ld.lld")) {
     CmdArgs.push_back("-z");
     CmdArgs.push_back("rodynamic");
+    CmdArgs.push_back("-z");
+    CmdArgs.push_back("separate-code");
   }
 
   if (!D.SysRoot.empty())
index c31e373..ec664fb 100644 (file)
@@ -16,7 +16,7 @@
 // CHECK: "-fsanitize=safe-stack"
 // CHECK: "-stack-protector" "2"
 // CHECK: "-fno-common"
-// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic" "-z" "separate-code"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
 // CHECK: "--build-id"