1// ==============================================================
2// libc_malloc_hooks.so
3// ==============================================================
4package {
5    default_team: "trendy_team_native_tools_libraries",
6    // See: http://go/android-license-faq
7    // A large-scale-change added 'default_applicable_licenses' to import
8    // all of the 'license_kinds' from "bionic_libc_license"
9    // to get the below license kinds:
10    //   SPDX-license-identifier-BSD
11    default_applicable_licenses: ["bionic_libc_license"],
12}
13
14cc_library {
15    name: "libc_malloc_hooks",
16
17    srcs: [
18        "malloc_hooks.cpp",
19    ],
20
21    static_libs: [
22        "libasync_safe",
23    ],
24
25    multilib: {
26        lib32: {
27            version_script: "exported32.map",
28        },
29        lib64: {
30            version_script: "exported64.map",
31        },
32    },
33    include_dirs: ["bionic/libc"],
34
35    sanitize: {
36        never: true,
37    },
38    native_coverage: false,
39
40    cflags: [
41        "-Wall",
42        "-Werror",
43        "-fno-stack-protector",
44    ],
45
46    apex_available: [
47        "com.android.runtime",
48    ],
49    static: {
50        apex_available: [
51            "//apex_available:platform",
52        ],
53    },
54}
55
56// ==============================================================
57// Unit Tests
58// ==============================================================
59cc_test {
60    name: "malloc_hooks_system_tests",
61    isolated: true,
62
63    // The clang-analyzer-unix.Malloc and other warnings in these
64    // unit tests are either false positive or in
65    // negative tests that can be ignored.
66    tidy: false,
67
68    srcs: [
69        "tests/malloc_hooks_tests.cpp",
70    ],
71
72    whole_static_libs: ["libc_malloc_hooks"],
73
74    shared_libs: ["libbase"],
75
76    local_include_dirs: ["tests"],
77    include_dirs: [
78        "bionic/libc",
79        "bionic",
80    ],
81    header_libs: [
82        "bionic_libc_platform_headers",
83    ],
84
85    cflags: [
86        "-Wall",
87        "-Werror",
88        "-O1", // FIXME: http://b/169206016 - issues with aligned_alloc and -O2
89    ],
90    test_suites: ["general-tests"],
91}
92