[cfe-commits] r164299 - in /cfe/trunk: lib/Basic/Targets.cpp test/Driver/darwin-asan-nofortify.c test/lit.cfg

David Blaikie dblaikie at gmail.com
Thu Sep 20 11:48:13 PDT 2012


On Thu, Sep 20, 2012 at 3:10 AM, Alexander Potapenko <glider at google.com> wrote:
> Author: glider
> Date: Thu Sep 20 05:10:01 2012
> New Revision: 164299
>
> URL: http://llvm.org/viewvc/llvm-project?rev=164299&view=rev
> Log:
> Disable source fortification on Darwin with AddressSanitizer.
>
> ASan doesn't play well with -D_FORTIFY_SOURCE, which is enabled by default starting at OS X 10.7
>
> Added:
>     cfe/trunk/test/Driver/darwin-asan-nofortify.c
> Modified:
>     cfe/trunk/lib/Basic/Targets.cpp
>     cfe/trunk/test/lit.cfg
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=164299&r1=164298&r2=164299&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Thu Sep 20 05:10:01 2012
> @@ -92,6 +92,9 @@
>    Builder.defineMacro("__APPLE__");
>    Builder.defineMacro("__MACH__");
>    Builder.defineMacro("OBJC_NEW_PROPERTIES");
> +  // AddressSanitizer doesn't play well with source fortification, which is on
> +  // by default on Darwin.
> +  if (Opts.AddressSanitizer) Builder.defineMacro("_FORTIFY_SOURCE", "0");
>
>    if (!Opts.ObjCAutoRefCount) {
>      // __weak is always defined, for use in blocks and with objc pointers.
>
> Added: cfe/trunk/test/Driver/darwin-asan-nofortify.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-asan-nofortify.c?rev=164299&view=auto
> ==============================================================================
> --- cfe/trunk/test/Driver/darwin-asan-nofortify.c (added)
> +++ cfe/trunk/test/Driver/darwin-asan-nofortify.c Thu Sep 20 05:10:01 2012
> @@ -0,0 +1,5 @@
> +// Make sure AddressSanitizer disables _FORTIFY_SOURCE on Darwin.
> +
> +// REQUIRES: system-darwin
> +// RUN: %clang -faddress-sanitizer %s -E -dM -o - | FileCheck %s
> +// CHECK: #define _FORTIFY_SOURCE 0

This breaks on cross compiling builds of clang where the system is
darwin but the target is non-darwin.
(http://lab.llvm.org:8011/builders/clang-x86_64-darwin11-cross-linux-gnu/builds/5568/steps/check-all/logs/darwin-asan-nofortify.c)
- should this be REQUIRES: darwin instead? (I'm not intimately
familiar with the REQUIRES fields, etc, so I could be wrong)

- David

>
> Modified: cfe/trunk/test/lit.cfg
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=164299&r1=164298&r2=164299&view=diff
> ==============================================================================
> --- cfe/trunk/test/lit.cfg (original)
> +++ cfe/trunk/test/lit.cfg Thu Sep 20 05:10:01 2012
> @@ -222,6 +222,10 @@
>  if platform.system() not in ['Windows'] or lit.getBashPath() != '':
>      config.available_features.add('shell')
>
> +# For tests that require Darwin to run.
> +if platform.system() in ['Darwin']:
> +    config.available_features.add('system-darwin')
> +
>  # ANSI escape sequences in non-dumb terminal
>  if platform.system() not in ['Windows']:
>      config.available_features.add('ansi-escape-sequences')
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list