Chromium Code Reviews| 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 static_library("allocator_extension_thunks") { | 5 import("//build/config/allocator.gni") |
| 6 | |
| 7 # Only executables and not libraries should depend on the allocator target; | |
| 8 # only the application (the final executable) knows what allocator makes sense. | |
| 9 # This "allocator" meta-target will forward to the default allocator according | |
| 10 # to the build settings. | |
| 11 group("allocator") { | |
| 12 if (use_allocator == "tcmalloc") { | |
| 13 deps = [ ":tcmalloc" ] | |
| 14 } | |
| 15 } | |
| 16 | |
| 17 if (!is_android) { | |
| 18 # tcmalloc currently won't compile on Android. | |
| 19 source_set("tcmalloc") { | |
| 20 tcmalloc_dir = "//third_party/tcmalloc/chromium" | |
| 21 | |
| 22 sources = [ | |
| 23 # Generated for our configuration from tcmalloc"s build | |
| 24 # and checked in. | |
| 25 "$tcmalloc_dir/src/config.h", | |
| 26 "$tcmalloc_dir/src/config_android.h", | |
| 27 "$tcmalloc_dir/src/config_linux.h", | |
| 28 "$tcmalloc_dir/src/config_win.h", | |
| 29 | |
| 30 # tcmalloc native and forked files. | |
| 31 "$tcmalloc_dir/src/base/abort.cc", | |
| 32 "$tcmalloc_dir/src/base/abort.h", | |
| 33 "$tcmalloc_dir/src/base/arm_instruction_set_select.h", | |
| 34 # We don"t list dynamic_annotations.c since its copy is already | |
|
scottmg
2014/05/15 23:37:32
another " here
| |
| 35 # present in the dynamic_annotations target. | |
| 36 "$tcmalloc_dir/src/base/elf_mem_image.cc", | |
| 37 "$tcmalloc_dir/src/base/linuxthreads.cc", | |
| 38 "$tcmalloc_dir/src/base/linuxthreads.h", | |
| 39 "$tcmalloc_dir/src/base/logging.cc", | |
| 40 "$tcmalloc_dir/src/base/logging.h", | |
| 41 "$tcmalloc_dir/src/base/low_level_alloc.cc", | |
| 42 "$tcmalloc_dir/src/base/low_level_alloc.h", | |
| 43 "$tcmalloc_dir/src/base/spinlock.cc", | |
| 44 "$tcmalloc_dir/src/base/spinlock.h", | |
| 45 "$tcmalloc_dir/src/base/spinlock_internal.cc", | |
| 46 "$tcmalloc_dir/src/base/spinlock_internal.h", | |
| 47 "$tcmalloc_dir/src/base/synchronization_profiling.h", | |
| 48 "$tcmalloc_dir/src/base/sysinfo.cc", | |
| 49 "$tcmalloc_dir/src/base/sysinfo.h", | |
| 50 "$tcmalloc_dir/src/base/thread_lister.c", | |
| 51 "$tcmalloc_dir/src/base/thread_lister.h", | |
| 52 "$tcmalloc_dir/src/base/vdso_support.cc", | |
| 53 "$tcmalloc_dir/src/base/vdso_support.h", | |
| 54 "$tcmalloc_dir/src/central_freelist.cc", | |
| 55 "$tcmalloc_dir/src/central_freelist.h", | |
| 56 "$tcmalloc_dir/src/common.cc", | |
| 57 "$tcmalloc_dir/src/common.h", | |
| 58 # #included by debugallocation_shim.cc | |
| 59 #"$tcmalloc_dir/src/debugallocation.cc", | |
| 60 "$tcmalloc_dir/src/deep-heap-profile.cc", | |
| 61 "$tcmalloc_dir/src/deep-heap-profile.h", | |
| 62 "$tcmalloc_dir/src/free_list.cc", | |
| 63 "$tcmalloc_dir/src/free_list.h", | |
| 64 "$tcmalloc_dir/src/heap-profile-table.cc", | |
| 65 "$tcmalloc_dir/src/heap-profile-table.h", | |
| 66 "$tcmalloc_dir/src/heap-profiler.cc", | |
| 67 "$tcmalloc_dir/src/internal_logging.cc", | |
| 68 "$tcmalloc_dir/src/internal_logging.h", | |
| 69 "$tcmalloc_dir/src/linked_list.h", | |
| 70 "$tcmalloc_dir/src/malloc_extension.cc", | |
| 71 "$tcmalloc_dir/src/malloc_hook-inl.h", | |
| 72 "$tcmalloc_dir/src/malloc_hook.cc", | |
| 73 "$tcmalloc_dir/src/maybe_threads.cc", | |
| 74 "$tcmalloc_dir/src/maybe_threads.h", | |
| 75 "$tcmalloc_dir/src/memory_region_map.cc", | |
| 76 "$tcmalloc_dir/src/memory_region_map.h", | |
| 77 "$tcmalloc_dir/src/page_heap.cc", | |
| 78 "$tcmalloc_dir/src/page_heap.h", | |
| 79 "$tcmalloc_dir/src/profile-handler.cc", | |
| 80 "$tcmalloc_dir/src/profile-handler.h", | |
| 81 "$tcmalloc_dir/src/profiledata.cc", | |
| 82 "$tcmalloc_dir/src/profiledata.h", | |
| 83 "$tcmalloc_dir/src/profiler.cc", | |
| 84 "$tcmalloc_dir/src/raw_printer.cc", | |
| 85 "$tcmalloc_dir/src/raw_printer.h", | |
| 86 "$tcmalloc_dir/src/sampler.cc", | |
| 87 "$tcmalloc_dir/src/sampler.h", | |
| 88 "$tcmalloc_dir/src/span.cc", | |
| 89 "$tcmalloc_dir/src/span.h", | |
| 90 "$tcmalloc_dir/src/stack_trace_table.cc", | |
| 91 "$tcmalloc_dir/src/stack_trace_table.h", | |
| 92 "$tcmalloc_dir/src/stacktrace.cc", | |
| 93 "$tcmalloc_dir/src/static_vars.cc", | |
| 94 "$tcmalloc_dir/src/static_vars.h", | |
| 95 "$tcmalloc_dir/src/symbolize.cc", | |
| 96 "$tcmalloc_dir/src/symbolize.h", | |
| 97 "$tcmalloc_dir/src/system-alloc.cc", | |
| 98 "$tcmalloc_dir/src/system-alloc.h", | |
| 99 # #included by debugallocation_shim.cc | |
| 100 #"$tcmalloc_dir/src/tcmalloc.cc", | |
| 101 "$tcmalloc_dir/src/thread_cache.cc", | |
| 102 "$tcmalloc_dir/src/thread_cache.h", | |
| 103 "$tcmalloc_dir/src/windows/port.cc", | |
| 104 "$tcmalloc_dir/src/windows/port.h", | |
| 105 | |
| 106 "allocator_shim.cc", | |
| 107 "allocator_shim.h", | |
| 108 "debugallocation_shim.cc", | |
| 109 | |
| 110 # These are both #included by allocator_shim for maximal linking. | |
| 111 #"generic_allocators.cc", | |
| 112 #"win_allocator.cc", | |
| 113 ] | |
| 114 | |
| 115 # Disable the heap checker in tcmalloc. | |
| 116 defines = [ "NO_HEAP_CHECK" ] | |
| 117 | |
| 118 include_dirs = [ | |
| 119 ".", | |
| 120 "$tcmalloc_dir/src/base", | |
| 121 "$tcmalloc_dir/src", | |
| 122 ] | |
| 123 | |
| 124 configs -= [ "//build/config/compiler:chromium_code" ] | |
| 125 configs += [ "//build/config/compiler:no_chromium_code" ] | |
| 126 | |
| 127 if (is_win) { | |
| 128 sources -= [ | |
| 129 "$tcmalloc_dir/src/base/elf_mem_image.cc", | |
| 130 "$tcmalloc_dir/src/base/elf_mem_image.h", | |
| 131 "$tcmalloc_dir/src/base/linuxthreads.cc", | |
| 132 "$tcmalloc_dir/src/base/linuxthreads.h", | |
| 133 "$tcmalloc_dir/src/base/vdso_support.cc", | |
| 134 "$tcmalloc_dir/src/base/vdso_support.h", | |
| 135 "$tcmalloc_dir/src/maybe_threads.cc", | |
| 136 "$tcmalloc_dir/src/maybe_threads.h", | |
| 137 "$tcmalloc_dir/src/symbolize.h", | |
| 138 "$tcmalloc_dir/src/system-alloc.cc", | |
| 139 "$tcmalloc_dir/src/system-alloc.h", | |
| 140 | |
| 141 # included by allocator_shim.cc | |
| 142 "debugallocation_shim.cc", | |
| 143 | |
| 144 # cpuprofiler | |
| 145 "$tcmalloc_dir/src/base/thread_lister.c", | |
| 146 "$tcmalloc_dir/src/base/thread_lister.h", | |
| 147 "$tcmalloc_dir/src/profiledata.cc", | |
| 148 "$tcmalloc_dir/src/profiledata.h", | |
| 149 "$tcmalloc_dir/src/profile-handler.cc", | |
| 150 "$tcmalloc_dir/src/profile-handler.h", | |
| 151 "$tcmalloc_dir/src/profiler.cc", | |
| 152 ] | |
| 153 defines = [ "PERFTOOLS_DLL_DECL=" ] | |
| 154 } | |
| 155 if (is_linux || is_android) { | |
| 156 sources -= [ | |
| 157 "$tcmalloc_dir/src/system-alloc.h", | |
| 158 "$tcmalloc_dir/src/windows/port.cc", | |
| 159 "$tcmalloc_dir/src/windows/port.h", | |
| 160 | |
| 161 # TODO(willchan): Support allocator shim later on. | |
| 162 "allocator_shim.cc", | |
| 163 ] | |
| 164 | |
| 165 # We enable all warnings by default, but upstream disables a few. | |
| 166 # Keep "-Wno-*" flags in sync with upstream by comparing against: | |
| 167 # http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.a m | |
| 168 cflags = [ | |
| 169 "-Wno-sign-compare", | |
| 170 "-Wno-unused-result", | |
| 171 ] | |
| 172 | |
| 173 configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] | |
| 174 | |
| 175 ldflags = [ | |
| 176 # Don"t let linker rip this symbol out, otherwise the heap&cpu | |
|
scottmg
2014/05/15 23:37:32
"
| |
| 177 # profilers will not initialize properly on startup. | |
| 178 "-Wl,-uIsHeapProfilerRunning,-uProfilerStart", | |
| 179 # Do the same for heap leak checker. | |
| 180 "-Wl,-u_Z21InitialMallocHook_NewPKvj,-u_Z22InitialMallocHook_MMapPKvS0_j iiix,-u_Z22InitialMallocHook_SbrkPKvi", | |
| 181 "-Wl,-u_Z21InitialMallocHook_NewPKvm,-u_Z22InitialMallocHook_MMapPKvS0_m iiil,-u_Z22InitialMallocHook_SbrkPKvl", | |
| 182 "-Wl,-u_ZN15HeapLeakChecker12IgnoreObjectEPKv,-u_ZN15HeapLeakChecker14Un IgnoreObjectEPKv", | |
| 183 ] | |
| 184 } | |
| 185 | |
| 186 # Make sure the allocation library is optimized as much as possible when | |
| 187 # we"re in release mode. | |
| 188 if (!is_debug) { | |
| 189 configs -= [ "//build/config/compiler:optimize" ] | |
| 190 configs += [ "//build/config/compiler:optimize_max" ] | |
| 191 } | |
| 192 | |
| 193 deps = [ | |
| 194 "//base/third_party/dynamic_annotations", | |
| 195 ] | |
| 196 | |
| 197 if (is_win) { | |
| 198 ldflags = [ "/ignore:4006:4221" ] | |
| 199 } | |
| 200 } | |
| 201 } # !is_android | |
| 202 | |
| 203 source_set("allocator_extension_thunks") { | |
| 6 visibility = "//base/*" | 204 visibility = "//base/*" |
| 7 sources = [ | 205 sources = [ |
| 8 "allocator_extension_thunks.cc", | 206 "allocator_extension_thunks.cc", |
| 9 "allocator_extension_thunks.h", | 207 "allocator_extension_thunks.h", |
| 10 ] | 208 ] |
| 11 } | 209 } |
| OLD | NEW |