Respect ToolChain::isPIEDefault() in constructing link job on Linux and FreeBSD.
Partially based on http://llvm-reviews.chandlerc.com/D2644 by Viktor Kutuzov.
llvm-svn: 202150
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index fb98e12..5f62601 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -2446,6 +2446,14 @@
}
}
+bool FreeBSD::HasNativeLLVMSupport() const {
+ return true;
+}
+
+bool FreeBSD::isPIEDefault() const {
+ return getSanitizerArgs().hasZeroBaseShadow();
+}
+
/// NetBSD - NetBSD tool chain which can call as(1) and ld(1) directly.
NetBSD::NetBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
@@ -2996,10 +3004,6 @@
addPathIfExists(SysRoot + "/usr/lib", Paths);
}
-bool FreeBSD::HasNativeLLVMSupport() const {
- return true;
-}
-
bool Linux::HasNativeLLVMSupport() const {
return true;
}