Chromium Code Reviews| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 | 61 |
| 62 if (is_lsan) { | 62 if (is_lsan) { |
| 63 sources += [ "//build/sanitizers/lsan_suppressions.cc" ] | 63 sources += [ "//build/sanitizers/lsan_suppressions.cc" ] |
| 64 } | 64 } |
| 65 | 65 |
| 66 if (is_tsan) { | 66 if (is_tsan) { |
| 67 sources += [ "//build/sanitizers/tsan_suppressions.cc" ] | 67 sources += [ "//build/sanitizers/tsan_suppressions.cc" ] |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 config("ubsan_vptr_flags") { | |
| 72 if (is_ubsan_vptr) { | |
|
Dirk Pranke
2016/04/26 01:00:32
maybe add a comment here about why this isn't just
krasin
2016/04/26 03:15:09
Done.
| |
| 73 ubsan_vptr_blacklist_path = | |
| 74 rebase_path("//tools/ubsan/vptr_blacklist.txt", root_build_dir) | |
| 75 cflags = [ | |
| 76 "-fsanitize=vptr", | |
| 77 "-fsanitize-blacklist=$ubsan_vptr_blacklist_path", | |
| 78 ] | |
| 79 ldflags = [ "-fsanitize=vptr" ] | |
| 80 } | |
| 81 } | |
| 82 | |
| 71 # Applies linker flags necessary when either :deps or :default_sanitizer_flags | 83 # Applies linker flags necessary when either :deps or :default_sanitizer_flags |
| 72 # are used. | 84 # are used. |
| 73 config("default_sanitizer_ldflags") { | 85 config("default_sanitizer_ldflags") { |
| 74 visibility = [ | 86 visibility = [ |
| 75 ":default_sanitizer_flags", | 87 ":default_sanitizer_flags", |
| 76 ":deps", | 88 ":deps", |
| 77 ] | 89 ] |
| 78 | 90 |
| 79 if (is_posix) { | 91 if (is_posix) { |
| 80 ldflags = [] | 92 ldflags = [] |
| 81 if (is_asan) { | 93 if (is_asan) { |
| 82 ldflags += [ "-fsanitize=address" ] | 94 ldflags += [ "-fsanitize=address" ] |
| 83 } | 95 } |
| 84 if (is_lsan) { | 96 if (is_lsan) { |
| 85 ldflags += [ "-fsanitize=leak" ] | 97 ldflags += [ "-fsanitize=leak" ] |
| 86 } | 98 } |
| 87 if (is_tsan) { | 99 if (is_tsan) { |
| 88 ldflags += [ "-fsanitize=thread" ] | 100 ldflags += [ "-fsanitize=thread" ] |
| 89 } | 101 } |
| 90 if (is_msan) { | 102 if (is_msan) { |
| 91 ldflags += [ "-fsanitize=memory" ] | 103 ldflags += [ "-fsanitize=memory" ] |
| 92 } | 104 } |
| 93 if (is_ubsan || is_ubsan_security) { | 105 if (is_ubsan || is_ubsan_security) { |
| 94 ldflags += [ "-fsanitize=undefined" ] | 106 ldflags += [ "-fsanitize=undefined" ] |
| 95 } | 107 } |
| 96 if (is_ubsan_vptr) { | |
| 97 ldflags += [ "-fsanitize=vptr" ] | |
| 98 } | |
| 99 | 108 |
| 100 if (is_cfi && !is_nacl) { | 109 if (is_cfi && !is_nacl) { |
| 101 ldflags += [ | 110 ldflags += [ |
| 102 "-fsanitize=cfi-vcall", | 111 "-fsanitize=cfi-vcall", |
| 103 "-fsanitize=cfi-derived-cast", | 112 "-fsanitize=cfi-derived-cast", |
| 104 "-fsanitize=cfi-unrelated-cast", | 113 "-fsanitize=cfi-unrelated-cast", |
| 105 ] | 114 ] |
| 106 if (use_cfi_diag) { | 115 if (use_cfi_diag) { |
| 107 ldflags += [ | 116 ldflags += [ |
| 108 "-fno-sanitize-trap=cfi", | 117 "-fno-sanitize-trap=cfi", |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 "-mllvm", | 247 "-mllvm", |
| 239 "-regalloc=pbqp", | 248 "-regalloc=pbqp", |
| 240 | 249 |
| 241 # Speculatively use coalescing to slightly improve the code generated | 250 # Speculatively use coalescing to slightly improve the code generated |
| 242 # by PBQP regallocator. May increase compile time. | 251 # by PBQP regallocator. May increase compile time. |
| 243 "-mllvm", | 252 "-mllvm", |
| 244 "-pbqp-coalescing", | 253 "-pbqp-coalescing", |
| 245 ] | 254 ] |
| 246 } | 255 } |
| 247 } | 256 } |
| 248 if (is_ubsan_vptr) { | |
| 249 ubsan_vptr_blacklist_path = | |
| 250 rebase_path("//tools/ubsan/vptr_blacklist.txt", root_build_dir) | |
| 251 cflags += [ | |
| 252 "-fsanitize=vptr", | |
| 253 "-fsanitize-blacklist=$ubsan_vptr_blacklist_path", | |
| 254 ] | |
| 255 } | |
| 256 if (is_ubsan_security) { | 257 if (is_ubsan_security) { |
| 257 ubsan_blacklist_path = | 258 ubsan_blacklist_path = |
| 258 rebase_path("//tools/ubsan/blacklist.txt", root_build_dir) | 259 rebase_path("//tools/ubsan/blacklist.txt", root_build_dir) |
| 259 cflags += [ | 260 cflags += [ |
| 260 "-fsanitize=signed-integer-overflow,shift", | 261 "-fsanitize=signed-integer-overflow,shift", |
| 261 "-fsanitize-blacklist=$ubsan_blacklist_path", | 262 "-fsanitize-blacklist=$ubsan_blacklist_path", |
| 262 ] | 263 ] |
| 263 } | 264 } |
| 264 if (is_cfi && !is_nacl) { | 265 if (is_cfi && !is_nacl) { |
| 265 cfi_blacklist_path = | 266 cfi_blacklist_path = |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 if (target_cpu == "arm") { | 309 if (target_cpu == "arm") { |
| 309 # http://crbug.com/517105 | 310 # http://crbug.com/517105 |
| 310 cflags += [ | 311 cflags += [ |
| 311 "-mllvm", | 312 "-mllvm", |
| 312 "-sanitizer-coverage-block-threshold=0", | 313 "-sanitizer-coverage-block-threshold=0", |
| 313 ] | 314 ] |
| 314 } | 315 } |
| 315 defines = [ "SANITIZER_COVERAGE" ] | 316 defines = [ "SANITIZER_COVERAGE" ] |
| 316 } | 317 } |
| 317 } | 318 } |
| OLD | NEW |