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/config/allocator.gni") | 5 import("//build/config/allocator.gni") |
6 | 6 |
7 # Only executables and not libraries should depend on the allocator target; | 7 # Only executables and not libraries should depend on the allocator target; |
8 # only the application (the final executable) knows what allocator makes sense. | 8 # only the application (the final executable) knows what allocator makes sense. |
9 # This "allocator" meta-target will forward to the default allocator according | 9 # This "allocator" meta-target will forward to the default allocator according |
10 # to the build settings. | 10 # to the build settings. |
11 group("allocator") { | 11 group("allocator") { |
12 if (use_allocator == "tcmalloc") { | 12 if (use_allocator == "tcmalloc") { |
13 deps = [ ":tcmalloc" ] | 13 deps = [ |
| 14 ":tcmalloc", |
| 15 ] |
14 } | 16 } |
15 } | 17 } |
16 | 18 |
17 # This config and libc modification are only used on Windows. | 19 # This config and libc modification are only used on Windows. |
18 if (is_win) { | 20 if (is_win) { |
19 import("//build/config/win/visual_studio_version.gni") | 21 import("//build/config/win/visual_studio_version.gni") |
20 | 22 |
21 config("nocmt") { | 23 config("nocmt") { |
22 ldflags = [ | 24 ldflags = [ |
23 "/NODEFAULTLIB:libcmt", | 25 "/NODEFAULTLIB:libcmt", |
(...skipping 23 matching lines...) Expand all Loading... |
47 # and checked in. | 49 # and checked in. |
48 "$tcmalloc_dir/src/config.h", | 50 "$tcmalloc_dir/src/config.h", |
49 "$tcmalloc_dir/src/config_android.h", | 51 "$tcmalloc_dir/src/config_android.h", |
50 "$tcmalloc_dir/src/config_linux.h", | 52 "$tcmalloc_dir/src/config_linux.h", |
51 "$tcmalloc_dir/src/config_win.h", | 53 "$tcmalloc_dir/src/config_win.h", |
52 | 54 |
53 # tcmalloc native and forked files. | 55 # tcmalloc native and forked files. |
54 "$tcmalloc_dir/src/base/abort.cc", | 56 "$tcmalloc_dir/src/base/abort.cc", |
55 "$tcmalloc_dir/src/base/abort.h", | 57 "$tcmalloc_dir/src/base/abort.h", |
56 "$tcmalloc_dir/src/base/arm_instruction_set_select.h", | 58 "$tcmalloc_dir/src/base/arm_instruction_set_select.h", |
| 59 |
57 # We don't list dynamic_annotations.c since its copy is already | 60 # We don't list dynamic_annotations.c since its copy is already |
58 # present in the dynamic_annotations target. | 61 # present in the dynamic_annotations target. |
59 "$tcmalloc_dir/src/base/elf_mem_image.cc", | 62 "$tcmalloc_dir/src/base/elf_mem_image.cc", |
60 "$tcmalloc_dir/src/base/elf_mem_image.h", | 63 "$tcmalloc_dir/src/base/elf_mem_image.h", |
61 "$tcmalloc_dir/src/base/linuxthreads.cc", | 64 "$tcmalloc_dir/src/base/linuxthreads.cc", |
62 "$tcmalloc_dir/src/base/linuxthreads.h", | 65 "$tcmalloc_dir/src/base/linuxthreads.h", |
63 "$tcmalloc_dir/src/base/logging.cc", | 66 "$tcmalloc_dir/src/base/logging.cc", |
64 "$tcmalloc_dir/src/base/logging.h", | 67 "$tcmalloc_dir/src/base/logging.h", |
65 "$tcmalloc_dir/src/base/low_level_alloc.cc", | 68 "$tcmalloc_dir/src/base/low_level_alloc.cc", |
66 "$tcmalloc_dir/src/base/low_level_alloc.h", | 69 "$tcmalloc_dir/src/base/low_level_alloc.h", |
67 "$tcmalloc_dir/src/base/spinlock.cc", | 70 "$tcmalloc_dir/src/base/spinlock.cc", |
68 "$tcmalloc_dir/src/base/spinlock.h", | 71 "$tcmalloc_dir/src/base/spinlock.h", |
69 "$tcmalloc_dir/src/base/spinlock_internal.cc", | 72 "$tcmalloc_dir/src/base/spinlock_internal.cc", |
70 "$tcmalloc_dir/src/base/spinlock_internal.h", | 73 "$tcmalloc_dir/src/base/spinlock_internal.h", |
71 "$tcmalloc_dir/src/base/synchronization_profiling.h", | 74 "$tcmalloc_dir/src/base/synchronization_profiling.h", |
72 "$tcmalloc_dir/src/base/sysinfo.cc", | 75 "$tcmalloc_dir/src/base/sysinfo.cc", |
73 "$tcmalloc_dir/src/base/sysinfo.h", | 76 "$tcmalloc_dir/src/base/sysinfo.h", |
74 "$tcmalloc_dir/src/base/thread_lister.c", | 77 "$tcmalloc_dir/src/base/thread_lister.c", |
75 "$tcmalloc_dir/src/base/thread_lister.h", | 78 "$tcmalloc_dir/src/base/thread_lister.h", |
76 "$tcmalloc_dir/src/base/vdso_support.cc", | 79 "$tcmalloc_dir/src/base/vdso_support.cc", |
77 "$tcmalloc_dir/src/base/vdso_support.h", | 80 "$tcmalloc_dir/src/base/vdso_support.h", |
78 "$tcmalloc_dir/src/central_freelist.cc", | 81 "$tcmalloc_dir/src/central_freelist.cc", |
79 "$tcmalloc_dir/src/central_freelist.h", | 82 "$tcmalloc_dir/src/central_freelist.h", |
80 "$tcmalloc_dir/src/common.cc", | 83 "$tcmalloc_dir/src/common.cc", |
81 "$tcmalloc_dir/src/common.h", | 84 "$tcmalloc_dir/src/common.h", |
| 85 |
82 # #included by debugallocation_shim.cc | 86 # #included by debugallocation_shim.cc |
83 #"$tcmalloc_dir/src/debugallocation.cc", | 87 #"$tcmalloc_dir/src/debugallocation.cc", |
84 "$tcmalloc_dir/src/deep-heap-profile.cc", | 88 "$tcmalloc_dir/src/deep-heap-profile.cc", |
85 "$tcmalloc_dir/src/deep-heap-profile.h", | 89 "$tcmalloc_dir/src/deep-heap-profile.h", |
86 "$tcmalloc_dir/src/free_list.cc", | 90 "$tcmalloc_dir/src/free_list.cc", |
87 "$tcmalloc_dir/src/free_list.h", | 91 "$tcmalloc_dir/src/free_list.h", |
88 "$tcmalloc_dir/src/heap-profile-table.cc", | 92 "$tcmalloc_dir/src/heap-profile-table.cc", |
89 "$tcmalloc_dir/src/heap-profile-table.h", | 93 "$tcmalloc_dir/src/heap-profile-table.h", |
90 "$tcmalloc_dir/src/heap-profiler.cc", | 94 "$tcmalloc_dir/src/heap-profiler.cc", |
91 "$tcmalloc_dir/src/internal_logging.cc", | 95 "$tcmalloc_dir/src/internal_logging.cc", |
(...skipping 21 matching lines...) Expand all Loading... |
113 "$tcmalloc_dir/src/span.h", | 117 "$tcmalloc_dir/src/span.h", |
114 "$tcmalloc_dir/src/stack_trace_table.cc", | 118 "$tcmalloc_dir/src/stack_trace_table.cc", |
115 "$tcmalloc_dir/src/stack_trace_table.h", | 119 "$tcmalloc_dir/src/stack_trace_table.h", |
116 "$tcmalloc_dir/src/stacktrace.cc", | 120 "$tcmalloc_dir/src/stacktrace.cc", |
117 "$tcmalloc_dir/src/static_vars.cc", | 121 "$tcmalloc_dir/src/static_vars.cc", |
118 "$tcmalloc_dir/src/static_vars.h", | 122 "$tcmalloc_dir/src/static_vars.h", |
119 "$tcmalloc_dir/src/symbolize.cc", | 123 "$tcmalloc_dir/src/symbolize.cc", |
120 "$tcmalloc_dir/src/symbolize.h", | 124 "$tcmalloc_dir/src/symbolize.h", |
121 "$tcmalloc_dir/src/system-alloc.cc", | 125 "$tcmalloc_dir/src/system-alloc.cc", |
122 "$tcmalloc_dir/src/system-alloc.h", | 126 "$tcmalloc_dir/src/system-alloc.h", |
| 127 |
123 # #included by debugallocation_shim.cc | 128 # #included by debugallocation_shim.cc |
124 #"$tcmalloc_dir/src/tcmalloc.cc", | 129 #"$tcmalloc_dir/src/tcmalloc.cc", |
125 "$tcmalloc_dir/src/thread_cache.cc", | 130 "$tcmalloc_dir/src/thread_cache.cc", |
126 "$tcmalloc_dir/src/thread_cache.h", | 131 "$tcmalloc_dir/src/thread_cache.h", |
127 "$tcmalloc_dir/src/windows/port.cc", | 132 "$tcmalloc_dir/src/windows/port.cc", |
128 "$tcmalloc_dir/src/windows/port.h", | 133 "$tcmalloc_dir/src/windows/port.h", |
129 | |
130 "allocator_shim.cc", | 134 "allocator_shim.cc", |
131 "allocator_shim.h", | 135 "allocator_shim.h", |
132 "debugallocation_shim.cc", | 136 "debugallocation_shim.cc", |
133 | 137 |
134 # These are both #included by allocator_shim for maximal linking. | 138 # These are both #included by allocator_shim for maximal linking. |
135 #"generic_allocators.cc", | 139 #"generic_allocators.cc", |
136 #"win_allocator.cc", | 140 #"win_allocator.cc", |
137 ] | 141 ] |
138 | 142 |
139 # Disable the heap checker in tcmalloc. | 143 # Disable the heap checker in tcmalloc. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 defines += [ "PERFTOOLS_DLL_DECL=" ] | 183 defines += [ "PERFTOOLS_DLL_DECL=" ] |
180 | 184 |
181 configs -= [ | 185 configs -= [ |
182 # Tcmalloc defines this itself, and we don't want duplicate definition | 186 # Tcmalloc defines this itself, and we don't want duplicate definition |
183 # warnings. | 187 # warnings. |
184 "//build/config/win:nominmax", | 188 "//build/config/win:nominmax", |
185 ] | 189 ] |
186 | 190 |
187 public_configs = [ ":nocmt" ] | 191 public_configs = [ ":nocmt" ] |
188 | 192 |
189 deps += [ | 193 deps += [ ":prep_libc" ] |
190 ":prep_libc", | |
191 ] | |
192 } | 194 } |
193 | 195 |
194 if (is_linux || is_android) { | 196 if (is_linux || is_android) { |
195 sources -= [ | 197 sources -= [ |
196 "$tcmalloc_dir/src/system-alloc.h", | 198 "$tcmalloc_dir/src/system-alloc.h", |
197 "$tcmalloc_dir/src/windows/port.cc", | 199 "$tcmalloc_dir/src/windows/port.cc", |
198 "$tcmalloc_dir/src/windows/port.h", | 200 "$tcmalloc_dir/src/windows/port.h", |
199 | 201 |
200 # TODO(willchan): Support allocator shim later on. | 202 # TODO(willchan): Support allocator shim later on. |
201 "allocator_shim.cc", | 203 "allocator_shim.cc", |
202 ] | 204 ] |
203 | 205 |
204 # We enable all warnings by default, but upstream disables a few. | 206 # We enable all warnings by default, but upstream disables a few. |
205 # Keep "-Wno-*" flags in sync with upstream by comparing against: | 207 # Keep "-Wno-*" flags in sync with upstream by comparing against: |
206 # http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.a
m | 208 # http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.a
m |
207 cflags = [ | 209 cflags = [ |
208 "-Wno-sign-compare", | 210 "-Wno-sign-compare", |
209 "-Wno-unused-result", | 211 "-Wno-unused-result", |
210 ] | 212 ] |
211 | 213 |
212 configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] | 214 configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] |
213 | 215 |
214 ldflags = [ | 216 ldflags = [ |
215 # Don't let linker rip this symbol out, otherwise the heap&cpu | 217 # Don't let linker rip this symbol out, otherwise the heap&cpu |
216 # profilers will not initialize properly on startup. | 218 # profilers will not initialize properly on startup. |
217 "-Wl,-uIsHeapProfilerRunning,-uProfilerStart", | 219 "-Wl,-uIsHeapProfilerRunning,-uProfilerStart", |
| 220 |
218 # Do the same for heap leak checker. | 221 # Do the same for heap leak checker. |
219 "-Wl,-u_Z21InitialMallocHook_NewPKvj,-u_Z22InitialMallocHook_MMapPKvS0_j
iiix,-u_Z22InitialMallocHook_SbrkPKvi", | 222 "-Wl,-u_Z21InitialMallocHook_NewPKvj,-u_Z22InitialMallocHook_MMapPKvS0_j
iiix,-u_Z22InitialMallocHook_SbrkPKvi", |
220 "-Wl,-u_Z21InitialMallocHook_NewPKvm,-u_Z22InitialMallocHook_MMapPKvS0_m
iiil,-u_Z22InitialMallocHook_SbrkPKvl", | 223 "-Wl,-u_Z21InitialMallocHook_NewPKvm,-u_Z22InitialMallocHook_MMapPKvS0_m
iiil,-u_Z22InitialMallocHook_SbrkPKvl", |
221 "-Wl,-u_ZN15HeapLeakChecker12IgnoreObjectEPKv,-u_ZN15HeapLeakChecker14Un
IgnoreObjectEPKv", | 224 "-Wl,-u_ZN15HeapLeakChecker12IgnoreObjectEPKv,-u_ZN15HeapLeakChecker14Un
IgnoreObjectEPKv", |
222 ] | 225 ] |
223 } | 226 } |
224 | 227 |
225 # Make sure the allocation library is optimized as much as possible when | 228 # Make sure the allocation library is optimized as much as possible when |
226 # we"re in release mode. | 229 # we"re in release mode. |
227 if (!is_debug) { | 230 if (!is_debug) { |
228 configs -= [ "//build/config/compiler:optimize" ] | 231 configs -= [ "//build/config/compiler:optimize" ] |
229 configs += [ "//build/config/compiler:optimize_max" ] | 232 configs += [ "//build/config/compiler:optimize_max" ] |
230 } | 233 } |
231 | 234 |
232 deps += [ | 235 deps += [ "//base/third_party/dynamic_annotations" ] |
233 "//base/third_party/dynamic_annotations", | |
234 ] | |
235 | 236 |
236 if (is_win) { | 237 if (is_win) { |
237 ldflags = [ "/ignore:4006:4221" ] | 238 ldflags = [ "/ignore:4006:4221" ] |
238 } | 239 } |
239 } | 240 } |
240 } # !is_android | 241 } # !is_android |
241 | 242 |
242 source_set("allocator_extension_thunks") { | 243 source_set("allocator_extension_thunks") { |
243 visibility = [ "//base/*" ] | 244 visibility = [ "//base/*" ] |
244 sources = [ | 245 sources = [ |
245 "allocator_extension_thunks.cc", | 246 "allocator_extension_thunks.cc", |
246 "allocator_extension_thunks.h", | 247 "allocator_extension_thunks.h", |
247 ] | 248 ] |
248 if (is_android && !is_debug) { | 249 if (is_android && !is_debug) { |
249 configs -= [ "//build/config/compiler:optimize" ] | 250 configs -= [ "//build/config/compiler:optimize" ] |
250 configs += [ "//build/config/compiler:optimize_max" ] | 251 configs += [ "//build/config/compiler:optimize_max" ] |
251 } | 252 } |
252 } | 253 } |
OLD | NEW |