blob: 344f9a78392385a719ace85f507fca74f10bf65f [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"],
Colin Crossbaa48992016-07-13 11:15:21 -0700125
126 srcs: [
127 "tests/backtrace_fake.cpp",
128 "tests/log_fake.cpp",
129 "tests/libc_fake.cpp",
Colin Crossbaa48992016-07-13 11:15:21 -0700130 "tests/malloc_debug_config_tests.cpp",
131 "tests/malloc_debug_unit_tests.cpp",
132 ],
133
Colin Crossbaa48992016-07-13 11:15:21 -0700134 local_include_dirs: ["tests"],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800135 include_dirs: [
136 "bionic/libc",
137 "bionic/libc/async_safe/include",
138 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700139
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700140 header_libs: [
141 "bionic_libc_platform_headers",
142 ],
143
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700144 static_libs: [
145 "libc_malloc_debug",
Christopher Ferris6c619a02019-03-01 17:59:51 -0800146 "libtinyxml2",
Christopher Ferris93bdd6a2018-04-05 11:12:38 -0700147 ],
148
149 shared_libs: [
150 "libbase",
151 "libunwindstack",
152 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700153
154 cflags: [
155 "-Wall",
156 "-Werror",
157 "-Wno-error=format-zero-length",
Christopher Ferris2e1a40a2018-06-13 10:46:34 -0700158 "-O0",
Colin Crossbaa48992016-07-13 11:15:21 -0700159 ],
Colin Crossbaa48992016-07-13 11:15:21 -0700160}
Christopher Ferris97b47472018-07-10 14:45:24 -0700161
162// ==============================================================
163// System Tests
164// ==============================================================
165cc_test {
166 name: "malloc_debug_system_tests",
Christopher Ferrise4619f72019-11-11 14:17:44 -0800167 isolated: true,
Christopher Ferris97b47472018-07-10 14:45:24 -0700168
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700169 include_dirs: [
170 "bionic/libc",
Florian Mayerdca72292022-04-13 14:39:36 -0700171 "bionic", // For SKIP_WITH_HWASAN.
Christopher Ferris2b0638e2019-09-11 19:05:29 -0700172 ],
173
174 header_libs: [
175 "bionic_libc_platform_headers",
176 ],
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -0800177
Christopher Ferris97b47472018-07-10 14:45:24 -0700178 srcs: [
179 "tests/malloc_debug_system_tests.cpp",
180 ],
181
182 shared_libs: [
183 "libbase",
Christopher Ferris9bf78172020-05-20 15:37:30 -0700184 "libbacktrace",
Christopher Ferris97b47472018-07-10 14:45:24 -0700185 "liblog",
186 "libunwindstack",
187 ],
188
189 cflags: [
190 "-Wall",
191 "-Werror",
192 "-O0",
193 ],
Christopher Ferrise4619f72019-11-11 14:17:44 -0800194 test_suites: ["general-tests"],
Christopher Ferris97b47472018-07-10 14:45:24 -0700195}