1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 { 6 'variables': { 7 'jemalloc_dir': '../../third_party/jemalloc/chromium', 8 'tcmalloc_dir': '../../third_party/tcmalloc/chromium', 9 'use_vtable_verify%': 0, 10 }, 11 'targets': [ 12 # Only executables and not libraries should depend on the 13 # allocator target; only the application (the final executable) 14 # knows what allocator makes sense. 15 { 16 'target_name': 'allocator', 17 'type': 'static_library', 18 # Make sure the allocation library is optimized to 19 # the hilt in official builds. 20 'variables': { 21 'optimize': 'max', 22 }, 23 'include_dirs': [ 24 '.', 25 '<(tcmalloc_dir)/src/base', 26 '<(tcmalloc_dir)/src', 27 '../..', 28 ], 29 'direct_dependent_settings': { 30 'configurations': { 31 'Common_Base': { 32 'msvs_settings': { 33 'VCLinkerTool': { 34 'IgnoreDefaultLibraryNames': ['libcmtd.lib', 'libcmt.lib'], 35 'AdditionalDependencies': [ 36 '<(SHARED_INTERMEDIATE_DIR)/allocator/libcmt.lib' 37 ], 38 }, 39 }, 40 }, 41 }, 42 'conditions': [ 43 ['OS=="win"', { 44 'defines': [ 45 'PERFTOOLS_DLL_DECL=', 46 ], 47 }], 48 ], 49 }, 50 'sources': [ 51 # Generated for our configuration from tcmalloc's build 52 # and checked in. 53 '<(tcmalloc_dir)/src/config.h', 54 '<(tcmalloc_dir)/src/config_android.h', 55 '<(tcmalloc_dir)/src/config_linux.h', 56 '<(tcmalloc_dir)/src/config_win.h', 57 58 # all tcmalloc native and forked files 59 '<(tcmalloc_dir)/src/addressmap-inl.h', 60 '<(tcmalloc_dir)/src/base/abort.cc', 61 '<(tcmalloc_dir)/src/base/abort.h', 62 '<(tcmalloc_dir)/src/base/arm_instruction_set_select.h', 63 '<(tcmalloc_dir)/src/base/atomicops-internals-linuxppc.h', 64 '<(tcmalloc_dir)/src/base/atomicops-internals-arm-generic.h', 65 '<(tcmalloc_dir)/src/base/atomicops-internals-arm-v6plus.h', 66 '<(tcmalloc_dir)/src/base/atomicops-internals-macosx.h', 67 '<(tcmalloc_dir)/src/base/atomicops-internals-windows.h', 68 '<(tcmalloc_dir)/src/base/atomicops-internals-x86.cc', 69 '<(tcmalloc_dir)/src/base/atomicops-internals-x86.h', 70 '<(tcmalloc_dir)/src/base/atomicops.h', 71 '<(tcmalloc_dir)/src/base/basictypes.h', 72 '<(tcmalloc_dir)/src/base/commandlineflags.h', 73 '<(tcmalloc_dir)/src/base/cycleclock.h', 74 # We don't list dynamic_annotations.c since its copy is already 75 # present in the dynamic_annotations target. 76 '<(tcmalloc_dir)/src/base/dynamic_annotations.h', 77 '<(tcmalloc_dir)/src/base/elf_mem_image.cc', 78 '<(tcmalloc_dir)/src/base/elf_mem_image.h', 79 '<(tcmalloc_dir)/src/base/elfcore.h', 80 '<(tcmalloc_dir)/src/base/googleinit.h', 81 '<(tcmalloc_dir)/src/base/linux_syscall_support.h', 82 '<(tcmalloc_dir)/src/base/linuxthreads.cc', 83 '<(tcmalloc_dir)/src/base/linuxthreads.h', 84 '<(tcmalloc_dir)/src/base/logging.cc', 85 '<(tcmalloc_dir)/src/base/logging.h', 86 '<(tcmalloc_dir)/src/base/low_level_alloc.cc', 87 '<(tcmalloc_dir)/src/base/low_level_alloc.h', 88 '<(tcmalloc_dir)/src/base/simple_mutex.h', 89 '<(tcmalloc_dir)/src/base/spinlock.cc', 90 '<(tcmalloc_dir)/src/base/spinlock.h', 91 '<(tcmalloc_dir)/src/base/spinlock_internal.cc', 92 '<(tcmalloc_dir)/src/base/spinlock_internal.h', 93 '<(tcmalloc_dir)/src/base/spinlock_linux-inl.h', 94 '<(tcmalloc_dir)/src/base/spinlock_posix-inl.h', 95 '<(tcmalloc_dir)/src/base/spinlock_win32-inl.h', 96 '<(tcmalloc_dir)/src/base/stl_allocator.h', 97 '<(tcmalloc_dir)/src/base/synchronization_profiling.h', 98 '<(tcmalloc_dir)/src/base/sysinfo.cc', 99 '<(tcmalloc_dir)/src/base/sysinfo.h', 100 '<(tcmalloc_dir)/src/base/thread_annotations.h', 101 '<(tcmalloc_dir)/src/base/thread_lister.c', 102 '<(tcmalloc_dir)/src/base/thread_lister.h', 103 '<(tcmalloc_dir)/src/base/vdso_support.cc', 104 '<(tcmalloc_dir)/src/base/vdso_support.h', 105 '<(tcmalloc_dir)/src/central_freelist.cc', 106 '<(tcmalloc_dir)/src/central_freelist.h', 107 '<(tcmalloc_dir)/src/common.cc', 108 '<(tcmalloc_dir)/src/common.h', 109 '<(tcmalloc_dir)/src/debugallocation.cc', 110 '<(tcmalloc_dir)/src/deep-heap-profile.cc', 111 '<(tcmalloc_dir)/src/deep-heap-profile.h', 112 '<(tcmalloc_dir)/src/free_list.cc', 113 '<(tcmalloc_dir)/src/free_list.h', 114 '<(tcmalloc_dir)/src/getpc.h', 115 '<(tcmalloc_dir)/src/gperftools/heap-checker.h', 116 '<(tcmalloc_dir)/src/gperftools/heap-profiler.h', 117 '<(tcmalloc_dir)/src/gperftools/malloc_extension.h', 118 '<(tcmalloc_dir)/src/gperftools/malloc_extension_c.h', 119 '<(tcmalloc_dir)/src/gperftools/malloc_hook.h', 120 '<(tcmalloc_dir)/src/gperftools/malloc_hook_c.h', 121 '<(tcmalloc_dir)/src/gperftools/profiler.h', 122 '<(tcmalloc_dir)/src/gperftools/stacktrace.h', 123 '<(tcmalloc_dir)/src/gperftools/tcmalloc.h', 124 '<(tcmalloc_dir)/src/heap-checker-bcad.cc', 125 '<(tcmalloc_dir)/src/heap-checker.cc', 126 '<(tcmalloc_dir)/src/heap-profile-table.cc', 127 '<(tcmalloc_dir)/src/heap-profile-table.h', 128 '<(tcmalloc_dir)/src/heap-profiler.cc', 129 '<(tcmalloc_dir)/src/internal_logging.cc', 130 '<(tcmalloc_dir)/src/internal_logging.h', 131 '<(tcmalloc_dir)/src/libc_override.h', 132 '<(tcmalloc_dir)/src/libc_override_gcc_and_weak.h', 133 '<(tcmalloc_dir)/src/libc_override_glibc.h', 134 '<(tcmalloc_dir)/src/libc_override_osx.h', 135 '<(tcmalloc_dir)/src/libc_override_redefine.h', 136 '<(tcmalloc_dir)/src/linked_list.h', 137 '<(tcmalloc_dir)/src/malloc_extension.cc', 138 '<(tcmalloc_dir)/src/malloc_hook-inl.h', 139 '<(tcmalloc_dir)/src/malloc_hook.cc', 140 '<(tcmalloc_dir)/src/malloc_hook_mmap_freebsd.h', 141 '<(tcmalloc_dir)/src/malloc_hook_mmap_linux.h', 142 '<(tcmalloc_dir)/src/maybe_threads.cc', 143 '<(tcmalloc_dir)/src/maybe_threads.h', 144 '<(tcmalloc_dir)/src/memfs_malloc.cc', 145 '<(tcmalloc_dir)/src/memory_region_map.cc', 146 '<(tcmalloc_dir)/src/memory_region_map.h', 147 '<(tcmalloc_dir)/src/packed-cache-inl.h', 148 '<(tcmalloc_dir)/src/page_heap.cc', 149 '<(tcmalloc_dir)/src/page_heap.h', 150 '<(tcmalloc_dir)/src/page_heap_allocator.h', 151 '<(tcmalloc_dir)/src/pagemap.h', 152 '<(tcmalloc_dir)/src/profile-handler.cc', 153 '<(tcmalloc_dir)/src/profile-handler.h', 154 '<(tcmalloc_dir)/src/profiledata.cc', 155 '<(tcmalloc_dir)/src/profiledata.h', 156 '<(tcmalloc_dir)/src/profiler.cc', 157 '<(tcmalloc_dir)/src/raw_printer.cc', 158 '<(tcmalloc_dir)/src/raw_printer.h', 159 '<(tcmalloc_dir)/src/sampler.cc', 160 '<(tcmalloc_dir)/src/sampler.h', 161 '<(tcmalloc_dir)/src/span.cc', 162 '<(tcmalloc_dir)/src/span.h', 163 '<(tcmalloc_dir)/src/stack_trace_table.cc', 164 '<(tcmalloc_dir)/src/stack_trace_table.h', 165 '<(tcmalloc_dir)/src/stacktrace.cc', 166 '<(tcmalloc_dir)/src/stacktrace_arm-inl.h', 167 '<(tcmalloc_dir)/src/stacktrace_config.h', 168 '<(tcmalloc_dir)/src/stacktrace_generic-inl.h', 169 '<(tcmalloc_dir)/src/stacktrace_libunwind-inl.h', 170 '<(tcmalloc_dir)/src/stacktrace_powerpc-inl.h', 171 '<(tcmalloc_dir)/src/stacktrace_win32-inl.h', 172 '<(tcmalloc_dir)/src/stacktrace_with_context.cc', 173 '<(tcmalloc_dir)/src/stacktrace_x86-inl.h', 174 '<(tcmalloc_dir)/src/static_vars.cc', 175 '<(tcmalloc_dir)/src/static_vars.h', 176 '<(tcmalloc_dir)/src/symbolize.cc', 177 '<(tcmalloc_dir)/src/symbolize.h', 178 '<(tcmalloc_dir)/src/system-alloc.cc', 179 '<(tcmalloc_dir)/src/system-alloc.h', 180 '<(tcmalloc_dir)/src/tcmalloc.cc', 181 '<(tcmalloc_dir)/src/tcmalloc_guard.h', 182 '<(tcmalloc_dir)/src/thread_cache.cc', 183 '<(tcmalloc_dir)/src/thread_cache.h', 184 '<(tcmalloc_dir)/src/windows/config.h', 185 '<(tcmalloc_dir)/src/windows/get_mangled_names.cc', 186 '<(tcmalloc_dir)/src/windows/gperftools/tcmalloc.h', 187 '<(tcmalloc_dir)/src/windows/ia32_modrm_map.cc', 188 '<(tcmalloc_dir)/src/windows/ia32_opcode_map.cc', 189 '<(tcmalloc_dir)/src/windows/mingw.h', 190 '<(tcmalloc_dir)/src/windows/mini_disassembler.cc', 191 '<(tcmalloc_dir)/src/windows/mini_disassembler.h', 192 '<(tcmalloc_dir)/src/windows/mini_disassembler_types.h', 193 '<(tcmalloc_dir)/src/windows/override_functions.cc', 194 '<(tcmalloc_dir)/src/windows/patch_functions.cc', 195 '<(tcmalloc_dir)/src/windows/port.cc', 196 '<(tcmalloc_dir)/src/windows/port.h', 197 '<(tcmalloc_dir)/src/windows/preamble_patcher.cc', 198 '<(tcmalloc_dir)/src/windows/preamble_patcher.h', 199 '<(tcmalloc_dir)/src/windows/preamble_patcher_with_stub.cc', 200 201 # jemalloc files 202 '<(jemalloc_dir)/jemalloc.c', 203 '<(jemalloc_dir)/jemalloc.h', 204 '<(jemalloc_dir)/ql.h', 205 '<(jemalloc_dir)/qr.h', 206 '<(jemalloc_dir)/rb.h', 207 208 'allocator_shim.cc', 209 'allocator_shim.h', 210 'debugallocation_shim.cc', 211 'generic_allocators.cc', 212 'win_allocator.cc', 213 ], 214 # sources! means that these are not compiled directly. 215 'sources!': [ 216 # Included by allocator_shim.cc for maximal inlining. 217 'generic_allocators.cc', 218 'win_allocator.cc', 219 220 # Included by debugallocation_shim.cc. 221 '<(tcmalloc_dir)/src/debugallocation.cc', 222 '<(tcmalloc_dir)/src/tcmalloc.cc', 223 224 # We simply don't use these, but list them above so that IDE 225 # users can view the full available source for reference, etc. 226 '<(tcmalloc_dir)/src/addressmap-inl.h', 227 '<(tcmalloc_dir)/src/base/atomicops-internals-linuxppc.h', 228 '<(tcmalloc_dir)/src/base/atomicops-internals-macosx.h', 229 '<(tcmalloc_dir)/src/base/atomicops-internals-x86-msvc.h', 230 '<(tcmalloc_dir)/src/base/atomicops-internals-x86.cc', 231 '<(tcmalloc_dir)/src/base/atomicops-internals-x86.h', 232 '<(tcmalloc_dir)/src/base/atomicops.h', 233 '<(tcmalloc_dir)/src/base/basictypes.h', 234 '<(tcmalloc_dir)/src/base/commandlineflags.h', 235 '<(tcmalloc_dir)/src/base/cycleclock.h', 236 '<(tcmalloc_dir)/src/base/elf_mem_image.h', 237 '<(tcmalloc_dir)/src/base/elfcore.h', 238 '<(tcmalloc_dir)/src/base/googleinit.h', 239 '<(tcmalloc_dir)/src/base/linux_syscall_support.h', 240 '<(tcmalloc_dir)/src/base/simple_mutex.h', 241 '<(tcmalloc_dir)/src/base/spinlock_linux-inl.h', 242 '<(tcmalloc_dir)/src/base/spinlock_posix-inl.h', 243 '<(tcmalloc_dir)/src/base/spinlock_win32-inl.h', 244 '<(tcmalloc_dir)/src/base/stl_allocator.h', 245 '<(tcmalloc_dir)/src/base/thread_annotations.h', 246 '<(tcmalloc_dir)/src/getpc.h', 247 '<(tcmalloc_dir)/src/gperftools/heap-checker.h', 248 '<(tcmalloc_dir)/src/gperftools/heap-profiler.h', 249 '<(tcmalloc_dir)/src/gperftools/malloc_extension.h', 250 '<(tcmalloc_dir)/src/gperftools/malloc_extension_c.h', 251 '<(tcmalloc_dir)/src/gperftools/malloc_hook.h', 252 '<(tcmalloc_dir)/src/gperftools/malloc_hook_c.h', 253 '<(tcmalloc_dir)/src/gperftools/profiler.h', 254 '<(tcmalloc_dir)/src/gperftools/stacktrace.h', 255 '<(tcmalloc_dir)/src/gperftools/tcmalloc.h', 256 '<(tcmalloc_dir)/src/libc_override.h', 257 '<(tcmalloc_dir)/src/libc_override_gcc_and_weak.h', 258 '<(tcmalloc_dir)/src/libc_override_glibc.h', 259 '<(tcmalloc_dir)/src/libc_override_osx.h', 260 '<(tcmalloc_dir)/src/libc_override_redefine.h', 261 '<(tcmalloc_dir)/src/malloc_hook_mmap_freebsd.h', 262 '<(tcmalloc_dir)/src/malloc_hook_mmap_linux.h', 263 '<(tcmalloc_dir)/src/memfs_malloc.cc', 264 '<(tcmalloc_dir)/src/packed-cache-inl.h', 265 '<(tcmalloc_dir)/src/page_heap_allocator.h', 266 '<(tcmalloc_dir)/src/pagemap.h', 267 '<(tcmalloc_dir)/src/stacktrace_arm-inl.h', 268 '<(tcmalloc_dir)/src/stacktrace_config.h', 269 '<(tcmalloc_dir)/src/stacktrace_generic-inl.h', 270 '<(tcmalloc_dir)/src/stacktrace_libunwind-inl.h', 271 '<(tcmalloc_dir)/src/stacktrace_powerpc-inl.h', 272 '<(tcmalloc_dir)/src/stacktrace_win32-inl.h', 273 '<(tcmalloc_dir)/src/stacktrace_with_context.cc', 274 '<(tcmalloc_dir)/src/stacktrace_x86-inl.h', 275 '<(tcmalloc_dir)/src/tcmalloc_guard.h', 276 '<(tcmalloc_dir)/src/windows/config.h', 277 '<(tcmalloc_dir)/src/windows/gperftools/tcmalloc.h', 278 '<(tcmalloc_dir)/src/windows/get_mangled_names.cc', 279 '<(tcmalloc_dir)/src/windows/ia32_modrm_map.cc', 280 '<(tcmalloc_dir)/src/windows/ia32_opcode_map.cc', 281 '<(tcmalloc_dir)/src/windows/mingw.h', 282 '<(tcmalloc_dir)/src/windows/mini_disassembler.cc', 283 '<(tcmalloc_dir)/src/windows/mini_disassembler.h', 284 '<(tcmalloc_dir)/src/windows/mini_disassembler_types.h', 285 '<(tcmalloc_dir)/src/windows/override_functions.cc', 286 '<(tcmalloc_dir)/src/windows/patch_functions.cc', 287 '<(tcmalloc_dir)/src/windows/preamble_patcher.cc', 288 '<(tcmalloc_dir)/src/windows/preamble_patcher.h', 289 '<(tcmalloc_dir)/src/windows/preamble_patcher_with_stub.cc', 290 ], 291 'dependencies': [ 292 '../third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', 293 ], 294 'msvs_settings': { 295 # TODO(sgk): merge this with build/common.gypi settings 296 'VCLibrarianTool': { 297 'AdditionalOptions': ['/ignore:4006,4221'], 298 }, 299 'VCLinkerTool': { 300 'AdditionalOptions': ['/ignore:4006'], 301 }, 302 }, 303 'configurations': { 304 'Debug_Base': { 305 'msvs_settings': { 306 'VCCLCompilerTool': { 307 'RuntimeLibrary': '0', 308 }, 309 }, 310 'variables': { 311 # Provide a way to force disable debugallocation in Debug builds, 312 # e.g. for profiling (it's more rare to profile Debug builds, 313 # but people sometimes need to do that). 314 'disable_debugallocation%': 0, 315 }, 316 'conditions': [ 317 # TODO(phajdan.jr): Also enable on Windows. 318 ['disable_debugallocation==0 and OS!="win"', { 319 'defines': [ 320 # Use debugallocation for Debug builds to catch problems early 321 # and cleanly, http://crbug.com/30715 . 322 'TCMALLOC_FOR_DEBUGALLOCATION', 323 ], 324 }], 325 ], 326 }, 327 }, 328 'conditions': [ 329 ['OS=="linux" and clang_type_profiler==1', { 330 'dependencies': [ 331 'type_profiler_tcmalloc', 332 ], 333 # It is undoing dependencies and cflags_cc for type_profiler which 334 # build/common.gypi injects into all targets. 335 'dependencies!': [ 336 'type_profiler', 337 ], 338 'cflags_cc!': [ 339 '-fintercept-allocation-functions', 340 ], 341 }], 342 ['OS=="win"', { 343 'defines': [ 344 'PERFTOOLS_DLL_DECL=', 345 ], 346 'defines!': [ 347 # tcmalloc source files unconditionally define this, remove it from 348 # the list of defines that common.gypi defines globally. 349 'NOMINMAX', 350 ], 351 'dependencies': [ 352 'libcmt', 353 ], 354 'include_dirs': [ 355 '<(jemalloc_dir)', 356 '<(tcmalloc_dir)/src/windows', 357 ], 358 'sources!': [ 359 '<(tcmalloc_dir)/src/base/elf_mem_image.cc', 360 '<(tcmalloc_dir)/src/base/elf_mem_image.h', 361 '<(tcmalloc_dir)/src/base/linuxthreads.cc', 362 '<(tcmalloc_dir)/src/base/linuxthreads.h', 363 '<(tcmalloc_dir)/src/base/vdso_support.cc', 364 '<(tcmalloc_dir)/src/base/vdso_support.h', 365 '<(tcmalloc_dir)/src/maybe_threads.cc', 366 '<(tcmalloc_dir)/src/maybe_threads.h', 367 '<(tcmalloc_dir)/src/symbolize.h', 368 '<(tcmalloc_dir)/src/system-alloc.cc', 369 '<(tcmalloc_dir)/src/system-alloc.h', 370 371 # included by allocator_shim.cc 372 'debugallocation_shim.cc', 373 374 # heap-profiler/checker/cpuprofiler 375 '<(tcmalloc_dir)/src/base/thread_lister.c', 376 '<(tcmalloc_dir)/src/base/thread_lister.h', 377 '<(tcmalloc_dir)/src/deep-heap-profile.cc', 378 '<(tcmalloc_dir)/src/deep-heap-profile.h', 379 '<(tcmalloc_dir)/src/heap-checker-bcad.cc', 380 '<(tcmalloc_dir)/src/heap-checker.cc', 381 '<(tcmalloc_dir)/src/heap-profiler.cc', 382 '<(tcmalloc_dir)/src/heap-profile-table.cc', 383 '<(tcmalloc_dir)/src/heap-profile-table.h', 384 '<(tcmalloc_dir)/src/memory_region_map.cc', 385 '<(tcmalloc_dir)/src/memory_region_map.h', 386 '<(tcmalloc_dir)/src/profiledata.cc', 387 '<(tcmalloc_dir)/src/profiledata.h', 388 '<(tcmalloc_dir)/src/profile-handler.cc', 389 '<(tcmalloc_dir)/src/profile-handler.h', 390 '<(tcmalloc_dir)/src/profiler.cc', 391 ], 392 }], 393 ['OS=="linux" or OS=="freebsd" or OS=="solaris" or OS=="android"', { 394 'sources!': [ 395 '<(tcmalloc_dir)/src/system-alloc.h', 396 '<(tcmalloc_dir)/src/windows/port.cc', 397 '<(tcmalloc_dir)/src/windows/port.h', 398 399 # TODO(willchan): Support allocator shim later on. 400 'allocator_shim.cc', 401 402 # TODO(willchan): support jemalloc on other platforms 403 # jemalloc files 404 '<(jemalloc_dir)/jemalloc.c', 405 '<(jemalloc_dir)/jemalloc.h', 406 '<(jemalloc_dir)/ql.h', 407 '<(jemalloc_dir)/qr.h', 408 '<(jemalloc_dir)/rb.h', 409 410 ], 411 # We enable all warnings by default, but upstream disables a few. 412 # Keep "-Wno-*" flags in sync with upstream by comparing against: 413 # http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.am 414 'cflags': [ 415 '-Wno-sign-compare', 416 '-Wno-unused-result', 417 ], 418 'cflags!': [ 419 '-fvisibility=hidden', 420 ], 421 'link_settings': { 422 'ldflags': [ 423 # Don't let linker rip this symbol out, otherwise the heap&cpu 424 # profilers will not initialize properly on startup. 425 '-Wl,-uIsHeapProfilerRunning,-uProfilerStart', 426 # Do the same for heap leak checker. 427 '-Wl,-u_Z21InitialMallocHook_NewPKvj,-u_Z22InitialMallocHook_MMapPKvS0_jiiix,-u_Z22InitialMallocHook_SbrkPKvi', 428 '-Wl,-u_Z21InitialMallocHook_NewPKvm,-u_Z22InitialMallocHook_MMapPKvS0_miiil,-u_Z22InitialMallocHook_SbrkPKvl', 429 '-Wl,-u_ZN15HeapLeakChecker12IgnoreObjectEPKv,-u_ZN15HeapLeakChecker14UnIgnoreObjectEPKv', 430 ]}, 431 }], 432 # Need to distinguish a non-SDK build for Android WebView 433 # due to differences in C include files. 434 ['OS=="android" and android_webview_build==1', { 435 'defines': ['ANDROID_NON_SDK_BUILD'], 436 }], 437 [ 'use_vtable_verify==1', { 438 'cflags': [ 439 '-fvtable-verify=preinit', 440 ], 441 }], 442 [ 'linux_keep_shadow_stacks==1', { 443 'sources': [ 444 '<(tcmalloc_dir)/src/linux_shadow_stacks.cc', 445 '<(tcmalloc_dir)/src/linux_shadow_stacks.h', 446 '<(tcmalloc_dir)/src/stacktrace_shadow-inl.h', 447 ], 448 'cflags': [ 449 '-finstrument-functions', 450 ], 451 'defines': [ 452 'KEEP_SHADOW_STACKS', 453 ], 454 }], 455 [ 'linux_use_heapchecker==0', { 456 # Do not compile and link the heapchecker source. 457 'sources!': [ 458 '<(tcmalloc_dir)/src/heap-checker-bcad.cc', 459 '<(tcmalloc_dir)/src/heap-checker.cc', 460 ], 461 # Disable the heap checker in tcmalloc. 462 'defines': [ 463 'NO_HEAP_CHECK', 464 ], 465 }], 466 ['order_profiling != 0', { 467 'target_conditions' : [ 468 ['_toolset=="target"', { 469 'cflags!': [ '-finstrument-functions' ], 470 }], 471 ], 472 }], 473 ], 474 }, 475 { 476 # This library is linked in to src/base.gypi:base and allocator_unittests 477 # It can't depend on either and nothing else should depend on it - all 478 # other code should use the interfaced provided by base. 479 'target_name': 'allocator_extension_thunks', 480 'type': 'static_library', 481 'sources': [ 482 'allocator_extension_thunks.cc', 483 'allocator_extension_thunks.h', 484 ], 485 'toolsets': ['host', 'target'], 486 'include_dirs': [ 487 '../../' 488 ], 489 'conditions': [ 490 ['OS=="linux" and clang_type_profiler==1', { 491 # It is undoing dependencies and cflags_cc for type_profiler which 492 # build/common.gypi injects into all targets. 493 'dependencies!': [ 494 'type_profiler', 495 ], 496 'cflags_cc!': [ 497 '-fintercept-allocation-functions', 498 ], 499 }], 500 ], 501 }, 502 ], 503 'conditions': [ 504 ['OS=="win"', { 505 'targets': [ 506 { 507 'target_name': 'libcmt', 508 'type': 'none', 509 'actions': [ 510 { 511 'action_name': 'libcmt', 512 'inputs': [ 513 'prep_libc.py', 514 ], 515 'outputs': [ 516 '<(SHARED_INTERMEDIATE_DIR)/allocator/libcmt.lib', 517 ], 518 'action': [ 519 'python', 520 'prep_libc.py', 521 '$(VCInstallDir)lib', 522 '<(SHARED_INTERMEDIATE_DIR)/allocator', 523 '<(target_arch)', 524 ], 525 }, 526 ], 527 }, 528 { 529 'target_name': 'allocator_unittests', 530 'type': 'executable', 531 'dependencies': [ 532 'allocator', 533 'allocator_extension_thunks', 534 '../../testing/gtest.gyp:gtest', 535 ], 536 'include_dirs': [ 537 '.', 538 '<(tcmalloc_dir)/src/base', 539 '<(tcmalloc_dir)/src', 540 '../..', 541 ], 542 'sources': [ 543 'allocator_unittests.cc', 544 '../profiler/alternate_timer.cc', 545 '../profiler/alternate_timer.h', 546 ], 547 }, 548 { 549 'target_name': 'tcmalloc_unittest', 550 'type': 'executable', 551 'sources': [ 552 'tcmalloc_unittest.cc', 553 ], 554 'include_dirs': [ 555 '../..', 556 # For constants of TCMalloc. 557 '<(tcmalloc_dir)/src', 558 ], 559 'dependencies': [ 560 '../../testing/gtest.gyp:gtest', 561 '../base.gyp:base', 562 'allocator', 563 ], 564 }, 565 ], 566 }], 567 ['OS=="win" and target_arch=="ia32"', { 568 'targets': [ 569 { 570 'target_name': 'allocator_extension_thunks_win64', 571 'type': 'static_library', 572 'sources': [ 573 'allocator_extension_thunks.cc', 574 'allocator_extension_thunks.h', 575 ], 576 'toolsets': ['host', 'target'], 577 'include_dirs': [ 578 '../../' 579 ], 580 'configurations': { 581 'Common_Base': { 582 'msvs_target_platform': 'x64', 583 }, 584 }, 585 }, 586 ], 587 }], 588 ['OS=="linux" and clang_type_profiler==1', { 589 # Some targets in this section undo dependencies and cflags_cc for 590 # type_profiler which build/common.gypi injects into all targets. 591 'targets': [ 592 { 593 'target_name': 'type_profiler', 594 'type': 'static_library', 595 'dependencies!': [ 596 'type_profiler', 597 ], 598 'cflags_cc!': [ 599 '-fintercept-allocation-functions', 600 ], 601 'include_dirs': [ 602 '../..', 603 ], 604 'sources': [ 605 'type_profiler.cc', 606 'type_profiler.h', 607 'type_profiler_control.h', 608 ], 609 'toolsets': ['host', 'target'], 610 }, 611 { 612 'target_name': 'type_profiler_tcmalloc', 613 'type': 'static_library', 614 'dependencies!': [ 615 'type_profiler', 616 ], 617 'cflags_cc!': [ 618 '-fintercept-allocation-functions', 619 ], 620 'include_dirs': [ 621 '<(tcmalloc_dir)/src', 622 '../..', 623 ], 624 'sources': [ 625 'type_profiler_tcmalloc.cc', 626 'type_profiler_tcmalloc.h', 627 '<(tcmalloc_dir)/src/gperftools/type_profiler_map.h', 628 '<(tcmalloc_dir)/src/type_profiler_map.cc', 629 ], 630 }, 631 { 632 'target_name': 'type_profiler_unittests', 633 'type': 'executable', 634 'dependencies': [ 635 '../../testing/gtest.gyp:gtest', 636 '../base.gyp:base', 637 'allocator', 638 'type_profiler_tcmalloc', 639 ], 640 'include_dirs': [ 641 '../..', 642 ], 643 'sources': [ 644 'type_profiler_control.cc', 645 'type_profiler_control.h', 646 'type_profiler_unittests.cc', 647 ], 648 }, 649 { 650 'target_name': 'type_profiler_map_unittests', 651 'type': 'executable', 652 'dependencies': [ 653 '../../testing/gtest.gyp:gtest', 654 '../base.gyp:base', 655 'allocator', 656 ], 657 'dependencies!': [ 658 'type_profiler', 659 ], 660 'cflags_cc!': [ 661 '-fintercept-allocation-functions', 662 ], 663 'include_dirs': [ 664 '<(tcmalloc_dir)/src', 665 '../..', 666 ], 667 'sources': [ 668 'type_profiler_map_unittests.cc', 669 '<(tcmalloc_dir)/src/gperftools/type_profiler_map.h', 670 '<(tcmalloc_dir)/src/type_profiler_map.cc', 671 ], 672 }, 673 ], 674 }], 675 ], 676 } 677