[cfe-commits] r164299 - in /cfe/trunk: lib/Basic/Targets.cpp test/Driver/darwin-asan-nofortify.c test/lit.cfg
Alexander Potapenko
glider at google.com
Thu Sep 20 03:10:01 PDT 2012
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
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')
More information about the cfe-commits
mailing list