From: Alexey Samsonov Date: Mon, 27 Apr 2015 22:07:50 +0000 (+0000) Subject: Introduce tsan_cxx and msan_cxx libraries (Clang part). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fc89bfc52cb746fdcd611c54451b4924e71bd93a;p=clang Introduce tsan_cxx and msan_cxx libraries (Clang part). For now tsan_cxx and msan_cxx contain only operator new/delete replacements. In the future, when we add support for running UBSan+TSan and UBSan+MSan, they will also contain bits ubsan_cxx runtime. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235924 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 526968cf41..10837996a3 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -2326,10 +2326,16 @@ collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args, StaticRuntimes.push_back("dfsan"); if (SanArgs.needsLsanRt()) StaticRuntimes.push_back("lsan"); - if (SanArgs.needsMsanRt()) + if (SanArgs.needsMsanRt()) { StaticRuntimes.push_back("msan"); - if (SanArgs.needsTsanRt()) + if (SanArgs.linkCXXRuntimes()) + StaticRuntimes.push_back("msan_cxx"); + } + if (SanArgs.needsTsanRt()) { StaticRuntimes.push_back("tsan"); + if (SanArgs.linkCXXRuntimes()) + StaticRuntimes.push_back("tsan_cxx"); + } if (SanArgs.needsUbsanRt()) { StaticRuntimes.push_back("ubsan_standalone"); if (SanArgs.linkCXXRuntimes()) diff --git a/test/Driver/Inputs/resource_dir/lib/linux/libclang_rt.msan_cxx-x86_64.a.syms b/test/Driver/Inputs/resource_dir/lib/linux/libclang_rt.msan_cxx-x86_64.a.syms new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/Driver/Inputs/resource_dir/lib/linux/libclang_rt.tsan_cxx-x86_64.a.syms b/test/Driver/Inputs/resource_dir/lib/linux/libclang_rt.tsan_cxx-x86_64.a.syms new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/Driver/sanitizer-ld.c b/test/Driver/sanitizer-ld.c index a95a83397e..7cbc37ff0c 100644 --- a/test/Driver/sanitizer-ld.c +++ b/test/Driver/sanitizer-ld.c @@ -160,8 +160,9 @@ // CHECK-TSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-TSAN-LINUX-CXX-NOT: stdc++ // CHECK-TSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.tsan-x86_64.a" "-no-whole-archive" -// CHECK-TSAN-LINUX-CXX-NOT: "-export-dynamic" // CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan-x86_64.a.syms" +// CHECK-TSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.tsan_cxx-x86_64.a" "-no-whole-archive" +// CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan_cxx-x86_64.a.syms" // CHECK-TSAN-LINUX-CXX-NOT: "-export-dynamic" // CHECK-TSAN-LINUX-CXX: stdc++ // CHECK-TSAN-LINUX-CXX: "-lpthread" @@ -177,8 +178,9 @@ // CHECK-MSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-MSAN-LINUX-CXX-NOT: stdc++ // CHECK-MSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "-no-whole-archive" -// CHECK-MSAN-LINUX-CXX-NOT: "-export-dynamic" // CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan-x86_64.a.syms" +// CHECK-MSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.msan_cxx-x86_64.a" "-no-whole-archive" +// CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan_cxx-x86_64.a.syms" // CHECK-MSAN-LINUX-CXX-NOT: "-export-dynamic" // CHECK-MSAN-LINUX-CXX: stdc++ // CHECK-MSAN-LINUX-CXX: "-lpthread"