forked from OSchip/llvm-project
[Driver] Sanitizer support based on runtime library presence
The runtime libraries of sanitizers are built in compiler-rt, and Clang can be built without compiler-rt, or compiler-rt can be configured to only build certain sanitizers. The driver should provide reasonable diagnostics and not a link-time error when a runtime library is missing. This patch changes the driver for OS X to only support sanitizers of which we can find the runtime libraries. The discussion for this patch explains the rationale Differential Revision: https://reviews.llvm.org/D15225 llvm-svn: 337635
This commit is contained in:
parent
bbfe0b79e2
commit
8d12fc1907
|
@ -916,13 +916,26 @@ unsigned DarwinClang::GetDefaultDwarfVersion() const {
|
|||
return 4;
|
||||
}
|
||||
|
||||
SmallString<128> MachO::runtimeLibDir(bool IsEmbedded) const {
|
||||
SmallString<128> Dir(getDriver().ResourceDir);
|
||||
llvm::sys::path::append(
|
||||
Dir, "lib", IsEmbedded ? "macho_embedded" : "darwin");
|
||||
return Dir;
|
||||
}
|
||||
|
||||
std::string Darwin::getFileNameForSanitizerLib(StringRef SanitizerName,
|
||||
bool Shared) const {
|
||||
return (Twine("libclang_rt.") + SanitizerName + "_" +
|
||||
getOSLibraryNameSuffix() +
|
||||
(Shared ? "_dynamic.dylib" : ".a")).str();
|
||||
|
||||
}
|
||||
|
||||
void MachO::AddLinkRuntimeLib(const ArgList &Args, ArgStringList &CmdArgs,
|
||||
StringRef DarwinLibName,
|
||||
RuntimeLinkOptions Opts) const {
|
||||
SmallString<128> Dir(getDriver().ResourceDir);
|
||||
llvm::sys::path::append(
|
||||
Dir, "lib", (Opts & RLO_IsEmbedded) ? "macho_embedded" : "darwin");
|
||||
|
||||
SmallString<128> Dir = runtimeLibDir(Opts & RLO_IsEmbedded);
|
||||
SmallString<128> P(Dir);
|
||||
llvm::sys::path::append(P, DarwinLibName);
|
||||
|
||||
|
@ -1042,12 +1055,9 @@ void DarwinClang::AddLinkSanitizerLibArgs(const ArgList &Args,
|
|||
StringRef Sanitizer,
|
||||
bool Shared) const {
|
||||
auto RLO = RuntimeLinkOptions(RLO_AlwaysLink | (Shared ? RLO_AddRPath : 0U));
|
||||
AddLinkRuntimeLib(Args, CmdArgs,
|
||||
(Twine("libclang_rt.") + Sanitizer + "_" +
|
||||
getOSLibraryNameSuffix() +
|
||||
(Shared ? "_dynamic.dylib" : ".a"))
|
||||
.str(),
|
||||
RLO);
|
||||
std::string SanitizerRelFilename =
|
||||
getFileNameForSanitizerLib(Sanitizer, Shared);
|
||||
AddLinkRuntimeLib(Args, CmdArgs, SanitizerRelFilename, RLO);
|
||||
}
|
||||
|
||||
ToolChain::RuntimeLibType DarwinClang::GetRuntimeLibType(
|
||||
|
@ -2285,24 +2295,43 @@ void Darwin::CheckObjCARC() const {
|
|||
SanitizerMask Darwin::getSupportedSanitizers() const {
|
||||
const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
|
||||
SanitizerMask Res = ToolChain::getSupportedSanitizers();
|
||||
Res |= SanitizerKind::Address;
|
||||
Res |= SanitizerKind::Leak;
|
||||
Res |= SanitizerKind::Fuzzer;
|
||||
Res |= SanitizerKind::FuzzerNoLink;
|
||||
Res |= SanitizerKind::Function;
|
||||
if (isTargetMacOS()) {
|
||||
if (!isMacosxVersionLT(10, 9))
|
||||
Res |= SanitizerKind::Vptr;
|
||||
Res |= SanitizerKind::SafeStack;
|
||||
if (IsX86_64)
|
||||
Res |= SanitizerKind::Thread;
|
||||
} else if (isTargetIOSSimulator() || isTargetTvOSSimulator()) {
|
||||
if (IsX86_64)
|
||||
Res |= SanitizerKind::Thread;
|
||||
|
||||
{
|
||||
using namespace SanitizerKind;
|
||||
assert(!(Res & (Address | Leak | Fuzzer | FuzzerNoLink | Thread)) &&
|
||||
"Sanitizer is already registered as supported");
|
||||
}
|
||||
|
||||
if (sanitizerRuntimeExists("asan"))
|
||||
Res |= SanitizerKind::Address;
|
||||
if (sanitizerRuntimeExists("lsan"))
|
||||
Res |= SanitizerKind::Leak;
|
||||
if (sanitizerRuntimeExists("fuzzer", /*Shared=*/false)) {
|
||||
Res |= SanitizerKind::Fuzzer;
|
||||
Res |= SanitizerKind::FuzzerNoLink;
|
||||
}
|
||||
Res |= SanitizerKind::Function;
|
||||
if (isTargetMacOS() && !isMacosxVersionLT(10, 9))
|
||||
Res |= SanitizerKind::Vptr;
|
||||
if (isTargetMacOS())
|
||||
Res |= SanitizerKind::SafeStack;
|
||||
|
||||
if (sanitizerRuntimeExists("tsan") && IsX86_64 &&
|
||||
(isTargetMacOS() || isTargetIOSSimulator() || isTargetTvOSSimulator()))
|
||||
Res |= SanitizerKind::Thread;
|
||||
|
||||
return Res;
|
||||
}
|
||||
|
||||
void Darwin::printVerboseInfo(raw_ostream &OS) const {
|
||||
CudaInstallation.print(OS);
|
||||
}
|
||||
|
||||
bool Darwin::sanitizerRuntimeExists(StringRef SanitizerName,
|
||||
bool Shared) const {
|
||||
std::string RelName = getFileNameForSanitizerLib(SanitizerName, Shared);
|
||||
SmallString<128> Dir = runtimeLibDir();
|
||||
SmallString<128> AbsName(Dir);
|
||||
llvm::sys::path::append(AbsName, RelName);
|
||||
return getVFS().exists(AbsName);
|
||||
}
|
||||
|
|
|
@ -130,6 +130,9 @@ protected:
|
|||
Tool *buildLinker() const override;
|
||||
Tool *getTool(Action::ActionClass AC) const override;
|
||||
|
||||
/// \return Directory to find the runtime library in.
|
||||
SmallString<128> runtimeLibDir(bool IsEmbedded=false) const;
|
||||
|
||||
private:
|
||||
mutable std::unique_ptr<tools::darwin::Lipo> Lipo;
|
||||
mutable std::unique_ptr<tools::darwin::Dsymutil> Dsymutil;
|
||||
|
@ -251,7 +254,6 @@ public:
|
|||
GetExceptionModel(const llvm::opt::ArgList &Args) const override {
|
||||
return llvm::ExceptionHandling::None;
|
||||
}
|
||||
|
||||
/// }
|
||||
};
|
||||
|
||||
|
@ -420,6 +422,11 @@ protected:
|
|||
StringRef getPlatformFamily() const;
|
||||
StringRef getOSLibraryNameSuffix() const;
|
||||
|
||||
/// \return Relative path to the filename for the library
|
||||
/// containing the sanitizer {@code SanitizerName}.
|
||||
std::string getFileNameForSanitizerLib(StringRef SanitizerName,
|
||||
bool Shared = true) const;
|
||||
|
||||
public:
|
||||
static StringRef getSDKName(StringRef isysroot);
|
||||
|
||||
|
@ -473,6 +480,12 @@ public:
|
|||
SanitizerMask getSupportedSanitizers() const override;
|
||||
|
||||
void printVerboseInfo(raw_ostream &OS) const override;
|
||||
|
||||
private:
|
||||
/// \return Whether the runtime corresponding to the given
|
||||
/// sanitizer exists in the toolchain.
|
||||
bool sanitizerRuntimeExists(StringRef SanitizerName,
|
||||
bool Shared = true) const;
|
||||
};
|
||||
|
||||
/// DarwinClang - The Darwin toolchain used by Clang.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Make sure AddressSanitizer disables _FORTIFY_SOURCE on Darwin.
|
||||
|
||||
// RUN: %clang -fsanitize=address %s -E -dM -target x86_64-darwin | FileCheck %s
|
||||
// RUN: %clang -fsanitize=address %s -E -dM -target x86_64-darwin -resource-dir %S/Inputs/resource_dir | FileCheck %s
|
||||
|
||||
// CHECK: #define _FORTIFY_SOURCE 0
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Test sanitizer link flags on Darwin.
|
||||
|
||||
// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
|
||||
// RUN: -resource-dir %S/Inputs/resource_dir \
|
||||
// RUN: -stdlib=platform -fsanitize=address %s -o %t.o 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ASAN %s
|
||||
|
||||
|
@ -12,6 +13,14 @@
|
|||
// CHECK-ASAN: "-rpath" "{{.*}}lib{{.*}}darwin"
|
||||
|
||||
// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
|
||||
// RUN: -resource-dir %S/Inputs/fake_resource_dir \
|
||||
// RUN: -stdlib=platform -fsanitize=address %s -o %t.o 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-LOAD-FAIL %s
|
||||
|
||||
// CHECK-LOAD-FAIL: error: unsupported option '-fsanitize=address' for target 'x86_64--darwin'
|
||||
|
||||
// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
|
||||
// RUN: -resource-dir %S/Inputs/resource_dir \
|
||||
// RUN: -fPIC -shared -fsanitize=address %s -o %t.so 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-DYN-ASAN %s
|
||||
|
||||
|
@ -22,6 +31,7 @@
|
|||
// CHECK-DYN-ASAN: "-rpath" "{{.*}}lib{{.*}}darwin"
|
||||
|
||||
// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
|
||||
// RUN: -resource-dir %S/Inputs/resource_dir \
|
||||
// RUN: -stdlib=platform -fsanitize=undefined %s -o %t.o 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-UBSAN %s
|
||||
|
||||
|
@ -34,6 +44,7 @@
|
|||
|
||||
// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
|
||||
// RUN: -fsanitize=bounds -fsanitize-undefined-trap-on-error \
|
||||
// RUN: -resource-dir %S/Inputs/resource_dir \
|
||||
// RUN: %s -o %t.o 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-BOUNDS %s
|
||||
|
||||
|
@ -42,6 +53,7 @@
|
|||
|
||||
// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
|
||||
// RUN: -fPIC -shared -fsanitize=undefined %s -o %t.so 2>&1 \
|
||||
// RUN: -resource-dir %S/Inputs/resource_dir \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-DYN-UBSAN %s
|
||||
|
||||
// CHECK-DYN-UBSAN: "{{.*}}ld{{(.exe)?}}"
|
||||
|
@ -52,6 +64,7 @@
|
|||
|
||||
// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
|
||||
// RUN: -fsanitize=bounds -fsanitize-undefined-trap-on-error \
|
||||
// RUN: -resource-dir %S/Inputs/resource_dir \
|
||||
// RUN: %s -o %t.so -fPIC -shared 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-DYN-BOUNDS %s
|
||||
|
||||
|
@ -60,6 +73,7 @@
|
|||
|
||||
// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
|
||||
// RUN: -stdlib=platform -fsanitize=address -mios-simulator-version-min=7.0 \
|
||||
// RUN: -resource-dir %S/Inputs/resource_dir \
|
||||
// RUN: %s -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-ASAN-IOSSIM %s
|
||||
|
||||
// CHECK-ASAN-IOSSIM: "{{.*}}ld{{(.exe)?}}"
|
||||
|
@ -70,6 +84,7 @@
|
|||
// CHECK-ASAN-IOSSIM: "-rpath" "{{.*}}lib{{.*}}darwin"
|
||||
|
||||
// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
|
||||
// RUN: -resource-dir %S/Inputs/resource_dir \
|
||||
// RUN: -stdlib=platform -fsanitize=address \
|
||||
// RUN: -mtvos-simulator-version-min=8.3.0 %s -o %t.o 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ASAN-TVOSSIM %s
|
||||
|
@ -83,6 +98,7 @@
|
|||
|
||||
// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
|
||||
// RUN: -stdlib=platform -fsanitize=address \
|
||||
// RUN: -resource-dir %S/Inputs/resource_dir \
|
||||
// RUN: -mwatchos-simulator-version-min=2.0.0 %s -o %t.o 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-ASAN-WATCHOSSIM %s
|
||||
|
||||
|
@ -94,6 +110,7 @@
|
|||
// CHECK-ASAN-WATCHOSSIM: "-rpath" "{{.*}}lib{{.*}}darwin"
|
||||
|
||||
// RUN: %clang -no-canonical-prefixes -### -target armv7-apple-ios \
|
||||
// RUN: -resource-dir %S/Inputs/resource_dir \
|
||||
// RUN: -stdlib=platform -fsanitize=address -miphoneos-version-min=7 \
|
||||
// RUN: %s -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-ASAN-IOS %s
|
||||
|
||||
|
@ -106,6 +123,7 @@
|
|||
|
||||
// RUN: %clang -no-canonical-prefixes -### -target arm64-apple-tvos \
|
||||
// RUN: -stdlib=platform -fsanitize=address -mtvos-version-min=8.3 \
|
||||
// RUN: -resource-dir %S/Inputs/resource_dir \
|
||||
// RUN: %s -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-ASAN-TVOS %s
|
||||
|
||||
// CHECK-ASAN-TVOS: "{{.*}}ld{{(.exe)?}}"
|
||||
|
@ -117,6 +135,7 @@
|
|||
|
||||
// RUN: %clang -no-canonical-prefixes -### -target armv7k-apple-watchos \
|
||||
// RUN: -stdlib=platform -fsanitize=address -mwatchos-version-min=2.0 \
|
||||
// RUN: -resource-dir %S/Inputs/resource_dir \
|
||||
// RUN: %s -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-ASAN-WATCHOS %s
|
||||
|
||||
// CHECK-ASAN-WATCHOS: "{{.*}}ld{{(.exe)?}}"
|
||||
|
|
|
@ -343,24 +343,24 @@
|
|||
// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=memory -fno-sanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-NOMSAN-DARWIN
|
||||
// CHECK-MSAN-NOMSAN-DARWIN-NOT: unsupported option
|
||||
|
||||
// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=memory -fsanitize=thread,memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-TSAN-MSAN-DARWIN
|
||||
// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=memory -fsanitize=thread,memory -resource-dir %S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-TSAN-MSAN-DARWIN
|
||||
// CHECK-MSAN-TSAN-MSAN-DARWIN: unsupported option '-fsanitize=memory' for target 'x86_64-apple-darwin10'
|
||||
// CHECK-MSAN-TSAN-MSAN-DARWIN-NOT: unsupported option
|
||||
|
||||
// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=thread,memory -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-MSAN-MSAN-DARWIN
|
||||
// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=thread,memory -fsanitize=memory -resource-dir %S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-MSAN-MSAN-DARWIN
|
||||
// CHECK-TSAN-MSAN-MSAN-DARWIN: unsupported option '-fsanitize=memory' for target 'x86_64-apple-darwin10'
|
||||
// CHECK-TSAN-MSAN-MSAN-DARWIN-NOT: unsupported option
|
||||
|
||||
// RUN: %clang -target x86_64-apple-darwin -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-X86-64-DARWIN
|
||||
// RUN: %clang -target x86_64-apple-darwin -fsanitize=thread -resource-dir %S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-X86-64-DARWIN
|
||||
// CHECK-TSAN-X86-64-DARWIN-NOT: unsupported option
|
||||
|
||||
// RUN: %clang -target x86_64-apple-iossimulator -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-X86-64-IOSSIMULATOR
|
||||
// RUN: %clang -target x86_64-apple-iossimulator -fsanitize=thread -resource-dir %S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-X86-64-IOSSIMULATOR
|
||||
// CHECK-TSAN-X86-64-IOSSIMULATOR-NOT: unsupported option
|
||||
|
||||
// RUN: %clang -target x86_64-apple-tvossimulator -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-X86-64-TVOSSIMULATOR
|
||||
// RUN: %clang -target x86_64-apple-tvossimulator -fsanitize=thread -resource-dir %S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-X86-64-TVOSSIMULATOR
|
||||
// CHECK-TSAN-X86-64-TVOSSIMULATOR-NOT: unsupported option
|
||||
|
||||
// RUN: %clang -target i386-apple-darwin -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-I386-DARWIN
|
||||
// RUN: %clang -target i386-apple-darwin -fsanitize=thread -resource-dir %S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-I386-DARWIN
|
||||
// CHECK-TSAN-I386-DARWIN: unsupported option '-fsanitize=thread' for target 'i386-apple-darwin'
|
||||
|
||||
// RUN: %clang -target arm-apple-ios -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TSAN-ARM-IOS
|
||||
|
@ -433,25 +433,25 @@
|
|||
// RUN: %clang -target i386-pc-openbsd -fsanitize=efficiency-working-set %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ESAN-OPENBSD
|
||||
// CHECK-ESAN-OPENBSD: error: unsupported option '-fsanitize=efficiency-{{.*}}' 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
|
||||
// RUN: %clang -target x86_64-apple-darwin -fsanitize=leak -resource-dir %S/Inputs/resource_dir %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
|
||||
// RUN: %clang -target x86_64-apple-iossimulator -fsanitize=leak -resource-dir %S/Inputs/resource_dir %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
|
||||
// RUN: %clang -target x86_64-apple-tvossimulator -fsanitize=leak -resource-dir %S/Inputs/resource_dir %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
|
||||
// RUN: %clang -target i386-apple-darwin -fsanitize=leak -resource-dir %S/Inputs/resource_dir %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
|
||||
// RUN: %clang -target arm-apple-ios -fsanitize=leak -resource-dir %S/Inputs/resource_dir %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
|
||||
// RUN: %clang -target i386-apple-iossimulator -fsanitize=leak -resource-dir %S/Inputs/resource_dir %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
|
||||
// RUN: %clang -target i386-apple-tvossimulator -fsanitize=leak -resource-dir %S/Inputs/resource_dir %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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Test flags inserted by -fsanitize=fuzzer.
|
||||
|
||||
// RUN: %clang -fsanitize=fuzzer %s -target x86_64-apple-darwin14 -### 2>&1 | FileCheck --check-prefixes=CHECK-FUZZER-LIB,CHECK-COVERAGE-FLAGS %s
|
||||
// RUN: %clang -fsanitize=fuzzer %s -target x86_64-apple-darwin14 -resource-dir %S/Inputs/resource_dir -### 2>&1 | FileCheck --check-prefixes=CHECK-FUZZER-LIB,CHECK-COVERAGE-FLAGS %s
|
||||
//
|
||||
// CHECK-FUZZER-LIB: libclang_rt.fuzzer
|
||||
// CHECK-COVERAGE: -fsanitize-coverage-inline-8bit-counters
|
||||
|
@ -8,21 +8,21 @@
|
|||
// CHECK-COVERAGE-SAME: -fsanitize-coverage-trace-cmp
|
||||
// CHECK-COVERAGE-SAME: -fsanitize-coverage-pc-table
|
||||
|
||||
// RUN: %clang -fsanitize=fuzzer -target i386-unknown-linux -stdlib=platform %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-LINUX %s
|
||||
// RUN: %clang -fsanitize=fuzzer -target i386-unknown-linux -stdlib=platform -resource-dir %S/Inputs/resource_dir %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-LINUX %s
|
||||
//
|
||||
// CHECK-LIBCXX-LINUX: -lstdc++
|
||||
|
||||
// RUN: %clang -target x86_64-apple-darwin14 -fsanitize=fuzzer %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-DARWIN %s
|
||||
// RUN: %clang -target x86_64-apple-darwin14 -fsanitize=fuzzer -resource-dir %S/Inputs/resource_dir %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-DARWIN %s
|
||||
//
|
||||
// CHECK-LIBCXX-DARWIN: -lc++
|
||||
|
||||
|
||||
// Check that we don't link in libFuzzer.a when producing a shared object.
|
||||
// RUN: %clang -fsanitize=fuzzer %s -shared -o %t.so -### 2>&1 | FileCheck --check-prefixes=CHECK-NOLIB-SO %s
|
||||
// RUN: %clang -fsanitize=fuzzer %s -shared -o %t.so -resource-dir %S/Inputs/resource_dir -### 2>&1 | FileCheck --check-prefixes=CHECK-NOLIB-SO %s
|
||||
// CHECK-NOLIB-SO-NOT: libclang_rt.libfuzzer
|
||||
|
||||
// Check that we don't link in libFuzzer when compiling with -fsanitize=fuzzer-no-link.
|
||||
// RUN: %clang -fsanitize=fuzzer-no-link %s -target x86_64-apple-darwin14 -### 2>&1 | FileCheck --check-prefixes=CHECK-NOLIB,CHECK-COV %s
|
||||
// RUN: %clang -fsanitize=fuzzer-no-link %s -target x86_64-apple-darwin14 -resource-dir %S/Inputs/resource_dir -### 2>&1 | FileCheck --check-prefixes=CHECK-NOLIB,CHECK-COV %s
|
||||
// CHECK-NOLIB-NOT: libclang_rt.libfuzzer
|
||||
// CHECK-COV: -fsanitize-coverage-inline-8bit-counters
|
||||
|
||||
|
|
|
@ -530,6 +530,7 @@
|
|||
|
||||
// RUN: %clangxx -fsanitize=address %s -### -o %t.o 2>&1 \
|
||||
// RUN: -mmacosx-version-min=10.6 \
|
||||
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
||||
// 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-ASAN-DARWIN106-CXX %s
|
||||
|
@ -539,6 +540,7 @@
|
|||
|
||||
// RUN: %clangxx -fsanitize=leak %s -### -o %t.o 2>&1 \
|
||||
// RUN: -mmacosx-version-min=10.6 \
|
||||
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
||||
// 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
|
||||
|
@ -598,6 +600,7 @@
|
|||
|
||||
// RUN: %clang -fsanitize=cfi -fsanitize-stats %s -### -o %t.o 2>&1 \
|
||||
// RUN: -target x86_64-apple-darwin -fuse-ld=ld \
|
||||
// RUN: -resource-dir=%S/Inputs/resource_dir \
|
||||
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-CFI-STATS-DARWIN %s
|
||||
// CHECK-CFI-STATS-DARWIN: "{{.*}}ld{{(.exe)?}}"
|
||||
|
|
Loading…
Reference in New Issue