Driver: libubsan_cxx depends on libubsan. Preserve the topological ordering, some linkers depend on it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193048 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index c85ff8d..2ab8b00 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1779,13 +1779,14 @@
static void addUbsanRTLinux(const ToolChain &TC, const ArgList &Args,
ArgStringList &CmdArgs, bool IsCXX,
bool HasOtherSanitizerRt) {
- addSanitizerRTLinkFlagsLinux(TC, Args, CmdArgs, "ubsan", false, 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, 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)