diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 21:52:07 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 21:52:07 +0000 |
commit | 349f21b8d8159af29c1138c09b169efe7b16b12e (patch) | |
tree | d12d03030fc56ae10df064cea49058335a11bc4a /third_party/tcmalloc/tcmalloc.gyp | |
parent | 1274c282519a78a38ae8c947453285e3ebe1ad37 (diff) | |
download | chromium_src-349f21b8d8159af29c1138c09b169efe7b16b12e.zip chromium_src-349f21b8d8159af29c1138c09b169efe7b16b12e.tar.gz chromium_src-349f21b8d8159af29c1138c09b169efe7b16b12e.tar.bz2 |
Linux: Make tcmalloc buildable on linux (does not enable it though).
Mostly changes to tcmalloc.gyp to get tcmalloc building for linux.
Supports the full google-perftools tool suite (heapchecker, heapprofiler, cpuprofiler).
Adds in a fix for malloc_hook.cc that is not upstream yet. Forked malloc_hook.cc.
Forces linking in a symbol that is not used except by a static initializer which was getting stripped out, thereby getting heap profiler to work even when statically linked.
TODO: integrate with allocator_shim
TODO: support jemalloc
TODO: support debugallocation
Review URL: http://codereview.chromium.org/173017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23761 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/tcmalloc/tcmalloc.gyp')
-rw-r--r-- | third_party/tcmalloc/tcmalloc.gyp | 100 |
1 files changed, 99 insertions, 1 deletions
diff --git a/third_party/tcmalloc/tcmalloc.gyp b/third_party/tcmalloc/tcmalloc.gyp index 99c0e13..32b6555 100644 --- a/third_party/tcmalloc/tcmalloc.gyp +++ b/third_party/tcmalloc/tcmalloc.gyp @@ -16,9 +16,9 @@ ], 'include_dirs': [ '.', - 'tcmalloc/src/windows', 'tcmalloc/src/base', 'tcmalloc/src', + '../..', ], 'direct_dependent_settings': { 'configurations': { @@ -49,6 +49,10 @@ }, }, 'sources': [ + 'config.h', + 'config_linux.h', + 'config_win.h', + # tcmalloc files 'tcmalloc/src/base/dynamic_annotations.cc', 'tcmalloc/src/base/dynamic_annotations.h', @@ -72,6 +76,8 @@ 'tcmalloc/src/malloc_extension.cc', 'tcmalloc/src/malloc_hook.cc', 'tcmalloc/src/malloc_hook-inl.h', + 'tcmalloc/src/page_heap.cc', + 'tcmalloc/src/page_heap.h', 'tcmalloc/src/port.h', 'tcmalloc/src/sampler.cc', 'tcmalloc/src/sampler.h', @@ -86,14 +92,40 @@ 'tcmalloc/src/thread_cache.cc', 'tcmalloc/src/thread_cache.h', + # non-windows + 'tcmalloc/src/base/linuxthreads.cc', + 'tcmalloc/src/base/linuxthreads.h', + 'tcmalloc/src/base/vdso_support.cc', + 'tcmalloc/src/base/vdso_support.h', + 'tcmalloc/src/google/tcmalloc.h', + 'tcmalloc/src/maybe_threads.cc', + 'tcmalloc/src/maybe_threads.h', + 'tcmalloc/src/system-alloc.cc', + 'tcmalloc/src/system-alloc.h', + 'tcmalloc/src/tcmalloc.cc', + + # heap-profiler/checker + 'tcmalloc/src/base/thread_lister.c', + 'tcmalloc/src/base/thread_lister.h', + 'tcmalloc/src/heap-checker-bcad.cc', + 'tcmalloc/src/heap-checker.cc', + 'tcmalloc/src/heap-profiler.cc', + 'tcmalloc/src/memory_region_map.cc', + 'tcmalloc/src/memory_region_map.h', + 'tcmalloc/src/raw_printer.cc', + 'tcmalloc/src/raw_printer.h', + # tcmalloc forked files 'allocator_shim.cc', + 'generic_allocators.cc', 'page_heap.cc', 'port.cc', 'system-alloc.h', 'tcmalloc.cc', 'win_allocator.cc', + 'malloc_hook.cc', + # jemalloc files 'jemalloc/jemalloc.c', 'jemalloc/jemalloc.h', @@ -103,6 +135,7 @@ ], # sources! means that these are not compiled directly. 'sources!': [ + 'generic_allocators.cc', 'tcmalloc.cc', 'win_allocator.cc', ], @@ -126,6 +159,71 @@ }, }, }, + 'conditions': [ + ['OS=="win"', { + 'include_dirs': [ + 'tcmalloc/src/windows', + ], + 'sources!': [ + 'tcmalloc/src/base/linuxthreads.cc', + 'tcmalloc/src/base/linuxthreads.h', + 'tcmalloc/src/base/vdso_support.cc', + 'tcmalloc/src/base/vdso_support.h', + 'tcmalloc/src/maybe_threads.cc', + 'tcmalloc/src/maybe_threads.h', + 'tcmalloc/src/system-alloc.cc', + 'tcmalloc/src/system-alloc.h', + + # use forked version in windows + 'tcmalloc/src/tcmalloc.cc', + 'tcmalloc/src/page_heap.cc', + 'tcmalloc/src/page_heap.h', + + # heap-profiler/checker + 'tcmalloc/src/base/thread_lister.c', + 'tcmalloc/src/base/thread_lister.h', + 'tcmalloc/src/heap-checker-bcad.cc', + 'tcmalloc/src/heap-checker.cc', + 'tcmalloc/src/heap-profiler.cc', + 'tcmalloc/src/memory_region_map.cc', + 'tcmalloc/src/memory_region_map.h', + 'tcmalloc/src/raw_printer.cc', + 'tcmalloc/src/raw_printer.h', + + # don't use linux forked versions + 'malloc_hook.cc', + ], + }], + ['OS=="linux"', { + 'sources!': [ + 'page_heap.cc', + 'port.cc', + 'system-alloc.h', + 'win_allocator.cc', + + # TODO(willchan): Support allocator shim later on. + 'allocator_shim.cc', + + # TODO(willchan): support jemalloc on other platforms + # jemalloc files + 'jemalloc/jemalloc.c', + 'jemalloc/jemalloc.h', + 'jemalloc/ql.h', + 'jemalloc/qr.h', + 'jemalloc/rb.h', + + # TODO(willchan): Unfork linux. + 'tcmalloc/src/malloc_hook.cc', + ], + 'link_settings': { + 'ldflags': [ + # Don't let linker rip this symbol out, otherwise the heap + # profiler will not initialize properly on startup. + '-Wl,-uIsHeapProfilerRunning', + ], + }, + }], + ], }, { 'target_name': 'libcmt', |