| 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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 ubsan_vptr_blacklist_path = | 529 ubsan_vptr_blacklist_path = |
| 530 rebase_path("//tools/ubsan/vptr_blacklist.txt", root_build_dir) | 530 rebase_path("//tools/ubsan/vptr_blacklist.txt", root_build_dir) |
| 531 } | 531 } |
| 532 cflags = [ | 532 cflags = [ |
| 533 "-fsanitize=vptr", | 533 "-fsanitize=vptr", |
| 534 "-fsanitize-blacklist=$ubsan_vptr_blacklist_path", | 534 "-fsanitize-blacklist=$ubsan_vptr_blacklist_path", |
| 535 ] | 535 ] |
| 536 } | 536 } |
| 537 } | 537 } |
| 538 | 538 |
| 539 config("fuzzing_build_mode") { |
| 540 if (use_libfuzzer || use_afl) { |
| 541 defines = [ "FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" ] |
| 542 } |
| 543 } |
| 544 |
| 539 all_sanitizer_configs = [ | 545 all_sanitizer_configs = [ |
| 540 ":common_sanitizer_flags", | 546 ":common_sanitizer_flags", |
| 541 ":coverage_flags", | 547 ":coverage_flags", |
| 542 ":default_sanitizer_ldflags", | 548 ":default_sanitizer_ldflags", |
| 543 ":asan_flags", | 549 ":asan_flags", |
| 544 ":cfi_flags", | 550 ":cfi_flags", |
| 545 ":lsan_flags", | 551 ":lsan_flags", |
| 546 ":msan_flags", | 552 ":msan_flags", |
| 547 ":tsan_flags", | 553 ":tsan_flags", |
| 548 ":ubsan_flags", | 554 ":ubsan_flags", |
| 549 ":ubsan_no_recover", | 555 ":ubsan_no_recover", |
| 550 ":ubsan_null_flags", | 556 ":ubsan_null_flags", |
| 551 ":ubsan_security_flags", | 557 ":ubsan_security_flags", |
| 552 ":ubsan_vptr_flags", | 558 ":ubsan_vptr_flags", |
| 559 ":fuzzing_build_mode", |
| 553 ] | 560 ] |
| 554 | 561 |
| 555 # This config is applied by default to all targets. It sets the compiler flags | 562 # This config is applied by default to all targets. It sets the compiler flags |
| 556 # for sanitizer usage, or, if no sanitizer is set, does nothing. | 563 # for sanitizer usage, or, if no sanitizer is set, does nothing. |
| 557 # | 564 # |
| 558 # This needs to be in a separate config so that targets can opt out of | 565 # This needs to be in a separate config so that targets can opt out of |
| 559 # sanitizers (by removing the config) if they desire. Even if a target | 566 # sanitizers (by removing the config) if they desire. Even if a target |
| 560 # removes this config, executables & shared libraries should still depend on | 567 # removes this config, executables & shared libraries should still depend on |
| 561 # :deps if any of their dependencies have not opted out of sanitizers. | 568 # :deps if any of their dependencies have not opted out of sanitizers. |
| 562 # Keep this list in sync with default_sanitizer_flags_but_ubsan_vptr. | 569 # Keep this list in sync with default_sanitizer_flags_but_ubsan_vptr. |
| 563 config("default_sanitizer_flags") { | 570 config("default_sanitizer_flags") { |
| 564 configs = all_sanitizer_configs | 571 configs = all_sanitizer_configs |
| 565 } | 572 } |
| 566 | 573 |
| 567 # This config is equivalent to default_sanitizer_flags, but excludes ubsan_vptr. | 574 # This config is equivalent to default_sanitizer_flags, but excludes ubsan_vptr. |
| 568 # This allows to selectively disable ubsan_vptr, when needed. In particular, | 575 # This allows to selectively disable ubsan_vptr, when needed. In particular, |
| 569 # if some third_party code is required to be compiled without rtti, which | 576 # if some third_party code is required to be compiled without rtti, which |
| 570 # is a requirement for ubsan_vptr. | 577 # is a requirement for ubsan_vptr. |
| 571 config("default_sanitizer_flags_but_ubsan_vptr") { | 578 config("default_sanitizer_flags_but_ubsan_vptr") { |
| 572 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] | 579 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] |
| 573 } | 580 } |
| 574 | 581 |
| 575 config("default_sanitizer_flags_but_coverage") { | 582 config("default_sanitizer_flags_but_coverage") { |
| 576 configs = all_sanitizer_configs - [ ":coverage_flags" ] | 583 configs = all_sanitizer_configs - [ ":coverage_flags" ] |
| 577 } | 584 } |
| OLD | NEW |