1// ==============================================================
2// libc_malloc_debug_backtrace.a
3// ==============================================================
4// Used by libmemunreachable
5cc_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
16    static_libs: ["libc_logging"],
17
18    include_dirs: ["bionic/libc"],
19    export_include_dirs: ["."],
20
21    sanitize: {
22        never: true,
23    },
24    native_coverage: false,
25
26    // -Wno-error=format-zero-length needed for gcc to compile.
27    cflags: [
28        "-Wall",
29        "-Werror",
30        "-Wno-error=format-zero-length",
31    ],
32
33}
34
35// ==============================================================
36// libc_malloc_debug.so
37// ==============================================================
38cc_library {
39    name: "libc_malloc_debug",
40
41    srcs: [
42        "BacktraceData.cpp",
43        "Config.cpp",
44        "DebugData.cpp",
45        "debug_disable.cpp",
46        "FreeTrackData.cpp",
47        "GuardData.cpp",
48        "malloc_debug.cpp",
49        "RecordData.cpp",
50        "TrackData.cpp",
51    ],
52
53    stl: "libc++_static",
54
55    // Only need this for arm since libc++ uses its own unwind code that
56    // doesn't mix with the other default unwind code.
57    arch: {
58        arm: {
59            static_libs: ["libunwind_llvm"],
60        },
61    },
62
63    static_libs: [
64        "libbase",
65        "libc_malloc_debug_backtrace",
66        "libc_logging",
67    ],
68
69    multilib: {
70        lib32: {
71            version_script: "exported32.map",
72        },
73        lib64: {
74            version_script: "exported64.map",
75        },
76    },
77    allow_undefined_symbols: true,
78    include_dirs: ["bionic/libc"],
79
80    sanitize: {
81        never: true,
82    },
83    native_coverage: false,
84
85    // -Wno-error=format-zero-length needed for gcc to compile.
86    cflags: [
87        "-Wall",
88        "-Werror",
89        "-fno-stack-protector",
90        "-Wno-error=format-zero-length",
91    ],
92
93}
94
95// ==============================================================
96// Unit Tests
97// ==============================================================
98cc_test {
99
100    name: "malloc_debug_unit_tests",
101    multilib: {
102        lib32: {
103            suffix: "32",
104        },
105        lib64: {
106            suffix: "64",
107        },
108    },
109
110    srcs: [
111        "tests/backtrace_fake.cpp",
112        "tests/log_fake.cpp",
113        "tests/libc_fake.cpp",
114        "tests/malloc_debug_config_tests.cpp",
115        "tests/malloc_debug_unit_tests.cpp",
116    ],
117
118    whole_static_libs: ["libc_malloc_debug"],
119
120    local_include_dirs: ["tests"],
121    include_dirs: ["bionic/libc"],
122
123    shared_libs: ["libbase"],
124
125    cflags: [
126        "-Wall",
127        "-Werror",
128        "-Wno-error=format-zero-length",
129    ],
130
131}
132