| 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_overrides/build.gni") | 5 import("//build_overrides/build.gni") |
| 6 import("//build/config/chrome_build.gni") | 6 import("//build/config/chrome_build.gni") |
| 7 import("//build/config/chromecast_build.gni") | 7 import("//build/config/chromecast_build.gni") |
| 8 import("//build/config/clang/clang.gni") | 8 import("//build/config/clang/clang.gni") |
| 9 import("//build/config/sanitizers/sanitizers.gni") | 9 import("//build/config/sanitizers/sanitizers.gni") |
| 10 import("//build/toolchain/toolchain.gni") | 10 import("//build/toolchain/toolchain.gni") |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 211 |
| 212 if (is_cfi && !is_nacl) { | 212 if (is_cfi && !is_nacl) { |
| 213 ldflags += [ "-fsanitize=cfi-vcall" ] | 213 ldflags += [ "-fsanitize=cfi-vcall" ] |
| 214 if (use_cfi_cast) { | 214 if (use_cfi_cast) { |
| 215 ldflags += [ | 215 ldflags += [ |
| 216 "-fsanitize=cfi-derived-cast", | 216 "-fsanitize=cfi-derived-cast", |
| 217 "-fsanitize=cfi-unrelated-cast", | 217 "-fsanitize=cfi-unrelated-cast", |
| 218 ] | 218 ] |
| 219 } | 219 } |
| 220 if (use_cfi_diag) { | 220 if (use_cfi_diag) { |
| 221 ldflags += [ | 221 ldflags += [ "-fno-sanitize-trap=cfi" ] |
| 222 "-fno-sanitize-trap=cfi", | 222 if (use_cfi_recover) { |
| 223 "-fsanitize-recover=cfi", | 223 ldflags += [ "-fsanitize-recover=cfi" ] |
| 224 ] | 224 } |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 } else if (is_win && is_asan) { | 227 } else if (is_win && is_asan) { |
| 228 # Windows directly calls link.exe instead of the compiler driver when | 228 # Windows directly calls link.exe instead of the compiler driver when |
| 229 # linking. Hence, pass the runtime libraries instead of -fsanitize=address. | 229 # linking. Hence, pass the runtime libraries instead of -fsanitize=address. |
| 230 # In the static-library build, libraries are different for executables | 230 # In the static-library build, libraries are different for executables |
| 231 # and dlls, see link_executable and link_shared_library below. | 231 # and dlls, see link_executable and link_shared_library below. |
| 232 # This here handles only the component build. | 232 # This here handles only the component build. |
| 233 if (target_cpu == "x64") { | 233 if (target_cpu == "x64") { |
| 234 # Windows 64-bit. TODO(etienneb): Remove the assert when this is ready. | 234 # Windows 64-bit. TODO(etienneb): Remove the assert when this is ready. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 ] | 375 ] |
| 376 } | 376 } |
| 377 | 377 |
| 378 if (use_cfi_icall) { | 378 if (use_cfi_icall) { |
| 379 cflags += [ "-fsanitize=cfi-icall" ] | 379 cflags += [ "-fsanitize=cfi-icall" ] |
| 380 } | 380 } |
| 381 | 381 |
| 382 if (use_cfi_diag) { | 382 if (use_cfi_diag) { |
| 383 cflags += [ | 383 cflags += [ |
| 384 "-fno-sanitize-trap=cfi", | 384 "-fno-sanitize-trap=cfi", |
| 385 "-fsanitize-recover=cfi", | |
| 386 "-fno-inline-functions", | 385 "-fno-inline-functions", |
| 387 "-fno-inline", | 386 "-fno-inline", |
| 388 "-fno-omit-frame-pointer", | 387 "-fno-omit-frame-pointer", |
| 389 "-O1", | 388 "-O1", |
| 390 ] | 389 ] |
| 390 if (use_cfi_recover) { |
| 391 cflags += [ "-fsanitize-recover=cfi" ] |
| 392 } |
| 391 } else { | 393 } else { |
| 392 defines = [ "CFI_ENFORCEMENT" ] | 394 defines = [ "CFI_ENFORCEMENT" ] |
| 393 } | 395 } |
| 394 } | 396 } |
| 395 } | 397 } |
| 396 | 398 |
| 397 config("coverage_flags") { | 399 config("coverage_flags") { |
| 398 cflags = [] | 400 cflags = [] |
| 399 | 401 |
| 400 if (use_sanitizer_coverage) { | 402 if (use_sanitizer_coverage) { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 # This allows to selectively disable ubsan_vptr, when needed. In particular, | 572 # This allows to selectively disable ubsan_vptr, when needed. In particular, |
| 571 # if some third_party code is required to be compiled without rtti, which | 573 # if some third_party code is required to be compiled without rtti, which |
| 572 # is a requirement for ubsan_vptr. | 574 # is a requirement for ubsan_vptr. |
| 573 config("default_sanitizer_flags_but_ubsan_vptr") { | 575 config("default_sanitizer_flags_but_ubsan_vptr") { |
| 574 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] | 576 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] |
| 575 } | 577 } |
| 576 | 578 |
| 577 config("default_sanitizer_flags_but_coverage") { | 579 config("default_sanitizer_flags_but_coverage") { |
| 578 configs = all_sanitizer_configs - [ ":coverage_flags" ] | 580 configs = all_sanitizer_configs - [ ":coverage_flags" ] |
| 579 } | 581 } |
| OLD | NEW |