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 | ], |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | // ============================================================== |
| 45 | // libc_malloc_debug.so |
| 46 | // ============================================================== |
| 47 | cc_library { |
| 48 | name: "libc_malloc_debug", |
| 49 | |
| 50 | srcs: [ |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 51 | "Config.cpp", |
| 52 | "DebugData.cpp", |
| 53 | "debug_disable.cpp", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 54 | "GuardData.cpp", |
| 55 | "malloc_debug.cpp", |
Christopher Ferris | 4da2503 | 2018-03-07 13:38:48 -0800 | [diff] [blame] | 56 | "PointerData.cpp", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 57 | "RecordData.cpp", |
Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 58 | "UnwindBacktrace.cpp", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 59 | ], |
| 60 | |
| 61 | stl: "libc++_static", |
| 62 | |
| 63 | // Only need this for arm since libc++ uses its own unwind code that |
| 64 | // doesn't mix with the other default unwind code. |
| 65 | arch: { |
| 66 | arm: { |
| 67 | static_libs: ["libunwind_llvm"], |
| 68 | }, |
| 69 | }, |
| 70 | |
| 71 | static_libs: [ |
Christopher Ferris | 7a3681e | 2017-04-24 17:48:32 -0700 | [diff] [blame] | 72 | "libasync_safe", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 73 | "libbase", |
| 74 | "libc_malloc_debug_backtrace", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 75 | ], |
| 76 | |
Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 77 | shared_libs: [ |
| 78 | "libunwindstack", |
| 79 | ], |
| 80 | |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 81 | multilib: { |
| 82 | lib32: { |
| 83 | version_script: "exported32.map", |
| 84 | }, |
| 85 | lib64: { |
| 86 | version_script: "exported64.map", |
| 87 | }, |
| 88 | }, |
| 89 | allow_undefined_symbols: true, |
| 90 | include_dirs: ["bionic/libc"], |
| 91 | |
| 92 | sanitize: { |
| 93 | never: true, |
| 94 | }, |
| 95 | native_coverage: false, |
| 96 | |
| 97 | // -Wno-error=format-zero-length needed for gcc to compile. |
| 98 | cflags: [ |
| 99 | "-Wall", |
| 100 | "-Werror", |
| 101 | "-fno-stack-protector", |
| 102 | "-Wno-error=format-zero-length", |
Christopher Ferris | 4da2503 | 2018-03-07 13:38:48 -0800 | [diff] [blame] | 103 | "-Wthread-safety", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 104 | ], |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | // ============================================================== |
| 108 | // Unit Tests |
| 109 | // ============================================================== |
| 110 | cc_test { |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 111 | name: "malloc_debug_unit_tests", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 112 | |
| 113 | srcs: [ |
| 114 | "tests/backtrace_fake.cpp", |
| 115 | "tests/log_fake.cpp", |
| 116 | "tests/libc_fake.cpp", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 117 | "tests/malloc_debug_config_tests.cpp", |
| 118 | "tests/malloc_debug_unit_tests.cpp", |
| 119 | ], |
| 120 | |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 121 | local_include_dirs: ["tests"], |
Elliott Hughes | d50a1de | 2018-02-05 17:30:57 -0800 | [diff] [blame] | 122 | include_dirs: [ |
| 123 | "bionic/libc", |
| 124 | "bionic/libc/async_safe/include", |
| 125 | ], |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 126 | |
Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 127 | static_libs: [ |
| 128 | "libc_malloc_debug", |
Christopher Ferris | 6c619a0 | 2019-03-01 17:59:51 -0800 | [diff] [blame] | 129 | "libtinyxml2", |
Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 130 | ], |
| 131 | |
| 132 | shared_libs: [ |
| 133 | "libbase", |
| 134 | "libunwindstack", |
| 135 | ], |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 136 | |
| 137 | cflags: [ |
| 138 | "-Wall", |
| 139 | "-Werror", |
| 140 | "-Wno-error=format-zero-length", |
Christopher Ferris | 2e1a40a | 2018-06-13 10:46:34 -0700 | [diff] [blame] | 141 | "-O0", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 142 | ], |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 143 | } |
Christopher Ferris | 97b4747 | 2018-07-10 14:45:24 -0700 | [diff] [blame] | 144 | |
| 145 | // ============================================================== |
| 146 | // System Tests |
| 147 | // ============================================================== |
| 148 | cc_test { |
| 149 | name: "malloc_debug_system_tests", |
| 150 | |
Christopher Ferris | 1fc5ccf | 2019-02-15 18:06:15 -0800 | [diff] [blame] | 151 | include_dirs: ["bionic/libc"], |
| 152 | |
Christopher Ferris | 97b4747 | 2018-07-10 14:45:24 -0700 | [diff] [blame] | 153 | srcs: [ |
| 154 | "tests/malloc_debug_system_tests.cpp", |
| 155 | ], |
| 156 | |
| 157 | shared_libs: [ |
| 158 | "libbase", |
| 159 | "liblog", |
| 160 | "libunwindstack", |
| 161 | ], |
| 162 | |
| 163 | cflags: [ |
| 164 | "-Wall", |
| 165 | "-Werror", |
| 166 | "-O0", |
| 167 | ], |
| 168 | } |