blob: 50f24f6c77d19eefdf57d5d15046a72af3cecaf2 [file] [log] [blame]
Colin Crossbaa48992016-07-13 11:15:21 -07001// ==============================================================
2// libc_malloc_debug_backtrace.a
3// ==============================================================
4// Used by libmemunreachable
Bob Badouraa7d8352021-02-19 13:06:22 -08005package {
Aditya Choudharyd9d37c02024-02-02 13:57:12 +00006 default_team: "trendy_team_native_tools_libraries",
Bob Badouraa7d8352021-02-19 13:06:22 -08007 // See: http://go/android-license-faq
8 // A large-scale-change added 'default_applicable_licenses' to import
9 // all of the 'license_kinds' from "bionic_libc_license"
10 // to get the below license kinds:
11 // SPDX-license-identifier-Apache-2.0
12 // SPDX-license-identifier-BSD
13 default_applicable_licenses: ["bionic_libc_license"],
14}
15
Colin Crossbaa48992016-07-13 11:15:21 -070016cc_library_static {
Colin Crossbaa48992016-07-13 11:15:21 -070017 name: "libc_malloc_debug_backtrace",
Colin Crossb9667b52019-05-17 13:45:18 -070018 vendor_available: true,
Colin Crossbaa48992016-07-13 11:15:21 -070019
20 srcs: [
21 "backtrace.cpp",
22 "MapData.cpp",
23 ],
24
25 stl: "libc++_static",
26
Elliott Hughesd50a1de2018-02-05 17:30:57 -080027 whole_static_libs: [
Christopher Ferris93bdd6a2018-04-05 11:12:38 -070028 "libbase",
Elliott Hughesd50a1de2018-02-05 17:30:57 -080029 "libasync_safe",
Elliott Hughesd50a1de2018-02-05 17:30:57 -080030 ],
Colin Crossbaa48992016-07-13 11:15:21 -070031
32 include_dirs: ["bionic/libc"],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070033
Colin Crossbaa48992016-07-13 11:15:21 -070034 export_include_dirs: ["."],
35
36 sanitize: {
37 never: true,
38 },
39 native_coverage: false,
40
41 // -Wno-error=format-zero-length needed for gcc to compile.
42 cflags: [
43 "-Wall",
44 "-Werror",
45 "-Wno-error=format-zero-length",
46 ],
Jiyong Parke87e0dc2019-10-02 17:09:33 +090047
48 apex_available: [
49 "//apex_available:platform",
50 "com.android.runtime",
51 ],
Colin Crossbaa48992016-07-13 11:15:21 -070052}
53
54// ==============================================================
55// libc_malloc_debug.so
56// ==============================================================
57cc_library {
58 name: "libc_malloc_debug",
59
60 srcs: [
Colin Crossbaa48992016-07-13 11:15:21 -070061 "Config.cpp",
62 "DebugData.cpp",
63 "debug_disable.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070064 "GuardData.cpp",
Christopher Ferris5610d5a2023-11-14 15:04:50 -080065 "LogAllocatorStats.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070066 "malloc_debug.cpp",
Christopher Ferris4da25032018-03-07 13:38:48 -080067 "PointerData.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070068 "RecordData.cpp",
Christopher Ferrisb42e8b42022-05-09 14:00:47 -070069 "Unreachable.cpp",
Christopher Ferris93bdd6a2018-04-05 11:12:38 -070070 "UnwindBacktrace.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070071 ],
72
73 stl: "libc++_static",
74
Colin Crossbaa48992016-07-13 11:15:21 -070075 static_libs: [
Christopher Ferris7a3681e2017-04-24 17:48:32 -070076 "libasync_safe",
Colin Crossbaa48992016-07-13 11:15:21 -070077 "libbase",
78 "libc_malloc_debug_backtrace",
Christopher Ferrisb42e8b42022-05-09 14:00:47 -070079 "libmemunreachable",
Colin Crossbaa48992016-07-13 11:15:21 -070080 ],
81
Christopher Ferrise39602c2024-11-02 05:02:43 +000082 whole_static_libs: [
83 "libmemory_trace",
84 ],
85
Christopher Ferris93bdd6a2018-04-05 11:12:38 -070086 shared_libs: [
87 "libunwindstack",
88 ],
89
Colin Crossbaa48992016-07-13 11:15:21 -070090 multilib: {
91 lib32: {
92 version_script: "exported32.map",
93 },
94 lib64: {
95 version_script: "exported64.map",
96 },
97 },
98 allow_undefined_symbols: true,
99 include_dirs: ["bionic/libc"],
100
101 sanitize: {
102 never: true,
103 },
104 native_coverage: false,
105
106 // -Wno-error=format-zero-length needed for gcc to compile.
107 cflags: [
108 "-Wall",
109 "-Werror",
110 "-fno-stack-protector",
111 "-Wno-error=format-zero-length",
Christopher Ferris4da25032018-03-07 13:38:48 -0800112 "-Wthread-safety",
Colin Crossbaa48992016-07-13 11:15:21 -0700113 ],
Jiyong Parke87e0dc2019-10-02 17:09:33 +0900114
115 apex_available: [
Jiyong Parke87e0dc2019-10-02 17:09:33 +0900116 "com.android.runtime",
117 ],
Jiyong Parkf302cfb2019-10-07 15:52:21 +0900118 static: {
119 apex_available: [
120 "//apex_available:platform",
121 ],
122 },
Colin Crossbaa48992016-07-13 11:15:21 -0700123}
124
125// ==============================================================
126// Unit Tests
127// ==============================================================
128cc_test {
Colin Crossbaa48992016-07-13 11:15:21 -0700129 name: "malloc_debug_unit_tests",
Colin Cross0cc60af2021-09-30 14:04:39 -0700130 test_suites: ["device-tests"],
Christopher Ferris0d07dcc2022-05-17 16:51:02 -0700131 isolated: true,
Colin Crossbaa48992016-07-13 11:15:21 -0700132
133 srcs: [
134 "tests/backtrace_fake.cpp",
135 "tests/log_fake.cpp",
136 "tests/libc_fake.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -0700137 "tests/malloc_debug_config_tests.cpp",
Christopher Ferris31199e72024-11-08 14:44:53 -0800138 "tests/malloc_debug_record_data_tests.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -0700139 "tests/malloc_debug_unit_tests.cpp",
140 ],
141
Colin Crossbaa48992016-07-13 11:15:21 -0700142 local_include_dirs: ["tests"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800143 include_dirs: [
144 "bionic/libc",
145 "bionic/libc/async_safe/include",
146 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700147
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700148 header_libs: [
149 "bionic_libc_platform_headers",
150 ],
151
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700152 static_libs: [
153 "libc_malloc_debug",
Christopher Ferris6c619a02019-03-01 17:59:51 -0800154 "libtinyxml2",
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700155 ],
156
157 shared_libs: [
158 "libbase",
159 "libunwindstack",
160 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700161
162 cflags: [
163 "-Wall",
164 "-Werror",
165 "-Wno-error=format-zero-length",
Christopher Ferris2e1a40a2018-06-13 10:46:34 -0700166 "-O0",
Colin Crossbaa48992016-07-13 11:15:21 -0700167 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700168}
Christopher Ferris97b47472018-07-10 14:45:24 -0700169
170// ==============================================================
171// System Tests
172// ==============================================================
173cc_test {
174 name: "malloc_debug_system_tests",
Christopher Ferrise4619f72019-11-11 14:17:44 -0800175 isolated: true,
Christopher Ferris97b47472018-07-10 14:45:24 -0700176
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700177 include_dirs: [
178 "bionic/libc",
Florian Mayerdca72292022-04-13 14:39:36 -0700179 "bionic", // For SKIP_WITH_HWASAN.
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700180 ],
181
182 header_libs: [
183 "bionic_libc_platform_headers",
184 ],
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -0800185
Christopher Ferris97b47472018-07-10 14:45:24 -0700186 srcs: [
187 "tests/malloc_debug_system_tests.cpp",
188 ],
189
190 shared_libs: [
191 "libbase",
192 "liblog",
193 "libunwindstack",
194 ],
195
196 cflags: [
197 "-Wall",
198 "-Werror",
199 "-O0",
200 ],
Christopher Ferrise4619f72019-11-11 14:17:44 -0800201 test_suites: ["general-tests"],
Christopher Ferris852f9b02023-06-02 16:34:28 -0700202 test_config: "tests/AndroidTest.xml",
Christopher Ferris97b47472018-07-10 14:45:24 -0700203}