diff options
| author | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-07-08 00:37:31 +0000 |
|---|---|---|
| committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-07-08 00:37:31 +0000 |
| commit | c61723f73e48475fdd31db3f0eca07985580e346 (patch) | |
| tree | a34bc38a990d2cbae0e0925b4334e09e1d4b9d57 /clang/lib | |
| parent | 3387074ae94a7b6babc25591a8e7716592cb220b (diff) | |
| download | bcm5719-llvm-c61723f73e48475fdd31db3f0eca07985580e346.tar.gz bcm5719-llvm-c61723f73e48475fdd31db3f0eca07985580e346.zip | |
Revert "Driver: Stop linking to C++ when using sanitizers on Darwin"
This reverts SVN r274797. It broke the Green Dragon bot. Revert it until the
failure can be addressed.
llvm-svn: 274814
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Driver/ToolChains.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp index 4ecbf2bac3c..89e973a1209 100644 --- a/clang/lib/Driver/ToolChains.cpp +++ b/clang/lib/Driver/ToolChains.cpp @@ -392,12 +392,24 @@ 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, |

