diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2013-10-20 21:29:13 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2013-10-20 21:29:13 +0000 |
| commit | f7ef3fd8109b5c7144d622b6da801ce0ba4bba69 (patch) | |
| tree | fab14d630cc80a56baa1b57736530f51a3561313 /clang/lib/Driver/Tools.cpp | |
| parent | e11bd86a98a5c3cec4e9d2bc74b8fd94638642be (diff) | |
| download | bcm5719-llvm-f7ef3fd8109b5c7144d622b6da801ce0ba4bba69.tar.gz bcm5719-llvm-f7ef3fd8109b5c7144d622b6da801ce0ba4bba69.zip | |
Revert r193022 and r193048. They broke the ubsan test suite.
llvm-svn: 193057
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
| -rw-r--r-- | clang/lib/Driver/Tools.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 2ab8b00e178..d6ddd024437 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -1705,15 +1705,13 @@ static void addSanitizerRTLinkFlagsLinux( // Sanitizer runtime may need to come before -lstdc++ (or -lc++, libstdc++.a, // etc.) so that the linker picks custom versions of the global 'operator // new' and 'operator delete' symbols. We take the extreme (but simple) - // strategy of inserting it at the front of the link command. If we're - // responsible for exporting the symbols then it also needs to be forced to - // end up in the executable, so wrap it in whole-archive. + // strategy of inserting it at the front of the link command. It also + // needs to be forced to end up in the executable, so wrap it in + // whole-archive. SmallVector<const char *, 3> LibSanitizerArgs; - if (ExportSymbols) - LibSanitizerArgs.push_back("-whole-archive"); + LibSanitizerArgs.push_back("-whole-archive"); LibSanitizerArgs.push_back(Args.MakeArgString(LibSanitizer)); - if (ExportSymbols) - LibSanitizerArgs.push_back("-no-whole-archive"); + LibSanitizerArgs.push_back("-no-whole-archive"); CmdArgs.insert(BeforeLibStdCXX ? CmdArgs.begin() : CmdArgs.end(), LibSanitizerArgs.begin(), LibSanitizerArgs.end()); @@ -1779,18 +1777,17 @@ static void addLsanRTLinux(const ToolChain &TC, const ArgList &Args, static void addUbsanRTLinux(const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs, bool IsCXX, bool HasOtherSanitizerRt) { - // Only include the bits of the runtime which need a C++ ABI library if - // we're linking in C++ mode. - if (IsCXX) - addSanitizerRTLinkFlagsLinux(TC, Args, CmdArgs, "ubsan_cxx", false, false); - - // Now insert the common ubsan bits. ubsan_cxx depends on them. - addSanitizerRTLinkFlagsLinux(TC, Args, CmdArgs, "ubsan", false, false); - // Need a copy of sanitizer_common. This could come from another sanitizer // runtime; if we're not including one, include our own copy. if (!HasOtherSanitizerRt) - addSanitizerRTLinkFlagsLinux(TC, Args, CmdArgs, "san", false, false); + addSanitizerRTLinkFlagsLinux(TC, Args, CmdArgs, "san", true, false); + + addSanitizerRTLinkFlagsLinux(TC, Args, CmdArgs, "ubsan", false); + + // Only include the bits of the runtime which need a C++ ABI library if + // we're linking in C++ mode. + if (IsCXX) + addSanitizerRTLinkFlagsLinux(TC, Args, CmdArgs, "ubsan_cxx", false); } static void addDfsanRTLinux(const ToolChain &TC, const ArgList &Args, |

