1// ==============================================================
2// libc_malloc_debug_backtrace.a
3// ==============================================================
4// Used by libmemunreachable
5package {
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
15cc_library_static {
16    name: "libc_malloc_debug_backtrace",
17    vendor_available: true,
18
19    srcs: [
20        "backtrace.cpp",
21        "MapData.cpp",
22    ],
23
24    stl: "libc++_static",
25
26    whole_static_libs: [
27        "libbase",
28        "libasync_safe",
29    ],
30
31    include_dirs: ["bionic/libc"],
32
33    export_include_dirs: ["."],
34
35    sanitize: {
36        never: true,
37    },
38    native_coverage: false,
39
40    target: {
41        android: {
42            static_libs: ["libc++demangle"],
43        },
44    },
45
46    // -Wno-error=format-zero-length needed for gcc to compile.
47    cflags: [
48        "-Wall",
49        "-Werror",
50        "-Wno-error=format-zero-length",
51    ],
52
53    apex_available: [
54        "//apex_available:platform",
55        "com.android.runtime",
56    ],
57}
58
59// ==============================================================
60// libc_malloc_debug.so
61// ==============================================================
62cc_library {
63    name: "libc_malloc_debug",
64
65    srcs: [
66        "Config.cpp",
67        "DebugData.cpp",
68        "debug_disable.cpp",
69        "GuardData.cpp",
70        "malloc_debug.cpp",
71        "PointerData.cpp",
72        "RecordData.cpp",
73        "UnwindBacktrace.cpp",
74    ],
75
76    stl: "libc++_static",
77
78    static_libs: [
79        "libasync_safe",
80        "libbase",
81        "libc_malloc_debug_backtrace",
82    ],
83
84    shared_libs: [
85        "libunwindstack",
86    ],
87
88    multilib: {
89        lib32: {
90            version_script: "exported32.map",
91        },
92        lib64: {
93            version_script: "exported64.map",
94        },
95    },
96    allow_undefined_symbols: true,
97    include_dirs: ["bionic/libc"],
98
99    sanitize: {
100        never: true,
101    },
102    native_coverage: false,
103
104    // -Wno-error=format-zero-length needed for gcc to compile.
105    cflags: [
106        "-Wall",
107        "-Werror",
108        "-fno-stack-protector",
109        "-Wno-error=format-zero-length",
110        "-Wthread-safety",
111    ],
112
113    apex_available: [
114        "com.android.runtime",
115    ],
116    static: {
117        apex_available: [
118            "//apex_available:platform",
119        ],
120    },
121}
122
123// ==============================================================
124// Unit Tests
125// ==============================================================
126cc_test {
127    name: "malloc_debug_unit_tests",
128
129    srcs: [
130        "tests/backtrace_fake.cpp",
131        "tests/log_fake.cpp",
132        "tests/libc_fake.cpp",
133        "tests/malloc_debug_config_tests.cpp",
134        "tests/malloc_debug_unit_tests.cpp",
135    ],
136
137    local_include_dirs: ["tests"],
138    include_dirs: [
139        "bionic/libc",
140        "bionic/libc/async_safe/include",
141    ],
142
143    header_libs: [
144        "bionic_libc_platform_headers",
145    ],
146
147    static_libs: [
148        "libc_malloc_debug",
149        "libtinyxml2",
150    ],
151
152    shared_libs: [
153        "libbase",
154        "libunwindstack",
155    ],
156
157    cflags: [
158        "-Wall",
159        "-Werror",
160        "-Wno-error=format-zero-length",
161        "-O0",
162    ],
163}
164
165// ==============================================================
166// System Tests
167// ==============================================================
168cc_test {
169    name: "malloc_debug_system_tests",
170    isolated: true,
171
172    include_dirs: [
173        "bionic/libc",
174    ],
175
176    header_libs: [
177        "bionic_libc_platform_headers",
178    ],
179
180    srcs: [
181        "tests/malloc_debug_system_tests.cpp",
182    ],
183
184    shared_libs: [
185        "libbase",
186        "libbacktrace",
187        "liblog",
188        "libunwindstack",
189    ],
190
191    cflags: [
192        "-Wall",
193        "-Werror",
194        "-O0",
195    ],
196    test_suites: ["general-tests"],
197}
198