blob: 5d61801ff0a227e79040d576bf6941b939d74f50 [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",
138 "tests/malloc_debug_unit_tests.cpp",
139 ],
140
Colin Crossbaa48992016-07-13 11:15:21 -0700141 local_include_dirs: ["tests"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800142 include_dirs: [
143 "bionic/libc",
144 "bionic/libc/async_safe/include",
145 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700146
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700147 header_libs: [
148 "bionic_libc_platform_headers",
149 ],
150
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700151 static_libs: [
152 "libc_malloc_debug",
Christopher Ferris6c619a02019-03-01 17:59:51 -0800153 "libtinyxml2",
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700154 ],
155
156 shared_libs: [
157 "libbase",
158 "libunwindstack",
159 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700160
161 cflags: [
162 "-Wall",
163 "-Werror",
164 "-Wno-error=format-zero-length",
Christopher Ferris2e1a40a2018-06-13 10:46:34 -0700165 "-O0",
Colin Crossbaa48992016-07-13 11:15:21 -0700166 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700167}
Christopher Ferris97b47472018-07-10 14:45:24 -0700168
169// ==============================================================
170// System Tests
171// ==============================================================
172cc_test {
173 name: "malloc_debug_system_tests",
Christopher Ferrise4619f72019-11-11 14:17:44 -0800174 isolated: true,
Christopher Ferris97b47472018-07-10 14:45:24 -0700175
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700176 include_dirs: [
177 "bionic/libc",
Florian Mayerdca72292022-04-13 14:39:36 -0700178 "bionic", // For SKIP_WITH_HWASAN.
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700179 ],
180
181 header_libs: [
182 "bionic_libc_platform_headers",
183 ],
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -0800184
Chih-Hung Hsieh7ab1c812023-01-09 15:12:32 -0800185 // The clang-analyzer-unix.Malloc and other warnings in these
186 // unit tests are either false positive or in
187 // negative tests that can be ignored.
188 tidy: false,
189
Christopher Ferris97b47472018-07-10 14:45:24 -0700190 srcs: [
191 "tests/malloc_debug_system_tests.cpp",
192 ],
193
194 shared_libs: [
195 "libbase",
196 "liblog",
197 "libunwindstack",
198 ],
199
200 cflags: [
201 "-Wall",
202 "-Werror",
203 "-O0",
204 ],
Christopher Ferrise4619f72019-11-11 14:17:44 -0800205 test_suites: ["general-tests"],
Christopher Ferris852f9b02023-06-02 16:34:28 -0700206 test_config: "tests/AndroidTest.xml",
Christopher Ferris97b47472018-07-10 14:45:24 -0700207}