blob: 24bb18a4069a7c6c6640a1f55ca60273035d858c [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 {
6 // See: http://go/android-license-faq
7 // A large-scale-change added 'default_applicable_licenses' to import
8 // all of the 'license_kinds' from "bionic_libc_license"
9 // to get the below license kinds:
10 // SPDX-license-identifier-Apache-2.0
11 // SPDX-license-identifier-BSD
12 default_applicable_licenses: ["bionic_libc_license"],
13}
14
Colin Crossbaa48992016-07-13 11:15:21 -070015cc_library_static {
Colin Crossbaa48992016-07-13 11:15:21 -070016 name: "libc_malloc_debug_backtrace",
Colin Crossb9667b52019-05-17 13:45:18 -070017 vendor_available: true,
Colin Crossbaa48992016-07-13 11:15:21 -070018
19 srcs: [
20 "backtrace.cpp",
21 "MapData.cpp",
22 ],
23
24 stl: "libc++_static",
25
Elliott Hughesd50a1de2018-02-05 17:30:57 -080026 whole_static_libs: [
Christopher Ferris93bdd6a2018-04-05 11:12:38 -070027 "libbase",
Elliott Hughesd50a1de2018-02-05 17:30:57 -080028 "libasync_safe",
Elliott Hughesd50a1de2018-02-05 17:30:57 -080029 ],
Colin Crossbaa48992016-07-13 11:15:21 -070030
31 include_dirs: ["bionic/libc"],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070032
Colin Crossbaa48992016-07-13 11:15:21 -070033 export_include_dirs: ["."],
34
35 sanitize: {
36 never: true,
37 },
38 native_coverage: false,
39
40 // -Wno-error=format-zero-length needed for gcc to compile.
41 cflags: [
42 "-Wall",
43 "-Werror",
44 "-Wno-error=format-zero-length",
45 ],
Jiyong Parke87e0dc2019-10-02 17:09:33 +090046
47 apex_available: [
48 "//apex_available:platform",
49 "com.android.runtime",
50 ],
Colin Crossbaa48992016-07-13 11:15:21 -070051}
52
53// ==============================================================
54// libc_malloc_debug.so
55// ==============================================================
56cc_library {
57 name: "libc_malloc_debug",
58
59 srcs: [
Colin Crossbaa48992016-07-13 11:15:21 -070060 "Config.cpp",
61 "DebugData.cpp",
62 "debug_disable.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070063 "GuardData.cpp",
64 "malloc_debug.cpp",
Christopher Ferris4da25032018-03-07 13:38:48 -080065 "PointerData.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070066 "RecordData.cpp",
Christopher Ferrisb42e8b42022-05-09 14:00:47 -070067 "Unreachable.cpp",
Christopher Ferris93bdd6a2018-04-05 11:12:38 -070068 "UnwindBacktrace.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070069 ],
70
71 stl: "libc++_static",
72
Colin Crossbaa48992016-07-13 11:15:21 -070073 static_libs: [
Christopher Ferris7a3681e2017-04-24 17:48:32 -070074 "libasync_safe",
Colin Crossbaa48992016-07-13 11:15:21 -070075 "libbase",
76 "libc_malloc_debug_backtrace",
Christopher Ferrisb42e8b42022-05-09 14:00:47 -070077 "libmemunreachable",
Colin Crossbaa48992016-07-13 11:15:21 -070078 ],
79
Christopher Ferris93bdd6a2018-04-05 11:12:38 -070080 shared_libs: [
81 "libunwindstack",
82 ],
83
Colin Crossbaa48992016-07-13 11:15:21 -070084 multilib: {
85 lib32: {
86 version_script: "exported32.map",
87 },
88 lib64: {
89 version_script: "exported64.map",
90 },
91 },
92 allow_undefined_symbols: true,
93 include_dirs: ["bionic/libc"],
94
95 sanitize: {
96 never: true,
97 },
98 native_coverage: false,
99
100 // -Wno-error=format-zero-length needed for gcc to compile.
101 cflags: [
102 "-Wall",
103 "-Werror",
104 "-fno-stack-protector",
105 "-Wno-error=format-zero-length",
Christopher Ferris4da25032018-03-07 13:38:48 -0800106 "-Wthread-safety",
Colin Crossbaa48992016-07-13 11:15:21 -0700107 ],
Jiyong Parke87e0dc2019-10-02 17:09:33 +0900108
109 apex_available: [
Jiyong Parke87e0dc2019-10-02 17:09:33 +0900110 "com.android.runtime",
111 ],
Jiyong Parkf302cfb2019-10-07 15:52:21 +0900112 static: {
113 apex_available: [
114 "//apex_available:platform",
115 ],
116 },
Colin Crossbaa48992016-07-13 11:15:21 -0700117}
118
119// ==============================================================
120// Unit Tests
121// ==============================================================
122cc_test {
Colin Crossbaa48992016-07-13 11:15:21 -0700123 name: "malloc_debug_unit_tests",
Colin Cross0cc60af2021-09-30 14:04:39 -0700124 test_suites: ["device-tests"],
Christopher Ferris0d07dcc2022-05-17 16:51:02 -0700125 isolated: true,
Colin Crossbaa48992016-07-13 11:15:21 -0700126
127 srcs: [
128 "tests/backtrace_fake.cpp",
129 "tests/log_fake.cpp",
130 "tests/libc_fake.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -0700131 "tests/malloc_debug_config_tests.cpp",
132 "tests/malloc_debug_unit_tests.cpp",
133 ],
134
Colin Crossbaa48992016-07-13 11:15:21 -0700135 local_include_dirs: ["tests"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800136 include_dirs: [
137 "bionic/libc",
138 "bionic/libc/async_safe/include",
139 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700140
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700141 header_libs: [
142 "bionic_libc_platform_headers",
143 ],
144
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700145 static_libs: [
146 "libc_malloc_debug",
Christopher Ferris6c619a02019-03-01 17:59:51 -0800147 "libtinyxml2",
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700148 ],
149
150 shared_libs: [
151 "libbase",
152 "libunwindstack",
153 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700154
155 cflags: [
156 "-Wall",
157 "-Werror",
158 "-Wno-error=format-zero-length",
Christopher Ferris2e1a40a2018-06-13 10:46:34 -0700159 "-O0",
Colin Crossbaa48992016-07-13 11:15:21 -0700160 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700161}
Christopher Ferris97b47472018-07-10 14:45:24 -0700162
163// ==============================================================
164// System Tests
165// ==============================================================
166cc_test {
167 name: "malloc_debug_system_tests",
Christopher Ferrise4619f72019-11-11 14:17:44 -0800168 isolated: true,
Christopher Ferris97b47472018-07-10 14:45:24 -0700169
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700170 include_dirs: [
171 "bionic/libc",
Florian Mayerdca72292022-04-13 14:39:36 -0700172 "bionic", // For SKIP_WITH_HWASAN.
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700173 ],
174
175 header_libs: [
176 "bionic_libc_platform_headers",
177 ],
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -0800178
Chih-Hung Hsieh7ab1c812023-01-09 15:12:32 -0800179 // The clang-analyzer-unix.Malloc and other warnings in these
180 // unit tests are either false positive or in
181 // negative tests that can be ignored.
182 tidy: false,
183
Christopher Ferris97b47472018-07-10 14:45:24 -0700184 srcs: [
185 "tests/malloc_debug_system_tests.cpp",
186 ],
187
188 shared_libs: [
189 "libbase",
190 "liblog",
191 "libunwindstack",
192 ],
193
194 cflags: [
195 "-Wall",
196 "-Werror",
197 "-O0",
198 ],
Christopher Ferrise4619f72019-11-11 14:17:44 -0800199 test_suites: ["general-tests"],
Christopher Ferris852f9b02023-06-02 16:34:28 -0700200 test_config: "tests/AndroidTest.xml",
Christopher Ferris97b47472018-07-10 14:45:24 -0700201}