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

llvm-svn: 164299
This commit is contained in:
Alexander Potapenko 2012-09-20 10:10:01 +00:00
parent d2247528f5
commit b4f819086a
3 changed files with 12 additions and 0 deletions

View File

@ -92,6 +92,9 @@ static void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts,
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.

View File

@ -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

View File

@ -222,6 +222,10 @@ if platform.system() not in ['FreeBSD']:
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')