Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp	(revision 164136)
+++ lib/Basic/Targets.cpp	(working copy)
@@ -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.
Index: test/Driver/darwin-asan-nofortify.c
===================================================================
--- test/Driver/darwin-asan-nofortify.c	(revision 0)
+++ test/Driver/darwin-asan-nofortify.c	(working copy)
@@ -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
Index: test/lit.cfg
===================================================================
--- test/lit.cfg	(revision 164136)
+++ test/lit.cfg	(working copy)
@@ -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')
