summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2016-07-07 21:42:29 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2016-07-07 21:42:29 +0000
commita1a36c85df101b68f2c9182dd386c0672708bdda (patch)
tree8f5212b84f7c09725dbfceaac6180b76b4d469b9 /clang/lib/Driver/ToolChains.cpp
parent[PM] Port InstSimplify to the new pass manager. (diff)
downloadllvm-project-a1a36c85df101b68f2c9182dd386c0672708bdda.tar.gz
llvm-project-a1a36c85df101b68f2c9182dd386c0672708bdda.tar.bz2
llvm-project-a1a36c85df101b68f2c9182dd386c0672708bdda.zip
Driver: Stop linking to C++ when using sanitizers on Darwin
Sanitizers on Darwin are built as dynamic libraries, not static libraries. Sanitizers will have their C++ dependency satisfied internally (LC_LOAD_DYLIB) in the libclang_rt dylib. As long as the sanitizers stay dynamic and not static, linking against C++ when enabling a sanitizer becomes over linkage. Patch by Dave Lee! llvm-svn: 274797
Diffstat (limited to 'clang/lib/Driver/ToolChains.cpp')
-rw-r--r--clang/lib/Driver/ToolChains.cpp12
1 files changed, 0 insertions, 12 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index 89e973a12090..4ecbf2bac3c3 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -392,24 +392,12 @@ void Darwin::addProfileRTLibs(const ArgList &Args,
void DarwinClang::AddLinkSanitizerLibArgs(const ArgList &Args,
ArgStringList &CmdArgs,
StringRef Sanitizer) const {
- if (!Args.hasArg(options::OPT_dynamiclib) &&
- !Args.hasArg(options::OPT_bundle)) {
- // Sanitizer runtime libraries requires C++.
- AddCXXStdlibLibArgs(Args, CmdArgs);
- }
-
AddLinkRuntimeLib(
Args, CmdArgs,
(Twine("libclang_rt.") + Sanitizer + "_" +
getOSLibraryNameSuffix() + "_dynamic.dylib").str(),
/*AlwaysLink*/ true, /*IsEmbedded*/ false,
/*AddRPath*/ true);
-
- if (GetCXXStdlibType(Args) == ToolChain::CST_Libcxx) {
- // Add explicit dependcy on -lc++abi, as -lc++ doesn't re-export
- // all RTTI-related symbols that UBSan uses.
- CmdArgs.push_back("-lc++abi");
- }
}
void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,