forked from OSchip/llvm-project
[Driver] Fix -static-libsan / -shared-libsan on Darwin
Don't ignore these flags on Darwin. The old behavior of using the dynamic runtime when neither flag is passed is preserved. llvm-svn: 315142
This commit is contained in:
parent
8bd0c45c7a
commit
358d642f65
|
@ -612,7 +612,8 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
|
|||
|
||||
SharedRuntime =
|
||||
Args.hasFlag(options::OPT_shared_libsan, options::OPT_static_libsan,
|
||||
TC.getTriple().isAndroid() || TC.getTriple().isOSFuchsia());
|
||||
TC.getTriple().isAndroid() || TC.getTriple().isOSFuchsia() ||
|
||||
TC.getTriple().isOSDarwin());
|
||||
|
||||
if (AllAddedKinds & Address) {
|
||||
NeedPIE |= TC.getTriple().isAndroid() || TC.getTriple().isOSFuchsia();
|
||||
|
|
|
@ -1049,7 +1049,8 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
|
|||
if (Sanitize.needsUbsanRt())
|
||||
AddLinkSanitizerLibArgs(Args, CmdArgs,
|
||||
Sanitize.requiresMinimalRuntime() ? "ubsan_minimal"
|
||||
: "ubsan");
|
||||
: "ubsan",
|
||||
Sanitize.needsSharedRt());
|
||||
if (Sanitize.needsTsanRt())
|
||||
AddLinkSanitizerLibArgs(Args, CmdArgs, "tsan");
|
||||
if (Sanitize.needsFuzzer() && !Args.hasArg(options::OPT_dynamiclib)) {
|
||||
|
|
|
@ -335,6 +335,13 @@
|
|||
// CHECK-UBSAN-MINIMAL-DARWIN: "{{.*}}ld{{(.exe)?}}"
|
||||
// CHECK-UBSAN-MINIMAL-DARWIN: "{{.*}}libclang_rt.ubsan_minimal_osx_dynamic.dylib"
|
||||
|
||||
// RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
|
||||
// RUN: -target x86_64-apple-darwin -fuse-ld=ld -static-libsan \
|
||||
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-UBSAN-STATIC-DARWIN %s
|
||||
// CHECK-UBSAN-STATIC-DARWIN: "{{.*}}ld{{(.exe)?}}"
|
||||
// CHECK-UBSAN-STATIC-DARWIN: "{{.*}}libclang_rt.ubsan_osx.a"
|
||||
|
||||
// RUN: %clang -fsanitize=address,undefined %s -### -o %t.o 2>&1 \
|
||||
// RUN: -target i386-unknown-linux -fuse-ld=ld \
|
||||
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
|
||||
|
|
Loading…
Reference in New Issue