blob: 430072b90fd60dda1da7c63767a4a2b947e83d27 [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001// Define the common source files for all the libc instances
2// =========================================================
Bob Badouraa7d8352021-02-19 13:06:22 -08003package {
4 default_applicable_licenses: ["bionic_libc_license"],
5}
6
7license {
8 name: "bionic_libc_license",
9 visibility: [":__subpackages__"],
10 license_kinds: [
11 "SPDX-license-identifier-Apache-2.0",
12 "SPDX-license-identifier-BSD",
13 "SPDX-license-identifier-ISC",
14 "SPDX-license-identifier-MIT",
15 "legacy_notice",
16 "legacy_unencumbered",
17 ],
18 license_text: [
19 "NOTICE",
20 ],
21}
22
Elliott Hughes53cf3482016-08-09 13:06:41 -070023libc_common_flags = [
24 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080025 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070026 "-Wall",
27 "-Wextra",
28 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080029 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070030 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070031 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070032 "-Wframe-larger-than=2048",
Christopher Ferris1de7a482023-09-12 11:06:29 -070033 "-Wno-reorder-init-list",
Elliott Hughes53cf3482016-08-09 13:06:41 -070034
35 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
36 "-Werror=pointer-to-int-cast",
37 "-Werror=int-to-pointer-cast",
38 "-Werror=type-limits",
39 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080040
41 // Clang's exit-time destructor registration hides __dso_handle, but
42 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
43 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080044
Elliott Hughesa13d0662021-12-02 14:42:16 -080045 // We know clang does a lot of harm by rewriting what we've said, and sadly
46 // never see any good it does, so let's just ask it to do what we say...
47 // (The specific motivating example was clang turning a loop that would only
48 // ever touch 0, 1, or 2 bytes into a call to memset, which was never going
49 // to amortize.)
50 "-fno-builtin",
Elliott Hughes53cf3482016-08-09 13:06:41 -070051]
52
Dan Willemsen208ae172015-09-16 16:33:27 -070053// Define some common cflags
54// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070055cc_defaults {
56 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080057 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070058 cflags: libc_common_flags,
59 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 },
Steven Morelandfb65ee42020-07-31 00:18:38 +0000101 malloc_not_svelte: {
102 cflags: ["-DUSE_SCUDO"],
103 },
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
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800115libc_scudo_product_variables = {
116 malloc_not_svelte: {
117 cflags: ["-DUSE_SCUDO"],
118 whole_static_libs: ["libscudo"],
119 exclude_static_libs: [
120 "libjemalloc5",
121 "libc_jemalloc_wrapper",
122 ],
123 },
124}
125
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700126// Defaults for native allocator libs/includes to make it
127// easier to change.
Christopher Ferris062eba22020-01-31 22:40:45 -0800128// To disable scudo for the non-svelte config remove the line:
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800129// product_variables: libc_scudo_product_variables,
Christopher Ferris062eba22020-01-31 22:40:45 -0800130// in the cc_defaults below.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700131// ========================================================
132cc_defaults {
133 name: "libc_native_allocator_defaults",
134
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700135 whole_static_libs: [
136 "libjemalloc5",
137 "libc_jemalloc_wrapper",
138 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800139 header_libs: ["gwp_asan_headers"],
Christopher Ferris062eba22020-01-31 22:40:45 -0800140 product_variables: libc_scudo_product_variables,
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700141}
142
143// Functions not implemented by jemalloc directly, or that need to
144// be modified for Android.
145cc_library_static {
146 name: "libc_jemalloc_wrapper",
147 defaults: ["libc_defaults"],
148 srcs: ["bionic/jemalloc_wrapper.cpp"],
149 cflags: ["-fvisibility=hidden"],
150
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800151 // Used to pull in the jemalloc include directory so that if the
152 // library is removed, the include directory is also removed.
153 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700154}
155
Dan Willemsen208ae172015-09-16 16:33:27 -0700156// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700157// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700158// ========================================================
159//
Ryan Prichard249757b2019-11-01 17:18:28 -0700160// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
161// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
162// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
163// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700164
165cc_library_static {
166
Colin Crossa3f9fca2016-01-11 13:20:55 -0800167 srcs: [
168 "bionic/__libc_init_main_thread.cpp",
169 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700170 "bionic/bionic_call_ifunc_resolver.cpp",
171 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800172 ],
173 arch: {
174 arm64: {
175 srcs: ["arch-arm64/bionic/__set_tls.c"],
176 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000177 riscv64: {
178 srcs: ["arch-riscv64/bionic/__set_tls.c"],
179 },
Colin Crossa3f9fca2016-01-11 13:20:55 -0800180 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700181 srcs: [
182 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Pirama Arumuga Nainar7b89be72021-02-12 15:09:49 -0800183 "arch-x86/bionic/__libc_int0x80.S",
Ryan Prichard27475b52018-05-17 17:14:18 -0700184 "arch-x86/bionic/__set_tls.cpp",
185 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800186 },
187 x86_64: {
188 srcs: ["arch-x86_64/bionic/__set_tls.c"],
189 },
190 },
191
Colin Cross50c21ab2015-10-31 23:03:05 -0700192 defaults: ["libc_defaults"],
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000193 cflags: [
194 "-fno-stack-protector",
195 "-ffreestanding",
196 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700197 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700198}
199
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800200filegroup {
201 name: "elf_note_sources",
202 srcs: ["bionic/elf_note.cpp"],
203}
204
Ryan Prichard249757b2019-11-01 17:18:28 -0700205// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
206// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
207// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800208
209cc_library_static {
210 name: "libc_init_static",
211 defaults: ["libc_defaults"],
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800212 srcs: [
213 "bionic/libc_init_static.cpp",
214 ":elf_note_sources",
215 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700216 cflags: [
217 "-fno-stack-protector",
218
219 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
220 // from the linker before ifunc resolvers have made string.h functions available.
221 "-ffreestanding",
222 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800223}
224
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700225cc_library_static {
226 name: "libc_init_dynamic",
227 defaults: ["libc_defaults"],
228 srcs: ["bionic/libc_init_dynamic.cpp"],
229 cflags: ["-fno-stack-protector"],
230}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800231
Dan Willemsen208ae172015-09-16 16:33:27 -0700232// ========================================================
233// libc_tzcode.a - upstream 'tzcode' code
234// ========================================================
235
236cc_library_static {
237
Colin Cross50c21ab2015-10-31 23:03:05 -0700238 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700239 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800240 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700241 "tzcode/bionic.cpp",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700242 // tzcode doesn't include strptime, so we use a fork of the
243 // OpenBSD code which needs this global data.
Elliott Hughesd3627a42022-12-06 22:24:27 +0000244 "upstream-openbsd/lib/libc/locale/_def_time.c",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700245 // tzcode doesn't include wcsftime, so we use the FreeBSD code.
246 "upstream-freebsd/lib/libc/locale/wcsftime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700247 ],
248
Colin Cross50c21ab2015-10-31 23:03:05 -0700249 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700250 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700251 // Don't use ridiculous amounts of stack.
252 "-DALL_STATE",
253 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
254 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800255 // Obviously, we want to be thread-safe.
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000256 "-DTHREAD_SAFE=1",
Dan Willemsen208ae172015-09-16 16:33:27 -0700257 // The name of the tm_gmtoff field in our struct tm.
258 "-DTM_GMTOFF=tm_gmtoff",
Elliott Hughes31fc69f2023-06-20 15:36:11 -0700259 // Android uses a system property instead of /etc/localtime, so make callers crash.
Almaz Mingaleeva52a0da2022-02-28 16:55:50 +0000260 "-DTZDEFAULT=NULL",
Dan Willemsen208ae172015-09-16 16:33:27 -0700261 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700262 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700263 // Include `tzname`, `timezone`, and `daylight` globals.
264 "-DHAVE_POSIX_DECLS=0",
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000265 "-DUSG_COMPAT=2",
266 "-DHAVE_TZNAME=2",
267 // stdbool.h is available
268 "-DHAVE_STDBOOL_H",
Colin Crossa35d23d2015-11-19 13:32:49 -0800269 // Use the empty string (instead of " ") as the timezone abbreviation
270 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700271 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700272 "-Dlint",
273 ],
274
Elliott Hughes2bd43162023-06-15 13:17:08 -0700275 local_include_dirs: [
276 "tzcode/",
277 "upstream-freebsd/android/include",
278 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700279 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700280}
281
282// ========================================================
283// libc_dns.a - modified NetBSD DNS code
284// ========================================================
285
286cc_library_static {
287
Colin Cross50c21ab2015-10-31 23:03:05 -0700288 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700289 srcs: [
Elliott Hughesd0bbfa82021-04-08 11:58:51 -0700290 "dns/**/*.c*",
Dan Willemsen208ae172015-09-16 16:33:27 -0700291
292 "upstream-netbsd/lib/libc/isc/ev_streams.c",
293 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700294 ],
295
Colin Cross50c21ab2015-10-31 23:03:05 -0700296 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700297 "-DANDROID_CHANGES",
298 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700299 "-Wno-unused-parameter",
300 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700301 "-Wframe-larger-than=66000",
Elliott Hughese1dc4f62021-01-11 11:51:29 -0800302 "-include private/bsd_sys_param.h",
Dan Willemsen208ae172015-09-16 16:33:27 -0700303 ],
304
Dan Willemsen208ae172015-09-16 16:33:27 -0700305 local_include_dirs: [
306 "dns/include",
307 "private",
308 "upstream-netbsd/lib/libc/include",
309 "upstream-netbsd/android/include",
310 ],
311
312 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700313}
314
315// ========================================================
316// libc_freebsd.a - upstream FreeBSD C library code
317// ========================================================
318//
319// These files are built with the freebsd-compat.h header file
320// automatically included.
321
322cc_library_static {
Elliott Hughesc2043342023-07-20 20:24:09 +0000323 name: "libc_freebsd_ldexp",
324 defaults: ["libc_defaults"],
325 cflags: ["-Dscalbn=ldexp"],
326 srcs: [":libc_ldexp_srcs"],
327}
328
329cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700330 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700331 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700332 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700333 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
334 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
335 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
336 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700337 "upstream-freebsd/lib/libc/stdlib/qsort.c",
338 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700339 "upstream-freebsd/lib/libc/string/wcpcpy.c",
340 "upstream-freebsd/lib/libc/string/wcpncpy.c",
341 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700342 "upstream-freebsd/lib/libc/string/wcscat.c",
343 "upstream-freebsd/lib/libc/string/wcschr.c",
344 "upstream-freebsd/lib/libc/string/wcscmp.c",
345 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700346 "upstream-freebsd/lib/libc/string/wcscspn.c",
347 "upstream-freebsd/lib/libc/string/wcsdup.c",
348 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700349 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700350 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
351 "upstream-freebsd/lib/libc/string/wcsncat.c",
352 "upstream-freebsd/lib/libc/string/wcsncmp.c",
353 "upstream-freebsd/lib/libc/string/wcsncpy.c",
354 "upstream-freebsd/lib/libc/string/wcsnlen.c",
355 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700356 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700357 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700358 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700359 "upstream-freebsd/lib/libc/string/wcstok.c",
360 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700361 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700362 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700363 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800364 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700365 ],
366 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700367 x86: {
368 exclude_srcs: [
369 "upstream-freebsd/lib/libc/string/wcschr.c",
370 "upstream-freebsd/lib/libc/string/wcscmp.c",
371 "upstream-freebsd/lib/libc/string/wcslen.c",
372 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700373 "upstream-freebsd/lib/libc/string/wmemcmp.c",
374 "upstream-freebsd/lib/libc/string/wcscat.c",
375 "upstream-freebsd/lib/libc/string/wcscpy.c",
376 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700377 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700378 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700379 },
380
Colin Cross50c21ab2015-10-31 23:03:05 -0700381 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700382 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700383 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700384 "-include freebsd-compat.h",
385 ],
386
Dan Willemsen208ae172015-09-16 16:33:27 -0700387 local_include_dirs: [
388 "upstream-freebsd/android/include",
389 ],
390
391 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700392}
393
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700394cc_library_static {
395 defaults: ["libc_defaults"],
396 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700397 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700398 ],
399
400 cflags: [
401 "-Wno-sign-compare",
402 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700403 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700404 ],
405
406 local_include_dirs: [
407 "upstream-freebsd/android/include",
408 ],
409
410 name: "libc_freebsd_large_stack",
411}
412
Dan Willemsen208ae172015-09-16 16:33:27 -0700413// ========================================================
414// libc_netbsd.a - upstream NetBSD C library code
415// ========================================================
416//
417// These files are built with the netbsd-compat.h header file
418// automatically included.
419
420cc_library_static {
421
Colin Cross50c21ab2015-10-31 23:03:05 -0700422 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700423 srcs: [
424 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700425 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700426 "upstream-netbsd/lib/libc/gen/psignal.c",
427 "upstream-netbsd/lib/libc/gen/utime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700428 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
429 "upstream-netbsd/lib/libc/regex/regcomp.c",
430 "upstream-netbsd/lib/libc/regex/regerror.c",
431 "upstream-netbsd/lib/libc/regex/regexec.c",
432 "upstream-netbsd/lib/libc/regex/regfree.c",
433 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700434 "upstream-netbsd/lib/libc/stdlib/drand48.c",
435 "upstream-netbsd/lib/libc/stdlib/erand48.c",
436 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
437 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700438 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
439 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
440 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
441 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
442 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
443 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
444 "upstream-netbsd/lib/libc/stdlib/seed48.c",
445 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700446 ],
447 multilib: {
448 lib32: {
449 // LP32 cruft
450 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
451 },
452 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700453 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700454 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800455 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700456 "-DPOSIX_MISTAKE",
457 "-include netbsd-compat.h",
458 ],
459
Dan Willemsen208ae172015-09-16 16:33:27 -0700460 local_include_dirs: [
461 "upstream-netbsd/android/include",
462 "upstream-netbsd/lib/libc/include",
463 ],
464
465 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700466}
467
468// ========================================================
Elliott Hughes968adf92024-02-08 13:15:53 -0800469// libc_openbsd.a - upstream OpenBSD C library code
Dan Willemsen208ae172015-09-16 16:33:27 -0700470// ========================================================
471//
472// These files are built with the openbsd-compat.h header file
473// automatically included.
Dan Willemsen208ae172015-09-16 16:33:27 -0700474cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700475 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700476 srcs: [
Elliott Hughes968adf92024-02-08 13:15:53 -0800477 "upstream-openbsd/lib/libc/crypt/arc4random.c",
478 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700479 "upstream-openbsd/lib/libc/gen/alarm.c",
480 "upstream-openbsd/lib/libc/gen/ctype_.c",
481 "upstream-openbsd/lib/libc/gen/daemon.c",
482 "upstream-openbsd/lib/libc/gen/err.c",
483 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700484 "upstream-openbsd/lib/libc/gen/fnmatch.c",
485 "upstream-openbsd/lib/libc/gen/ftok.c",
486 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700487 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700488 "upstream-openbsd/lib/libc/gen/verr.c",
489 "upstream-openbsd/lib/libc/gen/verrx.c",
490 "upstream-openbsd/lib/libc/gen/vwarn.c",
491 "upstream-openbsd/lib/libc/gen/vwarnx.c",
492 "upstream-openbsd/lib/libc/gen/warn.c",
493 "upstream-openbsd/lib/libc/gen/warnx.c",
494 "upstream-openbsd/lib/libc/locale/btowc.c",
495 "upstream-openbsd/lib/libc/locale/mbrlen.c",
496 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
497 "upstream-openbsd/lib/libc/locale/mbtowc.c",
498 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 "upstream-openbsd/lib/libc/locale/wcstombs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700500 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
501 "upstream-openbsd/lib/libc/locale/wctob.c",
502 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700503 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700504 "upstream-openbsd/lib/libc/net/htonl.c",
505 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700506 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
507 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
508 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700509 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
510 "upstream-openbsd/lib/libc/net/inet_ntop.c",
511 "upstream-openbsd/lib/libc/net/inet_pton.c",
512 "upstream-openbsd/lib/libc/net/ntohl.c",
513 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800514 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700515 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700516 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
517 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700518 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700519 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700520 "upstream-openbsd/lib/libc/stdio/fputwc.c",
521 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700522 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700523 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700524 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700525 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700526 "upstream-openbsd/lib/libc/stdio/makebuf.c",
527 "upstream-openbsd/lib/libc/stdio/mktemp.c",
528 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
529 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700530 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700531 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700532 "upstream-openbsd/lib/libc/stdio/ungetc.c",
533 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
534 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
535 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700536 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
537 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
538 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700539 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700540 "upstream-openbsd/lib/libc/stdio/wsetup.c",
541 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800542 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700543 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700544 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/stdlib/insque.c",
546 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
547 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
548 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800549 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700550 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800551 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700552 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughes26b06072020-07-31 11:00:10 -0700553 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700554 "upstream-openbsd/lib/libc/stdlib/remque.c",
555 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700556 "upstream-openbsd/lib/libc/stdlib/tfind.c",
557 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800558 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700559 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800560 "upstream-openbsd/lib/libc/string/strcasestr.c",
561 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700562 "upstream-openbsd/lib/libc/string/strcspn.c",
563 "upstream-openbsd/lib/libc/string/strdup.c",
564 "upstream-openbsd/lib/libc/string/strndup.c",
565 "upstream-openbsd/lib/libc/string/strpbrk.c",
566 "upstream-openbsd/lib/libc/string/strsep.c",
567 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700568 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800569 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700570 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700571 "upstream-openbsd/lib/libc/string/wcswidth.c",
Colin Cross69bcb8b2021-09-08 13:24:16 -0700572
573 // This file is originally from OpenBSD, and benefits from
574 // being compiled with openbsd-compat.h.
Elliott Hughes968adf92024-02-08 13:15:53 -0800575 // TODO: clean this up instead.
Colin Cross69bcb8b2021-09-08 13:24:16 -0700576 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700577 ],
578
Elliott Hughes7d136662023-10-27 15:40:32 -0700579 // Each architecture has optimized versions of some routines,
580 // and only includes the portable C versions of ones it's missing.
Dan Willemsen208ae172015-09-16 16:33:27 -0700581 arch: {
582 arm: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700583 srcs: [
584 "upstream-openbsd/lib/libc/string/memchr.c",
585 "upstream-openbsd/lib/libc/string/memrchr.c",
586 "upstream-openbsd/lib/libc/string/stpncpy.c",
587 "upstream-openbsd/lib/libc/string/strlcat.c",
588 "upstream-openbsd/lib/libc/string/strlcpy.c",
589 "upstream-openbsd/lib/libc/string/strncat.c",
590 "upstream-openbsd/lib/libc/string/strncmp.c",
591 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700592 ],
593 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700594 arm64: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700595 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700596 "upstream-openbsd/lib/libc/string/strcat.c",
Elliott Hughesaefe9992023-11-08 12:04:41 -0800597 "upstream-openbsd/lib/libc/string/stpncpy.c",
Elliott Hughes7d136662023-10-27 15:40:32 -0700598 "upstream-openbsd/lib/libc/string/strlcat.c",
599 "upstream-openbsd/lib/libc/string/strlcpy.c",
600 "upstream-openbsd/lib/libc/string/strncat.c",
601 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700602 ],
603 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000604 riscv64: {
605 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700606 "upstream-openbsd/lib/libc/string/memrchr.c",
607 "upstream-openbsd/lib/libc/string/stpncpy.c",
608 "upstream-openbsd/lib/libc/string/strlcat.c",
609 "upstream-openbsd/lib/libc/string/strlcpy.c",
Elliott Hughesebc19a92022-10-14 23:25:36 +0000610 ],
611 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700612 x86: {
Elliott Hughesaefe9992023-11-08 12:04:41 -0800613 srcs: [
614 // x86 has custom implementations of all of these.
615 ],
Elliott Hughes7d136662023-10-27 15:40:32 -0700616 },
617 x86_64: {
618 srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800619 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800620 "upstream-openbsd/lib/libc/string/memrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700621 "upstream-openbsd/lib/libc/string/strlcat.c",
622 "upstream-openbsd/lib/libc/string/strlcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800623 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700624 },
625 },
626
Colin Cross50c21ab2015-10-31 23:03:05 -0700627 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700628 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700629 "-Wno-unused-parameter",
630 "-include openbsd-compat.h",
631 ],
632
Dan Willemsen208ae172015-09-16 16:33:27 -0700633 local_include_dirs: [
634 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700635 "upstream-openbsd/android/include",
Elliott Hughes968adf92024-02-08 13:15:53 -0800636 "stdio",
637 "upstream-openbsd/lib/libc/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700638 ],
639
640 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700641}
642
Elliott Hughes968adf92024-02-08 13:15:53 -0800643cc_library_static {
644 name: "libc_openbsd_large_stack",
645 defaults: ["libc_defaults"],
646 srcs: [
647 "stdio/vfprintf.cpp",
648 "stdio/vfwprintf.cpp",
649 "upstream-openbsd/lib/libc/string/memmem.c",
650 "upstream-openbsd/lib/libc/string/strstr.c",
651 ],
652 cflags: [
653 "-include openbsd-compat.h",
654 "-Wno-sign-compare",
655 "-Wframe-larger-than=5000",
656 ],
657
658 local_include_dirs: [
659 "private",
660 "upstream-openbsd/android/include/",
661 "upstream-openbsd/lib/libc/gdtoa/",
662 "upstream-openbsd/lib/libc/include/",
663 "upstream-openbsd/lib/libc/stdio/",
664 ],
665}
666
Dan Willemsen208ae172015-09-16 16:33:27 -0700667// ========================================================
668// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
669// ========================================================
670//
671// These files are built with the openbsd-compat.h header file
672// automatically included.
673
674cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700675 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700676 srcs: [
677 "upstream-openbsd/android/gdtoa_support.cpp",
678 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
679 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
680 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
681 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
682 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
683 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
684 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
685 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
686 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
687 "upstream-openbsd/lib/libc/gdtoa/misc.c",
688 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
689 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
690 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
691 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
692 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
693 "upstream-openbsd/lib/libc/gdtoa/sum.c",
694 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
695 ],
696 multilib: {
697 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800698 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700699 },
700 },
701
Colin Cross50c21ab2015-10-31 23:03:05 -0700702 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700703 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700704 "-include openbsd-compat.h",
705 ],
706
Dan Willemsen208ae172015-09-16 16:33:27 -0700707 local_include_dirs: [
708 "private",
709 "upstream-openbsd/android/include",
710 "upstream-openbsd/lib/libc/include",
711 ],
712
713 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700714}
715
716// ========================================================
Pierre-Clément Tosi467e58e2023-02-01 13:44:43 +0000717// libc_fortify.a - container for our FORTIFY
George Burgess IV6cb06872017-07-21 13:28:42 -0700718// implementation details
719// ========================================================
720cc_library_static {
721 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700722 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700723
724 name: "libc_fortify",
725
726 // Disable FORTIFY for the compilation of these, so we don't end up having
727 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800728 cflags: [
729 "-U_FORTIFY_SOURCE",
730 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
731 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700732
733 arch: {
734 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800735 cflags: [
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800736 "-DRENAME___STRCAT_CHK",
737 "-DRENAME___STRCPY_CHK",
738 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700739 srcs: [
740 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800741
742 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
743 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
744
745 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
746 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
747
748 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
749 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
750
751 "arch-arm/krait/bionic/__strcat_chk.S",
752 "arch-arm/krait/bionic/__strcpy_chk.S",
753
754 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
755 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
756
Haibo Huang01bfd892018-12-03 15:05:16 -0800757 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
758 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700759 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700760 },
761 arm64: {
762 srcs: [
Elliott Hughes023e4e72022-11-17 19:27:02 +0000763 "arch-arm64/string/__memcpy_chk.S",
764 "arch-arm64/string/__memset_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700765 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700766 },
caowenchengab457f92023-03-06 14:57:55 +0800767 riscv64: {
768 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000769 "arch-riscv64/string/__memset_chk.S",
770 "arch-riscv64/string/__memcpy_chk.S",
caowenchengab457f92023-03-06 14:57:55 +0800771 ],
772 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700773 },
774}
775
776// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700777// libc_bionic.a - home-grown C library code
778// ========================================================
779
780cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700781 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700782 srcs: [
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800783 "bionic/NetdClientDispatch.cpp",
784 "bionic/__bionic_get_shell_path.cpp",
785 "bionic/__cmsg_nxthdr.cpp",
786 "bionic/__cxa_thread_atexit_impl.cpp",
787 "bionic/__errno.cpp",
788 "bionic/__gnu_basename.cpp",
789 "bionic/__libc_current_sigrtmax.cpp",
790 "bionic/__libc_current_sigrtmin.cpp",
791 "bionic/abort.cpp",
792 "bionic/accept.cpp",
793 "bionic/access.cpp",
Florian Mayerca4749a2024-02-14 12:55:46 -0800794 "bionic/android_crash_detail.cpp",
Josh Gao10ec9282017-04-03 15:13:29 -0700795 "bionic/android_set_abort_message.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000796 "bionic/android_unsafe_frame_pointer_chase.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800797 "bionic/arpa_inet.cpp",
798 "bionic/assert.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000799 "bionic/atexit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800800 "bionic/atof.cpp",
801 "bionic/bionic_allocator.cpp",
802 "bionic/bionic_arc4random.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000803 "bionic/bionic_elf_tls.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800804 "bionic/bionic_futex.cpp",
805 "bionic/bionic_netlink.cpp",
806 "bionic/bionic_systrace.cpp",
807 "bionic/bionic_time_conversions.cpp",
808 "bionic/brk.cpp",
809 "bionic/c16rtomb.cpp",
810 "bionic/c32rtomb.cpp",
811 "bionic/chmod.cpp",
812 "bionic/chown.cpp",
813 "bionic/clearenv.cpp",
814 "bionic/clock.cpp",
815 "bionic/clock_getcpuclockid.cpp",
816 "bionic/clock_nanosleep.cpp",
817 "bionic/clone.cpp",
818 "bionic/ctype.cpp",
819 "bionic/dirent.cpp",
820 "bionic/dup.cpp",
821 "bionic/environ.cpp",
822 "bionic/error.cpp",
823 "bionic/eventfd.cpp",
824 "bionic/exec.cpp",
825 "bionic/execinfo.cpp",
Elliott Hughes69bd8e92024-02-09 10:04:26 -0800826 "bionic/exit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800827 "bionic/faccessat.cpp",
828 "bionic/fchmod.cpp",
829 "bionic/fchmodat.cpp",
830 "bionic/fcntl.cpp",
831 "bionic/fdsan.cpp",
832 "bionic/fdtrack.cpp",
833 "bionic/ffs.cpp",
834 "bionic/fgetxattr.cpp",
835 "bionic/flistxattr.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000836 "bionic/fork.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800837 "bionic/fpclassify.cpp",
838 "bionic/fsetxattr.cpp",
839 "bionic/ftruncate.cpp",
840 "bionic/ftw.cpp",
841 "bionic/futimens.cpp",
842 "bionic/getcwd.cpp",
843 "bionic/getdomainname.cpp",
844 "bionic/getentropy.cpp",
845 "bionic/gethostname.cpp",
846 "bionic/getloadavg.cpp",
847 "bionic/getpagesize.cpp",
848 "bionic/getpgrp.cpp",
849 "bionic/getpid.cpp",
850 "bionic/getpriority.cpp",
851 "bionic/gettid.cpp",
852 "bionic/get_device_api_level.cpp",
853 "bionic/grp_pwd.cpp",
854 "bionic/grp_pwd_file.cpp",
855 "bionic/heap_zero_init.cpp",
856 "bionic/iconv.cpp",
857 "bionic/icu_wrappers.cpp",
858 "bionic/ifaddrs.cpp",
859 "bionic/inotify_init.cpp",
860 "bionic/ioctl.cpp",
Elliott Hughes17e40682024-02-13 16:32:29 -0800861 "bionic/isatty.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800862 "bionic/killpg.cpp",
863 "bionic/langinfo.cpp",
864 "bionic/lchown.cpp",
865 "bionic/lfs64_support.cpp",
866 "bionic/libc_init_common.cpp",
867 "bionic/libgen.cpp",
868 "bionic/link.cpp",
869 "bionic/locale.cpp",
870 "bionic/lockf.cpp",
871 "bionic/lstat.cpp",
872 "bionic/mblen.cpp",
873 "bionic/mbrtoc16.cpp",
874 "bionic/mbrtoc32.cpp",
875 "bionic/mempcpy.cpp",
876 "bionic/memset_explicit.cpp",
877 "bionic/mkdir.cpp",
878 "bionic/mkfifo.cpp",
879 "bionic/mknod.cpp",
880 "bionic/mntent.cpp",
881 "bionic/mremap.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800882 "bionic/netdb.cpp",
Elliott Hughes3ed6e722024-02-16 01:18:01 +0000883 "bionic/net_if.cpp",
884 "bionic/netinet_ether.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800885 "bionic/netinet_in.cpp",
886 "bionic/nl_types.cpp",
887 "bionic/open.cpp",
888 "bionic/pathconf.cpp",
889 "bionic/pause.cpp",
890 "bionic/pidfd.cpp",
891 "bionic/pipe.cpp",
892 "bionic/poll.cpp",
893 "bionic/posix_fadvise.cpp",
894 "bionic/posix_fallocate.cpp",
895 "bionic/posix_madvise.cpp",
896 "bionic/posix_timers.cpp",
897 "bionic/preadv_pwritev.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000898 "bionic/pthread_atfork.cpp",
899 "bionic/pthread_attr.cpp",
900 "bionic/pthread_barrier.cpp",
901 "bionic/pthread_cond.cpp",
902 "bionic/pthread_create.cpp",
903 "bionic/pthread_detach.cpp",
904 "bionic/pthread_equal.cpp",
905 "bionic/pthread_exit.cpp",
906 "bionic/pthread_getcpuclockid.cpp",
907 "bionic/pthread_getschedparam.cpp",
908 "bionic/pthread_gettid_np.cpp",
909 "bionic/pthread_internal.cpp",
910 "bionic/pthread_join.cpp",
911 "bionic/pthread_key.cpp",
912 "bionic/pthread_kill.cpp",
913 "bionic/pthread_mutex.cpp",
914 "bionic/pthread_once.cpp",
915 "bionic/pthread_rwlock.cpp",
916 "bionic/pthread_sigqueue.cpp",
917 "bionic/pthread_self.cpp",
918 "bionic/pthread_setname_np.cpp",
919 "bionic/pthread_setschedparam.cpp",
920 "bionic/pthread_spinlock.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800921 "bionic/ptrace.cpp",
922 "bionic/pty.cpp",
923 "bionic/raise.cpp",
924 "bionic/rand.cpp",
925 "bionic/readlink.cpp",
926 "bionic/realpath.cpp",
927 "bionic/reboot.cpp",
928 "bionic/recv.cpp",
929 "bionic/recvmsg.cpp",
930 "bionic/rename.cpp",
931 "bionic/rmdir.cpp",
932 "bionic/scandir.cpp",
Elliott Hughes17e40682024-02-13 16:32:29 -0800933 "bionic/sched_cpualloc.cpp",
934 "bionic/sched_cpucount.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800935 "bionic/sched_getaffinity.cpp",
936 "bionic/sched_getcpu.cpp",
937 "bionic/semaphore.cpp",
938 "bionic/send.cpp",
939 "bionic/setegid.cpp",
940 "bionic/seteuid.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000941 "bionic/setjmp_cookie.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800942 "bionic/setpgrp.cpp",
943 "bionic/sigaction.cpp",
944 "bionic/signal.cpp",
945 "bionic/sigprocmask.cpp",
946 "bionic/sleep.cpp",
947 "bionic/socketpair.cpp",
948 "bionic/spawn.cpp",
949 "bionic/stat.cpp",
950 "bionic/stdlib_l.cpp",
951 "bionic/strerror.cpp",
952 "bionic/string_l.cpp",
953 "bionic/strings_l.cpp",
954 "bionic/strsignal.cpp",
955 "bionic/strtol.cpp",
956 "bionic/strtold.cpp",
957 "bionic/swab.cpp",
958 "bionic/symlink.cpp",
959 "bionic/sync_file_range.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000960 "bionic/sysconf.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800961 "bionic/sys_epoll.cpp",
962 "bionic/sys_msg.cpp",
963 "bionic/sys_sem.cpp",
964 "bionic/sys_shm.cpp",
965 "bionic/sys_signalfd.cpp",
966 "bionic/sys_statfs.cpp",
967 "bionic/sys_statvfs.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000968 "bionic/sys_thread_properties.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800969 "bionic/sys_time.cpp",
970 "bionic/sysinfo.cpp",
971 "bionic/syslog.cpp",
Elliott Hughes69bd8e92024-02-09 10:04:26 -0800972 "bionic/sysprop_helpers.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800973 "bionic/system.cpp",
974 "bionic/system_property_api.cpp",
975 "bionic/system_property_set.cpp",
976 "bionic/tdestroy.cpp",
977 "bionic/termios.cpp",
978 "bionic/thread_private.cpp",
979 "bionic/threads.cpp",
980 "bionic/time.cpp",
981 "bionic/time_l.cpp",
982 "bionic/tmpfile.cpp",
983 "bionic/umount.cpp",
984 "bionic/unlink.cpp",
985 "bionic/usleep.cpp",
986 "bionic/utmp.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000987 "bionic/vdso.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800988 "bionic/wait.cpp",
989 "bionic/wchar.cpp",
990 "bionic/wchar_l.cpp",
991 "bionic/wcstod.cpp",
992 "bionic/wctype.cpp",
993 "bionic/wcwidth.cpp",
994 "bionic/wmempcpy.cpp",
995
Elliott Hughes69bd8e92024-02-09 10:04:26 -0800996 // Forked but not yet cleaned up/rewritten stdio code.
997 // TODO: finish cleanup.
998 "stdio/fmemopen.cpp",
999 "stdio/parsefloat.c",
1000 "stdio/refill.c",
1001 "stdio/stdio.cpp",
1002 "stdio/stdio_ext.cpp",
1003 "stdio/vfscanf.cpp",
1004 "stdio/vfwscanf.cpp",
1005
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001006 // TODO: why isn't this in a static-libc-only module?
1007 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1008 // which will be overridden by the actual one in libc.so.
1009 "bionic/icu_static.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001010 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001011
1012 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001013 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -07001014 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001015 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -08001016 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001017 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001018 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001019 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001020 "arch-arm/bionic/atomics_arm.c",
1021 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -08001022 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001023 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001024 "arch-arm/bionic/setjmp.S",
1025 "arch-arm/bionic/syscall.S",
1026 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001027
Haibo Huangea9957a2018-11-19 11:00:32 -08001028 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001029 "arch-arm/cortex-a7/bionic/memset.S",
1030
1031 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001032 "arch-arm/cortex-a9/bionic/memset.S",
1033 "arch-arm/cortex-a9/bionic/stpcpy.S",
1034 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001035 "arch-arm/cortex-a9/bionic/strcpy.S",
1036 "arch-arm/cortex-a9/bionic/strlen.S",
1037
Elliott Hughesaefe9992023-11-08 12:04:41 -08001038 "arch-arm/cortex-a15/bionic/memcpy.S",
1039 "arch-arm/cortex-a15/bionic/memmove.S",
1040 "arch-arm/cortex-a15/bionic/memset.S",
1041 "arch-arm/cortex-a15/bionic/stpcpy.S",
1042 "arch-arm/cortex-a15/bionic/strcat.S",
1043 "arch-arm/cortex-a15/bionic/strcmp.S",
1044 "arch-arm/cortex-a15/bionic/strcpy.S",
1045 "arch-arm/cortex-a15/bionic/strlen.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001046
1047 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001048
Haibo Huang01bfd892018-12-03 15:05:16 -08001049 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001050
Elliott Hughesaefe9992023-11-08 12:04:41 -08001051 "arch-arm/generic/bionic/memcmp.S",
1052 "arch-arm/generic/bionic/memmove.S",
1053 "arch-arm/generic/bionic/memset.S",
1054 "arch-arm/generic/bionic/stpcpy.c",
1055 "arch-arm/generic/bionic/strcat.c",
1056 "arch-arm/generic/bionic/strcmp.S",
1057 "arch-arm/generic/bionic/strcpy.S",
1058 "arch-arm/generic/bionic/strlen.c",
1059
1060 "arch-arm/krait/bionic/memcpy.S",
1061 "arch-arm/krait/bionic/memset.S",
1062
Haibo Huangea9957a2018-11-19 11:00:32 -08001063 "arch-arm/kryo/bionic/memcpy.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001064
1065 "bionic/strchr.cpp",
1066 "bionic/strchrnul.cpp",
1067 "bionic/strnlen.cpp",
1068 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001069 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001070 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001071 arm64: {
1072 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001073 "arch-arm64/bionic/__bionic_clone.S",
1074 "arch-arm64/bionic/_exit_with_stack_teardown.S",
1075 "arch-arm64/bionic/setjmp.S",
1076 "arch-arm64/bionic/syscall.S",
1077 "arch-arm64/bionic/vfork.S",
Vaisakh K V83e55842024-03-29 12:47:39 +05301078 "arch-arm64/oryon/memcpy-nt.S",
Vaisakh K V54a61212024-03-29 13:32:45 +05301079 "arch-arm64/oryon/memset-nt.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001080 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001081 },
1082
Elliott Hughesebc19a92022-10-14 23:25:36 +00001083 riscv64: {
1084 srcs: [
1085 "arch-riscv64/bionic/__bionic_clone.S",
1086 "arch-riscv64/bionic/_exit_with_stack_teardown.S",
Elliott Hughese1905ed2022-10-17 23:23:36 +00001087 "arch-riscv64/bionic/setjmp.S",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001088 "arch-riscv64/bionic/syscall.S",
1089 "arch-riscv64/bionic/vfork.S",
Yun Hsiang40a82d02023-05-26 10:10:40 +08001090
Elliott Hughesaefe9992023-11-08 12:04:41 -08001091 "arch-riscv64/string/memchr_v.S",
1092 "arch-riscv64/string/memcmp_v.S",
1093 "arch-riscv64/string/memcpy_v.S",
1094 "arch-riscv64/string/memmove_v.S",
1095 "arch-riscv64/string/memset_v.S",
1096 "arch-riscv64/string/stpcpy_v.S",
1097 "arch-riscv64/string/strcat_v.S",
1098 "arch-riscv64/string/strchr_v.S",
1099 "arch-riscv64/string/strcmp_v.S",
1100 "arch-riscv64/string/strcpy_v.S",
1101 "arch-riscv64/string/strlen_v.S",
1102 "arch-riscv64/string/strncat_v.S",
1103 "arch-riscv64/string/strncmp_v.S",
1104 "arch-riscv64/string/strncpy_v.S",
1105 "arch-riscv64/string/strnlen_v.S",
1106
1107 "arch-riscv64/string/memchr.c",
1108 "arch-riscv64/string/memcmp.c",
1109 "arch-riscv64/string/memcpy.c",
1110 "arch-riscv64/string/memmove.c",
1111 "arch-riscv64/string/memset.c",
1112 "arch-riscv64/string/stpcpy.c",
1113 "arch-riscv64/string/strcat.c",
1114 "arch-riscv64/string/strchr.c",
1115 "arch-riscv64/string/strcmp.c",
1116 "arch-riscv64/string/strcpy.c",
1117 "arch-riscv64/string/strlen.c",
1118 "arch-riscv64/string/strncat.c",
1119 "arch-riscv64/string/strncmp.c",
1120 "arch-riscv64/string/strncpy.c",
1121 "arch-riscv64/string/strnlen.c",
Prashanth Swaminathana4d71022023-10-30 17:35:19 -07001122
Elliott Hughes7d136662023-10-27 15:40:32 -07001123 "bionic/strchrnul.cpp",
1124 "bionic/strrchr.cpp",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001125 ],
1126 },
1127
Dan Willemsen208ae172015-09-16 16:33:27 -07001128 x86: {
1129 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001130 "arch-x86/bionic/__bionic_clone.S",
1131 "arch-x86/bionic/_exit_with_stack_teardown.S",
1132 "arch-x86/bionic/libcrt_compat.c",
Elliott Hughes7d136662023-10-27 15:40:32 -07001133 "arch-x86/bionic/setjmp.S",
1134 "arch-x86/bionic/syscall.S",
1135 "arch-x86/bionic/vfork.S",
1136 "arch-x86/bionic/__x86.get_pc_thunk.S",
1137
Dan Willemsen208ae172015-09-16 16:33:27 -07001138 "arch-x86/generic/string/memcmp.S",
1139 "arch-x86/generic/string/strcmp.S",
1140 "arch-x86/generic/string/strncmp.S",
1141 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001142
1143 "arch-x86/generic/string/strlcat.c",
1144 "arch-x86/generic/string/strlcpy.c",
1145 "arch-x86/generic/string/strncat.c",
1146 "arch-x86/generic/string/wcscat.c",
1147 "arch-x86/generic/string/wcscpy.c",
1148 "arch-x86/generic/string/wmemcmp.c",
1149
Elliott Hughesed777142022-07-25 16:25:11 +00001150 "arch-x86/string/sse2-memchr-atom.S",
1151 "arch-x86/string/sse2-memmove-slm.S",
1152 "arch-x86/string/sse2-memrchr-atom.S",
1153 "arch-x86/string/sse2-memset-atom.S",
1154 "arch-x86/string/sse2-memset-slm.S",
1155 "arch-x86/string/sse2-stpcpy-slm.S",
1156 "arch-x86/string/sse2-stpncpy-slm.S",
1157 "arch-x86/string/sse2-strchr-atom.S",
1158 "arch-x86/string/sse2-strcpy-slm.S",
1159 "arch-x86/string/sse2-strlen-slm.S",
1160 "arch-x86/string/sse2-strncpy-slm.S",
1161 "arch-x86/string/sse2-strnlen-atom.S",
1162 "arch-x86/string/sse2-strrchr-atom.S",
1163 "arch-x86/string/sse2-wcschr-atom.S",
1164 "arch-x86/string/sse2-wcsrchr-atom.S",
1165 "arch-x86/string/sse2-wcslen-atom.S",
1166 "arch-x86/string/sse2-wcscmp-atom.S",
1167 "arch-x86/string/sse2-strlen-atom.S",
1168
1169 "arch-x86/string/ssse3-memcmp-atom.S",
1170 "arch-x86/string/ssse3-memmove-atom.S",
1171 "arch-x86/string/ssse3-strcat-atom.S",
1172 "arch-x86/string/ssse3-strcmp-atom.S",
1173 "arch-x86/string/ssse3-strcpy-atom.S",
1174 "arch-x86/string/ssse3-strlcat-atom.S",
1175 "arch-x86/string/ssse3-strlcpy-atom.S",
1176 "arch-x86/string/ssse3-strncat-atom.S",
1177 "arch-x86/string/ssse3-strncmp-atom.S",
1178 "arch-x86/string/ssse3-strncpy-atom.S",
1179 "arch-x86/string/ssse3-wcscat-atom.S",
1180 "arch-x86/string/ssse3-wcscpy-atom.S",
1181 "arch-x86/string/ssse3-wmemcmp-atom.S",
1182
1183 "arch-x86/string/sse4-memcmp-slm.S",
1184 "arch-x86/string/sse4-wmemcmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001185
1186 "bionic/strchrnul.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001187 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001188 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001189 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001190 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001191 "arch-x86_64/bionic/__bionic_clone.S",
1192 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1193 "arch-x86_64/bionic/__restore_rt.S",
1194 "arch-x86_64/bionic/setjmp.S",
1195 "arch-x86_64/bionic/syscall.S",
1196 "arch-x86_64/bionic/vfork.S",
1197
ahs919fb7f2022-06-10 07:11:14 +05301198 "arch-x86_64/string/avx2-memset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001199 "arch-x86_64/string/sse2-memmove-slm.S",
1200 "arch-x86_64/string/sse2-memset-slm.S",
1201 "arch-x86_64/string/sse2-stpcpy-slm.S",
1202 "arch-x86_64/string/sse2-stpncpy-slm.S",
1203 "arch-x86_64/string/sse2-strcat-slm.S",
1204 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001205 "arch-x86_64/string/sse2-strlen-slm.S",
1206 "arch-x86_64/string/sse2-strncat-slm.S",
1207 "arch-x86_64/string/sse2-strncpy-slm.S",
1208 "arch-x86_64/string/sse4-memcmp-slm.S",
1209 "arch-x86_64/string/ssse3-strcmp-slm.S",
1210 "arch-x86_64/string/ssse3-strncmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001211
1212 "bionic/strchr.cpp",
1213 "bionic/strchrnul.cpp",
1214 "bionic/strnlen.cpp",
1215 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001216 ],
1217 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001218 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001219
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001220 multilib: {
1221 lib32: {
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001222 srcs: [
1223 // off64_t/time64_t support on LP32.
1224 "bionic/legacy_32_bit_support.cpp",
1225 "bionic/time64.c",
1226
1227 // TODO: move to libc/bionic/legacy_32_bit_support.cpp or #if __LP64__ instead.
1228 "bionic/mmap.cpp",
1229 ],
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001230 },
1231 },
1232
1233 local_include_dirs: ["stdio"],
1234 generated_headers: ["generated_android_ids"],
1235
1236 whole_static_libs: [
1237 "libsystemproperties",
1238 ],
1239
Colin Cross50c21ab2015-10-31 23:03:05 -07001240 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001241 include_dirs: ["bionic/libstdc++/include"],
1242 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001243}
1244
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001245genrule {
1246 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001247 out: ["generated_android_ids.h"],
1248 srcs: [":android_filesystem_config_header"],
Cole Faustb1a0a9d2023-11-28 17:51:16 -08001249 tools: ["fs_config_generator"],
1250 cmd: "$(location fs_config_generator) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001251}
1252
Dan Willemsen268a6732015-10-15 14:49:45 -07001253// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001254// libc_syscalls.a
1255// ========================================================
1256
Elliott Hughes782c4852019-04-16 12:31:00 -07001257genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001258 name: "syscalls-arm",
Elliott Hughes782c4852019-04-16 12:31:00 -07001259 out: ["syscalls-arm.S"],
1260 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001261 tools: ["gensyscalls"],
1262 cmd: "$(location gensyscalls) arm $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001263}
1264
1265genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001266 name: "syscalls-arm64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001267 out: ["syscalls-arm64.S"],
1268 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001269 tools: ["gensyscalls"],
1270 cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001271}
1272
1273genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001274 name: "syscalls-riscv64",
Elliott Hughes704772b2022-10-10 17:06:43 +00001275 out: ["syscalls-riscv64.S"],
1276 srcs: ["SYSCALLS.TXT"],
1277 tools: ["gensyscalls"],
1278 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
1279}
1280
1281genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001282 name: "syscalls-x86",
Elliott Hughes782c4852019-04-16 12:31:00 -07001283 out: ["syscalls-x86.S"],
1284 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001285 tools: ["gensyscalls"],
1286 cmd: "$(location gensyscalls) x86 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001287}
1288
1289genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001290 name: "syscalls-x86_64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001291 out: ["syscalls-x86_64.S"],
1292 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001293 tools: ["gensyscalls"],
1294 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001295}
1296
Dan Willemsen208ae172015-09-16 16:33:27 -07001297cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001298 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001299 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001300 arch: {
1301 arm: {
Cole Faustf5968d82023-04-11 15:20:19 -07001302 srcs: [":syscalls-arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001303 },
1304 arm64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001305 srcs: [":syscalls-arm64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001306 },
Elliott Hughes704772b2022-10-10 17:06:43 +00001307 riscv64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001308 srcs: [":syscalls-riscv64"],
Elliott Hughes704772b2022-10-10 17:06:43 +00001309 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001310 x86: {
Cole Faustf5968d82023-04-11 15:20:19 -07001311 srcs: [":syscalls-x86"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001312 },
1313 x86_64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001314 srcs: [":syscalls-x86_64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001315 },
1316 },
1317 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001318}
1319
1320// ========================================================
1321// libc_aeabi.a
1322// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1323// to avoid infinite recursion. For the other architectures we just build an
1324// empty library to keep this makefile simple.
1325// ========================================================
1326
1327cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001328 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001329 arch: {
1330 arm: {
1331 srcs: ["arch-arm/bionic/__aeabi.c"],
1332 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001333 },
1334 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001335 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001336}
1337
1338// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001339// libc_common.a --- everything shared by libc.a and libc.so
Dan Willemsen208ae172015-09-16 16:33:27 -07001340// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001341
Dan Willemsen208ae172015-09-16 16:33:27 -07001342cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001343 defaults: ["libc_defaults"],
Elliott Hughesb0948922024-01-26 00:28:12 +00001344 name: "libc_common",
1345
Dan Willemsen208ae172015-09-16 16:33:27 -07001346 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001347 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001348 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001349 "libc_bionic",
Ryan Prichard249757b2019-11-01 17:18:28 -07001350 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001351 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001352 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001353 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001354 "libc_freebsd_large_stack",
Elliott Hughesc2043342023-07-20 20:24:09 +00001355 "libc_freebsd_ldexp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001356 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001357 "libc_netbsd",
1358 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001359 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001360 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001361 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001362 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001363 ],
1364
1365 arch: {
1366 arm: {
1367 whole_static_libs: ["libc_aeabi"],
1368 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001369 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001370}
1371
1372// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001373// libc_static_dispatch.a --- libc.a ifuncs
Haibo Huangf71edfa2018-11-12 10:06:56 -08001374// ========================================================
1375cc_library_static {
1376 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001377 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001378
Haibo Huangb9244ff2018-08-11 10:12:13 -07001379 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301380 x86_64: {
1381 srcs: ["arch-x86_64/static_function_dispatch.S"],
1382 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001383 x86: {
1384 srcs: ["arch-x86/static_function_dispatch.S"],
1385 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001386 arm: {
1387 srcs: ["arch-arm/static_function_dispatch.S"],
1388 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001389 arm64: {
1390 srcs: ["arch-arm64/static_function_dispatch.S"],
1391 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001392 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001393 srcs: ["arch-riscv64/static_function_dispatch.S"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001394 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001395 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001396}
1397
1398// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001399// libc_dynamic_dispatch.a --- libc.so ifuncs
Haibo Huangf71edfa2018-11-12 10:06:56 -08001400// ========================================================
1401cc_library_static {
1402 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001403 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001404
Haibo Huangb9244ff2018-08-11 10:12:13 -07001405 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001406 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001407 "-fno-stack-protector",
1408 "-fno-jump-tables",
1409 ],
1410 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301411 x86_64: {
1412 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
1413 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001414 x86: {
1415 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1416 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001417 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001418 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001419 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001420 arm64: {
1421 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1422 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001423 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001424 srcs: ["arch-riscv64/dynamic_function_dispatch.cpp"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001425 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001426 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001427}
1428
1429// ========================================================
1430// libc_common_static.a For static binaries.
1431// ========================================================
1432cc_library_static {
1433 defaults: ["libc_defaults"],
1434 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001435
Haibo Huangf71edfa2018-11-12 10:06:56 -08001436 whole_static_libs: [
1437 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001438 "libc_static_dispatch",
1439 ],
1440}
1441
1442// ========================================================
1443// libc_common_shared.a For shared libraries.
1444// ========================================================
1445cc_library_static {
1446 defaults: ["libc_defaults"],
1447 name: "libc_common_shared",
1448
1449 whole_static_libs: [
1450 "libc_common",
1451 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001452 ],
1453}
1454
Ryan Prichard22a6a052019-10-10 23:59:30 -07001455// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1456// executable.
1457cc_library_static {
1458 name: "libc_unwind_static",
1459 defaults: ["libc_defaults"],
1460 cflags: ["-DLIBC_STATIC"],
1461
1462 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1463 arch: {
1464 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1465 arm: {
1466 srcs: ["arch-arm/bionic/exidx_static.c"],
1467 },
1468 },
1469}
1470
Haibo Huangf71edfa2018-11-12 10:06:56 -08001471// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001472// libc_nomalloc.a
1473// ========================================================
1474//
Ryan Prichard249757b2019-11-01 17:18:28 -07001475// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1476// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1477// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001478
1479cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001480 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001481 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001482
Colin Crossa3f9fca2016-01-11 13:20:55 -08001483 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001484 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001485 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001486 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001487 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001488}
1489
dimitryc0c0ef62018-12-05 16:33:52 +01001490filegroup {
1491 name: "libc_sources_shared",
1492 srcs: [
1493 "arch-common/bionic/crtbegin_so.c",
1494 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001495 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001496 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001497 "bionic/icu.cpp",
1498 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001499 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001500 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001501 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001502 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001503 "bionic/ndk_cruft.cpp",
1504 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001505 "bionic/NetdClient.cpp",
1506 "arch-common/bionic/crtend_so.S",
1507 ],
1508}
1509
1510filegroup {
1511 name: "libc_sources_static",
1512 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001513 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001514 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001515 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001516 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001517 ],
1518}
1519
1520filegroup {
1521 name: "libc_sources_shared_arm",
1522 srcs: [
1523 "arch-arm/bionic/exidx_dynamic.c",
1524 "arch-arm/bionic/atexit_legacy.c",
1525 ],
1526}
1527
Dan Willemsen208ae172015-09-16 16:33:27 -07001528// ========================================================
1529// libc.a + libc.so
1530// ========================================================
Florian Mayerc10d0642023-03-22 16:12:49 -07001531cc_defaults {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001532 defaults: [
1533 "libc_defaults",
1534 "libc_native_allocator_defaults",
1535 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001536 name: "libc_library_defaults",
Colin Cross50c21ab2015-10-31 23:03:05 -07001537 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001538 platform_sdk_version: {
1539 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1540 },
1541 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001542 static: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001543 srcs: [":libc_sources_static"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001544 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001545 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001546 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001547 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001548 "libc_init_static",
1549 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001550 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001551 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001552 },
1553 shared: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001554 srcs: [":libc_sources_shared"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001555 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001556 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001557 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001558 "libc_init_dynamic",
1559 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001560 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001561 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001562 },
1563
Neil Fullera7db90f2019-04-25 09:28:27 +01001564 required: [
MarkDacekd88d7ea2022-06-28 20:14:58 +00001565 "tzdata_prebuilt",
1566 "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
Neil Fullera7db90f2019-04-25 09:28:27 +01001567 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001568
Colin Cross4ce94d22016-11-15 13:15:43 -08001569 // Do not pack libc.so relocations; see http://b/20645321 for details.
1570 pack_relocations: false,
1571
dimitry06016f22018-01-05 11:39:28 +01001572 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1573 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1574 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1575 // those new libraries from libgcc.a are not declared external; if that were the case,
1576 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1577 // on the external symbols from the dependent libraries. That would create a "cloaked"
1578 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001579
dimitry06016f22018-01-05 11:39:28 +01001580 shared_libs: [
1581 "ld-android",
1582 "libdl",
1583 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001584 static_libs: [
1585 "libdl_android",
1586 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001587
1588 nocrt: true,
1589
Dan Willemsen208ae172015-09-16 16:33:27 -07001590 arch: {
1591 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001592 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001593 pack_relocations: false,
Christopher Ferris9d03a162023-11-10 11:19:11 -08001594 ldflags: [
1595 "-Wl,--hash-style=both",
1596 // Since we are preserving the debug_frame, do not compress
1597 // in this case to make unwinds as fast as possible.
1598 "-Wl,--compress-debug-sections=none",
1599 ],
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001600
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001601 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001602 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001603
Dan Willemsen208ae172015-09-16 16:33:27 -07001604 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001605 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001606 // special for arm
1607 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001608 // For backwards-compatibility, some arm32 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001609 static_libs: ["libclang_rt.builtins-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001610 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001611
1612 // Arm 32 bit does not produce complete exidx unwind information
1613 // so keep the .debug_frame which is relatively small and does
1614 // include needed unwind information.
1615 // See b/132992102 for details.
1616 strip: {
1617 keep_symbols_and_debug_frame: true,
1618 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001619 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001620 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001621 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001622
1623 // Leave the symbols in the shared library so that stack unwinders can produce
1624 // meaningful name resolution.
1625 strip: {
1626 keep_symbols: true,
1627 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001628 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001629 riscv64: {
1630 version_script: ":libc.riscv64.map",
1631
1632 // Leave the symbols in the shared library so that stack unwinders can produce
1633 // meaningful name resolution.
1634 strip: {
1635 keep_symbols: true,
1636 },
1637 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001638 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001639 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001640 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001641 ldflags: ["-Wl,--hash-style=both"],
1642
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001643 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001644 no_libcrt: true,
1645
1646 shared: {
1647 // For backwards-compatibility, some x86 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001648 static_libs: ["libclang_rt.builtins-exported"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001649 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001650
1651 // Leave the symbols in the shared library so that stack unwinders can produce
1652 // meaningful name resolution.
1653 strip: {
1654 keep_symbols: true,
1655 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001656 },
1657 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001658 version_script: ":libc.x86_64.map",
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 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001667
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001668 apex_available: [
1669 "//apex_available:platform",
1670 "com.android.runtime",
1671 ],
1672
Colin Cross7edd0082021-10-28 13:20:35 -07001673 target: {
1674 native_bridge: {
1675 shared: {
1676 installable: false,
1677 },
1678 },
1679 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001680}
1681
Florian Mayerc10d0642023-03-22 16:12:49 -07001682cc_library {
1683 name: "libc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001684 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001685 "libc_library_defaults",
1686 ],
1687 stubs: {
1688 symbol_file: "libc.map.txt",
1689 versions: [
1690 "29",
1691 "R",
1692 "current",
1693 ],
1694 },
1695 static_ndk_lib: true,
1696 llndk: {
1697 symbol_file: "libc.map.txt",
1698 export_headers_as_system: true,
1699 export_preprocessed_headers: ["include"],
1700 export_llndk_headers: ["libc_llndk_headers"],
1701 },
1702}
1703
1704cc_library {
1705 name: "libc_hwasan",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001706 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001707 "libc_library_defaults",
1708 ],
1709 sanitize: {
1710 hwaddress: true,
1711 },
1712 enabled: false,
Florian Mayerff116ed2023-04-14 17:38:53 -07001713 target: {
1714 android_arm64: {
Florian Mayerc10d0642023-03-22 16:12:49 -07001715 enabled: true,
1716 },
1717 },
1718 stem: "libc",
1719 relative_install_path: "hwasan",
1720 // We don't really need the stubs, but this needs to stay to trigger the
1721 // symlink logic in soong.
1722 stubs: {
1723 symbol_file: "libc.map.txt",
1724 },
1725 native_bridge_supported: false,
1726 // It is never correct to depend on this directly. This is only
1727 // needed for the runtime apex, and in base_system.mk.
1728 visibility: ["//bionic/apex"],
1729}
1730
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001731genrule {
1732 name: "libc.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001733 out: ["libc.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001734 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001735 tools: ["generate-version-script"],
1736 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001737}
1738
1739genrule {
1740 name: "libc.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001741 out: ["libc.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001742 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001743 tools: ["generate-version-script"],
1744 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001745}
1746
1747genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001748 name: "libc.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001749 out: ["libc.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001750 srcs: ["libc.map.txt"],
1751 tools: ["generate-version-script"],
1752 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1753}
1754
1755genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001756 name: "libc.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001757 out: ["libc.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001758 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001759 tools: ["generate-version-script"],
1760 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001761}
1762
1763genrule {
1764 name: "libc.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001765 out: ["libc.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001766 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001767 tools: ["generate-version-script"],
1768 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001769}
1770
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001771// Headers that only other parts of the platform can include.
1772cc_library_headers {
1773 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001774 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001775 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001776 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001777 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001778 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001779 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001780 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001781 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001782 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001783 "//system/core/debuggerd:__subpackages__",
Florian Mayerf5d70ce2022-09-13 13:58:30 -07001784 "//system/core/init:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001785 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001786 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001787 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001788 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001789 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001790 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001791 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001792 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001793 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001794 recovery_available: true,
1795 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001796 export_include_dirs: [
1797 "platform",
1798 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001799 system_shared_libs: [],
1800 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001801 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001802
Steven Moreland0cdf1322020-10-05 21:55:26 +00001803 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001804 apex_available: [
1805 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001806 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001807 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001808}
1809
Logan Chien17af91b2019-01-15 21:19:56 +08001810cc_library_headers {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001811 name: "libc_llndk_headers",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001812 visibility: [
1813 "//external/musl",
1814 ],
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001815 llndk: {
1816 llndk_headers: true,
1817 },
Logan Chien17af91b2019-01-15 21:19:56 +08001818 host_supported: true,
1819 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001820 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001821 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001822 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001823 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001824 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001825 apex_available: [
1826 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001827 "//apex_available:anyapex",
1828 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001829 // used by most APEXes indirectly via libunwind_llvm
1830 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001831
1832 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001833 stl: "none",
1834 system_shared_libs: [],
1835
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001836 // The build system generally requires that any dependencies of a target
1837 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1838 // to 1 we let targets with an sdk_version that need to depend on the libc
1839 // headers but cannot depend on libc itself due to circular dependencies
1840 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1841 // is correct because the headers can support any sdk_version.
1842 sdk_version: "1",
1843
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001844 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001845 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001846 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001847 "kernel/android/uapi",
1848 ],
1849
1850 arch: {
1851 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001852 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001853 },
1854 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001855 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001856 },
Elliott Hughes48e53332022-10-07 20:39:25 +00001857 riscv64: {
1858 export_system_include_dirs: ["kernel/uapi/asm-riscv"],
1859 },
Logan Chien17af91b2019-01-15 21:19:56 +08001860 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001861 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001862 },
1863 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001864 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001865 },
1866 },
1867}
1868
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001869cc_library_headers {
1870 name: "libc_headers",
1871 host_supported: true,
1872 native_bridge_supported: true,
1873 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001874 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001875 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001876 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001877 recovery_available: true,
1878 sdk_version: "1",
1879
1880 apex_available: [
1881 "//apex_available:platform",
1882 "//apex_available:anyapex",
1883 ],
1884 // used by most APEXes indirectly via libunwind_llvm
1885 min_sdk_version: "apex_inherit",
1886 visibility: [
1887 "//bionic:__subpackages__", // visible to bionic
1888 // ... and only to these places (b/152668052)
1889 "//external/arm-optimized-routines",
1890 "//external/gwp_asan",
1891 "//external/jemalloc_new",
1892 "//external/libunwind_llvm",
Nick Desaulniers942ae552024-02-12 10:26:19 -08001893 "//external/llvm-libc",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001894 "//external/scudo",
1895 "//system/core/property_service/libpropertyinfoparser",
1896 "//system/extras/toolchain-extras",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001897 ],
1898
1899 stl: "none",
1900 no_libcrt: true,
1901 system_shared_libs: [],
1902
1903 target: {
1904 android: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001905 export_system_include_dirs: ["include"],
1906 header_libs: ["libc_llndk_headers"],
1907 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001908 },
1909 linux_bionic: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001910 export_system_include_dirs: ["include"],
1911 header_libs: ["libc_llndk_headers"],
1912 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001913 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001914 },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001915}
1916
Dan Willemsen208ae172015-09-16 16:33:27 -07001917// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001918// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001919// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001920
Dan Willemsen208ae172015-09-16 16:33:27 -07001921cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001922 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001923 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001924 srcs: [
1925 "bionic/__cxa_guard.cpp",
1926 "bionic/__cxa_pure_virtual.cpp",
1927 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001928 ],
1929 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001930 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001931 static_libs: ["libasync_safe"],
Elliott Hughesc2043342023-07-20 20:24:09 +00001932 apex_available: [
1933 "//apex_available:platform",
1934 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001935
Dan Willemsen6b3be172018-12-03 13:57:20 -08001936 static: {
1937 system_shared_libs: [],
1938 },
Colin Crossb5bfe0b2021-07-13 16:26:28 -07001939 target: {
1940 bionic: {
1941 shared: {
1942 system_shared_libs: ["libc"],
1943 },
1944 },
Dan Willemsen6b3be172018-12-03 13:57:20 -08001945 },
1946
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001947 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001948 arch: {
1949 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001950 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001951 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001952 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001953 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001954 },
1955 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001956 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001957 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001958 riscv64: {
1959 version_script: ":libstdc++.riscv64.map",
1960 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001961 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001962 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001963 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001964 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001965 },
1966 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001967 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001968 },
1969 },
1970}
1971
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001972genrule {
1973 name: "libstdc++.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001974 out: ["libstdc++.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001975 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001976 tools: ["generate-version-script"],
1977 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001978}
1979
1980genrule {
1981 name: "libstdc++.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001982 out: ["libstdc++.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001983 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001984 tools: ["generate-version-script"],
1985 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001986}
1987
1988genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001989 name: "libstdc++.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001990 out: ["libstdc++.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001991 srcs: ["libstdc++.map.txt"],
1992 tools: ["generate-version-script"],
1993 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1994}
1995
1996genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001997 name: "libstdc++.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001998 out: ["libstdc++.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001999 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002000 tools: ["generate-version-script"],
2001 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002002}
2003
2004genrule {
2005 name: "libstdc++.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002006 out: ["libstdc++.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002007 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002008 tools: ["generate-version-script"],
2009 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002010}
2011
2012// ========================================================
2013// crt object files.
2014// ========================================================
2015
Colin Cross50c21ab2015-10-31 23:03:05 -07002016cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002017 name: "crt_and_memtag_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002018 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002019 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002020 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002021 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002022 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002023 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002024 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002025 apex_available: [
2026 "//apex_available:platform",
2027 "//apex_available:anyapex",
2028 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002029 // Generate NDK variants of the CRT objects for every supported API level.
2030 min_sdk_version: "16",
2031 stl: "none",
2032 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002033 cflags: [
2034 "-Wno-gcc-compat",
2035 "-Wall",
2036 "-Werror",
2037 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002038 sanitize: {
2039 never: true,
2040 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002041}
2042
Colin Cross50c21ab2015-10-31 23:03:05 -07002043cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002044 name: "crt_defaults",
2045 defaults: ["crt_and_memtag_defaults"],
Colin Cross02f81372021-07-22 12:02:10 -07002046 system_shared_libs: [],
Colin Cross10d92682021-06-22 13:25:46 -07002047}
2048
2049cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002050 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002051 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002052
2053 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002054 x86: {
2055 cflags: ["-fPIC"],
2056 },
2057 x86_64: {
2058 cflags: ["-fPIC"],
2059 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002060 },
Colin Crossab179442018-09-27 11:03:22 -07002061 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002062}
2063
Dan Willemsen208ae172015-09-16 16:33:27 -07002064cc_object {
2065 name: "crtbrand",
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002066 local_include_dirs: [
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002067 "private", // crtbrand.S depends on private/bionic_asm_note.h
2068 ],
Elliott Hughes6a30b712024-03-13 23:41:32 +00002069 // crtbrand.S needs to know the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002070 product_variables: {
2071 platform_sdk_version: {
2072 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2073 },
2074 },
2075 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002076
Colin Cross7d7b3682017-11-03 13:38:40 -07002077 defaults: ["crt_so_defaults"],
Dan Alberteee46dc2023-04-04 23:27:52 +00002078 // crtbrand is an intermediate artifact, not a final CRT object.
2079 exclude_from_ndk_sysroot: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07002080}
2081
Dan Willemsen208ae172015-09-16 16:33:27 -07002082cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002083 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002084 local_include_dirs: ["include"],
2085 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002086
Colin Cross7d7b3682017-11-03 13:38:40 -07002087 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002088 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002089 "crtbrand",
2090 ],
2091}
2092
Dan Willemsen208ae172015-09-16 16:33:27 -07002093cc_object {
2094 name: "crtend_so",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002095 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002096 "private", // crtend_so.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002097 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002098 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002099
Colin Cross7d7b3682017-11-03 13:38:40 -07002100 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002101}
2102
Dan Willemsen208ae172015-09-16 16:33:27 -07002103cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002104 name: "crtbegin_static",
2105
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002106 local_include_dirs: [
2107 "include",
2108 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2109 ],
Liz Kammere718dd72021-03-09 15:00:06 -05002110
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002111 cflags: ["-DCRTBEGIN_STATIC"],
Yabin Cui744cfd32023-08-24 13:20:23 -07002112
Dan Willemsen208ae172015-09-16 16:33:27 -07002113 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002114 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002115 "crtbrand",
2116 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002117 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002118 // When using libc.a, we're using the latest library regardless of target API level.
2119 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002120}
2121
Dan Willemsen208ae172015-09-16 16:33:27 -07002122cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002123 name: "crtbegin_dynamic",
2124
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002125 local_include_dirs: [
2126 "include",
2127 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2128 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002129 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002130 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002131 "crtbrand",
2132 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002133 target: {
2134 linux_bionic: {
2135 generated_sources: ["host_bionic_linker_asm"],
2136 objs: [
2137 "linker_wrapper",
2138 ],
2139 },
2140 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002141 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002142}
2143
Dan Willemsen208ae172015-09-16 16:33:27 -07002144cc_object {
2145 // We rename crtend.o to crtend_android.o to avoid a
2146 // name clash between gcc and bionic.
2147 name: "crtend_android",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002148 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002149 "private", // crtend.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002150 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002151 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002152
Colin Cross50c21ab2015-10-31 23:03:05 -07002153 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002154}
Colin Crossbaa48992016-07-13 11:15:21 -07002155
Kalesh Singh862a23d2024-01-09 13:13:50 -08002156cc_object {
2157 name: "crt_pad_segment",
2158 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002159 "private", // crt_pad_segment.S depends on private/bionic_asm_note.h
Kalesh Singh862a23d2024-01-09 13:13:50 -08002160 ],
2161 srcs: ["arch-common/bionic/crt_pad_segment.S"],
2162
2163 defaults: ["crt_defaults"],
2164}
2165
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002166cc_library_static {
2167 name: "note_memtag_heap_async",
2168 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002169 arm64: {
2170 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2171 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002172 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002173 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002174
Colin Cross10d92682021-06-22 13:25:46 -07002175 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002176}
2177
2178cc_library_static {
2179 name: "note_memtag_heap_sync",
2180 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002181 arm64: {
2182 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2183 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002184 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002185 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002186
Colin Cross10d92682021-06-22 13:25:46 -07002187 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002188}
2189
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002190// ========================================================
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002191// libc dependencies for baremetal Rust projects.
2192// ========================================================
2193
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002194// This library contains the following unresolved symbols:
2195// __errno
2196// abort
2197// async_safe_fatal_va_list
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002198cc_library_static {
2199 name: "librust_baremetal",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002200 header_libs: ["libc_headers"],
2201 include_dirs: [
2202 "bionic/libc/async_safe/include",
2203 "bionic/libc/platform",
2204 ],
2205 cflags: [
2206 "-Wall",
2207 "-Werror",
2208 ],
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002209 srcs: [
2210 "bionic/fortify.cpp",
Pierre-Clément Tosi816176c2022-11-30 14:33:41 +00002211 "bionic/strtol.cpp",
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002212 ],
2213 arch: {
2214 arm64: {
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002215 srcs: [
2216 "arch-arm64/string/__memcpy_chk.S",
2217 ],
2218 },
caowencheng9a39eb32023-03-20 16:24:41 +08002219 riscv64: {
2220 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002221 "arch-riscv64/string/__memcpy_chk.S",
caowencheng9a39eb32023-03-20 16:24:41 +08002222 ],
2223 },
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002224 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002225 whole_static_libs: [
2226 "libarm-optimized-routines-mem",
Pierre-Clément Tosieb46ac92023-02-01 13:44:57 +00002227 "libc_netbsd",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002228 ],
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002229 system_shared_libs: [],
2230 nocrt: true,
2231 stl: "none",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002232 visibility: [
2233 "//packages/modules/Virtualization/vmbase",
2234 ],
2235}
2236
2237// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002238// NDK headers.
2239// ========================================================
2240
Dan Albert26e1c412018-05-24 14:56:46 -07002241versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002242 name: "common_libc",
2243 from: "include",
2244 to: "",
2245 license: "NOTICE",
2246}
Dan Albert4238a352016-06-28 11:18:05 -07002247
2248ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002249 name: "libc_uapi",
2250 from: "kernel/uapi",
2251 to: "",
2252 srcs: [
2253 "kernel/uapi/asm-generic/**/*.h",
2254 "kernel/uapi/drm/**/*.h",
2255 "kernel/uapi/linux/**/*.h",
2256 "kernel/uapi/misc/**/*.h",
2257 "kernel/uapi/mtd/**/*.h",
2258 "kernel/uapi/rdma/**/*.h",
2259 "kernel/uapi/scsi/**/*.h",
2260 "kernel/uapi/sound/**/*.h",
2261 "kernel/uapi/video/**/*.h",
2262 "kernel/uapi/xen/**/*.h",
2263 ],
Dan Albert92592652016-10-20 01:42:54 -07002264 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002265}
2266
2267ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002268 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002269 from: "kernel/android/uapi/linux",
2270 to: "linux",
2271 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002272 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002273}
2274
2275ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002276 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002277 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002278 to: "scsi",
2279 srcs: ["kernel/android/scsi/**/*.h"],
2280 license: "NOTICE",
2281}
2282
2283ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002284 name: "libc_asm_arm",
2285 from: "kernel/uapi/asm-arm",
2286 to: "arm-linux-androideabi",
2287 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002288 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002289}
2290
2291ndk_headers {
2292 name: "libc_asm_arm64",
2293 from: "kernel/uapi/asm-arm64",
2294 to: "aarch64-linux-android",
2295 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002296 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002297}
2298
Lazar Trsic790d2f72017-11-27 11:54:11 +01002299ndk_headers {
Colin Crossbd26e0f2022-10-19 15:03:14 -07002300 name: "libc_asm_riscv64",
2301 from: "kernel/uapi/asm-riscv",
2302 to: "riscv64-linux-android",
2303 srcs: ["kernel/uapi/asm-riscv/**/*.h"],
2304 license: "NOTICE",
2305}
2306
2307ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002308 name: "libc_asm_x86",
2309 from: "kernel/uapi/asm-x86",
2310 to: "i686-linux-android",
2311 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002312 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002313}
2314
2315ndk_headers {
2316 name: "libc_asm_x86_64",
2317 from: "kernel/uapi/asm-x86",
2318 to: "x86_64-linux-android",
2319 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002320 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002321}
2322
Dan Albert4238a352016-06-28 11:18:05 -07002323ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002324 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002325 symbol_file: "libc.map.txt",
2326 first_version: "9",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002327 export_header_libs: [
2328 "common_libc",
2329 "libc_uapi",
2330 "libc_kernel_android_uapi_linux",
2331 "libc_kernel_android_scsi",
2332 "libc_asm_arm",
2333 "libc_asm_arm64",
Colin Crossbd26e0f2022-10-19 15:03:14 -07002334 "libc_asm_riscv64",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002335 "libc_asm_x86",
2336 "libc_asm_x86_64",
2337 ],
Dan Albert4238a352016-06-28 11:18:05 -07002338}
2339
Dan Albertdf31aff2016-10-06 15:50:41 -07002340ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002341 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002342 symbol_file: "libstdc++.map.txt",
2343 first_version: "9",
2344}
2345
Dan Willemsenca056d72018-01-08 14:00:24 -08002346// Export these headers for toolbox to process
2347filegroup {
2348 name: "kernel_input_headers",
2349 srcs: [
2350 "kernel/uapi/linux/input.h",
2351 "kernel/uapi/linux/input-event-codes.h",
2352 ],
2353}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002354
2355// Generate a syscall name / number mapping. These objects are text files
2356// (thanks to the -dD -E flags) and not binary files. They will then be
2357// consumed by the genseccomp.py script and converted into C++ code.
2358cc_defaults {
2359 name: "libseccomp_gen_syscall_nrs_defaults",
2360 recovery_available: true,
2361 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2362 cflags: [
2363 "-dD",
2364 "-E",
2365 "-Wall",
2366 "-Werror",
2367 "-nostdinc",
2368 ],
2369}
2370
2371cc_object {
2372 name: "libseccomp_gen_syscall_nrs_arm",
2373 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2374 local_include_dirs: [
2375 "kernel/uapi/asm-arm",
2376 "kernel/uapi",
2377 ],
2378}
2379
2380cc_object {
2381 name: "libseccomp_gen_syscall_nrs_arm64",
2382 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2383 local_include_dirs: [
2384 "kernel/uapi/asm-arm64",
2385 "kernel/uapi",
2386 ],
2387}
2388
2389cc_object {
Elliott Hughes704772b2022-10-10 17:06:43 +00002390 name: "libseccomp_gen_syscall_nrs_riscv64",
2391 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2392 local_include_dirs: [
2393 "kernel/uapi/asm-riscv",
2394 "kernel/uapi",
2395 ],
2396}
2397
2398cc_object {
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002399 name: "libseccomp_gen_syscall_nrs_x86",
2400 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2401 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2402 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2403 local_include_dirs: [
2404 "kernel/uapi/asm-x86",
2405 "kernel/uapi",
2406 ],
2407}
2408
2409cc_object {
2410 name: "libseccomp_gen_syscall_nrs_x86_64",
2411 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2412 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2413 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2414 local_include_dirs: [
2415 "kernel/uapi/asm-x86",
2416 "kernel/uapi",
2417 ],
2418}
2419
Jingwen Chenca366332021-01-29 05:16:32 -05002420filegroup {
2421 name: "all_kernel_uapi_headers",
2422 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002423}
2424
Martijn Coenen0c6de752019-01-02 12:52:51 +01002425cc_genrule {
2426 name: "func_to_syscall_nrs",
2427 recovery_available: true,
2428 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2429
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002430 tools: ["genfunctosyscallnrs"],
Martijn Coenen0c6de752019-01-02 12:52:51 +01002431
2432 srcs: [
2433 "SYSCALLS.TXT",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002434 ],
2435
Elliott Hughes704772b2022-10-10 17:06:43 +00002436 arch: {
2437 arm: {
2438 srcs: [
2439 ":libseccomp_gen_syscall_nrs_arm",
2440 ":libseccomp_gen_syscall_nrs_arm64",
2441 ],
2442 },
2443 arm64: {
2444 srcs: [
2445 ":libseccomp_gen_syscall_nrs_arm",
2446 ":libseccomp_gen_syscall_nrs_arm64",
2447 ],
2448 },
2449 riscv64: {
2450 srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
2451 },
2452 x86: {
2453 srcs: [
2454 ":libseccomp_gen_syscall_nrs_x86",
2455 ":libseccomp_gen_syscall_nrs_x86_64",
2456 ],
2457 },
2458 x86_64: {
2459 srcs: [
2460 ":libseccomp_gen_syscall_nrs_x86",
2461 ":libseccomp_gen_syscall_nrs_x86_64",
2462 ],
2463 },
2464 },
2465
Martijn Coenen0c6de752019-01-02 12:52:51 +01002466 out: [
2467 "func_to_syscall_nrs.h",
2468 ],
2469}
2470
Victor Hsiehdbb86702020-06-15 09:29:07 -07002471// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002472genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002473 name: "generate_app_zygote_blocklist",
2474 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2475 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002476 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2477}
2478
Yu Liu938ec9b2022-10-17 16:36:30 -07002479filegroup {
2480 name: "seccomp_syscalls_sources_zygote",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002481 srcs: [
2482 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002483 "SECCOMP_ALLOWLIST_COMMON.TXT",
2484 "SECCOMP_ALLOWLIST_APP.TXT",
2485 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002486 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002487 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002488 ],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002489}
2490
Yu Liu938ec9b2022-10-17 16:36:30 -07002491filegroup {
2492 name: "seccomp_syscalls_sources_app",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002493 srcs: [
2494 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002495 "SECCOMP_ALLOWLIST_COMMON.TXT",
2496 "SECCOMP_ALLOWLIST_APP.TXT",
2497 "SECCOMP_BLOCKLIST_COMMON.TXT",
2498 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002499 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002500 ],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002501}
2502
Yu Liu938ec9b2022-10-17 16:36:30 -07002503filegroup {
2504 name: "seccomp_syscalls_sources_system",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002505 srcs: [
2506 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002507 "SECCOMP_ALLOWLIST_COMMON.TXT",
2508 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2509 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002510 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002511 ],
Yu Liu938ec9b2022-10-17 16:36:30 -07002512}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002513
Yu Liu938ec9b2022-10-17 16:36:30 -07002514cc_genrule {
2515 name: "libseccomp_policy_app_zygote_sources_x86",
2516 recovery_available: true,
2517 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002518 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002519 srcs: [
2520 ":seccomp_syscalls_sources_zygote",
2521 ":libseccomp_gen_syscall_nrs_x86",
2522 ":libseccomp_gen_syscall_nrs_x86_64",
2523 ],
2524 out: [
2525 "x86_app_zygote_policy.cpp",
2526 "x86_64_app_zygote_policy.cpp",
2527 ],
2528 enabled: false,
Yu Liu3a579692022-10-18 03:02:32 +00002529 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002530 x86: {
2531 enabled: true,
2532 },
2533 x86_64: {
2534 enabled: true,
2535 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002536 },
2537}
2538
2539cc_genrule {
2540 name: "libseccomp_policy_app_zygote_sources_arm",
2541 recovery_available: true,
2542 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002543 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002544 srcs: [
2545 ":seccomp_syscalls_sources_zygote",
2546 ":libseccomp_gen_syscall_nrs_arm",
2547 ":libseccomp_gen_syscall_nrs_arm64",
2548 ],
2549 out: [
2550 "arm_app_zygote_policy.cpp",
2551 "arm64_app_zygote_policy.cpp",
2552 ],
2553 enabled: false,
2554 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002555 arm: {
2556 enabled: true,
2557 },
2558 arm64: {
2559 enabled: true,
2560 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002561 },
2562}
2563
2564cc_genrule {
2565 name: "libseccomp_policy_app_zygote_sources_riscv64",
2566 recovery_available: true,
2567 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002568 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002569 srcs: [
2570 ":seccomp_syscalls_sources_zygote",
2571 ":libseccomp_gen_syscall_nrs_riscv64",
2572 ],
2573 out: [
2574 "riscv64_app_zygote_policy.cpp",
2575 ],
2576 enabled: false,
2577 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002578 riscv64: {
2579 enabled: true,
2580 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002581 },
2582}
2583
2584cc_genrule {
2585 name: "libseccomp_policy_app_sources_x86",
2586 recovery_available: true,
2587 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002588 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002589 srcs: [
2590 ":seccomp_syscalls_sources_app",
2591 ":libseccomp_gen_syscall_nrs_x86",
2592 ":libseccomp_gen_syscall_nrs_x86_64",
2593 ],
2594 out: [
2595 "x86_app_policy.cpp",
2596 "x86_64_app_policy.cpp",
2597 ],
2598 enabled: false,
2599 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002600 x86: {
2601 enabled: true,
2602 },
2603 x86_64: {
2604 enabled: true,
2605 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002606 },
2607}
2608
2609cc_genrule {
2610 name: "libseccomp_policy_app_sources_arm",
2611 recovery_available: true,
2612 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002613 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002614 srcs: [
2615 ":seccomp_syscalls_sources_app",
2616 ":libseccomp_gen_syscall_nrs_arm",
2617 ":libseccomp_gen_syscall_nrs_arm64",
2618 ],
2619 out: [
2620 "arm_app_policy.cpp",
2621 "arm64_app_policy.cpp",
2622 ],
2623 enabled: false,
2624 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002625 arm: {
2626 enabled: true,
2627 },
2628 arm64: {
2629 enabled: true,
2630 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002631 },
2632}
2633
2634cc_genrule {
2635 name: "libseccomp_policy_app_sources_riscv64",
2636 recovery_available: true,
2637 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002638 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002639 srcs: [
2640 ":seccomp_syscalls_sources_app",
2641 ":libseccomp_gen_syscall_nrs_riscv64",
2642 ],
2643 out: [
2644 "riscv64_app_policy.cpp",
2645 ],
2646 enabled: false,
2647 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002648 riscv64: {
2649 enabled: true,
2650 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002651 },
2652}
2653
2654cc_genrule {
2655 name: "libseccomp_policy_system_sources_x86",
2656 recovery_available: true,
2657 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002658 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002659 srcs: [
2660 ":seccomp_syscalls_sources_system",
2661 ":libseccomp_gen_syscall_nrs_x86",
2662 ":libseccomp_gen_syscall_nrs_x86_64",
2663 ],
2664 out: [
2665 "x86_system_policy.cpp",
2666 "x86_64_system_policy.cpp",
2667 ],
2668 enabled: false,
2669 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002670 x86: {
2671 enabled: true,
2672 },
2673 x86_64: {
2674 enabled: true,
2675 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002676 },
2677}
2678
2679cc_genrule {
2680 name: "libseccomp_policy_system_sources_arm",
2681 recovery_available: true,
2682 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002683 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002684 srcs: [
2685 ":seccomp_syscalls_sources_system",
2686 ":libseccomp_gen_syscall_nrs_arm",
2687 ":libseccomp_gen_syscall_nrs_arm64",
2688 ],
2689 out: [
2690 "arm_system_policy.cpp",
2691 "arm64_system_policy.cpp",
2692 ],
2693 enabled: false,
2694 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002695 arm: {
2696 enabled: true,
2697 },
2698 arm64: {
2699 enabled: true,
2700 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002701 },
2702}
2703
2704cc_genrule {
2705 name: "libseccomp_policy_system_sources_riscv64",
2706 recovery_available: true,
2707 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002708 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002709 srcs: [
2710 ":seccomp_syscalls_sources_system",
2711 ":libseccomp_gen_syscall_nrs_riscv64",
2712 ],
2713 out: [
2714 "riscv64_system_policy.cpp",
2715 ],
2716 enabled: false,
2717 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002718 riscv64: {
2719 enabled: true,
2720 },
Yu Liu3a579692022-10-18 03:02:32 +00002721 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002722}
2723
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002724cc_library {
2725 name: "libseccomp_policy",
2726 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002727 generated_headers: ["func_to_syscall_nrs"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002728
2729 arch: {
2730 arm: {
2731 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002732 "libseccomp_policy_app_sources_arm",
2733 "libseccomp_policy_app_zygote_sources_arm",
2734 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002735 ],
2736 },
2737 arm64: {
2738 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002739 "libseccomp_policy_app_sources_arm",
2740 "libseccomp_policy_app_zygote_sources_arm",
2741 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002742 ],
2743 },
2744 riscv64: {
2745 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002746 "libseccomp_policy_app_sources_riscv64",
2747 "libseccomp_policy_app_zygote_sources_riscv64",
2748 "libseccomp_policy_system_sources_riscv64",
Yu Liu938ec9b2022-10-17 16:36:30 -07002749 ],
2750 },
2751 x86: {
2752 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002753 "libseccomp_policy_app_sources_x86",
2754 "libseccomp_policy_app_zygote_sources_x86",
2755 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002756 ],
2757 },
2758 x86_64: {
2759 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002760 "libseccomp_policy_app_sources_x86",
2761 "libseccomp_policy_app_zygote_sources_x86",
2762 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002763 ],
2764 },
2765 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002766
2767 srcs: [
2768 "seccomp/seccomp_policy.cpp",
2769 ],
2770
2771 export_include_dirs: ["seccomp/include"],
2772 cflags: [
2773 "-Wall",
2774 "-Werror",
2775 ],
2776 shared: {
2777 shared_libs: ["libbase"],
2778 },
2779 static: {
2780 static_libs: ["libbase"],
2781 },
2782}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002783
Colin Cross048f24e2021-09-01 17:26:00 -07002784cc_library_host_static {
2785 name: "libfts",
2786 srcs: [
2787 "bionic/fts.c",
2788 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
2789 ],
2790 export_include_dirs: ["fts/include"],
2791 local_include_dirs: [
2792 "private",
2793 "upstream-openbsd/android/include",
2794 ],
2795 cflags: [
2796 "-include openbsd-compat.h",
2797 "-Wno-unused-parameter",
2798 ],
2799 enabled: false,
2800 target: {
2801 musl: {
2802 enabled: true,
2803 },
2804 },
Colin Cross2a9843f2022-01-13 12:26:30 -08002805 stl: "none",
2806}
2807
2808cc_library_host_static {
2809 name: "libexecinfo",
2810 visibility: ["//external/musl"],
2811 srcs: ["bionic/execinfo.cpp"],
2812 export_include_dirs: ["execinfo/include"],
2813 local_include_dirs: ["private"],
2814 enabled: false,
2815 target: {
2816 musl: {
2817 enabled: true,
2818 system_shared_libs: [],
2819 header_libs: ["libc_musl_headers"],
2820 },
2821 },
2822 stl: "none",
Colin Cross048f24e2021-09-01 17:26:00 -07002823}
2824
Colin Cross9da85fa2022-01-24 18:20:05 -08002825cc_library_host_static {
2826 name: "libb64",
2827 visibility: ["//external/musl"],
2828 srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
2829 export_include_dirs: ["b64/include"],
2830 local_include_dirs: [
2831 "private",
2832 "upstream-openbsd/android/include",
2833 ],
2834 cflags: [
2835 "-include openbsd-compat.h",
2836 ],
2837 enabled: false,
2838 target: {
2839 musl: {
2840 enabled: true,
2841 system_shared_libs: [],
2842 header_libs: ["libc_musl_headers"],
2843 },
2844 },
2845 stl: "none",
2846}
2847
Colin Cross9d4a56e2022-02-03 10:20:32 -08002848// Export kernel uapi headers to be used in the musl sysroot.
2849// Also include the execinfo headers for the libexecinfo and the
2850// b64 headers for libb64 embedded in musl libc.
2851cc_genrule {
2852 name: "libc_musl_sysroot_bionic_headers",
2853 visibility: ["//external/musl"],
2854 host_supported: true,
2855 device_supported: false,
2856 enabled: false,
2857 target: {
2858 musl: {
2859 enabled: true,
2860 },
2861 },
2862 srcs: [
2863 "kernel/uapi/**/*.h",
2864 "kernel/android/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002865 "execinfo/include/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002866 "b64/include/**/*.h",
Colin Crossaeef9f02022-02-07 21:01:26 -08002867
Colin Crossaeef9f02022-02-07 21:01:26 -08002868 "NOTICE",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002869
2870 ":libc_musl_sysroot_bionic_arch_headers",
2871 ],
2872 out: ["libc_musl_sysroot_bionic_headers.zip"],
2873 tools: [
2874 "soong_zip",
2875 "merge_zips",
2876 "zip2zip",
2877 ],
Colin Crossaeef9f02022-02-07 21:01:26 -08002878 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
2879 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
Colin Crossad33d022022-02-25 18:27:04 -08002880 // NOTICE
2881 " -j -f $(location NOTICE) " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002882 // headers
2883 " -P include " +
Colin Crossaeef9f02022-02-07 21:01:26 -08002884 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
2885 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
2886 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2887 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2888 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2889 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2890 " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
2891 " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
2892 " -C $${BIONIC_LIBC_DIR}/b64/include " +
2893 " -D $${BIONIC_LIBC_DIR}/b64/include " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002894 " && " +
Colin Crossad33d022022-02-25 18:27:04 -08002895 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
Colin Cross1c0a7a02022-08-11 12:22:26 -07002896 " -x **/BUILD " +
Colin Crossad33d022022-02-25 18:27:04 -08002897 " include/**/*:include/ " +
2898 " NOTICE:NOTICE.bionic " +
2899 " && " +
2900 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002901}
2902
2903// The architecture-specific bits have to be handled separately because the label varies based
2904// on architecture, which prevents using $(locations) to find them and requires using $(in)
2905// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
2906// genrule.
2907cc_genrule {
2908 name: "libc_musl_sysroot_bionic_arch_headers",
2909 visibility: ["//visibility:private"],
2910 host_supported: true,
2911 device_supported: false,
2912 enabled: false,
2913 target: {
2914 musl: {
2915 enabled: true,
2916 },
2917 },
2918 arch: {
2919 arm: {
2920 srcs: ["kernel/uapi/asm-arm/**/*.h"],
2921 },
2922 arm64: {
2923 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
2924 },
2925 x86: {
2926 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2927 },
2928 x86_64: {
2929 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2930 },
2931 },
2932 out: ["libc_musl_sysroot_bionic_arch_headers.zip"],
2933 tools: ["soong_zip"],
2934 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
2935}
Colin Cross290c4952022-10-13 12:51:13 -07002936
2937cc_genrule {
2938 name: "bionic_sysroot_crt_objects",
2939 visibility: ["//visibility:private"],
2940 out: ["bionic_sysroot_crt_objects.zip"],
2941 tools: ["soong_zip"],
2942 srcs: [
2943 ":crtbegin_dynamic",
2944 ":crtbegin_so",
2945 ":crtbegin_static",
2946 ":crtend_android",
2947 ":crtend_so",
2948 ],
2949 cmd: "$(location soong_zip) -o $(out) -j " +
2950 "-f $(location :crtbegin_dynamic) " +
2951 "-f $(location :crtbegin_so) " +
2952 "-f $(location :crtbegin_static) " +
2953 "-f $(location :crtend_android) " +
2954 "-f $(location :crtend_so)",
2955 dist: {
2956 targets: ["bionic_sysroot_crt_objects"],
2957 },
2958 arch: {
2959 arm: {
2960 dist: {
2961 suffix: "_arm",
2962 },
2963 },
2964 arm64: {
2965 dist: {
2966 suffix: "_arm64",
2967 },
2968 },
2969 riscv64: {
2970 dist: {
2971 suffix: "_riscv64",
2972 },
2973 },
2974 x86: {
2975 dist: {
2976 suffix: "_x86",
2977 },
2978 },
2979 x86_64: {
2980 dist: {
2981 suffix: "_x86_64",
2982 },
2983 },
2984 },
2985}
Spandan Das8fce52a2023-09-28 18:00:12 +00002986
2987// headers that will be placed on the include path when running versioner in bazel
2988// this module should be a no-op in soong
2989filegroup {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002990 name: "versioner-dependencies",
2991 srcs: ["versioner-dependencies/**/*"],
Spandan Das8fce52a2023-09-28 18:00:12 +00002992}
Jiyong Park35a280d2024-05-03 16:53:39 +09002993
2994filegroup {
2995 name: "linux_capability_header",
2996 srcs: ["kernel/uapi/linux/capability.h"],
2997}