mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add buildroot compatibility for HWASAN. (#167133)
Needed to roll https://dart-review.googlesource.com/c/sdk/+/421180.
This commit is contained in:
parent
8703147add
commit
ca758ac49b
@ -143,6 +143,10 @@ declare_args() {
|
||||
# Compile for Address Sanitizer to find memory bugs.
|
||||
is_asan = false
|
||||
|
||||
# Compile with HWAddress Sanitizer to find memory bugs.
|
||||
# Requires ARM64 hardware
|
||||
is_hwasan = false
|
||||
|
||||
# Compile for Leak Sanitizer to find leaks.
|
||||
is_lsan = false
|
||||
|
||||
@ -319,7 +323,7 @@ default_library_type = "static_library"
|
||||
|
||||
# These Sanitizers all imply using the Clang compiler. On Windows they either
|
||||
# don't work or work differently.
|
||||
using_sanitizer = !is_win && (is_asan || is_lsan || is_tsan || is_msan)
|
||||
using_sanitizer = !is_win && (is_asan || is_hwasan || is_lsan || is_tsan || is_msan)
|
||||
if (!is_clang && using_sanitizer) {
|
||||
is_clang = true
|
||||
}
|
||||
@ -413,7 +417,7 @@ if (symbol_level == -1) {
|
||||
# size is paramount.
|
||||
if (is_debug || (!is_linux && !is_wasm)) {
|
||||
symbol_level = 2
|
||||
} else if (is_asan || is_lsan || is_tsan || is_msan) {
|
||||
} else if (is_asan || is_hwasan || is_lsan || is_tsan || is_msan) {
|
||||
# Sanitizers require symbols for filename suppressions to work.
|
||||
symbol_level = 1
|
||||
} else {
|
||||
|
||||
@ -125,6 +125,10 @@ config("compiler") {
|
||||
cflags += [ "-fsanitize=address" ]
|
||||
ldflags += [ "-fsanitize=address" ]
|
||||
}
|
||||
if (is_hwasan && is_android && current_cpu == "arm64") {
|
||||
cflags += [ "-fsanitize=hwaddress" ]
|
||||
ldflags += [ "-fsanitize=hwaddress" ]
|
||||
}
|
||||
if (is_lsan) {
|
||||
cflags += [ "-fsanitize=leak" ]
|
||||
ldflags += [ "-fsanitize=leak" ]
|
||||
|
||||
@ -10,7 +10,7 @@ import("//build/toolchain/toolchain.gni")
|
||||
# shared_libraries. Unconditionally depend upon this target as it is empty if
|
||||
# |is_asan|, |is_lsan|, |is_tsan|, |is_msan| and |use_custom_libcxx| are false.
|
||||
group("deps") {
|
||||
if (is_asan || is_lsan || is_tsan || is_msan) {
|
||||
if (is_asan || is_hwasan || is_lsan || is_tsan || is_msan) {
|
||||
public_configs = [ ":sanitizer_options_link_helper" ]
|
||||
deps += [ ":options_sources" ]
|
||||
}
|
||||
@ -24,6 +24,9 @@ config("sanitizer_options_link_helper") {
|
||||
if (is_asan) {
|
||||
ldflags += [ "-fsanitize=address" ]
|
||||
}
|
||||
if (is_hwasan && is_android && current_cpu == "arm64") {
|
||||
ldflags += [ "-fsanitize=hwaddress" ]
|
||||
}
|
||||
if (is_lsan) {
|
||||
ldflags += [ "-fsanitize=leak" ]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user