| 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/sanitizers/sanitizers.gni") | 7 import("//build/config/sanitizers/sanitizers.gni") |
| 8 | 8 |
| 9 # Contains the dependencies needed for sanitizers to link into executables and | 9 # Contains the dependencies needed for sanitizers to link into executables and |
| 10 # shared_libraries. Unconditionally depend upon this target as it is empty if | 10 # shared_libraries. Unconditionally depend upon this target as it is empty if |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 318 |
| 319 # Speculatively use coalescing to slightly improve the code generated | 319 # Speculatively use coalescing to slightly improve the code generated |
| 320 # by PBQP regallocator. May increase compile time. | 320 # by PBQP regallocator. May increase compile time. |
| 321 "-mllvm", | 321 "-mllvm", |
| 322 "-pbqp-coalescing", | 322 "-pbqp-coalescing", |
| 323 ] | 323 ] |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 } | 326 } |
| 327 | 327 |
| 328 config("ubsan_no_recover") { |
| 329 if (is_ubsan_no_recover) { |
| 330 cflags = [ "-fno-sanitize-recover=undefined" ] |
| 331 } |
| 332 } |
| 333 |
| 328 config("ubsan_security_flags") { | 334 config("ubsan_security_flags") { |
| 329 if (is_ubsan_security) { | 335 if (is_ubsan_security) { |
| 330 ubsan_blacklist_path = | 336 ubsan_blacklist_path = |
| 331 rebase_path("//tools/ubsan/blacklist.txt", root_build_dir) | 337 rebase_path("//tools/ubsan/blacklist.txt", root_build_dir) |
| 332 cflags = [ | 338 cflags = [ |
| 333 "-fsanitize=signed-integer-overflow,shift", | 339 "-fsanitize=signed-integer-overflow,shift", |
| 334 "-fsanitize-blacklist=$ubsan_blacklist_path", | 340 "-fsanitize-blacklist=$ubsan_blacklist_path", |
| 335 ] | 341 ] |
| 336 } | 342 } |
| 337 } | 343 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 350 all_sanitizer_configs = [ | 356 all_sanitizer_configs = [ |
| 351 ":common_sanitizer_flags", | 357 ":common_sanitizer_flags", |
| 352 ":coverage_flags", | 358 ":coverage_flags", |
| 353 ":default_sanitizer_ldflags", | 359 ":default_sanitizer_ldflags", |
| 354 ":asan_flags", | 360 ":asan_flags", |
| 355 ":cfi_flags", | 361 ":cfi_flags", |
| 356 ":lsan_flags", | 362 ":lsan_flags", |
| 357 ":msan_flags", | 363 ":msan_flags", |
| 358 ":tsan_flags", | 364 ":tsan_flags", |
| 359 ":ubsan_flags", | 365 ":ubsan_flags", |
| 366 ":ubsan_no_recover", |
| 360 ":ubsan_security_flags", | 367 ":ubsan_security_flags", |
| 361 ":ubsan_vptr_flags", | 368 ":ubsan_vptr_flags", |
| 362 ] | 369 ] |
| 363 | 370 |
| 364 # This config is applied by default to all targets. It sets the compiler flags | 371 # This config is applied by default to all targets. It sets the compiler flags |
| 365 # for sanitizer usage, or, if no sanitizer is set, does nothing. | 372 # for sanitizer usage, or, if no sanitizer is set, does nothing. |
| 366 # | 373 # |
| 367 # This needs to be in a separate config so that targets can opt out of | 374 # This needs to be in a separate config so that targets can opt out of |
| 368 # sanitizers (by removing the config) if they desire. Even if a target | 375 # sanitizers (by removing the config) if they desire. Even if a target |
| 369 # removes this config, executables & shared libraries should still depend on | 376 # removes this config, executables & shared libraries should still depend on |
| 370 # :deps if any of their dependencies have not opted out of sanitizers. | 377 # :deps if any of their dependencies have not opted out of sanitizers. |
| 371 # Keep this list in sync with default_sanitizer_flags_but_ubsan_vptr. | 378 # Keep this list in sync with default_sanitizer_flags_but_ubsan_vptr. |
| 372 config("default_sanitizer_flags") { | 379 config("default_sanitizer_flags") { |
| 373 configs = all_sanitizer_configs | 380 configs = all_sanitizer_configs |
| 374 } | 381 } |
| 375 | 382 |
| 376 # This config is equivalent to default_sanitizer_flags, but excludes ubsan_vptr. | 383 # This config is equivalent to default_sanitizer_flags, but excludes ubsan_vptr. |
| 377 # This allows to selectively disable ubsan_vptr, when needed. In particular, | 384 # This allows to selectively disable ubsan_vptr, when needed. In particular, |
| 378 # if some third_party code is required to be compiled without rtti, which | 385 # if some third_party code is required to be compiled without rtti, which |
| 379 # is a requirement for ubsan_vptr. | 386 # is a requirement for ubsan_vptr. |
| 380 config("default_sanitizer_flags_but_ubsan_vptr") { | 387 config("default_sanitizer_flags_but_ubsan_vptr") { |
| 381 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] | 388 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] |
| 382 } | 389 } |
| 383 | 390 |
| 384 config("default_sanitizer_flags_but_coverage") { | 391 config("default_sanitizer_flags_but_coverage") { |
| 385 configs = all_sanitizer_configs - [ ":coverage_flags" ] | 392 configs = all_sanitizer_configs - [ ":coverage_flags" ] |
| 386 } | 393 } |
| OLD | NEW |