From d1033f575617298c2d4c4c629a5fe10bc2120e4f 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 llvm-svn: 289144 --- clang/lib/Driver/SanitizerArgs.cpp | 3 ++- clang/test/Driver/sanitizer-ld.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp index 16a3672..f4f6dad 100644 --- a/clang/lib/Driver/SanitizerArgs.cpp +++ b/clang/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/clang/test/Driver/sanitizer-ld.c b/clang/test/Driver/sanitizer-ld.c index 698f695..91798b9 100644 --- a/clang/test/Driver/sanitizer-ld.c +++ b/clang/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.7.4