[UBSan] Introduce "ubsan_standalone" library (Clang part).
Get rid of "libclang_rt.san" library that used to contain
sanitizer_common pieces required by UBSan if it's used in a standalone
mode. Instead, build two variants of UBSan runtime: "ubsan" and
"ubsan_standalone" (same for "ubsan_cxx" and "ubsan_standalone_cxx").
Later "ubsan" and "ubsan_cxx" libraries will go away, as they will
embedded it into corresponding ASan runtimes.
llvm-svn: 233010
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 410a939..72a7749 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -2283,13 +2283,16 @@
StaticRuntimes.push_back("tsan");
// WARNING: UBSan should always go last.
if (SanArgs.needsUbsanRt()) {
- // If UBSan is not combined with another sanitizer, we need to pull in
- // sanitizer_common explicitly.
- if (StaticRuntimes.empty())
- HelperStaticRuntimes.push_back("san");
- StaticRuntimes.push_back("ubsan");
- if (SanArgs.linkCXXRuntimes())
- StaticRuntimes.push_back("ubsan_cxx");
+ // Check if UBSan is combined with another sanitizers.
+ if (StaticRuntimes.empty()) {
+ StaticRuntimes.push_back("ubsan_standalone");
+ if (SanArgs.linkCXXRuntimes())
+ StaticRuntimes.push_back("ubsan_standalone_cxx");
+ } else {
+ StaticRuntimes.push_back("ubsan");
+ if (SanArgs.linkCXXRuntimes())
+ StaticRuntimes.push_back("ubsan_cxx");
+ }
}
}