xref: /aosp_15_r20/system/extras/toolchain-extras/Android.bp (revision 288bf5226967eb3dac5cce6c939ccc2a7f2b4fe5)
1package {
2    default_team: "trendy_team_android_testing_experiences",
3    default_applicable_licenses: ["Android-Apache-2.0"],
4}
5
6cc_defaults {
7    name: "libprofile-defaults",
8    srcs: [
9        "profile-extras.cpp",
10        "profile-globals.c",
11    ],
12    native_coverage: false,
13}
14
15cc_library_static {
16    name: "libprofile-extras",
17    defaults: ["libprofile-defaults"],
18
19    native_bridge_supported: true,
20    vendor_available: true,
21    product_available: true,
22    ramdisk_available: true,
23    vendor_ramdisk_available: true,
24    recovery_available: true,
25
26    stl: "none",
27    system_shared_libs: [],
28    header_libs: ["libc_headers"],
29}
30
31cc_library_static {
32    name: "libprofile-extras_ndk",
33    defaults: ["libprofile-defaults"],
34    native_bridge_supported: true,
35    vendor_available: true,
36    product_available: true,
37
38    sdk_version: "minimum",
39}
40
41cc_defaults {
42    name: "libprofile-clang-defaults",
43    srcs: [
44        "profile-clang-extras.cpp",
45        "profile-clang-openat.cpp",
46    ],
47    native_coverage: false,
48    sanitize: {
49        blocklist: "libprofile_clang_extras_blocklist.txt",
50    },
51    native_bridge_supported: true,
52    vendor_available: true,
53    product_available: true,
54}
55
56cc_defaults {
57    name: "libprofile-clang-platform-defaults",
58    defaults: ["libprofile-clang-defaults"],
59
60    ramdisk_available: true,
61    vendor_ramdisk_available: true,
62    recovery_available: true,
63
64    stl: "none",
65    system_shared_libs: [],
66    header_libs: ["libc_headers"],
67}
68
69// -----------------------------------------------------------------------------
70// libprofile-clang libraries for regular coverage. They also install a signal
71// handler that writes coverage data to disk.
72// -----------------------------------------------------------------------------
73
74cc_library_static {
75    name: "libprofile-clang-extras",
76    defaults: ["libprofile-clang-platform-defaults"],
77    apex_available: [
78        "//apex_available:platform",
79        "//apex_available:anyapex",
80    ],
81}
82
83cc_library_static {
84    name: "libprofile-clang-extras_ndk",
85    defaults: ["libprofile-clang-defaults"],
86
87    sdk_version: "minimum",
88}
89
90cc_library_static {
91    name: "libprofile-clang-extras_cfi_support",
92    defaults: ["libprofile-clang-platform-defaults"],
93    apex_available: [
94        "//apex_available:platform",
95        "//apex_available:anyapex",
96    ],
97    sanitize: {
98        cfi: true,
99        config: {
100            cfi_assembly_support: true,
101        },
102    },
103}
104
105// -----------------------------------------------------------------------------
106// libprofile-clang libraries for continuous coverage. They install a no-op
107// signal handler.
108// -----------------------------------------------------------------------------
109
110cc_defaults {
111    name: "profile-extras-continuous-mode",
112    cflags: ["-D__CONTINUOUS_COVERAGE_MODE__"],
113}
114
115cc_library_static {
116    name: "libprofile-clang-extras_continuous",
117    defaults: [
118        "libprofile-clang-platform-defaults",
119        "profile-extras-continuous-mode",
120    ],
121}
122
123cc_library_static {
124    name: "libprofile-clang-extras_ndk_continuous",
125    defaults: [
126        "libprofile-clang-platform-defaults",
127        "profile-extras-continuous-mode",
128    ],
129
130    sdk_version: "minimum",
131}
132
133cc_library_static {
134    name: "libprofile-clang-extras_cfi_support_continuous",
135    defaults: [
136        "libprofile-clang-platform-defaults",
137        "profile-extras-continuous-mode",
138    ],
139
140    sanitize: {
141        cfi: true,
142        config: {
143            cfi_assembly_support: true,
144        },
145    },
146}
147
148// -----------------------------------------------------------------------------
149// tests
150// -----------------------------------------------------------------------------
151cc_test {
152    name: "libprofile-extras-test",
153    srcs: [
154        "profile-extras-test.cpp",
155    ],
156    static_libs: [
157        "libprofile-extras",
158    ],
159    ldflags: ["-uinit_profile_extras"],
160    native_coverage: false,
161}
162
163cc_test {
164    name: "libprofile-clang-extras-test",
165    srcs: [
166        "profile-clang-extras-test.cpp",
167    ],
168    whole_static_libs: [
169        "libprofile-clang-extras",
170    ],
171    ldflags: [
172        "-Wl,--wrap,open",
173    ],
174    native_coverage: false,
175}
176