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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 if (is_ubsan_null) { | 150 if (is_ubsan_null) { |
151 ldflags += [ "-fsanitize=null" ] | 151 ldflags += [ "-fsanitize=null" ] |
152 } | 152 } |
153 if (is_ubsan_vptr) { | 153 if (is_ubsan_vptr) { |
154 ldflags += [ "-fsanitize=vptr" ] | 154 ldflags += [ "-fsanitize=vptr" ] |
155 } | 155 } |
156 | 156 |
157 if (is_cfi && !is_nacl) { | 157 if (is_cfi && !is_nacl) { |
158 ldflags += [ | 158 ldflags += [ |
159 "-fsanitize=cfi-vcall", | 159 "-fsanitize=cfi-vcall", |
160 "-fsanitize=cfi-derived-cast", | |
161 "-fsanitize=cfi-unrelated-cast", | |
162 ] | 160 ] |
| 161 if (use_cfi_cast) { |
| 162 ldflags += [ |
| 163 "-fsanitize=cfi-derived-cast", |
| 164 "-fsanitize=cfi-unrelated-cast", |
| 165 ] |
| 166 } |
163 if (use_cfi_diag) { | 167 if (use_cfi_diag) { |
164 ldflags += [ | 168 ldflags += [ |
165 "-fno-sanitize-trap=cfi", | 169 "-fno-sanitize-trap=cfi", |
166 "-fsanitize-recover=cfi", | 170 "-fsanitize-recover=cfi", |
167 ] | 171 ] |
168 } | 172 } |
169 } | 173 } |
170 } | 174 } |
171 } | 175 } |
172 | 176 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 252 } |
249 } | 253 } |
250 | 254 |
251 config("cfi_flags") { | 255 config("cfi_flags") { |
252 cflags = [] | 256 cflags = [] |
253 if (is_cfi && !is_nacl) { | 257 if (is_cfi && !is_nacl) { |
254 cfi_blacklist_path = | 258 cfi_blacklist_path = |
255 rebase_path("//tools/cfi/blacklist.txt", root_build_dir) | 259 rebase_path("//tools/cfi/blacklist.txt", root_build_dir) |
256 cflags += [ | 260 cflags += [ |
257 "-fsanitize=cfi-vcall", | 261 "-fsanitize=cfi-vcall", |
258 "-fsanitize=cfi-derived-cast", | 262 ] |
259 "-fsanitize=cfi-unrelated-cast", | 263 if (use_cfi_cast) { |
| 264 cflags += [ |
| 265 "-fsanitize=cfi-derived-cast", |
| 266 "-fsanitize=cfi-unrelated-cast", |
| 267 ] |
| 268 } |
| 269 cflags += [ |
260 "-fsanitize-blacklist=$cfi_blacklist_path", | 270 "-fsanitize-blacklist=$cfi_blacklist_path", |
261 ] | 271 ] |
262 | 272 |
263 if (use_cfi_diag) { | 273 if (use_cfi_diag) { |
264 cflags += [ | 274 cflags += [ |
265 "-fno-sanitize-trap=cfi", | 275 "-fno-sanitize-trap=cfi", |
266 "-fsanitize-recover=cfi", | 276 "-fsanitize-recover=cfi", |
267 "-fno-inline-functions", | 277 "-fno-inline-functions", |
268 "-fno-inline", | 278 "-fno-inline", |
269 "-fno-omit-frame-pointer", | 279 "-fno-omit-frame-pointer", |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 # This allows to selectively disable ubsan_vptr, when needed. In particular, | 443 # This allows to selectively disable ubsan_vptr, when needed. In particular, |
434 # if some third_party code is required to be compiled without rtti, which | 444 # if some third_party code is required to be compiled without rtti, which |
435 # is a requirement for ubsan_vptr. | 445 # is a requirement for ubsan_vptr. |
436 config("default_sanitizer_flags_but_ubsan_vptr") { | 446 config("default_sanitizer_flags_but_ubsan_vptr") { |
437 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] | 447 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] |
438 } | 448 } |
439 | 449 |
440 config("default_sanitizer_flags_but_coverage") { | 450 config("default_sanitizer_flags_but_coverage") { |
441 configs = all_sanitizer_configs - [ ":coverage_flags" ] | 451 configs = all_sanitizer_configs - [ ":coverage_flags" ] |
442 } | 452 } |
OLD | NEW |