Index: build/common.gypi |
diff --git a/build/common.gypi b/build/common.gypi |
index 23bd721b125ec689a629a4986848caa8d049c1c7..adc137df4a11089f5c3b691d6e0d24af567d03af 100644 |
--- a/build/common.gypi |
+++ b/build/common.gypi |
@@ -278,6 +278,11 @@ |
'tsan%': 0, |
'tsan_blacklist%': '<(PRODUCT_DIR)/../../tools/valgrind/tsan_v2/ignores.txt', |
+ # Enable building with MSAN (Clang's -fsanitize=memory option). |
+ # MemorySanitizer only works with clang, but msan=1 implies clang=1 |
+ # See http://clang.llvm.org/docs/MemorySanitizer.html |
+ 'msan%': 0, |
+ |
# Use a modified version of Clang to intercept allocated types and sizes |
# for allocated objects. clang_type_profiler=1 implies clang=1. |
# See http://dev.chromium.org/developers/deep-memory-profiler/cpp-object-type-identifier |
@@ -715,6 +720,7 @@ |
'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)', |
'mac_want_real_dsym%': '<(mac_want_real_dsym)', |
'asan%': '<(asan)', |
+ 'msan%': '<(msan)', |
'tsan%': '<(tsan)', |
'tsan_blacklist%': '<(tsan_blacklist)', |
'clang_type_profiler%': '<(clang_type_profiler)', |
@@ -1049,7 +1055,7 @@ |
'conditions': [ |
# TODO(glider): set clang to 1 earlier for ASan and TSan builds so |
# that it takes effect here. |
- ['clang==0 and asan==0 and tsan==0', { |
+ ['clang==0 and asan==0 and tsan==0 and msan==0', { |
# This will set gcc_version to XY if you are running gcc X.Y.*. |
# This is used to tweak build flags for gcc 4.5. |
'gcc_version%': '<!(python <(DEPTH)/build/compiler_version.py)', |
@@ -1476,6 +1482,9 @@ |
['tsan==1', { |
'clang%': 1, |
}], |
+ ['msan==1', { |
+ 'clang%': 1, |
+ }], |
['OS=="linux" and clang_type_profiler==1', { |
'clang%': 1, |
@@ -2928,6 +2937,31 @@ |
}], |
], |
}], |
+ ['msan==1', { |
+ 'target_conditions': [ |
+ ['_toolset=="target"', { |
+ 'cflags': [ |
+ '-fsanitize=memory', |
+ '-fsanitize-memory-track-origins', |
+ '-fno-omit-frame-pointer', |
+ '-fPIC', |
+ ], |
+ 'ldflags': [ |
+ '-fsanitize=memory', |
+ ], |
+ 'defines': [ |
+ 'MEMORY_SANITIZER', |
+ ], |
+ 'target_conditions': [ |
+ ['_type=="executable"', { |
+ 'ldflags': [ |
+ '-pie', |
+ ], |
+ }], |
+ ], |
+ }], |
+ ], |
+ }], |
['order_profiling!=0 and (chromeos==1 or OS=="linux" or OS=="android")', { |
'target_conditions' : [ |
['_toolset=="target"', { |