summaryrefslogtreecommitdiff
path: root/base/allocator/BUILD.gn
diff options
context:
space:
mode:
Diffstat (limited to 'base/allocator/BUILD.gn')
-rw-r--r--base/allocator/BUILD.gn78
1 files changed, 30 insertions, 48 deletions
diff --git a/base/allocator/BUILD.gn b/base/allocator/BUILD.gn
index 490b8e871b..8cdb06161f 100644
--- a/base/allocator/BUILD.gn
+++ b/base/allocator/BUILD.gn
@@ -13,8 +13,10 @@ declare_args() {
enable_debugallocation = is_debug
}
-# Allocator shim is only enabled for Release static builds.
-win_use_allocator_shim = is_win && !is_component_build && !is_debug
+# The Windows-only allocator shim is only enabled for Release static builds, and
+# is mutually exclusive with the generalized shim.
+win_use_allocator_shim = is_win && !is_component_build && !is_debug &&
+ !use_experimental_allocator_shim && !is_asan
# This "allocator" meta-target will forward to the default allocator according
# to the build settings.
@@ -93,6 +95,8 @@ if (win_use_allocator_shim) {
sources = [
"allocator_shim_win.cc",
"allocator_shim_win.h",
+ "winheap_stubs_win.cc",
+ "winheap_stubs_win.h",
]
configs += [ ":allocator_shim_define" ]
}
@@ -218,6 +222,14 @@ if (use_allocator == "tcmalloc") {
":tcmalloc_flags",
]
+ # Thumb mode disabled due to bug in clang integrated assembler
+ # TODO(https://llvm.org/bugs/show_bug.cgi?id=31058)
+ configs -= [ "//build/config/compiler:compiler_arm_thumb" ]
+ configs += [ "//build/config/compiler:compiler_arm" ]
+
+ # TODO(crbug.com/633719) Make tcmalloc work with AFDO if possible.
+ configs -= [ "//build/config/compiler:afdo" ]
+
deps = []
if (enable_profiling) {
@@ -276,52 +288,22 @@ if (use_allocator == "tcmalloc") {
buildflag_header("features") {
header = "features.h"
- flags = [ "USE_EXPERIMENTAL_ALLOCATOR_SHIM=$use_experimental_allocator_shim" ]
+ flags = [
+ "USE_EXPERIMENTAL_ALLOCATOR_SHIM=$use_experimental_allocator_shim",
+ "ENABLE_WIN_ALLOCATOR_SHIM_TESTS=($use_experimental_allocator_shim || $win_use_allocator_shim)",
+ ]
}
-if (use_experimental_allocator_shim) {
- # Used to shim malloc symbols on Android. see //base/allocator/README.md.
- config("wrap_malloc_symbols") {
- ldflags = [
- "-Wl,-wrap,calloc",
- "-Wl,-wrap,free",
- "-Wl,-wrap,malloc",
- "-Wl,-wrap,memalign",
- "-Wl,-wrap,posix_memalign",
- "-Wl,-wrap,pvalloc",
- "-Wl,-wrap,realloc",
- "-Wl,-wrap,valloc",
- ]
- }
-
- source_set("unified_allocator_shim") {
- # TODO(primiano): support other platforms, currently this works only on
- # Linux/CrOS/Android. http://crbug.com/550886 .
- configs += [ "//base:base_implementation" ] # for BASE_EXPORT
- visibility = [ "//base:base" ]
- sources = [
- "allocator_shim.cc",
- "allocator_shim.h",
- "allocator_shim_internals.h",
- "allocator_shim_override_cpp_symbols.h",
- "allocator_shim_override_libc_symbols.h",
- ]
- if (is_linux && use_allocator == "tcmalloc") {
- sources += [
- "allocator_shim_default_dispatch_to_tcmalloc.cc",
- "allocator_shim_override_glibc_weak_symbols.h",
- ]
- deps = [
- ":tcmalloc",
- ]
- } else if (is_linux && use_allocator == "none") {
- sources += [ "allocator_shim_default_dispatch_to_glibc.cc" ]
- } else if (is_android && use_allocator == "none") {
- sources += [
- "allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc",
- "allocator_shim_override_linker_wrapped_symbols.h",
- ]
- all_dependent_configs = [ ":wrap_malloc_symbols" ]
- }
- }
+# Used to shim malloc symbols on Android. see //base/allocator/README.md.
+config("wrap_malloc_symbols") {
+ ldflags = [
+ "-Wl,-wrap,calloc",
+ "-Wl,-wrap,free",
+ "-Wl,-wrap,malloc",
+ "-Wl,-wrap,memalign",
+ "-Wl,-wrap,posix_memalign",
+ "-Wl,-wrap,pvalloc",
+ "-Wl,-wrap,realloc",
+ "-Wl,-wrap,valloc",
+ ]
}