OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/buildflag_header.gni") | 5 import("//build/buildflag_header.gni") |
6 import("//build/config/allocator.gni") | 6 import("//build/config/allocator.gni") |
7 import("//build/config/compiler/compiler.gni") | 7 import("//build/config/compiler/compiler.gni") |
8 | 8 |
9 declare_args() { | 9 declare_args() { |
10 # Provide a way to force disable debugallocation in Debug builds, | 10 # Provide a way to force disable debugallocation in Debug builds, |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 deps += [ "//base/third_party/dynamic_annotations" ] | 260 deps += [ "//base/third_party/dynamic_annotations" ] |
261 } | 261 } |
262 } # use_allocator == "tcmalloc" | 262 } # use_allocator == "tcmalloc" |
263 | 263 |
264 buildflag_header("features") { | 264 buildflag_header("features") { |
265 header = "features.h" | 265 header = "features.h" |
266 flags = [ "USE_EXPERIMENTAL_ALLOCATOR_SHIM=$use_experimental_allocator_shim" ] | 266 flags = [ "USE_EXPERIMENTAL_ALLOCATOR_SHIM=$use_experimental_allocator_shim" ] |
267 } | 267 } |
268 | 268 |
269 if (use_experimental_allocator_shim) { | 269 if (use_experimental_allocator_shim) { |
| 270 # Used to shim malloc symbols on Android. see //base/allocator/README.md. |
| 271 config("wrap_malloc_symbols") { |
| 272 ldflags = [ |
| 273 "-Wl,-wrap,calloc", |
| 274 "-Wl,-wrap,free", |
| 275 "-Wl,-wrap,malloc", |
| 276 "-Wl,-wrap,memalign", |
| 277 "-Wl,-wrap,posix_memalign", |
| 278 "-Wl,-wrap,pvalloc", |
| 279 "-Wl,-wrap,realloc", |
| 280 "-Wl,-wrap,valloc", |
| 281 ] |
| 282 } |
| 283 |
270 source_set("unified_allocator_shim") { | 284 source_set("unified_allocator_shim") { |
271 # TODO(primiano): support other platforms, currently this works only on | 285 # TODO(primiano): support other platforms, currently this works only on |
272 # Linux/CrOS. http://crbug.com/550886 . | 286 # Linux/CrOS/Android. http://crbug.com/550886 . |
273 configs += [ "//base:base_implementation" ] # for BASE_EXPORT | 287 configs += [ "//base:base_implementation" ] # for BASE_EXPORT |
274 visibility = [ "//base:base" ] | 288 visibility = [ "//base:base" ] |
275 sources = [ | 289 sources = [ |
276 "allocator_shim.cc", | 290 "allocator_shim.cc", |
277 "allocator_shim.h", | 291 "allocator_shim.h", |
278 "allocator_shim_internals.h", | 292 "allocator_shim_internals.h", |
279 "allocator_shim_override_cpp_symbols.h", | 293 "allocator_shim_override_cpp_symbols.h", |
280 "allocator_shim_override_libc_symbols.h", | 294 "allocator_shim_override_libc_symbols.h", |
281 ] | 295 ] |
282 if (is_linux && use_allocator == "tcmalloc") { | 296 if (is_linux && use_allocator == "tcmalloc") { |
283 sources += [ | 297 sources += [ |
284 "allocator_shim_default_dispatch_to_tcmalloc.cc", | 298 "allocator_shim_default_dispatch_to_tcmalloc.cc", |
285 "allocator_shim_override_glibc_weak_symbols.h", | 299 "allocator_shim_override_glibc_weak_symbols.h", |
286 ] | 300 ] |
287 deps = [ | 301 deps = [ |
288 ":tcmalloc", | 302 ":tcmalloc", |
289 ] | 303 ] |
290 } else if (is_linux && use_allocator == "none") { | 304 } else if (is_linux && use_allocator == "none") { |
291 sources += [ "allocator_shim_default_dispatch_to_glibc.cc" ] | 305 sources += [ "allocator_shim_default_dispatch_to_glibc.cc" ] |
| 306 } else if (is_android && use_allocator == "none") { |
| 307 sources += [ |
| 308 "allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc", |
| 309 "allocator_shim_override_linker_wrapped_symbols.h", |
| 310 ] |
| 311 all_dependent_configs = [ ":wrap_malloc_symbols" ] |
292 } | 312 } |
293 } | 313 } |
294 } | 314 } |
OLD | NEW |