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 (is_asan || is_lsan || is_tsan || is_msan || is_ubsan) { | 11 if (using_sanitizer) { |
12 public_configs = [ ":sanitizer_options_link_helper" ] | 12 public_configs = [ ":sanitizer_options_link_helper" ] |
13 deps = [ | 13 deps = [ |
14 ":options_sources", | 14 ":options_sources", |
15 ] | 15 ] |
16 | 16 |
17 if (use_prebuilt_instrumented_libraries) { | 17 if (use_prebuilt_instrumented_libraries) { |
18 deps += [ "//third_party/instrumented_libraries:deps" ] | 18 deps += [ "//third_party/instrumented_libraries:deps" ] |
19 } | 19 } |
20 if (use_custom_libcxx) { | 20 if (use_custom_libcxx) { |
21 deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ] | 21 deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ] |
(...skipping 11 matching lines...) Expand all Loading... |
33 } | 33 } |
34 if (is_tsan) { | 34 if (is_tsan) { |
35 ldflags += [ "-fsanitize=thread" ] | 35 ldflags += [ "-fsanitize=thread" ] |
36 } | 36 } |
37 if (is_msan) { | 37 if (is_msan) { |
38 ldflags += [ "-fsanitize=memory" ] | 38 ldflags += [ "-fsanitize=memory" ] |
39 } | 39 } |
40 if (is_ubsan) { | 40 if (is_ubsan) { |
41 ldflags += [ "-fsanitize=undefined" ] | 41 ldflags += [ "-fsanitize=undefined" ] |
42 } | 42 } |
| 43 if (is_ubsan_vptr) { |
| 44 ldflags += [ "-fsanitize=vptr" ] |
| 45 } |
43 } | 46 } |
44 | 47 |
45 source_set("options_sources") { | 48 source_set("options_sources") { |
46 visibility = [ | 49 visibility = [ |
47 ":deps", | 50 ":deps", |
48 "//:gn_visibility", | 51 "//:gn_visibility", |
49 ] | 52 ] |
50 sources = [ | 53 sources = [ |
51 "//build/sanitizers/sanitizer_options.cc", | 54 "//build/sanitizers/sanitizer_options.cc", |
52 ] | 55 ] |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 # See http://crbug.com/426271. | 149 # See http://crbug.com/426271. |
147 "-mllvm", | 150 "-mllvm", |
148 "-regalloc=pbqp", | 151 "-regalloc=pbqp", |
149 | 152 |
150 # Speculatively use coalescing to slightly improve the code generated | 153 # Speculatively use coalescing to slightly improve the code generated |
151 # by PBQP regallocator. May increase compile time. | 154 # by PBQP regallocator. May increase compile time. |
152 "-mllvm", | 155 "-mllvm", |
153 "-pbqp-coalescing", | 156 "-pbqp-coalescing", |
154 ] | 157 ] |
155 } | 158 } |
| 159 if (is_ubsan_vptr) { |
| 160 ubsan_vptr_blacklist_path = |
| 161 rebase_path("//tools/ubsan/vptr_blacklist.txt", root_build_dir) |
| 162 cflags += [ |
| 163 "-fsanitize=vptr", |
| 164 "-fsanitize-blacklist=$ubsan_vptr_blacklist_path", |
| 165 ] |
| 166 } |
156 if (is_cfi && !is_nacl) { | 167 if (is_cfi && !is_nacl) { |
157 cfi_blacklist_path = | 168 cfi_blacklist_path = |
158 rebase_path("//tools/cfi/blacklist.txt", root_build_dir) | 169 rebase_path("//tools/cfi/blacklist.txt", root_build_dir) |
159 cflags += [ | 170 cflags += [ |
160 "-flto", | 171 "-flto", |
161 "-fsanitize=cfi-vcall", | 172 "-fsanitize=cfi-vcall", |
162 "-fsanitize=cfi-derived-cast", | 173 "-fsanitize=cfi-derived-cast", |
163 "-fsanitize=cfi-unrelated-cast", | 174 "-fsanitize=cfi-unrelated-cast", |
164 "-fsanitize-blacklist=$cfi_blacklist_path", | 175 "-fsanitize-blacklist=$cfi_blacklist_path", |
165 ] | 176 ] |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 218 |
208 if (use_custom_libcxx) { | 219 if (use_custom_libcxx) { |
209 cflags_cc += [ "-nostdinc++" ] | 220 cflags_cc += [ "-nostdinc++" ] |
210 include_dirs = [ | 221 include_dirs = [ |
211 "//buildtools/third_party/libc++/trunk/include", | 222 "//buildtools/third_party/libc++/trunk/include", |
212 "//buildtools/third_party/libc++abi/trunk/include", | 223 "//buildtools/third_party/libc++abi/trunk/include", |
213 ] | 224 ] |
214 } | 225 } |
215 } | 226 } |
216 } | 227 } |
OLD | NEW |