...or you could just write the test with an explicit triple. (For completeness, also a negative check for a non-Darwin triple.)
On Sep 21, 2012, at 2:25 , Alexander Potapenko <[email protected]> wrote: > I don't know if the feature "darwin" exists at all (I've added > system-darwin in this particular CL) > I wonder if it's possible to detect the default triple for the > compiler and disable the test depending on that. > Will take a closer look later today. > > On Thu, Sep 20, 2012 at 10:48 PM, David Blaikie <[email protected]> wrote: >> On Thu, Sep 20, 2012 at 3:10 AM, Alexander Potapenko <[email protected]> >> 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 >>> [email protected] >>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > > > > -- > Alexander Potapenko > Software Engineer > Google Moscow > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
