diff --git a/.gnfiles/build/BUILDCONFIG.gn b/.gnfiles/build/BUILDCONFIG.gn index 4a30ce0..9db4af4 100644 --- a/.gnfiles/build/BUILDCONFIG.gn +++ b/.gnfiles/build/BUILDCONFIG.gn @@ -63,12 +63,10 @@ if (is_win) { declare_args() { enable_cxx_rtti = false - # Rust AddressSanitizer is supported on Linux x64 and macOS x64/arm64. Refer - # to: https://doc.rust-lang.org/stable/unstable-book/compiler-flags/sanitizer.html#addresssanitizer - # - # rustc finds the asan runtime library in ~/.rustup/toolchains// - # lib/rustlib//lib/librustc-nightly_rt.asan.a - enable_sanitizer = is_debug && (is_mac || (is_linux && target_cpu == "x64")) + # Set to true to disable ASAN for all code (only used when collecting coverage) + # Implement this because ASAN conflicts with coverage instrumentation: + # -Zprofile -Zsanitizer=address can't be used together. + disable_asan = false # Turn this on to have the compiler output extra timing information. enable_build_time_report = false @@ -82,6 +80,18 @@ declare_args() { enable_serialized_actions = false } +# Separate declare_args to avoid circular dependency +# enable_sanitizer depends on disable_asan +declare_args() { + # Rust AddressSanitizer is supported on Linux x64 and macOS x64/arm64. Refer + # to: https://doc.rust-lang.org/stable/unstable-book/compiler-flags/sanitizer.html#addresssanitizer + # + # rustc finds the asan runtime library in ~/.rustup/toolchains// + # lib/rustlib//lib/librustc-nightly_rt.asan.a + # Disable ASAN when disable_asan is true (e.g., when collecting coverage) + enable_sanitizer = !disable_asan && is_debug && (is_mac || (is_linux && target_cpu == "x64")) +} + _default_toolchain = "" _default_config = [] _default_config_name = "release"