[ASan] Link with libclang_rt.asan_iossim_dynamic.dylib when targeting the iOS simulator.

Add a test.

llvm-svn: 194820
This commit is contained in:
Alexander Potapenko 2013-11-15 16:07:44 +00:00
parent 71ce0cab02
commit 868cca96c4
2 changed files with 19 additions and 2 deletions

View File

@ -329,8 +329,17 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
// The ASAN runtime library requires C++.
AddCXXStdlibLibArgs(Args, CmdArgs);
}
AddLinkRuntimeLib(Args, CmdArgs,
"libclang_rt.asan_osx_dynamic.dylib", true);
if (isTargetMacOS()) {
AddLinkRuntimeLib(Args, CmdArgs,
"libclang_rt.asan_osx_dynamic.dylib",
true);
} else {
if (isTargetIOSSimulator()) {
AddLinkRuntimeLib(Args, CmdArgs,
"libclang_rt.asan_iossim_dynamic.dylib",
true);
}
}
}
}

View File

@ -8,6 +8,14 @@
// CHECK-ASAN: stdc++
// CHECK-ASAN: libclang_rt.asan_osx_dynamic.dylib"
// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
// RUN: -fsanitize=address -mios-simulator-version-min=7.0 %s -o %t.o 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-ASAN-IOSSIM %s
// CHECK-ASAN-IOSSIM: "{{.*}}ld{{(.exe)?}}"
// CHECK-ASAN-IOSSIM: stdc++
// CHECK-ASAN-IOSSIM: libclang_rt.asan_iossim_dynamic.dylib"
// RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \
// RUN: -fPIC -shared -fsanitize=address %s -o %t.so 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-DYN-ASAN %s