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 // -Wno-error=format-zero-length needed for gcc to compile. 41 cflags: [ 42 "-Wall", 43 "-Werror", 44 "-Wno-error=format-zero-length", 45 ], 46 47 apex_available: [ 48 "//apex_available:platform", 49 "com.android.runtime", 50 ], 51} 52 53// ============================================================== 54// libc_malloc_debug.so 55// ============================================================== 56cc_library { 57 name: "libc_malloc_debug", 58 59 srcs: [ 60 "Config.cpp", 61 "DebugData.cpp", 62 "debug_disable.cpp", 63 "GuardData.cpp", 64 "malloc_debug.cpp", 65 "PointerData.cpp", 66 "RecordData.cpp", 67 "Unreachable.cpp", 68 "UnwindBacktrace.cpp", 69 ], 70 71 stl: "libc++_static", 72 73 static_libs: [ 74 "libasync_safe", 75 "libbase", 76 "libc_malloc_debug_backtrace", 77 "libmemunreachable", 78 ], 79 80 shared_libs: [ 81 "libunwindstack", 82 ], 83 84 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", 106 "-Wthread-safety", 107 ], 108 109 apex_available: [ 110 "com.android.runtime", 111 ], 112 static: { 113 apex_available: [ 114 "//apex_available:platform", 115 ], 116 }, 117} 118 119// ============================================================== 120// Unit Tests 121// ============================================================== 122cc_test { 123 name: "malloc_debug_unit_tests", 124 test_suites: ["device-tests"], 125 isolated: true, 126 127 srcs: [ 128 "tests/backtrace_fake.cpp", 129 "tests/log_fake.cpp", 130 "tests/libc_fake.cpp", 131 "tests/malloc_debug_config_tests.cpp", 132 "tests/malloc_debug_unit_tests.cpp", 133 ], 134 135 local_include_dirs: ["tests"], 136 include_dirs: [ 137 "bionic/libc", 138 "bionic/libc/async_safe/include", 139 ], 140 141 header_libs: [ 142 "bionic_libc_platform_headers", 143 ], 144 145 static_libs: [ 146 "libc_malloc_debug", 147 "libtinyxml2", 148 ], 149 150 shared_libs: [ 151 "libbase", 152 "libunwindstack", 153 ], 154 155 cflags: [ 156 "-Wall", 157 "-Werror", 158 "-Wno-error=format-zero-length", 159 "-O0", 160 ], 161} 162 163// ============================================================== 164// System Tests 165// ============================================================== 166cc_test { 167 name: "malloc_debug_system_tests", 168 isolated: true, 169 170 include_dirs: [ 171 "bionic/libc", 172 "bionic", // For SKIP_WITH_HWASAN. 173 ], 174 175 header_libs: [ 176 "bionic_libc_platform_headers", 177 ], 178 179 // 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 184 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 ], 199 test_suites: ["general-tests"], 200} 201