Index: build/config/sanitizers/BUILD.gn |
diff --git a/build/config/sanitizers/BUILD.gn b/build/config/sanitizers/BUILD.gn |
index 3972a5c0e3b5e65b9ce25ab2081cef1577c49f47..023315f12bd45293f71678dd27e117c74ad697c6 100644 |
--- a/build/config/sanitizers/BUILD.gn |
+++ b/build/config/sanitizers/BUILD.gn |
@@ -2,23 +2,41 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-# Contains the dependencies needed for asan to link into executables and |
+import("//build/config/sanitizers/sanitizers.gni") |
+ |
+# Contains the dependencies needed for sanitizers to link into executables and |
# shared_libraries. Unconditionally depend upon this target as it is empty if |
-# |is_asan| is false. |
+# |is_asan|, |is_lsan|, |is_tsan|, |is_msan| and |use_custom_libcxx| are false. |
group("deps") { |
- if (is_asan) { |
+ # TODO(vtl): Chromium has the following (but we don't have |
+ # instrumented_libraries). |
+ # deps = [ |
+ # "//third_party/instrumented_libraries:deps", |
+ # ] |
+ deps = [] |
+ if (is_asan || is_lsan || is_tsan || is_msan) { |
public_configs = [ ":sanitizer_options_link_helper" ] |
- deps = [ |
- ":options_sources", |
- ] |
+ deps += [ ":options_sources" ] |
+ } |
+ if (use_custom_libcxx) { |
+ deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ] |
} |
} |
config("sanitizer_options_link_helper") { |
- ldflags = [ |
- "-Wl,-u_sanitizer_options_link_helper", |
- "-fsanitize=address", |
- ] |
+ ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ] |
+ if (is_asan) { |
+ ldflags += [ "-fsanitize=address" ] |
+ } |
+ if (is_lsan) { |
+ ldflags += [ "-fsanitize=leak" ] |
+ } |
+ if (is_tsan) { |
+ ldflags += [ "-fsanitize=thread" ] |
+ } |
+ if (is_msan) { |
+ ldflags += [ "-fsanitize=memory" ] |
+ } |
} |
source_set("options_sources") { |
@@ -34,6 +52,10 @@ source_set("options_sources") { |
sources += [ "//build/sanitizers/asan_suppressions.cc" ] |
} |
+ if (is_lsan) { |
+ sources += [ "//build/sanitizers/lsan_suppressions.cc" ] |
+ } |
+ |
if (is_tsan) { |
sources += [ "//build/sanitizers/tsan_suppressions.cc" ] |
} |