1// ============================================================== 2// libc_malloc_debug_backtrace.a 3// ============================================================== 4// Used by libmemunreachable 5package { 6 default_team: "trendy_team_native_tools_libraries", 7 // See: http://go/android-license-faq 8 // A large-scale-change added 'default_applicable_licenses' to import 9 // all of the 'license_kinds' from "bionic_libc_license" 10 // to get the below license kinds: 11 // SPDX-license-identifier-Apache-2.0 12 // SPDX-license-identifier-BSD 13 default_applicable_licenses: ["bionic_libc_license"], 14} 15 16cc_library_static { 17 name: "libc_malloc_debug_backtrace", 18 vendor_available: true, 19 20 srcs: [ 21 "backtrace.cpp", 22 "MapData.cpp", 23 ], 24 25 stl: "libc++_static", 26 27 whole_static_libs: [ 28 "libbase", 29 "libasync_safe", 30 ], 31 32 include_dirs: ["bionic/libc"], 33 34 export_include_dirs: ["."], 35 36 sanitize: { 37 never: true, 38 }, 39 native_coverage: false, 40 41 // -Wno-error=format-zero-length needed for gcc to compile. 42 cflags: [ 43 "-Wall", 44 "-Werror", 45 "-Wno-error=format-zero-length", 46 ], 47 48 apex_available: [ 49 "//apex_available:platform", 50 "com.android.runtime", 51 ], 52} 53 54// ============================================================== 55// libc_malloc_debug.so 56// ============================================================== 57cc_library { 58 name: "libc_malloc_debug", 59 60 srcs: [ 61 "Config.cpp", 62 "DebugData.cpp", 63 "debug_disable.cpp", 64 "GuardData.cpp", 65 "LogAllocatorStats.cpp", 66 "malloc_debug.cpp", 67 "PointerData.cpp", 68 "RecordData.cpp", 69 "Unreachable.cpp", 70 "UnwindBacktrace.cpp", 71 ], 72 73 stl: "libc++_static", 74 75 static_libs: [ 76 "libasync_safe", 77 "libbase", 78 "libc_malloc_debug_backtrace", 79 "libmemunreachable", 80 ], 81 82 shared_libs: [ 83 "libunwindstack", 84 ], 85 86 multilib: { 87 lib32: { 88 version_script: "exported32.map", 89 }, 90 lib64: { 91 version_script: "exported64.map", 92 }, 93 }, 94 allow_undefined_symbols: true, 95 include_dirs: ["bionic/libc"], 96 97 sanitize: { 98 never: true, 99 }, 100 native_coverage: false, 101 102 // -Wno-error=format-zero-length needed for gcc to compile. 103 cflags: [ 104 "-Wall", 105 "-Werror", 106 "-fno-stack-protector", 107 "-Wno-error=format-zero-length", 108 "-Wthread-safety", 109 ], 110 111 apex_available: [ 112 "com.android.runtime", 113 ], 114 static: { 115 apex_available: [ 116 "//apex_available:platform", 117 ], 118 }, 119} 120 121// ============================================================== 122// Unit Tests 123// ============================================================== 124cc_test { 125 name: "malloc_debug_unit_tests", 126 test_suites: ["device-tests"], 127 isolated: true, 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 "bionic", // For SKIP_WITH_HWASAN. 175 ], 176 177 header_libs: [ 178 "bionic_libc_platform_headers", 179 ], 180 181 // The clang-analyzer-unix.Malloc and other warnings in these 182 // unit tests are either false positive or in 183 // negative tests that can be ignored. 184 tidy: false, 185 186 srcs: [ 187 "tests/malloc_debug_system_tests.cpp", 188 ], 189 190 shared_libs: [ 191 "libbase", 192 "liblog", 193 "libunwindstack", 194 ], 195 196 cflags: [ 197 "-Wall", 198 "-Werror", 199 "-O0", 200 ], 201 test_suites: ["general-tests"], 202 test_config: "tests/AndroidTest.xml", 203} 204