1 // ============================================================== 2 // libc_malloc_debug_backtrace.a 3 // ============================================================== 4 // Used by libmemunreachable 5 cc_library_static { 6 7 name: "libc_malloc_debug_backtrace", 8 9 srcs: [ 10 "backtrace.cpp", 11 "MapData.cpp", 12 ], 13 14 stl: "libc++_static", 15 16 whole_static_libs: [ 17 "libbase", 18 "libasync_safe", 19 "libdemangle", 20 ], 21 22 include_dirs: ["bionic/libc"], 23 24 export_include_dirs: ["."], 25 26 sanitize: { 27 never: true, 28 }, 29 native_coverage: false, 30 31 // -Wno-error=format-zero-length needed for gcc to compile. 32 cflags: [ 33 "-Wall", 34 "-Werror", 35 "-Wno-error=format-zero-length", 36 ], 37 } 38 39 // ============================================================== 40 // libc_malloc_debug.so 41 // ============================================================== 42 cc_library { 43 name: "libc_malloc_debug", 44 45 srcs: [ 46 "Config.cpp", 47 "DebugData.cpp", 48 "debug_disable.cpp", 49 "GuardData.cpp", 50 "malloc_debug.cpp", 51 "PointerData.cpp", 52 "RecordData.cpp", 53 "UnwindBacktrace.cpp", 54 ], 55 56 stl: "libc++_static", 57 58 // Only need this for arm since libc++ uses its own unwind code that 59 // doesn't mix with the other default unwind code. 60 arch: { 61 arm: { 62 static_libs: ["libunwind_llvm"], 63 }, 64 }, 65 66 static_libs: [ 67 "libasync_safe", 68 "libbase", 69 "libdemangle", 70 "libc_malloc_debug_backtrace", 71 ], 72 73 shared_libs: [ 74 "libunwindstack", 75 ], 76 77 multilib: { 78 lib32: { 79 version_script: "exported32.map", 80 }, 81 lib64: { 82 version_script: "exported64.map", 83 }, 84 }, 85 allow_undefined_symbols: true, 86 include_dirs: ["bionic/libc"], 87 88 sanitize: { 89 never: true, 90 }, 91 native_coverage: false, 92 93 // -Wno-error=format-zero-length needed for gcc to compile. 94 cflags: [ 95 "-Wall", 96 "-Werror", 97 "-fno-stack-protector", 98 "-Wno-error=format-zero-length", 99 "-Wthread-safety", 100 ], 101 } 102 103 // ============================================================== 104 // Unit Tests 105 // ============================================================== 106 cc_test { 107 name: "malloc_debug_unit_tests", 108 109 srcs: [ 110 "tests/backtrace_fake.cpp", 111 "tests/log_fake.cpp", 112 "tests/libc_fake.cpp", 113 "tests/malloc_debug_config_tests.cpp", 114 "tests/malloc_debug_unit_tests.cpp", 115 ], 116 117 local_include_dirs: ["tests"], 118 include_dirs: [ 119 "bionic/libc", 120 "bionic/libc/async_safe/include", 121 ], 122 123 static_libs: [ 124 "libc_malloc_debug", 125 "libdemangle", 126 "libtinyxml2", 127 ], 128 129 shared_libs: [ 130 "libbase", 131 "libunwindstack", 132 ], 133 134 cflags: [ 135 "-Wall", 136 "-Werror", 137 "-Wno-error=format-zero-length", 138 "-O0", 139 ], 140 } 141 142 // ============================================================== 143 // System Tests 144 // ============================================================== 145 cc_test { 146 name: "malloc_debug_system_tests", 147 148 include_dirs: ["bionic/libc"], 149 150 srcs: [ 151 "tests/malloc_debug_system_tests.cpp", 152 ], 153 154 shared_libs: [ 155 "libbase", 156 "liblog", 157 "libunwindstack", 158 ], 159 160 cflags: [ 161 "-Wall", 162 "-Werror", 163 "-O0", 164 ], 165 } 166