From: Benjamin Kramer Date: Sun, 20 Oct 2013 12:34:18 +0000 (+0000) Subject: Driver: libubsan_cxx depends on libubsan. Preserve the topological ordering, some... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=acca8bcbe7b4c765caee75e62bfbf47f968a7bac;p=clang 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 c85ff8d60c..2ab8b00e17 100644 --- a/lib/Driver/Tools.cpp +++ b/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/test/Driver/sanitizer-ld.c b/test/Driver/sanitizer-ld.c index 1bb449ad2f..a9181336b5 100644 --- a/test/Driver/sanitizer-ld.c +++ b/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++"