Driver: libubsan_cxx depends on libubsan. Preserve the topological ordering, some linkers depend on it.

llvm-svn: 193048
This commit is contained in:
Benjamin Kramer 2013-10-20 12:34:18 +00:00
parent 1d5d634c82
commit 80b5a9d2d0
2 changed files with 5 additions and 4 deletions

View File

@ -1779,13 +1779,14 @@ static void addLsanRTLinux(const ToolChain &TC, const ArgList &Args,
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)

View File

@ -113,8 +113,8 @@
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-CXX %s
// CHECK-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}"
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
// CHECK-UBSAN-LINUX-CXX: "{{.*}}libclang_rt.ubsan-i386.a"
// CHECK-UBSAN-LINUX-CXX: "{{.*}}libclang_rt.ubsan_cxx-i386.a"
// CHECK-UBSAN-LINUX-CXX: "{{.*}}libclang_rt.ubsan-i386.a"
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
// CHECK-UBSAN-LINUX-CXX: "{{.*}}libclang_rt.san-i386.a"
// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan
@ -142,8 +142,8 @@
// CHECK-ASAN-UBSAN-LINUX-CXX-NOT: libclang_rt.san
// CHECK-ASAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.asan-i386.a" "-no-whole-archive"
// CHECK-ASAN-UBSAN-LINUX-CXX-NOT: libclang_rt.san
// CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}libclang_rt.ubsan-i386.a"
// CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}libclang_rt.ubsan_cxx-i386.a"
// CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}libclang_rt.ubsan-i386.a"
// CHECK-ASAN-UBSAN-LINUX-CXX: "-lpthread"
// CHECK-ASAN-UBSAN-LINUX-CXX: "-lstdc++"