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