| 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 { | 
|  | 6 |  | 
|  | 7 | name: "libc_malloc_debug_backtrace", | 
|  | 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 |  | 
| Chih-Hung Hsieh | 0e87940 | 2018-04-16 10:50:52 -0700 | [diff] [blame] | 66 | // Clang lld link flags do not work with special link rules | 
|  | 67 | // for libunwind_llvm yet. Linked aosp_arm-eng image failed to | 
|  | 68 | // boot up in the emulator. http://b/78118944. | 
|  | 69 | use_clang_lld: false, | 
|  | 70 |  | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 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", | 
| Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 74 | "libdemangle", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 75 | "libc_malloc_debug_backtrace", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 76 | ], | 
|  | 77 |  | 
| Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 78 | shared_libs: [ | 
|  | 79 | "libunwindstack", | 
|  | 80 | ], | 
|  | 81 |  | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 82 | multilib: { | 
|  | 83 | lib32: { | 
|  | 84 | version_script: "exported32.map", | 
|  | 85 | }, | 
|  | 86 | lib64: { | 
|  | 87 | version_script: "exported64.map", | 
|  | 88 | }, | 
|  | 89 | }, | 
|  | 90 | allow_undefined_symbols: true, | 
|  | 91 | include_dirs: ["bionic/libc"], | 
|  | 92 |  | 
|  | 93 | sanitize: { | 
|  | 94 | never: true, | 
|  | 95 | }, | 
|  | 96 | native_coverage: false, | 
|  | 97 |  | 
|  | 98 | // -Wno-error=format-zero-length needed for gcc to compile. | 
|  | 99 | cflags: [ | 
|  | 100 | "-Wall", | 
|  | 101 | "-Werror", | 
|  | 102 | "-fno-stack-protector", | 
|  | 103 | "-Wno-error=format-zero-length", | 
| Christopher Ferris | 4da2503 | 2018-03-07 13:38:48 -0800 | [diff] [blame] | 104 | "-Wthread-safety", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 105 | ], | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 106 | } | 
|  | 107 |  | 
|  | 108 | // ============================================================== | 
|  | 109 | // Unit Tests | 
|  | 110 | // ============================================================== | 
|  | 111 | cc_test { | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 112 | name: "malloc_debug_unit_tests", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 113 |  | 
|  | 114 | srcs: [ | 
|  | 115 | "tests/backtrace_fake.cpp", | 
|  | 116 | "tests/log_fake.cpp", | 
|  | 117 | "tests/libc_fake.cpp", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 118 | "tests/malloc_debug_config_tests.cpp", | 
|  | 119 | "tests/malloc_debug_unit_tests.cpp", | 
|  | 120 | ], | 
|  | 121 |  | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 122 | local_include_dirs: ["tests"], | 
| Elliott Hughes | d50a1de | 2018-02-05 17:30:57 -0800 | [diff] [blame] | 123 | include_dirs: [ | 
|  | 124 | "bionic/libc", | 
|  | 125 | "bionic/libc/async_safe/include", | 
|  | 126 | ], | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 127 |  | 
| Christopher Ferris | 93bdd6a | 2018-04-05 11:12:38 -0700 | [diff] [blame] | 128 | static_libs: [ | 
|  | 129 | "libc_malloc_debug", | 
|  | 130 | "libdemangle", | 
|  | 131 | ], | 
|  | 132 |  | 
|  | 133 | shared_libs: [ | 
|  | 134 | "libbase", | 
|  | 135 | "libunwindstack", | 
|  | 136 | ], | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 137 |  | 
|  | 138 | cflags: [ | 
|  | 139 | "-Wall", | 
|  | 140 | "-Werror", | 
|  | 141 | "-Wno-error=format-zero-length", | 
| Christopher Ferris | 2e1a40a | 2018-06-13 10:46:34 -0700 | [diff] [blame] | 142 | "-O0", | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 143 | ], | 
| Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 144 | } | 
| Christopher Ferris | 97b4747 | 2018-07-10 14:45:24 -0700 | [diff] [blame] | 145 |  | 
|  | 146 | // ============================================================== | 
|  | 147 | // System Tests | 
|  | 148 | // ============================================================== | 
|  | 149 | cc_test { | 
|  | 150 | name: "malloc_debug_system_tests", | 
|  | 151 |  | 
|  | 152 | srcs: [ | 
|  | 153 | "tests/malloc_debug_system_tests.cpp", | 
|  | 154 | ], | 
|  | 155 |  | 
|  | 156 | shared_libs: [ | 
|  | 157 | "libbase", | 
|  | 158 | "liblog", | 
|  | 159 | "libunwindstack", | 
|  | 160 | ], | 
|  | 161 |  | 
|  | 162 | cflags: [ | 
|  | 163 | "-Wall", | 
|  | 164 | "-Werror", | 
|  | 165 | "-O0", | 
|  | 166 | ], | 
|  | 167 | } |