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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 "-isystem" + rebase_path("$prefix/libc++/$include", root_build_dir), | 199 "-isystem" + rebase_path("$prefix/libc++/$include", root_build_dir), |
200 "-isystem" + rebase_path("$prefix/libc++abi/$include", root_build_dir), | 200 "-isystem" + rebase_path("$prefix/libc++abi/$include", root_build_dir), |
201 ] | 201 ] |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 config("asan_flags") { | 205 config("asan_flags") { |
206 cflags = [] | 206 cflags = [] |
207 if (is_asan) { | 207 if (is_asan) { |
208 cflags += [ "-fsanitize=address" ] | 208 cflags += [ "-fsanitize=address" ] |
| 209 if (!asan_globals) { |
| 210 cflags += [ |
| 211 "-mllvm", |
| 212 "-asan-globals=0", |
| 213 ] |
| 214 } |
209 if (is_win) { | 215 if (is_win) { |
210 cflags += [ "-fsanitize-blacklist=" + | 216 cflags += [ "-fsanitize-blacklist=" + |
211 rebase_path("//tools/memory/asan/blacklist_win.txt", | 217 rebase_path("//tools/memory/asan/blacklist_win.txt", |
212 root_build_dir) ] | 218 root_build_dir) ] |
213 } else { | 219 } else { |
214 # TODO(rnk): Remove this as discussed in http://crbug.com/427202. | 220 # TODO(rnk): Remove this as discussed in http://crbug.com/427202. |
215 cflags += | 221 cflags += |
216 [ "-fsanitize-blacklist=" + | 222 [ "-fsanitize-blacklist=" + |
217 rebase_path("//tools/memory/asan/blacklist.txt", root_build_dir) ] | 223 rebase_path("//tools/memory/asan/blacklist.txt", root_build_dir) ] |
218 } | 224 } |
219 if (is_android) { | 225 |
220 # Android build relies on -Wl,--gc-sections removing unreachable code. | 226 if (is_win) { |
221 # ASan instrumentation for globals inhibits this and results in a | |
222 # library with unresolvable relocations. | |
223 # TODO(eugenis): find a way to reenable this. | |
224 cflags += [ | |
225 "-mllvm", | |
226 "-asan-globals=0", | |
227 ] | |
228 } else if (is_mac) { | |
229 # http://crbug.com/352073 | |
230 cflags += [ | |
231 "-mllvm", | |
232 "-asan-globals=0", | |
233 ] | |
234 # TODO(GYP): deal with mac_bundles. | |
235 } else if (is_win) { | |
236 assert(current_cpu == "x86", "WinASan is 32-bit only currently") | 227 assert(current_cpu == "x86", "WinASan is 32-bit only currently") |
237 if (is_component_build) { | 228 if (is_component_build) { |
238 libs = [ | 229 libs = [ |
239 "clang_rt.asan_dynamic-i386.lib", | 230 "clang_rt.asan_dynamic-i386.lib", |
240 "clang_rt.asan_dynamic_runtime_thunk-i386.lib", | 231 "clang_rt.asan_dynamic_runtime_thunk-i386.lib", |
241 ] | 232 ] |
242 } else { | 233 } else { |
243 # TODO(rnk): DLLs in the non-component build should link against | 234 # TODO(rnk): DLLs in the non-component build should link against |
244 # clang_rt.asan_dll_thunk-i386.lib instead. | 235 # clang_rt.asan_dll_thunk-i386.lib instead. |
245 libs = [ "clang_rt.asan-i386.lib" ] | 236 libs = [ "clang_rt.asan-i386.lib" ] |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 # This allows to selectively disable ubsan_vptr, when needed. In particular, | 424 # 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 | 425 # if some third_party code is required to be compiled without rtti, which |
435 # is a requirement for ubsan_vptr. | 426 # is a requirement for ubsan_vptr. |
436 config("default_sanitizer_flags_but_ubsan_vptr") { | 427 config("default_sanitizer_flags_but_ubsan_vptr") { |
437 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] | 428 configs = all_sanitizer_configs - [ ":ubsan_vptr_flags" ] |
438 } | 429 } |
439 | 430 |
440 config("default_sanitizer_flags_but_coverage") { | 431 config("default_sanitizer_flags_but_coverage") { |
441 configs = all_sanitizer_configs - [ ":coverage_flags" ] | 432 configs = all_sanitizer_configs - [ ":coverage_flags" ] |
442 } | 433 } |
OLD | NEW |