| 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 } # use_allocator == "tcmalloc" | 287 } # use_allocator == "tcmalloc" |
| 288 | 288 |
| 289 buildflag_header("features") { | 289 buildflag_header("features") { |
| 290 header = "features.h" | 290 header = "features.h" |
| 291 flags = [ | 291 flags = [ |
| 292 "USE_EXPERIMENTAL_ALLOCATOR_SHIM=$use_experimental_allocator_shim", | 292 "USE_EXPERIMENTAL_ALLOCATOR_SHIM=$use_experimental_allocator_shim", |
| 293 "ENABLE_WIN_ALLOCATOR_SHIM_TESTS=($use_experimental_allocator_shim || $win_u
se_allocator_shim)", | 293 "ENABLE_WIN_ALLOCATOR_SHIM_TESTS=($use_experimental_allocator_shim || $win_u
se_allocator_shim)", |
| 294 ] | 294 ] |
| 295 } | 295 } |
| 296 | 296 |
| 297 if (use_experimental_allocator_shim) { | 297 # Used to shim malloc symbols on Android. see //base/allocator/README.md. |
| 298 # Used to shim malloc symbols on Android. see //base/allocator/README.md. | 298 config("wrap_malloc_symbols") { |
| 299 config("wrap_malloc_symbols") { | 299 ldflags = [ |
| 300 ldflags = [ | 300 "-Wl,-wrap,calloc", |
| 301 "-Wl,-wrap,calloc", | 301 "-Wl,-wrap,free", |
| 302 "-Wl,-wrap,free", | 302 "-Wl,-wrap,malloc", |
| 303 "-Wl,-wrap,malloc", | 303 "-Wl,-wrap,memalign", |
| 304 "-Wl,-wrap,memalign", | 304 "-Wl,-wrap,posix_memalign", |
| 305 "-Wl,-wrap,posix_memalign", | 305 "-Wl,-wrap,pvalloc", |
| 306 "-Wl,-wrap,pvalloc", | 306 "-Wl,-wrap,realloc", |
| 307 "-Wl,-wrap,realloc", | 307 "-Wl,-wrap,valloc", |
| 308 "-Wl,-wrap,valloc", | 308 ] |
| 309 ] | |
| 310 } | |
| 311 | |
| 312 source_set("unified_allocator_shim") { | |
| 313 # TODO(primiano): support other platforms, currently this works only on | |
| 314 # Linux/CrOS/Android. http://crbug.com/550886 . | |
| 315 configs += [ "//base:base_implementation" ] # for BASE_EXPORT | |
| 316 visibility = [ "//base:base" ] | |
| 317 sources = [ | |
| 318 "allocator_shim.cc", | |
| 319 "allocator_shim.h", | |
| 320 "allocator_shim_internals.h", | |
| 321 "allocator_shim_override_cpp_symbols.h", | |
| 322 "allocator_shim_override_libc_symbols.h", | |
| 323 ] | |
| 324 if (is_win) { | |
| 325 sources += [ | |
| 326 "allocator_shim_default_dispatch_to_winheap.cc", | |
| 327 "allocator_shim_override_ucrt_symbols_win.h", | |
| 328 "winheap_stubs_win.cc", | |
| 329 "winheap_stubs_win.h", | |
| 330 ] | |
| 331 } else if (is_linux && use_allocator == "tcmalloc") { | |
| 332 sources += [ | |
| 333 "allocator_shim_default_dispatch_to_tcmalloc.cc", | |
| 334 "allocator_shim_override_glibc_weak_symbols.h", | |
| 335 ] | |
| 336 deps = [ | |
| 337 ":tcmalloc", | |
| 338 ] | |
| 339 } else if (is_linux && use_allocator == "none") { | |
| 340 sources += [ "allocator_shim_default_dispatch_to_glibc.cc" ] | |
| 341 } else if (is_android && use_allocator == "none") { | |
| 342 sources += [ | |
| 343 "allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc", | |
| 344 "allocator_shim_override_linker_wrapped_symbols.h", | |
| 345 ] | |
| 346 all_dependent_configs = [ ":wrap_malloc_symbols" ] | |
| 347 } | |
| 348 } | |
| 349 } | 309 } |
| OLD | NEW |