OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # Contains the dependencies needed for asan to link into executables and | 5 import("//build/config/sanitizers/sanitizers.gni") |
| 6 |
| 7 # Contains the dependencies needed for sanitizers to link into executables and |
6 # shared_libraries. Unconditionally depend upon this target as it is empty if | 8 # shared_libraries. Unconditionally depend upon this target as it is empty if |
7 # |is_asan| is false. | 9 # |is_asan|, |is_lsan|, |is_tsan|, |is_msan| and |use_custom_libcxx| are false. |
8 group("deps") { | 10 group("deps") { |
9 if (is_asan) { | 11 # TODO(vtl): Chromium has the following (but we don't have |
| 12 # instrumented_libraries). |
| 13 # deps = [ |
| 14 # "//third_party/instrumented_libraries:deps", |
| 15 # ] |
| 16 deps = [] |
| 17 if (is_asan || is_lsan || is_tsan || is_msan) { |
10 public_configs = [ ":sanitizer_options_link_helper" ] | 18 public_configs = [ ":sanitizer_options_link_helper" ] |
11 deps = [ | 19 deps += [ ":options_sources" ] |
12 ":options_sources", | 20 } |
13 ] | 21 if (use_custom_libcxx) { |
| 22 deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ] |
14 } | 23 } |
15 } | 24 } |
16 | 25 |
17 config("sanitizer_options_link_helper") { | 26 config("sanitizer_options_link_helper") { |
18 ldflags = [ | 27 ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ] |
19 "-Wl,-u_sanitizer_options_link_helper", | 28 if (is_asan) { |
20 "-fsanitize=address", | 29 ldflags += [ "-fsanitize=address" ] |
21 ] | 30 } |
| 31 if (is_lsan) { |
| 32 ldflags += [ "-fsanitize=leak" ] |
| 33 } |
| 34 if (is_tsan) { |
| 35 ldflags += [ "-fsanitize=thread" ] |
| 36 } |
| 37 if (is_msan) { |
| 38 ldflags += [ "-fsanitize=memory" ] |
| 39 } |
22 } | 40 } |
23 | 41 |
24 source_set("options_sources") { | 42 source_set("options_sources") { |
25 visibility = [ | 43 visibility = [ |
26 ":deps", | 44 ":deps", |
27 "//:gn_visibility", | 45 "//:gn_visibility", |
28 ] | 46 ] |
29 sources = [ | 47 sources = [ |
30 "//build/sanitizers/sanitizer_options.cc", | 48 "//build/sanitizers/sanitizer_options.cc", |
31 ] | 49 ] |
32 | 50 |
33 if (is_asan) { | 51 if (is_asan) { |
34 sources += [ "//build/sanitizers/asan_suppressions.cc" ] | 52 sources += [ "//build/sanitizers/asan_suppressions.cc" ] |
35 } | 53 } |
36 | 54 |
| 55 if (is_lsan) { |
| 56 sources += [ "//build/sanitizers/lsan_suppressions.cc" ] |
| 57 } |
| 58 |
37 if (is_tsan) { | 59 if (is_tsan) { |
38 sources += [ "//build/sanitizers/tsan_suppressions.cc" ] | 60 sources += [ "//build/sanitizers/tsan_suppressions.cc" ] |
39 } | 61 } |
40 } | 62 } |
OLD | NEW |