forked from OSchip/llvm-project
[ASan] Let the users to invoke `clang -fsanitize=address` to link binaries targeting the iOS simulator.
llvm-svn: 177633
This commit is contained in:
parent
df973ed626
commit
5700f40d80
|
@ -312,19 +312,21 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
|
|||
// Add ASAN runtime library, if required. Dynamic libraries and bundles
|
||||
// should not be linked with the runtime library.
|
||||
if (Sanitize.needsAsanRt()) {
|
||||
if (Args.hasArg(options::OPT_dynamiclib) ||
|
||||
Args.hasArg(options::OPT_bundle)) {
|
||||
// Assume the binary will provide the ASan runtime.
|
||||
} else if (isTargetIPhoneOS()) {
|
||||
if (isTargetIPhoneOS() && !isTargetIOSSimulator()) {
|
||||
getDriver().Diag(diag::err_drv_clang_unsupported_per_platform)
|
||||
<< "-fsanitize=address";
|
||||
} else {
|
||||
AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.asan_osx_dynamic.dylib", true);
|
||||
|
||||
if (Args.hasArg(options::OPT_dynamiclib) ||
|
||||
Args.hasArg(options::OPT_bundle)) {
|
||||
// Assume the binary will provide the ASan runtime.
|
||||
} else {
|
||||
AddLinkRuntimeLib(Args, CmdArgs,
|
||||
"libclang_rt.asan_osx_dynamic.dylib", true);
|
||||
// The ASAN runtime library requires C++.
|
||||
AddCXXStdlibLibArgs(Args, CmdArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise link libSystem, then the dynamic runtime library, and finally any
|
||||
// target specific static runtime library.
|
||||
|
|
Loading…
Reference in New Issue