Index: build/config/compiler/BUILD.gn |
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
index e6cc59b840a0dbaa45597a0a756074f720047eef..7aaa9fbe8b80fd420b0960578de9c7e81c169206 100644 |
--- a/build/config/compiler/BUILD.gn |
+++ b/build/config/compiler/BUILD.gn |
@@ -56,6 +56,11 @@ declare_args() { |
# The patch is preapplied to the internal toolchain and hence all bots. |
msvs_xtree_patched = false |
} |
+ |
+ # Track where uninitialized memory originates from. From fastest to slowest: |
+ # 0 - no tracking, 1 - track only the initial allocation site, 2 - track the |
+ # chain of stores leading from allocation site to use site. |
+ msan_track_origins = 2 |
} |
# default_include_dirs --------------------------------------------------------- |
@@ -139,12 +144,39 @@ config("compiler") { |
] |
} |
if (is_asan) { |
- cflags += [ "-fsanitize=address" ] |
+ asan_blacklist_path = |
+ rebase_path("//tools/memory/asan/blacklist.txt", root_build_dir) |
+ cflags += [ |
+ "-fsanitize=address", |
+ "-fsanitize-blacklist=$asan_blacklist_path", |
+ ] |
if (is_mac) { |
cflags += [ "-mllvm -asan-globals=0" ] # http://crbug.com/352073 |
# TODO(GYP): deal with mac_bundles. |
} |
} |
+ if (is_lsan) { |
+ cflags += [ "-fsanitize=leak" ] |
+ } |
+ if (is_tsan) { |
+ tsan_blacklist_path = |
+ rebase_path("//tools/memory/tsan_v2/ignores.txt", root_build_dir) |
+ cflags += [ |
+ "-fsanitize=thread", |
+ "-fsanitize-blacklist=$tsan_blacklist_path", |
+ ] |
+ } |
+ if (is_msan) { |
+ msan_blacklist_path = |
+ rebase_path("//tools/msan/blacklist.txt", root_build_dir) |
+ cflags += [ |
+ "-fsanitize=memory", |
+ "-fsanitize-memory-track-origins=$msan_track_origins", |
+ "-fsanitize-blacklist=$msan_blacklist_path", |
+ ] |
+ |
+ # TODO(GYP): Support instrumented libraries and custom libc++. |
+ } |
} |
if (is_clang && is_debug) { |