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: [ |
| 17 | "libasync_safe", |
| 18 | "libdemangle", |
| 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", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 52 | ], |
| 53 | |
| 54 | stl: "libc++_static", |
| 55 | |
| 56 | // Only need this for arm since libc++ uses its own unwind code that |
| 57 | // doesn't mix with the other default unwind code. |
| 58 | arch: { |
| 59 | arm: { |
| 60 | static_libs: ["libunwind_llvm"], |
| 61 | }, |
| 62 | }, |
| 63 | |
Chih-Hung Hsieh | 0e87940 | 2018-04-16 10:50:52 -0700 | [diff] [blame] | 64 | // Clang lld link flags do not work with special link rules |
| 65 | // for libunwind_llvm yet. Linked aosp_arm-eng image failed to |
| 66 | // boot up in the emulator. http://b/78118944. |
| 67 | use_clang_lld: false, |
| 68 | |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 69 | static_libs: [ |
Christopher Ferris | 7a3681e | 2017-04-24 17:48:32 -0700 | [diff] [blame] | 70 | "libasync_safe", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 71 | "libbase", |
| 72 | "libc_malloc_debug_backtrace", |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 73 | ], |
| 74 | |
| 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 | |
| 115 | whole_static_libs: ["libc_malloc_debug"], |
| 116 | |
| 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 | |
| 123 | shared_libs: ["libbase"], |
| 124 | |
| 125 | cflags: [ |
| 126 | "-Wall", |
| 127 | "-Werror", |
| 128 | "-Wno-error=format-zero-length", |
| 129 | ], |
Colin Cross | baa4899 | 2016-07-13 11:15:21 -0700 | [diff] [blame] | 130 | } |