[clang] 231875e - [Clang] Always set -z now linker option on Fuchsia
Petr Hosek via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 13 11:54:12 PST 2020
Author: Petr Hosek
Date: 2020-01-13T11:54:04-08:00
New Revision: 231875e111facf6d15553dff9d7c04d3e9e4a404
URL: https://github.com/llvm/llvm-project/commit/231875e111facf6d15553dff9d7c04d3e9e4a404
DIFF: https://github.com/llvm/llvm-project/commit/231875e111facf6d15553dff9d7c04d3e9e4a404.diff
LOG: [Clang] Always set -z now linker option on Fuchsia
This should be the default on Fuchsia.
Differential Revision: https://reviews.llvm.org/D70576
Added:
Modified:
clang/lib/Driver/ToolChains/Fuchsia.cpp
clang/test/Driver/fuchsia.c
clang/test/Driver/fuchsia.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Fuchsia.cpp b/clang/lib/Driver/ToolChains/Fuchsia.cpp
index 32cf0369c137..808d0408d0d4 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("now");
+
const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
if (llvm::sys::path::filename(Exec).equals_lower("ld.lld") ||
llvm::sys::path::stem(Exec).equals_lower("ld.lld")) {
diff --git a/clang/test/Driver/fuchsia.c b/clang/test/Driver/fuchsia.c
index bf08213f3d8c..13280c851fee 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: "-fno-common"
-// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic" "-z" "separate-loadable-segments"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "now" "-z" "rodynamic" "-z" "separate-loadable-segments"
// CHECK: "--sysroot=[[SYSROOT]]"
// CHECK: "-pie"
// CHECK: "--build-id"
diff --git a/clang/test/Driver/fuchsia.cpp b/clang/test/Driver/fuchsia.cpp
index b9fecfa648db..b0aeb04d92a2 100644
--- a/clang/test/Driver/fuchsia.cpp
+++ b/clang/test/Driver/fuchsia.cpp
@@ -22,7 +22,7 @@
// CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK: "-internal-isystem" "{{.*[/\\]}}include{{/|\\\\}}c++{{/|\\\\}}v1"
// CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include"
-// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "now" "-z" "rodynamic" "-z" "separate-loadable-segments"
// CHECK: "--sysroot=[[SYSROOT]]"
// CHECK: "-pie"
// CHECK: "--build-id"
More information about the cfe-commits
mailing list