Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: build/config/sanitizers/BUILD.gn

Issue 2131423002: Implement use_cfi_cast to optionally enable cast checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Localize CFI_CAST_CHECK define Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/common.gypi ('k') | build/config/sanitizers/sanitizers.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 ldflags += [ "-fsanitize=undefined" ] 148 ldflags += [ "-fsanitize=undefined" ]
149 } 149 }
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 += [ "-fsanitize=cfi-vcall" ]
159 "-fsanitize=cfi-vcall", 159 if (use_cfi_cast) {
160 "-fsanitize=cfi-derived-cast", 160 ldflags += [
161 "-fsanitize=cfi-unrelated-cast", 161 "-fsanitize=cfi-derived-cast",
162 ] 162 "-fsanitize=cfi-unrelated-cast",
163 ]
164 }
163 if (use_cfi_diag) { 165 if (use_cfi_diag) {
164 ldflags += [ 166 ldflags += [
165 "-fno-sanitize-trap=cfi", 167 "-fno-sanitize-trap=cfi",
166 "-fsanitize-recover=cfi", 168 "-fsanitize-recover=cfi",
167 ] 169 ]
168 } 170 }
169 } 171 }
170 } 172 }
171 } 173 }
172 174
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 250 }
249 } 251 }
250 252
251 config("cfi_flags") { 253 config("cfi_flags") {
252 cflags = [] 254 cflags = []
253 if (is_cfi && !is_nacl) { 255 if (is_cfi && !is_nacl) {
254 cfi_blacklist_path = 256 cfi_blacklist_path =
255 rebase_path("//tools/cfi/blacklist.txt", root_build_dir) 257 rebase_path("//tools/cfi/blacklist.txt", root_build_dir)
256 cflags += [ 258 cflags += [
257 "-fsanitize=cfi-vcall", 259 "-fsanitize=cfi-vcall",
258 "-fsanitize=cfi-derived-cast",
259 "-fsanitize=cfi-unrelated-cast",
260 "-fsanitize-blacklist=$cfi_blacklist_path", 260 "-fsanitize-blacklist=$cfi_blacklist_path",
261 ] 261 ]
262 262
263 if (use_cfi_cast) {
264 cflags += [
265 "-fsanitize=cfi-derived-cast",
266 "-fsanitize=cfi-unrelated-cast",
267 ]
268 }
269
263 if (use_cfi_diag) { 270 if (use_cfi_diag) {
264 cflags += [ 271 cflags += [
265 "-fno-sanitize-trap=cfi", 272 "-fno-sanitize-trap=cfi",
266 "-fsanitize-recover=cfi", 273 "-fsanitize-recover=cfi",
267 "-fno-inline-functions", 274 "-fno-inline-functions",
268 "-fno-inline", 275 "-fno-inline",
269 "-fno-omit-frame-pointer", 276 "-fno-omit-frame-pointer",
270 "-O1", 277 "-O1",
271 ] 278 ]
272 } else { 279 } else {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 # This allows to selectively disable ubsan_vptr, when needed. In particular, 440 # 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 441 # if some third_party code is required to be compiled without rtti, which
435 # is a requirement for ubsan_vptr. 442 # is a requirement for ubsan_vptr.
436 config("default_sanitizer_flags_but_ubsan_vptr") { 443 config("default_sanitizer_flags_but_ubsan_vptr") {
437 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] 444 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ]
438 } 445 }
439 446
440 config("default_sanitizer_flags_but_coverage") { 447 config("default_sanitizer_flags_but_coverage") {
441 configs = all_sanitizer_configs - [ ":coverage_flags" ] 448 configs = all_sanitizer_configs - [ ":coverage_flags" ]
442 } 449 }
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | build/config/sanitizers/sanitizers.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698