forked from OSchip/llvm-project
Enable leak sanitizer builds for darwin
Summary: Support for leak sanitizer on darwin has been added to compiler-rt, this patch adds compiler support. Reviewers: dexonsmith, compnerd Subscribers: alekseyshl, kubamracek, cfe-commits Differential Revision: https://reviews.llvm.org/D32192 llvm-svn: 300894
This commit is contained in:
parent
4279c58ec4
commit
8e63e54177
|
@ -1035,6 +1035,8 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
|
|||
const SanitizerArgs &Sanitize = getSanitizerArgs();
|
||||
if (Sanitize.needsAsanRt())
|
||||
AddLinkSanitizerLibArgs(Args, CmdArgs, "asan");
|
||||
if (Sanitize.needsLsanRt())
|
||||
AddLinkSanitizerLibArgs(Args, CmdArgs, "lsan");
|
||||
if (Sanitize.needsUbsanRt())
|
||||
AddLinkSanitizerLibArgs(Args, CmdArgs, "ubsan");
|
||||
if (Sanitize.needsTsanRt())
|
||||
|
@ -1892,6 +1894,7 @@ SanitizerMask Darwin::getSupportedSanitizers() const {
|
|||
const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
|
||||
SanitizerMask Res = ToolChain::getSupportedSanitizers();
|
||||
Res |= SanitizerKind::Address;
|
||||
Res |= SanitizerKind::Leak;
|
||||
if (isTargetMacOS()) {
|
||||
if (!isMacosxVersionLT(10, 9))
|
||||
Res |= SanitizerKind::Vptr;
|
||||
|
|
|
@ -358,6 +358,27 @@
|
|||
// RUN: %clang -target i386-pc-openbsd -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-OPENBSD
|
||||
// CHECK-ASAN-OPENBSD: unsupported option '-fsanitize=address' for target 'i386-pc-openbsd'
|
||||
|
||||
// RUN: %clang -target x86_64-apple-darwin -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-X86-64-DARWIN
|
||||
// CHECK-LSAN-X86-64-DARWIN-NOT: unsupported option
|
||||
|
||||
// RUN: %clang -target x86_64-apple-iossimulator -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-X86-64-IOSSIMULATOR
|
||||
// CHECK-LSAN-X86-64-IOSSIMULATOR-NOT: unsupported option
|
||||
|
||||
// RUN: %clang -target x86_64-apple-tvossimulator -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-X86-64-TVOSSIMULATOR
|
||||
// CHECK-LSAN-X86-64-TVOSSIMULATOR-NOT: unsupported option
|
||||
|
||||
// RUN: %clang -target i386-apple-darwin -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-I386-DARWIN
|
||||
// CHECK-LSAN-I386-DARWIN-NOT: unsupported option
|
||||
|
||||
// RUN: %clang -target arm-apple-ios -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-ARM-IOS
|
||||
// CHECK-LSAN-ARM-IOS-NOT: unsupported option
|
||||
|
||||
// RUN: %clang -target i386-apple-iossimulator -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-I386-IOSSIMULATOR
|
||||
// CHECK-LSAN-I386-IOSSIMULATOR-NOT: unsupported option
|
||||
|
||||
// RUN: %clang -target i386-apple-tvossimulator -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LSAN-I386-TVOSSIMULATOR
|
||||
// CHECK-LSAN-I386-TVOSSIMULATOR-NOT: unsupported option
|
||||
|
||||
// RUN: %clang -target i686-linux-gnu -fsanitize=efficiency-cache-frag %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ESAN-X86
|
||||
// RUN: %clang -target i686-linux-gnu -fsanitize=efficiency-working-set %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ESAN-X86
|
||||
// CHECK-ESAN-X86: error: unsupported option '-fsanitize=efficiency-{{.*}}' for target 'i686--linux-gnu'
|
||||
|
|
|
@ -409,6 +409,15 @@
|
|||
// CHECK-ASAN-DARWIN106-CXX: libclang_rt.asan_osx_dynamic.dylib
|
||||
// CHECK-ASAN-DARWIN106-CXX-NOT: -lc++abi
|
||||
|
||||
// RUN: %clangxx -fsanitize=leak %s -### -o %t.o 2>&1 \
|
||||
// RUN: -mmacosx-version-min=10.6 \
|
||||
// RUN: -target x86_64-apple-darwin13.4.0 -fuse-ld=ld -stdlib=platform \
|
||||
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-LSAN-DARWIN106-CXX %s
|
||||
// CHECK-LSAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}"
|
||||
// CHECK-LSAN-DARWIN106-CXX: libclang_rt.lsan_osx_dynamic.dylib
|
||||
// CHECK-LSAN-DARWIN106-CXX-NOT: -lc++abi
|
||||
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
|
||||
// RUN: -target x86_64-unknown-linux -fuse-ld=ld -fsanitize=safe-stack \
|
||||
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||||
|
|
Loading…
Reference in New Issue