blob: 01f42b751d6b6294614cf20b5a3e2f83d13855af [file] [log] [blame]
Colin Crossbaa48992016-07-13 11:15:21 -07001// ==============================================================
2// libc_malloc_debug_backtrace.a
3// ==============================================================
4// Used by libmemunreachable
5cc_library_static {
6
7 name: "libc_malloc_debug_backtrace",
8
9 srcs: [
10 "backtrace.cpp",
11 "MapData.cpp",
12 ],
13
14 stl: "libc++_static",
15
Elliott Hughesd50a1de2018-02-05 17:30:57 -080016 whole_static_libs: [
Christopher Ferris93bdd6a2018-04-05 11:12:38 -070017 "libbase",
Elliott Hughesd50a1de2018-02-05 17:30:57 -080018 "libasync_safe",
19 "libdemangle",
20 ],
Colin Crossbaa48992016-07-13 11:15:21 -070021
22 include_dirs: ["bionic/libc"],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070023
Colin Crossbaa48992016-07-13 11:15:21 -070024 export_include_dirs: ["."],
25
26 sanitize: {
27 never: true,
28 },
29 native_coverage: false,
30
31 // -Wno-error=format-zero-length needed for gcc to compile.
32 cflags: [
33 "-Wall",
34 "-Werror",
35 "-Wno-error=format-zero-length",
36 ],
Colin Crossbaa48992016-07-13 11:15:21 -070037}
38
39// ==============================================================
40// libc_malloc_debug.so
41// ==============================================================
42cc_library {
43 name: "libc_malloc_debug",
44
45 srcs: [
Colin Crossbaa48992016-07-13 11:15:21 -070046 "Config.cpp",
47 "DebugData.cpp",
48 "debug_disable.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070049 "GuardData.cpp",
50 "malloc_debug.cpp",
Christopher Ferris4da25032018-03-07 13:38:48 -080051 "PointerData.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070052 "RecordData.cpp",
Christopher Ferris93bdd6a2018-04-05 11:12:38 -070053 "UnwindBacktrace.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070054 ],
55
56 stl: "libc++_static",
57
58 // Only need this for arm since libc++ uses its own unwind code that
59 // doesn't mix with the other default unwind code.
60 arch: {
61 arm: {
62 static_libs: ["libunwind_llvm"],
63 },
64 },
65
Chih-Hung Hsieh0e879402018-04-16 10:50:52 -070066 // Clang lld link flags do not work with special link rules
67 // for libunwind_llvm yet. Linked aosp_arm-eng image failed to
68 // boot up in the emulator. http://b/78118944.
69 use_clang_lld: false,
70
Colin Crossbaa48992016-07-13 11:15:21 -070071 static_libs: [
Christopher Ferris7a3681e2017-04-24 17:48:32 -070072 "libasync_safe",
Colin Crossbaa48992016-07-13 11:15:21 -070073 "libbase",
Christopher Ferris93bdd6a2018-04-05 11:12:38 -070074 "libdemangle",
Colin Crossbaa48992016-07-13 11:15:21 -070075 "libc_malloc_debug_backtrace",
Colin Crossbaa48992016-07-13 11:15:21 -070076 ],
77
Christopher Ferris93bdd6a2018-04-05 11:12:38 -070078 shared_libs: [
79 "libunwindstack",
80 ],
81
Colin Crossbaa48992016-07-13 11:15:21 -070082 multilib: {
83 lib32: {
84 version_script: "exported32.map",
85 },
86 lib64: {
87 version_script: "exported64.map",
88 },
89 },
90 allow_undefined_symbols: true,
91 include_dirs: ["bionic/libc"],
92
93 sanitize: {
94 never: true,
95 },
96 native_coverage: false,
97
98 // -Wno-error=format-zero-length needed for gcc to compile.
99 cflags: [
100 "-Wall",
101 "-Werror",
102 "-fno-stack-protector",
103 "-Wno-error=format-zero-length",
Christopher Ferris4da25032018-03-07 13:38:48 -0800104 "-Wthread-safety",
Colin Crossbaa48992016-07-13 11:15:21 -0700105 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700106}
107
108// ==============================================================
109// Unit Tests
110// ==============================================================
111cc_test {
Colin Crossbaa48992016-07-13 11:15:21 -0700112 name: "malloc_debug_unit_tests",
Colin Crossbaa48992016-07-13 11:15:21 -0700113
114 srcs: [
115 "tests/backtrace_fake.cpp",
116 "tests/log_fake.cpp",
117 "tests/libc_fake.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -0700118 "tests/malloc_debug_config_tests.cpp",
119 "tests/malloc_debug_unit_tests.cpp",
120 ],
121
Colin Crossbaa48992016-07-13 11:15:21 -0700122 local_include_dirs: ["tests"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800123 include_dirs: [
124 "bionic/libc",
125 "bionic/libc/async_safe/include",
126 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700127
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700128 static_libs: [
129 "libc_malloc_debug",
130 "libdemangle",
131 ],
132
133 shared_libs: [
134 "libbase",
135 "libunwindstack",
136 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700137
138 cflags: [
139 "-Wall",
140 "-Werror",
141 "-Wno-error=format-zero-length",
Christopher Ferris2e1a40a2018-06-13 10:46:34 -0700142 "-O0",
Colin Crossbaa48992016-07-13 11:15:21 -0700143 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700144}
Christopher Ferris97b47472018-07-10 14:45:24 -0700145
146// ==============================================================
147// System Tests
148// ==============================================================
149cc_test {
150 name: "malloc_debug_system_tests",
151
152 srcs: [
153 "tests/malloc_debug_system_tests.cpp",
154 ],
155
156 shared_libs: [
157 "libbase",
158 "liblog",
159 "libunwindstack",
160 ],
161
162 cflags: [
163 "-Wall",
164 "-Werror",
165 "-O0",
166 ],
167}