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/chrome_build.gni") | 5 import("//build/config/chrome_build.gni") |
6 import("//build/config/chromecast_build.gni") | 6 import("//build/config/chromecast_build.gni") |
7 import("//build/config/clang/clang.gni") | 7 import("//build/config/clang/clang.gni") |
8 import("//build/config/sanitizers/sanitizers.gni") | 8 import("//build/config/sanitizers/sanitizers.gni") |
9 import("//build/toolchain/toolchain.gni") | 9 import("//build/toolchain/toolchain.gni") |
10 | 10 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 "-fsanitize=cfi-unrelated-cast", | 184 "-fsanitize=cfi-unrelated-cast", |
185 ] | 185 ] |
186 } | 186 } |
187 if (use_cfi_diag) { | 187 if (use_cfi_diag) { |
188 ldflags += [ | 188 ldflags += [ |
189 "-fno-sanitize-trap=cfi", | 189 "-fno-sanitize-trap=cfi", |
190 "-fsanitize-recover=cfi", | 190 "-fsanitize-recover=cfi", |
191 ] | 191 ] |
192 } | 192 } |
193 } | 193 } |
| 194 } else if (is_win && is_asan) { |
| 195 # Windows directly calls link.exe instead of the compiler driver when |
| 196 # linking. Hence, pass the runtime libraries instead of -fsanitize=address. |
| 197 # In the static-library build, libraries are different for executables |
| 198 # and dlls, see link_executable and link_shared_library below. |
| 199 # This here handles only the component build. |
| 200 if (target_cpu == "x64") { |
| 201 # Windows 64-bit. TODO(etienneb): Remove the assert when this is ready. |
| 202 if (is_component_build) { |
| 203 assert(false, "win/asan does not work in 64-bit yet") |
| 204 libs = [ |
| 205 "clang_rt.asan_dynamic-x86_64.lib", |
| 206 "clang_rt.asan_dynamic_runtime_thunk-x86_64.lib", |
| 207 ] |
| 208 } |
| 209 } else { |
| 210 assert(target_cpu == "x86", "WinASan unsupported architecture") |
| 211 if (is_component_build) { |
| 212 libs = [ |
| 213 "clang_rt.asan_dynamic-i386.lib", |
| 214 "clang_rt.asan_dynamic_runtime_thunk-i386.lib", |
| 215 ] |
| 216 } |
| 217 } |
194 } | 218 } |
195 } | 219 } |
196 | 220 |
197 config("common_sanitizer_flags") { | 221 config("common_sanitizer_flags") { |
198 cflags = [] | 222 cflags = [] |
199 cflags_cc = [] | 223 cflags_cc = [] |
200 | 224 |
201 # Sanitizers need line table info for stack traces. They don't need type info | 225 # Sanitizers need line table info for stack traces. They don't need type info |
202 # or variable info, so we can leave that out to speed up the build. | 226 # or variable info, so we can leave that out to speed up the build. |
203 if (using_sanitizer) { | 227 if (using_sanitizer) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 if (is_win) { | 263 if (is_win) { |
240 cflags += [ "-fsanitize-blacklist=" + | 264 cflags += [ "-fsanitize-blacklist=" + |
241 rebase_path("//tools/memory/asan/blacklist_win.txt", | 265 rebase_path("//tools/memory/asan/blacklist_win.txt", |
242 root_build_dir) ] | 266 root_build_dir) ] |
243 } else { | 267 } else { |
244 # TODO(rnk): Remove this as discussed in http://crbug.com/427202. | 268 # TODO(rnk): Remove this as discussed in http://crbug.com/427202. |
245 cflags += | 269 cflags += |
246 [ "-fsanitize-blacklist=" + | 270 [ "-fsanitize-blacklist=" + |
247 rebase_path("//tools/memory/asan/blacklist.txt", root_build_dir) ] | 271 rebase_path("//tools/memory/asan/blacklist.txt", root_build_dir) ] |
248 } | 272 } |
249 | |
250 if (is_win) { | |
251 # In the static-library build, libraries are different for executables | |
252 # and dlls, see link_executable and link_shared_library below. | |
253 # This here handles only the component build. | |
254 if (target_cpu == "x64") { | |
255 # Windows 64-bit. TODO(etienneb): Remove the assert when this is ready. | |
256 if (is_component_build) { | |
257 assert(false, "win/asan does not work in 64-bit yet") | |
258 libs = [ | |
259 "clang_rt.asan_dynamic-x86_64.lib", | |
260 "clang_rt.asan_dynamic_runtime_thunk-x86_64.lib", | |
261 ] | |
262 } | |
263 } else { | |
264 assert(target_cpu == "x86", "WinASan unsupported architecture") | |
265 if (is_component_build) { | |
266 libs = [ | |
267 "clang_rt.asan_dynamic-i386.lib", | |
268 "clang_rt.asan_dynamic_runtime_thunk-i386.lib", | |
269 ] | |
270 } | |
271 } | |
272 } | |
273 } | 273 } |
274 } | 274 } |
275 | 275 |
276 config("link_executable") { | 276 config("link_executable") { |
277 if (is_asan && is_win && !is_component_build) { | 277 if (is_asan && is_win && !is_component_build) { |
278 if (target_cpu == "x64") { | 278 if (target_cpu == "x64") { |
279 # Windows 64-bit. TODO(etienneb): Remove the assert when this is ready. | 279 # Windows 64-bit. TODO(etienneb): Remove the assert when this is ready. |
280 assert(false, "win/asan does not work in 64-bit yet") | 280 assert(false, "win/asan does not work in 64-bit yet") |
281 libs = [ "clang_rt.asan-x86_64.lib" ] | 281 libs = [ "clang_rt.asan-x86_64.lib" ] |
282 } else { | 282 } else { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 # This allows to selectively disable ubsan_vptr, when needed. In particular, | 489 # This allows to selectively disable ubsan_vptr, when needed. In particular, |
490 # if some third_party code is required to be compiled without rtti, which | 490 # if some third_party code is required to be compiled without rtti, which |
491 # is a requirement for ubsan_vptr. | 491 # is a requirement for ubsan_vptr. |
492 config("default_sanitizer_flags_but_ubsan_vptr") { | 492 config("default_sanitizer_flags_but_ubsan_vptr") { |
493 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] | 493 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] |
494 } | 494 } |
495 | 495 |
496 config("default_sanitizer_flags_but_coverage") { | 496 config("default_sanitizer_flags_but_coverage") { |
497 configs = all_sanitizer_configs - [ ":coverage_flags" ] | 497 configs = all_sanitizer_configs - [ ":coverage_flags" ] |
498 } | 498 } |
OLD | NEW |