Index: base/allocator/BUILD.gn |
diff --git a/base/allocator/BUILD.gn b/base/allocator/BUILD.gn |
index c1599bb6855669c1a2d39fe2b038f0918e5c42f5..b2ec91e40c5842a6bcee91dea4dd03824a150653 100644 |
--- a/base/allocator/BUILD.gn |
+++ b/base/allocator/BUILD.gn |
@@ -267,9 +267,23 @@ buildflag_header("features") { |
} |
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. http://crbug.com/550886 . |
+ # Linux/CrOS/Android. http://crbug.com/550886 . |
configs += [ "//base:base_implementation" ] # for BASE_EXPORT |
visibility = [ "//base:base" ] |
sources = [ |
@@ -289,6 +303,12 @@ if (use_experimental_allocator_shim) { |
] |
} 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" ] |
} |
} |
} |