From 80b5a9d2d094724db1da43c80739b2042975a2eb Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 20 Oct 2013 12:34:18 +0000 Subject: [PATCH] Driver: libubsan_cxx depends on libubsan. Preserve the topological ordering, some linkers depend on it. llvm-svn: 193048 --- clang/lib/Driver/Tools.cpp | 5 +++-- clang/test/Driver/sanitizer-ld.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index c85ff8d60c83..2ab8b00e1785 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -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) diff --git a/clang/test/Driver/sanitizer-ld.c b/clang/test/Driver/sanitizer-ld.c index 1bb449ad2f3b..a9181336b59b 100644 --- a/clang/test/Driver/sanitizer-ld.c +++ b/clang/test/Driver/sanitizer-ld.c @@ -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++"