2016-09-23 22:24:54 +00:00
|
|
|
# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
|
|
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
2017-08-15 04:54:34 +00:00
|
|
|
import("tcmalloc_sources.gni")
|
|
|
|
|
2016-09-23 22:24:54 +00:00
|
|
|
config("internal_config") {
|
|
|
|
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
|
|
|
cflags = [
|
|
|
|
"-Wall",
|
|
|
|
"-Wextra",
|
2017-12-02 06:19:33 +00:00
|
|
|
"-Wno-format",
|
2016-09-23 22:24:54 +00:00
|
|
|
"-Wno-missing-field-initializers",
|
|
|
|
"-Wno-sign-compare",
|
|
|
|
"-Wno-type-limits",
|
|
|
|
"-Wno-unused-result",
|
|
|
|
"-Wno-unused-parameter",
|
|
|
|
"-Wno-unused-function",
|
|
|
|
"-Wno-vla",
|
|
|
|
"-g3",
|
|
|
|
"-ggdb3",
|
|
|
|
"-fstack-protector",
|
|
|
|
"-Wa,--noexecstack",
|
|
|
|
"-fno-omit-frame-pointer",
|
|
|
|
"-fno-builtin-malloc",
|
|
|
|
"-fno-builtin-free",
|
|
|
|
"-fno-builtin-realloc",
|
|
|
|
"-fno-builtin-calloc",
|
|
|
|
"-fno-builtin-cfree",
|
|
|
|
"-fno-builtin-memalign",
|
|
|
|
"-fno-builtin-posix_memalign",
|
|
|
|
"-fno-builtin-valloc",
|
|
|
|
"-fno-builtin-pvalloc",
|
2018-05-15 21:07:57 +00:00
|
|
|
"-fsized-deallocation",
|
|
|
|
"-faligned-new",
|
2016-09-23 22:24:54 +00:00
|
|
|
]
|
|
|
|
if (is_clang) {
|
2016-10-26 15:50:54 +00:00
|
|
|
cflags += [ "-Wno-unused-const-variable" ]
|
2016-09-23 22:24:54 +00:00
|
|
|
}
|
2017-05-22 20:15:31 +00:00
|
|
|
if (current_cpu == "arm" && !is_clang) {
|
|
|
|
cflags += [ "-Wno-psabi" ]
|
|
|
|
}
|
2016-09-23 22:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
config("link_config") {
|
|
|
|
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
|
|
|
ldflags = [
|
|
|
|
# Don't let linker rip this symbol out, otherwise the heap&cpu
|
|
|
|
# profilers will not initialize properly on startup.
|
|
|
|
"-Wl,-uIsHeapProfilerRunning,-uProfilerStart",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
source_set("dynamic_annotations") {
|
2017-12-02 06:19:33 +00:00
|
|
|
configs -= [
|
|
|
|
"//build/config/compiler:chromium_code",
|
|
|
|
"//build/config/compiler:clang_stackrealign",
|
|
|
|
]
|
2016-09-23 22:24:54 +00:00
|
|
|
configs += [ ":internal_config" ]
|
|
|
|
|
|
|
|
include_dirs = [
|
|
|
|
"include",
|
|
|
|
"gperftools/src/base",
|
|
|
|
"gperftools/src",
|
|
|
|
]
|
|
|
|
|
|
|
|
sources = [
|
|
|
|
"gperftools/src/base/dynamic_annotations.c",
|
|
|
|
"gperftools/src/base/dynamic_annotations.h",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
source_set("tcmalloc") {
|
2017-12-02 06:19:33 +00:00
|
|
|
configs -= [
|
|
|
|
"//build/config/compiler:chromium_code",
|
|
|
|
"//build/config/compiler:clang_stackrealign",
|
2018-03-08 18:09:28 +00:00
|
|
|
"//build/config/compiler:compiler_arm_thumb",
|
2017-12-02 06:19:33 +00:00
|
|
|
]
|
2016-09-23 22:24:54 +00:00
|
|
|
configs += [ ":internal_config" ]
|
|
|
|
|
2016-10-26 15:50:54 +00:00
|
|
|
public_configs = [ ":link_config" ]
|
2016-09-23 22:24:54 +00:00
|
|
|
|
|
|
|
deps = [
|
2016-10-26 15:50:54 +00:00
|
|
|
":dynamic_annotations",
|
2016-09-23 22:24:54 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
include_dirs = [
|
|
|
|
"include",
|
|
|
|
"gperftools/src/base",
|
|
|
|
"gperftools/src",
|
|
|
|
]
|
|
|
|
|
|
|
|
# Disable the heap checker in tcmalloc.
|
|
|
|
defines = [
|
|
|
|
"ENABLE_EMERGENCY_MALLOC",
|
|
|
|
"NO_HEAP_CHECK",
|
2016-10-26 15:50:54 +00:00
|
|
|
|
2016-09-23 22:24:54 +00:00
|
|
|
# Disable debug even in a Dart Debug build. It is too slow.
|
|
|
|
"NDEBUG",
|
|
|
|
]
|
|
|
|
|
|
|
|
if (is_product) {
|
2017-06-30 15:09:35 +00:00
|
|
|
# Disable stack sampling for heap profiling in Product builds.
|
2016-10-26 15:50:54 +00:00
|
|
|
defines += [ "NO_TCMALLOC_SAMPLES" ]
|
2017-06-30 15:09:35 +00:00
|
|
|
|
|
|
|
# To override the C library functions, we can't hide symbols.
|
|
|
|
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
|
2016-09-23 22:24:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cflags = [
|
|
|
|
"-Wnon-virtual-dtor",
|
|
|
|
"-Woverloaded-virtual",
|
|
|
|
"-fno-rtti",
|
|
|
|
"-fpermissive",
|
|
|
|
]
|
|
|
|
|
2017-04-06 22:03:25 +00:00
|
|
|
if (!is_clang) {
|
2016-10-26 15:50:54 +00:00
|
|
|
cflags += [ "-Wno-format" ]
|
2016-10-07 16:55:58 +00:00
|
|
|
}
|
|
|
|
|
2016-09-23 22:24:54 +00:00
|
|
|
set_sources_assignment_filter([
|
2016-10-26 15:50:54 +00:00
|
|
|
# No debug allocator.
|
|
|
|
"gperftools/src/debugallocation.cc",
|
|
|
|
|
|
|
|
# Not needed when using emergency malloc.
|
|
|
|
"gperftools/src/fake_stacktrace_scope.cc",
|
|
|
|
|
|
|
|
# Not using the cpuprofiler
|
|
|
|
"gperftools/src/base/thread_lister.c",
|
|
|
|
"gperftools/src/base/thread_lister.h",
|
|
|
|
"gperftools/src/profile-handler.cc",
|
|
|
|
"gperftools/src/profile-handler.h",
|
|
|
|
"gperftools/src/profiledata.cc",
|
|
|
|
"gperftools/src/profiledata.h",
|
|
|
|
"gperftools/src/profiler.cc",
|
|
|
|
])
|
2016-09-23 22:24:54 +00:00
|
|
|
|
2017-08-15 04:54:34 +00:00
|
|
|
sources = tcmalloc_sources
|
2016-09-23 22:24:54 +00:00
|
|
|
}
|