GN(android): Fix compile when is_asan=true

BUG=559284

Review URL: https://codereview.chromium.org/1469943002

Cr-Original-Commit-Position: refs/heads/master@{#361361}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: cea07ed21c3ad2db7b37a3f26ce34d7dd12efe94
This commit is contained in:
agrieve 2015-11-24 08:38:00 -08:00 коммит произвёл Commit bot
Родитель 102598e404
Коммит b6f82aec62
4 изменённых файлов: 22 добавлений и 10 удалений

Просмотреть файл

@ -42,14 +42,6 @@ config("compiler") {
}
}
if (is_asan) {
# Android build relies on -Wl,--gc-sections removing unreachable code.
# ASan instrumentation for globals inhibits this and results in a library
# with unresolvable relocations.
# TODO(eugenis): find a way to reenable this.
cflags += [ "-mllvm -asan-globals=0" ]
}
# Use gold for Android for most CPU architectures.
if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm") {
ldflags += [ "-fuse-ld=gold" ]

Просмотреть файл

@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/android/config.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/zip.gni")
import("//third_party/ijar/ijar.gni")
@ -1971,6 +1972,9 @@ template("test_runner_script") {
"--num_retries=0",
]
}
if (is_asan) {
test_runner_args += [ "--tool=asan" ]
}
generated_script = "$root_build_dir/bin/run_${_test_name}"
outputs = [

Просмотреть файл

@ -102,8 +102,21 @@ config("default_sanitizer_flags") {
"-fsanitize=address",
"-fsanitize-blacklist=$asan_blacklist_path",
]
if (is_mac) {
cflags += [ "-mllvm -asan-globals=0" ] # http://crbug.com/352073
if (is_android) {
# Android build relies on -Wl,--gc-sections removing unreachable code.
# ASan instrumentation for globals inhibits this and results in a
# library with unresolvable relocations.
# TODO(eugenis): find a way to reenable this.
cflags += [
"-mllvm",
"-asan-globals=0",
]
} else if (is_mac) {
# http://crbug.com/352073
cflags += [
"-mllvm",
"-asan-globals=0",
]
# TODO(GYP): deal with mac_bundles.
}
}

Просмотреть файл

@ -85,3 +85,6 @@ assert(!using_sanitizer || is_clang,
assert(
!is_debug || !(is_msan || is_lsan || is_tsan || is_ubsan || is_ubsan_vptr),
"Sanitizers should generally be used in release (set is_debug=false).")
assert(!(is_android && is_asan && !is_component_build),
"is_asan on Android requires is_component_build to be set")