blob: 40215a7f6fec955bb878e86a2143833d511cf659 [file] [log] [blame]
Bob Badouraa7d8352021-02-19 13:06:22 -08001package {
2 default_applicable_licenses: ["bionic_libc_license"],
3}
4
5license {
6 name: "bionic_libc_license",
7 visibility: [":__subpackages__"],
8 license_kinds: [
9 "SPDX-license-identifier-Apache-2.0",
10 "SPDX-license-identifier-BSD",
11 "SPDX-license-identifier-ISC",
12 "SPDX-license-identifier-MIT",
13 "legacy_notice",
14 "legacy_unencumbered",
15 ],
16 license_text: [
17 "NOTICE",
18 ],
19}
20
Elliott Hughes53cf3482016-08-09 13:06:41 -070021libc_common_flags = [
22 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080023 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070024 "-Wall",
25 "-Wextra",
26 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080027 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070028 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070029 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070030 "-Wframe-larger-than=2048",
Christopher Ferris1de7a482023-09-12 11:06:29 -070031 "-Wno-reorder-init-list",
Elliott Hughes53cf3482016-08-09 13:06:41 -070032
33 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
34 "-Werror=pointer-to-int-cast",
35 "-Werror=int-to-pointer-cast",
36 "-Werror=type-limits",
37 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080038
39 // Clang's exit-time destructor registration hides __dso_handle, but
40 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
41 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080042
Elliott Hughesa13d0662021-12-02 14:42:16 -080043 // We know clang does a lot of harm by rewriting what we've said, and sadly
44 // never see any good it does, so let's just ask it to do what we say...
45 // (The specific motivating example was clang turning a loop that would only
46 // ever touch 0, 1, or 2 bytes into a call to memset, which was never going
47 // to amortize.)
48 "-fno-builtin",
Elliott Hughes53cf3482016-08-09 13:06:41 -070049]
50
Dan Willemsen208ae172015-09-16 16:33:27 -070051// Define some common cflags
52// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070053cc_defaults {
54 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080055 defaults: ["linux_bionic_supported"],
Christopher Ferrisb5425052024-04-23 17:15:39 -070056 cflags: libc_common_flags + [
57 "-DUSE_SCUDO",
58 ],
Elliott Hughes53cf3482016-08-09 13:06:41 -070059 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070060 conlyflags: ["-std=gnu99"],
61 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070062 include_dirs: [
63 "bionic/libc/async_safe/include",
Peter Collingbourne5d3aa862020-09-11 15:05:17 -070064 "bionic/libc/platform",
Tom Cherry379ed1e2020-09-17 09:36:25 -070065 // For android_filesystem_config.h.
66 "system/core/libcutils/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070067 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070068
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010069 header_libs: [
70 "libc_headers",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +000071 "liblog_headers", // needed by bionic/libc/async_safe/include
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010072 ],
73 export_header_lib_headers: [
74 "libc_headers",
75 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -080076
Colin Cross50c21ab2015-10-31 23:03:05 -070077 stl: "none",
78 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070079 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070080 address: false,
81 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070082 // TODO(b/132640749): Fix broken fuzzer support.
83 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070084 },
Yifan Hong5a39cee2020-01-21 16:43:56 -080085 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -070086 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090087 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020088 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080089
Yi Konge3d90de2019-02-20 14:28:56 -080090 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
91 // warning since this is intended right now.
92 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070093
94 product_variables: {
Evgenii Stepanov5a73e032020-04-29 14:59:44 -070095 malloc_zero_contents: {
96 cflags: ["-DSCUDO_ZERO_CONTENTS"],
97 },
98 malloc_pattern_fill_contents: {
99 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
100 },
Christopher Ferrisb5425052024-04-23 17:15:39 -0700101 malloc_low_memory: {
102 cflags: ["-UUSE_SCUDO"],
Steven Morelandfb65ee42020-07-31 00:18:38 +0000103 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700104 },
Yi Kong9e33b762021-10-29 02:43:22 +0800105
106 lto: {
107 never: true,
108 },
Elliott Hughesc2043342023-07-20 20:24:09 +0000109
110 apex_available: ["com.android.runtime"],
Elliott Hughes7d136662023-10-27 15:40:32 -0700111
112 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700113}
114
Elliott Hughes788075a2024-06-18 12:25:37 +0000115// Workaround for b/24465209.
116// We're unlikely to be able to remove this before we just
117// remove ILP32 support completely.
118// Note that we also still have `pack_relocations: false`
119// for both libc and libm, even on LP64.
120// ========================================================
121cc_defaults {
122 name: "bug_24465209_workaround",
123 arch: {
124 arm: {
125 pack_relocations: false,
126 ldflags: ["-Wl,--hash-style=both"],
127 },
128 x86: {
129 pack_relocations: false,
130 ldflags: ["-Wl,--hash-style=both"],
131 }
132 },
133}
134
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700135// Defaults for native allocator libs/includes to make it
136// easier to change.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700137// ========================================================
138cc_defaults {
139 name: "libc_native_allocator_defaults",
140
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700141 whole_static_libs: [
Christopher Ferrisb5425052024-04-23 17:15:39 -0700142 "libscudo",
143 ],
144 cflags: [
145 "-DUSE_SCUDO",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700146 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800147 header_libs: ["gwp_asan_headers"],
Christopher Ferrisb5425052024-04-23 17:15:39 -0700148 product_variables: {
149 malloc_low_memory: {
150 cflags: ["-UUSE_SCUDO"],
151 whole_static_libs: [
152 "libjemalloc5",
153 "libc_jemalloc_wrapper",
154 ],
155 exclude_static_libs: [
156 "libscudo",
157 ],
158 },
159 },
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700160}
161
162// Functions not implemented by jemalloc directly, or that need to
163// be modified for Android.
164cc_library_static {
165 name: "libc_jemalloc_wrapper",
166 defaults: ["libc_defaults"],
167 srcs: ["bionic/jemalloc_wrapper.cpp"],
168 cflags: ["-fvisibility=hidden"],
169
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800170 // Used to pull in the jemalloc include directory so that if the
171 // library is removed, the include directory is also removed.
172 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700173}
174
Dan Willemsen208ae172015-09-16 16:33:27 -0700175// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700176// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700177// ========================================================
178//
Ryan Prichard249757b2019-11-01 17:18:28 -0700179// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
180// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
181// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
182// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700183
184cc_library_static {
185
Colin Crossa3f9fca2016-01-11 13:20:55 -0800186 srcs: [
187 "bionic/__libc_init_main_thread.cpp",
188 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700189 "bionic/bionic_call_ifunc_resolver.cpp",
190 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800191 ],
192 arch: {
193 arm64: {
194 srcs: ["arch-arm64/bionic/__set_tls.c"],
195 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000196 riscv64: {
197 srcs: ["arch-riscv64/bionic/__set_tls.c"],
198 },
Colin Crossa3f9fca2016-01-11 13:20:55 -0800199 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700200 srcs: [
201 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Pirama Arumuga Nainar7b89be72021-02-12 15:09:49 -0800202 "arch-x86/bionic/__libc_int0x80.S",
Ryan Prichard27475b52018-05-17 17:14:18 -0700203 "arch-x86/bionic/__set_tls.cpp",
204 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800205 },
206 x86_64: {
207 srcs: ["arch-x86_64/bionic/__set_tls.c"],
208 },
209 },
210
Colin Cross50c21ab2015-10-31 23:03:05 -0700211 defaults: ["libc_defaults"],
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000212 cflags: [
213 "-fno-stack-protector",
214 "-ffreestanding",
215 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700216 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700217}
218
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800219filegroup {
220 name: "elf_note_sources",
221 srcs: ["bionic/elf_note.cpp"],
222}
223
Ryan Prichard249757b2019-11-01 17:18:28 -0700224// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
225// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
226// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800227
228cc_library_static {
229 name: "libc_init_static",
230 defaults: ["libc_defaults"],
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800231 srcs: [
232 "bionic/libc_init_static.cpp",
233 ":elf_note_sources",
234 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700235 cflags: [
236 "-fno-stack-protector",
237
238 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
239 // from the linker before ifunc resolvers have made string.h functions available.
240 "-ffreestanding",
241 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800242}
243
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700244cc_library_static {
245 name: "libc_init_dynamic",
246 defaults: ["libc_defaults"],
247 srcs: ["bionic/libc_init_dynamic.cpp"],
248 cflags: ["-fno-stack-protector"],
249}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800250
Dan Willemsen208ae172015-09-16 16:33:27 -0700251// ========================================================
252// libc_tzcode.a - upstream 'tzcode' code
253// ========================================================
254
255cc_library_static {
256
Colin Cross50c21ab2015-10-31 23:03:05 -0700257 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700258 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800259 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700260 "tzcode/bionic.cpp",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700261 // tzcode doesn't include strptime, so we use a fork of the
262 // OpenBSD code which needs this global data.
Elliott Hughesd3627a42022-12-06 22:24:27 +0000263 "upstream-openbsd/lib/libc/locale/_def_time.c",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700264 // tzcode doesn't include wcsftime, so we use the FreeBSD code.
265 "upstream-freebsd/lib/libc/locale/wcsftime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700266 ],
267
Colin Cross50c21ab2015-10-31 23:03:05 -0700268 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700269 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700270 // Don't use ridiculous amounts of stack.
271 "-DALL_STATE",
272 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
273 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800274 // Obviously, we want to be thread-safe.
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000275 "-DTHREAD_SAFE=1",
Dan Willemsen208ae172015-09-16 16:33:27 -0700276 // The name of the tm_gmtoff field in our struct tm.
277 "-DTM_GMTOFF=tm_gmtoff",
Elliott Hughes31fc69f2023-06-20 15:36:11 -0700278 // Android uses a system property instead of /etc/localtime, so make callers crash.
Almaz Mingaleeva52a0da2022-02-28 16:55:50 +0000279 "-DTZDEFAULT=NULL",
Dan Willemsen208ae172015-09-16 16:33:27 -0700280 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700281 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700282 // Include `tzname`, `timezone`, and `daylight` globals.
283 "-DHAVE_POSIX_DECLS=0",
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000284 "-DUSG_COMPAT=2",
285 "-DHAVE_TZNAME=2",
286 // stdbool.h is available
287 "-DHAVE_STDBOOL_H",
Colin Crossa35d23d2015-11-19 13:32:49 -0800288 // Use the empty string (instead of " ") as the timezone abbreviation
289 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700290 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700291 "-Dlint",
292 ],
293
Elliott Hughes2bd43162023-06-15 13:17:08 -0700294 local_include_dirs: [
295 "tzcode/",
296 "upstream-freebsd/android/include",
297 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700298 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700299}
300
301// ========================================================
302// libc_dns.a - modified NetBSD DNS code
303// ========================================================
304
305cc_library_static {
306
Colin Cross50c21ab2015-10-31 23:03:05 -0700307 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700308 srcs: [
Elliott Hughesd0bbfa82021-04-08 11:58:51 -0700309 "dns/**/*.c*",
Dan Willemsen208ae172015-09-16 16:33:27 -0700310
311 "upstream-netbsd/lib/libc/isc/ev_streams.c",
312 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700313 ],
314
Colin Cross50c21ab2015-10-31 23:03:05 -0700315 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700316 "-DANDROID_CHANGES",
317 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700318 "-Wno-unused-parameter",
319 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700320 "-Wframe-larger-than=66000",
Elliott Hughese1dc4f62021-01-11 11:51:29 -0800321 "-include private/bsd_sys_param.h",
Dan Willemsen208ae172015-09-16 16:33:27 -0700322 ],
323
Dan Willemsen208ae172015-09-16 16:33:27 -0700324 local_include_dirs: [
325 "dns/include",
326 "private",
327 "upstream-netbsd/lib/libc/include",
328 "upstream-netbsd/android/include",
329 ],
330
331 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700332}
333
334// ========================================================
335// libc_freebsd.a - upstream FreeBSD C library code
336// ========================================================
337//
338// These files are built with the freebsd-compat.h header file
339// automatically included.
340
341cc_library_static {
Elliott Hughesc2043342023-07-20 20:24:09 +0000342 name: "libc_freebsd_ldexp",
343 defaults: ["libc_defaults"],
344 cflags: ["-Dscalbn=ldexp"],
345 srcs: [":libc_ldexp_srcs"],
346}
347
348cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700349 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700350 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700351 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700352 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
353 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
354 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
355 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700356 "upstream-freebsd/lib/libc/stdlib/qsort.c",
357 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700358 "upstream-freebsd/lib/libc/string/wcpcpy.c",
359 "upstream-freebsd/lib/libc/string/wcpncpy.c",
360 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700361 "upstream-freebsd/lib/libc/string/wcscat.c",
362 "upstream-freebsd/lib/libc/string/wcschr.c",
363 "upstream-freebsd/lib/libc/string/wcscmp.c",
364 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700365 "upstream-freebsd/lib/libc/string/wcscspn.c",
366 "upstream-freebsd/lib/libc/string/wcsdup.c",
367 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700368 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700369 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
370 "upstream-freebsd/lib/libc/string/wcsncat.c",
371 "upstream-freebsd/lib/libc/string/wcsncmp.c",
372 "upstream-freebsd/lib/libc/string/wcsncpy.c",
373 "upstream-freebsd/lib/libc/string/wcsnlen.c",
374 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700375 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700376 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700377 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700378 "upstream-freebsd/lib/libc/string/wcstok.c",
379 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700380 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700381 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700382 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800383 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700384 ],
385 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700386 x86: {
387 exclude_srcs: [
388 "upstream-freebsd/lib/libc/string/wcschr.c",
389 "upstream-freebsd/lib/libc/string/wcscmp.c",
390 "upstream-freebsd/lib/libc/string/wcslen.c",
391 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700392 "upstream-freebsd/lib/libc/string/wmemcmp.c",
393 "upstream-freebsd/lib/libc/string/wcscat.c",
394 "upstream-freebsd/lib/libc/string/wcscpy.c",
395 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700396 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700397 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700398 },
399
Colin Cross50c21ab2015-10-31 23:03:05 -0700400 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700401 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700402 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700403 "-include freebsd-compat.h",
404 ],
405
Dan Willemsen208ae172015-09-16 16:33:27 -0700406 local_include_dirs: [
407 "upstream-freebsd/android/include",
408 ],
409
410 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700411}
412
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700413cc_library_static {
414 defaults: ["libc_defaults"],
415 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700416 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700417 ],
418
419 cflags: [
420 "-Wno-sign-compare",
421 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700422 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700423 ],
424
425 local_include_dirs: [
426 "upstream-freebsd/android/include",
427 ],
428
429 name: "libc_freebsd_large_stack",
430}
431
Dan Willemsen208ae172015-09-16 16:33:27 -0700432// ========================================================
433// libc_netbsd.a - upstream NetBSD C library code
434// ========================================================
435//
436// These files are built with the netbsd-compat.h header file
437// automatically included.
438
439cc_library_static {
440
Colin Cross50c21ab2015-10-31 23:03:05 -0700441 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700442 srcs: [
443 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700444 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700445 "upstream-netbsd/lib/libc/gen/psignal.c",
446 "upstream-netbsd/lib/libc/gen/utime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700447 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
448 "upstream-netbsd/lib/libc/regex/regcomp.c",
449 "upstream-netbsd/lib/libc/regex/regerror.c",
450 "upstream-netbsd/lib/libc/regex/regexec.c",
451 "upstream-netbsd/lib/libc/regex/regfree.c",
452 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700453 "upstream-netbsd/lib/libc/stdlib/drand48.c",
454 "upstream-netbsd/lib/libc/stdlib/erand48.c",
455 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
456 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700457 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
458 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
459 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
460 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
461 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
462 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
463 "upstream-netbsd/lib/libc/stdlib/seed48.c",
464 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700465 ],
466 multilib: {
467 lib32: {
468 // LP32 cruft
469 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
470 },
471 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700472 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700473 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800474 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700475 "-DPOSIX_MISTAKE",
476 "-include netbsd-compat.h",
477 ],
478
Dan Willemsen208ae172015-09-16 16:33:27 -0700479 local_include_dirs: [
480 "upstream-netbsd/android/include",
481 "upstream-netbsd/lib/libc/include",
482 ],
483
484 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700485}
486
487// ========================================================
Elliott Hughes968adf92024-02-08 13:15:53 -0800488// libc_openbsd.a - upstream OpenBSD C library code
Dan Willemsen208ae172015-09-16 16:33:27 -0700489// ========================================================
490//
491// These files are built with the openbsd-compat.h header file
492// automatically included.
Dan Willemsen208ae172015-09-16 16:33:27 -0700493cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700494 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700495 srcs: [
Elliott Hughes968adf92024-02-08 13:15:53 -0800496 "upstream-openbsd/lib/libc/crypt/arc4random.c",
497 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700498 "upstream-openbsd/lib/libc/gen/alarm.c",
499 "upstream-openbsd/lib/libc/gen/ctype_.c",
500 "upstream-openbsd/lib/libc/gen/daemon.c",
501 "upstream-openbsd/lib/libc/gen/err.c",
502 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700503 "upstream-openbsd/lib/libc/gen/fnmatch.c",
504 "upstream-openbsd/lib/libc/gen/ftok.c",
505 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700506 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700507 "upstream-openbsd/lib/libc/gen/verr.c",
508 "upstream-openbsd/lib/libc/gen/verrx.c",
509 "upstream-openbsd/lib/libc/gen/vwarn.c",
510 "upstream-openbsd/lib/libc/gen/vwarnx.c",
511 "upstream-openbsd/lib/libc/gen/warn.c",
512 "upstream-openbsd/lib/libc/gen/warnx.c",
513 "upstream-openbsd/lib/libc/locale/btowc.c",
514 "upstream-openbsd/lib/libc/locale/mbrlen.c",
515 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
516 "upstream-openbsd/lib/libc/locale/mbtowc.c",
517 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700518 "upstream-openbsd/lib/libc/locale/wcstombs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700519 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
520 "upstream-openbsd/lib/libc/locale/wctob.c",
521 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700522 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700523 "upstream-openbsd/lib/libc/net/htonl.c",
524 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700525 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
526 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
527 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700528 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
529 "upstream-openbsd/lib/libc/net/inet_ntop.c",
530 "upstream-openbsd/lib/libc/net/inet_pton.c",
531 "upstream-openbsd/lib/libc/net/ntohl.c",
532 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800533 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700534 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700535 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
536 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700537 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700538 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700539 "upstream-openbsd/lib/libc/stdio/fputwc.c",
540 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700541 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700542 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700543 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700544 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/stdio/makebuf.c",
546 "upstream-openbsd/lib/libc/stdio/mktemp.c",
547 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
548 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700549 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700550 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700551 "upstream-openbsd/lib/libc/stdio/ungetc.c",
552 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
553 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
554 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700555 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
556 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
557 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700558 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700559 "upstream-openbsd/lib/libc/stdio/wsetup.c",
560 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800561 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700562 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700563 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700564 "upstream-openbsd/lib/libc/stdlib/insque.c",
565 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
566 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
567 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800568 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700569 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800570 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700571 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughes26b06072020-07-31 11:00:10 -0700572 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700573 "upstream-openbsd/lib/libc/stdlib/remque.c",
574 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700575 "upstream-openbsd/lib/libc/stdlib/tfind.c",
576 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800577 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700578 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800579 "upstream-openbsd/lib/libc/string/strcasestr.c",
580 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700581 "upstream-openbsd/lib/libc/string/strcspn.c",
582 "upstream-openbsd/lib/libc/string/strdup.c",
583 "upstream-openbsd/lib/libc/string/strndup.c",
584 "upstream-openbsd/lib/libc/string/strpbrk.c",
585 "upstream-openbsd/lib/libc/string/strsep.c",
586 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700587 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800588 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700589 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700590 "upstream-openbsd/lib/libc/string/wcswidth.c",
Colin Cross69bcb8b2021-09-08 13:24:16 -0700591
592 // This file is originally from OpenBSD, and benefits from
593 // being compiled with openbsd-compat.h.
Elliott Hughes968adf92024-02-08 13:15:53 -0800594 // TODO: clean this up instead.
Colin Cross69bcb8b2021-09-08 13:24:16 -0700595 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700596 ],
597
Elliott Hughes7d136662023-10-27 15:40:32 -0700598 // Each architecture has optimized versions of some routines,
599 // and only includes the portable C versions of ones it's missing.
Dan Willemsen208ae172015-09-16 16:33:27 -0700600 arch: {
601 arm: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700602 srcs: [
603 "upstream-openbsd/lib/libc/string/memchr.c",
604 "upstream-openbsd/lib/libc/string/memrchr.c",
605 "upstream-openbsd/lib/libc/string/stpncpy.c",
606 "upstream-openbsd/lib/libc/string/strlcat.c",
607 "upstream-openbsd/lib/libc/string/strlcpy.c",
608 "upstream-openbsd/lib/libc/string/strncat.c",
609 "upstream-openbsd/lib/libc/string/strncmp.c",
610 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700611 ],
612 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700613 arm64: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700614 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700615 "upstream-openbsd/lib/libc/string/strcat.c",
Elliott Hughesaefe9992023-11-08 12:04:41 -0800616 "upstream-openbsd/lib/libc/string/stpncpy.c",
Elliott Hughes7d136662023-10-27 15:40:32 -0700617 "upstream-openbsd/lib/libc/string/strlcat.c",
618 "upstream-openbsd/lib/libc/string/strlcpy.c",
619 "upstream-openbsd/lib/libc/string/strncat.c",
620 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700621 ],
622 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000623 riscv64: {
624 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700625 "upstream-openbsd/lib/libc/string/memrchr.c",
626 "upstream-openbsd/lib/libc/string/stpncpy.c",
627 "upstream-openbsd/lib/libc/string/strlcat.c",
628 "upstream-openbsd/lib/libc/string/strlcpy.c",
Elliott Hughesebc19a92022-10-14 23:25:36 +0000629 ],
630 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700631 x86: {
Elliott Hughesaefe9992023-11-08 12:04:41 -0800632 srcs: [
633 // x86 has custom implementations of all of these.
634 ],
Elliott Hughes7d136662023-10-27 15:40:32 -0700635 },
636 x86_64: {
637 srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800638 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800639 "upstream-openbsd/lib/libc/string/memrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700640 "upstream-openbsd/lib/libc/string/strlcat.c",
641 "upstream-openbsd/lib/libc/string/strlcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800642 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700643 },
644 },
645
Colin Cross50c21ab2015-10-31 23:03:05 -0700646 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700647 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700648 "-Wno-unused-parameter",
649 "-include openbsd-compat.h",
650 ],
651
Dan Willemsen208ae172015-09-16 16:33:27 -0700652 local_include_dirs: [
653 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700654 "upstream-openbsd/android/include",
Elliott Hughes968adf92024-02-08 13:15:53 -0800655 "stdio",
656 "upstream-openbsd/lib/libc/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700657 ],
658
659 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700660}
661
Elliott Hughes968adf92024-02-08 13:15:53 -0800662cc_library_static {
663 name: "libc_openbsd_large_stack",
664 defaults: ["libc_defaults"],
665 srcs: [
666 "stdio/vfprintf.cpp",
667 "stdio/vfwprintf.cpp",
668 "upstream-openbsd/lib/libc/string/memmem.c",
669 "upstream-openbsd/lib/libc/string/strstr.c",
670 ],
671 cflags: [
672 "-include openbsd-compat.h",
673 "-Wno-sign-compare",
674 "-Wframe-larger-than=5000",
675 ],
676
677 local_include_dirs: [
678 "private",
679 "upstream-openbsd/android/include/",
680 "upstream-openbsd/lib/libc/gdtoa/",
681 "upstream-openbsd/lib/libc/include/",
682 "upstream-openbsd/lib/libc/stdio/",
683 ],
684}
685
Dan Willemsen208ae172015-09-16 16:33:27 -0700686// ========================================================
687// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
688// ========================================================
689//
690// These files are built with the openbsd-compat.h header file
691// automatically included.
692
693cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700694 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700695 srcs: [
696 "upstream-openbsd/android/gdtoa_support.cpp",
697 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
698 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
699 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
700 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
701 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
702 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
703 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
704 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
705 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
706 "upstream-openbsd/lib/libc/gdtoa/misc.c",
707 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
708 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
709 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
710 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
711 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
712 "upstream-openbsd/lib/libc/gdtoa/sum.c",
713 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
714 ],
715 multilib: {
716 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800717 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700718 },
719 },
720
Colin Cross50c21ab2015-10-31 23:03:05 -0700721 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700722 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700723 "-include openbsd-compat.h",
724 ],
725
Dan Willemsen208ae172015-09-16 16:33:27 -0700726 local_include_dirs: [
727 "private",
728 "upstream-openbsd/android/include",
729 "upstream-openbsd/lib/libc/include",
730 ],
731
732 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700733}
734
735// ========================================================
Pierre-Clément Tosi467e58e2023-02-01 13:44:43 +0000736// libc_fortify.a - container for our FORTIFY
George Burgess IV6cb06872017-07-21 13:28:42 -0700737// implementation details
738// ========================================================
739cc_library_static {
740 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700741 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700742
743 name: "libc_fortify",
744
745 // Disable FORTIFY for the compilation of these, so we don't end up having
746 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800747 cflags: [
748 "-U_FORTIFY_SOURCE",
749 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
750 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700751
752 arch: {
753 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800754 cflags: [
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800755 "-DRENAME___STRCAT_CHK",
756 "-DRENAME___STRCPY_CHK",
757 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700758 srcs: [
759 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800760
761 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
762 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
763
764 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
765 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
766
767 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
768 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
769
770 "arch-arm/krait/bionic/__strcat_chk.S",
771 "arch-arm/krait/bionic/__strcpy_chk.S",
772
773 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
774 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
775
Haibo Huang01bfd892018-12-03 15:05:16 -0800776 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
777 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700778 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700779 },
780 arm64: {
781 srcs: [
Elliott Hughes023e4e72022-11-17 19:27:02 +0000782 "arch-arm64/string/__memcpy_chk.S",
783 "arch-arm64/string/__memset_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700784 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700785 },
caowenchengab457f92023-03-06 14:57:55 +0800786 riscv64: {
787 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000788 "arch-riscv64/string/__memset_chk.S",
789 "arch-riscv64/string/__memcpy_chk.S",
caowenchengab457f92023-03-06 14:57:55 +0800790 ],
791 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700792 },
793}
794
795// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700796// libc_bionic.a - home-grown C library code
797// ========================================================
798
799cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700800 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700801 srcs: [
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800802 "bionic/NetdClientDispatch.cpp",
803 "bionic/__bionic_get_shell_path.cpp",
804 "bionic/__cmsg_nxthdr.cpp",
805 "bionic/__cxa_thread_atexit_impl.cpp",
806 "bionic/__errno.cpp",
807 "bionic/__gnu_basename.cpp",
808 "bionic/__libc_current_sigrtmax.cpp",
809 "bionic/__libc_current_sigrtmin.cpp",
810 "bionic/abort.cpp",
811 "bionic/accept.cpp",
812 "bionic/access.cpp",
Florian Mayerca4749a2024-02-14 12:55:46 -0800813 "bionic/android_crash_detail.cpp",
Josh Gao10ec9282017-04-03 15:13:29 -0700814 "bionic/android_set_abort_message.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000815 "bionic/android_unsafe_frame_pointer_chase.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800816 "bionic/arpa_inet.cpp",
817 "bionic/assert.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000818 "bionic/atexit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800819 "bionic/atof.cpp",
820 "bionic/bionic_allocator.cpp",
821 "bionic/bionic_arc4random.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000822 "bionic/bionic_elf_tls.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800823 "bionic/bionic_futex.cpp",
824 "bionic/bionic_netlink.cpp",
825 "bionic/bionic_systrace.cpp",
826 "bionic/bionic_time_conversions.cpp",
827 "bionic/brk.cpp",
828 "bionic/c16rtomb.cpp",
829 "bionic/c32rtomb.cpp",
830 "bionic/chmod.cpp",
831 "bionic/chown.cpp",
832 "bionic/clearenv.cpp",
833 "bionic/clock.cpp",
834 "bionic/clock_getcpuclockid.cpp",
835 "bionic/clock_nanosleep.cpp",
836 "bionic/clone.cpp",
837 "bionic/ctype.cpp",
838 "bionic/dirent.cpp",
839 "bionic/dup.cpp",
840 "bionic/environ.cpp",
841 "bionic/error.cpp",
842 "bionic/eventfd.cpp",
843 "bionic/exec.cpp",
844 "bionic/execinfo.cpp",
Elliott Hughes69bd8e92024-02-09 10:04:26 -0800845 "bionic/exit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800846 "bionic/faccessat.cpp",
847 "bionic/fchmod.cpp",
848 "bionic/fchmodat.cpp",
849 "bionic/fcntl.cpp",
850 "bionic/fdsan.cpp",
851 "bionic/fdtrack.cpp",
852 "bionic/ffs.cpp",
853 "bionic/fgetxattr.cpp",
854 "bionic/flistxattr.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000855 "bionic/fork.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800856 "bionic/fpclassify.cpp",
857 "bionic/fsetxattr.cpp",
858 "bionic/ftruncate.cpp",
859 "bionic/ftw.cpp",
860 "bionic/futimens.cpp",
861 "bionic/getcwd.cpp",
862 "bionic/getdomainname.cpp",
863 "bionic/getentropy.cpp",
864 "bionic/gethostname.cpp",
865 "bionic/getloadavg.cpp",
866 "bionic/getpagesize.cpp",
867 "bionic/getpgrp.cpp",
868 "bionic/getpid.cpp",
869 "bionic/getpriority.cpp",
870 "bionic/gettid.cpp",
871 "bionic/get_device_api_level.cpp",
872 "bionic/grp_pwd.cpp",
873 "bionic/grp_pwd_file.cpp",
874 "bionic/heap_zero_init.cpp",
875 "bionic/iconv.cpp",
876 "bionic/icu_wrappers.cpp",
877 "bionic/ifaddrs.cpp",
878 "bionic/inotify_init.cpp",
879 "bionic/ioctl.cpp",
Elliott Hughes17e40682024-02-13 16:32:29 -0800880 "bionic/isatty.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800881 "bionic/killpg.cpp",
882 "bionic/langinfo.cpp",
883 "bionic/lchown.cpp",
884 "bionic/lfs64_support.cpp",
885 "bionic/libc_init_common.cpp",
886 "bionic/libgen.cpp",
887 "bionic/link.cpp",
888 "bionic/locale.cpp",
889 "bionic/lockf.cpp",
890 "bionic/lstat.cpp",
891 "bionic/mblen.cpp",
892 "bionic/mbrtoc16.cpp",
893 "bionic/mbrtoc32.cpp",
894 "bionic/mempcpy.cpp",
895 "bionic/memset_explicit.cpp",
896 "bionic/mkdir.cpp",
897 "bionic/mkfifo.cpp",
898 "bionic/mknod.cpp",
899 "bionic/mntent.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800900 "bionic/netdb.cpp",
Elliott Hughes3ed6e722024-02-16 01:18:01 +0000901 "bionic/net_if.cpp",
902 "bionic/netinet_ether.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800903 "bionic/netinet_in.cpp",
904 "bionic/nl_types.cpp",
905 "bionic/open.cpp",
906 "bionic/pathconf.cpp",
907 "bionic/pause.cpp",
908 "bionic/pidfd.cpp",
909 "bionic/pipe.cpp",
910 "bionic/poll.cpp",
911 "bionic/posix_fadvise.cpp",
912 "bionic/posix_fallocate.cpp",
913 "bionic/posix_madvise.cpp",
914 "bionic/posix_timers.cpp",
915 "bionic/preadv_pwritev.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000916 "bionic/pthread_atfork.cpp",
917 "bionic/pthread_attr.cpp",
918 "bionic/pthread_barrier.cpp",
919 "bionic/pthread_cond.cpp",
920 "bionic/pthread_create.cpp",
921 "bionic/pthread_detach.cpp",
922 "bionic/pthread_equal.cpp",
923 "bionic/pthread_exit.cpp",
924 "bionic/pthread_getcpuclockid.cpp",
925 "bionic/pthread_getschedparam.cpp",
926 "bionic/pthread_gettid_np.cpp",
927 "bionic/pthread_internal.cpp",
928 "bionic/pthread_join.cpp",
929 "bionic/pthread_key.cpp",
930 "bionic/pthread_kill.cpp",
931 "bionic/pthread_mutex.cpp",
932 "bionic/pthread_once.cpp",
933 "bionic/pthread_rwlock.cpp",
934 "bionic/pthread_sigqueue.cpp",
935 "bionic/pthread_self.cpp",
936 "bionic/pthread_setname_np.cpp",
937 "bionic/pthread_setschedparam.cpp",
938 "bionic/pthread_spinlock.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800939 "bionic/ptrace.cpp",
940 "bionic/pty.cpp",
941 "bionic/raise.cpp",
942 "bionic/rand.cpp",
943 "bionic/readlink.cpp",
944 "bionic/realpath.cpp",
945 "bionic/reboot.cpp",
946 "bionic/recv.cpp",
947 "bionic/recvmsg.cpp",
948 "bionic/rename.cpp",
949 "bionic/rmdir.cpp",
950 "bionic/scandir.cpp",
Elliott Hughes17e40682024-02-13 16:32:29 -0800951 "bionic/sched_cpualloc.cpp",
952 "bionic/sched_cpucount.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800953 "bionic/sched_getaffinity.cpp",
954 "bionic/sched_getcpu.cpp",
955 "bionic/semaphore.cpp",
956 "bionic/send.cpp",
957 "bionic/setegid.cpp",
958 "bionic/seteuid.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000959 "bionic/setjmp_cookie.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800960 "bionic/setpgrp.cpp",
961 "bionic/sigaction.cpp",
962 "bionic/signal.cpp",
963 "bionic/sigprocmask.cpp",
964 "bionic/sleep.cpp",
965 "bionic/socketpair.cpp",
966 "bionic/spawn.cpp",
967 "bionic/stat.cpp",
968 "bionic/stdlib_l.cpp",
969 "bionic/strerror.cpp",
970 "bionic/string_l.cpp",
971 "bionic/strings_l.cpp",
972 "bionic/strsignal.cpp",
973 "bionic/strtol.cpp",
974 "bionic/strtold.cpp",
975 "bionic/swab.cpp",
976 "bionic/symlink.cpp",
977 "bionic/sync_file_range.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000978 "bionic/sysconf.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800979 "bionic/sys_epoll.cpp",
980 "bionic/sys_msg.cpp",
981 "bionic/sys_sem.cpp",
982 "bionic/sys_shm.cpp",
983 "bionic/sys_signalfd.cpp",
984 "bionic/sys_statfs.cpp",
985 "bionic/sys_statvfs.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000986 "bionic/sys_thread_properties.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800987 "bionic/sys_time.cpp",
988 "bionic/sysinfo.cpp",
989 "bionic/syslog.cpp",
Elliott Hughes69bd8e92024-02-09 10:04:26 -0800990 "bionic/sysprop_helpers.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800991 "bionic/system.cpp",
992 "bionic/system_property_api.cpp",
993 "bionic/system_property_set.cpp",
994 "bionic/tdestroy.cpp",
995 "bionic/termios.cpp",
996 "bionic/thread_private.cpp",
997 "bionic/threads.cpp",
998 "bionic/time.cpp",
999 "bionic/time_l.cpp",
1000 "bionic/tmpfile.cpp",
1001 "bionic/umount.cpp",
1002 "bionic/unlink.cpp",
1003 "bionic/usleep.cpp",
1004 "bionic/utmp.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001005 "bionic/vdso.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001006 "bionic/wait.cpp",
1007 "bionic/wchar.cpp",
1008 "bionic/wchar_l.cpp",
1009 "bionic/wcstod.cpp",
1010 "bionic/wctype.cpp",
1011 "bionic/wcwidth.cpp",
1012 "bionic/wmempcpy.cpp",
1013
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001014 // Forked but not yet cleaned up/rewritten stdio code.
1015 // TODO: finish cleanup.
1016 "stdio/fmemopen.cpp",
1017 "stdio/parsefloat.c",
1018 "stdio/refill.c",
1019 "stdio/stdio.cpp",
1020 "stdio/stdio_ext.cpp",
1021 "stdio/vfscanf.cpp",
1022 "stdio/vfwscanf.cpp",
1023
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001024 // TODO: why isn't this in a static-libc-only module?
1025 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1026 // which will be overridden by the actual one in libc.so.
1027 "bionic/icu_static.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001028 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001029
1030 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001031 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -07001032 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001033 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -08001034 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001035 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001036 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001037 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001038 "arch-arm/bionic/atomics_arm.c",
1039 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -08001040 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001041 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001042 "arch-arm/bionic/setjmp.S",
1043 "arch-arm/bionic/syscall.S",
1044 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001045
Haibo Huangea9957a2018-11-19 11:00:32 -08001046 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001047 "arch-arm/cortex-a7/bionic/memset.S",
1048
1049 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001050 "arch-arm/cortex-a9/bionic/memset.S",
1051 "arch-arm/cortex-a9/bionic/stpcpy.S",
1052 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001053 "arch-arm/cortex-a9/bionic/strcpy.S",
1054 "arch-arm/cortex-a9/bionic/strlen.S",
1055
Elliott Hughesaefe9992023-11-08 12:04:41 -08001056 "arch-arm/cortex-a15/bionic/memcpy.S",
1057 "arch-arm/cortex-a15/bionic/memmove.S",
1058 "arch-arm/cortex-a15/bionic/memset.S",
1059 "arch-arm/cortex-a15/bionic/stpcpy.S",
1060 "arch-arm/cortex-a15/bionic/strcat.S",
1061 "arch-arm/cortex-a15/bionic/strcmp.S",
1062 "arch-arm/cortex-a15/bionic/strcpy.S",
1063 "arch-arm/cortex-a15/bionic/strlen.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001064
1065 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001066
Haibo Huang01bfd892018-12-03 15:05:16 -08001067 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001068
Elliott Hughesaefe9992023-11-08 12:04:41 -08001069 "arch-arm/generic/bionic/memcmp.S",
1070 "arch-arm/generic/bionic/memmove.S",
1071 "arch-arm/generic/bionic/memset.S",
1072 "arch-arm/generic/bionic/stpcpy.c",
1073 "arch-arm/generic/bionic/strcat.c",
1074 "arch-arm/generic/bionic/strcmp.S",
1075 "arch-arm/generic/bionic/strcpy.S",
1076 "arch-arm/generic/bionic/strlen.c",
1077
1078 "arch-arm/krait/bionic/memcpy.S",
1079 "arch-arm/krait/bionic/memset.S",
1080
Haibo Huangea9957a2018-11-19 11:00:32 -08001081 "arch-arm/kryo/bionic/memcpy.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001082
1083 "bionic/strchr.cpp",
1084 "bionic/strchrnul.cpp",
1085 "bionic/strnlen.cpp",
1086 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001087 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001088 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001089 arm64: {
1090 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001091 "arch-arm64/bionic/__bionic_clone.S",
1092 "arch-arm64/bionic/_exit_with_stack_teardown.S",
1093 "arch-arm64/bionic/setjmp.S",
1094 "arch-arm64/bionic/syscall.S",
1095 "arch-arm64/bionic/vfork.S",
Vaisakh K V83e55842024-03-29 12:47:39 +05301096 "arch-arm64/oryon/memcpy-nt.S",
Vaisakh K V54a61212024-03-29 13:32:45 +05301097 "arch-arm64/oryon/memset-nt.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001098 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001099 },
1100
Elliott Hughesebc19a92022-10-14 23:25:36 +00001101 riscv64: {
1102 srcs: [
1103 "arch-riscv64/bionic/__bionic_clone.S",
1104 "arch-riscv64/bionic/_exit_with_stack_teardown.S",
Elliott Hughese1905ed2022-10-17 23:23:36 +00001105 "arch-riscv64/bionic/setjmp.S",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001106 "arch-riscv64/bionic/syscall.S",
1107 "arch-riscv64/bionic/vfork.S",
Yun Hsiang40a82d02023-05-26 10:10:40 +08001108
Elliott Hughesaefe9992023-11-08 12:04:41 -08001109 "arch-riscv64/string/memchr_v.S",
1110 "arch-riscv64/string/memcmp_v.S",
1111 "arch-riscv64/string/memcpy_v.S",
1112 "arch-riscv64/string/memmove_v.S",
1113 "arch-riscv64/string/memset_v.S",
1114 "arch-riscv64/string/stpcpy_v.S",
1115 "arch-riscv64/string/strcat_v.S",
1116 "arch-riscv64/string/strchr_v.S",
1117 "arch-riscv64/string/strcmp_v.S",
1118 "arch-riscv64/string/strcpy_v.S",
1119 "arch-riscv64/string/strlen_v.S",
1120 "arch-riscv64/string/strncat_v.S",
1121 "arch-riscv64/string/strncmp_v.S",
1122 "arch-riscv64/string/strncpy_v.S",
1123 "arch-riscv64/string/strnlen_v.S",
1124
1125 "arch-riscv64/string/memchr.c",
1126 "arch-riscv64/string/memcmp.c",
1127 "arch-riscv64/string/memcpy.c",
1128 "arch-riscv64/string/memmove.c",
1129 "arch-riscv64/string/memset.c",
1130 "arch-riscv64/string/stpcpy.c",
1131 "arch-riscv64/string/strcat.c",
1132 "arch-riscv64/string/strchr.c",
1133 "arch-riscv64/string/strcmp.c",
1134 "arch-riscv64/string/strcpy.c",
1135 "arch-riscv64/string/strlen.c",
1136 "arch-riscv64/string/strncat.c",
1137 "arch-riscv64/string/strncmp.c",
1138 "arch-riscv64/string/strncpy.c",
1139 "arch-riscv64/string/strnlen.c",
Prashanth Swaminathana4d71022023-10-30 17:35:19 -07001140
Elliott Hughes7d136662023-10-27 15:40:32 -07001141 "bionic/strchrnul.cpp",
1142 "bionic/strrchr.cpp",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001143 ],
1144 },
1145
Dan Willemsen208ae172015-09-16 16:33:27 -07001146 x86: {
1147 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001148 "arch-x86/bionic/__bionic_clone.S",
1149 "arch-x86/bionic/_exit_with_stack_teardown.S",
1150 "arch-x86/bionic/libcrt_compat.c",
Elliott Hughes7d136662023-10-27 15:40:32 -07001151 "arch-x86/bionic/setjmp.S",
1152 "arch-x86/bionic/syscall.S",
1153 "arch-x86/bionic/vfork.S",
1154 "arch-x86/bionic/__x86.get_pc_thunk.S",
1155
Dan Willemsen208ae172015-09-16 16:33:27 -07001156 "arch-x86/generic/string/memcmp.S",
1157 "arch-x86/generic/string/strcmp.S",
1158 "arch-x86/generic/string/strncmp.S",
1159 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001160
1161 "arch-x86/generic/string/strlcat.c",
1162 "arch-x86/generic/string/strlcpy.c",
1163 "arch-x86/generic/string/strncat.c",
1164 "arch-x86/generic/string/wcscat.c",
1165 "arch-x86/generic/string/wcscpy.c",
1166 "arch-x86/generic/string/wmemcmp.c",
1167
Elliott Hughesed777142022-07-25 16:25:11 +00001168 "arch-x86/string/sse2-memchr-atom.S",
1169 "arch-x86/string/sse2-memmove-slm.S",
1170 "arch-x86/string/sse2-memrchr-atom.S",
1171 "arch-x86/string/sse2-memset-atom.S",
1172 "arch-x86/string/sse2-memset-slm.S",
1173 "arch-x86/string/sse2-stpcpy-slm.S",
1174 "arch-x86/string/sse2-stpncpy-slm.S",
1175 "arch-x86/string/sse2-strchr-atom.S",
1176 "arch-x86/string/sse2-strcpy-slm.S",
1177 "arch-x86/string/sse2-strlen-slm.S",
1178 "arch-x86/string/sse2-strncpy-slm.S",
1179 "arch-x86/string/sse2-strnlen-atom.S",
1180 "arch-x86/string/sse2-strrchr-atom.S",
1181 "arch-x86/string/sse2-wcschr-atom.S",
1182 "arch-x86/string/sse2-wcsrchr-atom.S",
1183 "arch-x86/string/sse2-wcslen-atom.S",
1184 "arch-x86/string/sse2-wcscmp-atom.S",
1185 "arch-x86/string/sse2-strlen-atom.S",
1186
1187 "arch-x86/string/ssse3-memcmp-atom.S",
1188 "arch-x86/string/ssse3-memmove-atom.S",
1189 "arch-x86/string/ssse3-strcat-atom.S",
1190 "arch-x86/string/ssse3-strcmp-atom.S",
1191 "arch-x86/string/ssse3-strcpy-atom.S",
1192 "arch-x86/string/ssse3-strlcat-atom.S",
1193 "arch-x86/string/ssse3-strlcpy-atom.S",
1194 "arch-x86/string/ssse3-strncat-atom.S",
1195 "arch-x86/string/ssse3-strncmp-atom.S",
1196 "arch-x86/string/ssse3-strncpy-atom.S",
1197 "arch-x86/string/ssse3-wcscat-atom.S",
1198 "arch-x86/string/ssse3-wcscpy-atom.S",
1199 "arch-x86/string/ssse3-wmemcmp-atom.S",
1200
1201 "arch-x86/string/sse4-memcmp-slm.S",
1202 "arch-x86/string/sse4-wmemcmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001203
1204 "bionic/strchrnul.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001205 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001206 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001207 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001208 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001209 "arch-x86_64/bionic/__bionic_clone.S",
1210 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1211 "arch-x86_64/bionic/__restore_rt.S",
1212 "arch-x86_64/bionic/setjmp.S",
1213 "arch-x86_64/bionic/syscall.S",
1214 "arch-x86_64/bionic/vfork.S",
1215
ahs919fb7f2022-06-10 07:11:14 +05301216 "arch-x86_64/string/avx2-memset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001217 "arch-x86_64/string/sse2-memmove-slm.S",
1218 "arch-x86_64/string/sse2-memset-slm.S",
1219 "arch-x86_64/string/sse2-stpcpy-slm.S",
1220 "arch-x86_64/string/sse2-stpncpy-slm.S",
1221 "arch-x86_64/string/sse2-strcat-slm.S",
1222 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001223 "arch-x86_64/string/sse2-strlen-slm.S",
1224 "arch-x86_64/string/sse2-strncat-slm.S",
1225 "arch-x86_64/string/sse2-strncpy-slm.S",
1226 "arch-x86_64/string/sse4-memcmp-slm.S",
1227 "arch-x86_64/string/ssse3-strcmp-slm.S",
1228 "arch-x86_64/string/ssse3-strncmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001229
1230 "bionic/strchr.cpp",
1231 "bionic/strchrnul.cpp",
1232 "bionic/strnlen.cpp",
1233 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001234 ],
1235 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001236 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001237
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001238 multilib: {
1239 lib32: {
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001240 srcs: [
1241 // off64_t/time64_t support on LP32.
1242 "bionic/legacy_32_bit_support.cpp",
1243 "bionic/time64.c",
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001244 ],
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001245 },
1246 },
1247
1248 local_include_dirs: ["stdio"],
1249 generated_headers: ["generated_android_ids"],
1250
1251 whole_static_libs: [
1252 "libsystemproperties",
1253 ],
1254
Colin Cross50c21ab2015-10-31 23:03:05 -07001255 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001256 include_dirs: ["bionic/libstdc++/include"],
1257 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001258}
1259
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001260genrule {
1261 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001262 out: ["generated_android_ids.h"],
1263 srcs: [":android_filesystem_config_header"],
Cole Faustb1a0a9d2023-11-28 17:51:16 -08001264 tools: ["fs_config_generator"],
1265 cmd: "$(location fs_config_generator) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001266}
1267
Dan Willemsen268a6732015-10-15 14:49:45 -07001268// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001269// libc_syscalls.a
1270// ========================================================
1271
Elliott Hughes782c4852019-04-16 12:31:00 -07001272genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001273 name: "syscalls-arm",
Elliott Hughes782c4852019-04-16 12:31:00 -07001274 out: ["syscalls-arm.S"],
1275 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001276 tools: ["gensyscalls"],
1277 cmd: "$(location gensyscalls) arm $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001278}
1279
1280genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001281 name: "syscalls-arm64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001282 out: ["syscalls-arm64.S"],
1283 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001284 tools: ["gensyscalls"],
1285 cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001286}
1287
1288genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001289 name: "syscalls-riscv64",
Elliott Hughes704772b2022-10-10 17:06:43 +00001290 out: ["syscalls-riscv64.S"],
1291 srcs: ["SYSCALLS.TXT"],
1292 tools: ["gensyscalls"],
1293 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
1294}
1295
1296genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001297 name: "syscalls-x86",
Elliott Hughes782c4852019-04-16 12:31:00 -07001298 out: ["syscalls-x86.S"],
1299 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001300 tools: ["gensyscalls"],
1301 cmd: "$(location gensyscalls) x86 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001302}
1303
1304genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001305 name: "syscalls-x86_64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001306 out: ["syscalls-x86_64.S"],
1307 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001308 tools: ["gensyscalls"],
1309 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001310}
1311
Dan Willemsen208ae172015-09-16 16:33:27 -07001312cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001313 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001314 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001315 arch: {
1316 arm: {
Cole Faustf5968d82023-04-11 15:20:19 -07001317 srcs: [":syscalls-arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001318 },
1319 arm64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001320 srcs: [":syscalls-arm64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001321 },
Elliott Hughes704772b2022-10-10 17:06:43 +00001322 riscv64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001323 srcs: [":syscalls-riscv64"],
Elliott Hughes704772b2022-10-10 17:06:43 +00001324 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001325 x86: {
Cole Faustf5968d82023-04-11 15:20:19 -07001326 srcs: [":syscalls-x86"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001327 },
1328 x86_64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001329 srcs: [":syscalls-x86_64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001330 },
1331 },
1332 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001333}
1334
1335// ========================================================
1336// libc_aeabi.a
1337// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1338// to avoid infinite recursion. For the other architectures we just build an
1339// empty library to keep this makefile simple.
1340// ========================================================
1341
1342cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001343 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001344 arch: {
1345 arm: {
1346 srcs: ["arch-arm/bionic/__aeabi.c"],
1347 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001348 },
1349 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001350 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001351}
1352
1353// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001354// libc_common.a --- everything shared by libc.a and libc.so
Dan Willemsen208ae172015-09-16 16:33:27 -07001355// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001356
Dan Willemsen208ae172015-09-16 16:33:27 -07001357cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001358 defaults: ["libc_defaults"],
Elliott Hughesb0948922024-01-26 00:28:12 +00001359 name: "libc_common",
1360
Dan Willemsen208ae172015-09-16 16:33:27 -07001361 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001362 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001363 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001364 "libc_bionic",
Ryan Prichard249757b2019-11-01 17:18:28 -07001365 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001366 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001367 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001368 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001369 "libc_freebsd_large_stack",
Elliott Hughesc2043342023-07-20 20:24:09 +00001370 "libc_freebsd_ldexp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001371 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001372 "libc_netbsd",
1373 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001374 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001375 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001376 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001377 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001378 ],
1379
1380 arch: {
1381 arm: {
1382 whole_static_libs: ["libc_aeabi"],
1383 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001384 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001385}
1386
1387// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001388// libc_static_dispatch.a --- libc.a ifuncs
Haibo Huangf71edfa2018-11-12 10:06:56 -08001389// ========================================================
1390cc_library_static {
1391 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001392 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001393
Haibo Huangb9244ff2018-08-11 10:12:13 -07001394 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301395 x86_64: {
1396 srcs: ["arch-x86_64/static_function_dispatch.S"],
1397 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001398 x86: {
1399 srcs: ["arch-x86/static_function_dispatch.S"],
1400 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001401 arm: {
1402 srcs: ["arch-arm/static_function_dispatch.S"],
1403 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001404 arm64: {
1405 srcs: ["arch-arm64/static_function_dispatch.S"],
1406 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001407 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001408 srcs: ["arch-riscv64/static_function_dispatch.S"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001409 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001410 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001411}
1412
1413// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001414// libc_dynamic_dispatch.a --- libc.so ifuncs
Haibo Huangf71edfa2018-11-12 10:06:56 -08001415// ========================================================
1416cc_library_static {
1417 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001418 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001419
Haibo Huangb9244ff2018-08-11 10:12:13 -07001420 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001421 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001422 "-fno-stack-protector",
1423 "-fno-jump-tables",
1424 ],
1425 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301426 x86_64: {
1427 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
1428 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001429 x86: {
1430 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1431 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001432 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001433 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001434 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001435 arm64: {
1436 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1437 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001438 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001439 srcs: ["arch-riscv64/dynamic_function_dispatch.cpp"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001440 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001441 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001442}
1443
1444// ========================================================
1445// libc_common_static.a For static binaries.
1446// ========================================================
1447cc_library_static {
1448 defaults: ["libc_defaults"],
1449 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001450
Haibo Huangf71edfa2018-11-12 10:06:56 -08001451 whole_static_libs: [
1452 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001453 "libc_static_dispatch",
1454 ],
1455}
1456
1457// ========================================================
1458// libc_common_shared.a For shared libraries.
1459// ========================================================
1460cc_library_static {
1461 defaults: ["libc_defaults"],
1462 name: "libc_common_shared",
1463
1464 whole_static_libs: [
1465 "libc_common",
1466 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001467 ],
1468}
1469
Ryan Prichard22a6a052019-10-10 23:59:30 -07001470// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1471// executable.
1472cc_library_static {
1473 name: "libc_unwind_static",
1474 defaults: ["libc_defaults"],
1475 cflags: ["-DLIBC_STATIC"],
1476
1477 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1478 arch: {
1479 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1480 arm: {
1481 srcs: ["arch-arm/bionic/exidx_static.c"],
1482 },
1483 },
1484}
1485
Haibo Huangf71edfa2018-11-12 10:06:56 -08001486// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001487// libc_nomalloc.a
1488// ========================================================
1489//
Ryan Prichard249757b2019-11-01 17:18:28 -07001490// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1491// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1492// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001493
1494cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001495 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001496 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001497
Colin Crossa3f9fca2016-01-11 13:20:55 -08001498 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001499 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001500 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001501 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001502 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001503}
1504
dimitryc0c0ef62018-12-05 16:33:52 +01001505filegroup {
1506 name: "libc_sources_shared",
1507 srcs: [
1508 "arch-common/bionic/crtbegin_so.c",
1509 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001510 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001511 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001512 "bionic/icu.cpp",
1513 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001514 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001515 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001516 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001517 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001518 "bionic/ndk_cruft.cpp",
1519 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001520 "bionic/NetdClient.cpp",
1521 "arch-common/bionic/crtend_so.S",
1522 ],
1523}
1524
1525filegroup {
1526 name: "libc_sources_static",
1527 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001528 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001529 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001530 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001531 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001532 ],
1533}
1534
1535filegroup {
1536 name: "libc_sources_shared_arm",
1537 srcs: [
1538 "arch-arm/bionic/exidx_dynamic.c",
1539 "arch-arm/bionic/atexit_legacy.c",
1540 ],
1541}
1542
Dan Willemsen208ae172015-09-16 16:33:27 -07001543// ========================================================
1544// libc.a + libc.so
1545// ========================================================
Florian Mayerc10d0642023-03-22 16:12:49 -07001546cc_defaults {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001547 defaults: [
1548 "libc_defaults",
1549 "libc_native_allocator_defaults",
Elliott Hughes788075a2024-06-18 12:25:37 +00001550 "bug_24465209_workaround",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001551 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001552 name: "libc_library_defaults",
Colin Cross50c21ab2015-10-31 23:03:05 -07001553 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001554 platform_sdk_version: {
1555 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1556 },
1557 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001558 static: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001559 srcs: [":libc_sources_static"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001560 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001561 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001562 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001563 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001564 "libc_init_static",
1565 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001566 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001567 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001568 },
1569 shared: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001570 srcs: [":libc_sources_shared"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001571 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001572 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001573 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001574 "libc_init_dynamic",
1575 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001576 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001577 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001578 },
1579
Neil Fullera7db90f2019-04-25 09:28:27 +01001580 required: [
MarkDacekd88d7ea2022-06-28 20:14:58 +00001581 "tzdata_prebuilt",
1582 "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
Neil Fullera7db90f2019-04-25 09:28:27 +01001583 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001584
Colin Cross4ce94d22016-11-15 13:15:43 -08001585 // Do not pack libc.so relocations; see http://b/20645321 for details.
1586 pack_relocations: false,
1587
dimitry06016f22018-01-05 11:39:28 +01001588 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1589 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1590 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1591 // those new libraries from libgcc.a are not declared external; if that were the case,
1592 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1593 // on the external symbols from the dependent libraries. That would create a "cloaked"
1594 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001595
dimitry06016f22018-01-05 11:39:28 +01001596 shared_libs: [
1597 "ld-android",
1598 "libdl",
1599 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001600 static_libs: [
1601 "libdl_android",
1602 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001603
1604 nocrt: true,
1605
Dan Willemsen208ae172015-09-16 16:33:27 -07001606 arch: {
1607 arm: {
Christopher Ferris9d03a162023-11-10 11:19:11 -08001608 ldflags: [
Christopher Ferris9d03a162023-11-10 11:19:11 -08001609 // Since we are preserving the debug_frame, do not compress
1610 // in this case to make unwinds as fast as possible.
1611 "-Wl,--compress-debug-sections=none",
1612 ],
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001613
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001614 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001615 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001616
Dan Willemsen208ae172015-09-16 16:33:27 -07001617 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001618 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001619 // special for arm
1620 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001621 // For backwards-compatibility, some arm32 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001622 static_libs: ["libclang_rt.builtins-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001623 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001624
1625 // Arm 32 bit does not produce complete exidx unwind information
1626 // so keep the .debug_frame which is relatively small and does
1627 // include needed unwind information.
1628 // See b/132992102 for details.
1629 strip: {
1630 keep_symbols_and_debug_frame: true,
1631 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001632 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001633 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001634 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001635
1636 // Leave the symbols in the shared library so that stack unwinders can produce
1637 // meaningful name resolution.
1638 strip: {
1639 keep_symbols: true,
1640 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001641 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001642 riscv64: {
1643 version_script: ":libc.riscv64.map",
1644
1645 // Leave the symbols in the shared library so that stack unwinders can produce
1646 // meaningful name resolution.
1647 strip: {
1648 keep_symbols: true,
1649 },
1650 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001651 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001652 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001653 no_libcrt: true,
1654
1655 shared: {
1656 // For backwards-compatibility, some x86 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001657 static_libs: ["libclang_rt.builtins-exported"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001658 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001659
1660 // Leave the symbols in the shared library so that stack unwinders can produce
1661 // meaningful name resolution.
1662 strip: {
1663 keep_symbols: true,
1664 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001665 },
1666 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001667 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001668
1669 // Leave the symbols in the shared library so that stack unwinders can produce
1670 // meaningful name resolution.
1671 strip: {
1672 keep_symbols: true,
1673 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001674 },
1675 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001676
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001677 apex_available: [
1678 "//apex_available:platform",
1679 "com.android.runtime",
1680 ],
1681
Colin Cross7edd0082021-10-28 13:20:35 -07001682 target: {
1683 native_bridge: {
1684 shared: {
1685 installable: false,
1686 },
1687 },
1688 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001689}
1690
Florian Mayerc10d0642023-03-22 16:12:49 -07001691cc_library {
1692 name: "libc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001693 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001694 "libc_library_defaults",
1695 ],
1696 stubs: {
1697 symbol_file: "libc.map.txt",
1698 versions: [
1699 "29",
1700 "R",
1701 "current",
1702 ],
1703 },
1704 static_ndk_lib: true,
1705 llndk: {
1706 symbol_file: "libc.map.txt",
1707 export_headers_as_system: true,
1708 export_preprocessed_headers: ["include"],
1709 export_llndk_headers: ["libc_llndk_headers"],
1710 },
1711}
1712
1713cc_library {
1714 name: "libc_hwasan",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001715 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001716 "libc_library_defaults",
1717 ],
1718 sanitize: {
1719 hwaddress: true,
1720 },
1721 enabled: false,
Florian Mayerff116ed2023-04-14 17:38:53 -07001722 target: {
1723 android_arm64: {
Florian Mayerc10d0642023-03-22 16:12:49 -07001724 enabled: true,
1725 },
1726 },
1727 stem: "libc",
1728 relative_install_path: "hwasan",
1729 // We don't really need the stubs, but this needs to stay to trigger the
1730 // symlink logic in soong.
1731 stubs: {
1732 symbol_file: "libc.map.txt",
1733 },
1734 native_bridge_supported: false,
1735 // It is never correct to depend on this directly. This is only
1736 // needed for the runtime apex, and in base_system.mk.
1737 visibility: ["//bionic/apex"],
1738}
1739
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001740genrule {
1741 name: "libc.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001742 out: ["libc.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001743 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001744 tools: ["generate-version-script"],
1745 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001746}
1747
1748genrule {
1749 name: "libc.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001750 out: ["libc.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001751 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001752 tools: ["generate-version-script"],
1753 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001754}
1755
1756genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001757 name: "libc.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001758 out: ["libc.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001759 srcs: ["libc.map.txt"],
1760 tools: ["generate-version-script"],
1761 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1762}
1763
1764genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001765 name: "libc.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001766 out: ["libc.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001767 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001768 tools: ["generate-version-script"],
1769 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001770}
1771
1772genrule {
1773 name: "libc.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001774 out: ["libc.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001775 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001776 tools: ["generate-version-script"],
1777 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001778}
1779
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001780// Headers that only other parts of the platform can include.
1781cc_library_headers {
1782 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001783 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001784 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001785 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001786 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001787 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001788 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001789 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001790 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001791 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001792 "//system/core/debuggerd:__subpackages__",
Florian Mayerf5d70ce2022-09-13 13:58:30 -07001793 "//system/core/init:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001794 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001795 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001796 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001797 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001798 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001799 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001800 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001801 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001802 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001803 recovery_available: true,
1804 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001805 export_include_dirs: [
1806 "platform",
1807 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001808 system_shared_libs: [],
1809 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001810 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001811
Steven Moreland0cdf1322020-10-05 21:55:26 +00001812 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001813 apex_available: [
1814 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001815 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001816 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001817}
1818
Logan Chien17af91b2019-01-15 21:19:56 +08001819cc_library_headers {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001820 name: "libc_llndk_headers",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001821 visibility: [
1822 "//external/musl",
1823 ],
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001824 llndk: {
1825 llndk_headers: true,
1826 },
Logan Chien17af91b2019-01-15 21:19:56 +08001827 host_supported: true,
1828 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001829 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001830 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001831 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001832 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001833 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001834 apex_available: [
1835 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001836 "//apex_available:anyapex",
1837 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001838 // used by most APEXes indirectly via libunwind_llvm
1839 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001840
1841 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001842 stl: "none",
1843 system_shared_libs: [],
1844
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001845 // The build system generally requires that any dependencies of a target
1846 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1847 // to 1 we let targets with an sdk_version that need to depend on the libc
1848 // headers but cannot depend on libc itself due to circular dependencies
1849 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1850 // is correct because the headers can support any sdk_version.
1851 sdk_version: "1",
1852
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001853 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001854 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001855 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001856 "kernel/android/uapi",
1857 ],
1858
1859 arch: {
1860 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001861 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001862 },
1863 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001864 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001865 },
Elliott Hughes48e53332022-10-07 20:39:25 +00001866 riscv64: {
1867 export_system_include_dirs: ["kernel/uapi/asm-riscv"],
1868 },
Logan Chien17af91b2019-01-15 21:19:56 +08001869 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001870 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001871 },
1872 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001873 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001874 },
1875 },
1876}
1877
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001878cc_library_headers {
1879 name: "libc_headers",
1880 host_supported: true,
1881 native_bridge_supported: true,
1882 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001883 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001884 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001885 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001886 recovery_available: true,
1887 sdk_version: "1",
1888
1889 apex_available: [
1890 "//apex_available:platform",
1891 "//apex_available:anyapex",
1892 ],
1893 // used by most APEXes indirectly via libunwind_llvm
1894 min_sdk_version: "apex_inherit",
1895 visibility: [
1896 "//bionic:__subpackages__", // visible to bionic
1897 // ... and only to these places (b/152668052)
1898 "//external/arm-optimized-routines",
1899 "//external/gwp_asan",
1900 "//external/jemalloc_new",
1901 "//external/libunwind_llvm",
Nick Desaulniers942ae552024-02-12 10:26:19 -08001902 "//external/llvm-libc",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001903 "//external/scudo",
1904 "//system/core/property_service/libpropertyinfoparser",
1905 "//system/extras/toolchain-extras",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001906 ],
1907
1908 stl: "none",
1909 no_libcrt: true,
1910 system_shared_libs: [],
1911
1912 target: {
1913 android: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001914 export_system_include_dirs: ["include"],
1915 header_libs: ["libc_llndk_headers"],
1916 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001917 },
1918 linux_bionic: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001919 export_system_include_dirs: ["include"],
1920 header_libs: ["libc_llndk_headers"],
1921 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001922 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001923 },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001924}
1925
Dan Willemsen208ae172015-09-16 16:33:27 -07001926// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001927// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001928// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001929
Dan Willemsen208ae172015-09-16 16:33:27 -07001930cc_library {
Elliott Hughes788075a2024-06-18 12:25:37 +00001931 defaults: [
1932 "libc_defaults",
1933 "bug_24465209_workaround",
1934 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001935 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001936 srcs: [
1937 "bionic/__cxa_guard.cpp",
1938 "bionic/__cxa_pure_virtual.cpp",
1939 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001940 ],
1941 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001942 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001943 static_libs: ["libasync_safe"],
Elliott Hughesc2043342023-07-20 20:24:09 +00001944 apex_available: [
1945 "//apex_available:platform",
1946 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001947
Dan Willemsen6b3be172018-12-03 13:57:20 -08001948 static: {
1949 system_shared_libs: [],
1950 },
Colin Crossb5bfe0b2021-07-13 16:26:28 -07001951 target: {
1952 bionic: {
1953 shared: {
1954 system_shared_libs: ["libc"],
1955 },
1956 },
Dan Willemsen6b3be172018-12-03 13:57:20 -08001957 },
1958
Dan Willemsen208ae172015-09-16 16:33:27 -07001959 arch: {
1960 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001961 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001962 },
1963 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001964 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001965 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001966 riscv64: {
1967 version_script: ":libstdc++.riscv64.map",
1968 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001969 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001970 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001971 },
1972 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001973 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001974 },
1975 },
1976}
1977
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001978genrule {
1979 name: "libstdc++.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001980 out: ["libstdc++.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001981 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001982 tools: ["generate-version-script"],
1983 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001984}
1985
1986genrule {
1987 name: "libstdc++.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001988 out: ["libstdc++.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001989 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001990 tools: ["generate-version-script"],
1991 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001992}
1993
1994genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001995 name: "libstdc++.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001996 out: ["libstdc++.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001997 srcs: ["libstdc++.map.txt"],
1998 tools: ["generate-version-script"],
1999 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
2000}
2001
2002genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002003 name: "libstdc++.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002004 out: ["libstdc++.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002005 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002006 tools: ["generate-version-script"],
2007 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002008}
2009
2010genrule {
2011 name: "libstdc++.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002012 out: ["libstdc++.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002013 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002014 tools: ["generate-version-script"],
2015 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002016}
2017
2018// ========================================================
2019// crt object files.
2020// ========================================================
2021
Colin Cross50c21ab2015-10-31 23:03:05 -07002022cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002023 name: "crt_and_memtag_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002024 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002025 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002026 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002027 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002028 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002029 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002030 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002031 apex_available: [
2032 "//apex_available:platform",
2033 "//apex_available:anyapex",
2034 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002035 // Generate NDK variants of the CRT objects for every supported API level.
2036 min_sdk_version: "16",
2037 stl: "none",
2038 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002039 cflags: [
2040 "-Wno-gcc-compat",
2041 "-Wall",
2042 "-Werror",
2043 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002044 sanitize: {
2045 never: true,
2046 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002047}
2048
Colin Cross50c21ab2015-10-31 23:03:05 -07002049cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002050 name: "crt_defaults",
2051 defaults: ["crt_and_memtag_defaults"],
Colin Cross02f81372021-07-22 12:02:10 -07002052 system_shared_libs: [],
Colin Cross10d92682021-06-22 13:25:46 -07002053}
2054
2055cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002056 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002057 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002058
2059 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002060 x86: {
2061 cflags: ["-fPIC"],
2062 },
2063 x86_64: {
2064 cflags: ["-fPIC"],
2065 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002066 },
Colin Crossab179442018-09-27 11:03:22 -07002067 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002068}
2069
Dan Willemsen208ae172015-09-16 16:33:27 -07002070cc_object {
2071 name: "crtbrand",
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002072 local_include_dirs: [
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002073 "private", // crtbrand.S depends on private/bionic_asm_note.h
2074 ],
Elliott Hughes6a30b712024-03-13 23:41:32 +00002075 // crtbrand.S needs to know the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002076 product_variables: {
2077 platform_sdk_version: {
2078 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2079 },
2080 },
2081 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002082
Colin Cross7d7b3682017-11-03 13:38:40 -07002083 defaults: ["crt_so_defaults"],
Dan Alberteee46dc2023-04-04 23:27:52 +00002084 // crtbrand is an intermediate artifact, not a final CRT object.
2085 exclude_from_ndk_sysroot: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07002086}
2087
Dan Willemsen208ae172015-09-16 16:33:27 -07002088cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002089 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002090 local_include_dirs: ["include"],
2091 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002092
Colin Cross7d7b3682017-11-03 13:38:40 -07002093 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002094 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002095 "crtbrand",
2096 ],
2097}
2098
Dan Willemsen208ae172015-09-16 16:33:27 -07002099cc_object {
2100 name: "crtend_so",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002101 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002102 "private", // crtend_so.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002103 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002104 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002105
Colin Cross7d7b3682017-11-03 13:38:40 -07002106 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002107}
2108
Dan Willemsen208ae172015-09-16 16:33:27 -07002109cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002110 name: "crtbegin_static",
2111
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002112 local_include_dirs: [
2113 "include",
2114 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2115 ],
Liz Kammere718dd72021-03-09 15:00:06 -05002116
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002117 cflags: ["-DCRTBEGIN_STATIC"],
Yabin Cui744cfd32023-08-24 13:20:23 -07002118
Dan Willemsen208ae172015-09-16 16:33:27 -07002119 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002120 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002121 "crtbrand",
2122 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002123 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002124 // When using libc.a, we're using the latest library regardless of target API level.
2125 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002126}
2127
Dan Willemsen208ae172015-09-16 16:33:27 -07002128cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002129 name: "crtbegin_dynamic",
2130
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002131 local_include_dirs: [
2132 "include",
2133 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2134 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002135 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002136 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002137 "crtbrand",
2138 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002139 target: {
2140 linux_bionic: {
2141 generated_sources: ["host_bionic_linker_asm"],
2142 objs: [
2143 "linker_wrapper",
2144 ],
2145 },
2146 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002147 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002148}
2149
Dan Willemsen208ae172015-09-16 16:33:27 -07002150cc_object {
2151 // We rename crtend.o to crtend_android.o to avoid a
2152 // name clash between gcc and bionic.
2153 name: "crtend_android",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002154 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002155 "private", // crtend.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002156 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002157 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002158
Colin Cross50c21ab2015-10-31 23:03:05 -07002159 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002160}
Colin Crossbaa48992016-07-13 11:15:21 -07002161
Kalesh Singh862a23d2024-01-09 13:13:50 -08002162cc_object {
2163 name: "crt_pad_segment",
2164 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002165 "private", // crt_pad_segment.S depends on private/bionic_asm_note.h
Kalesh Singh862a23d2024-01-09 13:13:50 -08002166 ],
2167 srcs: ["arch-common/bionic/crt_pad_segment.S"],
2168
2169 defaults: ["crt_defaults"],
2170}
2171
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002172cc_library_static {
2173 name: "note_memtag_heap_async",
2174 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002175 arm64: {
2176 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2177 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002178 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002179 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002180
Colin Cross10d92682021-06-22 13:25:46 -07002181 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002182}
2183
2184cc_library_static {
2185 name: "note_memtag_heap_sync",
2186 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002187 arm64: {
2188 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2189 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002190 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002191 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002192
Colin Cross10d92682021-06-22 13:25:46 -07002193 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002194}
2195
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002196// ========================================================
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002197// libc dependencies for baremetal Rust projects.
2198// ========================================================
2199
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002200// This library contains the following unresolved symbols:
2201// __errno
2202// abort
2203// async_safe_fatal_va_list
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002204cc_library_static {
2205 name: "librust_baremetal",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002206 header_libs: ["libc_headers"],
2207 include_dirs: [
2208 "bionic/libc/async_safe/include",
2209 "bionic/libc/platform",
2210 ],
2211 cflags: [
2212 "-Wall",
2213 "-Werror",
2214 ],
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002215 srcs: [
2216 "bionic/fortify.cpp",
Pierre-Clément Tosi816176c2022-11-30 14:33:41 +00002217 "bionic/strtol.cpp",
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002218 ],
2219 arch: {
2220 arm64: {
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002221 srcs: [
2222 "arch-arm64/string/__memcpy_chk.S",
2223 ],
2224 },
caowencheng9a39eb32023-03-20 16:24:41 +08002225 riscv64: {
2226 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002227 "arch-riscv64/string/__memcpy_chk.S",
caowencheng9a39eb32023-03-20 16:24:41 +08002228 ],
2229 },
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002230 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002231 whole_static_libs: [
2232 "libarm-optimized-routines-mem",
Pierre-Clément Tosieb46ac92023-02-01 13:44:57 +00002233 "libc_netbsd",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002234 ],
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002235 system_shared_libs: [],
2236 nocrt: true,
2237 stl: "none",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002238 visibility: [
2239 "//packages/modules/Virtualization/vmbase",
2240 ],
2241}
2242
2243// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002244// NDK headers.
2245// ========================================================
2246
Dan Albert26e1c412018-05-24 14:56:46 -07002247versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002248 name: "common_libc",
2249 from: "include",
2250 to: "",
2251 license: "NOTICE",
2252}
Dan Albert4238a352016-06-28 11:18:05 -07002253
2254ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002255 name: "libc_uapi",
2256 from: "kernel/uapi",
2257 to: "",
2258 srcs: [
2259 "kernel/uapi/asm-generic/**/*.h",
2260 "kernel/uapi/drm/**/*.h",
2261 "kernel/uapi/linux/**/*.h",
2262 "kernel/uapi/misc/**/*.h",
2263 "kernel/uapi/mtd/**/*.h",
2264 "kernel/uapi/rdma/**/*.h",
2265 "kernel/uapi/scsi/**/*.h",
2266 "kernel/uapi/sound/**/*.h",
2267 "kernel/uapi/video/**/*.h",
2268 "kernel/uapi/xen/**/*.h",
2269 ],
Dan Albert92592652016-10-20 01:42:54 -07002270 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002271}
2272
2273ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002274 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002275 from: "kernel/android/uapi/linux",
2276 to: "linux",
2277 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002278 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002279}
2280
2281ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002282 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002283 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002284 to: "scsi",
2285 srcs: ["kernel/android/scsi/**/*.h"],
2286 license: "NOTICE",
2287}
2288
2289ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002290 name: "libc_asm_arm",
2291 from: "kernel/uapi/asm-arm",
2292 to: "arm-linux-androideabi",
2293 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002294 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002295}
2296
2297ndk_headers {
2298 name: "libc_asm_arm64",
2299 from: "kernel/uapi/asm-arm64",
2300 to: "aarch64-linux-android",
2301 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002302 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002303}
2304
Lazar Trsic790d2f72017-11-27 11:54:11 +01002305ndk_headers {
Colin Crossbd26e0f2022-10-19 15:03:14 -07002306 name: "libc_asm_riscv64",
2307 from: "kernel/uapi/asm-riscv",
2308 to: "riscv64-linux-android",
2309 srcs: ["kernel/uapi/asm-riscv/**/*.h"],
2310 license: "NOTICE",
2311}
2312
2313ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002314 name: "libc_asm_x86",
2315 from: "kernel/uapi/asm-x86",
2316 to: "i686-linux-android",
2317 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002318 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002319}
2320
2321ndk_headers {
2322 name: "libc_asm_x86_64",
2323 from: "kernel/uapi/asm-x86",
2324 to: "x86_64-linux-android",
2325 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002326 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002327}
2328
Dan Albert4238a352016-06-28 11:18:05 -07002329ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002330 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002331 symbol_file: "libc.map.txt",
2332 first_version: "9",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002333 export_header_libs: [
2334 "common_libc",
2335 "libc_uapi",
2336 "libc_kernel_android_uapi_linux",
2337 "libc_kernel_android_scsi",
2338 "libc_asm_arm",
2339 "libc_asm_arm64",
Colin Crossbd26e0f2022-10-19 15:03:14 -07002340 "libc_asm_riscv64",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002341 "libc_asm_x86",
2342 "libc_asm_x86_64",
2343 ],
Dan Albert4238a352016-06-28 11:18:05 -07002344}
2345
Dan Albertdf31aff2016-10-06 15:50:41 -07002346ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002347 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002348 symbol_file: "libstdc++.map.txt",
2349 first_version: "9",
2350}
2351
Dan Willemsenca056d72018-01-08 14:00:24 -08002352// Export these headers for toolbox to process
2353filegroup {
2354 name: "kernel_input_headers",
2355 srcs: [
2356 "kernel/uapi/linux/input.h",
2357 "kernel/uapi/linux/input-event-codes.h",
2358 ],
2359}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002360
2361// Generate a syscall name / number mapping. These objects are text files
2362// (thanks to the -dD -E flags) and not binary files. They will then be
2363// consumed by the genseccomp.py script and converted into C++ code.
2364cc_defaults {
2365 name: "libseccomp_gen_syscall_nrs_defaults",
2366 recovery_available: true,
2367 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2368 cflags: [
2369 "-dD",
2370 "-E",
2371 "-Wall",
2372 "-Werror",
2373 "-nostdinc",
2374 ],
2375}
2376
2377cc_object {
2378 name: "libseccomp_gen_syscall_nrs_arm",
2379 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2380 local_include_dirs: [
2381 "kernel/uapi/asm-arm",
2382 "kernel/uapi",
2383 ],
2384}
2385
2386cc_object {
2387 name: "libseccomp_gen_syscall_nrs_arm64",
2388 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2389 local_include_dirs: [
2390 "kernel/uapi/asm-arm64",
2391 "kernel/uapi",
2392 ],
2393}
2394
2395cc_object {
Elliott Hughes704772b2022-10-10 17:06:43 +00002396 name: "libseccomp_gen_syscall_nrs_riscv64",
2397 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2398 local_include_dirs: [
2399 "kernel/uapi/asm-riscv",
2400 "kernel/uapi",
2401 ],
2402}
2403
2404cc_object {
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002405 name: "libseccomp_gen_syscall_nrs_x86",
2406 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2407 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2408 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2409 local_include_dirs: [
2410 "kernel/uapi/asm-x86",
2411 "kernel/uapi",
2412 ],
2413}
2414
2415cc_object {
2416 name: "libseccomp_gen_syscall_nrs_x86_64",
2417 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2418 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2419 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2420 local_include_dirs: [
2421 "kernel/uapi/asm-x86",
2422 "kernel/uapi",
2423 ],
2424}
2425
Jingwen Chenca366332021-01-29 05:16:32 -05002426filegroup {
2427 name: "all_kernel_uapi_headers",
2428 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002429}
2430
Martijn Coenen0c6de752019-01-02 12:52:51 +01002431cc_genrule {
2432 name: "func_to_syscall_nrs",
2433 recovery_available: true,
2434 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2435
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002436 tools: ["genfunctosyscallnrs"],
Martijn Coenen0c6de752019-01-02 12:52:51 +01002437
2438 srcs: [
2439 "SYSCALLS.TXT",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002440 ],
2441
Elliott Hughes704772b2022-10-10 17:06:43 +00002442 arch: {
2443 arm: {
2444 srcs: [
2445 ":libseccomp_gen_syscall_nrs_arm",
2446 ":libseccomp_gen_syscall_nrs_arm64",
2447 ],
2448 },
2449 arm64: {
2450 srcs: [
2451 ":libseccomp_gen_syscall_nrs_arm",
2452 ":libseccomp_gen_syscall_nrs_arm64",
2453 ],
2454 },
2455 riscv64: {
2456 srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
2457 },
2458 x86: {
2459 srcs: [
2460 ":libseccomp_gen_syscall_nrs_x86",
2461 ":libseccomp_gen_syscall_nrs_x86_64",
2462 ],
2463 },
2464 x86_64: {
2465 srcs: [
2466 ":libseccomp_gen_syscall_nrs_x86",
2467 ":libseccomp_gen_syscall_nrs_x86_64",
2468 ],
2469 },
2470 },
2471
Martijn Coenen0c6de752019-01-02 12:52:51 +01002472 out: [
2473 "func_to_syscall_nrs.h",
2474 ],
2475}
2476
Victor Hsiehdbb86702020-06-15 09:29:07 -07002477// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002478genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002479 name: "generate_app_zygote_blocklist",
2480 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2481 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002482 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2483}
2484
Yu Liu938ec9b2022-10-17 16:36:30 -07002485filegroup {
2486 name: "seccomp_syscalls_sources_zygote",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002487 srcs: [
2488 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002489 "SECCOMP_ALLOWLIST_COMMON.TXT",
2490 "SECCOMP_ALLOWLIST_APP.TXT",
2491 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002492 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002493 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002494 ],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002495}
2496
Yu Liu938ec9b2022-10-17 16:36:30 -07002497filegroup {
2498 name: "seccomp_syscalls_sources_app",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002499 srcs: [
2500 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002501 "SECCOMP_ALLOWLIST_COMMON.TXT",
2502 "SECCOMP_ALLOWLIST_APP.TXT",
2503 "SECCOMP_BLOCKLIST_COMMON.TXT",
2504 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002505 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002506 ],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002507}
2508
Yu Liu938ec9b2022-10-17 16:36:30 -07002509filegroup {
2510 name: "seccomp_syscalls_sources_system",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002511 srcs: [
2512 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002513 "SECCOMP_ALLOWLIST_COMMON.TXT",
2514 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2515 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002516 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002517 ],
Yu Liu938ec9b2022-10-17 16:36:30 -07002518}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002519
Yu Liu938ec9b2022-10-17 16:36:30 -07002520cc_genrule {
2521 name: "libseccomp_policy_app_zygote_sources_x86",
2522 recovery_available: true,
2523 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002524 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002525 srcs: [
2526 ":seccomp_syscalls_sources_zygote",
2527 ":libseccomp_gen_syscall_nrs_x86",
2528 ":libseccomp_gen_syscall_nrs_x86_64",
2529 ],
2530 out: [
2531 "x86_app_zygote_policy.cpp",
2532 "x86_64_app_zygote_policy.cpp",
2533 ],
2534 enabled: false,
Yu Liu3a579692022-10-18 03:02:32 +00002535 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002536 x86: {
2537 enabled: true,
2538 },
2539 x86_64: {
2540 enabled: true,
2541 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002542 },
2543}
2544
2545cc_genrule {
2546 name: "libseccomp_policy_app_zygote_sources_arm",
2547 recovery_available: true,
2548 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002549 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002550 srcs: [
2551 ":seccomp_syscalls_sources_zygote",
2552 ":libseccomp_gen_syscall_nrs_arm",
2553 ":libseccomp_gen_syscall_nrs_arm64",
2554 ],
2555 out: [
2556 "arm_app_zygote_policy.cpp",
2557 "arm64_app_zygote_policy.cpp",
2558 ],
2559 enabled: false,
2560 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002561 arm: {
2562 enabled: true,
2563 },
2564 arm64: {
2565 enabled: true,
2566 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002567 },
2568}
2569
2570cc_genrule {
2571 name: "libseccomp_policy_app_zygote_sources_riscv64",
2572 recovery_available: true,
2573 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002574 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002575 srcs: [
2576 ":seccomp_syscalls_sources_zygote",
2577 ":libseccomp_gen_syscall_nrs_riscv64",
2578 ],
2579 out: [
2580 "riscv64_app_zygote_policy.cpp",
2581 ],
2582 enabled: false,
2583 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002584 riscv64: {
2585 enabled: true,
2586 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002587 },
2588}
2589
2590cc_genrule {
2591 name: "libseccomp_policy_app_sources_x86",
2592 recovery_available: true,
2593 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002594 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002595 srcs: [
2596 ":seccomp_syscalls_sources_app",
2597 ":libseccomp_gen_syscall_nrs_x86",
2598 ":libseccomp_gen_syscall_nrs_x86_64",
2599 ],
2600 out: [
2601 "x86_app_policy.cpp",
2602 "x86_64_app_policy.cpp",
2603 ],
2604 enabled: false,
2605 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002606 x86: {
2607 enabled: true,
2608 },
2609 x86_64: {
2610 enabled: true,
2611 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002612 },
2613}
2614
2615cc_genrule {
2616 name: "libseccomp_policy_app_sources_arm",
2617 recovery_available: true,
2618 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002619 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002620 srcs: [
2621 ":seccomp_syscalls_sources_app",
2622 ":libseccomp_gen_syscall_nrs_arm",
2623 ":libseccomp_gen_syscall_nrs_arm64",
2624 ],
2625 out: [
2626 "arm_app_policy.cpp",
2627 "arm64_app_policy.cpp",
2628 ],
2629 enabled: false,
2630 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002631 arm: {
2632 enabled: true,
2633 },
2634 arm64: {
2635 enabled: true,
2636 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002637 },
2638}
2639
2640cc_genrule {
2641 name: "libseccomp_policy_app_sources_riscv64",
2642 recovery_available: true,
2643 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002644 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002645 srcs: [
2646 ":seccomp_syscalls_sources_app",
2647 ":libseccomp_gen_syscall_nrs_riscv64",
2648 ],
2649 out: [
2650 "riscv64_app_policy.cpp",
2651 ],
2652 enabled: false,
2653 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002654 riscv64: {
2655 enabled: true,
2656 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002657 },
2658}
2659
2660cc_genrule {
2661 name: "libseccomp_policy_system_sources_x86",
2662 recovery_available: true,
2663 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002664 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002665 srcs: [
2666 ":seccomp_syscalls_sources_system",
2667 ":libseccomp_gen_syscall_nrs_x86",
2668 ":libseccomp_gen_syscall_nrs_x86_64",
2669 ],
2670 out: [
2671 "x86_system_policy.cpp",
2672 "x86_64_system_policy.cpp",
2673 ],
2674 enabled: false,
2675 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002676 x86: {
2677 enabled: true,
2678 },
2679 x86_64: {
2680 enabled: true,
2681 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002682 },
2683}
2684
2685cc_genrule {
2686 name: "libseccomp_policy_system_sources_arm",
2687 recovery_available: true,
2688 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002689 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002690 srcs: [
2691 ":seccomp_syscalls_sources_system",
2692 ":libseccomp_gen_syscall_nrs_arm",
2693 ":libseccomp_gen_syscall_nrs_arm64",
2694 ],
2695 out: [
2696 "arm_system_policy.cpp",
2697 "arm64_system_policy.cpp",
2698 ],
2699 enabled: false,
2700 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002701 arm: {
2702 enabled: true,
2703 },
2704 arm64: {
2705 enabled: true,
2706 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002707 },
2708}
2709
2710cc_genrule {
2711 name: "libseccomp_policy_system_sources_riscv64",
2712 recovery_available: true,
2713 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002714 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002715 srcs: [
2716 ":seccomp_syscalls_sources_system",
2717 ":libseccomp_gen_syscall_nrs_riscv64",
2718 ],
2719 out: [
2720 "riscv64_system_policy.cpp",
2721 ],
2722 enabled: false,
2723 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002724 riscv64: {
2725 enabled: true,
2726 },
Yu Liu3a579692022-10-18 03:02:32 +00002727 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002728}
2729
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002730cc_library {
2731 name: "libseccomp_policy",
2732 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002733 generated_headers: ["func_to_syscall_nrs"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002734
2735 arch: {
2736 arm: {
2737 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002738 "libseccomp_policy_app_sources_arm",
2739 "libseccomp_policy_app_zygote_sources_arm",
2740 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002741 ],
2742 },
2743 arm64: {
2744 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002745 "libseccomp_policy_app_sources_arm",
2746 "libseccomp_policy_app_zygote_sources_arm",
2747 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002748 ],
2749 },
2750 riscv64: {
2751 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002752 "libseccomp_policy_app_sources_riscv64",
2753 "libseccomp_policy_app_zygote_sources_riscv64",
2754 "libseccomp_policy_system_sources_riscv64",
Yu Liu938ec9b2022-10-17 16:36:30 -07002755 ],
2756 },
2757 x86: {
2758 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002759 "libseccomp_policy_app_sources_x86",
2760 "libseccomp_policy_app_zygote_sources_x86",
2761 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002762 ],
2763 },
2764 x86_64: {
2765 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002766 "libseccomp_policy_app_sources_x86",
2767 "libseccomp_policy_app_zygote_sources_x86",
2768 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002769 ],
2770 },
2771 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002772
2773 srcs: [
2774 "seccomp/seccomp_policy.cpp",
2775 ],
2776
2777 export_include_dirs: ["seccomp/include"],
2778 cflags: [
2779 "-Wall",
2780 "-Werror",
2781 ],
2782 shared: {
2783 shared_libs: ["libbase"],
2784 },
2785 static: {
2786 static_libs: ["libbase"],
2787 },
2788}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002789
Colin Cross048f24e2021-09-01 17:26:00 -07002790cc_library_host_static {
2791 name: "libfts",
2792 srcs: [
2793 "bionic/fts.c",
2794 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
2795 ],
2796 export_include_dirs: ["fts/include"],
2797 local_include_dirs: [
2798 "private",
2799 "upstream-openbsd/android/include",
2800 ],
2801 cflags: [
2802 "-include openbsd-compat.h",
2803 "-Wno-unused-parameter",
2804 ],
2805 enabled: false,
2806 target: {
2807 musl: {
2808 enabled: true,
2809 },
2810 },
Colin Cross2a9843f2022-01-13 12:26:30 -08002811 stl: "none",
2812}
2813
2814cc_library_host_static {
2815 name: "libexecinfo",
2816 visibility: ["//external/musl"],
2817 srcs: ["bionic/execinfo.cpp"],
2818 export_include_dirs: ["execinfo/include"],
2819 local_include_dirs: ["private"],
2820 enabled: false,
2821 target: {
2822 musl: {
2823 enabled: true,
2824 system_shared_libs: [],
2825 header_libs: ["libc_musl_headers"],
2826 },
2827 },
2828 stl: "none",
Colin Cross048f24e2021-09-01 17:26:00 -07002829}
2830
Colin Cross9da85fa2022-01-24 18:20:05 -08002831cc_library_host_static {
2832 name: "libb64",
2833 visibility: ["//external/musl"],
2834 srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
2835 export_include_dirs: ["b64/include"],
2836 local_include_dirs: [
2837 "private",
2838 "upstream-openbsd/android/include",
2839 ],
2840 cflags: [
2841 "-include openbsd-compat.h",
2842 ],
2843 enabled: false,
2844 target: {
2845 musl: {
2846 enabled: true,
2847 system_shared_libs: [],
2848 header_libs: ["libc_musl_headers"],
2849 },
2850 },
2851 stl: "none",
2852}
2853
Colin Cross9d4a56e2022-02-03 10:20:32 -08002854// Export kernel uapi headers to be used in the musl sysroot.
2855// Also include the execinfo headers for the libexecinfo and the
2856// b64 headers for libb64 embedded in musl libc.
2857cc_genrule {
2858 name: "libc_musl_sysroot_bionic_headers",
2859 visibility: ["//external/musl"],
2860 host_supported: true,
2861 device_supported: false,
2862 enabled: false,
2863 target: {
2864 musl: {
2865 enabled: true,
2866 },
2867 },
2868 srcs: [
2869 "kernel/uapi/**/*.h",
2870 "kernel/android/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002871 "execinfo/include/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002872 "b64/include/**/*.h",
Colin Crossaeef9f02022-02-07 21:01:26 -08002873
Colin Crossaeef9f02022-02-07 21:01:26 -08002874 "NOTICE",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002875
2876 ":libc_musl_sysroot_bionic_arch_headers",
2877 ],
2878 out: ["libc_musl_sysroot_bionic_headers.zip"],
2879 tools: [
2880 "soong_zip",
2881 "merge_zips",
2882 "zip2zip",
2883 ],
Colin Crossaeef9f02022-02-07 21:01:26 -08002884 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
2885 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
Colin Crossad33d022022-02-25 18:27:04 -08002886 // NOTICE
2887 " -j -f $(location NOTICE) " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002888 // headers
2889 " -P include " +
Colin Crossaeef9f02022-02-07 21:01:26 -08002890 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
2891 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
2892 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2893 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2894 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2895 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2896 " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
2897 " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
2898 " -C $${BIONIC_LIBC_DIR}/b64/include " +
2899 " -D $${BIONIC_LIBC_DIR}/b64/include " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002900 " && " +
Colin Crossad33d022022-02-25 18:27:04 -08002901 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
Colin Cross1c0a7a02022-08-11 12:22:26 -07002902 " -x **/BUILD " +
Colin Crossad33d022022-02-25 18:27:04 -08002903 " include/**/*:include/ " +
2904 " NOTICE:NOTICE.bionic " +
2905 " && " +
2906 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002907}
2908
2909// The architecture-specific bits have to be handled separately because the label varies based
2910// on architecture, which prevents using $(locations) to find them and requires using $(in)
2911// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
2912// genrule.
2913cc_genrule {
2914 name: "libc_musl_sysroot_bionic_arch_headers",
2915 visibility: ["//visibility:private"],
2916 host_supported: true,
2917 device_supported: false,
2918 enabled: false,
2919 target: {
2920 musl: {
2921 enabled: true,
2922 },
2923 },
2924 arch: {
2925 arm: {
2926 srcs: ["kernel/uapi/asm-arm/**/*.h"],
2927 },
2928 arm64: {
2929 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
2930 },
2931 x86: {
2932 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2933 },
2934 x86_64: {
2935 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2936 },
2937 },
2938 out: ["libc_musl_sysroot_bionic_arch_headers.zip"],
2939 tools: ["soong_zip"],
2940 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
2941}
Colin Cross290c4952022-10-13 12:51:13 -07002942
2943cc_genrule {
2944 name: "bionic_sysroot_crt_objects",
2945 visibility: ["//visibility:private"],
2946 out: ["bionic_sysroot_crt_objects.zip"],
2947 tools: ["soong_zip"],
2948 srcs: [
2949 ":crtbegin_dynamic",
2950 ":crtbegin_so",
2951 ":crtbegin_static",
2952 ":crtend_android",
2953 ":crtend_so",
2954 ],
2955 cmd: "$(location soong_zip) -o $(out) -j " +
2956 "-f $(location :crtbegin_dynamic) " +
2957 "-f $(location :crtbegin_so) " +
2958 "-f $(location :crtbegin_static) " +
2959 "-f $(location :crtend_android) " +
2960 "-f $(location :crtend_so)",
2961 dist: {
2962 targets: ["bionic_sysroot_crt_objects"],
2963 },
2964 arch: {
2965 arm: {
2966 dist: {
2967 suffix: "_arm",
2968 },
2969 },
2970 arm64: {
2971 dist: {
2972 suffix: "_arm64",
2973 },
2974 },
2975 riscv64: {
2976 dist: {
2977 suffix: "_riscv64",
2978 },
2979 },
2980 x86: {
2981 dist: {
2982 suffix: "_x86",
2983 },
2984 },
2985 x86_64: {
2986 dist: {
2987 suffix: "_x86_64",
2988 },
2989 },
2990 },
2991}
Spandan Das8fce52a2023-09-28 18:00:12 +00002992
2993// headers that will be placed on the include path when running versioner in bazel
2994// this module should be a no-op in soong
2995filegroup {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002996 name: "versioner-dependencies",
2997 srcs: ["versioner-dependencies/**/*"],
Spandan Das8fce52a2023-09-28 18:00:12 +00002998}
Jiyong Park35a280d2024-05-03 16:53:39 +09002999
3000filegroup {
3001 name: "linux_capability_header",
3002 srcs: ["kernel/uapi/linux/capability.h"],
3003}