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 # Contains the dependencies needed for sanitizers to link into executables and |
6 # shared_libraries. Unconditionally depend upon this target as it is empty if | 6 # shared_libraries. Unconditionally depend upon this target as it is empty if |
7 # |is_asan| is false. | 7 # |is_asan|, |is_lsan|, |is_tsan| and |is_msan| are false. |
8 group("deps") { | 8 group("deps") { |
9 if (is_asan) { | 9 if (is_asan || is_lsan || is_tsan || is_msan) { |
10 public_configs = [ ":sanitizer_options_link_helper" ] | 10 public_configs = [ ":sanitizer_options_link_helper" ] |
11 deps = [ | 11 deps = [ |
12 ":options_sources", | 12 ":options_sources", |
13 ] | 13 ] |
14 } | 14 } |
15 } | 15 } |
16 | 16 |
17 config("sanitizer_options_link_helper") { | 17 config("sanitizer_options_link_helper") { |
18 ldflags = [ | 18 ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ] |
19 "-Wl,-u_sanitizer_options_link_helper", | 19 if (is_asan) { |
20 "-fsanitize=address", | 20 ldflags += [ "-fsanitize=address" ] |
21 ] | 21 } |
| 22 if (is_lsan) { |
| 23 ldflags += [ "-fsanitize=leak" ] |
| 24 } |
| 25 if (is_tsan) { |
| 26 ldflags += [ "-fsanitize=thread" ] |
| 27 } |
| 28 if (is_msan) { |
| 29 ldflags += [ "-fsanitize=memory" ] |
| 30 } |
22 } | 31 } |
23 | 32 |
24 source_set("options_sources") { | 33 source_set("options_sources") { |
25 visibility = [ | 34 visibility = [ |
26 ":deps", | 35 ":deps", |
27 "//:gn_visibility", | 36 "//:gn_visibility", |
28 ] | 37 ] |
29 sources = [ | 38 sources = [ |
30 "//build/sanitizers/sanitizer_options.cc", | 39 "//build/sanitizers/sanitizer_options.cc", |
31 ] | 40 ] |
32 | 41 |
33 if (is_asan) { | 42 if (is_asan) { |
34 sources += [ "//build/sanitizers/asan_suppressions.cc" ] | 43 sources += [ "//build/sanitizers/asan_suppressions.cc" ] |
35 } | 44 } |
36 | 45 |
| 46 if (is_lsan) { |
| 47 sources += [ "//build/sanitizers/lsan_suppressions.cc" ] |
| 48 } |
| 49 |
37 if (is_tsan) { | 50 if (is_tsan) { |
38 sources += [ "//build/sanitizers/tsan_suppressions.cc" ] | 51 sources += [ "//build/sanitizers/tsan_suppressions.cc" ] |
39 } | 52 } |
40 } | 53 } |
OLD | NEW |