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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 } else { | 244 } else { |
243 # TODO(rnk): DLLs in the non-component build should link against | 245 # TODO(rnk): DLLs in the non-component build should link against |
244 # clang_rt.asan_dll_thunk-i386.lib instead. | 246 # clang_rt.asan_dll_thunk-i386.lib instead. |
245 libs = [ "clang_rt.asan-i386.lib" ] | 247 libs = [ "clang_rt.asan-i386.lib" ] |
246 } | 248 } |
247 } | 249 } |
248 } | 250 } |
249 } | 251 } |
250 | 252 |
251 config("cfi_flags") { | 253 config("cfi_flags") { |
254 defines = [] | |
252 cflags = [] | 255 cflags = [] |
253 if (is_cfi && !is_nacl) { | 256 if (is_cfi && !is_nacl) { |
254 cfi_blacklist_path = | 257 cfi_blacklist_path = |
255 rebase_path("//tools/cfi/blacklist.txt", root_build_dir) | 258 rebase_path("//tools/cfi/blacklist.txt", root_build_dir) |
256 cflags += [ | 259 cflags += [ |
257 "-fsanitize=cfi-vcall", | 260 "-fsanitize=cfi-vcall", |
258 "-fsanitize=cfi-derived-cast", | |
259 "-fsanitize=cfi-unrelated-cast", | |
260 "-fsanitize-blacklist=$cfi_blacklist_path", | 261 "-fsanitize-blacklist=$cfi_blacklist_path", |
261 ] | 262 ] |
262 | 263 |
264 if (use_cfi_cast) { | |
265 cflags += [ | |
266 "-fsanitize=cfi-derived-cast", | |
267 "-fsanitize=cfi-unrelated-cast", | |
268 ] | |
269 | |
270 # TODO(krasin): remove CFI_CAST_CHECK, see https://crbug.com/626794. | |
271 defines += [ "CFI_CAST_CHECK" ] | |
Nico
2016/07/12 23:23:59
likewise
krasin1
2016/07/13 00:02:51
Done.
| |
272 } | |
273 | |
263 if (use_cfi_diag) { | 274 if (use_cfi_diag) { |
264 cflags += [ | 275 cflags += [ |
265 "-fno-sanitize-trap=cfi", | 276 "-fno-sanitize-trap=cfi", |
266 "-fsanitize-recover=cfi", | 277 "-fsanitize-recover=cfi", |
267 "-fno-inline-functions", | 278 "-fno-inline-functions", |
268 "-fno-inline", | 279 "-fno-inline", |
269 "-fno-omit-frame-pointer", | 280 "-fno-omit-frame-pointer", |
270 "-O1", | 281 "-O1", |
271 ] | 282 ] |
272 } else { | 283 } else { |
273 defines = [ "CFI_ENFORCEMENT" ] | 284 defines += [ "CFI_ENFORCEMENT" ] |
274 } | 285 } |
275 } | 286 } |
276 } | 287 } |
277 | 288 |
278 config("coverage_flags") { | 289 config("coverage_flags") { |
279 cflags = [] | 290 cflags = [] |
280 | 291 |
281 if (use_sanitizer_coverage) { | 292 if (use_sanitizer_coverage) { |
282 cflags += [ | 293 cflags += [ |
283 "-fsanitize-coverage=$sanitizer_coverage_flags", | 294 "-fsanitize-coverage=$sanitizer_coverage_flags", |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 # This allows to selectively disable ubsan_vptr, when needed. In particular, | 444 # 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 | 445 # if some third_party code is required to be compiled without rtti, which |
435 # is a requirement for ubsan_vptr. | 446 # is a requirement for ubsan_vptr. |
436 config("default_sanitizer_flags_but_ubsan_vptr") { | 447 config("default_sanitizer_flags_but_ubsan_vptr") { |
437 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] | 448 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] |
438 } | 449 } |
439 | 450 |
440 config("default_sanitizer_flags_but_coverage") { | 451 config("default_sanitizer_flags_but_coverage") { |
441 configs = all_sanitizer_configs - [ ":coverage_flags" ] | 452 configs = all_sanitizer_configs - [ ":coverage_flags" ] |
442 } | 453 } |
OLD | NEW |