[PATCH] Allow to use -fsanitize=address for iOS simulator

Alexander Potapenko glider at google.com
Wed Mar 20 10:24:51 PDT 2013


My only concern about this patch was that we were letting the people
use the runtime on the simulator without giving any support for it.
But since no piece of documentation claims we support the iOS
simulator, it should be fine.
I'm going to commit the change tomorrow, because it's simple enough to
be eligible for post-commit review.

On Fri, Mar 15, 2013 at 8:13 PM, Alexander Potapenko <glider at google.com> wrote:
> This patch lets the users invoke `clang -fsanitize=address` to link binaries targeting the iOS simulator.
>
> http://llvm-reviews.chandlerc.com/D545
>
> Files:
>   lib/Driver/ToolChains.cpp
>
> Index: lib/Driver/ToolChains.cpp
> ===================================================================
> --- lib/Driver/ToolChains.cpp
> +++ lib/Driver/ToolChains.cpp
> @@ -335,17 +335,19 @@
>    // 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);
> +      }
>      }
>    }



--
Alexander Potapenko
Software Engineer
Google Moscow
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D545.1.patch
Type: text/x-patch
Size: 1298 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130320/80d88e32/attachment.bin>


More information about the cfe-commits mailing list