Index: build/common.gypi |
=================================================================== |
--- build/common.gypi (revision 145435) |
+++ build/common.gypi (working copy) |
@@ -223,6 +223,11 @@ |
# See https://sites.google.com/a/chromium.org/dev/developers/testing/addresssanitizer |
'asan%': 0, |
+ # Enable building with TSAN (Clang's -fthread-sanitizer option). |
+ # -fthread-sanitizer only works with clang, but tsan=1 implies clang=1 |
+ # See http://clang.llvm.org/docs/ThreadSanitizer.html |
+ 'tsan%': 0, |
+ |
# Set to true to instrument the code with function call logger. |
# See src/third_party/cygprofile/cyg-profile.cc for details. |
'order_profiling%': 0, |
@@ -560,6 +565,7 @@ |
'notifications%': '<(notifications)', |
'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)', |
'asan%': '<(asan)', |
+ 'tsan%': '<(tsan)', |
'order_profiling%': '<(order_profiling)', |
'order_text_section%': '<(order_text_section)', |
'enable_extensions%': '<(enable_extensions)', |
@@ -1130,9 +1136,15 @@ |
'clang%': 1, |
# Do not use Chrome plugins for Clang. The Clang version in |
# third_party/asan may be different from the default one. |
+ # TODO(glider): this isn't true anymore, need to check if we can use the |
+ # plugins now. |
'clang_use_chrome_plugins%': 0, |
}], |
+ ['tsan==1', { |
+ 'clang%': 1, |
+ }], |
+ |
# On valgrind bots, override the optimizer settings so we don't inline too |
# much and make the stacks harder to figure out. |
# |
@@ -2286,6 +2298,25 @@ |
}], |
], |
}], |
+ ['tsan==1', { |
+ 'target_conditions': [ |
+ ['_toolset=="target"', { |
+ 'cflags': [ |
+ '-fthread-sanitizer', |
+ '-fno-omit-frame-pointer', |
+ '-fPIE', |
+ ], |
+ 'ldflags': [ |
+ '-fthread-sanitizer', |
+ '-pie', |
+ ], |
+ 'defines': [ |
+ 'THREAD_SANITIZER', |
+ 'DYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1', |
+ ], |
+ }], |
+ ], |
+ }], |
['order_profiling!=0 and (chromeos==1 or OS=="linux")', { |
'target_conditions' : [ |
['_toolset=="target"', { |