blob: 15c8f5e47b040aa615746c8790b884a1a2848278 [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
Dan Willemsen208ae172015-09-16 16:33:27 -070023libc_common_src_files = [
Dan Willemsen208ae172015-09-16 16:33:27 -070024 "bionic/ether_aton.c",
25 "bionic/ether_ntoa.c",
Victor Khimenko8e0707d2020-06-09 21:57:05 +020026 "bionic/exit.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070027 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070028 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070029 "bionic/sched_cpualloc.c",
30 "bionic/sched_cpucount.c",
Mitch Phillipse6997d52020-11-30 15:04:14 -080031 "bionic/sysprop_helpers.cpp",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070032 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070033 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070034 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080035 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070036 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080037 "stdio/vfscanf.cpp",
Elliott Hughes1f462de2022-08-05 22:51:05 +000038 "stdio/vfwscanf.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070039]
40
Peter Collingbourne570de332019-12-11 10:00:58 -080041// off64_t/time64_t support on LP32.
Dan Willemsen208ae172015-09-16 16:33:27 -070042// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -070043libc_common_src_files_32 = [
44 "bionic/legacy_32_bit_support.cpp",
45 "bionic/time64.c",
46]
47
Elliott Hughes53cf3482016-08-09 13:06:41 -070048libc_common_flags = [
49 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080050 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070051 "-Wall",
52 "-Wextra",
53 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080054 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070055 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070056 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070057 "-Wframe-larger-than=2048",
Christopher Ferris1de7a482023-09-12 11:06:29 -070058 "-Wno-reorder-init-list",
Elliott Hughes53cf3482016-08-09 13:06:41 -070059
60 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
61 "-Werror=pointer-to-int-cast",
62 "-Werror=int-to-pointer-cast",
63 "-Werror=type-limits",
64 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080065
66 // Clang's exit-time destructor registration hides __dso_handle, but
67 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
68 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080069
Elliott Hughesa13d0662021-12-02 14:42:16 -080070 // We know clang does a lot of harm by rewriting what we've said, and sadly
71 // never see any good it does, so let's just ask it to do what we say...
72 // (The specific motivating example was clang turning a loop that would only
73 // ever touch 0, 1, or 2 bytes into a call to memset, which was never going
74 // to amortize.)
75 "-fno-builtin",
Elliott Hughes53cf3482016-08-09 13:06:41 -070076]
77
Dan Willemsen208ae172015-09-16 16:33:27 -070078// Define some common cflags
79// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070080cc_defaults {
81 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080082 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070083 cflags: libc_common_flags,
84 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070085 conlyflags: ["-std=gnu99"],
86 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070087 include_dirs: [
88 "bionic/libc/async_safe/include",
Peter Collingbourne5d3aa862020-09-11 15:05:17 -070089 "bionic/libc/platform",
Tom Cherry379ed1e2020-09-17 09:36:25 -070090 // For android_filesystem_config.h.
91 "system/core/libcutils/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070092 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070093
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010094 header_libs: [
95 "libc_headers",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +000096 "liblog_headers", // needed by bionic/libc/async_safe/include
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010097 ],
98 export_header_lib_headers: [
99 "libc_headers",
100 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800101
Colin Cross50c21ab2015-10-31 23:03:05 -0700102 stl: "none",
103 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -0700104 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -0700105 address: false,
106 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -0700107 // TODO(b/132640749): Fix broken fuzzer support.
108 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -0700109 },
Yifan Hong5a39cee2020-01-21 16:43:56 -0800110 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700111 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +0900112 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +0200113 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -0800114
Yi Konge3d90de2019-02-20 14:28:56 -0800115 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
116 // warning since this is intended right now.
117 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -0700118
119 product_variables: {
Evgenii Stepanov5a73e032020-04-29 14:59:44 -0700120 malloc_zero_contents: {
121 cflags: ["-DSCUDO_ZERO_CONTENTS"],
122 },
123 malloc_pattern_fill_contents: {
124 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
125 },
Steven Morelandfb65ee42020-07-31 00:18:38 +0000126 malloc_not_svelte: {
127 cflags: ["-DUSE_SCUDO"],
128 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700129 },
Yi Kong9e33b762021-10-29 02:43:22 +0800130
131 lto: {
132 never: true,
133 },
Elliott Hughesc2043342023-07-20 20:24:09 +0000134
135 apex_available: ["com.android.runtime"],
Elliott Hughes7d136662023-10-27 15:40:32 -0700136
137 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700138}
139
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800140libc_scudo_product_variables = {
141 malloc_not_svelte: {
142 cflags: ["-DUSE_SCUDO"],
143 whole_static_libs: ["libscudo"],
144 exclude_static_libs: [
145 "libjemalloc5",
146 "libc_jemalloc_wrapper",
147 ],
148 },
149}
150
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700151// Defaults for native allocator libs/includes to make it
152// easier to change.
Christopher Ferris062eba22020-01-31 22:40:45 -0800153// To disable scudo for the non-svelte config remove the line:
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800154// product_variables: libc_scudo_product_variables,
Christopher Ferris062eba22020-01-31 22:40:45 -0800155// in the cc_defaults below.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700156// ========================================================
157cc_defaults {
158 name: "libc_native_allocator_defaults",
159
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700160 whole_static_libs: [
161 "libjemalloc5",
162 "libc_jemalloc_wrapper",
163 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800164 header_libs: ["gwp_asan_headers"],
Christopher Ferris062eba22020-01-31 22:40:45 -0800165 product_variables: libc_scudo_product_variables,
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700166}
167
168// Functions not implemented by jemalloc directly, or that need to
169// be modified for Android.
170cc_library_static {
171 name: "libc_jemalloc_wrapper",
172 defaults: ["libc_defaults"],
173 srcs: ["bionic/jemalloc_wrapper.cpp"],
174 cflags: ["-fvisibility=hidden"],
175
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800176 // Used to pull in the jemalloc include directory so that if the
177 // library is removed, the include directory is also removed.
178 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700179}
180
Dan Willemsen208ae172015-09-16 16:33:27 -0700181// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700182// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700183// ========================================================
184//
Ryan Prichard249757b2019-11-01 17:18:28 -0700185// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
186// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
187// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
188// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700189
190cc_library_static {
191
Colin Crossa3f9fca2016-01-11 13:20:55 -0800192 srcs: [
193 "bionic/__libc_init_main_thread.cpp",
194 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700195 "bionic/bionic_call_ifunc_resolver.cpp",
196 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800197 ],
198 arch: {
199 arm64: {
200 srcs: ["arch-arm64/bionic/__set_tls.c"],
201 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000202 riscv64: {
203 srcs: ["arch-riscv64/bionic/__set_tls.c"],
204 },
Colin Crossa3f9fca2016-01-11 13:20:55 -0800205 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700206 srcs: [
207 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Pirama Arumuga Nainar7b89be72021-02-12 15:09:49 -0800208 "arch-x86/bionic/__libc_int0x80.S",
Ryan Prichard27475b52018-05-17 17:14:18 -0700209 "arch-x86/bionic/__set_tls.cpp",
210 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800211 },
212 x86_64: {
213 srcs: ["arch-x86_64/bionic/__set_tls.c"],
214 },
215 },
216
Colin Cross50c21ab2015-10-31 23:03:05 -0700217 defaults: ["libc_defaults"],
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000218 cflags: [
219 "-fno-stack-protector",
220 "-ffreestanding",
221 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700222 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700223}
224
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800225filegroup {
226 name: "elf_note_sources",
227 srcs: ["bionic/elf_note.cpp"],
228}
229
Ryan Prichard249757b2019-11-01 17:18:28 -0700230// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
231// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
232// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800233
234cc_library_static {
235 name: "libc_init_static",
236 defaults: ["libc_defaults"],
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800237 srcs: [
238 "bionic/libc_init_static.cpp",
239 ":elf_note_sources",
240 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700241 cflags: [
242 "-fno-stack-protector",
243
244 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
245 // from the linker before ifunc resolvers have made string.h functions available.
246 "-ffreestanding",
247 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800248}
249
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700250cc_library_static {
251 name: "libc_init_dynamic",
252 defaults: ["libc_defaults"],
253 srcs: ["bionic/libc_init_dynamic.cpp"],
254 cflags: ["-fno-stack-protector"],
255}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800256
Dan Willemsen208ae172015-09-16 16:33:27 -0700257// ========================================================
258// libc_tzcode.a - upstream 'tzcode' code
259// ========================================================
260
261cc_library_static {
262
Colin Cross50c21ab2015-10-31 23:03:05 -0700263 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700264 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800265 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700266 "tzcode/bionic.cpp",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700267 // tzcode doesn't include strptime, so we use a fork of the
268 // OpenBSD code which needs this global data.
Elliott Hughesd3627a42022-12-06 22:24:27 +0000269 "upstream-openbsd/lib/libc/locale/_def_time.c",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700270 // tzcode doesn't include wcsftime, so we use the FreeBSD code.
271 "upstream-freebsd/lib/libc/locale/wcsftime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700272 ],
273
Colin Cross50c21ab2015-10-31 23:03:05 -0700274 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700275 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700276 // Don't use ridiculous amounts of stack.
277 "-DALL_STATE",
278 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
279 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800280 // Obviously, we want to be thread-safe.
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000281 "-DTHREAD_SAFE=1",
Dan Willemsen208ae172015-09-16 16:33:27 -0700282 // The name of the tm_gmtoff field in our struct tm.
283 "-DTM_GMTOFF=tm_gmtoff",
Elliott Hughes31fc69f2023-06-20 15:36:11 -0700284 // Android uses a system property instead of /etc/localtime, so make callers crash.
Almaz Mingaleeva52a0da2022-02-28 16:55:50 +0000285 "-DTZDEFAULT=NULL",
Dan Willemsen208ae172015-09-16 16:33:27 -0700286 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700287 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700288 // Include `tzname`, `timezone`, and `daylight` globals.
289 "-DHAVE_POSIX_DECLS=0",
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000290 "-DUSG_COMPAT=2",
291 "-DHAVE_TZNAME=2",
292 // stdbool.h is available
293 "-DHAVE_STDBOOL_H",
Colin Crossa35d23d2015-11-19 13:32:49 -0800294 // Use the empty string (instead of " ") as the timezone abbreviation
295 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700296 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700297 "-Dlint",
298 ],
299
Elliott Hughes2bd43162023-06-15 13:17:08 -0700300 local_include_dirs: [
301 "tzcode/",
302 "upstream-freebsd/android/include",
303 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700304 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700305}
306
307// ========================================================
308// libc_dns.a - modified NetBSD DNS code
309// ========================================================
310
311cc_library_static {
312
Colin Cross50c21ab2015-10-31 23:03:05 -0700313 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700314 srcs: [
Elliott Hughesd0bbfa82021-04-08 11:58:51 -0700315 "dns/**/*.c*",
Dan Willemsen208ae172015-09-16 16:33:27 -0700316
317 "upstream-netbsd/lib/libc/isc/ev_streams.c",
318 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700319 ],
320
Colin Cross50c21ab2015-10-31 23:03:05 -0700321 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700322 "-DANDROID_CHANGES",
323 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700324 "-Wno-unused-parameter",
325 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700326 "-Wframe-larger-than=66000",
Elliott Hughese1dc4f62021-01-11 11:51:29 -0800327 "-include private/bsd_sys_param.h",
Dan Willemsen208ae172015-09-16 16:33:27 -0700328 ],
329
Dan Willemsen208ae172015-09-16 16:33:27 -0700330 local_include_dirs: [
331 "dns/include",
332 "private",
333 "upstream-netbsd/lib/libc/include",
334 "upstream-netbsd/android/include",
335 ],
336
337 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700338}
339
340// ========================================================
341// libc_freebsd.a - upstream FreeBSD C library code
342// ========================================================
343//
344// These files are built with the freebsd-compat.h header file
345// automatically included.
346
347cc_library_static {
Elliott Hughesc2043342023-07-20 20:24:09 +0000348 name: "libc_freebsd_ldexp",
349 defaults: ["libc_defaults"],
350 cflags: ["-Dscalbn=ldexp"],
351 srcs: [":libc_ldexp_srcs"],
352}
353
354cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700355 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700356 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700357 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700358 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
359 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
360 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
361 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700362 "upstream-freebsd/lib/libc/stdlib/qsort.c",
363 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700364 "upstream-freebsd/lib/libc/string/wcpcpy.c",
365 "upstream-freebsd/lib/libc/string/wcpncpy.c",
366 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700367 "upstream-freebsd/lib/libc/string/wcscat.c",
368 "upstream-freebsd/lib/libc/string/wcschr.c",
369 "upstream-freebsd/lib/libc/string/wcscmp.c",
370 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700371 "upstream-freebsd/lib/libc/string/wcscspn.c",
372 "upstream-freebsd/lib/libc/string/wcsdup.c",
373 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700374 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700375 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
376 "upstream-freebsd/lib/libc/string/wcsncat.c",
377 "upstream-freebsd/lib/libc/string/wcsncmp.c",
378 "upstream-freebsd/lib/libc/string/wcsncpy.c",
379 "upstream-freebsd/lib/libc/string/wcsnlen.c",
380 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700381 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700382 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700383 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700384 "upstream-freebsd/lib/libc/string/wcstok.c",
385 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700386 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700387 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700388 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800389 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700390 ],
391 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700392 x86: {
393 exclude_srcs: [
394 "upstream-freebsd/lib/libc/string/wcschr.c",
395 "upstream-freebsd/lib/libc/string/wcscmp.c",
396 "upstream-freebsd/lib/libc/string/wcslen.c",
397 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700398 "upstream-freebsd/lib/libc/string/wmemcmp.c",
399 "upstream-freebsd/lib/libc/string/wcscat.c",
400 "upstream-freebsd/lib/libc/string/wcscpy.c",
401 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700402 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700403 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700404 },
405
Colin Cross50c21ab2015-10-31 23:03:05 -0700406 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700407 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700408 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700409 "-include freebsd-compat.h",
410 ],
411
Dan Willemsen208ae172015-09-16 16:33:27 -0700412 local_include_dirs: [
413 "upstream-freebsd/android/include",
414 ],
415
416 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700417}
418
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700419cc_library_static {
420 defaults: ["libc_defaults"],
421 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700422 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700423 ],
424
425 cflags: [
426 "-Wno-sign-compare",
427 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700428 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700429 ],
430
431 local_include_dirs: [
432 "upstream-freebsd/android/include",
433 ],
434
435 name: "libc_freebsd_large_stack",
436}
437
Dan Willemsen208ae172015-09-16 16:33:27 -0700438// ========================================================
439// libc_netbsd.a - upstream NetBSD C library code
440// ========================================================
441//
442// These files are built with the netbsd-compat.h header file
443// automatically included.
444
445cc_library_static {
446
Colin Cross50c21ab2015-10-31 23:03:05 -0700447 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700448 srcs: [
449 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700450 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700451 "upstream-netbsd/lib/libc/gen/psignal.c",
452 "upstream-netbsd/lib/libc/gen/utime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700453 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
454 "upstream-netbsd/lib/libc/regex/regcomp.c",
455 "upstream-netbsd/lib/libc/regex/regerror.c",
456 "upstream-netbsd/lib/libc/regex/regexec.c",
457 "upstream-netbsd/lib/libc/regex/regfree.c",
458 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700459 "upstream-netbsd/lib/libc/stdlib/drand48.c",
460 "upstream-netbsd/lib/libc/stdlib/erand48.c",
461 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
462 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700463 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
464 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
465 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
466 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
467 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
468 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
469 "upstream-netbsd/lib/libc/stdlib/seed48.c",
470 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700471 ],
472 multilib: {
473 lib32: {
474 // LP32 cruft
475 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
476 },
477 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700478 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700479 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800480 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700481 "-DPOSIX_MISTAKE",
482 "-include netbsd-compat.h",
483 ],
484
Dan Willemsen208ae172015-09-16 16:33:27 -0700485 local_include_dirs: [
486 "upstream-netbsd/android/include",
487 "upstream-netbsd/lib/libc/include",
488 ],
489
490 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700491}
492
493// ========================================================
Elliott Hughes968adf92024-02-08 13:15:53 -0800494// libc_openbsd.a - upstream OpenBSD C library code
Dan Willemsen208ae172015-09-16 16:33:27 -0700495// ========================================================
496//
497// These files are built with the openbsd-compat.h header file
498// automatically included.
Dan Willemsen208ae172015-09-16 16:33:27 -0700499cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700500 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700501 srcs: [
Elliott Hughes968adf92024-02-08 13:15:53 -0800502 "upstream-openbsd/lib/libc/crypt/arc4random.c",
503 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700504 "upstream-openbsd/lib/libc/gen/alarm.c",
505 "upstream-openbsd/lib/libc/gen/ctype_.c",
506 "upstream-openbsd/lib/libc/gen/daemon.c",
507 "upstream-openbsd/lib/libc/gen/err.c",
508 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700509 "upstream-openbsd/lib/libc/gen/fnmatch.c",
510 "upstream-openbsd/lib/libc/gen/ftok.c",
511 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700512 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700513 "upstream-openbsd/lib/libc/gen/verr.c",
514 "upstream-openbsd/lib/libc/gen/verrx.c",
515 "upstream-openbsd/lib/libc/gen/vwarn.c",
516 "upstream-openbsd/lib/libc/gen/vwarnx.c",
517 "upstream-openbsd/lib/libc/gen/warn.c",
518 "upstream-openbsd/lib/libc/gen/warnx.c",
519 "upstream-openbsd/lib/libc/locale/btowc.c",
520 "upstream-openbsd/lib/libc/locale/mbrlen.c",
521 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
522 "upstream-openbsd/lib/libc/locale/mbtowc.c",
523 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700524 "upstream-openbsd/lib/libc/locale/wcstombs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700525 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
526 "upstream-openbsd/lib/libc/locale/wctob.c",
527 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700528 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700529 "upstream-openbsd/lib/libc/net/htonl.c",
530 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700531 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
532 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
533 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700534 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
535 "upstream-openbsd/lib/libc/net/inet_ntop.c",
536 "upstream-openbsd/lib/libc/net/inet_pton.c",
537 "upstream-openbsd/lib/libc/net/ntohl.c",
538 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800539 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700540 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700541 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
542 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700543 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700544 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/stdio/fputwc.c",
546 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700547 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700548 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700549 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700550 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700551 "upstream-openbsd/lib/libc/stdio/makebuf.c",
552 "upstream-openbsd/lib/libc/stdio/mktemp.c",
553 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
554 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700555 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700556 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700557 "upstream-openbsd/lib/libc/stdio/ungetc.c",
558 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
559 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
560 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700561 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
562 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
563 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700564 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700565 "upstream-openbsd/lib/libc/stdio/wsetup.c",
566 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800567 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700568 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700569 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700570 "upstream-openbsd/lib/libc/stdlib/insque.c",
571 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
572 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
573 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800574 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700575 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800576 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700577 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughes26b06072020-07-31 11:00:10 -0700578 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700579 "upstream-openbsd/lib/libc/stdlib/remque.c",
580 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700581 "upstream-openbsd/lib/libc/stdlib/tfind.c",
582 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800583 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700584 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800585 "upstream-openbsd/lib/libc/string/strcasestr.c",
586 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700587 "upstream-openbsd/lib/libc/string/strcspn.c",
588 "upstream-openbsd/lib/libc/string/strdup.c",
589 "upstream-openbsd/lib/libc/string/strndup.c",
590 "upstream-openbsd/lib/libc/string/strpbrk.c",
591 "upstream-openbsd/lib/libc/string/strsep.c",
592 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700593 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800594 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700595 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700596 "upstream-openbsd/lib/libc/string/wcswidth.c",
Colin Cross69bcb8b2021-09-08 13:24:16 -0700597
598 // This file is originally from OpenBSD, and benefits from
599 // being compiled with openbsd-compat.h.
Elliott Hughes968adf92024-02-08 13:15:53 -0800600 // TODO: clean this up instead.
Colin Cross69bcb8b2021-09-08 13:24:16 -0700601 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700602 ],
603
Elliott Hughes7d136662023-10-27 15:40:32 -0700604 // Each architecture has optimized versions of some routines,
605 // and only includes the portable C versions of ones it's missing.
Dan Willemsen208ae172015-09-16 16:33:27 -0700606 arch: {
607 arm: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700608 srcs: [
609 "upstream-openbsd/lib/libc/string/memchr.c",
610 "upstream-openbsd/lib/libc/string/memrchr.c",
611 "upstream-openbsd/lib/libc/string/stpncpy.c",
612 "upstream-openbsd/lib/libc/string/strlcat.c",
613 "upstream-openbsd/lib/libc/string/strlcpy.c",
614 "upstream-openbsd/lib/libc/string/strncat.c",
615 "upstream-openbsd/lib/libc/string/strncmp.c",
616 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700617 ],
618 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700619 arm64: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700620 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700621 "upstream-openbsd/lib/libc/string/strcat.c",
Elliott Hughesaefe9992023-11-08 12:04:41 -0800622 "upstream-openbsd/lib/libc/string/stpncpy.c",
Elliott Hughes7d136662023-10-27 15:40:32 -0700623 "upstream-openbsd/lib/libc/string/strlcat.c",
624 "upstream-openbsd/lib/libc/string/strlcpy.c",
625 "upstream-openbsd/lib/libc/string/strncat.c",
626 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700627 ],
628 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000629 riscv64: {
630 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700631 "upstream-openbsd/lib/libc/string/memrchr.c",
632 "upstream-openbsd/lib/libc/string/stpncpy.c",
633 "upstream-openbsd/lib/libc/string/strlcat.c",
634 "upstream-openbsd/lib/libc/string/strlcpy.c",
Elliott Hughesebc19a92022-10-14 23:25:36 +0000635 ],
636 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700637 x86: {
Elliott Hughesaefe9992023-11-08 12:04:41 -0800638 srcs: [
639 // x86 has custom implementations of all of these.
640 ],
Elliott Hughes7d136662023-10-27 15:40:32 -0700641 },
642 x86_64: {
643 srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800644 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800645 "upstream-openbsd/lib/libc/string/memrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700646 "upstream-openbsd/lib/libc/string/strlcat.c",
647 "upstream-openbsd/lib/libc/string/strlcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800648 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700649 },
650 },
651
Colin Cross50c21ab2015-10-31 23:03:05 -0700652 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700653 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700654 "-Wno-unused-parameter",
655 "-include openbsd-compat.h",
656 ],
657
Dan Willemsen208ae172015-09-16 16:33:27 -0700658 local_include_dirs: [
659 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700660 "upstream-openbsd/android/include",
Elliott Hughes968adf92024-02-08 13:15:53 -0800661 "stdio",
662 "upstream-openbsd/lib/libc/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700663 ],
664
665 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700666}
667
Elliott Hughes968adf92024-02-08 13:15:53 -0800668cc_library_static {
669 name: "libc_openbsd_large_stack",
670 defaults: ["libc_defaults"],
671 srcs: [
672 "stdio/vfprintf.cpp",
673 "stdio/vfwprintf.cpp",
674 "upstream-openbsd/lib/libc/string/memmem.c",
675 "upstream-openbsd/lib/libc/string/strstr.c",
676 ],
677 cflags: [
678 "-include openbsd-compat.h",
679 "-Wno-sign-compare",
680 "-Wframe-larger-than=5000",
681 ],
682
683 local_include_dirs: [
684 "private",
685 "upstream-openbsd/android/include/",
686 "upstream-openbsd/lib/libc/gdtoa/",
687 "upstream-openbsd/lib/libc/include/",
688 "upstream-openbsd/lib/libc/stdio/",
689 ],
690}
691
Dan Willemsen208ae172015-09-16 16:33:27 -0700692// ========================================================
693// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
694// ========================================================
695//
696// These files are built with the openbsd-compat.h header file
697// automatically included.
698
699cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700700 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700701 srcs: [
702 "upstream-openbsd/android/gdtoa_support.cpp",
703 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
704 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
705 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
706 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
707 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
708 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
709 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
710 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
711 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
712 "upstream-openbsd/lib/libc/gdtoa/misc.c",
713 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
714 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
715 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
716 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
717 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
718 "upstream-openbsd/lib/libc/gdtoa/sum.c",
719 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
720 ],
721 multilib: {
722 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800723 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700724 },
725 },
726
Colin Cross50c21ab2015-10-31 23:03:05 -0700727 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700728 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700729 "-include openbsd-compat.h",
730 ],
731
Dan Willemsen208ae172015-09-16 16:33:27 -0700732 local_include_dirs: [
733 "private",
734 "upstream-openbsd/android/include",
735 "upstream-openbsd/lib/libc/include",
736 ],
737
738 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700739}
740
741// ========================================================
Pierre-Clément Tosi467e58e2023-02-01 13:44:43 +0000742// libc_fortify.a - container for our FORTIFY
George Burgess IV6cb06872017-07-21 13:28:42 -0700743// implementation details
744// ========================================================
745cc_library_static {
746 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700747 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700748
749 name: "libc_fortify",
750
751 // Disable FORTIFY for the compilation of these, so we don't end up having
752 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800753 cflags: [
754 "-U_FORTIFY_SOURCE",
755 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
756 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700757
758 arch: {
759 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800760 cflags: [
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800761 "-DRENAME___STRCAT_CHK",
762 "-DRENAME___STRCPY_CHK",
763 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700764 srcs: [
765 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800766
767 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
768 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
769
770 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
771 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
772
773 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
774 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
775
776 "arch-arm/krait/bionic/__strcat_chk.S",
777 "arch-arm/krait/bionic/__strcpy_chk.S",
778
779 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
780 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
781
Haibo Huang01bfd892018-12-03 15:05:16 -0800782 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
783 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700784 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700785 },
786 arm64: {
787 srcs: [
Elliott Hughes023e4e72022-11-17 19:27:02 +0000788 "arch-arm64/string/__memcpy_chk.S",
789 "arch-arm64/string/__memset_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700790 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700791 },
caowenchengab457f92023-03-06 14:57:55 +0800792 riscv64: {
793 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000794 "arch-riscv64/string/__memset_chk.S",
795 "arch-riscv64/string/__memcpy_chk.S",
caowenchengab457f92023-03-06 14:57:55 +0800796 ],
797 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700798 },
799}
800
801// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700802// libc_bionic.a - home-grown C library code
803// ========================================================
804
805cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700806 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700807 srcs: [
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800808 "bionic/NetdClientDispatch.cpp",
809 "bionic/__bionic_get_shell_path.cpp",
810 "bionic/__cmsg_nxthdr.cpp",
811 "bionic/__cxa_thread_atexit_impl.cpp",
812 "bionic/__errno.cpp",
813 "bionic/__gnu_basename.cpp",
814 "bionic/__libc_current_sigrtmax.cpp",
815 "bionic/__libc_current_sigrtmin.cpp",
816 "bionic/abort.cpp",
817 "bionic/accept.cpp",
818 "bionic/access.cpp",
Florian Mayerca4749a2024-02-14 12:55:46 -0800819 "bionic/android_crash_detail.cpp",
Josh Gao10ec9282017-04-03 15:13:29 -0700820 "bionic/android_set_abort_message.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000821 "bionic/android_unsafe_frame_pointer_chase.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800822 "bionic/arpa_inet.cpp",
823 "bionic/assert.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000824 "bionic/atexit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800825 "bionic/atof.cpp",
826 "bionic/bionic_allocator.cpp",
827 "bionic/bionic_arc4random.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000828 "bionic/bionic_elf_tls.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800829 "bionic/bionic_futex.cpp",
830 "bionic/bionic_netlink.cpp",
831 "bionic/bionic_systrace.cpp",
832 "bionic/bionic_time_conversions.cpp",
833 "bionic/brk.cpp",
834 "bionic/c16rtomb.cpp",
835 "bionic/c32rtomb.cpp",
836 "bionic/chmod.cpp",
837 "bionic/chown.cpp",
838 "bionic/clearenv.cpp",
839 "bionic/clock.cpp",
840 "bionic/clock_getcpuclockid.cpp",
841 "bionic/clock_nanosleep.cpp",
842 "bionic/clone.cpp",
843 "bionic/ctype.cpp",
844 "bionic/dirent.cpp",
845 "bionic/dup.cpp",
846 "bionic/environ.cpp",
847 "bionic/error.cpp",
848 "bionic/eventfd.cpp",
849 "bionic/exec.cpp",
850 "bionic/execinfo.cpp",
851 "bionic/faccessat.cpp",
852 "bionic/fchmod.cpp",
853 "bionic/fchmodat.cpp",
854 "bionic/fcntl.cpp",
855 "bionic/fdsan.cpp",
856 "bionic/fdtrack.cpp",
857 "bionic/ffs.cpp",
858 "bionic/fgetxattr.cpp",
859 "bionic/flistxattr.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000860 "bionic/fork.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800861 "bionic/fpclassify.cpp",
862 "bionic/fsetxattr.cpp",
863 "bionic/ftruncate.cpp",
864 "bionic/ftw.cpp",
865 "bionic/futimens.cpp",
866 "bionic/getcwd.cpp",
867 "bionic/getdomainname.cpp",
868 "bionic/getentropy.cpp",
869 "bionic/gethostname.cpp",
870 "bionic/getloadavg.cpp",
871 "bionic/getpagesize.cpp",
872 "bionic/getpgrp.cpp",
873 "bionic/getpid.cpp",
874 "bionic/getpriority.cpp",
875 "bionic/gettid.cpp",
876 "bionic/get_device_api_level.cpp",
877 "bionic/grp_pwd.cpp",
878 "bionic/grp_pwd_file.cpp",
879 "bionic/heap_zero_init.cpp",
880 "bionic/iconv.cpp",
881 "bionic/icu_wrappers.cpp",
882 "bionic/ifaddrs.cpp",
883 "bionic/inotify_init.cpp",
884 "bionic/ioctl.cpp",
885 "bionic/killpg.cpp",
886 "bionic/langinfo.cpp",
887 "bionic/lchown.cpp",
888 "bionic/lfs64_support.cpp",
889 "bionic/libc_init_common.cpp",
890 "bionic/libgen.cpp",
891 "bionic/link.cpp",
892 "bionic/locale.cpp",
893 "bionic/lockf.cpp",
894 "bionic/lstat.cpp",
895 "bionic/mblen.cpp",
896 "bionic/mbrtoc16.cpp",
897 "bionic/mbrtoc32.cpp",
898 "bionic/mempcpy.cpp",
899 "bionic/memset_explicit.cpp",
900 "bionic/mkdir.cpp",
901 "bionic/mkfifo.cpp",
902 "bionic/mknod.cpp",
903 "bionic/mntent.cpp",
904 "bionic/mremap.cpp",
905 "bionic/net_if.cpp",
906 "bionic/netdb.cpp",
907 "bionic/netinet_in.cpp",
908 "bionic/nl_types.cpp",
909 "bionic/open.cpp",
910 "bionic/pathconf.cpp",
911 "bionic/pause.cpp",
912 "bionic/pidfd.cpp",
913 "bionic/pipe.cpp",
914 "bionic/poll.cpp",
915 "bionic/posix_fadvise.cpp",
916 "bionic/posix_fallocate.cpp",
917 "bionic/posix_madvise.cpp",
918 "bionic/posix_timers.cpp",
919 "bionic/preadv_pwritev.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000920 "bionic/pthread_atfork.cpp",
921 "bionic/pthread_attr.cpp",
922 "bionic/pthread_barrier.cpp",
923 "bionic/pthread_cond.cpp",
924 "bionic/pthread_create.cpp",
925 "bionic/pthread_detach.cpp",
926 "bionic/pthread_equal.cpp",
927 "bionic/pthread_exit.cpp",
928 "bionic/pthread_getcpuclockid.cpp",
929 "bionic/pthread_getschedparam.cpp",
930 "bionic/pthread_gettid_np.cpp",
931 "bionic/pthread_internal.cpp",
932 "bionic/pthread_join.cpp",
933 "bionic/pthread_key.cpp",
934 "bionic/pthread_kill.cpp",
935 "bionic/pthread_mutex.cpp",
936 "bionic/pthread_once.cpp",
937 "bionic/pthread_rwlock.cpp",
938 "bionic/pthread_sigqueue.cpp",
939 "bionic/pthread_self.cpp",
940 "bionic/pthread_setname_np.cpp",
941 "bionic/pthread_setschedparam.cpp",
942 "bionic/pthread_spinlock.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800943 "bionic/ptrace.cpp",
944 "bionic/pty.cpp",
945 "bionic/raise.cpp",
946 "bionic/rand.cpp",
947 "bionic/readlink.cpp",
948 "bionic/realpath.cpp",
949 "bionic/reboot.cpp",
950 "bionic/recv.cpp",
951 "bionic/recvmsg.cpp",
952 "bionic/rename.cpp",
953 "bionic/rmdir.cpp",
954 "bionic/scandir.cpp",
955 "bionic/sched_getaffinity.cpp",
956 "bionic/sched_getcpu.cpp",
957 "bionic/semaphore.cpp",
958 "bionic/send.cpp",
959 "bionic/setegid.cpp",
960 "bionic/seteuid.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000961 "bionic/setjmp_cookie.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800962 "bionic/setpgrp.cpp",
963 "bionic/sigaction.cpp",
964 "bionic/signal.cpp",
965 "bionic/sigprocmask.cpp",
966 "bionic/sleep.cpp",
967 "bionic/socketpair.cpp",
968 "bionic/spawn.cpp",
969 "bionic/stat.cpp",
970 "bionic/stdlib_l.cpp",
971 "bionic/strerror.cpp",
972 "bionic/string_l.cpp",
973 "bionic/strings_l.cpp",
974 "bionic/strsignal.cpp",
975 "bionic/strtol.cpp",
976 "bionic/strtold.cpp",
977 "bionic/swab.cpp",
978 "bionic/symlink.cpp",
979 "bionic/sync_file_range.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000980 "bionic/sysconf.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800981 "bionic/sys_epoll.cpp",
982 "bionic/sys_msg.cpp",
983 "bionic/sys_sem.cpp",
984 "bionic/sys_shm.cpp",
985 "bionic/sys_signalfd.cpp",
986 "bionic/sys_statfs.cpp",
987 "bionic/sys_statvfs.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000988 "bionic/sys_thread_properties.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800989 "bionic/sys_time.cpp",
990 "bionic/sysinfo.cpp",
991 "bionic/syslog.cpp",
992 "bionic/system.cpp",
993 "bionic/system_property_api.cpp",
994 "bionic/system_property_set.cpp",
995 "bionic/tdestroy.cpp",
996 "bionic/termios.cpp",
997 "bionic/thread_private.cpp",
998 "bionic/threads.cpp",
999 "bionic/time.cpp",
1000 "bionic/time_l.cpp",
1001 "bionic/tmpfile.cpp",
1002 "bionic/umount.cpp",
1003 "bionic/unlink.cpp",
1004 "bionic/usleep.cpp",
1005 "bionic/utmp.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001006 "bionic/vdso.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001007 "bionic/wait.cpp",
1008 "bionic/wchar.cpp",
1009 "bionic/wchar_l.cpp",
1010 "bionic/wcstod.cpp",
1011 "bionic/wctype.cpp",
1012 "bionic/wcwidth.cpp",
1013 "bionic/wmempcpy.cpp",
1014
1015 // TODO: why isn't this in a static-libc-only module?
1016 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1017 // which will be overridden by the actual one in libc.so.
1018 "bionic/icu_static.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001019 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001020
1021 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001022 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -07001023 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001024 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -08001025 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001026 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001027 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001028 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001029 "arch-arm/bionic/atomics_arm.c",
1030 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -08001031 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001032 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001033 "arch-arm/bionic/setjmp.S",
1034 "arch-arm/bionic/syscall.S",
1035 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001036
Haibo Huangea9957a2018-11-19 11:00:32 -08001037 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001038 "arch-arm/cortex-a7/bionic/memset.S",
1039
1040 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001041 "arch-arm/cortex-a9/bionic/memset.S",
1042 "arch-arm/cortex-a9/bionic/stpcpy.S",
1043 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001044 "arch-arm/cortex-a9/bionic/strcpy.S",
1045 "arch-arm/cortex-a9/bionic/strlen.S",
1046
Elliott Hughesaefe9992023-11-08 12:04:41 -08001047 "arch-arm/cortex-a15/bionic/memcpy.S",
1048 "arch-arm/cortex-a15/bionic/memmove.S",
1049 "arch-arm/cortex-a15/bionic/memset.S",
1050 "arch-arm/cortex-a15/bionic/stpcpy.S",
1051 "arch-arm/cortex-a15/bionic/strcat.S",
1052 "arch-arm/cortex-a15/bionic/strcmp.S",
1053 "arch-arm/cortex-a15/bionic/strcpy.S",
1054 "arch-arm/cortex-a15/bionic/strlen.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001055
1056 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001057
Haibo Huang01bfd892018-12-03 15:05:16 -08001058 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001059
Elliott Hughesaefe9992023-11-08 12:04:41 -08001060 "arch-arm/generic/bionic/memcmp.S",
1061 "arch-arm/generic/bionic/memmove.S",
1062 "arch-arm/generic/bionic/memset.S",
1063 "arch-arm/generic/bionic/stpcpy.c",
1064 "arch-arm/generic/bionic/strcat.c",
1065 "arch-arm/generic/bionic/strcmp.S",
1066 "arch-arm/generic/bionic/strcpy.S",
1067 "arch-arm/generic/bionic/strlen.c",
1068
1069 "arch-arm/krait/bionic/memcpy.S",
1070 "arch-arm/krait/bionic/memset.S",
1071
Haibo Huangea9957a2018-11-19 11:00:32 -08001072 "arch-arm/kryo/bionic/memcpy.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001073
1074 "bionic/strchr.cpp",
1075 "bionic/strchrnul.cpp",
1076 "bionic/strnlen.cpp",
1077 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001078 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001079 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001080 arm64: {
1081 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001082 "arch-arm64/bionic/__bionic_clone.S",
1083 "arch-arm64/bionic/_exit_with_stack_teardown.S",
1084 "arch-arm64/bionic/setjmp.S",
1085 "arch-arm64/bionic/syscall.S",
1086 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001087 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001088 },
1089
Elliott Hughesebc19a92022-10-14 23:25:36 +00001090 riscv64: {
1091 srcs: [
1092 "arch-riscv64/bionic/__bionic_clone.S",
1093 "arch-riscv64/bionic/_exit_with_stack_teardown.S",
Elliott Hughese1905ed2022-10-17 23:23:36 +00001094 "arch-riscv64/bionic/setjmp.S",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001095 "arch-riscv64/bionic/syscall.S",
1096 "arch-riscv64/bionic/vfork.S",
Yun Hsiang40a82d02023-05-26 10:10:40 +08001097
Elliott Hughesaefe9992023-11-08 12:04:41 -08001098 "arch-riscv64/string/memchr_v.S",
1099 "arch-riscv64/string/memcmp_v.S",
1100 "arch-riscv64/string/memcpy_v.S",
1101 "arch-riscv64/string/memmove_v.S",
1102 "arch-riscv64/string/memset_v.S",
1103 "arch-riscv64/string/stpcpy_v.S",
1104 "arch-riscv64/string/strcat_v.S",
1105 "arch-riscv64/string/strchr_v.S",
1106 "arch-riscv64/string/strcmp_v.S",
1107 "arch-riscv64/string/strcpy_v.S",
1108 "arch-riscv64/string/strlen_v.S",
1109 "arch-riscv64/string/strncat_v.S",
1110 "arch-riscv64/string/strncmp_v.S",
1111 "arch-riscv64/string/strncpy_v.S",
1112 "arch-riscv64/string/strnlen_v.S",
1113
1114 "arch-riscv64/string/memchr.c",
1115 "arch-riscv64/string/memcmp.c",
1116 "arch-riscv64/string/memcpy.c",
1117 "arch-riscv64/string/memmove.c",
1118 "arch-riscv64/string/memset.c",
1119 "arch-riscv64/string/stpcpy.c",
1120 "arch-riscv64/string/strcat.c",
1121 "arch-riscv64/string/strchr.c",
1122 "arch-riscv64/string/strcmp.c",
1123 "arch-riscv64/string/strcpy.c",
1124 "arch-riscv64/string/strlen.c",
1125 "arch-riscv64/string/strncat.c",
1126 "arch-riscv64/string/strncmp.c",
1127 "arch-riscv64/string/strncpy.c",
1128 "arch-riscv64/string/strnlen.c",
Prashanth Swaminathana4d71022023-10-30 17:35:19 -07001129
Elliott Hughes7d136662023-10-27 15:40:32 -07001130 "bionic/strchrnul.cpp",
1131 "bionic/strrchr.cpp",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001132 ],
1133 },
1134
Dan Willemsen208ae172015-09-16 16:33:27 -07001135 x86: {
1136 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001137 "arch-x86/bionic/__bionic_clone.S",
1138 "arch-x86/bionic/_exit_with_stack_teardown.S",
1139 "arch-x86/bionic/libcrt_compat.c",
Elliott Hughes7d136662023-10-27 15:40:32 -07001140 "arch-x86/bionic/setjmp.S",
1141 "arch-x86/bionic/syscall.S",
1142 "arch-x86/bionic/vfork.S",
1143 "arch-x86/bionic/__x86.get_pc_thunk.S",
1144
Dan Willemsen208ae172015-09-16 16:33:27 -07001145 "arch-x86/generic/string/memcmp.S",
1146 "arch-x86/generic/string/strcmp.S",
1147 "arch-x86/generic/string/strncmp.S",
1148 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001149
1150 "arch-x86/generic/string/strlcat.c",
1151 "arch-x86/generic/string/strlcpy.c",
1152 "arch-x86/generic/string/strncat.c",
1153 "arch-x86/generic/string/wcscat.c",
1154 "arch-x86/generic/string/wcscpy.c",
1155 "arch-x86/generic/string/wmemcmp.c",
1156
Elliott Hughesed777142022-07-25 16:25:11 +00001157 "arch-x86/string/sse2-memchr-atom.S",
1158 "arch-x86/string/sse2-memmove-slm.S",
1159 "arch-x86/string/sse2-memrchr-atom.S",
1160 "arch-x86/string/sse2-memset-atom.S",
1161 "arch-x86/string/sse2-memset-slm.S",
1162 "arch-x86/string/sse2-stpcpy-slm.S",
1163 "arch-x86/string/sse2-stpncpy-slm.S",
1164 "arch-x86/string/sse2-strchr-atom.S",
1165 "arch-x86/string/sse2-strcpy-slm.S",
1166 "arch-x86/string/sse2-strlen-slm.S",
1167 "arch-x86/string/sse2-strncpy-slm.S",
1168 "arch-x86/string/sse2-strnlen-atom.S",
1169 "arch-x86/string/sse2-strrchr-atom.S",
1170 "arch-x86/string/sse2-wcschr-atom.S",
1171 "arch-x86/string/sse2-wcsrchr-atom.S",
1172 "arch-x86/string/sse2-wcslen-atom.S",
1173 "arch-x86/string/sse2-wcscmp-atom.S",
1174 "arch-x86/string/sse2-strlen-atom.S",
1175
1176 "arch-x86/string/ssse3-memcmp-atom.S",
1177 "arch-x86/string/ssse3-memmove-atom.S",
1178 "arch-x86/string/ssse3-strcat-atom.S",
1179 "arch-x86/string/ssse3-strcmp-atom.S",
1180 "arch-x86/string/ssse3-strcpy-atom.S",
1181 "arch-x86/string/ssse3-strlcat-atom.S",
1182 "arch-x86/string/ssse3-strlcpy-atom.S",
1183 "arch-x86/string/ssse3-strncat-atom.S",
1184 "arch-x86/string/ssse3-strncmp-atom.S",
1185 "arch-x86/string/ssse3-strncpy-atom.S",
1186 "arch-x86/string/ssse3-wcscat-atom.S",
1187 "arch-x86/string/ssse3-wcscpy-atom.S",
1188 "arch-x86/string/ssse3-wmemcmp-atom.S",
1189
1190 "arch-x86/string/sse4-memcmp-slm.S",
1191 "arch-x86/string/sse4-wmemcmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001192
1193 "bionic/strchrnul.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001194 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001195 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001196 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001197 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001198 "arch-x86_64/bionic/__bionic_clone.S",
1199 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1200 "arch-x86_64/bionic/__restore_rt.S",
1201 "arch-x86_64/bionic/setjmp.S",
1202 "arch-x86_64/bionic/syscall.S",
1203 "arch-x86_64/bionic/vfork.S",
1204
ahs919fb7f2022-06-10 07:11:14 +05301205 "arch-x86_64/string/avx2-memset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001206 "arch-x86_64/string/sse2-memmove-slm.S",
1207 "arch-x86_64/string/sse2-memset-slm.S",
1208 "arch-x86_64/string/sse2-stpcpy-slm.S",
1209 "arch-x86_64/string/sse2-stpncpy-slm.S",
1210 "arch-x86_64/string/sse2-strcat-slm.S",
1211 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001212 "arch-x86_64/string/sse2-strlen-slm.S",
1213 "arch-x86_64/string/sse2-strncat-slm.S",
1214 "arch-x86_64/string/sse2-strncpy-slm.S",
1215 "arch-x86_64/string/sse4-memcmp-slm.S",
1216 "arch-x86_64/string/ssse3-strcmp-slm.S",
1217 "arch-x86_64/string/ssse3-strncmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001218
1219 "bionic/strchr.cpp",
1220 "bionic/strchrnul.cpp",
1221 "bionic/strnlen.cpp",
1222 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001223 ],
1224 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001225 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001226
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001227 // TODO: move to libc/bionic/legacy_32_bit_support.cpp or #if __LP64__ instead.
1228 multilib: {
1229 lib32: {
1230 srcs: ["bionic/mmap.cpp"],
1231 },
1232 },
1233
1234 local_include_dirs: ["stdio"],
1235 generated_headers: ["generated_android_ids"],
1236
1237 whole_static_libs: [
1238 "libsystemproperties",
1239 ],
1240
Colin Cross50c21ab2015-10-31 23:03:05 -07001241 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001242 include_dirs: ["bionic/libstdc++/include"],
1243 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001244}
1245
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001246genrule {
1247 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001248 out: ["generated_android_ids.h"],
1249 srcs: [":android_filesystem_config_header"],
Cole Faustb1a0a9d2023-11-28 17:51:16 -08001250 tools: ["fs_config_generator"],
1251 cmd: "$(location fs_config_generator) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001252}
1253
Dan Willemsen268a6732015-10-15 14:49:45 -07001254// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001255// libc_syscalls.a
1256// ========================================================
1257
Elliott Hughes782c4852019-04-16 12:31:00 -07001258genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001259 name: "syscalls-arm",
Elliott Hughes782c4852019-04-16 12:31:00 -07001260 out: ["syscalls-arm.S"],
1261 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001262 tools: ["gensyscalls"],
1263 cmd: "$(location gensyscalls) arm $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001264}
1265
1266genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001267 name: "syscalls-arm64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001268 out: ["syscalls-arm64.S"],
1269 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001270 tools: ["gensyscalls"],
1271 cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001272}
1273
1274genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001275 name: "syscalls-riscv64",
Elliott Hughes704772b2022-10-10 17:06:43 +00001276 out: ["syscalls-riscv64.S"],
1277 srcs: ["SYSCALLS.TXT"],
1278 tools: ["gensyscalls"],
1279 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
1280}
1281
1282genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001283 name: "syscalls-x86",
Elliott Hughes782c4852019-04-16 12:31:00 -07001284 out: ["syscalls-x86.S"],
1285 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001286 tools: ["gensyscalls"],
1287 cmd: "$(location gensyscalls) x86 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001288}
1289
1290genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001291 name: "syscalls-x86_64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001292 out: ["syscalls-x86_64.S"],
1293 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001294 tools: ["gensyscalls"],
1295 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001296}
1297
Dan Willemsen208ae172015-09-16 16:33:27 -07001298cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001299 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001300 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001301 arch: {
1302 arm: {
Cole Faustf5968d82023-04-11 15:20:19 -07001303 srcs: [":syscalls-arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001304 },
1305 arm64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001306 srcs: [":syscalls-arm64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001307 },
Elliott Hughes704772b2022-10-10 17:06:43 +00001308 riscv64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001309 srcs: [":syscalls-riscv64"],
Elliott Hughes704772b2022-10-10 17:06:43 +00001310 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001311 x86: {
Cole Faustf5968d82023-04-11 15:20:19 -07001312 srcs: [":syscalls-x86"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001313 },
1314 x86_64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001315 srcs: [":syscalls-x86_64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001316 },
1317 },
1318 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001319}
1320
1321// ========================================================
1322// libc_aeabi.a
1323// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1324// to avoid infinite recursion. For the other architectures we just build an
1325// empty library to keep this makefile simple.
1326// ========================================================
1327
1328cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001329 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001330 arch: {
1331 arm: {
1332 srcs: ["arch-arm/bionic/__aeabi.c"],
1333 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001334 },
1335 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001336 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001337}
1338
1339// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001340// libc_common.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001341// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001342
Dan Willemsen208ae172015-09-16 16:33:27 -07001343cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001344 defaults: ["libc_defaults"],
Elliott Hughesb0948922024-01-26 00:28:12 +00001345 name: "libc_common",
1346
Dan Willemsen208ae172015-09-16 16:33:27 -07001347 srcs: libc_common_src_files,
1348 multilib: {
1349 lib32: {
1350 srcs: libc_common_src_files_32,
1351 },
1352 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001353
1354 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001355 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001356 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001357 "libc_bionic",
Ryan Prichard249757b2019-11-01 17:18:28 -07001358 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001359 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001360 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001361 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001362 "libc_freebsd_large_stack",
Elliott Hughesc2043342023-07-20 20:24:09 +00001363 "libc_freebsd_ldexp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001364 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001365 "libc_netbsd",
1366 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001367 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001368 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001369 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001370 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001371 ],
1372
1373 arch: {
1374 arm: {
1375 whole_static_libs: ["libc_aeabi"],
1376 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001377 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001378}
1379
1380// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001381// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001382// ========================================================
1383cc_library_static {
1384 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001385 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001386
Haibo Huangb9244ff2018-08-11 10:12:13 -07001387 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301388 x86_64: {
1389 srcs: ["arch-x86_64/static_function_dispatch.S"],
1390 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001391 x86: {
1392 srcs: ["arch-x86/static_function_dispatch.S"],
1393 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001394 arm: {
1395 srcs: ["arch-arm/static_function_dispatch.S"],
1396 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001397 arm64: {
1398 srcs: ["arch-arm64/static_function_dispatch.S"],
1399 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001400 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001401 srcs: ["arch-riscv64/static_function_dispatch.S"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001402 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001403 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001404}
1405
1406// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001407// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001408// ========================================================
1409cc_library_static {
1410 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001411 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001412
Haibo Huangb9244ff2018-08-11 10:12:13 -07001413 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001414 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001415 "-fno-stack-protector",
1416 "-fno-jump-tables",
1417 ],
1418 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301419 x86_64: {
1420 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
1421 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001422 x86: {
1423 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1424 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001425 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001426 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001427 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001428 arm64: {
1429 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1430 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001431 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001432 srcs: ["arch-riscv64/dynamic_function_dispatch.cpp"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001433 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001434 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001435}
1436
1437// ========================================================
1438// libc_common_static.a For static binaries.
1439// ========================================================
1440cc_library_static {
1441 defaults: ["libc_defaults"],
1442 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001443
Haibo Huangf71edfa2018-11-12 10:06:56 -08001444 whole_static_libs: [
1445 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001446 "libc_static_dispatch",
1447 ],
1448}
1449
1450// ========================================================
1451// libc_common_shared.a For shared libraries.
1452// ========================================================
1453cc_library_static {
1454 defaults: ["libc_defaults"],
1455 name: "libc_common_shared",
1456
1457 whole_static_libs: [
1458 "libc_common",
1459 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001460 ],
1461}
1462
Ryan Prichard22a6a052019-10-10 23:59:30 -07001463// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1464// executable.
1465cc_library_static {
1466 name: "libc_unwind_static",
1467 defaults: ["libc_defaults"],
1468 cflags: ["-DLIBC_STATIC"],
1469
1470 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1471 arch: {
1472 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1473 arm: {
1474 srcs: ["arch-arm/bionic/exidx_static.c"],
1475 },
1476 },
1477}
1478
Haibo Huangf71edfa2018-11-12 10:06:56 -08001479// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001480// libc_nomalloc.a
1481// ========================================================
1482//
Ryan Prichard249757b2019-11-01 17:18:28 -07001483// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1484// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1485// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001486
1487cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001488 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001489 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001490
Colin Crossa3f9fca2016-01-11 13:20:55 -08001491 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001492 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001493 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001494 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001495 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001496}
1497
dimitryc0c0ef62018-12-05 16:33:52 +01001498filegroup {
1499 name: "libc_sources_shared",
1500 srcs: [
1501 "arch-common/bionic/crtbegin_so.c",
1502 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001503 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001504 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001505 "bionic/icu.cpp",
1506 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001507 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001508 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001509 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001510 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001511 "bionic/ndk_cruft.cpp",
1512 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001513 "bionic/NetdClient.cpp",
1514 "arch-common/bionic/crtend_so.S",
1515 ],
1516}
1517
1518filegroup {
1519 name: "libc_sources_static",
1520 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001521 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001522 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001523 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001524 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001525 ],
1526}
1527
1528filegroup {
1529 name: "libc_sources_shared_arm",
1530 srcs: [
1531 "arch-arm/bionic/exidx_dynamic.c",
1532 "arch-arm/bionic/atexit_legacy.c",
1533 ],
1534}
1535
Dan Willemsen208ae172015-09-16 16:33:27 -07001536// ========================================================
1537// libc.a + libc.so
1538// ========================================================
Florian Mayerc10d0642023-03-22 16:12:49 -07001539cc_defaults {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001540 defaults: [
1541 "libc_defaults",
1542 "libc_native_allocator_defaults",
1543 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001544 name: "libc_library_defaults",
Colin Cross50c21ab2015-10-31 23:03:05 -07001545 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001546 platform_sdk_version: {
1547 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1548 },
1549 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001550 static: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001551 srcs: [":libc_sources_static"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001552 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001553 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001554 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001555 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001556 "libc_init_static",
1557 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001558 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001559 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001560 },
1561 shared: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001562 srcs: [":libc_sources_shared"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001563 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001564 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001565 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001566 "libc_init_dynamic",
1567 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001568 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001569 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001570 },
1571
Neil Fullera7db90f2019-04-25 09:28:27 +01001572 required: [
MarkDacekd88d7ea2022-06-28 20:14:58 +00001573 "tzdata_prebuilt",
1574 "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
Neil Fullera7db90f2019-04-25 09:28:27 +01001575 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001576
Colin Cross4ce94d22016-11-15 13:15:43 -08001577 // Do not pack libc.so relocations; see http://b/20645321 for details.
1578 pack_relocations: false,
1579
dimitry06016f22018-01-05 11:39:28 +01001580 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1581 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1582 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1583 // those new libraries from libgcc.a are not declared external; if that were the case,
1584 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1585 // on the external symbols from the dependent libraries. That would create a "cloaked"
1586 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001587
dimitry06016f22018-01-05 11:39:28 +01001588 shared_libs: [
1589 "ld-android",
1590 "libdl",
1591 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001592 static_libs: [
1593 "libdl_android",
1594 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001595
1596 nocrt: true,
1597
Dan Willemsen208ae172015-09-16 16:33:27 -07001598 arch: {
1599 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001600 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001601 pack_relocations: false,
Christopher Ferris9d03a162023-11-10 11:19:11 -08001602 ldflags: [
1603 "-Wl,--hash-style=both",
1604 // Since we are preserving the debug_frame, do not compress
1605 // in this case to make unwinds as fast as possible.
1606 "-Wl,--compress-debug-sections=none",
1607 ],
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001608
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001609 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001610 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001611
Dan Willemsen208ae172015-09-16 16:33:27 -07001612 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001613 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001614 // special for arm
1615 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001616 // For backwards-compatibility, some arm32 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001617 static_libs: ["libclang_rt.builtins-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001618 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001619
1620 // Arm 32 bit does not produce complete exidx unwind information
1621 // so keep the .debug_frame which is relatively small and does
1622 // include needed unwind information.
1623 // See b/132992102 for details.
1624 strip: {
1625 keep_symbols_and_debug_frame: true,
1626 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001627 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001628 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001629 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001630
1631 // Leave the symbols in the shared library so that stack unwinders can produce
1632 // meaningful name resolution.
1633 strip: {
1634 keep_symbols: true,
1635 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001636 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001637 riscv64: {
1638 version_script: ":libc.riscv64.map",
1639
1640 // Leave the symbols in the shared library so that stack unwinders can produce
1641 // meaningful name resolution.
1642 strip: {
1643 keep_symbols: true,
1644 },
1645 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001646 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001647 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001648 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001649 ldflags: ["-Wl,--hash-style=both"],
1650
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001651 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001652 no_libcrt: true,
1653
1654 shared: {
1655 // For backwards-compatibility, some x86 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001656 static_libs: ["libclang_rt.builtins-exported"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001657 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001658
1659 // Leave the symbols in the shared library so that stack unwinders can produce
1660 // meaningful name resolution.
1661 strip: {
1662 keep_symbols: true,
1663 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001664 },
1665 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001666 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001667
1668 // Leave the symbols in the shared library so that stack unwinders can produce
1669 // meaningful name resolution.
1670 strip: {
1671 keep_symbols: true,
1672 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001673 },
1674 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001675
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001676 apex_available: [
1677 "//apex_available:platform",
1678 "com.android.runtime",
1679 ],
1680
Colin Cross7edd0082021-10-28 13:20:35 -07001681 target: {
1682 native_bridge: {
1683 shared: {
1684 installable: false,
1685 },
1686 },
1687 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001688}
1689
Florian Mayerc10d0642023-03-22 16:12:49 -07001690cc_library {
1691 name: "libc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001692 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001693 "libc_library_defaults",
1694 ],
1695 stubs: {
1696 symbol_file: "libc.map.txt",
1697 versions: [
1698 "29",
1699 "R",
1700 "current",
1701 ],
1702 },
1703 static_ndk_lib: true,
1704 llndk: {
1705 symbol_file: "libc.map.txt",
1706 export_headers_as_system: true,
1707 export_preprocessed_headers: ["include"],
1708 export_llndk_headers: ["libc_llndk_headers"],
1709 },
1710}
1711
1712cc_library {
1713 name: "libc_hwasan",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001714 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001715 "libc_library_defaults",
1716 ],
1717 sanitize: {
1718 hwaddress: true,
1719 },
1720 enabled: false,
Florian Mayerff116ed2023-04-14 17:38:53 -07001721 target: {
1722 android_arm64: {
Florian Mayerc10d0642023-03-22 16:12:49 -07001723 enabled: true,
1724 },
1725 },
1726 stem: "libc",
1727 relative_install_path: "hwasan",
1728 // We don't really need the stubs, but this needs to stay to trigger the
1729 // symlink logic in soong.
1730 stubs: {
1731 symbol_file: "libc.map.txt",
1732 },
1733 native_bridge_supported: false,
1734 // It is never correct to depend on this directly. This is only
1735 // needed for the runtime apex, and in base_system.mk.
1736 visibility: ["//bionic/apex"],
1737}
1738
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001739genrule {
1740 name: "libc.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001741 out: ["libc.arm.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) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001745}
1746
1747genrule {
1748 name: "libc.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001749 out: ["libc.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001750 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001751 tools: ["generate-version-script"],
1752 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001753}
1754
1755genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001756 name: "libc.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001757 out: ["libc.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001758 srcs: ["libc.map.txt"],
1759 tools: ["generate-version-script"],
1760 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1761}
1762
1763genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001764 name: "libc.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001765 out: ["libc.x86.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 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001769}
1770
1771genrule {
1772 name: "libc.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001773 out: ["libc.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001774 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001775 tools: ["generate-version-script"],
1776 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001777}
1778
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001779// Headers that only other parts of the platform can include.
1780cc_library_headers {
1781 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001782 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001783 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001784 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001785 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001786 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001787 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001788 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001789 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001790 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001791 "//system/core/debuggerd:__subpackages__",
Florian Mayerf5d70ce2022-09-13 13:58:30 -07001792 "//system/core/init:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001793 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001794 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001795 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001796 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001797 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001798 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001799 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001800 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001801 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001802 recovery_available: true,
1803 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001804 export_include_dirs: [
1805 "platform",
1806 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001807 system_shared_libs: [],
1808 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001809 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001810
Steven Moreland0cdf1322020-10-05 21:55:26 +00001811 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001812 apex_available: [
1813 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001814 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001815 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001816}
1817
Logan Chien17af91b2019-01-15 21:19:56 +08001818cc_library_headers {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001819 name: "libc_llndk_headers",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001820 visibility: [
1821 "//external/musl",
1822 ],
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001823 llndk: {
1824 llndk_headers: true,
1825 },
Logan Chien17af91b2019-01-15 21:19:56 +08001826 host_supported: true,
1827 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001828 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001829 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001830 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001831 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001832 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001833 apex_available: [
1834 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001835 "//apex_available:anyapex",
1836 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001837 // used by most APEXes indirectly via libunwind_llvm
1838 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001839
1840 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001841 stl: "none",
1842 system_shared_libs: [],
1843
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001844 // The build system generally requires that any dependencies of a target
1845 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1846 // to 1 we let targets with an sdk_version that need to depend on the libc
1847 // headers but cannot depend on libc itself due to circular dependencies
1848 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1849 // is correct because the headers can support any sdk_version.
1850 sdk_version: "1",
1851
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001852 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001853 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001854 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001855 "kernel/android/uapi",
1856 ],
1857
1858 arch: {
1859 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001860 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001861 },
1862 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001863 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001864 },
Elliott Hughes48e53332022-10-07 20:39:25 +00001865 riscv64: {
1866 export_system_include_dirs: ["kernel/uapi/asm-riscv"],
1867 },
Logan Chien17af91b2019-01-15 21:19:56 +08001868 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001869 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001870 },
1871 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001872 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001873 },
1874 },
1875}
1876
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001877cc_library_headers {
1878 name: "libc_headers",
1879 host_supported: true,
1880 native_bridge_supported: true,
1881 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001882 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001883 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001884 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001885 recovery_available: true,
1886 sdk_version: "1",
1887
1888 apex_available: [
1889 "//apex_available:platform",
1890 "//apex_available:anyapex",
1891 ],
1892 // used by most APEXes indirectly via libunwind_llvm
1893 min_sdk_version: "apex_inherit",
1894 visibility: [
1895 "//bionic:__subpackages__", // visible to bionic
1896 // ... and only to these places (b/152668052)
1897 "//external/arm-optimized-routines",
1898 "//external/gwp_asan",
1899 "//external/jemalloc_new",
1900 "//external/libunwind_llvm",
1901 "//external/scudo",
1902 "//system/core/property_service/libpropertyinfoparser",
1903 "//system/extras/toolchain-extras",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001904 ],
1905
1906 stl: "none",
1907 no_libcrt: true,
1908 system_shared_libs: [],
1909
1910 target: {
1911 android: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001912 export_system_include_dirs: ["include"],
1913 header_libs: ["libc_llndk_headers"],
1914 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001915 },
1916 linux_bionic: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001917 export_system_include_dirs: ["include"],
1918 header_libs: ["libc_llndk_headers"],
1919 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001920 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001921 },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001922}
1923
Dan Willemsen208ae172015-09-16 16:33:27 -07001924// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001925// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001926// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001927
Dan Willemsen208ae172015-09-16 16:33:27 -07001928cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001929 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001930 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001931 srcs: [
1932 "bionic/__cxa_guard.cpp",
1933 "bionic/__cxa_pure_virtual.cpp",
1934 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001935 ],
1936 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001937 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001938 static_libs: ["libasync_safe"],
Elliott Hughesc2043342023-07-20 20:24:09 +00001939 apex_available: [
1940 "//apex_available:platform",
1941 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001942
Dan Willemsen6b3be172018-12-03 13:57:20 -08001943 static: {
1944 system_shared_libs: [],
1945 },
Colin Crossb5bfe0b2021-07-13 16:26:28 -07001946 target: {
1947 bionic: {
1948 shared: {
1949 system_shared_libs: ["libc"],
1950 },
1951 },
Dan Willemsen6b3be172018-12-03 13:57:20 -08001952 },
1953
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001954 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001955 arch: {
1956 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001957 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001958 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001959 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001960 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001961 },
1962 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001963 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001964 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001965 riscv64: {
1966 version_script: ":libstdc++.riscv64.map",
1967 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001968 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001969 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001970 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001971 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001972 },
1973 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001974 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001975 },
1976 },
1977}
1978
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001979genrule {
1980 name: "libstdc++.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001981 out: ["libstdc++.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001982 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001983 tools: ["generate-version-script"],
1984 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001985}
1986
1987genrule {
1988 name: "libstdc++.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001989 out: ["libstdc++.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001990 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001991 tools: ["generate-version-script"],
1992 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001993}
1994
1995genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001996 name: "libstdc++.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001997 out: ["libstdc++.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001998 srcs: ["libstdc++.map.txt"],
1999 tools: ["generate-version-script"],
2000 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
2001}
2002
2003genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002004 name: "libstdc++.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002005 out: ["libstdc++.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002006 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002007 tools: ["generate-version-script"],
2008 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002009}
2010
2011genrule {
2012 name: "libstdc++.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002013 out: ["libstdc++.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002014 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002015 tools: ["generate-version-script"],
2016 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002017}
2018
2019// ========================================================
2020// crt object files.
2021// ========================================================
2022
Colin Cross50c21ab2015-10-31 23:03:05 -07002023cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002024 name: "crt_and_memtag_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002025 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002026 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002027 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002028 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002029 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002030 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002031 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002032 apex_available: [
2033 "//apex_available:platform",
2034 "//apex_available:anyapex",
2035 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002036 // Generate NDK variants of the CRT objects for every supported API level.
2037 min_sdk_version: "16",
2038 stl: "none",
2039 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002040 cflags: [
2041 "-Wno-gcc-compat",
2042 "-Wall",
2043 "-Werror",
2044 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002045 sanitize: {
2046 never: true,
2047 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002048}
2049
Colin Cross50c21ab2015-10-31 23:03:05 -07002050cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002051 name: "crt_defaults",
2052 defaults: ["crt_and_memtag_defaults"],
Colin Cross02f81372021-07-22 12:02:10 -07002053 system_shared_libs: [],
Colin Cross10d92682021-06-22 13:25:46 -07002054}
2055
2056cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002057 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002058 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002059
2060 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002061 x86: {
2062 cflags: ["-fPIC"],
2063 },
2064 x86_64: {
2065 cflags: ["-fPIC"],
2066 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002067 },
Colin Crossab179442018-09-27 11:03:22 -07002068 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002069}
2070
Dan Willemsen208ae172015-09-16 16:33:27 -07002071cc_object {
2072 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002073 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002074 local_include_dirs: [
2075 "include",
2076 "private", // crtbrand.S depends on private/bionic_asm_note.h
2077 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002078 product_variables: {
2079 platform_sdk_version: {
2080 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2081 },
2082 },
2083 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002084
Colin Cross7d7b3682017-11-03 13:38:40 -07002085 defaults: ["crt_so_defaults"],
Dan Alberteee46dc2023-04-04 23:27:52 +00002086 // crtbrand is an intermediate artifact, not a final CRT object.
2087 exclude_from_ndk_sysroot: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07002088}
2089
Dan Willemsen208ae172015-09-16 16:33:27 -07002090cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002091 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002092 local_include_dirs: ["include"],
2093 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002094
Colin Cross7d7b3682017-11-03 13:38:40 -07002095 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002096 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002097 "crtbrand",
2098 ],
2099}
2100
Dan Willemsen208ae172015-09-16 16:33:27 -07002101cc_object {
2102 name: "crtend_so",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002103 local_include_dirs: [
2104 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002105 "private", // crtend_so.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002106 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002107 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002108
Colin Cross7d7b3682017-11-03 13:38:40 -07002109 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002110}
2111
Dan Willemsen208ae172015-09-16 16:33:27 -07002112cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002113 name: "crtbegin_static",
2114
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002115 local_include_dirs: [
2116 "include",
2117 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2118 ],
Liz Kammere718dd72021-03-09 15:00:06 -05002119
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002120 cflags: ["-DCRTBEGIN_STATIC"],
Yabin Cui744cfd32023-08-24 13:20:23 -07002121
Dan Willemsen208ae172015-09-16 16:33:27 -07002122 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002123 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002124 "crtbrand",
2125 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002126 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002127 // When using libc.a, we're using the latest library regardless of target API level.
2128 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002129}
2130
Dan Willemsen208ae172015-09-16 16:33:27 -07002131cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002132 name: "crtbegin_dynamic",
2133
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002134 local_include_dirs: [
2135 "include",
2136 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2137 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002138 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002139 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002140 "crtbrand",
2141 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002142 target: {
2143 linux_bionic: {
2144 generated_sources: ["host_bionic_linker_asm"],
2145 objs: [
2146 "linker_wrapper",
2147 ],
2148 },
2149 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002150 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002151}
2152
Dan Willemsen208ae172015-09-16 16:33:27 -07002153cc_object {
2154 // We rename crtend.o to crtend_android.o to avoid a
2155 // name clash between gcc and bionic.
2156 name: "crtend_android",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002157 local_include_dirs: [
2158 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002159 "private", // crtend.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002160 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002161 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002162
Colin Cross50c21ab2015-10-31 23:03:05 -07002163 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002164}
Colin Crossbaa48992016-07-13 11:15:21 -07002165
Kalesh Singh862a23d2024-01-09 13:13:50 -08002166cc_object {
2167 name: "crt_pad_segment",
2168 local_include_dirs: [
2169 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002170 "private", // crt_pad_segment.S depends on private/bionic_asm_note.h
Kalesh Singh862a23d2024-01-09 13:13:50 -08002171 ],
2172 srcs: ["arch-common/bionic/crt_pad_segment.S"],
2173
2174 defaults: ["crt_defaults"],
2175}
2176
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002177cc_library_static {
2178 name: "note_memtag_heap_async",
2179 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002180 arm64: {
2181 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2182 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002183 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002184 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002185
Colin Cross10d92682021-06-22 13:25:46 -07002186 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002187}
2188
2189cc_library_static {
2190 name: "note_memtag_heap_sync",
2191 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002192 arm64: {
2193 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2194 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002195 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002196 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002197
Colin Cross10d92682021-06-22 13:25:46 -07002198 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002199}
2200
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002201// ========================================================
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002202// libc dependencies for baremetal Rust projects.
2203// ========================================================
2204
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002205// This library contains the following unresolved symbols:
2206// __errno
2207// abort
2208// async_safe_fatal_va_list
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002209cc_library_static {
2210 name: "librust_baremetal",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002211 header_libs: ["libc_headers"],
2212 include_dirs: [
2213 "bionic/libc/async_safe/include",
2214 "bionic/libc/platform",
2215 ],
2216 cflags: [
2217 "-Wall",
2218 "-Werror",
2219 ],
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002220 srcs: [
2221 "bionic/fortify.cpp",
Pierre-Clément Tosi816176c2022-11-30 14:33:41 +00002222 "bionic/strtol.cpp",
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002223 ],
2224 arch: {
2225 arm64: {
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002226 srcs: [
2227 "arch-arm64/string/__memcpy_chk.S",
2228 ],
2229 },
caowencheng9a39eb32023-03-20 16:24:41 +08002230 riscv64: {
2231 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002232 "arch-riscv64/string/__memcpy_chk.S",
caowencheng9a39eb32023-03-20 16:24:41 +08002233 ],
2234 },
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002235 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002236 whole_static_libs: [
2237 "libarm-optimized-routines-mem",
Pierre-Clément Tosieb46ac92023-02-01 13:44:57 +00002238 "libc_netbsd",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002239 ],
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002240 system_shared_libs: [],
2241 nocrt: true,
2242 stl: "none",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002243 visibility: [
2244 "//packages/modules/Virtualization/vmbase",
2245 ],
2246}
2247
2248// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002249// NDK headers.
2250// ========================================================
2251
Dan Albert26e1c412018-05-24 14:56:46 -07002252versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002253 name: "common_libc",
2254 from: "include",
2255 to: "",
2256 license: "NOTICE",
2257}
Dan Albert4238a352016-06-28 11:18:05 -07002258
2259ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002260 name: "libc_uapi",
2261 from: "kernel/uapi",
2262 to: "",
2263 srcs: [
2264 "kernel/uapi/asm-generic/**/*.h",
2265 "kernel/uapi/drm/**/*.h",
2266 "kernel/uapi/linux/**/*.h",
2267 "kernel/uapi/misc/**/*.h",
2268 "kernel/uapi/mtd/**/*.h",
2269 "kernel/uapi/rdma/**/*.h",
2270 "kernel/uapi/scsi/**/*.h",
2271 "kernel/uapi/sound/**/*.h",
2272 "kernel/uapi/video/**/*.h",
2273 "kernel/uapi/xen/**/*.h",
2274 ],
Dan Albert92592652016-10-20 01:42:54 -07002275 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002276}
2277
2278ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002279 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002280 from: "kernel/android/uapi/linux",
2281 to: "linux",
2282 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002283 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002284}
2285
2286ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002287 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002288 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002289 to: "scsi",
2290 srcs: ["kernel/android/scsi/**/*.h"],
2291 license: "NOTICE",
2292}
2293
2294ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002295 name: "libc_asm_arm",
2296 from: "kernel/uapi/asm-arm",
2297 to: "arm-linux-androideabi",
2298 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002299 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002300}
2301
2302ndk_headers {
2303 name: "libc_asm_arm64",
2304 from: "kernel/uapi/asm-arm64",
2305 to: "aarch64-linux-android",
2306 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002307 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002308}
2309
Lazar Trsic790d2f72017-11-27 11:54:11 +01002310ndk_headers {
Colin Crossbd26e0f2022-10-19 15:03:14 -07002311 name: "libc_asm_riscv64",
2312 from: "kernel/uapi/asm-riscv",
2313 to: "riscv64-linux-android",
2314 srcs: ["kernel/uapi/asm-riscv/**/*.h"],
2315 license: "NOTICE",
2316}
2317
2318ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002319 name: "libc_asm_x86",
2320 from: "kernel/uapi/asm-x86",
2321 to: "i686-linux-android",
2322 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002323 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002324}
2325
2326ndk_headers {
2327 name: "libc_asm_x86_64",
2328 from: "kernel/uapi/asm-x86",
2329 to: "x86_64-linux-android",
2330 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002331 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002332}
2333
Dan Albert4238a352016-06-28 11:18:05 -07002334ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002335 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002336 symbol_file: "libc.map.txt",
2337 first_version: "9",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002338 export_header_libs: [
2339 "common_libc",
2340 "libc_uapi",
2341 "libc_kernel_android_uapi_linux",
2342 "libc_kernel_android_scsi",
2343 "libc_asm_arm",
2344 "libc_asm_arm64",
Colin Crossbd26e0f2022-10-19 15:03:14 -07002345 "libc_asm_riscv64",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002346 "libc_asm_x86",
2347 "libc_asm_x86_64",
2348 ],
Dan Albert4238a352016-06-28 11:18:05 -07002349}
2350
Dan Albertdf31aff2016-10-06 15:50:41 -07002351ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002352 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002353 symbol_file: "libstdc++.map.txt",
2354 first_version: "9",
2355}
2356
Dan Willemsenca056d72018-01-08 14:00:24 -08002357// Export these headers for toolbox to process
2358filegroup {
2359 name: "kernel_input_headers",
2360 srcs: [
2361 "kernel/uapi/linux/input.h",
2362 "kernel/uapi/linux/input-event-codes.h",
2363 ],
2364}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002365
2366// Generate a syscall name / number mapping. These objects are text files
2367// (thanks to the -dD -E flags) and not binary files. They will then be
2368// consumed by the genseccomp.py script and converted into C++ code.
2369cc_defaults {
2370 name: "libseccomp_gen_syscall_nrs_defaults",
2371 recovery_available: true,
2372 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2373 cflags: [
2374 "-dD",
2375 "-E",
2376 "-Wall",
2377 "-Werror",
2378 "-nostdinc",
2379 ],
2380}
2381
2382cc_object {
2383 name: "libseccomp_gen_syscall_nrs_arm",
2384 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2385 local_include_dirs: [
2386 "kernel/uapi/asm-arm",
2387 "kernel/uapi",
2388 ],
2389}
2390
2391cc_object {
2392 name: "libseccomp_gen_syscall_nrs_arm64",
2393 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2394 local_include_dirs: [
2395 "kernel/uapi/asm-arm64",
2396 "kernel/uapi",
2397 ],
2398}
2399
2400cc_object {
Elliott Hughes704772b2022-10-10 17:06:43 +00002401 name: "libseccomp_gen_syscall_nrs_riscv64",
2402 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2403 local_include_dirs: [
2404 "kernel/uapi/asm-riscv",
2405 "kernel/uapi",
2406 ],
2407}
2408
2409cc_object {
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002410 name: "libseccomp_gen_syscall_nrs_x86",
2411 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2412 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2413 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2414 local_include_dirs: [
2415 "kernel/uapi/asm-x86",
2416 "kernel/uapi",
2417 ],
2418}
2419
2420cc_object {
2421 name: "libseccomp_gen_syscall_nrs_x86_64",
2422 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2423 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2424 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2425 local_include_dirs: [
2426 "kernel/uapi/asm-x86",
2427 "kernel/uapi",
2428 ],
2429}
2430
Jingwen Chenca366332021-01-29 05:16:32 -05002431filegroup {
2432 name: "all_kernel_uapi_headers",
2433 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002434}
2435
Martijn Coenen0c6de752019-01-02 12:52:51 +01002436cc_genrule {
2437 name: "func_to_syscall_nrs",
2438 recovery_available: true,
2439 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2440
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002441 tools: ["genfunctosyscallnrs"],
Martijn Coenen0c6de752019-01-02 12:52:51 +01002442
2443 srcs: [
2444 "SYSCALLS.TXT",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002445 ],
2446
Elliott Hughes704772b2022-10-10 17:06:43 +00002447 arch: {
2448 arm: {
2449 srcs: [
2450 ":libseccomp_gen_syscall_nrs_arm",
2451 ":libseccomp_gen_syscall_nrs_arm64",
2452 ],
2453 },
2454 arm64: {
2455 srcs: [
2456 ":libseccomp_gen_syscall_nrs_arm",
2457 ":libseccomp_gen_syscall_nrs_arm64",
2458 ],
2459 },
2460 riscv64: {
2461 srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
2462 },
2463 x86: {
2464 srcs: [
2465 ":libseccomp_gen_syscall_nrs_x86",
2466 ":libseccomp_gen_syscall_nrs_x86_64",
2467 ],
2468 },
2469 x86_64: {
2470 srcs: [
2471 ":libseccomp_gen_syscall_nrs_x86",
2472 ":libseccomp_gen_syscall_nrs_x86_64",
2473 ],
2474 },
2475 },
2476
Martijn Coenen0c6de752019-01-02 12:52:51 +01002477 out: [
2478 "func_to_syscall_nrs.h",
2479 ],
2480}
2481
Victor Hsiehdbb86702020-06-15 09:29:07 -07002482// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002483genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002484 name: "generate_app_zygote_blocklist",
2485 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2486 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002487 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2488}
2489
Yu Liu938ec9b2022-10-17 16:36:30 -07002490filegroup {
2491 name: "seccomp_syscalls_sources_zygote",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002492 srcs: [
2493 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002494 "SECCOMP_ALLOWLIST_COMMON.TXT",
2495 "SECCOMP_ALLOWLIST_APP.TXT",
2496 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002497 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002498 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002499 ],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002500}
2501
Yu Liu938ec9b2022-10-17 16:36:30 -07002502filegroup {
2503 name: "seccomp_syscalls_sources_app",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002504 srcs: [
2505 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002506 "SECCOMP_ALLOWLIST_COMMON.TXT",
2507 "SECCOMP_ALLOWLIST_APP.TXT",
2508 "SECCOMP_BLOCKLIST_COMMON.TXT",
2509 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002510 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002511 ],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002512}
2513
Yu Liu938ec9b2022-10-17 16:36:30 -07002514filegroup {
2515 name: "seccomp_syscalls_sources_system",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002516 srcs: [
2517 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002518 "SECCOMP_ALLOWLIST_COMMON.TXT",
2519 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2520 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002521 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002522 ],
Yu Liu938ec9b2022-10-17 16:36:30 -07002523}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002524
Yu Liu938ec9b2022-10-17 16:36:30 -07002525cc_genrule {
2526 name: "libseccomp_policy_app_zygote_sources_x86",
2527 recovery_available: true,
2528 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002529 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002530 srcs: [
2531 ":seccomp_syscalls_sources_zygote",
2532 ":libseccomp_gen_syscall_nrs_x86",
2533 ":libseccomp_gen_syscall_nrs_x86_64",
2534 ],
2535 out: [
2536 "x86_app_zygote_policy.cpp",
2537 "x86_64_app_zygote_policy.cpp",
2538 ],
2539 enabled: false,
Yu Liu3a579692022-10-18 03:02:32 +00002540 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002541 x86: {
2542 enabled: true,
2543 },
2544 x86_64: {
2545 enabled: true,
2546 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002547 },
2548}
2549
2550cc_genrule {
2551 name: "libseccomp_policy_app_zygote_sources_arm",
2552 recovery_available: true,
2553 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002554 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002555 srcs: [
2556 ":seccomp_syscalls_sources_zygote",
2557 ":libseccomp_gen_syscall_nrs_arm",
2558 ":libseccomp_gen_syscall_nrs_arm64",
2559 ],
2560 out: [
2561 "arm_app_zygote_policy.cpp",
2562 "arm64_app_zygote_policy.cpp",
2563 ],
2564 enabled: false,
2565 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002566 arm: {
2567 enabled: true,
2568 },
2569 arm64: {
2570 enabled: true,
2571 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002572 },
2573}
2574
2575cc_genrule {
2576 name: "libseccomp_policy_app_zygote_sources_riscv64",
2577 recovery_available: true,
2578 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002579 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002580 srcs: [
2581 ":seccomp_syscalls_sources_zygote",
2582 ":libseccomp_gen_syscall_nrs_riscv64",
2583 ],
2584 out: [
2585 "riscv64_app_zygote_policy.cpp",
2586 ],
2587 enabled: false,
2588 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002589 riscv64: {
2590 enabled: true,
2591 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002592 },
2593}
2594
2595cc_genrule {
2596 name: "libseccomp_policy_app_sources_x86",
2597 recovery_available: true,
2598 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002599 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002600 srcs: [
2601 ":seccomp_syscalls_sources_app",
2602 ":libseccomp_gen_syscall_nrs_x86",
2603 ":libseccomp_gen_syscall_nrs_x86_64",
2604 ],
2605 out: [
2606 "x86_app_policy.cpp",
2607 "x86_64_app_policy.cpp",
2608 ],
2609 enabled: false,
2610 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002611 x86: {
2612 enabled: true,
2613 },
2614 x86_64: {
2615 enabled: true,
2616 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002617 },
2618}
2619
2620cc_genrule {
2621 name: "libseccomp_policy_app_sources_arm",
2622 recovery_available: true,
2623 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002624 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002625 srcs: [
2626 ":seccomp_syscalls_sources_app",
2627 ":libseccomp_gen_syscall_nrs_arm",
2628 ":libseccomp_gen_syscall_nrs_arm64",
2629 ],
2630 out: [
2631 "arm_app_policy.cpp",
2632 "arm64_app_policy.cpp",
2633 ],
2634 enabled: false,
2635 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002636 arm: {
2637 enabled: true,
2638 },
2639 arm64: {
2640 enabled: true,
2641 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002642 },
2643}
2644
2645cc_genrule {
2646 name: "libseccomp_policy_app_sources_riscv64",
2647 recovery_available: true,
2648 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002649 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002650 srcs: [
2651 ":seccomp_syscalls_sources_app",
2652 ":libseccomp_gen_syscall_nrs_riscv64",
2653 ],
2654 out: [
2655 "riscv64_app_policy.cpp",
2656 ],
2657 enabled: false,
2658 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002659 riscv64: {
2660 enabled: true,
2661 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002662 },
2663}
2664
2665cc_genrule {
2666 name: "libseccomp_policy_system_sources_x86",
2667 recovery_available: true,
2668 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002669 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002670 srcs: [
2671 ":seccomp_syscalls_sources_system",
2672 ":libseccomp_gen_syscall_nrs_x86",
2673 ":libseccomp_gen_syscall_nrs_x86_64",
2674 ],
2675 out: [
2676 "x86_system_policy.cpp",
2677 "x86_64_system_policy.cpp",
2678 ],
2679 enabled: false,
2680 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002681 x86: {
2682 enabled: true,
2683 },
2684 x86_64: {
2685 enabled: true,
2686 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002687 },
2688}
2689
2690cc_genrule {
2691 name: "libseccomp_policy_system_sources_arm",
2692 recovery_available: true,
2693 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002694 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002695 srcs: [
2696 ":seccomp_syscalls_sources_system",
2697 ":libseccomp_gen_syscall_nrs_arm",
2698 ":libseccomp_gen_syscall_nrs_arm64",
2699 ],
2700 out: [
2701 "arm_system_policy.cpp",
2702 "arm64_system_policy.cpp",
2703 ],
2704 enabled: false,
2705 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002706 arm: {
2707 enabled: true,
2708 },
2709 arm64: {
2710 enabled: true,
2711 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002712 },
2713}
2714
2715cc_genrule {
2716 name: "libseccomp_policy_system_sources_riscv64",
2717 recovery_available: true,
2718 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002719 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002720 srcs: [
2721 ":seccomp_syscalls_sources_system",
2722 ":libseccomp_gen_syscall_nrs_riscv64",
2723 ],
2724 out: [
2725 "riscv64_system_policy.cpp",
2726 ],
2727 enabled: false,
2728 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002729 riscv64: {
2730 enabled: true,
2731 },
Yu Liu3a579692022-10-18 03:02:32 +00002732 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002733}
2734
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002735cc_library {
2736 name: "libseccomp_policy",
2737 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002738 generated_headers: ["func_to_syscall_nrs"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002739
2740 arch: {
2741 arm: {
2742 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002743 "libseccomp_policy_app_sources_arm",
2744 "libseccomp_policy_app_zygote_sources_arm",
2745 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002746 ],
2747 },
2748 arm64: {
2749 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002750 "libseccomp_policy_app_sources_arm",
2751 "libseccomp_policy_app_zygote_sources_arm",
2752 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002753 ],
2754 },
2755 riscv64: {
2756 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002757 "libseccomp_policy_app_sources_riscv64",
2758 "libseccomp_policy_app_zygote_sources_riscv64",
2759 "libseccomp_policy_system_sources_riscv64",
Yu Liu938ec9b2022-10-17 16:36:30 -07002760 ],
2761 },
2762 x86: {
2763 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002764 "libseccomp_policy_app_sources_x86",
2765 "libseccomp_policy_app_zygote_sources_x86",
2766 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002767 ],
2768 },
2769 x86_64: {
2770 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002771 "libseccomp_policy_app_sources_x86",
2772 "libseccomp_policy_app_zygote_sources_x86",
2773 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002774 ],
2775 },
2776 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002777
2778 srcs: [
2779 "seccomp/seccomp_policy.cpp",
2780 ],
2781
2782 export_include_dirs: ["seccomp/include"],
2783 cflags: [
2784 "-Wall",
2785 "-Werror",
2786 ],
2787 shared: {
2788 shared_libs: ["libbase"],
2789 },
2790 static: {
2791 static_libs: ["libbase"],
2792 },
2793}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002794
Colin Cross048f24e2021-09-01 17:26:00 -07002795cc_library_host_static {
2796 name: "libfts",
2797 srcs: [
2798 "bionic/fts.c",
2799 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
2800 ],
2801 export_include_dirs: ["fts/include"],
2802 local_include_dirs: [
2803 "private",
2804 "upstream-openbsd/android/include",
2805 ],
2806 cflags: [
2807 "-include openbsd-compat.h",
2808 "-Wno-unused-parameter",
2809 ],
2810 enabled: false,
2811 target: {
2812 musl: {
2813 enabled: true,
2814 },
2815 },
Colin Cross2a9843f2022-01-13 12:26:30 -08002816 stl: "none",
2817}
2818
2819cc_library_host_static {
2820 name: "libexecinfo",
2821 visibility: ["//external/musl"],
2822 srcs: ["bionic/execinfo.cpp"],
2823 export_include_dirs: ["execinfo/include"],
2824 local_include_dirs: ["private"],
2825 enabled: false,
2826 target: {
2827 musl: {
2828 enabled: true,
2829 system_shared_libs: [],
2830 header_libs: ["libc_musl_headers"],
2831 },
2832 },
2833 stl: "none",
Colin Cross048f24e2021-09-01 17:26:00 -07002834}
2835
Colin Cross9da85fa2022-01-24 18:20:05 -08002836cc_library_host_static {
2837 name: "libb64",
2838 visibility: ["//external/musl"],
2839 srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
2840 export_include_dirs: ["b64/include"],
2841 local_include_dirs: [
2842 "private",
2843 "upstream-openbsd/android/include",
2844 ],
2845 cflags: [
2846 "-include openbsd-compat.h",
2847 ],
2848 enabled: false,
2849 target: {
2850 musl: {
2851 enabled: true,
2852 system_shared_libs: [],
2853 header_libs: ["libc_musl_headers"],
2854 },
2855 },
2856 stl: "none",
2857}
2858
Colin Cross9d4a56e2022-02-03 10:20:32 -08002859// Export kernel uapi headers to be used in the musl sysroot.
2860// Also include the execinfo headers for the libexecinfo and the
2861// b64 headers for libb64 embedded in musl libc.
2862cc_genrule {
2863 name: "libc_musl_sysroot_bionic_headers",
2864 visibility: ["//external/musl"],
2865 host_supported: true,
2866 device_supported: false,
2867 enabled: false,
2868 target: {
2869 musl: {
2870 enabled: true,
2871 },
2872 },
2873 srcs: [
2874 "kernel/uapi/**/*.h",
2875 "kernel/android/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002876 "execinfo/include/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002877 "b64/include/**/*.h",
Colin Crossaeef9f02022-02-07 21:01:26 -08002878
Colin Crossaeef9f02022-02-07 21:01:26 -08002879 "NOTICE",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002880
2881 ":libc_musl_sysroot_bionic_arch_headers",
2882 ],
2883 out: ["libc_musl_sysroot_bionic_headers.zip"],
2884 tools: [
2885 "soong_zip",
2886 "merge_zips",
2887 "zip2zip",
2888 ],
Colin Crossaeef9f02022-02-07 21:01:26 -08002889 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
2890 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
Colin Crossad33d022022-02-25 18:27:04 -08002891 // NOTICE
2892 " -j -f $(location NOTICE) " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002893 // headers
2894 " -P include " +
Colin Crossaeef9f02022-02-07 21:01:26 -08002895 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
2896 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
2897 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2898 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2899 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2900 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2901 " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
2902 " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
2903 " -C $${BIONIC_LIBC_DIR}/b64/include " +
2904 " -D $${BIONIC_LIBC_DIR}/b64/include " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002905 " && " +
Colin Crossad33d022022-02-25 18:27:04 -08002906 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
Colin Cross1c0a7a02022-08-11 12:22:26 -07002907 " -x **/BUILD " +
Colin Crossad33d022022-02-25 18:27:04 -08002908 " include/**/*:include/ " +
2909 " NOTICE:NOTICE.bionic " +
2910 " && " +
2911 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002912}
2913
2914// The architecture-specific bits have to be handled separately because the label varies based
2915// on architecture, which prevents using $(locations) to find them and requires using $(in)
2916// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
2917// genrule.
2918cc_genrule {
2919 name: "libc_musl_sysroot_bionic_arch_headers",
2920 visibility: ["//visibility:private"],
2921 host_supported: true,
2922 device_supported: false,
2923 enabled: false,
2924 target: {
2925 musl: {
2926 enabled: true,
2927 },
2928 },
2929 arch: {
2930 arm: {
2931 srcs: ["kernel/uapi/asm-arm/**/*.h"],
2932 },
2933 arm64: {
2934 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
2935 },
2936 x86: {
2937 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2938 },
2939 x86_64: {
2940 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2941 },
2942 },
2943 out: ["libc_musl_sysroot_bionic_arch_headers.zip"],
2944 tools: ["soong_zip"],
2945 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
2946}
Colin Cross290c4952022-10-13 12:51:13 -07002947
2948cc_genrule {
2949 name: "bionic_sysroot_crt_objects",
2950 visibility: ["//visibility:private"],
2951 out: ["bionic_sysroot_crt_objects.zip"],
2952 tools: ["soong_zip"],
2953 srcs: [
2954 ":crtbegin_dynamic",
2955 ":crtbegin_so",
2956 ":crtbegin_static",
2957 ":crtend_android",
2958 ":crtend_so",
2959 ],
2960 cmd: "$(location soong_zip) -o $(out) -j " +
2961 "-f $(location :crtbegin_dynamic) " +
2962 "-f $(location :crtbegin_so) " +
2963 "-f $(location :crtbegin_static) " +
2964 "-f $(location :crtend_android) " +
2965 "-f $(location :crtend_so)",
2966 dist: {
2967 targets: ["bionic_sysroot_crt_objects"],
2968 },
2969 arch: {
2970 arm: {
2971 dist: {
2972 suffix: "_arm",
2973 },
2974 },
2975 arm64: {
2976 dist: {
2977 suffix: "_arm64",
2978 },
2979 },
2980 riscv64: {
2981 dist: {
2982 suffix: "_riscv64",
2983 },
2984 },
2985 x86: {
2986 dist: {
2987 suffix: "_x86",
2988 },
2989 },
2990 x86_64: {
2991 dist: {
2992 suffix: "_x86_64",
2993 },
2994 },
2995 },
2996}
Spandan Das8fce52a2023-09-28 18:00:12 +00002997
2998// headers that will be placed on the include path when running versioner in bazel
2999// this module should be a no-op in soong
3000filegroup {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00003001 name: "versioner-dependencies",
3002 srcs: ["versioner-dependencies/**/*"],
Spandan Das8fce52a2023-09-28 18:00:12 +00003003}