blob: 83e4aa8b0649a6b131a9a18f67ede63c1d796a13 [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",
Christopher Ferris5610d5a2023-11-14 15:04:50 -080064 "LogAllocatorStats.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070065 "malloc_debug.cpp",
Christopher Ferris4da25032018-03-07 13:38:48 -080066 "PointerData.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070067 "RecordData.cpp",
Christopher Ferrisb42e8b42022-05-09 14:00:47 -070068 "Unreachable.cpp",
Christopher Ferris93bdd6a2018-04-05 11:12:38 -070069 "UnwindBacktrace.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -070070 ],
71
72 stl: "libc++_static",
73
Colin Crossbaa48992016-07-13 11:15:21 -070074 static_libs: [
Christopher Ferris7a3681e2017-04-24 17:48:32 -070075 "libasync_safe",
Colin Crossbaa48992016-07-13 11:15:21 -070076 "libbase",
77 "libc_malloc_debug_backtrace",
Christopher Ferrisb42e8b42022-05-09 14:00:47 -070078 "libmemunreachable",
Colin Crossbaa48992016-07-13 11:15:21 -070079 ],
80
Christopher Ferris93bdd6a2018-04-05 11:12:38 -070081 shared_libs: [
82 "libunwindstack",
83 ],
84
Colin Crossbaa48992016-07-13 11:15:21 -070085 multilib: {
86 lib32: {
87 version_script: "exported32.map",
88 },
89 lib64: {
90 version_script: "exported64.map",
91 },
92 },
93 allow_undefined_symbols: true,
94 include_dirs: ["bionic/libc"],
95
96 sanitize: {
97 never: true,
98 },
99 native_coverage: false,
100
101 // -Wno-error=format-zero-length needed for gcc to compile.
102 cflags: [
103 "-Wall",
104 "-Werror",
105 "-fno-stack-protector",
106 "-Wno-error=format-zero-length",
Christopher Ferris4da25032018-03-07 13:38:48 -0800107 "-Wthread-safety",
Colin Crossbaa48992016-07-13 11:15:21 -0700108 ],
Jiyong Parke87e0dc2019-10-02 17:09:33 +0900109
110 apex_available: [
Jiyong Parke87e0dc2019-10-02 17:09:33 +0900111 "com.android.runtime",
112 ],
Jiyong Parkf302cfb2019-10-07 15:52:21 +0900113 static: {
114 apex_available: [
115 "//apex_available:platform",
116 ],
117 },
Colin Crossbaa48992016-07-13 11:15:21 -0700118}
119
120// ==============================================================
121// Unit Tests
122// ==============================================================
123cc_test {
Colin Crossbaa48992016-07-13 11:15:21 -0700124 name: "malloc_debug_unit_tests",
Colin Cross0cc60af2021-09-30 14:04:39 -0700125 test_suites: ["device-tests"],
Christopher Ferris0d07dcc2022-05-17 16:51:02 -0700126 isolated: true,
Colin Crossbaa48992016-07-13 11:15:21 -0700127
128 srcs: [
129 "tests/backtrace_fake.cpp",
130 "tests/log_fake.cpp",
131 "tests/libc_fake.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -0700132 "tests/malloc_debug_config_tests.cpp",
133 "tests/malloc_debug_unit_tests.cpp",
134 ],
135
Colin Crossbaa48992016-07-13 11:15:21 -0700136 local_include_dirs: ["tests"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800137 include_dirs: [
138 "bionic/libc",
139 "bionic/libc/async_safe/include",
140 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700141
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700142 header_libs: [
143 "bionic_libc_platform_headers",
144 ],
145
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700146 static_libs: [
147 "libc_malloc_debug",
Christopher Ferris6c619a02019-03-01 17:59:51 -0800148 "libtinyxml2",
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700149 ],
150
151 shared_libs: [
152 "libbase",
153 "libunwindstack",
154 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700155
156 cflags: [
157 "-Wall",
158 "-Werror",
159 "-Wno-error=format-zero-length",
Christopher Ferris2e1a40a2018-06-13 10:46:34 -0700160 "-O0",
Colin Crossbaa48992016-07-13 11:15:21 -0700161 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700162}
Christopher Ferris97b47472018-07-10 14:45:24 -0700163
164// ==============================================================
165// System Tests
166// ==============================================================
167cc_test {
168 name: "malloc_debug_system_tests",
Christopher Ferrise4619f72019-11-11 14:17:44 -0800169 isolated: true,
Christopher Ferris97b47472018-07-10 14:45:24 -0700170
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700171 include_dirs: [
172 "bionic/libc",
Florian Mayerdca72292022-04-13 14:39:36 -0700173 "bionic", // For SKIP_WITH_HWASAN.
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700174 ],
175
176 header_libs: [
177 "bionic_libc_platform_headers",
178 ],
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -0800179
Chih-Hung Hsieh7ab1c812023-01-09 15:12:32 -0800180 // The clang-analyzer-unix.Malloc and other warnings in these
181 // unit tests are either false positive or in
182 // negative tests that can be ignored.
183 tidy: false,
184
Christopher Ferris97b47472018-07-10 14:45:24 -0700185 srcs: [
186 "tests/malloc_debug_system_tests.cpp",
187 ],
188
189 shared_libs: [
190 "libbase",
191 "liblog",
192 "libunwindstack",
193 ],
194
195 cflags: [
196 "-Wall",
197 "-Werror",
198 "-O0",
199 ],
Christopher Ferrise4619f72019-11-11 14:17:44 -0800200 test_suites: ["general-tests"],
Christopher Ferris852f9b02023-06-02 16:34:28 -0700201 test_config: "tests/AndroidTest.xml",
Christopher Ferris97b47472018-07-10 14:45:24 -0700202}