chromium/components/gwp_asan/buildflags/buildflags.gni

# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//base/allocator/allocator.gni")
import("//base/allocator/partition_allocator/partition_alloc.gni")
import("//build/config/compiler/compiler.gni")

# Windows/32-bit is disabled due to https://crbug.com/969146
# Android component builds are disabled due to https://crbug.com/976399
# Android requires frame pointers for unwinding, unwind tables aren't shipped in
# official builds.
supported_platform =
    is_linux || is_chromeos || is_mac ||
    (is_win && (current_cpu == "x64" || current_cpu == "arm64")) ||
    (is_android && !is_component_build && enable_frame_pointers)

declare_args() {
  # Is GWP-ASan malloc/PartitionAlloc hooking enabled for chrome/ on a given
  # platform.
  enable_gwp_asan_malloc = supported_platform && use_allocator_shim
  enable_gwp_asan_partitionalloc = supported_platform && use_partition_alloc
}

declare_args() {
  # Convenience definition
  enable_gwp_asan = enable_gwp_asan_malloc || enable_gwp_asan_partitionalloc
}