| 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", | 
|  | 19 | "libdemangle", | 
|  | 20 | ], | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 21 |  | 
|  | 22 | include_dirs: ["bionic/libc"], | 
| Christopher Ferris | 7a3681e | 2017-04-24 17:48:32 -0700 | [diff] [blame] | 23 |  | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 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 | ], | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 37 | } | 
|  | 38 |  | 
|  | 39 | // ============================================================== | 
|  | 40 | // libc_malloc_debug.so | 
|  | 41 | // ============================================================== | 
|  | 42 | cc_library { | 
|  | 43 | name: "libc_malloc_debug", | 
|  | 44 |  | 
|  | 45 | srcs: [ | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 46 | "Config.cpp", | 
|  | 47 | "DebugData.cpp", | 
|  | 48 | "debug_disable.cpp", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 49 | "GuardData.cpp", | 
|  | 50 | "malloc_debug.cpp", | 
| Christopher Ferris | 4da2503 | 2018-03-07 13:38:48 -0800 | [diff] [blame] | 51 | "PointerData.cpp", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 52 | "RecordData.cpp", | 
| Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 53 | "UnwindBacktrace.cpp", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 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: [ | 
| Christopher Ferris | 7a3681e | 2017-04-24 17:48:32 -0700 | [diff] [blame] | 67 | "libasync_safe", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 68 | "libbase", | 
| Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 69 | "libdemangle", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 70 | "libc_malloc_debug_backtrace", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 71 | ], | 
|  | 72 |  | 
| Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 73 | shared_libs: [ | 
|  | 74 | "libunwindstack", | 
|  | 75 | ], | 
|  | 76 |  | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 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", | 
| Christopher Ferris | 4da2503 | 2018-03-07 13:38:48 -0800 | [diff] [blame] | 99 | "-Wthread-safety", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 100 | ], | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 101 | } | 
|  | 102 |  | 
|  | 103 | // ============================================================== | 
|  | 104 | // Unit Tests | 
|  | 105 | // ============================================================== | 
|  | 106 | cc_test { | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 107 | name: "malloc_debug_unit_tests", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 108 |  | 
|  | 109 | srcs: [ | 
|  | 110 | "tests/backtrace_fake.cpp", | 
|  | 111 | "tests/log_fake.cpp", | 
|  | 112 | "tests/libc_fake.cpp", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 113 | "tests/malloc_debug_config_tests.cpp", | 
|  | 114 | "tests/malloc_debug_unit_tests.cpp", | 
|  | 115 | ], | 
|  | 116 |  | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 117 | local_include_dirs: ["tests"], | 
| Elliott Hughes | d50a1de | 2018-02-05 17:30:57 -0800 | [diff] [blame] | 118 | include_dirs: [ | 
|  | 119 | "bionic/libc", | 
|  | 120 | "bionic/libc/async_safe/include", | 
|  | 121 | ], | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 122 |  | 
| Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 123 | static_libs: [ | 
|  | 124 | "libc_malloc_debug", | 
|  | 125 | "libdemangle", | 
| Christopher Ferris | 6c619a0 | 2019-03-01 17:59:51 -0800 | [diff] [blame] | 126 | "libtinyxml2", | 
| Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 127 | ], | 
|  | 128 |  | 
|  | 129 | shared_libs: [ | 
|  | 130 | "libbase", | 
|  | 131 | "libunwindstack", | 
|  | 132 | ], | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 133 |  | 
|  | 134 | cflags: [ | 
|  | 135 | "-Wall", | 
|  | 136 | "-Werror", | 
|  | 137 | "-Wno-error=format-zero-length", | 
| Christopher Ferris | 2e1a40a | 2018-06-13 10:46:34 -0700 | [diff] [blame] | 138 | "-O0", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 139 | ], | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 140 | } | 
| Christopher Ferris | 97b4747 | 2018-07-10 14:45:24 -0700 | [diff] [blame] | 141 |  | 
|  | 142 | // ============================================================== | 
|  | 143 | // System Tests | 
|  | 144 | // ============================================================== | 
|  | 145 | cc_test { | 
|  | 146 | name: "malloc_debug_system_tests", | 
|  | 147 |  | 
| Christopher Ferris | 1fc5ccf | 2019-02-15 18:06:15 -0800 | [diff] [blame] | 148 | include_dirs: ["bionic/libc"], | 
|  | 149 |  | 
| Christopher Ferris | 97b4747 | 2018-07-10 14:45:24 -0700 | [diff] [blame] | 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 | } |