Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 1 | // ============================================================== |
| 2 | // libc_malloc_debug_backtrace.a |
| 3 | // ============================================================== |
| 4 | // Used by libmemunreachable |
| 5 | cc_library_static { |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 6 | name: "libc_malloc_debug_backtrace", |
Colin Cross | b9667b5 | 2019-05-17 13:45:18 -0700 | [diff] [blame] | 7 | vendor_available: true, |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 8 | |
| 9 | srcs: [ |
| 10 | "backtrace.cpp", |
| 11 | "MapData.cpp", |
| 12 | ], |
| 13 | |
| 14 | stl: "libc++_static", |
| 15 | |
Elliott Hughes | d50a1de | 2018-02-05 17:30:57 -0800 | [diff] [blame] | 16 | whole_static_libs: [ |
Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 17 | "libbase", |
Elliott Hughes | d50a1de | 2018-02-05 17:30:57 -0800 | [diff] [blame] | 18 | "libasync_safe", |
Elliott Hughes | d50a1de | 2018-02-05 17:30:57 -0800 | [diff] [blame] | 19 | ], |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 20 | |
| 21 | include_dirs: ["bionic/libc"], |
Christopher Ferris | 7a3681e | 2017-04-24 17:48:32 -0700 | [diff] [blame] | 22 | |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 23 | export_include_dirs: ["."], |
| 24 | |
| 25 | sanitize: { |
| 26 | never: true, |
| 27 | }, |
| 28 | native_coverage: false, |
| 29 | |
Dan Albert | 4ea1921 | 2019-07-23 13:31:14 -0700 | [diff] [blame] | 30 | target: { |
| 31 | android: { |
| 32 | static_libs: ["libc++demangle"], |
| 33 | }, |
| 34 | }, |
| 35 | |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 36 | // -Wno-error=format-zero-length needed for gcc to compile. |
| 37 | cflags: [ |
| 38 | "-Wall", |
| 39 | "-Werror", |
| 40 | "-Wno-error=format-zero-length", |
| 41 | ], |
Jiyong Park | e87e0dc | 2019-10-02 17:09:33 +0900 | [diff] [blame^] | 42 | |
| 43 | apex_available: [ |
| 44 | "//apex_available:platform", |
| 45 | "com.android.runtime", |
| 46 | ], |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | // ============================================================== |
| 50 | // libc_malloc_debug.so |
| 51 | // ============================================================== |
| 52 | cc_library { |
| 53 | name: "libc_malloc_debug", |
| 54 | |
| 55 | srcs: [ |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 56 | "Config.cpp", |
| 57 | "DebugData.cpp", |
| 58 | "debug_disable.cpp", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 59 | "GuardData.cpp", |
| 60 | "malloc_debug.cpp", |
Christopher Ferris | 4da2503 | 2018-03-07 13:38:48 -0800 | [diff] [blame] | 61 | "PointerData.cpp", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 62 | "RecordData.cpp", |
Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 63 | "UnwindBacktrace.cpp", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 64 | ], |
| 65 | |
| 66 | stl: "libc++_static", |
| 67 | |
| 68 | // Only need this for arm since libc++ uses its own unwind code that |
| 69 | // doesn't mix with the other default unwind code. |
| 70 | arch: { |
| 71 | arm: { |
| 72 | static_libs: ["libunwind_llvm"], |
| 73 | }, |
| 74 | }, |
| 75 | |
| 76 | static_libs: [ |
Christopher Ferris | 7a3681e | 2017-04-24 17:48:32 -0700 | [diff] [blame] | 77 | "libasync_safe", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 78 | "libbase", |
| 79 | "libc_malloc_debug_backtrace", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 80 | ], |
| 81 | |
Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 82 | shared_libs: [ |
| 83 | "libunwindstack", |
| 84 | ], |
| 85 | |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 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", |
Christopher Ferris | 4da2503 | 2018-03-07 13:38:48 -0800 | [diff] [blame] | 108 | "-Wthread-safety", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 109 | ], |
Jiyong Park | e87e0dc | 2019-10-02 17:09:33 +0900 | [diff] [blame^] | 110 | |
| 111 | apex_available: [ |
| 112 | "//apex_available:platform", |
| 113 | "com.android.runtime", |
| 114 | ], |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | // ============================================================== |
| 118 | // Unit Tests |
| 119 | // ============================================================== |
| 120 | cc_test { |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 121 | name: "malloc_debug_unit_tests", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 122 | |
| 123 | srcs: [ |
| 124 | "tests/backtrace_fake.cpp", |
| 125 | "tests/log_fake.cpp", |
| 126 | "tests/libc_fake.cpp", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 127 | "tests/malloc_debug_config_tests.cpp", |
| 128 | "tests/malloc_debug_unit_tests.cpp", |
| 129 | ], |
| 130 | |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 131 | local_include_dirs: ["tests"], |
Elliott Hughes | d50a1de | 2018-02-05 17:30:57 -0800 | [diff] [blame] | 132 | include_dirs: [ |
| 133 | "bionic/libc", |
| 134 | "bionic/libc/async_safe/include", |
| 135 | ], |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 136 | |
Christopher Ferris | 2b0638e | 2019-09-11 19:05:29 -0700 | [diff] [blame] | 137 | header_libs: [ |
| 138 | "bionic_libc_platform_headers", |
| 139 | ], |
| 140 | |
Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 141 | static_libs: [ |
| 142 | "libc_malloc_debug", |
Christopher Ferris | 6c619a0 | 2019-03-01 17:59:51 -0800 | [diff] [blame] | 143 | "libtinyxml2", |
Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 144 | ], |
| 145 | |
| 146 | shared_libs: [ |
| 147 | "libbase", |
| 148 | "libunwindstack", |
| 149 | ], |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 150 | |
| 151 | cflags: [ |
| 152 | "-Wall", |
| 153 | "-Werror", |
| 154 | "-Wno-error=format-zero-length", |
Christopher Ferris | 2e1a40a | 2018-06-13 10:46:34 -0700 | [diff] [blame] | 155 | "-O0", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 156 | ], |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 157 | } |
Christopher Ferris | 97b4747 | 2018-07-10 14:45:24 -0700 | [diff] [blame] | 158 | |
| 159 | // ============================================================== |
| 160 | // System Tests |
| 161 | // ============================================================== |
| 162 | cc_test { |
| 163 | name: "malloc_debug_system_tests", |
| 164 | |
Christopher Ferris | 2b0638e | 2019-09-11 19:05:29 -0700 | [diff] [blame] | 165 | include_dirs: [ |
| 166 | "bionic/libc", |
| 167 | ], |
| 168 | |
| 169 | header_libs: [ |
| 170 | "bionic_libc_platform_headers", |
| 171 | ], |
Christopher Ferris | 1fc5ccf | 2019-02-15 18:06:15 -0800 | [diff] [blame] | 172 | |
Christopher Ferris | 97b4747 | 2018-07-10 14:45:24 -0700 | [diff] [blame] | 173 | srcs: [ |
| 174 | "tests/malloc_debug_system_tests.cpp", |
| 175 | ], |
| 176 | |
| 177 | shared_libs: [ |
| 178 | "libbase", |
| 179 | "liblog", |
| 180 | "libunwindstack", |
| 181 | ], |
| 182 | |
| 183 | cflags: [ |
| 184 | "-Wall", |
| 185 | "-Werror", |
| 186 | "-O0", |
| 187 | ], |
| 188 | } |