blob: 41c4f9d07e431582a8f39bb4f4162cc0ff92a7d1 [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 {
Colin Crossbaa48992016-07-13 11:15:21 -07006 name: "libc_malloc_debug_backtrace",
Colin Crossb9667b52019-05-17 13:45:18 -07007 vendor_available: true,
Colin Crossbaa48992016-07-13 11:15:21 -07008
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",
Elliott Hughesd50a1de2018-02-05 17:30:57 -080019 ],
Colin Crossbaa48992016-07-13 11:15:21 -070020
21 include_dirs: ["bionic/libc"],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070022
Colin Crossbaa48992016-07-13 11:15:21 -070023 export_include_dirs: ["."],
24
25 sanitize: {
26 never: true,
27 },
28 native_coverage: false,
29
Dan Albert4ea19212019-07-23 13:31:14 -070030 target: {
31 android: {
32 static_libs: ["libc++demangle"],
33 },
34 },
35
Colin Crossbaa48992016-07-13 11:15:21 -070036 // -Wno-error=format-zero-length needed for gcc to compile.
37 cflags: [
38 "-Wall",
39 "-Werror",
40 "-Wno-error=format-zero-length",
41 ],
Colin Crossbaa48992016-07-13 11:15:21 -070042}
43
44// ==============================================================
45// libc_malloc_debug.so
46// ==============================================================
47cc_library {
48 name: "libc_malloc_debug",
49
50 srcs: [
Colin Crossbaa48992016-07-13 11:15:21 -070051 "Config.cpp",
52 "DebugData.cpp",
53 "debug_disable.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070054 "GuardData.cpp",
55 "malloc_debug.cpp",
Christopher Ferris4da25032018-03-07 13:38:48 -080056 "PointerData.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070057 "RecordData.cpp",
Christopher Ferris93bdd6a2018-04-05 11:12:38 -070058 "UnwindBacktrace.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070059 ],
60
61 stl: "libc++_static",
62
63 // Only need this for arm since libc++ uses its own unwind code that
64 // doesn't mix with the other default unwind code.
65 arch: {
66 arm: {
67 static_libs: ["libunwind_llvm"],
68 },
69 },
70
71 static_libs: [
Christopher Ferris7a3681e2017-04-24 17:48:32 -070072 "libasync_safe",
Colin Crossbaa48992016-07-13 11:15:21 -070073 "libbase",
74 "libc_malloc_debug_backtrace",
Colin Crossbaa48992016-07-13 11:15:21 -070075 ],
76
Christopher Ferris93bdd6a2018-04-05 11:12:38 -070077 shared_libs: [
78 "libunwindstack",
79 ],
80
Colin Crossbaa48992016-07-13 11:15:21 -070081 multilib: {
82 lib32: {
83 version_script: "exported32.map",
84 },
85 lib64: {
86 version_script: "exported64.map",
87 },
88 },
89 allow_undefined_symbols: true,
90 include_dirs: ["bionic/libc"],
91
92 sanitize: {
93 never: true,
94 },
95 native_coverage: false,
96
97 // -Wno-error=format-zero-length needed for gcc to compile.
98 cflags: [
99 "-Wall",
100 "-Werror",
101 "-fno-stack-protector",
102 "-Wno-error=format-zero-length",
Christopher Ferris4da25032018-03-07 13:38:48 -0800103 "-Wthread-safety",
Colin Crossbaa48992016-07-13 11:15:21 -0700104 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700105}
106
107// ==============================================================
108// Unit Tests
109// ==============================================================
110cc_test {
Colin Crossbaa48992016-07-13 11:15:21 -0700111 name: "malloc_debug_unit_tests",
Colin Crossbaa48992016-07-13 11:15:21 -0700112
113 srcs: [
114 "tests/backtrace_fake.cpp",
115 "tests/log_fake.cpp",
116 "tests/libc_fake.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -0700117 "tests/malloc_debug_config_tests.cpp",
118 "tests/malloc_debug_unit_tests.cpp",
119 ],
120
Colin Crossbaa48992016-07-13 11:15:21 -0700121 local_include_dirs: ["tests"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800122 include_dirs: [
123 "bionic/libc",
124 "bionic/libc/async_safe/include",
125 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700126
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700127 header_libs: [
128 "bionic_libc_platform_headers",
129 ],
130
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700131 static_libs: [
132 "libc_malloc_debug",
Christopher Ferris6c619a02019-03-01 17:59:51 -0800133 "libtinyxml2",
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700134 ],
135
136 shared_libs: [
137 "libbase",
138 "libunwindstack",
139 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700140
141 cflags: [
142 "-Wall",
143 "-Werror",
144 "-Wno-error=format-zero-length",
Christopher Ferris2e1a40a2018-06-13 10:46:34 -0700145 "-O0",
Colin Crossbaa48992016-07-13 11:15:21 -0700146 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700147}
Christopher Ferris97b47472018-07-10 14:45:24 -0700148
149// ==============================================================
150// System Tests
151// ==============================================================
152cc_test {
153 name: "malloc_debug_system_tests",
154
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700155 include_dirs: [
156 "bionic/libc",
157 ],
158
159 header_libs: [
160 "bionic_libc_platform_headers",
161 ],
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -0800162
Christopher Ferris97b47472018-07-10 14:45:24 -0700163 srcs: [
164 "tests/malloc_debug_system_tests.cpp",
165 ],
166
167 shared_libs: [
168 "libbase",
169 "liblog",
170 "libunwindstack",
171 ],
172
173 cflags: [
174 "-Wall",
175 "-Werror",
176 "-O0",
177 ],
178}