blob: 3828c2802dc6b946db092049f8892566743c5c15 [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 Ferris93bdd6a2018-04-05 11:12:38 -070082 shared_libs: [
83 "libunwindstack",
84 ],
85
Colin Crossbaa48992016-07-13 11:15:21 -070086 multilib: {
87 lib32: {
88 version_script: "exported32.map",
89 },
90 lib64: {
91 version_script: "exported64.map",
92 },
93 },
94 allow_undefined_symbols: true,
95 include_dirs: ["bionic/libc"],
96
97 sanitize: {
98 never: true,
99 },
100 native_coverage: false,
101
102 // -Wno-error=format-zero-length needed for gcc to compile.
103 cflags: [
104 "-Wall",
105 "-Werror",
106 "-fno-stack-protector",
107 "-Wno-error=format-zero-length",
Christopher Ferris4da25032018-03-07 13:38:48 -0800108 "-Wthread-safety",
Colin Crossbaa48992016-07-13 11:15:21 -0700109 ],
Jiyong Parke87e0dc2019-10-02 17:09:33 +0900110
111 apex_available: [
Jiyong Parke87e0dc2019-10-02 17:09:33 +0900112 "com.android.runtime",
113 ],
Jiyong Parkf302cfb2019-10-07 15:52:21 +0900114 static: {
115 apex_available: [
116 "//apex_available:platform",
117 ],
118 },
Colin Crossbaa48992016-07-13 11:15:21 -0700119}
120
121// ==============================================================
122// Unit Tests
123// ==============================================================
124cc_test {
Colin Crossbaa48992016-07-13 11:15:21 -0700125 name: "malloc_debug_unit_tests",
Colin Cross0cc60af2021-09-30 14:04:39 -0700126 test_suites: ["device-tests"],
Christopher Ferris0d07dcc2022-05-17 16:51:02 -0700127 isolated: true,
Colin Crossbaa48992016-07-13 11:15:21 -0700128
129 srcs: [
130 "tests/backtrace_fake.cpp",
131 "tests/log_fake.cpp",
132 "tests/libc_fake.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -0700133 "tests/malloc_debug_config_tests.cpp",
134 "tests/malloc_debug_unit_tests.cpp",
135 ],
136
Colin Crossbaa48992016-07-13 11:15:21 -0700137 local_include_dirs: ["tests"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800138 include_dirs: [
139 "bionic/libc",
140 "bionic/libc/async_safe/include",
141 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700142
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700143 header_libs: [
144 "bionic_libc_platform_headers",
145 ],
146
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700147 static_libs: [
148 "libc_malloc_debug",
Christopher Ferris6c619a02019-03-01 17:59:51 -0800149 "libtinyxml2",
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700150 ],
151
152 shared_libs: [
153 "libbase",
154 "libunwindstack",
155 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700156
157 cflags: [
158 "-Wall",
159 "-Werror",
160 "-Wno-error=format-zero-length",
Christopher Ferris2e1a40a2018-06-13 10:46:34 -0700161 "-O0",
Colin Crossbaa48992016-07-13 11:15:21 -0700162 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700163}
Christopher Ferris97b47472018-07-10 14:45:24 -0700164
165// ==============================================================
166// System Tests
167// ==============================================================
168cc_test {
169 name: "malloc_debug_system_tests",
Christopher Ferrise4619f72019-11-11 14:17:44 -0800170 isolated: true,
Christopher Ferris97b47472018-07-10 14:45:24 -0700171
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700172 include_dirs: [
173 "bionic/libc",
Florian Mayerdca72292022-04-13 14:39:36 -0700174 "bionic", // For SKIP_WITH_HWASAN.
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700175 ],
176
177 header_libs: [
178 "bionic_libc_platform_headers",
179 ],
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -0800180
Chih-Hung Hsieh7ab1c812023-01-09 15:12:32 -0800181 // The clang-analyzer-unix.Malloc and other warnings in these
182 // unit tests are either false positive or in
183 // negative tests that can be ignored.
184 tidy: false,
185
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}