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 import("//build/config/sanitizers/sanitizers.gni") | 5 import("//build/config/sanitizers/sanitizers.gni") |
6 | 6 |
7 # Contains the dependencies needed for sanitizers to link into executables and | 7 # Contains the dependencies needed for sanitizers to link into executables and |
8 # 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 |
9 # |is_asan|, |is_lsan|, |is_tsan|, |is_msan| and |use_custom_libcxx| are false. | 9 # |is_asan|, |is_lsan|, |is_tsan|, |is_msan| and |use_custom_libcxx| are false. |
10 group("deps") { | 10 group("deps") { |
11 if (use_libfuzzer) { | 11 if (use_libfuzzer) { |
12 is_asan = true | 12 is_asan = true |
13 use_custom_libcxx = true | 13 use_custom_libcxx = true |
14 } | 14 } |
15 | 15 |
16 if (is_asan || is_lsan || is_tsan || is_msan || is_ubsan) { | 16 if (using_sanitizer) { |
17 public_configs = [ ":sanitizer_options_link_helper" ] | 17 public_configs = [ ":sanitizer_options_link_helper" ] |
18 deps = [ | 18 deps = [ |
19 ":options_sources", | 19 ":options_sources", |
20 ] | 20 ] |
21 | 21 |
22 if (use_prebuilt_instrumented_libraries) { | 22 if (use_prebuilt_instrumented_libraries) { |
23 deps += [ "//third_party/instrumented_libraries:deps" ] | 23 deps += [ "//third_party/instrumented_libraries:deps" ] |
24 } | 24 } |
25 if (use_custom_libcxx) { | 25 if (use_custom_libcxx) { |
26 deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ] | 26 deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ] |
(...skipping 11 matching lines...) Expand all Loading... |
38 } | 38 } |
39 if (is_tsan) { | 39 if (is_tsan) { |
40 ldflags += [ "-fsanitize=thread" ] | 40 ldflags += [ "-fsanitize=thread" ] |
41 } | 41 } |
42 if (is_msan) { | 42 if (is_msan) { |
43 ldflags += [ "-fsanitize=memory" ] | 43 ldflags += [ "-fsanitize=memory" ] |
44 } | 44 } |
45 if (is_ubsan) { | 45 if (is_ubsan) { |
46 ldflags += [ "-fsanitize=undefined" ] | 46 ldflags += [ "-fsanitize=undefined" ] |
47 } | 47 } |
| 48 if (is_ubsan_vptr) { |
| 49 ldflags += [ "-fsanitize=vptr" ] |
| 50 } |
48 } | 51 } |
49 | 52 |
50 source_set("options_sources") { | 53 source_set("options_sources") { |
51 visibility = [ | 54 visibility = [ |
52 ":deps", | 55 ":deps", |
53 "//:gn_visibility", | 56 "//:gn_visibility", |
54 ] | 57 ] |
55 sources = [ | 58 sources = [ |
56 "//build/sanitizers/sanitizer_options.cc", | 59 "//build/sanitizers/sanitizer_options.cc", |
57 ] | 60 ] |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 # See http://crbug.com/426271. | 154 # See http://crbug.com/426271. |
152 "-mllvm", | 155 "-mllvm", |
153 "-regalloc=pbqp", | 156 "-regalloc=pbqp", |
154 | 157 |
155 # Speculatively use coalescing to slightly improve the code generated | 158 # Speculatively use coalescing to slightly improve the code generated |
156 # by PBQP regallocator. May increase compile time. | 159 # by PBQP regallocator. May increase compile time. |
157 "-mllvm", | 160 "-mllvm", |
158 "-pbqp-coalescing", | 161 "-pbqp-coalescing", |
159 ] | 162 ] |
160 } | 163 } |
| 164 if (is_ubsan_vptr) { |
| 165 ubsan_vptr_blacklist_path = |
| 166 rebase_path("//tools/ubsan/vptr_blacklist.txt", root_build_dir) |
| 167 cflags += [ |
| 168 "-fsanitize=vptr", |
| 169 "-fsanitize-blacklist=$ubsan_vptr_blacklist_path", |
| 170 ] |
| 171 } |
161 if (is_cfi && !is_nacl) { | 172 if (is_cfi && !is_nacl) { |
162 cfi_blacklist_path = | 173 cfi_blacklist_path = |
163 rebase_path("//tools/cfi/blacklist.txt", root_build_dir) | 174 rebase_path("//tools/cfi/blacklist.txt", root_build_dir) |
164 cflags += [ | 175 cflags += [ |
165 "-flto", | 176 "-flto", |
166 "-fsanitize=cfi-vcall", | 177 "-fsanitize=cfi-vcall", |
167 "-fsanitize=cfi-derived-cast", | 178 "-fsanitize=cfi-derived-cast", |
168 "-fsanitize=cfi-unrelated-cast", | 179 "-fsanitize=cfi-unrelated-cast", |
169 "-fsanitize-blacklist=$cfi_blacklist_path", | 180 "-fsanitize-blacklist=$cfi_blacklist_path", |
170 ] | 181 ] |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 223 |
213 if (use_custom_libcxx) { | 224 if (use_custom_libcxx) { |
214 cflags_cc += [ "-nostdinc++" ] | 225 cflags_cc += [ "-nostdinc++" ] |
215 include_dirs = [ | 226 include_dirs = [ |
216 "//buildtools/third_party/libc++/trunk/include", | 227 "//buildtools/third_party/libc++/trunk/include", |
217 "//buildtools/third_party/libc++abi/trunk/include", | 228 "//buildtools/third_party/libc++abi/trunk/include", |
218 ] | 229 ] |
219 } | 230 } |
220 } | 231 } |
221 } | 232 } |
OLD | NEW |