blob: 5afed1a4875db5087e889cb12cb00e827b53c3d2 [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",
Josh Gao10ec9282017-04-03 15:13:29 -0700819 "bionic/android_set_abort_message.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000820 "bionic/android_unsafe_frame_pointer_chase.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800821 "bionic/arpa_inet.cpp",
822 "bionic/assert.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000823 "bionic/atexit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800824 "bionic/atof.cpp",
825 "bionic/bionic_allocator.cpp",
826 "bionic/bionic_arc4random.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000827 "bionic/bionic_elf_tls.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800828 "bionic/bionic_futex.cpp",
829 "bionic/bionic_netlink.cpp",
830 "bionic/bionic_systrace.cpp",
831 "bionic/bionic_time_conversions.cpp",
832 "bionic/brk.cpp",
833 "bionic/c16rtomb.cpp",
834 "bionic/c32rtomb.cpp",
835 "bionic/chmod.cpp",
836 "bionic/chown.cpp",
837 "bionic/clearenv.cpp",
838 "bionic/clock.cpp",
839 "bionic/clock_getcpuclockid.cpp",
840 "bionic/clock_nanosleep.cpp",
841 "bionic/clone.cpp",
842 "bionic/ctype.cpp",
843 "bionic/dirent.cpp",
844 "bionic/dup.cpp",
845 "bionic/environ.cpp",
846 "bionic/error.cpp",
847 "bionic/eventfd.cpp",
848 "bionic/exec.cpp",
849 "bionic/execinfo.cpp",
850 "bionic/faccessat.cpp",
851 "bionic/fchmod.cpp",
852 "bionic/fchmodat.cpp",
853 "bionic/fcntl.cpp",
854 "bionic/fdsan.cpp",
855 "bionic/fdtrack.cpp",
856 "bionic/ffs.cpp",
857 "bionic/fgetxattr.cpp",
858 "bionic/flistxattr.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000859 "bionic/fork.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800860 "bionic/fpclassify.cpp",
861 "bionic/fsetxattr.cpp",
862 "bionic/ftruncate.cpp",
863 "bionic/ftw.cpp",
864 "bionic/futimens.cpp",
865 "bionic/getcwd.cpp",
866 "bionic/getdomainname.cpp",
867 "bionic/getentropy.cpp",
868 "bionic/gethostname.cpp",
869 "bionic/getloadavg.cpp",
870 "bionic/getpagesize.cpp",
871 "bionic/getpgrp.cpp",
872 "bionic/getpid.cpp",
873 "bionic/getpriority.cpp",
874 "bionic/gettid.cpp",
875 "bionic/get_device_api_level.cpp",
876 "bionic/grp_pwd.cpp",
877 "bionic/grp_pwd_file.cpp",
878 "bionic/heap_zero_init.cpp",
879 "bionic/iconv.cpp",
880 "bionic/icu_wrappers.cpp",
881 "bionic/ifaddrs.cpp",
882 "bionic/inotify_init.cpp",
883 "bionic/ioctl.cpp",
884 "bionic/killpg.cpp",
885 "bionic/langinfo.cpp",
886 "bionic/lchown.cpp",
887 "bionic/lfs64_support.cpp",
888 "bionic/libc_init_common.cpp",
889 "bionic/libgen.cpp",
890 "bionic/link.cpp",
891 "bionic/locale.cpp",
892 "bionic/lockf.cpp",
893 "bionic/lstat.cpp",
894 "bionic/mblen.cpp",
895 "bionic/mbrtoc16.cpp",
896 "bionic/mbrtoc32.cpp",
897 "bionic/mempcpy.cpp",
898 "bionic/memset_explicit.cpp",
899 "bionic/mkdir.cpp",
900 "bionic/mkfifo.cpp",
901 "bionic/mknod.cpp",
902 "bionic/mntent.cpp",
903 "bionic/mremap.cpp",
904 "bionic/net_if.cpp",
905 "bionic/netdb.cpp",
906 "bionic/netinet_in.cpp",
907 "bionic/nl_types.cpp",
908 "bionic/open.cpp",
909 "bionic/pathconf.cpp",
910 "bionic/pause.cpp",
911 "bionic/pidfd.cpp",
912 "bionic/pipe.cpp",
913 "bionic/poll.cpp",
914 "bionic/posix_fadvise.cpp",
915 "bionic/posix_fallocate.cpp",
916 "bionic/posix_madvise.cpp",
917 "bionic/posix_timers.cpp",
918 "bionic/preadv_pwritev.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000919 "bionic/pthread_atfork.cpp",
920 "bionic/pthread_attr.cpp",
921 "bionic/pthread_barrier.cpp",
922 "bionic/pthread_cond.cpp",
923 "bionic/pthread_create.cpp",
924 "bionic/pthread_detach.cpp",
925 "bionic/pthread_equal.cpp",
926 "bionic/pthread_exit.cpp",
927 "bionic/pthread_getcpuclockid.cpp",
928 "bionic/pthread_getschedparam.cpp",
929 "bionic/pthread_gettid_np.cpp",
930 "bionic/pthread_internal.cpp",
931 "bionic/pthread_join.cpp",
932 "bionic/pthread_key.cpp",
933 "bionic/pthread_kill.cpp",
934 "bionic/pthread_mutex.cpp",
935 "bionic/pthread_once.cpp",
936 "bionic/pthread_rwlock.cpp",
937 "bionic/pthread_sigqueue.cpp",
938 "bionic/pthread_self.cpp",
939 "bionic/pthread_setname_np.cpp",
940 "bionic/pthread_setschedparam.cpp",
941 "bionic/pthread_spinlock.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800942 "bionic/ptrace.cpp",
943 "bionic/pty.cpp",
944 "bionic/raise.cpp",
945 "bionic/rand.cpp",
946 "bionic/readlink.cpp",
947 "bionic/realpath.cpp",
948 "bionic/reboot.cpp",
949 "bionic/recv.cpp",
950 "bionic/recvmsg.cpp",
951 "bionic/rename.cpp",
952 "bionic/rmdir.cpp",
953 "bionic/scandir.cpp",
954 "bionic/sched_getaffinity.cpp",
955 "bionic/sched_getcpu.cpp",
956 "bionic/semaphore.cpp",
957 "bionic/send.cpp",
958 "bionic/setegid.cpp",
959 "bionic/seteuid.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000960 "bionic/setjmp_cookie.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800961 "bionic/setpgrp.cpp",
962 "bionic/sigaction.cpp",
963 "bionic/signal.cpp",
964 "bionic/sigprocmask.cpp",
965 "bionic/sleep.cpp",
966 "bionic/socketpair.cpp",
967 "bionic/spawn.cpp",
968 "bionic/stat.cpp",
969 "bionic/stdlib_l.cpp",
970 "bionic/strerror.cpp",
971 "bionic/string_l.cpp",
972 "bionic/strings_l.cpp",
973 "bionic/strsignal.cpp",
974 "bionic/strtol.cpp",
975 "bionic/strtold.cpp",
976 "bionic/swab.cpp",
977 "bionic/symlink.cpp",
978 "bionic/sync_file_range.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000979 "bionic/sysconf.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800980 "bionic/sys_epoll.cpp",
981 "bionic/sys_msg.cpp",
982 "bionic/sys_sem.cpp",
983 "bionic/sys_shm.cpp",
984 "bionic/sys_signalfd.cpp",
985 "bionic/sys_statfs.cpp",
986 "bionic/sys_statvfs.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000987 "bionic/sys_thread_properties.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800988 "bionic/sys_time.cpp",
989 "bionic/sysinfo.cpp",
990 "bionic/syslog.cpp",
991 "bionic/system.cpp",
992 "bionic/system_property_api.cpp",
993 "bionic/system_property_set.cpp",
994 "bionic/tdestroy.cpp",
995 "bionic/termios.cpp",
996 "bionic/thread_private.cpp",
997 "bionic/threads.cpp",
998 "bionic/time.cpp",
999 "bionic/time_l.cpp",
1000 "bionic/tmpfile.cpp",
1001 "bionic/umount.cpp",
1002 "bionic/unlink.cpp",
1003 "bionic/usleep.cpp",
1004 "bionic/utmp.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001005 "bionic/vdso.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001006 "bionic/wait.cpp",
1007 "bionic/wchar.cpp",
1008 "bionic/wchar_l.cpp",
1009 "bionic/wcstod.cpp",
1010 "bionic/wctype.cpp",
1011 "bionic/wcwidth.cpp",
1012 "bionic/wmempcpy.cpp",
1013
1014 // TODO: why isn't this in a static-libc-only module?
1015 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1016 // which will be overridden by the actual one in libc.so.
1017 "bionic/icu_static.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001018 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001019
1020 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001021 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -07001022 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001023 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -08001024 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001025 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001026 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001027 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001028 "arch-arm/bionic/atomics_arm.c",
1029 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -08001030 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001031 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001032 "arch-arm/bionic/setjmp.S",
1033 "arch-arm/bionic/syscall.S",
1034 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001035
Haibo Huangea9957a2018-11-19 11:00:32 -08001036 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001037 "arch-arm/cortex-a7/bionic/memset.S",
1038
1039 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001040 "arch-arm/cortex-a9/bionic/memset.S",
1041 "arch-arm/cortex-a9/bionic/stpcpy.S",
1042 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001043 "arch-arm/cortex-a9/bionic/strcpy.S",
1044 "arch-arm/cortex-a9/bionic/strlen.S",
1045
Elliott Hughesaefe9992023-11-08 12:04:41 -08001046 "arch-arm/cortex-a15/bionic/memcpy.S",
1047 "arch-arm/cortex-a15/bionic/memmove.S",
1048 "arch-arm/cortex-a15/bionic/memset.S",
1049 "arch-arm/cortex-a15/bionic/stpcpy.S",
1050 "arch-arm/cortex-a15/bionic/strcat.S",
1051 "arch-arm/cortex-a15/bionic/strcmp.S",
1052 "arch-arm/cortex-a15/bionic/strcpy.S",
1053 "arch-arm/cortex-a15/bionic/strlen.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001054
1055 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001056
Haibo Huang01bfd892018-12-03 15:05:16 -08001057 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001058
Elliott Hughesaefe9992023-11-08 12:04:41 -08001059 "arch-arm/generic/bionic/memcmp.S",
1060 "arch-arm/generic/bionic/memmove.S",
1061 "arch-arm/generic/bionic/memset.S",
1062 "arch-arm/generic/bionic/stpcpy.c",
1063 "arch-arm/generic/bionic/strcat.c",
1064 "arch-arm/generic/bionic/strcmp.S",
1065 "arch-arm/generic/bionic/strcpy.S",
1066 "arch-arm/generic/bionic/strlen.c",
1067
1068 "arch-arm/krait/bionic/memcpy.S",
1069 "arch-arm/krait/bionic/memset.S",
1070
Haibo Huangea9957a2018-11-19 11:00:32 -08001071 "arch-arm/kryo/bionic/memcpy.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001072
1073 "bionic/strchr.cpp",
1074 "bionic/strchrnul.cpp",
1075 "bionic/strnlen.cpp",
1076 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001077 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001078 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001079 arm64: {
1080 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001081 "arch-arm64/bionic/__bionic_clone.S",
1082 "arch-arm64/bionic/_exit_with_stack_teardown.S",
1083 "arch-arm64/bionic/setjmp.S",
1084 "arch-arm64/bionic/syscall.S",
1085 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001086 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001087 },
1088
Elliott Hughesebc19a92022-10-14 23:25:36 +00001089 riscv64: {
1090 srcs: [
1091 "arch-riscv64/bionic/__bionic_clone.S",
1092 "arch-riscv64/bionic/_exit_with_stack_teardown.S",
Elliott Hughese1905ed2022-10-17 23:23:36 +00001093 "arch-riscv64/bionic/setjmp.S",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001094 "arch-riscv64/bionic/syscall.S",
1095 "arch-riscv64/bionic/vfork.S",
Yun Hsiang40a82d02023-05-26 10:10:40 +08001096
Elliott Hughesaefe9992023-11-08 12:04:41 -08001097 "arch-riscv64/string/memchr_v.S",
1098 "arch-riscv64/string/memcmp_v.S",
1099 "arch-riscv64/string/memcpy_v.S",
1100 "arch-riscv64/string/memmove_v.S",
1101 "arch-riscv64/string/memset_v.S",
1102 "arch-riscv64/string/stpcpy_v.S",
1103 "arch-riscv64/string/strcat_v.S",
1104 "arch-riscv64/string/strchr_v.S",
1105 "arch-riscv64/string/strcmp_v.S",
1106 "arch-riscv64/string/strcpy_v.S",
1107 "arch-riscv64/string/strlen_v.S",
1108 "arch-riscv64/string/strncat_v.S",
1109 "arch-riscv64/string/strncmp_v.S",
1110 "arch-riscv64/string/strncpy_v.S",
1111 "arch-riscv64/string/strnlen_v.S",
1112
1113 "arch-riscv64/string/memchr.c",
1114 "arch-riscv64/string/memcmp.c",
1115 "arch-riscv64/string/memcpy.c",
1116 "arch-riscv64/string/memmove.c",
1117 "arch-riscv64/string/memset.c",
1118 "arch-riscv64/string/stpcpy.c",
1119 "arch-riscv64/string/strcat.c",
1120 "arch-riscv64/string/strchr.c",
1121 "arch-riscv64/string/strcmp.c",
1122 "arch-riscv64/string/strcpy.c",
1123 "arch-riscv64/string/strlen.c",
1124 "arch-riscv64/string/strncat.c",
1125 "arch-riscv64/string/strncmp.c",
1126 "arch-riscv64/string/strncpy.c",
1127 "arch-riscv64/string/strnlen.c",
Prashanth Swaminathana4d71022023-10-30 17:35:19 -07001128
Elliott Hughes7d136662023-10-27 15:40:32 -07001129 "bionic/strchrnul.cpp",
1130 "bionic/strrchr.cpp",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001131 ],
1132 },
1133
Dan Willemsen208ae172015-09-16 16:33:27 -07001134 x86: {
1135 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001136 "arch-x86/bionic/__bionic_clone.S",
1137 "arch-x86/bionic/_exit_with_stack_teardown.S",
1138 "arch-x86/bionic/libcrt_compat.c",
Elliott Hughes7d136662023-10-27 15:40:32 -07001139 "arch-x86/bionic/setjmp.S",
1140 "arch-x86/bionic/syscall.S",
1141 "arch-x86/bionic/vfork.S",
1142 "arch-x86/bionic/__x86.get_pc_thunk.S",
1143
Dan Willemsen208ae172015-09-16 16:33:27 -07001144 "arch-x86/generic/string/memcmp.S",
1145 "arch-x86/generic/string/strcmp.S",
1146 "arch-x86/generic/string/strncmp.S",
1147 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001148
1149 "arch-x86/generic/string/strlcat.c",
1150 "arch-x86/generic/string/strlcpy.c",
1151 "arch-x86/generic/string/strncat.c",
1152 "arch-x86/generic/string/wcscat.c",
1153 "arch-x86/generic/string/wcscpy.c",
1154 "arch-x86/generic/string/wmemcmp.c",
1155
Elliott Hughesed777142022-07-25 16:25:11 +00001156 "arch-x86/string/sse2-memchr-atom.S",
1157 "arch-x86/string/sse2-memmove-slm.S",
1158 "arch-x86/string/sse2-memrchr-atom.S",
1159 "arch-x86/string/sse2-memset-atom.S",
1160 "arch-x86/string/sse2-memset-slm.S",
1161 "arch-x86/string/sse2-stpcpy-slm.S",
1162 "arch-x86/string/sse2-stpncpy-slm.S",
1163 "arch-x86/string/sse2-strchr-atom.S",
1164 "arch-x86/string/sse2-strcpy-slm.S",
1165 "arch-x86/string/sse2-strlen-slm.S",
1166 "arch-x86/string/sse2-strncpy-slm.S",
1167 "arch-x86/string/sse2-strnlen-atom.S",
1168 "arch-x86/string/sse2-strrchr-atom.S",
1169 "arch-x86/string/sse2-wcschr-atom.S",
1170 "arch-x86/string/sse2-wcsrchr-atom.S",
1171 "arch-x86/string/sse2-wcslen-atom.S",
1172 "arch-x86/string/sse2-wcscmp-atom.S",
1173 "arch-x86/string/sse2-strlen-atom.S",
1174
1175 "arch-x86/string/ssse3-memcmp-atom.S",
1176 "arch-x86/string/ssse3-memmove-atom.S",
1177 "arch-x86/string/ssse3-strcat-atom.S",
1178 "arch-x86/string/ssse3-strcmp-atom.S",
1179 "arch-x86/string/ssse3-strcpy-atom.S",
1180 "arch-x86/string/ssse3-strlcat-atom.S",
1181 "arch-x86/string/ssse3-strlcpy-atom.S",
1182 "arch-x86/string/ssse3-strncat-atom.S",
1183 "arch-x86/string/ssse3-strncmp-atom.S",
1184 "arch-x86/string/ssse3-strncpy-atom.S",
1185 "arch-x86/string/ssse3-wcscat-atom.S",
1186 "arch-x86/string/ssse3-wcscpy-atom.S",
1187 "arch-x86/string/ssse3-wmemcmp-atom.S",
1188
1189 "arch-x86/string/sse4-memcmp-slm.S",
1190 "arch-x86/string/sse4-wmemcmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001191
1192 "bionic/strchrnul.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001193 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001194 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001195 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001196 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001197 "arch-x86_64/bionic/__bionic_clone.S",
1198 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1199 "arch-x86_64/bionic/__restore_rt.S",
1200 "arch-x86_64/bionic/setjmp.S",
1201 "arch-x86_64/bionic/syscall.S",
1202 "arch-x86_64/bionic/vfork.S",
1203
ahs919fb7f2022-06-10 07:11:14 +05301204 "arch-x86_64/string/avx2-memset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001205 "arch-x86_64/string/sse2-memmove-slm.S",
1206 "arch-x86_64/string/sse2-memset-slm.S",
1207 "arch-x86_64/string/sse2-stpcpy-slm.S",
1208 "arch-x86_64/string/sse2-stpncpy-slm.S",
1209 "arch-x86_64/string/sse2-strcat-slm.S",
1210 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001211 "arch-x86_64/string/sse2-strlen-slm.S",
1212 "arch-x86_64/string/sse2-strncat-slm.S",
1213 "arch-x86_64/string/sse2-strncpy-slm.S",
1214 "arch-x86_64/string/sse4-memcmp-slm.S",
1215 "arch-x86_64/string/ssse3-strcmp-slm.S",
1216 "arch-x86_64/string/ssse3-strncmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001217
1218 "bionic/strchr.cpp",
1219 "bionic/strchrnul.cpp",
1220 "bionic/strnlen.cpp",
1221 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001222 ],
1223 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001224 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001225
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001226 // TODO: move to libc/bionic/legacy_32_bit_support.cpp or #if __LP64__ instead.
1227 multilib: {
1228 lib32: {
1229 srcs: ["bionic/mmap.cpp"],
1230 },
1231 },
1232
1233 local_include_dirs: ["stdio"],
1234 generated_headers: ["generated_android_ids"],
1235
1236 whole_static_libs: [
1237 "libsystemproperties",
1238 ],
1239
Colin Cross50c21ab2015-10-31 23:03:05 -07001240 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001241 include_dirs: ["bionic/libstdc++/include"],
1242 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001243}
1244
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001245genrule {
1246 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001247 out: ["generated_android_ids.h"],
1248 srcs: [":android_filesystem_config_header"],
Cole Faustb1a0a9d2023-11-28 17:51:16 -08001249 tools: ["fs_config_generator"],
1250 cmd: "$(location fs_config_generator) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001251}
1252
Dan Willemsen268a6732015-10-15 14:49:45 -07001253// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001254// libc_syscalls.a
1255// ========================================================
1256
Elliott Hughes782c4852019-04-16 12:31:00 -07001257genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001258 name: "syscalls-arm",
Elliott Hughes782c4852019-04-16 12:31:00 -07001259 out: ["syscalls-arm.S"],
1260 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001261 tools: ["gensyscalls"],
1262 cmd: "$(location gensyscalls) arm $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001263}
1264
1265genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001266 name: "syscalls-arm64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001267 out: ["syscalls-arm64.S"],
1268 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001269 tools: ["gensyscalls"],
1270 cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001271}
1272
1273genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001274 name: "syscalls-riscv64",
Elliott Hughes704772b2022-10-10 17:06:43 +00001275 out: ["syscalls-riscv64.S"],
1276 srcs: ["SYSCALLS.TXT"],
1277 tools: ["gensyscalls"],
1278 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
1279}
1280
1281genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001282 name: "syscalls-x86",
Elliott Hughes782c4852019-04-16 12:31:00 -07001283 out: ["syscalls-x86.S"],
1284 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001285 tools: ["gensyscalls"],
1286 cmd: "$(location gensyscalls) x86 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001287}
1288
1289genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001290 name: "syscalls-x86_64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001291 out: ["syscalls-x86_64.S"],
1292 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001293 tools: ["gensyscalls"],
1294 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001295}
1296
Dan Willemsen208ae172015-09-16 16:33:27 -07001297cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001298 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001299 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001300 arch: {
1301 arm: {
Cole Faustf5968d82023-04-11 15:20:19 -07001302 srcs: [":syscalls-arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001303 },
1304 arm64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001305 srcs: [":syscalls-arm64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001306 },
Elliott Hughes704772b2022-10-10 17:06:43 +00001307 riscv64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001308 srcs: [":syscalls-riscv64"],
Elliott Hughes704772b2022-10-10 17:06:43 +00001309 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001310 x86: {
Cole Faustf5968d82023-04-11 15:20:19 -07001311 srcs: [":syscalls-x86"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001312 },
1313 x86_64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001314 srcs: [":syscalls-x86_64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001315 },
1316 },
1317 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001318}
1319
1320// ========================================================
1321// libc_aeabi.a
1322// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1323// to avoid infinite recursion. For the other architectures we just build an
1324// empty library to keep this makefile simple.
1325// ========================================================
1326
1327cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001328 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001329 arch: {
1330 arm: {
1331 srcs: ["arch-arm/bionic/__aeabi.c"],
1332 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001333 },
1334 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001335 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001336}
1337
1338// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001339// libc_common.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001340// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001341
Dan Willemsen208ae172015-09-16 16:33:27 -07001342cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001343 defaults: ["libc_defaults"],
Elliott Hughesb0948922024-01-26 00:28:12 +00001344 name: "libc_common",
1345
Dan Willemsen208ae172015-09-16 16:33:27 -07001346 srcs: libc_common_src_files,
1347 multilib: {
1348 lib32: {
1349 srcs: libc_common_src_files_32,
1350 },
1351 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001352
1353 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001354 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001355 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001356 "libc_bionic",
Ryan Prichard249757b2019-11-01 17:18:28 -07001357 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001358 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001359 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001360 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001361 "libc_freebsd_large_stack",
Elliott Hughesc2043342023-07-20 20:24:09 +00001362 "libc_freebsd_ldexp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001363 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001364 "libc_netbsd",
1365 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001366 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001367 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001368 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001369 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001370 ],
1371
1372 arch: {
1373 arm: {
1374 whole_static_libs: ["libc_aeabi"],
1375 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001376 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001377}
1378
1379// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001380// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001381// ========================================================
1382cc_library_static {
1383 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001384 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001385
Haibo Huangb9244ff2018-08-11 10:12:13 -07001386 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301387 x86_64: {
1388 srcs: ["arch-x86_64/static_function_dispatch.S"],
1389 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001390 x86: {
1391 srcs: ["arch-x86/static_function_dispatch.S"],
1392 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001393 arm: {
1394 srcs: ["arch-arm/static_function_dispatch.S"],
1395 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001396 arm64: {
1397 srcs: ["arch-arm64/static_function_dispatch.S"],
1398 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001399 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001400 srcs: ["arch-riscv64/static_function_dispatch.S"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001401 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001402 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001403}
1404
1405// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001406// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001407// ========================================================
1408cc_library_static {
1409 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001410 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001411
Haibo Huangb9244ff2018-08-11 10:12:13 -07001412 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001413 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001414 "-fno-stack-protector",
1415 "-fno-jump-tables",
1416 ],
1417 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301418 x86_64: {
1419 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
1420 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001421 x86: {
1422 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1423 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001424 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001425 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001426 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001427 arm64: {
1428 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1429 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001430 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001431 srcs: ["arch-riscv64/dynamic_function_dispatch.cpp"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001432 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001433 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001434}
1435
1436// ========================================================
1437// libc_common_static.a For static binaries.
1438// ========================================================
1439cc_library_static {
1440 defaults: ["libc_defaults"],
1441 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001442
Haibo Huangf71edfa2018-11-12 10:06:56 -08001443 whole_static_libs: [
1444 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001445 "libc_static_dispatch",
1446 ],
1447}
1448
1449// ========================================================
1450// libc_common_shared.a For shared libraries.
1451// ========================================================
1452cc_library_static {
1453 defaults: ["libc_defaults"],
1454 name: "libc_common_shared",
1455
1456 whole_static_libs: [
1457 "libc_common",
1458 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001459 ],
1460}
1461
Ryan Prichard22a6a052019-10-10 23:59:30 -07001462// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1463// executable.
1464cc_library_static {
1465 name: "libc_unwind_static",
1466 defaults: ["libc_defaults"],
1467 cflags: ["-DLIBC_STATIC"],
1468
1469 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1470 arch: {
1471 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1472 arm: {
1473 srcs: ["arch-arm/bionic/exidx_static.c"],
1474 },
1475 },
1476}
1477
Haibo Huangf71edfa2018-11-12 10:06:56 -08001478// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001479// libc_nomalloc.a
1480// ========================================================
1481//
Ryan Prichard249757b2019-11-01 17:18:28 -07001482// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1483// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1484// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001485
1486cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001487 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001488 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001489
Colin Crossa3f9fca2016-01-11 13:20:55 -08001490 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001491 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001492 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001493 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001494 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001495}
1496
dimitryc0c0ef62018-12-05 16:33:52 +01001497filegroup {
1498 name: "libc_sources_shared",
1499 srcs: [
1500 "arch-common/bionic/crtbegin_so.c",
1501 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001502 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001503 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001504 "bionic/icu.cpp",
1505 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001506 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001507 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001508 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001509 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001510 "bionic/ndk_cruft.cpp",
1511 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001512 "bionic/NetdClient.cpp",
1513 "arch-common/bionic/crtend_so.S",
1514 ],
1515}
1516
1517filegroup {
1518 name: "libc_sources_static",
1519 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001520 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001521 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001522 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001523 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001524 ],
1525}
1526
1527filegroup {
1528 name: "libc_sources_shared_arm",
1529 srcs: [
1530 "arch-arm/bionic/exidx_dynamic.c",
1531 "arch-arm/bionic/atexit_legacy.c",
1532 ],
1533}
1534
Dan Willemsen208ae172015-09-16 16:33:27 -07001535// ========================================================
1536// libc.a + libc.so
1537// ========================================================
Florian Mayerc10d0642023-03-22 16:12:49 -07001538cc_defaults {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001539 defaults: [
1540 "libc_defaults",
1541 "libc_native_allocator_defaults",
1542 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001543 name: "libc_library_defaults",
Colin Cross50c21ab2015-10-31 23:03:05 -07001544 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001545 platform_sdk_version: {
1546 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1547 },
1548 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001549 static: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001550 srcs: [":libc_sources_static"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001551 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001552 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001553 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001554 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001555 "libc_init_static",
1556 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001557 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001558 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001559 },
1560 shared: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001561 srcs: [":libc_sources_shared"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001562 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001563 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001564 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001565 "libc_init_dynamic",
1566 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001567 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001568 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001569 },
1570
Neil Fullera7db90f2019-04-25 09:28:27 +01001571 required: [
MarkDacekd88d7ea2022-06-28 20:14:58 +00001572 "tzdata_prebuilt",
1573 "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
Neil Fullera7db90f2019-04-25 09:28:27 +01001574 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001575
Colin Cross4ce94d22016-11-15 13:15:43 -08001576 // Do not pack libc.so relocations; see http://b/20645321 for details.
1577 pack_relocations: false,
1578
dimitry06016f22018-01-05 11:39:28 +01001579 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1580 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1581 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1582 // those new libraries from libgcc.a are not declared external; if that were the case,
1583 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1584 // on the external symbols from the dependent libraries. That would create a "cloaked"
1585 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001586
dimitry06016f22018-01-05 11:39:28 +01001587 shared_libs: [
1588 "ld-android",
1589 "libdl",
1590 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001591 static_libs: [
1592 "libdl_android",
1593 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001594
1595 nocrt: true,
1596
Dan Willemsen208ae172015-09-16 16:33:27 -07001597 arch: {
1598 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001599 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001600 pack_relocations: false,
Christopher Ferris9d03a162023-11-10 11:19:11 -08001601 ldflags: [
1602 "-Wl,--hash-style=both",
1603 // Since we are preserving the debug_frame, do not compress
1604 // in this case to make unwinds as fast as possible.
1605 "-Wl,--compress-debug-sections=none",
1606 ],
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001607
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001608 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001609 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001610
Dan Willemsen208ae172015-09-16 16:33:27 -07001611 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001612 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001613 // special for arm
1614 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001615 // For backwards-compatibility, some arm32 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001616 static_libs: ["libclang_rt.builtins-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001617 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001618
1619 // Arm 32 bit does not produce complete exidx unwind information
1620 // so keep the .debug_frame which is relatively small and does
1621 // include needed unwind information.
1622 // See b/132992102 for details.
1623 strip: {
1624 keep_symbols_and_debug_frame: true,
1625 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001626 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001627 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001628 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001629
1630 // Leave the symbols in the shared library so that stack unwinders can produce
1631 // meaningful name resolution.
1632 strip: {
1633 keep_symbols: true,
1634 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001635 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001636 riscv64: {
1637 version_script: ":libc.riscv64.map",
1638
1639 // Leave the symbols in the shared library so that stack unwinders can produce
1640 // meaningful name resolution.
1641 strip: {
1642 keep_symbols: true,
1643 },
1644 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001645 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001646 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001647 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001648 ldflags: ["-Wl,--hash-style=both"],
1649
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001650 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001651 no_libcrt: true,
1652
1653 shared: {
1654 // For backwards-compatibility, some x86 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001655 static_libs: ["libclang_rt.builtins-exported"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001656 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001657
1658 // Leave the symbols in the shared library so that stack unwinders can produce
1659 // meaningful name resolution.
1660 strip: {
1661 keep_symbols: true,
1662 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001663 },
1664 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001665 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001666
1667 // Leave the symbols in the shared library so that stack unwinders can produce
1668 // meaningful name resolution.
1669 strip: {
1670 keep_symbols: true,
1671 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001672 },
1673 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001674
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001675 apex_available: [
1676 "//apex_available:platform",
1677 "com.android.runtime",
1678 ],
1679
Colin Cross7edd0082021-10-28 13:20:35 -07001680 target: {
1681 native_bridge: {
1682 shared: {
1683 installable: false,
1684 },
1685 },
1686 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001687}
1688
Florian Mayerc10d0642023-03-22 16:12:49 -07001689cc_library {
1690 name: "libc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001691 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001692 "libc_library_defaults",
1693 ],
1694 stubs: {
1695 symbol_file: "libc.map.txt",
1696 versions: [
1697 "29",
1698 "R",
1699 "current",
1700 ],
1701 },
1702 static_ndk_lib: true,
1703 llndk: {
1704 symbol_file: "libc.map.txt",
1705 export_headers_as_system: true,
1706 export_preprocessed_headers: ["include"],
1707 export_llndk_headers: ["libc_llndk_headers"],
1708 },
1709}
1710
1711cc_library {
1712 name: "libc_hwasan",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001713 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001714 "libc_library_defaults",
1715 ],
1716 sanitize: {
1717 hwaddress: true,
1718 },
1719 enabled: false,
Florian Mayerff116ed2023-04-14 17:38:53 -07001720 target: {
1721 android_arm64: {
Florian Mayerc10d0642023-03-22 16:12:49 -07001722 enabled: true,
1723 },
1724 },
1725 stem: "libc",
1726 relative_install_path: "hwasan",
1727 // We don't really need the stubs, but this needs to stay to trigger the
1728 // symlink logic in soong.
1729 stubs: {
1730 symbol_file: "libc.map.txt",
1731 },
1732 native_bridge_supported: false,
1733 // It is never correct to depend on this directly. This is only
1734 // needed for the runtime apex, and in base_system.mk.
1735 visibility: ["//bionic/apex"],
1736}
1737
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001738genrule {
1739 name: "libc.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001740 out: ["libc.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001741 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001742 tools: ["generate-version-script"],
1743 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001744}
1745
1746genrule {
1747 name: "libc.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001748 out: ["libc.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001749 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001750 tools: ["generate-version-script"],
1751 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001752}
1753
1754genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001755 name: "libc.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001756 out: ["libc.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001757 srcs: ["libc.map.txt"],
1758 tools: ["generate-version-script"],
1759 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1760}
1761
1762genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001763 name: "libc.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001764 out: ["libc.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001765 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001766 tools: ["generate-version-script"],
1767 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001768}
1769
1770genrule {
1771 name: "libc.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001772 out: ["libc.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001773 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001774 tools: ["generate-version-script"],
1775 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001776}
1777
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001778// Headers that only other parts of the platform can include.
1779cc_library_headers {
1780 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001781 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001782 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001783 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001784 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001785 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001786 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001787 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001788 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001789 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001790 "//system/core/debuggerd:__subpackages__",
Florian Mayerf5d70ce2022-09-13 13:58:30 -07001791 "//system/core/init:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001792 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001793 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001794 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001795 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001796 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001797 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001798 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001799 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001800 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001801 recovery_available: true,
1802 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001803 export_include_dirs: [
1804 "platform",
1805 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001806 system_shared_libs: [],
1807 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001808 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001809
Steven Moreland0cdf1322020-10-05 21:55:26 +00001810 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001811 apex_available: [
1812 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001813 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001814 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001815}
1816
Logan Chien17af91b2019-01-15 21:19:56 +08001817cc_library_headers {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001818 name: "libc_llndk_headers",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001819 visibility: [
1820 "//external/musl",
1821 ],
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001822 llndk: {
1823 llndk_headers: true,
1824 },
Logan Chien17af91b2019-01-15 21:19:56 +08001825 host_supported: true,
1826 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001827 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001828 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001829 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001830 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001831 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001832 apex_available: [
1833 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001834 "//apex_available:anyapex",
1835 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001836 // used by most APEXes indirectly via libunwind_llvm
1837 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001838
1839 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001840 stl: "none",
1841 system_shared_libs: [],
1842
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001843 // The build system generally requires that any dependencies of a target
1844 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1845 // to 1 we let targets with an sdk_version that need to depend on the libc
1846 // headers but cannot depend on libc itself due to circular dependencies
1847 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1848 // is correct because the headers can support any sdk_version.
1849 sdk_version: "1",
1850
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001851 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001852 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001853 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001854 "kernel/android/uapi",
1855 ],
1856
1857 arch: {
1858 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001859 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001860 },
1861 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001862 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001863 },
Elliott Hughes48e53332022-10-07 20:39:25 +00001864 riscv64: {
1865 export_system_include_dirs: ["kernel/uapi/asm-riscv"],
1866 },
Logan Chien17af91b2019-01-15 21:19:56 +08001867 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001868 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001869 },
1870 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001871 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001872 },
1873 },
1874}
1875
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001876cc_library_headers {
1877 name: "libc_headers",
1878 host_supported: true,
1879 native_bridge_supported: true,
1880 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001881 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001882 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001883 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001884 recovery_available: true,
1885 sdk_version: "1",
1886
1887 apex_available: [
1888 "//apex_available:platform",
1889 "//apex_available:anyapex",
1890 ],
1891 // used by most APEXes indirectly via libunwind_llvm
1892 min_sdk_version: "apex_inherit",
1893 visibility: [
1894 "//bionic:__subpackages__", // visible to bionic
1895 // ... and only to these places (b/152668052)
1896 "//external/arm-optimized-routines",
1897 "//external/gwp_asan",
1898 "//external/jemalloc_new",
1899 "//external/libunwind_llvm",
1900 "//external/scudo",
1901 "//system/core/property_service/libpropertyinfoparser",
1902 "//system/extras/toolchain-extras",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001903 ],
1904
1905 stl: "none",
1906 no_libcrt: true,
1907 system_shared_libs: [],
1908
1909 target: {
1910 android: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001911 export_system_include_dirs: ["include"],
1912 header_libs: ["libc_llndk_headers"],
1913 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001914 },
1915 linux_bionic: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001916 export_system_include_dirs: ["include"],
1917 header_libs: ["libc_llndk_headers"],
1918 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001919 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001920 },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001921}
1922
Dan Willemsen208ae172015-09-16 16:33:27 -07001923// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001924// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001925// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001926
Dan Willemsen208ae172015-09-16 16:33:27 -07001927cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001928 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001929 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001930 srcs: [
1931 "bionic/__cxa_guard.cpp",
1932 "bionic/__cxa_pure_virtual.cpp",
1933 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001934 ],
1935 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001936 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001937 static_libs: ["libasync_safe"],
Elliott Hughesc2043342023-07-20 20:24:09 +00001938 apex_available: [
1939 "//apex_available:platform",
1940 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001941
Dan Willemsen6b3be172018-12-03 13:57:20 -08001942 static: {
1943 system_shared_libs: [],
1944 },
Colin Crossb5bfe0b2021-07-13 16:26:28 -07001945 target: {
1946 bionic: {
1947 shared: {
1948 system_shared_libs: ["libc"],
1949 },
1950 },
Dan Willemsen6b3be172018-12-03 13:57:20 -08001951 },
1952
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001953 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001954 arch: {
1955 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001956 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001957 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001958 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001959 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001960 },
1961 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001962 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001963 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001964 riscv64: {
1965 version_script: ":libstdc++.riscv64.map",
1966 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001967 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001968 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001969 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001970 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001971 },
1972 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001973 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001974 },
1975 },
1976}
1977
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001978genrule {
1979 name: "libstdc++.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001980 out: ["libstdc++.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001981 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001982 tools: ["generate-version-script"],
1983 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001984}
1985
1986genrule {
1987 name: "libstdc++.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001988 out: ["libstdc++.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001989 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001990 tools: ["generate-version-script"],
1991 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001992}
1993
1994genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001995 name: "libstdc++.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001996 out: ["libstdc++.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001997 srcs: ["libstdc++.map.txt"],
1998 tools: ["generate-version-script"],
1999 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
2000}
2001
2002genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002003 name: "libstdc++.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002004 out: ["libstdc++.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002005 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002006 tools: ["generate-version-script"],
2007 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002008}
2009
2010genrule {
2011 name: "libstdc++.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002012 out: ["libstdc++.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002013 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002014 tools: ["generate-version-script"],
2015 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002016}
2017
2018// ========================================================
2019// crt object files.
2020// ========================================================
2021
Colin Cross50c21ab2015-10-31 23:03:05 -07002022cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002023 name: "crt_and_memtag_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002024 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002025 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002026 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002027 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002028 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002029 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002030 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002031 apex_available: [
2032 "//apex_available:platform",
2033 "//apex_available:anyapex",
2034 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002035 // Generate NDK variants of the CRT objects for every supported API level.
2036 min_sdk_version: "16",
2037 stl: "none",
2038 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002039 cflags: [
2040 "-Wno-gcc-compat",
2041 "-Wall",
2042 "-Werror",
2043 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002044 sanitize: {
2045 never: true,
2046 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002047}
2048
Colin Cross50c21ab2015-10-31 23:03:05 -07002049cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002050 name: "crt_defaults",
2051 defaults: ["crt_and_memtag_defaults"],
Colin Cross02f81372021-07-22 12:02:10 -07002052 system_shared_libs: [],
Colin Cross10d92682021-06-22 13:25:46 -07002053}
2054
2055cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002056 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002057 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002058
2059 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002060 x86: {
2061 cflags: ["-fPIC"],
2062 },
2063 x86_64: {
2064 cflags: ["-fPIC"],
2065 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002066 },
Colin Crossab179442018-09-27 11:03:22 -07002067 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002068}
2069
Dan Willemsen208ae172015-09-16 16:33:27 -07002070cc_object {
2071 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002072 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002073 local_include_dirs: [
2074 "include",
2075 "private", // crtbrand.S depends on private/bionic_asm_note.h
2076 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002077 product_variables: {
2078 platform_sdk_version: {
2079 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2080 },
2081 },
2082 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002083
Colin Cross7d7b3682017-11-03 13:38:40 -07002084 defaults: ["crt_so_defaults"],
Dan Alberteee46dc2023-04-04 23:27:52 +00002085 // crtbrand is an intermediate artifact, not a final CRT object.
2086 exclude_from_ndk_sysroot: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07002087}
2088
Dan Willemsen208ae172015-09-16 16:33:27 -07002089cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002090 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002091 local_include_dirs: ["include"],
2092 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002093
Colin Cross7d7b3682017-11-03 13:38:40 -07002094 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002095 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002096 "crtbrand",
2097 ],
2098}
2099
Dan Willemsen208ae172015-09-16 16:33:27 -07002100cc_object {
2101 name: "crtend_so",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002102 local_include_dirs: [
2103 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002104 "private", // crtend_so.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002105 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002106 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002107
Colin Cross7d7b3682017-11-03 13:38:40 -07002108 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002109}
2110
Dan Willemsen208ae172015-09-16 16:33:27 -07002111cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002112 name: "crtbegin_static",
2113
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002114 local_include_dirs: [
2115 "include",
2116 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2117 ],
Liz Kammere718dd72021-03-09 15:00:06 -05002118
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002119 cflags: ["-DCRTBEGIN_STATIC"],
Yabin Cui744cfd32023-08-24 13:20:23 -07002120
Dan Willemsen208ae172015-09-16 16:33:27 -07002121 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002122 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002123 "crtbrand",
2124 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002125 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002126 // When using libc.a, we're using the latest library regardless of target API level.
2127 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002128}
2129
Dan Willemsen208ae172015-09-16 16:33:27 -07002130cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002131 name: "crtbegin_dynamic",
2132
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002133 local_include_dirs: [
2134 "include",
2135 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2136 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002137 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002138 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002139 "crtbrand",
2140 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002141 target: {
2142 linux_bionic: {
2143 generated_sources: ["host_bionic_linker_asm"],
2144 objs: [
2145 "linker_wrapper",
2146 ],
2147 },
2148 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002149 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002150}
2151
Dan Willemsen208ae172015-09-16 16:33:27 -07002152cc_object {
2153 // We rename crtend.o to crtend_android.o to avoid a
2154 // name clash between gcc and bionic.
2155 name: "crtend_android",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002156 local_include_dirs: [
2157 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002158 "private", // crtend.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002159 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002160 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002161
Colin Cross50c21ab2015-10-31 23:03:05 -07002162 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002163}
Colin Crossbaa48992016-07-13 11:15:21 -07002164
Kalesh Singh862a23d2024-01-09 13:13:50 -08002165cc_object {
2166 name: "crt_pad_segment",
2167 local_include_dirs: [
2168 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002169 "private", // crt_pad_segment.S depends on private/bionic_asm_note.h
Kalesh Singh862a23d2024-01-09 13:13:50 -08002170 ],
2171 srcs: ["arch-common/bionic/crt_pad_segment.S"],
2172
2173 defaults: ["crt_defaults"],
2174}
2175
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002176cc_library_static {
2177 name: "note_memtag_heap_async",
2178 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002179 arm64: {
2180 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2181 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002182 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002183 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002184
Colin Cross10d92682021-06-22 13:25:46 -07002185 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002186}
2187
2188cc_library_static {
2189 name: "note_memtag_heap_sync",
2190 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002191 arm64: {
2192 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2193 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002194 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002195 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002196
Colin Cross10d92682021-06-22 13:25:46 -07002197 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002198}
2199
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002200// ========================================================
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002201// libc dependencies for baremetal Rust projects.
2202// ========================================================
2203
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002204// This library contains the following unresolved symbols:
2205// __errno
2206// abort
2207// async_safe_fatal_va_list
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002208cc_library_static {
2209 name: "librust_baremetal",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002210 header_libs: ["libc_headers"],
2211 include_dirs: [
2212 "bionic/libc/async_safe/include",
2213 "bionic/libc/platform",
2214 ],
2215 cflags: [
2216 "-Wall",
2217 "-Werror",
2218 ],
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002219 srcs: [
2220 "bionic/fortify.cpp",
Pierre-Clément Tosi816176c2022-11-30 14:33:41 +00002221 "bionic/strtol.cpp",
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002222 ],
2223 arch: {
2224 arm64: {
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002225 srcs: [
2226 "arch-arm64/string/__memcpy_chk.S",
2227 ],
2228 },
caowencheng9a39eb32023-03-20 16:24:41 +08002229 riscv64: {
2230 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002231 "arch-riscv64/string/__memcpy_chk.S",
caowencheng9a39eb32023-03-20 16:24:41 +08002232 ],
2233 },
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002234 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002235 whole_static_libs: [
2236 "libarm-optimized-routines-mem",
Pierre-Clément Tosieb46ac92023-02-01 13:44:57 +00002237 "libc_netbsd",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002238 ],
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002239 system_shared_libs: [],
2240 nocrt: true,
2241 stl: "none",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002242 visibility: [
2243 "//packages/modules/Virtualization/vmbase",
2244 ],
2245}
2246
2247// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002248// NDK headers.
2249// ========================================================
2250
Dan Albert26e1c412018-05-24 14:56:46 -07002251versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002252 name: "common_libc",
2253 from: "include",
2254 to: "",
2255 license: "NOTICE",
2256}
Dan Albert4238a352016-06-28 11:18:05 -07002257
2258ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002259 name: "libc_uapi",
2260 from: "kernel/uapi",
2261 to: "",
2262 srcs: [
2263 "kernel/uapi/asm-generic/**/*.h",
2264 "kernel/uapi/drm/**/*.h",
2265 "kernel/uapi/linux/**/*.h",
2266 "kernel/uapi/misc/**/*.h",
2267 "kernel/uapi/mtd/**/*.h",
2268 "kernel/uapi/rdma/**/*.h",
2269 "kernel/uapi/scsi/**/*.h",
2270 "kernel/uapi/sound/**/*.h",
2271 "kernel/uapi/video/**/*.h",
2272 "kernel/uapi/xen/**/*.h",
2273 ],
Dan Albert92592652016-10-20 01:42:54 -07002274 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002275}
2276
2277ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002278 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002279 from: "kernel/android/uapi/linux",
2280 to: "linux",
2281 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002282 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002283}
2284
2285ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002286 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002287 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002288 to: "scsi",
2289 srcs: ["kernel/android/scsi/**/*.h"],
2290 license: "NOTICE",
2291}
2292
2293ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002294 name: "libc_asm_arm",
2295 from: "kernel/uapi/asm-arm",
2296 to: "arm-linux-androideabi",
2297 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002298 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002299}
2300
2301ndk_headers {
2302 name: "libc_asm_arm64",
2303 from: "kernel/uapi/asm-arm64",
2304 to: "aarch64-linux-android",
2305 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002306 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002307}
2308
Lazar Trsic790d2f72017-11-27 11:54:11 +01002309ndk_headers {
Colin Crossbd26e0f2022-10-19 15:03:14 -07002310 name: "libc_asm_riscv64",
2311 from: "kernel/uapi/asm-riscv",
2312 to: "riscv64-linux-android",
2313 srcs: ["kernel/uapi/asm-riscv/**/*.h"],
2314 license: "NOTICE",
2315}
2316
2317ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002318 name: "libc_asm_x86",
2319 from: "kernel/uapi/asm-x86",
2320 to: "i686-linux-android",
2321 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002322 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002323}
2324
2325ndk_headers {
2326 name: "libc_asm_x86_64",
2327 from: "kernel/uapi/asm-x86",
2328 to: "x86_64-linux-android",
2329 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002330 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002331}
2332
Dan Albert4238a352016-06-28 11:18:05 -07002333ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002334 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002335 symbol_file: "libc.map.txt",
2336 first_version: "9",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002337 export_header_libs: [
2338 "common_libc",
2339 "libc_uapi",
2340 "libc_kernel_android_uapi_linux",
2341 "libc_kernel_android_scsi",
2342 "libc_asm_arm",
2343 "libc_asm_arm64",
Colin Crossbd26e0f2022-10-19 15:03:14 -07002344 "libc_asm_riscv64",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002345 "libc_asm_x86",
2346 "libc_asm_x86_64",
2347 ],
Dan Albert4238a352016-06-28 11:18:05 -07002348}
2349
Dan Albertdf31aff2016-10-06 15:50:41 -07002350ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002351 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002352 symbol_file: "libstdc++.map.txt",
2353 first_version: "9",
2354}
2355
Dan Willemsenca056d72018-01-08 14:00:24 -08002356// Export these headers for toolbox to process
2357filegroup {
2358 name: "kernel_input_headers",
2359 srcs: [
2360 "kernel/uapi/linux/input.h",
2361 "kernel/uapi/linux/input-event-codes.h",
2362 ],
2363}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002364
2365// Generate a syscall name / number mapping. These objects are text files
2366// (thanks to the -dD -E flags) and not binary files. They will then be
2367// consumed by the genseccomp.py script and converted into C++ code.
2368cc_defaults {
2369 name: "libseccomp_gen_syscall_nrs_defaults",
2370 recovery_available: true,
2371 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2372 cflags: [
2373 "-dD",
2374 "-E",
2375 "-Wall",
2376 "-Werror",
2377 "-nostdinc",
2378 ],
2379}
2380
2381cc_object {
2382 name: "libseccomp_gen_syscall_nrs_arm",
2383 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2384 local_include_dirs: [
2385 "kernel/uapi/asm-arm",
2386 "kernel/uapi",
2387 ],
2388}
2389
2390cc_object {
2391 name: "libseccomp_gen_syscall_nrs_arm64",
2392 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2393 local_include_dirs: [
2394 "kernel/uapi/asm-arm64",
2395 "kernel/uapi",
2396 ],
2397}
2398
2399cc_object {
Elliott Hughes704772b2022-10-10 17:06:43 +00002400 name: "libseccomp_gen_syscall_nrs_riscv64",
2401 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2402 local_include_dirs: [
2403 "kernel/uapi/asm-riscv",
2404 "kernel/uapi",
2405 ],
2406}
2407
2408cc_object {
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002409 name: "libseccomp_gen_syscall_nrs_x86",
2410 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2411 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2412 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2413 local_include_dirs: [
2414 "kernel/uapi/asm-x86",
2415 "kernel/uapi",
2416 ],
2417}
2418
2419cc_object {
2420 name: "libseccomp_gen_syscall_nrs_x86_64",
2421 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2422 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2423 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2424 local_include_dirs: [
2425 "kernel/uapi/asm-x86",
2426 "kernel/uapi",
2427 ],
2428}
2429
Jingwen Chenca366332021-01-29 05:16:32 -05002430filegroup {
2431 name: "all_kernel_uapi_headers",
2432 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002433}
2434
Martijn Coenen0c6de752019-01-02 12:52:51 +01002435cc_genrule {
2436 name: "func_to_syscall_nrs",
2437 recovery_available: true,
2438 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2439
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002440 tools: ["genfunctosyscallnrs"],
Martijn Coenen0c6de752019-01-02 12:52:51 +01002441
2442 srcs: [
2443 "SYSCALLS.TXT",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002444 ],
2445
Elliott Hughes704772b2022-10-10 17:06:43 +00002446 arch: {
2447 arm: {
2448 srcs: [
2449 ":libseccomp_gen_syscall_nrs_arm",
2450 ":libseccomp_gen_syscall_nrs_arm64",
2451 ],
2452 },
2453 arm64: {
2454 srcs: [
2455 ":libseccomp_gen_syscall_nrs_arm",
2456 ":libseccomp_gen_syscall_nrs_arm64",
2457 ],
2458 },
2459 riscv64: {
2460 srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
2461 },
2462 x86: {
2463 srcs: [
2464 ":libseccomp_gen_syscall_nrs_x86",
2465 ":libseccomp_gen_syscall_nrs_x86_64",
2466 ],
2467 },
2468 x86_64: {
2469 srcs: [
2470 ":libseccomp_gen_syscall_nrs_x86",
2471 ":libseccomp_gen_syscall_nrs_x86_64",
2472 ],
2473 },
2474 },
2475
Martijn Coenen0c6de752019-01-02 12:52:51 +01002476 out: [
2477 "func_to_syscall_nrs.h",
2478 ],
2479}
2480
Victor Hsiehdbb86702020-06-15 09:29:07 -07002481// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002482genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002483 name: "generate_app_zygote_blocklist",
2484 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2485 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002486 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2487}
2488
Yu Liu938ec9b2022-10-17 16:36:30 -07002489filegroup {
2490 name: "seccomp_syscalls_sources_zygote",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002491 srcs: [
2492 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002493 "SECCOMP_ALLOWLIST_COMMON.TXT",
2494 "SECCOMP_ALLOWLIST_APP.TXT",
2495 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002496 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002497 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002498 ],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002499}
2500
Yu Liu938ec9b2022-10-17 16:36:30 -07002501filegroup {
2502 name: "seccomp_syscalls_sources_app",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002503 srcs: [
2504 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002505 "SECCOMP_ALLOWLIST_COMMON.TXT",
2506 "SECCOMP_ALLOWLIST_APP.TXT",
2507 "SECCOMP_BLOCKLIST_COMMON.TXT",
2508 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002509 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002510 ],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002511}
2512
Yu Liu938ec9b2022-10-17 16:36:30 -07002513filegroup {
2514 name: "seccomp_syscalls_sources_system",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002515 srcs: [
2516 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002517 "SECCOMP_ALLOWLIST_COMMON.TXT",
2518 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2519 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002520 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002521 ],
Yu Liu938ec9b2022-10-17 16:36:30 -07002522}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002523
Yu Liu938ec9b2022-10-17 16:36:30 -07002524cc_genrule {
2525 name: "libseccomp_policy_app_zygote_sources_x86",
2526 recovery_available: true,
2527 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002528 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002529 srcs: [
2530 ":seccomp_syscalls_sources_zygote",
2531 ":libseccomp_gen_syscall_nrs_x86",
2532 ":libseccomp_gen_syscall_nrs_x86_64",
2533 ],
2534 out: [
2535 "x86_app_zygote_policy.cpp",
2536 "x86_64_app_zygote_policy.cpp",
2537 ],
2538 enabled: false,
Yu Liu3a579692022-10-18 03:02:32 +00002539 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002540 x86: {
2541 enabled: true,
2542 },
2543 x86_64: {
2544 enabled: true,
2545 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002546 },
2547}
2548
2549cc_genrule {
2550 name: "libseccomp_policy_app_zygote_sources_arm",
2551 recovery_available: true,
2552 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002553 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002554 srcs: [
2555 ":seccomp_syscalls_sources_zygote",
2556 ":libseccomp_gen_syscall_nrs_arm",
2557 ":libseccomp_gen_syscall_nrs_arm64",
2558 ],
2559 out: [
2560 "arm_app_zygote_policy.cpp",
2561 "arm64_app_zygote_policy.cpp",
2562 ],
2563 enabled: false,
2564 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002565 arm: {
2566 enabled: true,
2567 },
2568 arm64: {
2569 enabled: true,
2570 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002571 },
2572}
2573
2574cc_genrule {
2575 name: "libseccomp_policy_app_zygote_sources_riscv64",
2576 recovery_available: true,
2577 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002578 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002579 srcs: [
2580 ":seccomp_syscalls_sources_zygote",
2581 ":libseccomp_gen_syscall_nrs_riscv64",
2582 ],
2583 out: [
2584 "riscv64_app_zygote_policy.cpp",
2585 ],
2586 enabled: false,
2587 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002588 riscv64: {
2589 enabled: true,
2590 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002591 },
2592}
2593
2594cc_genrule {
2595 name: "libseccomp_policy_app_sources_x86",
2596 recovery_available: true,
2597 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002598 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002599 srcs: [
2600 ":seccomp_syscalls_sources_app",
2601 ":libseccomp_gen_syscall_nrs_x86",
2602 ":libseccomp_gen_syscall_nrs_x86_64",
2603 ],
2604 out: [
2605 "x86_app_policy.cpp",
2606 "x86_64_app_policy.cpp",
2607 ],
2608 enabled: false,
2609 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002610 x86: {
2611 enabled: true,
2612 },
2613 x86_64: {
2614 enabled: true,
2615 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002616 },
2617}
2618
2619cc_genrule {
2620 name: "libseccomp_policy_app_sources_arm",
2621 recovery_available: true,
2622 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002623 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002624 srcs: [
2625 ":seccomp_syscalls_sources_app",
2626 ":libseccomp_gen_syscall_nrs_arm",
2627 ":libseccomp_gen_syscall_nrs_arm64",
2628 ],
2629 out: [
2630 "arm_app_policy.cpp",
2631 "arm64_app_policy.cpp",
2632 ],
2633 enabled: false,
2634 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002635 arm: {
2636 enabled: true,
2637 },
2638 arm64: {
2639 enabled: true,
2640 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002641 },
2642}
2643
2644cc_genrule {
2645 name: "libseccomp_policy_app_sources_riscv64",
2646 recovery_available: true,
2647 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002648 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002649 srcs: [
2650 ":seccomp_syscalls_sources_app",
2651 ":libseccomp_gen_syscall_nrs_riscv64",
2652 ],
2653 out: [
2654 "riscv64_app_policy.cpp",
2655 ],
2656 enabled: false,
2657 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002658 riscv64: {
2659 enabled: true,
2660 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002661 },
2662}
2663
2664cc_genrule {
2665 name: "libseccomp_policy_system_sources_x86",
2666 recovery_available: true,
2667 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002668 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002669 srcs: [
2670 ":seccomp_syscalls_sources_system",
2671 ":libseccomp_gen_syscall_nrs_x86",
2672 ":libseccomp_gen_syscall_nrs_x86_64",
2673 ],
2674 out: [
2675 "x86_system_policy.cpp",
2676 "x86_64_system_policy.cpp",
2677 ],
2678 enabled: false,
2679 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002680 x86: {
2681 enabled: true,
2682 },
2683 x86_64: {
2684 enabled: true,
2685 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002686 },
2687}
2688
2689cc_genrule {
2690 name: "libseccomp_policy_system_sources_arm",
2691 recovery_available: true,
2692 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002693 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002694 srcs: [
2695 ":seccomp_syscalls_sources_system",
2696 ":libseccomp_gen_syscall_nrs_arm",
2697 ":libseccomp_gen_syscall_nrs_arm64",
2698 ],
2699 out: [
2700 "arm_system_policy.cpp",
2701 "arm64_system_policy.cpp",
2702 ],
2703 enabled: false,
2704 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002705 arm: {
2706 enabled: true,
2707 },
2708 arm64: {
2709 enabled: true,
2710 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002711 },
2712}
2713
2714cc_genrule {
2715 name: "libseccomp_policy_system_sources_riscv64",
2716 recovery_available: true,
2717 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002718 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002719 srcs: [
2720 ":seccomp_syscalls_sources_system",
2721 ":libseccomp_gen_syscall_nrs_riscv64",
2722 ],
2723 out: [
2724 "riscv64_system_policy.cpp",
2725 ],
2726 enabled: false,
2727 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002728 riscv64: {
2729 enabled: true,
2730 },
Yu Liu3a579692022-10-18 03:02:32 +00002731 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002732}
2733
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002734cc_library {
2735 name: "libseccomp_policy",
2736 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002737 generated_headers: ["func_to_syscall_nrs"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002738
2739 arch: {
2740 arm: {
2741 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002742 "libseccomp_policy_app_sources_arm",
2743 "libseccomp_policy_app_zygote_sources_arm",
2744 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002745 ],
2746 },
2747 arm64: {
2748 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002749 "libseccomp_policy_app_sources_arm",
2750 "libseccomp_policy_app_zygote_sources_arm",
2751 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002752 ],
2753 },
2754 riscv64: {
2755 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002756 "libseccomp_policy_app_sources_riscv64",
2757 "libseccomp_policy_app_zygote_sources_riscv64",
2758 "libseccomp_policy_system_sources_riscv64",
Yu Liu938ec9b2022-10-17 16:36:30 -07002759 ],
2760 },
2761 x86: {
2762 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002763 "libseccomp_policy_app_sources_x86",
2764 "libseccomp_policy_app_zygote_sources_x86",
2765 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002766 ],
2767 },
2768 x86_64: {
2769 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002770 "libseccomp_policy_app_sources_x86",
2771 "libseccomp_policy_app_zygote_sources_x86",
2772 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002773 ],
2774 },
2775 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002776
2777 srcs: [
2778 "seccomp/seccomp_policy.cpp",
2779 ],
2780
2781 export_include_dirs: ["seccomp/include"],
2782 cflags: [
2783 "-Wall",
2784 "-Werror",
2785 ],
2786 shared: {
2787 shared_libs: ["libbase"],
2788 },
2789 static: {
2790 static_libs: ["libbase"],
2791 },
2792}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002793
Colin Cross048f24e2021-09-01 17:26:00 -07002794cc_library_host_static {
2795 name: "libfts",
2796 srcs: [
2797 "bionic/fts.c",
2798 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
2799 ],
2800 export_include_dirs: ["fts/include"],
2801 local_include_dirs: [
2802 "private",
2803 "upstream-openbsd/android/include",
2804 ],
2805 cflags: [
2806 "-include openbsd-compat.h",
2807 "-Wno-unused-parameter",
2808 ],
2809 enabled: false,
2810 target: {
2811 musl: {
2812 enabled: true,
2813 },
2814 },
Colin Cross2a9843f2022-01-13 12:26:30 -08002815 stl: "none",
2816}
2817
2818cc_library_host_static {
2819 name: "libexecinfo",
2820 visibility: ["//external/musl"],
2821 srcs: ["bionic/execinfo.cpp"],
2822 export_include_dirs: ["execinfo/include"],
2823 local_include_dirs: ["private"],
2824 enabled: false,
2825 target: {
2826 musl: {
2827 enabled: true,
2828 system_shared_libs: [],
2829 header_libs: ["libc_musl_headers"],
2830 },
2831 },
2832 stl: "none",
Colin Cross048f24e2021-09-01 17:26:00 -07002833}
2834
Colin Cross9da85fa2022-01-24 18:20:05 -08002835cc_library_host_static {
2836 name: "libb64",
2837 visibility: ["//external/musl"],
2838 srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
2839 export_include_dirs: ["b64/include"],
2840 local_include_dirs: [
2841 "private",
2842 "upstream-openbsd/android/include",
2843 ],
2844 cflags: [
2845 "-include openbsd-compat.h",
2846 ],
2847 enabled: false,
2848 target: {
2849 musl: {
2850 enabled: true,
2851 system_shared_libs: [],
2852 header_libs: ["libc_musl_headers"],
2853 },
2854 },
2855 stl: "none",
2856}
2857
Colin Cross9d4a56e2022-02-03 10:20:32 -08002858// Export kernel uapi headers to be used in the musl sysroot.
2859// Also include the execinfo headers for the libexecinfo and the
2860// b64 headers for libb64 embedded in musl libc.
2861cc_genrule {
2862 name: "libc_musl_sysroot_bionic_headers",
2863 visibility: ["//external/musl"],
2864 host_supported: true,
2865 device_supported: false,
2866 enabled: false,
2867 target: {
2868 musl: {
2869 enabled: true,
2870 },
2871 },
2872 srcs: [
2873 "kernel/uapi/**/*.h",
2874 "kernel/android/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002875 "execinfo/include/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002876 "b64/include/**/*.h",
Colin Crossaeef9f02022-02-07 21:01:26 -08002877
Colin Crossaeef9f02022-02-07 21:01:26 -08002878 "NOTICE",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002879
2880 ":libc_musl_sysroot_bionic_arch_headers",
2881 ],
2882 out: ["libc_musl_sysroot_bionic_headers.zip"],
2883 tools: [
2884 "soong_zip",
2885 "merge_zips",
2886 "zip2zip",
2887 ],
Colin Crossaeef9f02022-02-07 21:01:26 -08002888 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
2889 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
Colin Crossad33d022022-02-25 18:27:04 -08002890 // NOTICE
2891 " -j -f $(location NOTICE) " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002892 // headers
2893 " -P include " +
Colin Crossaeef9f02022-02-07 21:01:26 -08002894 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
2895 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
2896 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2897 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2898 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2899 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2900 " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
2901 " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
2902 " -C $${BIONIC_LIBC_DIR}/b64/include " +
2903 " -D $${BIONIC_LIBC_DIR}/b64/include " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002904 " && " +
Colin Crossad33d022022-02-25 18:27:04 -08002905 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
Colin Cross1c0a7a02022-08-11 12:22:26 -07002906 " -x **/BUILD " +
Colin Crossad33d022022-02-25 18:27:04 -08002907 " include/**/*:include/ " +
2908 " NOTICE:NOTICE.bionic " +
2909 " && " +
2910 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002911}
2912
2913// The architecture-specific bits have to be handled separately because the label varies based
2914// on architecture, which prevents using $(locations) to find them and requires using $(in)
2915// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
2916// genrule.
2917cc_genrule {
2918 name: "libc_musl_sysroot_bionic_arch_headers",
2919 visibility: ["//visibility:private"],
2920 host_supported: true,
2921 device_supported: false,
2922 enabled: false,
2923 target: {
2924 musl: {
2925 enabled: true,
2926 },
2927 },
2928 arch: {
2929 arm: {
2930 srcs: ["kernel/uapi/asm-arm/**/*.h"],
2931 },
2932 arm64: {
2933 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
2934 },
2935 x86: {
2936 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2937 },
2938 x86_64: {
2939 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2940 },
2941 },
2942 out: ["libc_musl_sysroot_bionic_arch_headers.zip"],
2943 tools: ["soong_zip"],
2944 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
2945}
Colin Cross290c4952022-10-13 12:51:13 -07002946
2947cc_genrule {
2948 name: "bionic_sysroot_crt_objects",
2949 visibility: ["//visibility:private"],
2950 out: ["bionic_sysroot_crt_objects.zip"],
2951 tools: ["soong_zip"],
2952 srcs: [
2953 ":crtbegin_dynamic",
2954 ":crtbegin_so",
2955 ":crtbegin_static",
2956 ":crtend_android",
2957 ":crtend_so",
2958 ],
2959 cmd: "$(location soong_zip) -o $(out) -j " +
2960 "-f $(location :crtbegin_dynamic) " +
2961 "-f $(location :crtbegin_so) " +
2962 "-f $(location :crtbegin_static) " +
2963 "-f $(location :crtend_android) " +
2964 "-f $(location :crtend_so)",
2965 dist: {
2966 targets: ["bionic_sysroot_crt_objects"],
2967 },
2968 arch: {
2969 arm: {
2970 dist: {
2971 suffix: "_arm",
2972 },
2973 },
2974 arm64: {
2975 dist: {
2976 suffix: "_arm64",
2977 },
2978 },
2979 riscv64: {
2980 dist: {
2981 suffix: "_riscv64",
2982 },
2983 },
2984 x86: {
2985 dist: {
2986 suffix: "_x86",
2987 },
2988 },
2989 x86_64: {
2990 dist: {
2991 suffix: "_x86_64",
2992 },
2993 },
2994 },
2995}
Spandan Das8fce52a2023-09-28 18:00:12 +00002996
2997// headers that will be placed on the include path when running versioner in bazel
2998// this module should be a no-op in soong
2999filegroup {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00003000 name: "versioner-dependencies",
3001 srcs: ["versioner-dependencies/**/*"],
Spandan Das8fce52a2023-09-28 18:00:12 +00003002}