From: Alexander Potapenko Date: Thu, 21 Mar 2013 10:49:06 +0000 (+0000) Subject: [ASan] Let the users to invoke `clang -fsanitize=address` to link binaries targeting... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3656c612efe4889da0174ffa6a621a2d59fc3ecb;p=clang [ASan] Let the users to invoke `clang -fsanitize=address` to link binaries targeting the iOS simulator. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177633 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index e28f80114c..4afb4166d6 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -312,17 +312,19 @@ 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); - - // The ASAN runtime library requires C++. - AddCXXStdlibLibArgs(Args, CmdArgs); + 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); + } } }