From 6d02edb8e3891605db0f47c53deaef934e702e4e Mon Sep 17 00:00:00 2001 From: Mike Aizatsky Date: Thu, 8 Dec 2016 22:25:01 +0000 Subject: [PATCH] [sanitizers] lsan+sancov doesn't need ubsanrt (multi def error) Reviewers: eugenis Differential Revision: https://reviews.llvm.org/D27594 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289144 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/SanitizerArgs.cpp | 3 ++- test/Driver/sanitizer-ld.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/Driver/SanitizerArgs.cpp b/lib/Driver/SanitizerArgs.cpp index 16a3672472..f4f6dad9f2 100644 --- a/lib/Driver/SanitizerArgs.cpp +++ b/lib/Driver/SanitizerArgs.cpp @@ -165,7 +165,8 @@ bool SanitizerArgs::needsUbsanRt() const { return ((Sanitizers.Mask & NeedsUbsanRt & ~TrapSanitizers.Mask) || CoverageFeatures) && !Sanitizers.has(Address) && !Sanitizers.has(Memory) && - !Sanitizers.has(Thread) && !Sanitizers.has(DataFlow) && !CfiCrossDso; + !Sanitizers.has(Thread) && !Sanitizers.has(DataFlow) && + !Sanitizers.has(Leak) && !CfiCrossDso; } bool SanitizerArgs::needsCfiRt() const { diff --git a/test/Driver/sanitizer-ld.c b/test/Driver/sanitizer-ld.c index 698f695c90..91798b91b3 100644 --- a/test/Driver/sanitizer-ld.c +++ b/test/Driver/sanitizer-ld.c @@ -289,10 +289,24 @@ // // CHECK-LSAN-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-LSAN-LINUX-NOT: "-lc" +// CHECK-LSAN-LINUX-NOT: libclang_rt.ubsan // CHECK-LSAN-LINUX: libclang_rt.lsan-x86_64.a" // CHECK-LSAN-LINUX: "-lpthread" // CHECK-LSAN-LINUX: "-ldl" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-unknown-linux -fsanitize=leak -fsanitize-coverage=func \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-LSAN-COV-LINUX %s +// +// CHECK-LSAN-COV-LINUX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-LSAN-COV-LINUX-NOT: "-lc" +// CHECK-LSAN-COV-LINUX-NOT: libclang_rt.ubsan +// CHECK-LSAV-COV-LINUX: libclang_rt.lsan-x86_64.a" +// CHECK-LSAN-COV-LINUX-NOT: libclang_rt.ubsan +// CHECK-LSAN-COV-LINUX: "-lpthread" +// CHECK-LSAN-COV-LINUX: "-ldl" + // RUN: %clang -fsanitize=leak,address %s -### -o %t.o 2>&1 \ // RUN: -target x86_64-unknown-linux \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ -- 2.40.0