blob: c7d2923f17fcb66bc48aa56615897c6225ee72f4 [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// ========================================================
494// libc_openbsd_ndk.a - upstream OpenBSD C library code
495// that can be safely included in the libc_ndk.a (doesn't
496// contain any troublesome global data or constructors).
497// ========================================================
498//
499// These files are built with the openbsd-compat.h header file
500// automatically included.
501
502cc_library_static {
503 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700504 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700505 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700506 "upstream-openbsd/lib/libc/gen/alarm.c",
507 "upstream-openbsd/lib/libc/gen/ctype_.c",
508 "upstream-openbsd/lib/libc/gen/daemon.c",
509 "upstream-openbsd/lib/libc/gen/err.c",
510 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700511 "upstream-openbsd/lib/libc/gen/fnmatch.c",
512 "upstream-openbsd/lib/libc/gen/ftok.c",
513 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700514 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700515 "upstream-openbsd/lib/libc/gen/verr.c",
516 "upstream-openbsd/lib/libc/gen/verrx.c",
517 "upstream-openbsd/lib/libc/gen/vwarn.c",
518 "upstream-openbsd/lib/libc/gen/vwarnx.c",
519 "upstream-openbsd/lib/libc/gen/warn.c",
520 "upstream-openbsd/lib/libc/gen/warnx.c",
521 "upstream-openbsd/lib/libc/locale/btowc.c",
522 "upstream-openbsd/lib/libc/locale/mbrlen.c",
523 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
524 "upstream-openbsd/lib/libc/locale/mbtowc.c",
525 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700526 "upstream-openbsd/lib/libc/locale/wcstombs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700527 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
528 "upstream-openbsd/lib/libc/locale/wctob.c",
529 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700530 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700531 "upstream-openbsd/lib/libc/net/htonl.c",
532 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700533 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
534 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
535 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700536 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
537 "upstream-openbsd/lib/libc/net/inet_ntop.c",
538 "upstream-openbsd/lib/libc/net/inet_pton.c",
539 "upstream-openbsd/lib/libc/net/ntohl.c",
540 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800541 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700542 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700543 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
544 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700546 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700547 "upstream-openbsd/lib/libc/stdio/fputwc.c",
548 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700549 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700550 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700551 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700552 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700553 "upstream-openbsd/lib/libc/stdio/makebuf.c",
554 "upstream-openbsd/lib/libc/stdio/mktemp.c",
555 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
556 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700557 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700558 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700559 "upstream-openbsd/lib/libc/stdio/ungetc.c",
560 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
561 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
562 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700563 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
564 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
565 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700566 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700567 "upstream-openbsd/lib/libc/stdio/wsetup.c",
568 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800569 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700570 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700571 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700572 "upstream-openbsd/lib/libc/stdlib/insque.c",
573 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
574 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
575 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800576 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700577 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800578 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700579 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughes26b06072020-07-31 11:00:10 -0700580 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700581 "upstream-openbsd/lib/libc/stdlib/remque.c",
582 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700583 "upstream-openbsd/lib/libc/stdlib/tfind.c",
584 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800585 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700586 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800587 "upstream-openbsd/lib/libc/string/strcasestr.c",
588 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700589 "upstream-openbsd/lib/libc/string/strcspn.c",
590 "upstream-openbsd/lib/libc/string/strdup.c",
591 "upstream-openbsd/lib/libc/string/strndup.c",
592 "upstream-openbsd/lib/libc/string/strpbrk.c",
593 "upstream-openbsd/lib/libc/string/strsep.c",
594 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700595 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800596 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700597 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700598 "upstream-openbsd/lib/libc/string/wcswidth.c",
Colin Cross69bcb8b2021-09-08 13:24:16 -0700599
600 // This file is originally from OpenBSD, and benefits from
601 // being compiled with openbsd-compat.h.
602 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700603 ],
604
Colin Cross50c21ab2015-10-31 23:03:05 -0700605 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700606 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700607 "-Wno-unused-parameter",
608 "-include openbsd-compat.h",
609 ],
610
Dan Willemsen208ae172015-09-16 16:33:27 -0700611 local_include_dirs: [
612 "private",
613 "stdio",
614 "upstream-openbsd/android/include",
615 "upstream-openbsd/lib/libc/include",
616 "upstream-openbsd/lib/libc/gdtoa/",
617 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700618}
619
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700620cc_library_static {
621 name: "libc_openbsd_large_stack",
622 defaults: ["libc_defaults"],
623 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700624 "stdio/vfprintf.cpp",
625 "stdio/vfwprintf.cpp",
Elliott Hughes5633caa2020-08-06 14:32:43 -0700626 "upstream-openbsd/lib/libc/string/memmem.c",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800627 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700628 ],
629 cflags: [
630 "-include openbsd-compat.h",
631 "-Wno-sign-compare",
632 "-Wframe-larger-than=5000",
633 ],
634
635 local_include_dirs: [
Elliott Hughese1dc4f62021-01-11 11:51:29 -0800636 "private",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700637 "upstream-openbsd/android/include/",
638 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700639 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700640 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700641 ],
642}
643
Dan Willemsen208ae172015-09-16 16:33:27 -0700644// ========================================================
645// libc_openbsd.a - upstream OpenBSD C library code
646// ========================================================
647//
648// These files are built with the openbsd-compat.h header file
649// automatically included.
650cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700651 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700652 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800653 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700654 "upstream-openbsd/lib/libc/crypt/arc4random.c",
655 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700656 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700657
Elliott Hughes7d136662023-10-27 15:40:32 -0700658 // Each architecture has optimized versions of some routines,
659 // and only includes the portable C versions of ones it's missing.
Dan Willemsen208ae172015-09-16 16:33:27 -0700660 arch: {
661 arm: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700662 srcs: [
663 "upstream-openbsd/lib/libc/string/memchr.c",
664 "upstream-openbsd/lib/libc/string/memrchr.c",
665 "upstream-openbsd/lib/libc/string/stpncpy.c",
666 "upstream-openbsd/lib/libc/string/strlcat.c",
667 "upstream-openbsd/lib/libc/string/strlcpy.c",
668 "upstream-openbsd/lib/libc/string/strncat.c",
669 "upstream-openbsd/lib/libc/string/strncmp.c",
670 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700671 ],
672 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700673 arm64: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700674 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700675 "upstream-openbsd/lib/libc/string/strcat.c",
Elliott Hughesaefe9992023-11-08 12:04:41 -0800676 "upstream-openbsd/lib/libc/string/stpncpy.c",
Elliott Hughes7d136662023-10-27 15:40:32 -0700677 "upstream-openbsd/lib/libc/string/strlcat.c",
678 "upstream-openbsd/lib/libc/string/strlcpy.c",
679 "upstream-openbsd/lib/libc/string/strncat.c",
680 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700681 ],
682 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000683 riscv64: {
684 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700685 "upstream-openbsd/lib/libc/string/memrchr.c",
686 "upstream-openbsd/lib/libc/string/stpncpy.c",
687 "upstream-openbsd/lib/libc/string/strlcat.c",
688 "upstream-openbsd/lib/libc/string/strlcpy.c",
Elliott Hughesebc19a92022-10-14 23:25:36 +0000689 ],
690 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700691 x86: {
Elliott Hughesaefe9992023-11-08 12:04:41 -0800692 srcs: [
693 // x86 has custom implementations of all of these.
694 ],
Elliott Hughes7d136662023-10-27 15:40:32 -0700695 },
696 x86_64: {
697 srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800698 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800699 "upstream-openbsd/lib/libc/string/memrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700700 "upstream-openbsd/lib/libc/string/strlcat.c",
701 "upstream-openbsd/lib/libc/string/strlcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800702 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700703 },
704 },
705
Colin Cross50c21ab2015-10-31 23:03:05 -0700706 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700707 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700708 "-Wno-unused-parameter",
709 "-include openbsd-compat.h",
710 ],
711
Dan Willemsen208ae172015-09-16 16:33:27 -0700712 local_include_dirs: [
713 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700714 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700715 ],
716
717 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700718}
719
720// ========================================================
721// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
722// ========================================================
723//
724// These files are built with the openbsd-compat.h header file
725// automatically included.
726
727cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700728 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700729 srcs: [
730 "upstream-openbsd/android/gdtoa_support.cpp",
731 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
732 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
733 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
734 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
735 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
736 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
737 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
738 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
739 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
740 "upstream-openbsd/lib/libc/gdtoa/misc.c",
741 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
742 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
743 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
744 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
745 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
746 "upstream-openbsd/lib/libc/gdtoa/sum.c",
747 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
748 ],
749 multilib: {
750 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800751 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700752 },
753 },
754
Colin Cross50c21ab2015-10-31 23:03:05 -0700755 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700756 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700757 "-include openbsd-compat.h",
758 ],
759
Dan Willemsen208ae172015-09-16 16:33:27 -0700760 local_include_dirs: [
761 "private",
762 "upstream-openbsd/android/include",
763 "upstream-openbsd/lib/libc/include",
764 ],
765
766 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700767}
768
769// ========================================================
Pierre-Clément Tosi467e58e2023-02-01 13:44:43 +0000770// libc_fortify.a - container for our FORTIFY
George Burgess IV6cb06872017-07-21 13:28:42 -0700771// implementation details
772// ========================================================
773cc_library_static {
774 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700775 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700776
777 name: "libc_fortify",
778
779 // Disable FORTIFY for the compilation of these, so we don't end up having
780 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800781 cflags: [
782 "-U_FORTIFY_SOURCE",
783 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
784 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700785
786 arch: {
787 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800788 cflags: [
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800789 "-DRENAME___STRCAT_CHK",
790 "-DRENAME___STRCPY_CHK",
791 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700792 srcs: [
793 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800794
795 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
796 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
797
798 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
799 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
800
801 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
802 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
803
804 "arch-arm/krait/bionic/__strcat_chk.S",
805 "arch-arm/krait/bionic/__strcpy_chk.S",
806
807 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
808 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
809
Haibo Huang01bfd892018-12-03 15:05:16 -0800810 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
811 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700812 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700813 },
814 arm64: {
815 srcs: [
Elliott Hughes023e4e72022-11-17 19:27:02 +0000816 "arch-arm64/string/__memcpy_chk.S",
817 "arch-arm64/string/__memset_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700818 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700819 },
caowenchengab457f92023-03-06 14:57:55 +0800820 riscv64: {
821 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000822 "arch-riscv64/string/__memset_chk.S",
823 "arch-riscv64/string/__memcpy_chk.S",
caowenchengab457f92023-03-06 14:57:55 +0800824 ],
825 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700826 },
827}
828
829// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700830// libc_bionic.a - home-grown C library code
831// ========================================================
832
833cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700834 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700835 srcs: [
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800836 "bionic/NetdClientDispatch.cpp",
837 "bionic/__bionic_get_shell_path.cpp",
838 "bionic/__cmsg_nxthdr.cpp",
839 "bionic/__cxa_thread_atexit_impl.cpp",
840 "bionic/__errno.cpp",
841 "bionic/__gnu_basename.cpp",
842 "bionic/__libc_current_sigrtmax.cpp",
843 "bionic/__libc_current_sigrtmin.cpp",
844 "bionic/abort.cpp",
845 "bionic/accept.cpp",
846 "bionic/access.cpp",
Josh Gao10ec9282017-04-03 15:13:29 -0700847 "bionic/android_set_abort_message.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000848 "bionic/android_unsafe_frame_pointer_chase.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800849 "bionic/arpa_inet.cpp",
850 "bionic/assert.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000851 "bionic/atexit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800852 "bionic/atof.cpp",
853 "bionic/bionic_allocator.cpp",
854 "bionic/bionic_arc4random.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000855 "bionic/bionic_elf_tls.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800856 "bionic/bionic_futex.cpp",
857 "bionic/bionic_netlink.cpp",
858 "bionic/bionic_systrace.cpp",
859 "bionic/bionic_time_conversions.cpp",
860 "bionic/brk.cpp",
861 "bionic/c16rtomb.cpp",
862 "bionic/c32rtomb.cpp",
863 "bionic/chmod.cpp",
864 "bionic/chown.cpp",
865 "bionic/clearenv.cpp",
866 "bionic/clock.cpp",
867 "bionic/clock_getcpuclockid.cpp",
868 "bionic/clock_nanosleep.cpp",
869 "bionic/clone.cpp",
870 "bionic/ctype.cpp",
871 "bionic/dirent.cpp",
872 "bionic/dup.cpp",
873 "bionic/environ.cpp",
874 "bionic/error.cpp",
875 "bionic/eventfd.cpp",
876 "bionic/exec.cpp",
877 "bionic/execinfo.cpp",
878 "bionic/faccessat.cpp",
879 "bionic/fchmod.cpp",
880 "bionic/fchmodat.cpp",
881 "bionic/fcntl.cpp",
882 "bionic/fdsan.cpp",
883 "bionic/fdtrack.cpp",
884 "bionic/ffs.cpp",
885 "bionic/fgetxattr.cpp",
886 "bionic/flistxattr.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000887 "bionic/fork.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800888 "bionic/fpclassify.cpp",
889 "bionic/fsetxattr.cpp",
890 "bionic/ftruncate.cpp",
891 "bionic/ftw.cpp",
892 "bionic/futimens.cpp",
893 "bionic/getcwd.cpp",
894 "bionic/getdomainname.cpp",
895 "bionic/getentropy.cpp",
896 "bionic/gethostname.cpp",
897 "bionic/getloadavg.cpp",
898 "bionic/getpagesize.cpp",
899 "bionic/getpgrp.cpp",
900 "bionic/getpid.cpp",
901 "bionic/getpriority.cpp",
902 "bionic/gettid.cpp",
903 "bionic/get_device_api_level.cpp",
904 "bionic/grp_pwd.cpp",
905 "bionic/grp_pwd_file.cpp",
906 "bionic/heap_zero_init.cpp",
907 "bionic/iconv.cpp",
908 "bionic/icu_wrappers.cpp",
909 "bionic/ifaddrs.cpp",
910 "bionic/inotify_init.cpp",
911 "bionic/ioctl.cpp",
912 "bionic/killpg.cpp",
913 "bionic/langinfo.cpp",
914 "bionic/lchown.cpp",
915 "bionic/lfs64_support.cpp",
916 "bionic/libc_init_common.cpp",
917 "bionic/libgen.cpp",
918 "bionic/link.cpp",
919 "bionic/locale.cpp",
920 "bionic/lockf.cpp",
921 "bionic/lstat.cpp",
922 "bionic/mblen.cpp",
923 "bionic/mbrtoc16.cpp",
924 "bionic/mbrtoc32.cpp",
925 "bionic/mempcpy.cpp",
926 "bionic/memset_explicit.cpp",
927 "bionic/mkdir.cpp",
928 "bionic/mkfifo.cpp",
929 "bionic/mknod.cpp",
930 "bionic/mntent.cpp",
931 "bionic/mremap.cpp",
932 "bionic/net_if.cpp",
933 "bionic/netdb.cpp",
934 "bionic/netinet_in.cpp",
935 "bionic/nl_types.cpp",
936 "bionic/open.cpp",
937 "bionic/pathconf.cpp",
938 "bionic/pause.cpp",
939 "bionic/pidfd.cpp",
940 "bionic/pipe.cpp",
941 "bionic/poll.cpp",
942 "bionic/posix_fadvise.cpp",
943 "bionic/posix_fallocate.cpp",
944 "bionic/posix_madvise.cpp",
945 "bionic/posix_timers.cpp",
946 "bionic/preadv_pwritev.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000947 "bionic/pthread_atfork.cpp",
948 "bionic/pthread_attr.cpp",
949 "bionic/pthread_barrier.cpp",
950 "bionic/pthread_cond.cpp",
951 "bionic/pthread_create.cpp",
952 "bionic/pthread_detach.cpp",
953 "bionic/pthread_equal.cpp",
954 "bionic/pthread_exit.cpp",
955 "bionic/pthread_getcpuclockid.cpp",
956 "bionic/pthread_getschedparam.cpp",
957 "bionic/pthread_gettid_np.cpp",
958 "bionic/pthread_internal.cpp",
959 "bionic/pthread_join.cpp",
960 "bionic/pthread_key.cpp",
961 "bionic/pthread_kill.cpp",
962 "bionic/pthread_mutex.cpp",
963 "bionic/pthread_once.cpp",
964 "bionic/pthread_rwlock.cpp",
965 "bionic/pthread_sigqueue.cpp",
966 "bionic/pthread_self.cpp",
967 "bionic/pthread_setname_np.cpp",
968 "bionic/pthread_setschedparam.cpp",
969 "bionic/pthread_spinlock.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800970 "bionic/ptrace.cpp",
971 "bionic/pty.cpp",
972 "bionic/raise.cpp",
973 "bionic/rand.cpp",
974 "bionic/readlink.cpp",
975 "bionic/realpath.cpp",
976 "bionic/reboot.cpp",
977 "bionic/recv.cpp",
978 "bionic/recvmsg.cpp",
979 "bionic/rename.cpp",
980 "bionic/rmdir.cpp",
981 "bionic/scandir.cpp",
982 "bionic/sched_getaffinity.cpp",
983 "bionic/sched_getcpu.cpp",
984 "bionic/semaphore.cpp",
985 "bionic/send.cpp",
986 "bionic/setegid.cpp",
987 "bionic/seteuid.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000988 "bionic/setjmp_cookie.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800989 "bionic/setpgrp.cpp",
990 "bionic/sigaction.cpp",
991 "bionic/signal.cpp",
992 "bionic/sigprocmask.cpp",
993 "bionic/sleep.cpp",
994 "bionic/socketpair.cpp",
995 "bionic/spawn.cpp",
996 "bionic/stat.cpp",
997 "bionic/stdlib_l.cpp",
998 "bionic/strerror.cpp",
999 "bionic/string_l.cpp",
1000 "bionic/strings_l.cpp",
1001 "bionic/strsignal.cpp",
1002 "bionic/strtol.cpp",
1003 "bionic/strtold.cpp",
1004 "bionic/swab.cpp",
1005 "bionic/symlink.cpp",
1006 "bionic/sync_file_range.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001007 "bionic/sysconf.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001008 "bionic/sys_epoll.cpp",
1009 "bionic/sys_msg.cpp",
1010 "bionic/sys_sem.cpp",
1011 "bionic/sys_shm.cpp",
1012 "bionic/sys_signalfd.cpp",
1013 "bionic/sys_statfs.cpp",
1014 "bionic/sys_statvfs.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001015 "bionic/sys_thread_properties.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001016 "bionic/sys_time.cpp",
1017 "bionic/sysinfo.cpp",
1018 "bionic/syslog.cpp",
1019 "bionic/system.cpp",
1020 "bionic/system_property_api.cpp",
1021 "bionic/system_property_set.cpp",
1022 "bionic/tdestroy.cpp",
1023 "bionic/termios.cpp",
1024 "bionic/thread_private.cpp",
1025 "bionic/threads.cpp",
1026 "bionic/time.cpp",
1027 "bionic/time_l.cpp",
1028 "bionic/tmpfile.cpp",
1029 "bionic/umount.cpp",
1030 "bionic/unlink.cpp",
1031 "bionic/usleep.cpp",
1032 "bionic/utmp.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001033 "bionic/vdso.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001034 "bionic/wait.cpp",
1035 "bionic/wchar.cpp",
1036 "bionic/wchar_l.cpp",
1037 "bionic/wcstod.cpp",
1038 "bionic/wctype.cpp",
1039 "bionic/wcwidth.cpp",
1040 "bionic/wmempcpy.cpp",
1041
1042 // TODO: why isn't this in a static-libc-only module?
1043 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1044 // which will be overridden by the actual one in libc.so.
1045 "bionic/icu_static.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001046 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001047
1048 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001049 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -07001050 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001051 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -08001052 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001053 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001054 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001055 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001056 "arch-arm/bionic/atomics_arm.c",
1057 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -08001058 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001059 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001060 "arch-arm/bionic/setjmp.S",
1061 "arch-arm/bionic/syscall.S",
1062 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001063
Haibo Huangea9957a2018-11-19 11:00:32 -08001064 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001065 "arch-arm/cortex-a7/bionic/memset.S",
1066
1067 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001068 "arch-arm/cortex-a9/bionic/memset.S",
1069 "arch-arm/cortex-a9/bionic/stpcpy.S",
1070 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001071 "arch-arm/cortex-a9/bionic/strcpy.S",
1072 "arch-arm/cortex-a9/bionic/strlen.S",
1073
Elliott Hughesaefe9992023-11-08 12:04:41 -08001074 "arch-arm/cortex-a15/bionic/memcpy.S",
1075 "arch-arm/cortex-a15/bionic/memmove.S",
1076 "arch-arm/cortex-a15/bionic/memset.S",
1077 "arch-arm/cortex-a15/bionic/stpcpy.S",
1078 "arch-arm/cortex-a15/bionic/strcat.S",
1079 "arch-arm/cortex-a15/bionic/strcmp.S",
1080 "arch-arm/cortex-a15/bionic/strcpy.S",
1081 "arch-arm/cortex-a15/bionic/strlen.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001082
1083 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001084
Haibo Huang01bfd892018-12-03 15:05:16 -08001085 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001086
Elliott Hughesaefe9992023-11-08 12:04:41 -08001087 "arch-arm/generic/bionic/memcmp.S",
1088 "arch-arm/generic/bionic/memmove.S",
1089 "arch-arm/generic/bionic/memset.S",
1090 "arch-arm/generic/bionic/stpcpy.c",
1091 "arch-arm/generic/bionic/strcat.c",
1092 "arch-arm/generic/bionic/strcmp.S",
1093 "arch-arm/generic/bionic/strcpy.S",
1094 "arch-arm/generic/bionic/strlen.c",
1095
1096 "arch-arm/krait/bionic/memcpy.S",
1097 "arch-arm/krait/bionic/memset.S",
1098
Haibo Huangea9957a2018-11-19 11:00:32 -08001099 "arch-arm/kryo/bionic/memcpy.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001100
1101 "bionic/strchr.cpp",
1102 "bionic/strchrnul.cpp",
1103 "bionic/strnlen.cpp",
1104 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001105 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001106 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001107 arm64: {
1108 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001109 "arch-arm64/bionic/__bionic_clone.S",
1110 "arch-arm64/bionic/_exit_with_stack_teardown.S",
1111 "arch-arm64/bionic/setjmp.S",
1112 "arch-arm64/bionic/syscall.S",
1113 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001114 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001115 },
1116
Elliott Hughesebc19a92022-10-14 23:25:36 +00001117 riscv64: {
1118 srcs: [
1119 "arch-riscv64/bionic/__bionic_clone.S",
1120 "arch-riscv64/bionic/_exit_with_stack_teardown.S",
Elliott Hughese1905ed2022-10-17 23:23:36 +00001121 "arch-riscv64/bionic/setjmp.S",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001122 "arch-riscv64/bionic/syscall.S",
1123 "arch-riscv64/bionic/vfork.S",
Yun Hsiang40a82d02023-05-26 10:10:40 +08001124
Elliott Hughesaefe9992023-11-08 12:04:41 -08001125 "arch-riscv64/string/memchr_v.S",
1126 "arch-riscv64/string/memcmp_v.S",
1127 "arch-riscv64/string/memcpy_v.S",
1128 "arch-riscv64/string/memmove_v.S",
1129 "arch-riscv64/string/memset_v.S",
1130 "arch-riscv64/string/stpcpy_v.S",
1131 "arch-riscv64/string/strcat_v.S",
1132 "arch-riscv64/string/strchr_v.S",
1133 "arch-riscv64/string/strcmp_v.S",
1134 "arch-riscv64/string/strcpy_v.S",
1135 "arch-riscv64/string/strlen_v.S",
1136 "arch-riscv64/string/strncat_v.S",
1137 "arch-riscv64/string/strncmp_v.S",
1138 "arch-riscv64/string/strncpy_v.S",
1139 "arch-riscv64/string/strnlen_v.S",
1140
1141 "arch-riscv64/string/memchr.c",
1142 "arch-riscv64/string/memcmp.c",
1143 "arch-riscv64/string/memcpy.c",
1144 "arch-riscv64/string/memmove.c",
1145 "arch-riscv64/string/memset.c",
1146 "arch-riscv64/string/stpcpy.c",
1147 "arch-riscv64/string/strcat.c",
1148 "arch-riscv64/string/strchr.c",
1149 "arch-riscv64/string/strcmp.c",
1150 "arch-riscv64/string/strcpy.c",
1151 "arch-riscv64/string/strlen.c",
1152 "arch-riscv64/string/strncat.c",
1153 "arch-riscv64/string/strncmp.c",
1154 "arch-riscv64/string/strncpy.c",
1155 "arch-riscv64/string/strnlen.c",
Prashanth Swaminathana4d71022023-10-30 17:35:19 -07001156
Elliott Hughes7d136662023-10-27 15:40:32 -07001157 "bionic/strchrnul.cpp",
1158 "bionic/strrchr.cpp",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001159 ],
1160 },
1161
Dan Willemsen208ae172015-09-16 16:33:27 -07001162 x86: {
1163 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001164 "arch-x86/bionic/__bionic_clone.S",
1165 "arch-x86/bionic/_exit_with_stack_teardown.S",
1166 "arch-x86/bionic/libcrt_compat.c",
Elliott Hughes7d136662023-10-27 15:40:32 -07001167 "arch-x86/bionic/setjmp.S",
1168 "arch-x86/bionic/syscall.S",
1169 "arch-x86/bionic/vfork.S",
1170 "arch-x86/bionic/__x86.get_pc_thunk.S",
1171
Dan Willemsen208ae172015-09-16 16:33:27 -07001172 "arch-x86/generic/string/memcmp.S",
1173 "arch-x86/generic/string/strcmp.S",
1174 "arch-x86/generic/string/strncmp.S",
1175 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001176
1177 "arch-x86/generic/string/strlcat.c",
1178 "arch-x86/generic/string/strlcpy.c",
1179 "arch-x86/generic/string/strncat.c",
1180 "arch-x86/generic/string/wcscat.c",
1181 "arch-x86/generic/string/wcscpy.c",
1182 "arch-x86/generic/string/wmemcmp.c",
1183
Elliott Hughesed777142022-07-25 16:25:11 +00001184 "arch-x86/string/sse2-memchr-atom.S",
1185 "arch-x86/string/sse2-memmove-slm.S",
1186 "arch-x86/string/sse2-memrchr-atom.S",
1187 "arch-x86/string/sse2-memset-atom.S",
1188 "arch-x86/string/sse2-memset-slm.S",
1189 "arch-x86/string/sse2-stpcpy-slm.S",
1190 "arch-x86/string/sse2-stpncpy-slm.S",
1191 "arch-x86/string/sse2-strchr-atom.S",
1192 "arch-x86/string/sse2-strcpy-slm.S",
1193 "arch-x86/string/sse2-strlen-slm.S",
1194 "arch-x86/string/sse2-strncpy-slm.S",
1195 "arch-x86/string/sse2-strnlen-atom.S",
1196 "arch-x86/string/sse2-strrchr-atom.S",
1197 "arch-x86/string/sse2-wcschr-atom.S",
1198 "arch-x86/string/sse2-wcsrchr-atom.S",
1199 "arch-x86/string/sse2-wcslen-atom.S",
1200 "arch-x86/string/sse2-wcscmp-atom.S",
1201 "arch-x86/string/sse2-strlen-atom.S",
1202
1203 "arch-x86/string/ssse3-memcmp-atom.S",
1204 "arch-x86/string/ssse3-memmove-atom.S",
1205 "arch-x86/string/ssse3-strcat-atom.S",
1206 "arch-x86/string/ssse3-strcmp-atom.S",
1207 "arch-x86/string/ssse3-strcpy-atom.S",
1208 "arch-x86/string/ssse3-strlcat-atom.S",
1209 "arch-x86/string/ssse3-strlcpy-atom.S",
1210 "arch-x86/string/ssse3-strncat-atom.S",
1211 "arch-x86/string/ssse3-strncmp-atom.S",
1212 "arch-x86/string/ssse3-strncpy-atom.S",
1213 "arch-x86/string/ssse3-wcscat-atom.S",
1214 "arch-x86/string/ssse3-wcscpy-atom.S",
1215 "arch-x86/string/ssse3-wmemcmp-atom.S",
1216
1217 "arch-x86/string/sse4-memcmp-slm.S",
1218 "arch-x86/string/sse4-wmemcmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001219
1220 "bionic/strchrnul.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001221 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001222 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001223 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001224 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001225 "arch-x86_64/bionic/__bionic_clone.S",
1226 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1227 "arch-x86_64/bionic/__restore_rt.S",
1228 "arch-x86_64/bionic/setjmp.S",
1229 "arch-x86_64/bionic/syscall.S",
1230 "arch-x86_64/bionic/vfork.S",
1231
ahs919fb7f2022-06-10 07:11:14 +05301232 "arch-x86_64/string/avx2-memset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001233 "arch-x86_64/string/sse2-memmove-slm.S",
1234 "arch-x86_64/string/sse2-memset-slm.S",
1235 "arch-x86_64/string/sse2-stpcpy-slm.S",
1236 "arch-x86_64/string/sse2-stpncpy-slm.S",
1237 "arch-x86_64/string/sse2-strcat-slm.S",
1238 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001239 "arch-x86_64/string/sse2-strlen-slm.S",
1240 "arch-x86_64/string/sse2-strncat-slm.S",
1241 "arch-x86_64/string/sse2-strncpy-slm.S",
1242 "arch-x86_64/string/sse4-memcmp-slm.S",
1243 "arch-x86_64/string/ssse3-strcmp-slm.S",
1244 "arch-x86_64/string/ssse3-strncmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001245
1246 "bionic/strchr.cpp",
1247 "bionic/strchrnul.cpp",
1248 "bionic/strnlen.cpp",
1249 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001250 ],
1251 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001252 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001253
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001254 // TODO: move to libc/bionic/legacy_32_bit_support.cpp or #if __LP64__ instead.
1255 multilib: {
1256 lib32: {
1257 srcs: ["bionic/mmap.cpp"],
1258 },
1259 },
1260
1261 local_include_dirs: ["stdio"],
1262 generated_headers: ["generated_android_ids"],
1263
1264 whole_static_libs: [
1265 "libsystemproperties",
1266 ],
1267
Colin Cross50c21ab2015-10-31 23:03:05 -07001268 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001269 include_dirs: ["bionic/libstdc++/include"],
1270 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001271}
1272
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001273genrule {
1274 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001275 out: ["generated_android_ids.h"],
1276 srcs: [":android_filesystem_config_header"],
Cole Faustb1a0a9d2023-11-28 17:51:16 -08001277 tools: ["fs_config_generator"],
1278 cmd: "$(location fs_config_generator) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001279}
1280
Dan Willemsen268a6732015-10-15 14:49:45 -07001281// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001282// libc_syscalls.a
1283// ========================================================
1284
Elliott Hughes782c4852019-04-16 12:31:00 -07001285genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001286 name: "syscalls-arm",
Elliott Hughes782c4852019-04-16 12:31:00 -07001287 out: ["syscalls-arm.S"],
1288 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001289 tools: ["gensyscalls"],
1290 cmd: "$(location gensyscalls) arm $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001291}
1292
1293genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001294 name: "syscalls-arm64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001295 out: ["syscalls-arm64.S"],
1296 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001297 tools: ["gensyscalls"],
1298 cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001299}
1300
1301genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001302 name: "syscalls-riscv64",
Elliott Hughes704772b2022-10-10 17:06:43 +00001303 out: ["syscalls-riscv64.S"],
1304 srcs: ["SYSCALLS.TXT"],
1305 tools: ["gensyscalls"],
1306 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
1307}
1308
1309genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001310 name: "syscalls-x86",
Elliott Hughes782c4852019-04-16 12:31:00 -07001311 out: ["syscalls-x86.S"],
1312 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001313 tools: ["gensyscalls"],
1314 cmd: "$(location gensyscalls) x86 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001315}
1316
1317genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001318 name: "syscalls-x86_64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001319 out: ["syscalls-x86_64.S"],
1320 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001321 tools: ["gensyscalls"],
1322 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001323}
1324
Dan Willemsen208ae172015-09-16 16:33:27 -07001325cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001326 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001327 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001328 arch: {
1329 arm: {
Cole Faustf5968d82023-04-11 15:20:19 -07001330 srcs: [":syscalls-arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001331 },
1332 arm64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001333 srcs: [":syscalls-arm64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001334 },
Elliott Hughes704772b2022-10-10 17:06:43 +00001335 riscv64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001336 srcs: [":syscalls-riscv64"],
Elliott Hughes704772b2022-10-10 17:06:43 +00001337 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001338 x86: {
Cole Faustf5968d82023-04-11 15:20:19 -07001339 srcs: [":syscalls-x86"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001340 },
1341 x86_64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001342 srcs: [":syscalls-x86_64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001343 },
1344 },
1345 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001346}
1347
1348// ========================================================
1349// libc_aeabi.a
1350// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1351// to avoid infinite recursion. For the other architectures we just build an
1352// empty library to keep this makefile simple.
1353// ========================================================
1354
1355cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001356 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001357 arch: {
1358 arm: {
1359 srcs: ["arch-arm/bionic/__aeabi.c"],
1360 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001361 },
1362 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001363 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001364}
1365
1366// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001367// libc_common.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001368// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001369
Dan Willemsen208ae172015-09-16 16:33:27 -07001370cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001371 defaults: ["libc_defaults"],
Elliott Hughesb0948922024-01-26 00:28:12 +00001372 name: "libc_common",
1373
Dan Willemsen208ae172015-09-16 16:33:27 -07001374 srcs: libc_common_src_files,
1375 multilib: {
1376 lib32: {
1377 srcs: libc_common_src_files_32,
1378 },
1379 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001380
1381 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001382 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001383 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001384 "libc_bionic",
Ryan Prichard249757b2019-11-01 17:18:28 -07001385 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001386 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001387 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001388 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001389 "libc_freebsd_large_stack",
Elliott Hughesc2043342023-07-20 20:24:09 +00001390 "libc_freebsd_ldexp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001391 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001392 "libc_netbsd",
1393 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001394 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001395 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001396 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001397 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001398 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001399 ],
1400
1401 arch: {
1402 arm: {
1403 whole_static_libs: ["libc_aeabi"],
1404 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001405 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001406}
1407
1408// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001409// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001410// ========================================================
1411cc_library_static {
1412 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001413 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001414
Haibo Huangb9244ff2018-08-11 10:12:13 -07001415 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301416 x86_64: {
1417 srcs: ["arch-x86_64/static_function_dispatch.S"],
1418 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001419 x86: {
1420 srcs: ["arch-x86/static_function_dispatch.S"],
1421 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001422 arm: {
1423 srcs: ["arch-arm/static_function_dispatch.S"],
1424 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001425 arm64: {
1426 srcs: ["arch-arm64/static_function_dispatch.S"],
1427 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001428 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001429 srcs: ["arch-riscv64/static_function_dispatch.S"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001430 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001431 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001432}
1433
1434// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001435// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001436// ========================================================
1437cc_library_static {
1438 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001439 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001440
Haibo Huangb9244ff2018-08-11 10:12:13 -07001441 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001442 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001443 "-fno-stack-protector",
1444 "-fno-jump-tables",
1445 ],
1446 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301447 x86_64: {
1448 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
1449 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001450 x86: {
1451 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1452 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001453 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001454 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001455 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001456 arm64: {
1457 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1458 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001459 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001460 srcs: ["arch-riscv64/dynamic_function_dispatch.cpp"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001461 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001462 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001463}
1464
1465// ========================================================
1466// libc_common_static.a For static binaries.
1467// ========================================================
1468cc_library_static {
1469 defaults: ["libc_defaults"],
1470 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001471
Haibo Huangf71edfa2018-11-12 10:06:56 -08001472 whole_static_libs: [
1473 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001474 "libc_static_dispatch",
1475 ],
1476}
1477
1478// ========================================================
1479// libc_common_shared.a For shared libraries.
1480// ========================================================
1481cc_library_static {
1482 defaults: ["libc_defaults"],
1483 name: "libc_common_shared",
1484
1485 whole_static_libs: [
1486 "libc_common",
1487 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001488 ],
1489}
1490
Ryan Prichard22a6a052019-10-10 23:59:30 -07001491// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1492// executable.
1493cc_library_static {
1494 name: "libc_unwind_static",
1495 defaults: ["libc_defaults"],
1496 cflags: ["-DLIBC_STATIC"],
1497
1498 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1499 arch: {
1500 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1501 arm: {
1502 srcs: ["arch-arm/bionic/exidx_static.c"],
1503 },
1504 },
1505}
1506
Haibo Huangf71edfa2018-11-12 10:06:56 -08001507// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001508// libc_nomalloc.a
1509// ========================================================
1510//
Ryan Prichard249757b2019-11-01 17:18:28 -07001511// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1512// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1513// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001514
1515cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001516 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001517 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001518
Colin Crossa3f9fca2016-01-11 13:20:55 -08001519 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001520 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001521 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001522 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001523 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001524}
1525
dimitryc0c0ef62018-12-05 16:33:52 +01001526filegroup {
1527 name: "libc_sources_shared",
1528 srcs: [
1529 "arch-common/bionic/crtbegin_so.c",
1530 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001531 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001532 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001533 "bionic/icu.cpp",
1534 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001535 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001536 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001537 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001538 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001539 "bionic/ndk_cruft.cpp",
1540 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001541 "bionic/NetdClient.cpp",
1542 "arch-common/bionic/crtend_so.S",
1543 ],
1544}
1545
1546filegroup {
1547 name: "libc_sources_static",
1548 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001549 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001550 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001551 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001552 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001553 ],
1554}
1555
1556filegroup {
1557 name: "libc_sources_shared_arm",
1558 srcs: [
1559 "arch-arm/bionic/exidx_dynamic.c",
1560 "arch-arm/bionic/atexit_legacy.c",
1561 ],
1562}
1563
Dan Willemsen208ae172015-09-16 16:33:27 -07001564// ========================================================
1565// libc.a + libc.so
1566// ========================================================
Florian Mayerc10d0642023-03-22 16:12:49 -07001567cc_defaults {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001568 defaults: [
1569 "libc_defaults",
1570 "libc_native_allocator_defaults",
1571 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001572 name: "libc_library_defaults",
Colin Cross50c21ab2015-10-31 23:03:05 -07001573 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001574 platform_sdk_version: {
1575 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1576 },
1577 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001578 static: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001579 srcs: [":libc_sources_static"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001580 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001581 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001582 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001583 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001584 "libc_init_static",
1585 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001586 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001587 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001588 },
1589 shared: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001590 srcs: [":libc_sources_shared"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001591 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001592 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001593 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001594 "libc_init_dynamic",
1595 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001596 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001597 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001598 },
1599
Neil Fullera7db90f2019-04-25 09:28:27 +01001600 required: [
MarkDacekd88d7ea2022-06-28 20:14:58 +00001601 "tzdata_prebuilt",
1602 "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
Neil Fullera7db90f2019-04-25 09:28:27 +01001603 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001604
Colin Cross4ce94d22016-11-15 13:15:43 -08001605 // Do not pack libc.so relocations; see http://b/20645321 for details.
1606 pack_relocations: false,
1607
dimitry06016f22018-01-05 11:39:28 +01001608 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1609 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1610 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1611 // those new libraries from libgcc.a are not declared external; if that were the case,
1612 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1613 // on the external symbols from the dependent libraries. That would create a "cloaked"
1614 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001615
dimitry06016f22018-01-05 11:39:28 +01001616 shared_libs: [
1617 "ld-android",
1618 "libdl",
1619 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001620 static_libs: [
1621 "libdl_android",
1622 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001623
1624 nocrt: true,
1625
Dan Willemsen208ae172015-09-16 16:33:27 -07001626 arch: {
1627 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001628 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001629 pack_relocations: false,
Christopher Ferris9d03a162023-11-10 11:19:11 -08001630 ldflags: [
1631 "-Wl,--hash-style=both",
1632 // Since we are preserving the debug_frame, do not compress
1633 // in this case to make unwinds as fast as possible.
1634 "-Wl,--compress-debug-sections=none",
1635 ],
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001636
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001637 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001638 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001639
Dan Willemsen208ae172015-09-16 16:33:27 -07001640 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001641 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001642 // special for arm
1643 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001644 // For backwards-compatibility, some arm32 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001645 static_libs: ["libclang_rt.builtins-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001646 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001647
1648 // Arm 32 bit does not produce complete exidx unwind information
1649 // so keep the .debug_frame which is relatively small and does
1650 // include needed unwind information.
1651 // See b/132992102 for details.
1652 strip: {
1653 keep_symbols_and_debug_frame: true,
1654 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001655 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001656 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001657 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001658
1659 // Leave the symbols in the shared library so that stack unwinders can produce
1660 // meaningful name resolution.
1661 strip: {
1662 keep_symbols: true,
1663 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001664 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001665 riscv64: {
1666 version_script: ":libc.riscv64.map",
1667
1668 // Leave the symbols in the shared library so that stack unwinders can produce
1669 // meaningful name resolution.
1670 strip: {
1671 keep_symbols: true,
1672 },
1673 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001674 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001675 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001676 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001677 ldflags: ["-Wl,--hash-style=both"],
1678
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001679 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001680 no_libcrt: true,
1681
1682 shared: {
1683 // For backwards-compatibility, some x86 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001684 static_libs: ["libclang_rt.builtins-exported"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001685 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001686
1687 // Leave the symbols in the shared library so that stack unwinders can produce
1688 // meaningful name resolution.
1689 strip: {
1690 keep_symbols: true,
1691 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001692 },
1693 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001694 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001695
1696 // Leave the symbols in the shared library so that stack unwinders can produce
1697 // meaningful name resolution.
1698 strip: {
1699 keep_symbols: true,
1700 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001701 },
1702 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001703
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001704 apex_available: [
1705 "//apex_available:platform",
1706 "com.android.runtime",
1707 ],
1708
Colin Cross7edd0082021-10-28 13:20:35 -07001709 target: {
1710 native_bridge: {
1711 shared: {
1712 installable: false,
1713 },
1714 },
1715 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001716}
1717
Florian Mayerc10d0642023-03-22 16:12:49 -07001718cc_library {
1719 name: "libc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001720 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001721 "libc_library_defaults",
1722 ],
1723 stubs: {
1724 symbol_file: "libc.map.txt",
1725 versions: [
1726 "29",
1727 "R",
1728 "current",
1729 ],
1730 },
1731 static_ndk_lib: true,
1732 llndk: {
1733 symbol_file: "libc.map.txt",
1734 export_headers_as_system: true,
1735 export_preprocessed_headers: ["include"],
1736 export_llndk_headers: ["libc_llndk_headers"],
1737 },
1738}
1739
1740cc_library {
1741 name: "libc_hwasan",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001742 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001743 "libc_library_defaults",
1744 ],
1745 sanitize: {
1746 hwaddress: true,
1747 },
1748 enabled: false,
Florian Mayerff116ed2023-04-14 17:38:53 -07001749 target: {
1750 android_arm64: {
Florian Mayerc10d0642023-03-22 16:12:49 -07001751 enabled: true,
1752 },
1753 },
1754 stem: "libc",
1755 relative_install_path: "hwasan",
1756 // We don't really need the stubs, but this needs to stay to trigger the
1757 // symlink logic in soong.
1758 stubs: {
1759 symbol_file: "libc.map.txt",
1760 },
1761 native_bridge_supported: false,
1762 // It is never correct to depend on this directly. This is only
1763 // needed for the runtime apex, and in base_system.mk.
1764 visibility: ["//bionic/apex"],
1765}
1766
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001767genrule {
1768 name: "libc.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001769 out: ["libc.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001770 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001771 tools: ["generate-version-script"],
1772 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001773}
1774
1775genrule {
1776 name: "libc.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001777 out: ["libc.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001778 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001779 tools: ["generate-version-script"],
1780 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001781}
1782
1783genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001784 name: "libc.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001785 out: ["libc.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001786 srcs: ["libc.map.txt"],
1787 tools: ["generate-version-script"],
1788 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1789}
1790
1791genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001792 name: "libc.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001793 out: ["libc.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001794 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001795 tools: ["generate-version-script"],
1796 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001797}
1798
1799genrule {
1800 name: "libc.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001801 out: ["libc.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001802 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001803 tools: ["generate-version-script"],
1804 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001805}
1806
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001807// Headers that only other parts of the platform can include.
1808cc_library_headers {
1809 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001810 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001811 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001812 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001813 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001814 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001815 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001816 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001817 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001818 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001819 "//system/core/debuggerd:__subpackages__",
Florian Mayerf5d70ce2022-09-13 13:58:30 -07001820 "//system/core/init:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001821 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001822 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001823 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001824 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001825 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001826 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,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001830 recovery_available: true,
1831 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001832 export_include_dirs: [
1833 "platform",
1834 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001835 system_shared_libs: [],
1836 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001837 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001838
Steven Moreland0cdf1322020-10-05 21:55:26 +00001839 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001840 apex_available: [
1841 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001842 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001843 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001844}
1845
Logan Chien17af91b2019-01-15 21:19:56 +08001846cc_library_headers {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001847 name: "libc_llndk_headers",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001848 visibility: [
1849 "//external/musl",
1850 ],
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001851 llndk: {
1852 llndk_headers: true,
1853 },
Logan Chien17af91b2019-01-15 21:19:56 +08001854 host_supported: true,
1855 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001856 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001857 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001858 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001859 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001860 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001861 apex_available: [
1862 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001863 "//apex_available:anyapex",
1864 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001865 // used by most APEXes indirectly via libunwind_llvm
1866 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001867
1868 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001869 stl: "none",
1870 system_shared_libs: [],
1871
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001872 // The build system generally requires that any dependencies of a target
1873 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1874 // to 1 we let targets with an sdk_version that need to depend on the libc
1875 // headers but cannot depend on libc itself due to circular dependencies
1876 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1877 // is correct because the headers can support any sdk_version.
1878 sdk_version: "1",
1879
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001880 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001881 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001882 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001883 "kernel/android/uapi",
1884 ],
1885
1886 arch: {
1887 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001888 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001889 },
1890 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001891 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001892 },
Elliott Hughes48e53332022-10-07 20:39:25 +00001893 riscv64: {
1894 export_system_include_dirs: ["kernel/uapi/asm-riscv"],
1895 },
Logan Chien17af91b2019-01-15 21:19:56 +08001896 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001897 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001898 },
1899 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001900 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001901 },
1902 },
1903}
1904
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001905cc_library_headers {
1906 name: "libc_headers",
1907 host_supported: true,
1908 native_bridge_supported: true,
1909 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001910 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001911 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001912 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001913 recovery_available: true,
1914 sdk_version: "1",
1915
1916 apex_available: [
1917 "//apex_available:platform",
1918 "//apex_available:anyapex",
1919 ],
1920 // used by most APEXes indirectly via libunwind_llvm
1921 min_sdk_version: "apex_inherit",
1922 visibility: [
1923 "//bionic:__subpackages__", // visible to bionic
1924 // ... and only to these places (b/152668052)
1925 "//external/arm-optimized-routines",
1926 "//external/gwp_asan",
1927 "//external/jemalloc_new",
1928 "//external/libunwind_llvm",
1929 "//external/scudo",
1930 "//system/core/property_service/libpropertyinfoparser",
1931 "//system/extras/toolchain-extras",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001932 ],
1933
1934 stl: "none",
1935 no_libcrt: true,
1936 system_shared_libs: [],
1937
1938 target: {
1939 android: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001940 export_system_include_dirs: ["include"],
1941 header_libs: ["libc_llndk_headers"],
1942 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001943 },
1944 linux_bionic: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001945 export_system_include_dirs: ["include"],
1946 header_libs: ["libc_llndk_headers"],
1947 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001948 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001949 },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001950}
1951
Dan Willemsen208ae172015-09-16 16:33:27 -07001952// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001953// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001954// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001955
Dan Willemsen208ae172015-09-16 16:33:27 -07001956cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001957 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001958 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001959 srcs: [
1960 "bionic/__cxa_guard.cpp",
1961 "bionic/__cxa_pure_virtual.cpp",
1962 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001963 ],
1964 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001965 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001966 static_libs: ["libasync_safe"],
Elliott Hughesc2043342023-07-20 20:24:09 +00001967 apex_available: [
1968 "//apex_available:platform",
1969 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001970
Dan Willemsen6b3be172018-12-03 13:57:20 -08001971 static: {
1972 system_shared_libs: [],
1973 },
Colin Crossb5bfe0b2021-07-13 16:26:28 -07001974 target: {
1975 bionic: {
1976 shared: {
1977 system_shared_libs: ["libc"],
1978 },
1979 },
Dan Willemsen6b3be172018-12-03 13:57:20 -08001980 },
1981
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001982 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001983 arch: {
1984 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001985 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001986 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001987 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001988 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001989 },
1990 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001991 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001992 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001993 riscv64: {
1994 version_script: ":libstdc++.riscv64.map",
1995 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001996 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001997 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001998 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001999 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07002000 },
2001 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002002 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07002003 },
2004 },
2005}
2006
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002007genrule {
2008 name: "libstdc++.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002009 out: ["libstdc++.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002010 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002011 tools: ["generate-version-script"],
2012 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002013}
2014
2015genrule {
2016 name: "libstdc++.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002017 out: ["libstdc++.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002018 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002019 tools: ["generate-version-script"],
2020 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002021}
2022
2023genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00002024 name: "libstdc++.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002025 out: ["libstdc++.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00002026 srcs: ["libstdc++.map.txt"],
2027 tools: ["generate-version-script"],
2028 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
2029}
2030
2031genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002032 name: "libstdc++.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002033 out: ["libstdc++.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002034 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002035 tools: ["generate-version-script"],
2036 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002037}
2038
2039genrule {
2040 name: "libstdc++.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002041 out: ["libstdc++.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002042 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002043 tools: ["generate-version-script"],
2044 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002045}
2046
2047// ========================================================
2048// crt object files.
2049// ========================================================
2050
Colin Cross50c21ab2015-10-31 23:03:05 -07002051cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002052 name: "crt_and_memtag_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002053 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002054 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002055 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002056 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002057 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002058 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002059 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002060 apex_available: [
2061 "//apex_available:platform",
2062 "//apex_available:anyapex",
2063 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002064 // Generate NDK variants of the CRT objects for every supported API level.
2065 min_sdk_version: "16",
2066 stl: "none",
2067 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002068 cflags: [
2069 "-Wno-gcc-compat",
2070 "-Wall",
2071 "-Werror",
2072 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002073 sanitize: {
2074 never: true,
2075 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002076}
2077
Colin Cross50c21ab2015-10-31 23:03:05 -07002078cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002079 name: "crt_defaults",
2080 defaults: ["crt_and_memtag_defaults"],
Colin Cross02f81372021-07-22 12:02:10 -07002081 system_shared_libs: [],
Colin Cross10d92682021-06-22 13:25:46 -07002082}
2083
2084cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002085 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002086 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002087
2088 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002089 x86: {
2090 cflags: ["-fPIC"],
2091 },
2092 x86_64: {
2093 cflags: ["-fPIC"],
2094 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002095 },
Colin Crossab179442018-09-27 11:03:22 -07002096 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002097}
2098
Dan Willemsen208ae172015-09-16 16:33:27 -07002099cc_object {
2100 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002101 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002102 local_include_dirs: [
2103 "include",
2104 "private", // crtbrand.S depends on private/bionic_asm_note.h
2105 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002106 product_variables: {
2107 platform_sdk_version: {
2108 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2109 },
2110 },
2111 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002112
Colin Cross7d7b3682017-11-03 13:38:40 -07002113 defaults: ["crt_so_defaults"],
Dan Alberteee46dc2023-04-04 23:27:52 +00002114 // crtbrand is an intermediate artifact, not a final CRT object.
2115 exclude_from_ndk_sysroot: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07002116}
2117
Dan Willemsen208ae172015-09-16 16:33:27 -07002118cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002119 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002120 local_include_dirs: ["include"],
2121 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002122
Colin Cross7d7b3682017-11-03 13:38:40 -07002123 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002124 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002125 "crtbrand",
2126 ],
2127}
2128
Dan Willemsen208ae172015-09-16 16:33:27 -07002129cc_object {
2130 name: "crtend_so",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002131 local_include_dirs: [
2132 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002133 "private", // crtend_so.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002134 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002135 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002136
Colin Cross7d7b3682017-11-03 13:38:40 -07002137 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002138}
2139
Dan Willemsen208ae172015-09-16 16:33:27 -07002140cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002141 name: "crtbegin_static",
2142
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002143 local_include_dirs: [
2144 "include",
2145 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2146 ],
Liz Kammere718dd72021-03-09 15:00:06 -05002147
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002148 cflags: ["-DCRTBEGIN_STATIC"],
Yabin Cui744cfd32023-08-24 13:20:23 -07002149
Dan Willemsen208ae172015-09-16 16:33:27 -07002150 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002151 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002152 "crtbrand",
2153 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002154 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002155 // When using libc.a, we're using the latest library regardless of target API level.
2156 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002157}
2158
Dan Willemsen208ae172015-09-16 16:33:27 -07002159cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002160 name: "crtbegin_dynamic",
2161
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002162 local_include_dirs: [
2163 "include",
2164 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2165 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002166 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002167 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002168 "crtbrand",
2169 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002170 target: {
2171 linux_bionic: {
2172 generated_sources: ["host_bionic_linker_asm"],
2173 objs: [
2174 "linker_wrapper",
2175 ],
2176 },
2177 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002178 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002179}
2180
Dan Willemsen208ae172015-09-16 16:33:27 -07002181cc_object {
2182 // We rename crtend.o to crtend_android.o to avoid a
2183 // name clash between gcc and bionic.
2184 name: "crtend_android",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002185 local_include_dirs: [
2186 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002187 "private", // crtend.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002188 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002189 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002190
Colin Cross50c21ab2015-10-31 23:03:05 -07002191 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002192}
Colin Crossbaa48992016-07-13 11:15:21 -07002193
Kalesh Singh862a23d2024-01-09 13:13:50 -08002194cc_object {
2195 name: "crt_pad_segment",
2196 local_include_dirs: [
2197 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002198 "private", // crt_pad_segment.S depends on private/bionic_asm_note.h
Kalesh Singh862a23d2024-01-09 13:13:50 -08002199 ],
2200 srcs: ["arch-common/bionic/crt_pad_segment.S"],
2201
2202 defaults: ["crt_defaults"],
2203}
2204
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002205cc_library_static {
2206 name: "note_memtag_heap_async",
2207 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002208 arm64: {
2209 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2210 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002211 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002212 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002213
Colin Cross10d92682021-06-22 13:25:46 -07002214 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002215}
2216
2217cc_library_static {
2218 name: "note_memtag_heap_sync",
2219 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002220 arm64: {
2221 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2222 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002223 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002224 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002225
Colin Cross10d92682021-06-22 13:25:46 -07002226 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002227}
2228
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002229// ========================================================
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002230// libc dependencies for baremetal Rust projects.
2231// ========================================================
2232
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002233// This library contains the following unresolved symbols:
2234// __errno
2235// abort
2236// async_safe_fatal_va_list
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002237cc_library_static {
2238 name: "librust_baremetal",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002239 header_libs: ["libc_headers"],
2240 include_dirs: [
2241 "bionic/libc/async_safe/include",
2242 "bionic/libc/platform",
2243 ],
2244 cflags: [
2245 "-Wall",
2246 "-Werror",
2247 ],
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002248 srcs: [
2249 "bionic/fortify.cpp",
Pierre-Clément Tosi816176c2022-11-30 14:33:41 +00002250 "bionic/strtol.cpp",
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002251 ],
2252 arch: {
2253 arm64: {
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002254 srcs: [
2255 "arch-arm64/string/__memcpy_chk.S",
2256 ],
2257 },
caowencheng9a39eb32023-03-20 16:24:41 +08002258 riscv64: {
2259 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002260 "arch-riscv64/string/__memcpy_chk.S",
caowencheng9a39eb32023-03-20 16:24:41 +08002261 ],
2262 },
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002263 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002264 whole_static_libs: [
2265 "libarm-optimized-routines-mem",
Pierre-Clément Tosieb46ac92023-02-01 13:44:57 +00002266 "libc_netbsd",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002267 ],
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002268 system_shared_libs: [],
2269 nocrt: true,
2270 stl: "none",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002271 visibility: [
2272 "//packages/modules/Virtualization/vmbase",
2273 ],
2274}
2275
2276// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002277// NDK headers.
2278// ========================================================
2279
Dan Albert26e1c412018-05-24 14:56:46 -07002280versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002281 name: "common_libc",
2282 from: "include",
2283 to: "",
2284 license: "NOTICE",
2285}
Dan Albert4238a352016-06-28 11:18:05 -07002286
2287ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002288 name: "libc_uapi",
2289 from: "kernel/uapi",
2290 to: "",
2291 srcs: [
2292 "kernel/uapi/asm-generic/**/*.h",
2293 "kernel/uapi/drm/**/*.h",
2294 "kernel/uapi/linux/**/*.h",
2295 "kernel/uapi/misc/**/*.h",
2296 "kernel/uapi/mtd/**/*.h",
2297 "kernel/uapi/rdma/**/*.h",
2298 "kernel/uapi/scsi/**/*.h",
2299 "kernel/uapi/sound/**/*.h",
2300 "kernel/uapi/video/**/*.h",
2301 "kernel/uapi/xen/**/*.h",
2302 ],
Dan Albert92592652016-10-20 01:42:54 -07002303 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002304}
2305
2306ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002307 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002308 from: "kernel/android/uapi/linux",
2309 to: "linux",
2310 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002311 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002312}
2313
2314ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002315 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002316 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002317 to: "scsi",
2318 srcs: ["kernel/android/scsi/**/*.h"],
2319 license: "NOTICE",
2320}
2321
2322ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002323 name: "libc_asm_arm",
2324 from: "kernel/uapi/asm-arm",
2325 to: "arm-linux-androideabi",
2326 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002327 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002328}
2329
2330ndk_headers {
2331 name: "libc_asm_arm64",
2332 from: "kernel/uapi/asm-arm64",
2333 to: "aarch64-linux-android",
2334 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002335 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002336}
2337
Lazar Trsic790d2f72017-11-27 11:54:11 +01002338ndk_headers {
Colin Crossbd26e0f2022-10-19 15:03:14 -07002339 name: "libc_asm_riscv64",
2340 from: "kernel/uapi/asm-riscv",
2341 to: "riscv64-linux-android",
2342 srcs: ["kernel/uapi/asm-riscv/**/*.h"],
2343 license: "NOTICE",
2344}
2345
2346ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002347 name: "libc_asm_x86",
2348 from: "kernel/uapi/asm-x86",
2349 to: "i686-linux-android",
2350 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002351 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002352}
2353
2354ndk_headers {
2355 name: "libc_asm_x86_64",
2356 from: "kernel/uapi/asm-x86",
2357 to: "x86_64-linux-android",
2358 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002359 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002360}
2361
Dan Albert4238a352016-06-28 11:18:05 -07002362ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002363 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002364 symbol_file: "libc.map.txt",
2365 first_version: "9",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002366 export_header_libs: [
2367 "common_libc",
2368 "libc_uapi",
2369 "libc_kernel_android_uapi_linux",
2370 "libc_kernel_android_scsi",
2371 "libc_asm_arm",
2372 "libc_asm_arm64",
Colin Crossbd26e0f2022-10-19 15:03:14 -07002373 "libc_asm_riscv64",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002374 "libc_asm_x86",
2375 "libc_asm_x86_64",
2376 ],
Dan Albert4238a352016-06-28 11:18:05 -07002377}
2378
Dan Albertdf31aff2016-10-06 15:50:41 -07002379ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002380 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002381 symbol_file: "libstdc++.map.txt",
2382 first_version: "9",
2383}
2384
Dan Willemsenca056d72018-01-08 14:00:24 -08002385// Export these headers for toolbox to process
2386filegroup {
2387 name: "kernel_input_headers",
2388 srcs: [
2389 "kernel/uapi/linux/input.h",
2390 "kernel/uapi/linux/input-event-codes.h",
2391 ],
2392}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002393
2394// Generate a syscall name / number mapping. These objects are text files
2395// (thanks to the -dD -E flags) and not binary files. They will then be
2396// consumed by the genseccomp.py script and converted into C++ code.
2397cc_defaults {
2398 name: "libseccomp_gen_syscall_nrs_defaults",
2399 recovery_available: true,
2400 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2401 cflags: [
2402 "-dD",
2403 "-E",
2404 "-Wall",
2405 "-Werror",
2406 "-nostdinc",
2407 ],
2408}
2409
2410cc_object {
2411 name: "libseccomp_gen_syscall_nrs_arm",
2412 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2413 local_include_dirs: [
2414 "kernel/uapi/asm-arm",
2415 "kernel/uapi",
2416 ],
2417}
2418
2419cc_object {
2420 name: "libseccomp_gen_syscall_nrs_arm64",
2421 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2422 local_include_dirs: [
2423 "kernel/uapi/asm-arm64",
2424 "kernel/uapi",
2425 ],
2426}
2427
2428cc_object {
Elliott Hughes704772b2022-10-10 17:06:43 +00002429 name: "libseccomp_gen_syscall_nrs_riscv64",
2430 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2431 local_include_dirs: [
2432 "kernel/uapi/asm-riscv",
2433 "kernel/uapi",
2434 ],
2435}
2436
2437cc_object {
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002438 name: "libseccomp_gen_syscall_nrs_x86",
2439 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2440 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2441 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2442 local_include_dirs: [
2443 "kernel/uapi/asm-x86",
2444 "kernel/uapi",
2445 ],
2446}
2447
2448cc_object {
2449 name: "libseccomp_gen_syscall_nrs_x86_64",
2450 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2451 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2452 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2453 local_include_dirs: [
2454 "kernel/uapi/asm-x86",
2455 "kernel/uapi",
2456 ],
2457}
2458
Jingwen Chenca366332021-01-29 05:16:32 -05002459filegroup {
2460 name: "all_kernel_uapi_headers",
2461 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002462}
2463
Martijn Coenen0c6de752019-01-02 12:52:51 +01002464cc_genrule {
2465 name: "func_to_syscall_nrs",
2466 recovery_available: true,
2467 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2468
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002469 tools: ["genfunctosyscallnrs"],
Martijn Coenen0c6de752019-01-02 12:52:51 +01002470
2471 srcs: [
2472 "SYSCALLS.TXT",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002473 ],
2474
Elliott Hughes704772b2022-10-10 17:06:43 +00002475 arch: {
2476 arm: {
2477 srcs: [
2478 ":libseccomp_gen_syscall_nrs_arm",
2479 ":libseccomp_gen_syscall_nrs_arm64",
2480 ],
2481 },
2482 arm64: {
2483 srcs: [
2484 ":libseccomp_gen_syscall_nrs_arm",
2485 ":libseccomp_gen_syscall_nrs_arm64",
2486 ],
2487 },
2488 riscv64: {
2489 srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
2490 },
2491 x86: {
2492 srcs: [
2493 ":libseccomp_gen_syscall_nrs_x86",
2494 ":libseccomp_gen_syscall_nrs_x86_64",
2495 ],
2496 },
2497 x86_64: {
2498 srcs: [
2499 ":libseccomp_gen_syscall_nrs_x86",
2500 ":libseccomp_gen_syscall_nrs_x86_64",
2501 ],
2502 },
2503 },
2504
Martijn Coenen0c6de752019-01-02 12:52:51 +01002505 out: [
2506 "func_to_syscall_nrs.h",
2507 ],
2508}
2509
Victor Hsiehdbb86702020-06-15 09:29:07 -07002510// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002511genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002512 name: "generate_app_zygote_blocklist",
2513 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2514 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002515 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2516}
2517
Yu Liu938ec9b2022-10-17 16:36:30 -07002518filegroup {
2519 name: "seccomp_syscalls_sources_zygote",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002520 srcs: [
2521 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002522 "SECCOMP_ALLOWLIST_COMMON.TXT",
2523 "SECCOMP_ALLOWLIST_APP.TXT",
2524 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002525 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002526 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002527 ],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002528}
2529
Yu Liu938ec9b2022-10-17 16:36:30 -07002530filegroup {
2531 name: "seccomp_syscalls_sources_app",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002532 srcs: [
2533 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002534 "SECCOMP_ALLOWLIST_COMMON.TXT",
2535 "SECCOMP_ALLOWLIST_APP.TXT",
2536 "SECCOMP_BLOCKLIST_COMMON.TXT",
2537 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002538 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002539 ],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002540}
2541
Yu Liu938ec9b2022-10-17 16:36:30 -07002542filegroup {
2543 name: "seccomp_syscalls_sources_system",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002544 srcs: [
2545 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002546 "SECCOMP_ALLOWLIST_COMMON.TXT",
2547 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2548 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002549 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002550 ],
Yu Liu938ec9b2022-10-17 16:36:30 -07002551}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002552
Yu Liu938ec9b2022-10-17 16:36:30 -07002553cc_genrule {
2554 name: "libseccomp_policy_app_zygote_sources_x86",
2555 recovery_available: true,
2556 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002557 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002558 srcs: [
2559 ":seccomp_syscalls_sources_zygote",
2560 ":libseccomp_gen_syscall_nrs_x86",
2561 ":libseccomp_gen_syscall_nrs_x86_64",
2562 ],
2563 out: [
2564 "x86_app_zygote_policy.cpp",
2565 "x86_64_app_zygote_policy.cpp",
2566 ],
2567 enabled: false,
Yu Liu3a579692022-10-18 03:02:32 +00002568 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002569 x86: {
2570 enabled: true,
2571 },
2572 x86_64: {
2573 enabled: true,
2574 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002575 },
2576}
2577
2578cc_genrule {
2579 name: "libseccomp_policy_app_zygote_sources_arm",
2580 recovery_available: true,
2581 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002582 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002583 srcs: [
2584 ":seccomp_syscalls_sources_zygote",
2585 ":libseccomp_gen_syscall_nrs_arm",
2586 ":libseccomp_gen_syscall_nrs_arm64",
2587 ],
2588 out: [
2589 "arm_app_zygote_policy.cpp",
2590 "arm64_app_zygote_policy.cpp",
2591 ],
2592 enabled: false,
2593 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002594 arm: {
2595 enabled: true,
2596 },
2597 arm64: {
2598 enabled: true,
2599 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002600 },
2601}
2602
2603cc_genrule {
2604 name: "libseccomp_policy_app_zygote_sources_riscv64",
2605 recovery_available: true,
2606 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002607 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002608 srcs: [
2609 ":seccomp_syscalls_sources_zygote",
2610 ":libseccomp_gen_syscall_nrs_riscv64",
2611 ],
2612 out: [
2613 "riscv64_app_zygote_policy.cpp",
2614 ],
2615 enabled: false,
2616 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002617 riscv64: {
2618 enabled: true,
2619 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002620 },
2621}
2622
2623cc_genrule {
2624 name: "libseccomp_policy_app_sources_x86",
2625 recovery_available: true,
2626 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002627 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002628 srcs: [
2629 ":seccomp_syscalls_sources_app",
2630 ":libseccomp_gen_syscall_nrs_x86",
2631 ":libseccomp_gen_syscall_nrs_x86_64",
2632 ],
2633 out: [
2634 "x86_app_policy.cpp",
2635 "x86_64_app_policy.cpp",
2636 ],
2637 enabled: false,
2638 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002639 x86: {
2640 enabled: true,
2641 },
2642 x86_64: {
2643 enabled: true,
2644 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002645 },
2646}
2647
2648cc_genrule {
2649 name: "libseccomp_policy_app_sources_arm",
2650 recovery_available: true,
2651 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002652 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002653 srcs: [
2654 ":seccomp_syscalls_sources_app",
2655 ":libseccomp_gen_syscall_nrs_arm",
2656 ":libseccomp_gen_syscall_nrs_arm64",
2657 ],
2658 out: [
2659 "arm_app_policy.cpp",
2660 "arm64_app_policy.cpp",
2661 ],
2662 enabled: false,
2663 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002664 arm: {
2665 enabled: true,
2666 },
2667 arm64: {
2668 enabled: true,
2669 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002670 },
2671}
2672
2673cc_genrule {
2674 name: "libseccomp_policy_app_sources_riscv64",
2675 recovery_available: true,
2676 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002677 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002678 srcs: [
2679 ":seccomp_syscalls_sources_app",
2680 ":libseccomp_gen_syscall_nrs_riscv64",
2681 ],
2682 out: [
2683 "riscv64_app_policy.cpp",
2684 ],
2685 enabled: false,
2686 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002687 riscv64: {
2688 enabled: true,
2689 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002690 },
2691}
2692
2693cc_genrule {
2694 name: "libseccomp_policy_system_sources_x86",
2695 recovery_available: true,
2696 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002697 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002698 srcs: [
2699 ":seccomp_syscalls_sources_system",
2700 ":libseccomp_gen_syscall_nrs_x86",
2701 ":libseccomp_gen_syscall_nrs_x86_64",
2702 ],
2703 out: [
2704 "x86_system_policy.cpp",
2705 "x86_64_system_policy.cpp",
2706 ],
2707 enabled: false,
2708 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002709 x86: {
2710 enabled: true,
2711 },
2712 x86_64: {
2713 enabled: true,
2714 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002715 },
2716}
2717
2718cc_genrule {
2719 name: "libseccomp_policy_system_sources_arm",
2720 recovery_available: true,
2721 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002722 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002723 srcs: [
2724 ":seccomp_syscalls_sources_system",
2725 ":libseccomp_gen_syscall_nrs_arm",
2726 ":libseccomp_gen_syscall_nrs_arm64",
2727 ],
2728 out: [
2729 "arm_system_policy.cpp",
2730 "arm64_system_policy.cpp",
2731 ],
2732 enabled: false,
2733 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002734 arm: {
2735 enabled: true,
2736 },
2737 arm64: {
2738 enabled: true,
2739 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002740 },
2741}
2742
2743cc_genrule {
2744 name: "libseccomp_policy_system_sources_riscv64",
2745 recovery_available: true,
2746 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002747 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002748 srcs: [
2749 ":seccomp_syscalls_sources_system",
2750 ":libseccomp_gen_syscall_nrs_riscv64",
2751 ],
2752 out: [
2753 "riscv64_system_policy.cpp",
2754 ],
2755 enabled: false,
2756 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002757 riscv64: {
2758 enabled: true,
2759 },
Yu Liu3a579692022-10-18 03:02:32 +00002760 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002761}
2762
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002763cc_library {
2764 name: "libseccomp_policy",
2765 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002766 generated_headers: ["func_to_syscall_nrs"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002767
2768 arch: {
2769 arm: {
2770 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002771 "libseccomp_policy_app_sources_arm",
2772 "libseccomp_policy_app_zygote_sources_arm",
2773 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002774 ],
2775 },
2776 arm64: {
2777 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002778 "libseccomp_policy_app_sources_arm",
2779 "libseccomp_policy_app_zygote_sources_arm",
2780 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002781 ],
2782 },
2783 riscv64: {
2784 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002785 "libseccomp_policy_app_sources_riscv64",
2786 "libseccomp_policy_app_zygote_sources_riscv64",
2787 "libseccomp_policy_system_sources_riscv64",
Yu Liu938ec9b2022-10-17 16:36:30 -07002788 ],
2789 },
2790 x86: {
2791 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002792 "libseccomp_policy_app_sources_x86",
2793 "libseccomp_policy_app_zygote_sources_x86",
2794 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002795 ],
2796 },
2797 x86_64: {
2798 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002799 "libseccomp_policy_app_sources_x86",
2800 "libseccomp_policy_app_zygote_sources_x86",
2801 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002802 ],
2803 },
2804 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002805
2806 srcs: [
2807 "seccomp/seccomp_policy.cpp",
2808 ],
2809
2810 export_include_dirs: ["seccomp/include"],
2811 cflags: [
2812 "-Wall",
2813 "-Werror",
2814 ],
2815 shared: {
2816 shared_libs: ["libbase"],
2817 },
2818 static: {
2819 static_libs: ["libbase"],
2820 },
2821}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002822
Colin Cross048f24e2021-09-01 17:26:00 -07002823cc_library_host_static {
2824 name: "libfts",
2825 srcs: [
2826 "bionic/fts.c",
2827 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
2828 ],
2829 export_include_dirs: ["fts/include"],
2830 local_include_dirs: [
2831 "private",
2832 "upstream-openbsd/android/include",
2833 ],
2834 cflags: [
2835 "-include openbsd-compat.h",
2836 "-Wno-unused-parameter",
2837 ],
2838 enabled: false,
2839 target: {
2840 musl: {
2841 enabled: true,
2842 },
2843 },
Colin Cross2a9843f2022-01-13 12:26:30 -08002844 stl: "none",
2845}
2846
2847cc_library_host_static {
2848 name: "libexecinfo",
2849 visibility: ["//external/musl"],
2850 srcs: ["bionic/execinfo.cpp"],
2851 export_include_dirs: ["execinfo/include"],
2852 local_include_dirs: ["private"],
2853 enabled: false,
2854 target: {
2855 musl: {
2856 enabled: true,
2857 system_shared_libs: [],
2858 header_libs: ["libc_musl_headers"],
2859 },
2860 },
2861 stl: "none",
Colin Cross048f24e2021-09-01 17:26:00 -07002862}
2863
Colin Cross9da85fa2022-01-24 18:20:05 -08002864cc_library_host_static {
2865 name: "libb64",
2866 visibility: ["//external/musl"],
2867 srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
2868 export_include_dirs: ["b64/include"],
2869 local_include_dirs: [
2870 "private",
2871 "upstream-openbsd/android/include",
2872 ],
2873 cflags: [
2874 "-include openbsd-compat.h",
2875 ],
2876 enabled: false,
2877 target: {
2878 musl: {
2879 enabled: true,
2880 system_shared_libs: [],
2881 header_libs: ["libc_musl_headers"],
2882 },
2883 },
2884 stl: "none",
2885}
2886
Colin Cross9d4a56e2022-02-03 10:20:32 -08002887// Export kernel uapi headers to be used in the musl sysroot.
2888// Also include the execinfo headers for the libexecinfo and the
2889// b64 headers for libb64 embedded in musl libc.
2890cc_genrule {
2891 name: "libc_musl_sysroot_bionic_headers",
2892 visibility: ["//external/musl"],
2893 host_supported: true,
2894 device_supported: false,
2895 enabled: false,
2896 target: {
2897 musl: {
2898 enabled: true,
2899 },
2900 },
2901 srcs: [
2902 "kernel/uapi/**/*.h",
2903 "kernel/android/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002904 "execinfo/include/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002905 "b64/include/**/*.h",
Colin Crossaeef9f02022-02-07 21:01:26 -08002906
Colin Crossaeef9f02022-02-07 21:01:26 -08002907 "NOTICE",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002908
2909 ":libc_musl_sysroot_bionic_arch_headers",
2910 ],
2911 out: ["libc_musl_sysroot_bionic_headers.zip"],
2912 tools: [
2913 "soong_zip",
2914 "merge_zips",
2915 "zip2zip",
2916 ],
Colin Crossaeef9f02022-02-07 21:01:26 -08002917 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
2918 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
Colin Crossad33d022022-02-25 18:27:04 -08002919 // NOTICE
2920 " -j -f $(location NOTICE) " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002921 // headers
2922 " -P include " +
Colin Crossaeef9f02022-02-07 21:01:26 -08002923 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
2924 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
2925 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2926 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2927 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2928 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2929 " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
2930 " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
2931 " -C $${BIONIC_LIBC_DIR}/b64/include " +
2932 " -D $${BIONIC_LIBC_DIR}/b64/include " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002933 " && " +
Colin Crossad33d022022-02-25 18:27:04 -08002934 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
Colin Cross1c0a7a02022-08-11 12:22:26 -07002935 " -x **/BUILD " +
Colin Crossad33d022022-02-25 18:27:04 -08002936 " include/**/*:include/ " +
2937 " NOTICE:NOTICE.bionic " +
2938 " && " +
2939 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002940}
2941
2942// The architecture-specific bits have to be handled separately because the label varies based
2943// on architecture, which prevents using $(locations) to find them and requires using $(in)
2944// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
2945// genrule.
2946cc_genrule {
2947 name: "libc_musl_sysroot_bionic_arch_headers",
2948 visibility: ["//visibility:private"],
2949 host_supported: true,
2950 device_supported: false,
2951 enabled: false,
2952 target: {
2953 musl: {
2954 enabled: true,
2955 },
2956 },
2957 arch: {
2958 arm: {
2959 srcs: ["kernel/uapi/asm-arm/**/*.h"],
2960 },
2961 arm64: {
2962 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
2963 },
2964 x86: {
2965 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2966 },
2967 x86_64: {
2968 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2969 },
2970 },
2971 out: ["libc_musl_sysroot_bionic_arch_headers.zip"],
2972 tools: ["soong_zip"],
2973 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
2974}
Colin Cross290c4952022-10-13 12:51:13 -07002975
2976cc_genrule {
2977 name: "bionic_sysroot_crt_objects",
2978 visibility: ["//visibility:private"],
2979 out: ["bionic_sysroot_crt_objects.zip"],
2980 tools: ["soong_zip"],
2981 srcs: [
2982 ":crtbegin_dynamic",
2983 ":crtbegin_so",
2984 ":crtbegin_static",
2985 ":crtend_android",
2986 ":crtend_so",
2987 ],
2988 cmd: "$(location soong_zip) -o $(out) -j " +
2989 "-f $(location :crtbegin_dynamic) " +
2990 "-f $(location :crtbegin_so) " +
2991 "-f $(location :crtbegin_static) " +
2992 "-f $(location :crtend_android) " +
2993 "-f $(location :crtend_so)",
2994 dist: {
2995 targets: ["bionic_sysroot_crt_objects"],
2996 },
2997 arch: {
2998 arm: {
2999 dist: {
3000 suffix: "_arm",
3001 },
3002 },
3003 arm64: {
3004 dist: {
3005 suffix: "_arm64",
3006 },
3007 },
3008 riscv64: {
3009 dist: {
3010 suffix: "_riscv64",
3011 },
3012 },
3013 x86: {
3014 dist: {
3015 suffix: "_x86",
3016 },
3017 },
3018 x86_64: {
3019 dist: {
3020 suffix: "_x86_64",
3021 },
3022 },
3023 },
3024}
Spandan Das8fce52a2023-09-28 18:00:12 +00003025
3026// headers that will be placed on the include path when running versioner in bazel
3027// this module should be a no-op in soong
3028filegroup {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00003029 name: "versioner-dependencies",
3030 srcs: ["versioner-dependencies/**/*"],
Spandan Das8fce52a2023-09-28 18:00:12 +00003031}