blob: 825b95bcf538aea133f5b6264124b3045ee71a03 [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: [
Josh Gao10ec9282017-04-03 15:13:29 -0700836 "bionic/android_set_abort_message.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000837 "bionic/android_unsafe_frame_pointer_chase.cpp",
838 "bionic/atexit.cpp",
839 "bionic/bionic_elf_tls.cpp",
840 "bionic/__cxa_thread_atexit_impl.cpp",
841 "bionic/fork.cpp",
842 "bionic/pthread_atfork.cpp",
843 "bionic/pthread_attr.cpp",
844 "bionic/pthread_barrier.cpp",
845 "bionic/pthread_cond.cpp",
846 "bionic/pthread_create.cpp",
847 "bionic/pthread_detach.cpp",
848 "bionic/pthread_equal.cpp",
849 "bionic/pthread_exit.cpp",
850 "bionic/pthread_getcpuclockid.cpp",
851 "bionic/pthread_getschedparam.cpp",
852 "bionic/pthread_gettid_np.cpp",
853 "bionic/pthread_internal.cpp",
854 "bionic/pthread_join.cpp",
855 "bionic/pthread_key.cpp",
856 "bionic/pthread_kill.cpp",
857 "bionic/pthread_mutex.cpp",
858 "bionic/pthread_once.cpp",
859 "bionic/pthread_rwlock.cpp",
860 "bionic/pthread_sigqueue.cpp",
861 "bionic/pthread_self.cpp",
862 "bionic/pthread_setname_np.cpp",
863 "bionic/pthread_setschedparam.cpp",
864 "bionic/pthread_spinlock.cpp",
865 "bionic/setjmp_cookie.cpp",
866 "bionic/sysconf.cpp",
867 "bionic/sys_thread_properties.cpp",
868 "bionic/vdso.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700869 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700870
871 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700872 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700873 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700874 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800875 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700876 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700877 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700878 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700879 "arch-arm/bionic/atomics_arm.c",
880 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800881 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700882 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700883 "arch-arm/bionic/setjmp.S",
884 "arch-arm/bionic/syscall.S",
885 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800886
Haibo Huangea9957a2018-11-19 11:00:32 -0800887 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800888 "arch-arm/cortex-a7/bionic/memset.S",
889
890 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800891 "arch-arm/cortex-a9/bionic/memset.S",
892 "arch-arm/cortex-a9/bionic/stpcpy.S",
893 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800894 "arch-arm/cortex-a9/bionic/strcpy.S",
895 "arch-arm/cortex-a9/bionic/strlen.S",
896
Elliott Hughesaefe9992023-11-08 12:04:41 -0800897 "arch-arm/cortex-a15/bionic/memcpy.S",
898 "arch-arm/cortex-a15/bionic/memmove.S",
899 "arch-arm/cortex-a15/bionic/memset.S",
900 "arch-arm/cortex-a15/bionic/stpcpy.S",
901 "arch-arm/cortex-a15/bionic/strcat.S",
902 "arch-arm/cortex-a15/bionic/strcmp.S",
903 "arch-arm/cortex-a15/bionic/strcpy.S",
904 "arch-arm/cortex-a15/bionic/strlen.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800905
906 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800907
Haibo Huang01bfd892018-12-03 15:05:16 -0800908 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800909
Elliott Hughesaefe9992023-11-08 12:04:41 -0800910 "arch-arm/generic/bionic/memcmp.S",
911 "arch-arm/generic/bionic/memmove.S",
912 "arch-arm/generic/bionic/memset.S",
913 "arch-arm/generic/bionic/stpcpy.c",
914 "arch-arm/generic/bionic/strcat.c",
915 "arch-arm/generic/bionic/strcmp.S",
916 "arch-arm/generic/bionic/strcpy.S",
917 "arch-arm/generic/bionic/strlen.c",
918
919 "arch-arm/krait/bionic/memcpy.S",
920 "arch-arm/krait/bionic/memset.S",
921
Haibo Huangea9957a2018-11-19 11:00:32 -0800922 "arch-arm/kryo/bionic/memcpy.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -0800923
924 "bionic/strchr.cpp",
925 "bionic/strchrnul.cpp",
926 "bionic/strnlen.cpp",
927 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700928 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700929 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700930 arm64: {
931 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800932 "arch-arm64/bionic/__bionic_clone.S",
933 "arch-arm64/bionic/_exit_with_stack_teardown.S",
934 "arch-arm64/bionic/setjmp.S",
935 "arch-arm64/bionic/syscall.S",
936 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700937 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700938 },
939
Elliott Hughesebc19a92022-10-14 23:25:36 +0000940 riscv64: {
941 srcs: [
942 "arch-riscv64/bionic/__bionic_clone.S",
943 "arch-riscv64/bionic/_exit_with_stack_teardown.S",
Elliott Hughese1905ed2022-10-17 23:23:36 +0000944 "arch-riscv64/bionic/setjmp.S",
Elliott Hughesebc19a92022-10-14 23:25:36 +0000945 "arch-riscv64/bionic/syscall.S",
946 "arch-riscv64/bionic/vfork.S",
Yun Hsiang40a82d02023-05-26 10:10:40 +0800947
Elliott Hughesaefe9992023-11-08 12:04:41 -0800948 "arch-riscv64/string/memchr_v.S",
949 "arch-riscv64/string/memcmp_v.S",
950 "arch-riscv64/string/memcpy_v.S",
951 "arch-riscv64/string/memmove_v.S",
952 "arch-riscv64/string/memset_v.S",
953 "arch-riscv64/string/stpcpy_v.S",
954 "arch-riscv64/string/strcat_v.S",
955 "arch-riscv64/string/strchr_v.S",
956 "arch-riscv64/string/strcmp_v.S",
957 "arch-riscv64/string/strcpy_v.S",
958 "arch-riscv64/string/strlen_v.S",
959 "arch-riscv64/string/strncat_v.S",
960 "arch-riscv64/string/strncmp_v.S",
961 "arch-riscv64/string/strncpy_v.S",
962 "arch-riscv64/string/strnlen_v.S",
963
964 "arch-riscv64/string/memchr.c",
965 "arch-riscv64/string/memcmp.c",
966 "arch-riscv64/string/memcpy.c",
967 "arch-riscv64/string/memmove.c",
968 "arch-riscv64/string/memset.c",
969 "arch-riscv64/string/stpcpy.c",
970 "arch-riscv64/string/strcat.c",
971 "arch-riscv64/string/strchr.c",
972 "arch-riscv64/string/strcmp.c",
973 "arch-riscv64/string/strcpy.c",
974 "arch-riscv64/string/strlen.c",
975 "arch-riscv64/string/strncat.c",
976 "arch-riscv64/string/strncmp.c",
977 "arch-riscv64/string/strncpy.c",
978 "arch-riscv64/string/strnlen.c",
Prashanth Swaminathana4d71022023-10-30 17:35:19 -0700979
Elliott Hughes7d136662023-10-27 15:40:32 -0700980 "bionic/strchrnul.cpp",
981 "bionic/strrchr.cpp",
Elliott Hughesebc19a92022-10-14 23:25:36 +0000982 ],
983 },
984
Dan Willemsen208ae172015-09-16 16:33:27 -0700985 x86: {
986 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700987 "arch-x86/bionic/__bionic_clone.S",
988 "arch-x86/bionic/_exit_with_stack_teardown.S",
989 "arch-x86/bionic/libcrt_compat.c",
Elliott Hughes7d136662023-10-27 15:40:32 -0700990 "arch-x86/bionic/setjmp.S",
991 "arch-x86/bionic/syscall.S",
992 "arch-x86/bionic/vfork.S",
993 "arch-x86/bionic/__x86.get_pc_thunk.S",
994
Dan Willemsen208ae172015-09-16 16:33:27 -0700995 "arch-x86/generic/string/memcmp.S",
996 "arch-x86/generic/string/strcmp.S",
997 "arch-x86/generic/string/strncmp.S",
998 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700999
1000 "arch-x86/generic/string/strlcat.c",
1001 "arch-x86/generic/string/strlcpy.c",
1002 "arch-x86/generic/string/strncat.c",
1003 "arch-x86/generic/string/wcscat.c",
1004 "arch-x86/generic/string/wcscpy.c",
1005 "arch-x86/generic/string/wmemcmp.c",
1006
Elliott Hughesed777142022-07-25 16:25:11 +00001007 "arch-x86/string/sse2-memchr-atom.S",
1008 "arch-x86/string/sse2-memmove-slm.S",
1009 "arch-x86/string/sse2-memrchr-atom.S",
1010 "arch-x86/string/sse2-memset-atom.S",
1011 "arch-x86/string/sse2-memset-slm.S",
1012 "arch-x86/string/sse2-stpcpy-slm.S",
1013 "arch-x86/string/sse2-stpncpy-slm.S",
1014 "arch-x86/string/sse2-strchr-atom.S",
1015 "arch-x86/string/sse2-strcpy-slm.S",
1016 "arch-x86/string/sse2-strlen-slm.S",
1017 "arch-x86/string/sse2-strncpy-slm.S",
1018 "arch-x86/string/sse2-strnlen-atom.S",
1019 "arch-x86/string/sse2-strrchr-atom.S",
1020 "arch-x86/string/sse2-wcschr-atom.S",
1021 "arch-x86/string/sse2-wcsrchr-atom.S",
1022 "arch-x86/string/sse2-wcslen-atom.S",
1023 "arch-x86/string/sse2-wcscmp-atom.S",
1024 "arch-x86/string/sse2-strlen-atom.S",
1025
1026 "arch-x86/string/ssse3-memcmp-atom.S",
1027 "arch-x86/string/ssse3-memmove-atom.S",
1028 "arch-x86/string/ssse3-strcat-atom.S",
1029 "arch-x86/string/ssse3-strcmp-atom.S",
1030 "arch-x86/string/ssse3-strcpy-atom.S",
1031 "arch-x86/string/ssse3-strlcat-atom.S",
1032 "arch-x86/string/ssse3-strlcpy-atom.S",
1033 "arch-x86/string/ssse3-strncat-atom.S",
1034 "arch-x86/string/ssse3-strncmp-atom.S",
1035 "arch-x86/string/ssse3-strncpy-atom.S",
1036 "arch-x86/string/ssse3-wcscat-atom.S",
1037 "arch-x86/string/ssse3-wcscpy-atom.S",
1038 "arch-x86/string/ssse3-wmemcmp-atom.S",
1039
1040 "arch-x86/string/sse4-memcmp-slm.S",
1041 "arch-x86/string/sse4-wmemcmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001042
1043 "bionic/strchrnul.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001044 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001045 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001046 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001047 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001048 "arch-x86_64/bionic/__bionic_clone.S",
1049 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1050 "arch-x86_64/bionic/__restore_rt.S",
1051 "arch-x86_64/bionic/setjmp.S",
1052 "arch-x86_64/bionic/syscall.S",
1053 "arch-x86_64/bionic/vfork.S",
1054
ahs919fb7f2022-06-10 07:11:14 +05301055 "arch-x86_64/string/avx2-memset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001056 "arch-x86_64/string/sse2-memmove-slm.S",
1057 "arch-x86_64/string/sse2-memset-slm.S",
1058 "arch-x86_64/string/sse2-stpcpy-slm.S",
1059 "arch-x86_64/string/sse2-stpncpy-slm.S",
1060 "arch-x86_64/string/sse2-strcat-slm.S",
1061 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001062 "arch-x86_64/string/sse2-strlen-slm.S",
1063 "arch-x86_64/string/sse2-strncat-slm.S",
1064 "arch-x86_64/string/sse2-strncpy-slm.S",
1065 "arch-x86_64/string/sse4-memcmp-slm.S",
1066 "arch-x86_64/string/ssse3-strcmp-slm.S",
1067 "arch-x86_64/string/ssse3-strncmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001068
1069 "bionic/strchr.cpp",
1070 "bionic/strchrnul.cpp",
1071 "bionic/strnlen.cpp",
1072 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001073 ],
1074 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001075 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001076
Colin Cross50c21ab2015-10-31 23:03:05 -07001077 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001078 include_dirs: ["bionic/libstdc++/include"],
1079 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001080}
1081
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001082genrule {
1083 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001084 out: ["generated_android_ids.h"],
1085 srcs: [":android_filesystem_config_header"],
Cole Faustb1a0a9d2023-11-28 17:51:16 -08001086 tools: ["fs_config_generator"],
1087 cmd: "$(location fs_config_generator) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001088}
1089
Dan Willemsen268a6732015-10-15 14:49:45 -07001090// ========================================================
1091// libc_bionic_ndk.a- The portions of libc_bionic that can
1092// be safely used in libc_ndk.a (no troublesome global data
1093// or constructors).
1094// ========================================================
1095cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001096 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001097 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001098 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001099 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001100 "bionic/__cmsg_nxthdr.cpp",
1101 "bionic/__errno.cpp",
1102 "bionic/__gnu_basename.cpp",
1103 "bionic/__libc_current_sigrtmax.cpp",
1104 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001105 "bionic/abort.cpp",
1106 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001107 "bionic/access.cpp",
1108 "bionic/arpa_inet.cpp",
1109 "bionic/assert.cpp",
1110 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001111 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001112 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001113 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001114 "bionic/bionic_netlink.cpp",
Elliott Hughes99cc9162024-01-25 22:45:24 +00001115 "bionic/bionic_systrace.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001116 "bionic/bionic_time_conversions.cpp",
1117 "bionic/brk.cpp",
1118 "bionic/c16rtomb.cpp",
1119 "bionic/c32rtomb.cpp",
1120 "bionic/chmod.cpp",
1121 "bionic/chown.cpp",
1122 "bionic/clearenv.cpp",
1123 "bionic/clock.cpp",
1124 "bionic/clock_getcpuclockid.cpp",
1125 "bionic/clock_nanosleep.cpp",
1126 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001127 "bionic/ctype.cpp",
1128 "bionic/dirent.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001129 "bionic/dup.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001130 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001131 "bionic/error.cpp",
Josh Gao7de41242020-04-29 17:08:46 -07001132 "bionic/eventfd.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001133 "bionic/exec.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001134 "bionic/execinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001135 "bionic/faccessat.cpp",
1136 "bionic/fchmod.cpp",
1137 "bionic/fchmodat.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001138 "bionic/fcntl.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001139 "bionic/fdsan.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001140 "bionic/fdtrack.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001141 "bionic/ffs.cpp",
1142 "bionic/fgetxattr.cpp",
1143 "bionic/flistxattr.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001144 "bionic/fpclassify.cpp",
1145 "bionic/fsetxattr.cpp",
1146 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001147 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001148 "bionic/futimens.cpp",
1149 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001150 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001151 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001152 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001153 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001154 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001155 "bionic/getpgrp.cpp",
1156 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001157 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001158 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001159 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001160 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001161 "bionic/grp_pwd_file.cpp",
Mitch Phillips9cad8422021-01-20 16:03:27 -08001162 "bionic/heap_zero_init.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001163 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001164 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001165 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001166 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001167 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001168 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001169 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001170 "bionic/lchown.cpp",
1171 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001172 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001173 "bionic/libgen.cpp",
1174 "bionic/link.cpp",
1175 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001176 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001177 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001178 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001179 "bionic/mbrtoc16.cpp",
1180 "bionic/mbrtoc32.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001181 "bionic/mempcpy.cpp",
Elliott Hughes0d642432022-08-10 23:35:03 +00001182 "bionic/memset_explicit.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001183 "bionic/mkdir.cpp",
1184 "bionic/mkfifo.cpp",
1185 "bionic/mknod.cpp",
1186 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001187 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001188 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001189 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001190 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001191 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001192 "bionic/open.cpp",
1193 "bionic/pathconf.cpp",
1194 "bionic/pause.cpp",
Josh Gao3de19152021-02-22 18:09:48 -08001195 "bionic/pidfd.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001196 "bionic/pipe.cpp",
1197 "bionic/poll.cpp",
1198 "bionic/posix_fadvise.cpp",
1199 "bionic/posix_fallocate.cpp",
1200 "bionic/posix_madvise.cpp",
1201 "bionic/posix_timers.cpp",
Elliott Hughescf59e192021-10-13 18:25:21 -07001202 "bionic/preadv_pwritev.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001203 "bionic/ptrace.cpp",
1204 "bionic/pty.cpp",
1205 "bionic/raise.cpp",
1206 "bionic/rand.cpp",
1207 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001208 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001209 "bionic/reboot.cpp",
1210 "bionic/recv.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001211 "bionic/recvmsg.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001212 "bionic/rename.cpp",
1213 "bionic/rmdir.cpp",
1214 "bionic/scandir.cpp",
1215 "bionic/sched_getaffinity.cpp",
1216 "bionic/sched_getcpu.cpp",
1217 "bionic/semaphore.cpp",
1218 "bionic/send.cpp",
1219 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001220 "bionic/seteuid.cpp",
1221 "bionic/setpgrp.cpp",
1222 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001223 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001224 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001225 "bionic/sleep.cpp",
Josh Gaob107eab2020-04-29 17:17:56 -07001226 "bionic/socketpair.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001227 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001228 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001229 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001230 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001231 "bionic/string_l.cpp",
1232 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001233 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001234 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001235 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001236 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001237 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001238 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001239 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001240 "bionic/sys_msg.cpp",
1241 "bionic/sys_sem.cpp",
1242 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001243 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001244 "bionic/sys_statfs.cpp",
1245 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001246 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001247 "bionic/sysinfo.cpp",
1248 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001249 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001250 "bionic/system_property_api.cpp",
1251 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001252 "bionic/tdestroy.cpp",
1253 "bionic/termios.cpp",
1254 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001255 "bionic/threads.cpp",
Elliott Hughes52541ee2023-04-24 17:04:49 -07001256 "bionic/time.cpp",
Elliott Hughesd3627a42022-12-06 22:24:27 +00001257 "bionic/time_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001258 "bionic/tmpfile.cpp",
1259 "bionic/umount.cpp",
1260 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001261 "bionic/usleep.cpp",
Elliott Hughes9a1d3972020-08-07 15:55:02 -07001262 "bionic/utmp.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001263 "bionic/wait.cpp",
1264 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001265 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001266 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001267 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001268 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001269 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001270
1271 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1272 // which will be overridden by the actual one in libc.so.
1273 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001274 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001275
Dan Willemsen208ae172015-09-16 16:33:27 -07001276 multilib: {
1277 lib32: {
1278 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001279 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001280 },
1281 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001282 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001283 treble_linker_namespaces: {
1284 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001285 },
1286 },
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001287 whole_static_libs: [
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001288 "libsystemproperties",
1289 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001290 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001291 local_include_dirs: ["stdio"],
1292 include_dirs: ["bionic/libstdc++/include"],
1293 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001294 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001295}
1296
Dan Willemsen208ae172015-09-16 16:33:27 -07001297// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001298// libc_syscalls.a
1299// ========================================================
1300
Elliott Hughes782c4852019-04-16 12:31:00 -07001301genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001302 name: "syscalls-arm",
Elliott Hughes782c4852019-04-16 12:31:00 -07001303 out: ["syscalls-arm.S"],
1304 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001305 tools: ["gensyscalls"],
1306 cmd: "$(location gensyscalls) arm $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001307}
1308
1309genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001310 name: "syscalls-arm64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001311 out: ["syscalls-arm64.S"],
1312 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001313 tools: ["gensyscalls"],
1314 cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001315}
1316
1317genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001318 name: "syscalls-riscv64",
Elliott Hughes704772b2022-10-10 17:06:43 +00001319 out: ["syscalls-riscv64.S"],
1320 srcs: ["SYSCALLS.TXT"],
1321 tools: ["gensyscalls"],
1322 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
1323}
1324
1325genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001326 name: "syscalls-x86",
Elliott Hughes782c4852019-04-16 12:31:00 -07001327 out: ["syscalls-x86.S"],
1328 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001329 tools: ["gensyscalls"],
1330 cmd: "$(location gensyscalls) x86 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001331}
1332
1333genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001334 name: "syscalls-x86_64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001335 out: ["syscalls-x86_64.S"],
1336 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001337 tools: ["gensyscalls"],
1338 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001339}
1340
Dan Willemsen208ae172015-09-16 16:33:27 -07001341cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001342 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001343 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001344 arch: {
1345 arm: {
Cole Faustf5968d82023-04-11 15:20:19 -07001346 srcs: [":syscalls-arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001347 },
1348 arm64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001349 srcs: [":syscalls-arm64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001350 },
Elliott Hughes704772b2022-10-10 17:06:43 +00001351 riscv64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001352 srcs: [":syscalls-riscv64"],
Elliott Hughes704772b2022-10-10 17:06:43 +00001353 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001354 x86: {
Cole Faustf5968d82023-04-11 15:20:19 -07001355 srcs: [":syscalls-x86"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001356 },
1357 x86_64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001358 srcs: [":syscalls-x86_64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001359 },
1360 },
1361 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001362}
1363
1364// ========================================================
1365// libc_aeabi.a
1366// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1367// to avoid infinite recursion. For the other architectures we just build an
1368// empty library to keep this makefile simple.
1369// ========================================================
1370
1371cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001372 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001373 arch: {
1374 arm: {
1375 srcs: ["arch-arm/bionic/__aeabi.c"],
1376 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001377 },
1378 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001379 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001380}
1381
1382// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001383// libc_common.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001384// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001385
Dan Willemsen208ae172015-09-16 16:33:27 -07001386cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001387 defaults: ["libc_defaults"],
Elliott Hughesb0948922024-01-26 00:28:12 +00001388 name: "libc_common",
1389
Dan Willemsen208ae172015-09-16 16:33:27 -07001390 srcs: libc_common_src_files,
1391 multilib: {
1392 lib32: {
1393 srcs: libc_common_src_files_32,
1394 },
1395 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001396
1397 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001398 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001399 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001400 "libc_bionic",
1401 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001402 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001403 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001404 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001405 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001406 "libc_freebsd_large_stack",
Elliott Hughesc2043342023-07-20 20:24:09 +00001407 "libc_freebsd_ldexp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001408 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001409 "libc_netbsd",
1410 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001411 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001412 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001413 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001414 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001415 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001416 ],
1417
1418 arch: {
1419 arm: {
1420 whole_static_libs: ["libc_aeabi"],
1421 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001422 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001423}
1424
1425// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001426// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001427// ========================================================
1428cc_library_static {
1429 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001430 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001431
Haibo Huangb9244ff2018-08-11 10:12:13 -07001432 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301433 x86_64: {
1434 srcs: ["arch-x86_64/static_function_dispatch.S"],
1435 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001436 x86: {
1437 srcs: ["arch-x86/static_function_dispatch.S"],
1438 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001439 arm: {
1440 srcs: ["arch-arm/static_function_dispatch.S"],
1441 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001442 arm64: {
1443 srcs: ["arch-arm64/static_function_dispatch.S"],
1444 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001445 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001446 srcs: ["arch-riscv64/static_function_dispatch.S"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001447 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001448 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001449}
1450
1451// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001452// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001453// ========================================================
1454cc_library_static {
1455 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001456 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001457
Haibo Huangb9244ff2018-08-11 10:12:13 -07001458 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001459 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001460 "-fno-stack-protector",
1461 "-fno-jump-tables",
1462 ],
1463 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301464 x86_64: {
1465 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
1466 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001467 x86: {
1468 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1469 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001470 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001471 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001472 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001473 arm64: {
1474 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1475 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001476 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001477 srcs: ["arch-riscv64/dynamic_function_dispatch.cpp"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001478 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001479 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001480}
1481
1482// ========================================================
1483// libc_common_static.a For static binaries.
1484// ========================================================
1485cc_library_static {
1486 defaults: ["libc_defaults"],
1487 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001488
Haibo Huangf71edfa2018-11-12 10:06:56 -08001489 whole_static_libs: [
1490 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001491 "libc_static_dispatch",
1492 ],
1493}
1494
1495// ========================================================
1496// libc_common_shared.a For shared libraries.
1497// ========================================================
1498cc_library_static {
1499 defaults: ["libc_defaults"],
1500 name: "libc_common_shared",
1501
1502 whole_static_libs: [
1503 "libc_common",
1504 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001505 ],
1506}
1507
Ryan Prichard22a6a052019-10-10 23:59:30 -07001508// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1509// executable.
1510cc_library_static {
1511 name: "libc_unwind_static",
1512 defaults: ["libc_defaults"],
1513 cflags: ["-DLIBC_STATIC"],
1514
1515 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1516 arch: {
1517 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1518 arm: {
1519 srcs: ["arch-arm/bionic/exidx_static.c"],
1520 },
1521 },
1522}
1523
Haibo Huangf71edfa2018-11-12 10:06:56 -08001524// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001525// libc_nomalloc.a
1526// ========================================================
1527//
Ryan Prichard249757b2019-11-01 17:18:28 -07001528// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1529// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1530// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001531
1532cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001533 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001534 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001535
Colin Crossa3f9fca2016-01-11 13:20:55 -08001536 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001537 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001538 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001539 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001540 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001541}
1542
dimitryc0c0ef62018-12-05 16:33:52 +01001543filegroup {
1544 name: "libc_sources_shared",
1545 srcs: [
1546 "arch-common/bionic/crtbegin_so.c",
1547 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001548 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001549 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001550 "bionic/icu.cpp",
1551 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001552 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001553 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001554 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001555 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001556 "bionic/ndk_cruft.cpp",
1557 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001558 "bionic/NetdClient.cpp",
1559 "arch-common/bionic/crtend_so.S",
1560 ],
1561}
1562
1563filegroup {
1564 name: "libc_sources_static",
1565 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001566 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001567 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001568 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001569 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001570 ],
1571}
1572
1573filegroup {
1574 name: "libc_sources_shared_arm",
1575 srcs: [
1576 "arch-arm/bionic/exidx_dynamic.c",
1577 "arch-arm/bionic/atexit_legacy.c",
1578 ],
1579}
1580
Dan Willemsen208ae172015-09-16 16:33:27 -07001581// ========================================================
1582// libc.a + libc.so
1583// ========================================================
Florian Mayerc10d0642023-03-22 16:12:49 -07001584cc_defaults {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001585 defaults: [
1586 "libc_defaults",
1587 "libc_native_allocator_defaults",
1588 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001589 name: "libc_library_defaults",
Colin Cross50c21ab2015-10-31 23:03:05 -07001590 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001591 platform_sdk_version: {
1592 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1593 },
1594 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001595 static: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001596 srcs: [":libc_sources_static"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001597 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001598 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001599 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001600 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001601 "libc_init_static",
1602 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001603 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001604 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001605 },
1606 shared: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001607 srcs: [":libc_sources_shared"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001608 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001609 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001610 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001611 "libc_init_dynamic",
1612 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001613 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001614 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001615 },
1616
Neil Fullera7db90f2019-04-25 09:28:27 +01001617 required: [
MarkDacekd88d7ea2022-06-28 20:14:58 +00001618 "tzdata_prebuilt",
1619 "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
Neil Fullera7db90f2019-04-25 09:28:27 +01001620 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001621
Colin Cross4ce94d22016-11-15 13:15:43 -08001622 // Do not pack libc.so relocations; see http://b/20645321 for details.
1623 pack_relocations: false,
1624
dimitry06016f22018-01-05 11:39:28 +01001625 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1626 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1627 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1628 // those new libraries from libgcc.a are not declared external; if that were the case,
1629 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1630 // on the external symbols from the dependent libraries. That would create a "cloaked"
1631 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001632
dimitry06016f22018-01-05 11:39:28 +01001633 shared_libs: [
1634 "ld-android",
1635 "libdl",
1636 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001637 static_libs: [
1638 "libdl_android",
1639 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001640
1641 nocrt: true,
1642
Dan Willemsen208ae172015-09-16 16:33:27 -07001643 arch: {
1644 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001645 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001646 pack_relocations: false,
Christopher Ferris9d03a162023-11-10 11:19:11 -08001647 ldflags: [
1648 "-Wl,--hash-style=both",
1649 // Since we are preserving the debug_frame, do not compress
1650 // in this case to make unwinds as fast as possible.
1651 "-Wl,--compress-debug-sections=none",
1652 ],
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001653
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001654 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001655 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001656
Dan Willemsen208ae172015-09-16 16:33:27 -07001657 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001658 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001659 // special for arm
1660 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001661 // For backwards-compatibility, some arm32 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001662 static_libs: ["libclang_rt.builtins-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001663 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001664
1665 // Arm 32 bit does not produce complete exidx unwind information
1666 // so keep the .debug_frame which is relatively small and does
1667 // include needed unwind information.
1668 // See b/132992102 for details.
1669 strip: {
1670 keep_symbols_and_debug_frame: true,
1671 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001672 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001673 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001674 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001675
1676 // Leave the symbols in the shared library so that stack unwinders can produce
1677 // meaningful name resolution.
1678 strip: {
1679 keep_symbols: true,
1680 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001681 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001682 riscv64: {
1683 version_script: ":libc.riscv64.map",
1684
1685 // Leave the symbols in the shared library so that stack unwinders can produce
1686 // meaningful name resolution.
1687 strip: {
1688 keep_symbols: true,
1689 },
1690 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001691 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001692 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001693 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001694 ldflags: ["-Wl,--hash-style=both"],
1695
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001696 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001697 no_libcrt: true,
1698
1699 shared: {
1700 // For backwards-compatibility, some x86 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001701 static_libs: ["libclang_rt.builtins-exported"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001702 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001703
1704 // Leave the symbols in the shared library so that stack unwinders can produce
1705 // meaningful name resolution.
1706 strip: {
1707 keep_symbols: true,
1708 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001709 },
1710 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001711 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001712
1713 // Leave the symbols in the shared library so that stack unwinders can produce
1714 // meaningful name resolution.
1715 strip: {
1716 keep_symbols: true,
1717 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001718 },
1719 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001720
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001721 apex_available: [
1722 "//apex_available:platform",
1723 "com.android.runtime",
1724 ],
1725
Colin Cross7edd0082021-10-28 13:20:35 -07001726 target: {
1727 native_bridge: {
1728 shared: {
1729 installable: false,
1730 },
1731 },
1732 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001733}
1734
Florian Mayerc10d0642023-03-22 16:12:49 -07001735cc_library {
1736 name: "libc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001737 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001738 "libc_library_defaults",
1739 ],
1740 stubs: {
1741 symbol_file: "libc.map.txt",
1742 versions: [
1743 "29",
1744 "R",
1745 "current",
1746 ],
1747 },
1748 static_ndk_lib: true,
1749 llndk: {
1750 symbol_file: "libc.map.txt",
1751 export_headers_as_system: true,
1752 export_preprocessed_headers: ["include"],
1753 export_llndk_headers: ["libc_llndk_headers"],
1754 },
1755}
1756
1757cc_library {
1758 name: "libc_hwasan",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001759 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001760 "libc_library_defaults",
1761 ],
1762 sanitize: {
1763 hwaddress: true,
1764 },
1765 enabled: false,
Florian Mayerff116ed2023-04-14 17:38:53 -07001766 target: {
1767 android_arm64: {
Florian Mayerc10d0642023-03-22 16:12:49 -07001768 enabled: true,
1769 },
1770 },
1771 stem: "libc",
1772 relative_install_path: "hwasan",
1773 // We don't really need the stubs, but this needs to stay to trigger the
1774 // symlink logic in soong.
1775 stubs: {
1776 symbol_file: "libc.map.txt",
1777 },
1778 native_bridge_supported: false,
1779 // It is never correct to depend on this directly. This is only
1780 // needed for the runtime apex, and in base_system.mk.
1781 visibility: ["//bionic/apex"],
1782}
1783
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001784genrule {
1785 name: "libc.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001786 out: ["libc.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001787 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001788 tools: ["generate-version-script"],
1789 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001790}
1791
1792genrule {
1793 name: "libc.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001794 out: ["libc.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001795 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001796 tools: ["generate-version-script"],
1797 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001798}
1799
1800genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001801 name: "libc.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001802 out: ["libc.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001803 srcs: ["libc.map.txt"],
1804 tools: ["generate-version-script"],
1805 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1806}
1807
1808genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001809 name: "libc.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001810 out: ["libc.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001811 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001812 tools: ["generate-version-script"],
1813 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001814}
1815
1816genrule {
1817 name: "libc.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001818 out: ["libc.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001819 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001820 tools: ["generate-version-script"],
1821 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001822}
1823
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001824// Headers that only other parts of the platform can include.
1825cc_library_headers {
1826 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001827 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001828 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001829 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001830 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001831 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001832 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001833 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001834 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001835 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001836 "//system/core/debuggerd:__subpackages__",
Florian Mayerf5d70ce2022-09-13 13:58:30 -07001837 "//system/core/init:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001838 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001839 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001840 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001841 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001842 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001843 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001844 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001845 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001846 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001847 recovery_available: true,
1848 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001849 export_include_dirs: [
1850 "platform",
1851 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001852 system_shared_libs: [],
1853 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001854 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001855
Steven Moreland0cdf1322020-10-05 21:55:26 +00001856 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001857 apex_available: [
1858 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001859 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001860 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001861}
1862
Logan Chien17af91b2019-01-15 21:19:56 +08001863cc_library_headers {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001864 name: "libc_llndk_headers",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001865 visibility: [
1866 "//external/musl",
1867 ],
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001868 llndk: {
1869 llndk_headers: true,
1870 },
Logan Chien17af91b2019-01-15 21:19:56 +08001871 host_supported: true,
1872 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001873 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001874 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001875 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001876 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001877 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001878 apex_available: [
1879 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001880 "//apex_available:anyapex",
1881 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001882 // used by most APEXes indirectly via libunwind_llvm
1883 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001884
1885 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001886 stl: "none",
1887 system_shared_libs: [],
1888
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001889 // The build system generally requires that any dependencies of a target
1890 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1891 // to 1 we let targets with an sdk_version that need to depend on the libc
1892 // headers but cannot depend on libc itself due to circular dependencies
1893 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1894 // is correct because the headers can support any sdk_version.
1895 sdk_version: "1",
1896
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001897 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001898 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001899 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001900 "kernel/android/uapi",
1901 ],
1902
1903 arch: {
1904 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001905 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001906 },
1907 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001908 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001909 },
Elliott Hughes48e53332022-10-07 20:39:25 +00001910 riscv64: {
1911 export_system_include_dirs: ["kernel/uapi/asm-riscv"],
1912 },
Logan Chien17af91b2019-01-15 21:19:56 +08001913 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001914 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001915 },
1916 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001917 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001918 },
1919 },
1920}
1921
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001922cc_library_headers {
1923 name: "libc_headers",
1924 host_supported: true,
1925 native_bridge_supported: true,
1926 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001927 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001928 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001929 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001930 recovery_available: true,
1931 sdk_version: "1",
1932
1933 apex_available: [
1934 "//apex_available:platform",
1935 "//apex_available:anyapex",
1936 ],
1937 // used by most APEXes indirectly via libunwind_llvm
1938 min_sdk_version: "apex_inherit",
1939 visibility: [
1940 "//bionic:__subpackages__", // visible to bionic
1941 // ... and only to these places (b/152668052)
1942 "//external/arm-optimized-routines",
1943 "//external/gwp_asan",
1944 "//external/jemalloc_new",
1945 "//external/libunwind_llvm",
1946 "//external/scudo",
1947 "//system/core/property_service/libpropertyinfoparser",
1948 "//system/extras/toolchain-extras",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001949 ],
1950
1951 stl: "none",
1952 no_libcrt: true,
1953 system_shared_libs: [],
1954
1955 target: {
1956 android: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001957 export_system_include_dirs: ["include"],
1958 header_libs: ["libc_llndk_headers"],
1959 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001960 },
1961 linux_bionic: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001962 export_system_include_dirs: ["include"],
1963 header_libs: ["libc_llndk_headers"],
1964 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001965 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001966 },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001967}
1968
Dan Willemsen208ae172015-09-16 16:33:27 -07001969// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001970// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001971// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001972
Dan Willemsen208ae172015-09-16 16:33:27 -07001973cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001974 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001975 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001976 srcs: [
1977 "bionic/__cxa_guard.cpp",
1978 "bionic/__cxa_pure_virtual.cpp",
1979 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001980 ],
1981 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001982 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001983 static_libs: ["libasync_safe"],
Elliott Hughesc2043342023-07-20 20:24:09 +00001984 apex_available: [
1985 "//apex_available:platform",
1986 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001987
Dan Willemsen6b3be172018-12-03 13:57:20 -08001988 static: {
1989 system_shared_libs: [],
1990 },
Colin Crossb5bfe0b2021-07-13 16:26:28 -07001991 target: {
1992 bionic: {
1993 shared: {
1994 system_shared_libs: ["libc"],
1995 },
1996 },
Dan Willemsen6b3be172018-12-03 13:57:20 -08001997 },
1998
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001999 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07002000 arch: {
2001 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002002 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07002003 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08002004 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002005 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07002006 },
2007 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002008 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07002009 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00002010 riscv64: {
2011 version_script: ":libstdc++.riscv64.map",
2012 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002013 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07002014 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08002015 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002016 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07002017 },
2018 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002019 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07002020 },
2021 },
2022}
2023
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002024genrule {
2025 name: "libstdc++.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002026 out: ["libstdc++.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002027 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002028 tools: ["generate-version-script"],
2029 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002030}
2031
2032genrule {
2033 name: "libstdc++.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002034 out: ["libstdc++.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002035 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002036 tools: ["generate-version-script"],
2037 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002038}
2039
2040genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00002041 name: "libstdc++.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002042 out: ["libstdc++.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00002043 srcs: ["libstdc++.map.txt"],
2044 tools: ["generate-version-script"],
2045 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
2046}
2047
2048genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002049 name: "libstdc++.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002050 out: ["libstdc++.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002051 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002052 tools: ["generate-version-script"],
2053 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002054}
2055
2056genrule {
2057 name: "libstdc++.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002058 out: ["libstdc++.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002059 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002060 tools: ["generate-version-script"],
2061 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002062}
2063
2064// ========================================================
2065// crt object files.
2066// ========================================================
2067
Colin Cross50c21ab2015-10-31 23:03:05 -07002068cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002069 name: "crt_and_memtag_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002070 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002071 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002072 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002073 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002074 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002075 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002076 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002077 apex_available: [
2078 "//apex_available:platform",
2079 "//apex_available:anyapex",
2080 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002081 // Generate NDK variants of the CRT objects for every supported API level.
2082 min_sdk_version: "16",
2083 stl: "none",
2084 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002085 cflags: [
2086 "-Wno-gcc-compat",
2087 "-Wall",
2088 "-Werror",
2089 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002090 sanitize: {
2091 never: true,
2092 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002093}
2094
Colin Cross50c21ab2015-10-31 23:03:05 -07002095cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002096 name: "crt_defaults",
2097 defaults: ["crt_and_memtag_defaults"],
Colin Cross02f81372021-07-22 12:02:10 -07002098 system_shared_libs: [],
Colin Cross10d92682021-06-22 13:25:46 -07002099}
2100
2101cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002102 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002103 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002104
2105 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002106 x86: {
2107 cflags: ["-fPIC"],
2108 },
2109 x86_64: {
2110 cflags: ["-fPIC"],
2111 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002112 },
Colin Crossab179442018-09-27 11:03:22 -07002113 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002114}
2115
Dan Willemsen208ae172015-09-16 16:33:27 -07002116cc_object {
2117 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002118 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002119 local_include_dirs: [
2120 "include",
2121 "private", // crtbrand.S depends on private/bionic_asm_note.h
2122 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002123 product_variables: {
2124 platform_sdk_version: {
2125 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2126 },
2127 },
2128 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002129
Colin Cross7d7b3682017-11-03 13:38:40 -07002130 defaults: ["crt_so_defaults"],
Dan Alberteee46dc2023-04-04 23:27:52 +00002131 // crtbrand is an intermediate artifact, not a final CRT object.
2132 exclude_from_ndk_sysroot: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07002133}
2134
Dan Willemsen208ae172015-09-16 16:33:27 -07002135cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002136 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002137 local_include_dirs: ["include"],
2138 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002139
Colin Cross7d7b3682017-11-03 13:38:40 -07002140 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002141 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002142 "crtbrand",
2143 ],
2144}
2145
Dan Willemsen208ae172015-09-16 16:33:27 -07002146cc_object {
2147 name: "crtend_so",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002148 local_include_dirs: [
2149 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002150 "private", // crtend_so.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002151 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002152 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002153
Colin Cross7d7b3682017-11-03 13:38:40 -07002154 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002155}
2156
Dan Willemsen208ae172015-09-16 16:33:27 -07002157cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002158 name: "crtbegin_static",
2159
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002160 local_include_dirs: [
2161 "include",
2162 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2163 ],
Liz Kammere718dd72021-03-09 15:00:06 -05002164
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002165 cflags: ["-DCRTBEGIN_STATIC"],
Yabin Cui744cfd32023-08-24 13:20:23 -07002166
Dan Willemsen208ae172015-09-16 16:33:27 -07002167 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002168 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002169 "crtbrand",
2170 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002171 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002172 // When using libc.a, we're using the latest library regardless of target API level.
2173 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002174}
2175
Dan Willemsen208ae172015-09-16 16:33:27 -07002176cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002177 name: "crtbegin_dynamic",
2178
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002179 local_include_dirs: [
2180 "include",
2181 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2182 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002183 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002184 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002185 "crtbrand",
2186 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002187 target: {
2188 linux_bionic: {
2189 generated_sources: ["host_bionic_linker_asm"],
2190 objs: [
2191 "linker_wrapper",
2192 ],
2193 },
2194 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002195 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002196}
2197
Dan Willemsen208ae172015-09-16 16:33:27 -07002198cc_object {
2199 // We rename crtend.o to crtend_android.o to avoid a
2200 // name clash between gcc and bionic.
2201 name: "crtend_android",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002202 local_include_dirs: [
2203 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002204 "private", // crtend.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002205 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002206 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002207
Colin Cross50c21ab2015-10-31 23:03:05 -07002208 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002209}
Colin Crossbaa48992016-07-13 11:15:21 -07002210
Kalesh Singh862a23d2024-01-09 13:13:50 -08002211cc_object {
2212 name: "crt_pad_segment",
2213 local_include_dirs: [
2214 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002215 "private", // crt_pad_segment.S depends on private/bionic_asm_note.h
Kalesh Singh862a23d2024-01-09 13:13:50 -08002216 ],
2217 srcs: ["arch-common/bionic/crt_pad_segment.S"],
2218
2219 defaults: ["crt_defaults"],
2220}
2221
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002222cc_library_static {
2223 name: "note_memtag_heap_async",
2224 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002225 arm64: {
2226 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2227 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002228 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002229 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002230
Colin Cross10d92682021-06-22 13:25:46 -07002231 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002232}
2233
2234cc_library_static {
2235 name: "note_memtag_heap_sync",
2236 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002237 arm64: {
2238 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2239 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002240 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002241 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002242
Colin Cross10d92682021-06-22 13:25:46 -07002243 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002244}
2245
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002246// ========================================================
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002247// libc dependencies for baremetal Rust projects.
2248// ========================================================
2249
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002250// This library contains the following unresolved symbols:
2251// __errno
2252// abort
2253// async_safe_fatal_va_list
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002254cc_library_static {
2255 name: "librust_baremetal",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002256 header_libs: ["libc_headers"],
2257 include_dirs: [
2258 "bionic/libc/async_safe/include",
2259 "bionic/libc/platform",
2260 ],
2261 cflags: [
2262 "-Wall",
2263 "-Werror",
2264 ],
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002265 srcs: [
2266 "bionic/fortify.cpp",
Pierre-Clément Tosi816176c2022-11-30 14:33:41 +00002267 "bionic/strtol.cpp",
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002268 ],
2269 arch: {
2270 arm64: {
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002271 srcs: [
2272 "arch-arm64/string/__memcpy_chk.S",
2273 ],
2274 },
caowencheng9a39eb32023-03-20 16:24:41 +08002275 riscv64: {
2276 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002277 "arch-riscv64/string/__memcpy_chk.S",
caowencheng9a39eb32023-03-20 16:24:41 +08002278 ],
2279 },
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002280 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002281 whole_static_libs: [
2282 "libarm-optimized-routines-mem",
Pierre-Clément Tosieb46ac92023-02-01 13:44:57 +00002283 "libc_netbsd",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002284 ],
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002285 system_shared_libs: [],
2286 nocrt: true,
2287 stl: "none",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002288 visibility: [
2289 "//packages/modules/Virtualization/vmbase",
2290 ],
2291}
2292
2293// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002294// NDK headers.
2295// ========================================================
2296
Dan Albert26e1c412018-05-24 14:56:46 -07002297versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002298 name: "common_libc",
2299 from: "include",
2300 to: "",
2301 license: "NOTICE",
2302}
Dan Albert4238a352016-06-28 11:18:05 -07002303
2304ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002305 name: "libc_uapi",
2306 from: "kernel/uapi",
2307 to: "",
2308 srcs: [
2309 "kernel/uapi/asm-generic/**/*.h",
2310 "kernel/uapi/drm/**/*.h",
2311 "kernel/uapi/linux/**/*.h",
2312 "kernel/uapi/misc/**/*.h",
2313 "kernel/uapi/mtd/**/*.h",
2314 "kernel/uapi/rdma/**/*.h",
2315 "kernel/uapi/scsi/**/*.h",
2316 "kernel/uapi/sound/**/*.h",
2317 "kernel/uapi/video/**/*.h",
2318 "kernel/uapi/xen/**/*.h",
2319 ],
Dan Albert92592652016-10-20 01:42:54 -07002320 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002321}
2322
2323ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002324 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002325 from: "kernel/android/uapi/linux",
2326 to: "linux",
2327 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002328 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002329}
2330
2331ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002332 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002333 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002334 to: "scsi",
2335 srcs: ["kernel/android/scsi/**/*.h"],
2336 license: "NOTICE",
2337}
2338
2339ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002340 name: "libc_asm_arm",
2341 from: "kernel/uapi/asm-arm",
2342 to: "arm-linux-androideabi",
2343 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002344 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002345}
2346
2347ndk_headers {
2348 name: "libc_asm_arm64",
2349 from: "kernel/uapi/asm-arm64",
2350 to: "aarch64-linux-android",
2351 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002352 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002353}
2354
Lazar Trsic790d2f72017-11-27 11:54:11 +01002355ndk_headers {
Colin Crossbd26e0f2022-10-19 15:03:14 -07002356 name: "libc_asm_riscv64",
2357 from: "kernel/uapi/asm-riscv",
2358 to: "riscv64-linux-android",
2359 srcs: ["kernel/uapi/asm-riscv/**/*.h"],
2360 license: "NOTICE",
2361}
2362
2363ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002364 name: "libc_asm_x86",
2365 from: "kernel/uapi/asm-x86",
2366 to: "i686-linux-android",
2367 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002368 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002369}
2370
2371ndk_headers {
2372 name: "libc_asm_x86_64",
2373 from: "kernel/uapi/asm-x86",
2374 to: "x86_64-linux-android",
2375 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002376 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002377}
2378
Dan Albert4238a352016-06-28 11:18:05 -07002379ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002380 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002381 symbol_file: "libc.map.txt",
2382 first_version: "9",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002383 export_header_libs: [
2384 "common_libc",
2385 "libc_uapi",
2386 "libc_kernel_android_uapi_linux",
2387 "libc_kernel_android_scsi",
2388 "libc_asm_arm",
2389 "libc_asm_arm64",
Colin Crossbd26e0f2022-10-19 15:03:14 -07002390 "libc_asm_riscv64",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002391 "libc_asm_x86",
2392 "libc_asm_x86_64",
2393 ],
Dan Albert4238a352016-06-28 11:18:05 -07002394}
2395
Dan Albertdf31aff2016-10-06 15:50:41 -07002396ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002397 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002398 symbol_file: "libstdc++.map.txt",
2399 first_version: "9",
2400}
2401
Dan Willemsenca056d72018-01-08 14:00:24 -08002402// Export these headers for toolbox to process
2403filegroup {
2404 name: "kernel_input_headers",
2405 srcs: [
2406 "kernel/uapi/linux/input.h",
2407 "kernel/uapi/linux/input-event-codes.h",
2408 ],
2409}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002410
2411// Generate a syscall name / number mapping. These objects are text files
2412// (thanks to the -dD -E flags) and not binary files. They will then be
2413// consumed by the genseccomp.py script and converted into C++ code.
2414cc_defaults {
2415 name: "libseccomp_gen_syscall_nrs_defaults",
2416 recovery_available: true,
2417 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2418 cflags: [
2419 "-dD",
2420 "-E",
2421 "-Wall",
2422 "-Werror",
2423 "-nostdinc",
2424 ],
2425}
2426
2427cc_object {
2428 name: "libseccomp_gen_syscall_nrs_arm",
2429 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2430 local_include_dirs: [
2431 "kernel/uapi/asm-arm",
2432 "kernel/uapi",
2433 ],
2434}
2435
2436cc_object {
2437 name: "libseccomp_gen_syscall_nrs_arm64",
2438 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2439 local_include_dirs: [
2440 "kernel/uapi/asm-arm64",
2441 "kernel/uapi",
2442 ],
2443}
2444
2445cc_object {
Elliott Hughes704772b2022-10-10 17:06:43 +00002446 name: "libseccomp_gen_syscall_nrs_riscv64",
2447 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2448 local_include_dirs: [
2449 "kernel/uapi/asm-riscv",
2450 "kernel/uapi",
2451 ],
2452}
2453
2454cc_object {
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002455 name: "libseccomp_gen_syscall_nrs_x86",
2456 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2457 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2458 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2459 local_include_dirs: [
2460 "kernel/uapi/asm-x86",
2461 "kernel/uapi",
2462 ],
2463}
2464
2465cc_object {
2466 name: "libseccomp_gen_syscall_nrs_x86_64",
2467 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2468 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2469 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2470 local_include_dirs: [
2471 "kernel/uapi/asm-x86",
2472 "kernel/uapi",
2473 ],
2474}
2475
Jingwen Chenca366332021-01-29 05:16:32 -05002476filegroup {
2477 name: "all_kernel_uapi_headers",
2478 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002479}
2480
Martijn Coenen0c6de752019-01-02 12:52:51 +01002481cc_genrule {
2482 name: "func_to_syscall_nrs",
2483 recovery_available: true,
2484 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2485
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002486 tools: ["genfunctosyscallnrs"],
Martijn Coenen0c6de752019-01-02 12:52:51 +01002487
2488 srcs: [
2489 "SYSCALLS.TXT",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002490 ],
2491
Elliott Hughes704772b2022-10-10 17:06:43 +00002492 arch: {
2493 arm: {
2494 srcs: [
2495 ":libseccomp_gen_syscall_nrs_arm",
2496 ":libseccomp_gen_syscall_nrs_arm64",
2497 ],
2498 },
2499 arm64: {
2500 srcs: [
2501 ":libseccomp_gen_syscall_nrs_arm",
2502 ":libseccomp_gen_syscall_nrs_arm64",
2503 ],
2504 },
2505 riscv64: {
2506 srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
2507 },
2508 x86: {
2509 srcs: [
2510 ":libseccomp_gen_syscall_nrs_x86",
2511 ":libseccomp_gen_syscall_nrs_x86_64",
2512 ],
2513 },
2514 x86_64: {
2515 srcs: [
2516 ":libseccomp_gen_syscall_nrs_x86",
2517 ":libseccomp_gen_syscall_nrs_x86_64",
2518 ],
2519 },
2520 },
2521
Martijn Coenen0c6de752019-01-02 12:52:51 +01002522 out: [
2523 "func_to_syscall_nrs.h",
2524 ],
2525}
2526
Victor Hsiehdbb86702020-06-15 09:29:07 -07002527// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002528genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002529 name: "generate_app_zygote_blocklist",
2530 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2531 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002532 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2533}
2534
Yu Liu938ec9b2022-10-17 16:36:30 -07002535filegroup {
2536 name: "seccomp_syscalls_sources_zygote",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002537 srcs: [
2538 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002539 "SECCOMP_ALLOWLIST_COMMON.TXT",
2540 "SECCOMP_ALLOWLIST_APP.TXT",
2541 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002542 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002543 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002544 ],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002545}
2546
Yu Liu938ec9b2022-10-17 16:36:30 -07002547filegroup {
2548 name: "seccomp_syscalls_sources_app",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002549 srcs: [
2550 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002551 "SECCOMP_ALLOWLIST_COMMON.TXT",
2552 "SECCOMP_ALLOWLIST_APP.TXT",
2553 "SECCOMP_BLOCKLIST_COMMON.TXT",
2554 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002555 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002556 ],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002557}
2558
Yu Liu938ec9b2022-10-17 16:36:30 -07002559filegroup {
2560 name: "seccomp_syscalls_sources_system",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002561 srcs: [
2562 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002563 "SECCOMP_ALLOWLIST_COMMON.TXT",
2564 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2565 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002566 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002567 ],
Yu Liu938ec9b2022-10-17 16:36:30 -07002568}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002569
Yu Liu938ec9b2022-10-17 16:36:30 -07002570cc_genrule {
2571 name: "libseccomp_policy_app_zygote_sources_x86",
2572 recovery_available: true,
2573 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002574 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002575 srcs: [
2576 ":seccomp_syscalls_sources_zygote",
2577 ":libseccomp_gen_syscall_nrs_x86",
2578 ":libseccomp_gen_syscall_nrs_x86_64",
2579 ],
2580 out: [
2581 "x86_app_zygote_policy.cpp",
2582 "x86_64_app_zygote_policy.cpp",
2583 ],
2584 enabled: false,
Yu Liu3a579692022-10-18 03:02:32 +00002585 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002586 x86: {
2587 enabled: true,
2588 },
2589 x86_64: {
2590 enabled: true,
2591 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002592 },
2593}
2594
2595cc_genrule {
2596 name: "libseccomp_policy_app_zygote_sources_arm",
2597 recovery_available: true,
2598 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002599 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002600 srcs: [
2601 ":seccomp_syscalls_sources_zygote",
2602 ":libseccomp_gen_syscall_nrs_arm",
2603 ":libseccomp_gen_syscall_nrs_arm64",
2604 ],
2605 out: [
2606 "arm_app_zygote_policy.cpp",
2607 "arm64_app_zygote_policy.cpp",
2608 ],
2609 enabled: false,
2610 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002611 arm: {
2612 enabled: true,
2613 },
2614 arm64: {
2615 enabled: true,
2616 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002617 },
2618}
2619
2620cc_genrule {
2621 name: "libseccomp_policy_app_zygote_sources_riscv64",
2622 recovery_available: true,
2623 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002624 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002625 srcs: [
2626 ":seccomp_syscalls_sources_zygote",
2627 ":libseccomp_gen_syscall_nrs_riscv64",
2628 ],
2629 out: [
2630 "riscv64_app_zygote_policy.cpp",
2631 ],
2632 enabled: false,
2633 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002634 riscv64: {
2635 enabled: true,
2636 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002637 },
2638}
2639
2640cc_genrule {
2641 name: "libseccomp_policy_app_sources_x86",
2642 recovery_available: true,
2643 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002644 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002645 srcs: [
2646 ":seccomp_syscalls_sources_app",
2647 ":libseccomp_gen_syscall_nrs_x86",
2648 ":libseccomp_gen_syscall_nrs_x86_64",
2649 ],
2650 out: [
2651 "x86_app_policy.cpp",
2652 "x86_64_app_policy.cpp",
2653 ],
2654 enabled: false,
2655 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002656 x86: {
2657 enabled: true,
2658 },
2659 x86_64: {
2660 enabled: true,
2661 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002662 },
2663}
2664
2665cc_genrule {
2666 name: "libseccomp_policy_app_sources_arm",
2667 recovery_available: true,
2668 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002669 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002670 srcs: [
2671 ":seccomp_syscalls_sources_app",
2672 ":libseccomp_gen_syscall_nrs_arm",
2673 ":libseccomp_gen_syscall_nrs_arm64",
2674 ],
2675 out: [
2676 "arm_app_policy.cpp",
2677 "arm64_app_policy.cpp",
2678 ],
2679 enabled: false,
2680 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002681 arm: {
2682 enabled: true,
2683 },
2684 arm64: {
2685 enabled: true,
2686 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002687 },
2688}
2689
2690cc_genrule {
2691 name: "libseccomp_policy_app_sources_riscv64",
2692 recovery_available: true,
2693 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002694 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002695 srcs: [
2696 ":seccomp_syscalls_sources_app",
2697 ":libseccomp_gen_syscall_nrs_riscv64",
2698 ],
2699 out: [
2700 "riscv64_app_policy.cpp",
2701 ],
2702 enabled: false,
2703 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002704 riscv64: {
2705 enabled: true,
2706 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002707 },
2708}
2709
2710cc_genrule {
2711 name: "libseccomp_policy_system_sources_x86",
2712 recovery_available: true,
2713 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002714 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002715 srcs: [
2716 ":seccomp_syscalls_sources_system",
2717 ":libseccomp_gen_syscall_nrs_x86",
2718 ":libseccomp_gen_syscall_nrs_x86_64",
2719 ],
2720 out: [
2721 "x86_system_policy.cpp",
2722 "x86_64_system_policy.cpp",
2723 ],
2724 enabled: false,
2725 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002726 x86: {
2727 enabled: true,
2728 },
2729 x86_64: {
2730 enabled: true,
2731 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002732 },
2733}
2734
2735cc_genrule {
2736 name: "libseccomp_policy_system_sources_arm",
2737 recovery_available: true,
2738 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002739 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002740 srcs: [
2741 ":seccomp_syscalls_sources_system",
2742 ":libseccomp_gen_syscall_nrs_arm",
2743 ":libseccomp_gen_syscall_nrs_arm64",
2744 ],
2745 out: [
2746 "arm_system_policy.cpp",
2747 "arm64_system_policy.cpp",
2748 ],
2749 enabled: false,
2750 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002751 arm: {
2752 enabled: true,
2753 },
2754 arm64: {
2755 enabled: true,
2756 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002757 },
2758}
2759
2760cc_genrule {
2761 name: "libseccomp_policy_system_sources_riscv64",
2762 recovery_available: true,
2763 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002764 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002765 srcs: [
2766 ":seccomp_syscalls_sources_system",
2767 ":libseccomp_gen_syscall_nrs_riscv64",
2768 ],
2769 out: [
2770 "riscv64_system_policy.cpp",
2771 ],
2772 enabled: false,
2773 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002774 riscv64: {
2775 enabled: true,
2776 },
Yu Liu3a579692022-10-18 03:02:32 +00002777 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002778}
2779
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002780cc_library {
2781 name: "libseccomp_policy",
2782 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002783 generated_headers: ["func_to_syscall_nrs"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002784
2785 arch: {
2786 arm: {
2787 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002788 "libseccomp_policy_app_sources_arm",
2789 "libseccomp_policy_app_zygote_sources_arm",
2790 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002791 ],
2792 },
2793 arm64: {
2794 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002795 "libseccomp_policy_app_sources_arm",
2796 "libseccomp_policy_app_zygote_sources_arm",
2797 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002798 ],
2799 },
2800 riscv64: {
2801 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002802 "libseccomp_policy_app_sources_riscv64",
2803 "libseccomp_policy_app_zygote_sources_riscv64",
2804 "libseccomp_policy_system_sources_riscv64",
Yu Liu938ec9b2022-10-17 16:36:30 -07002805 ],
2806 },
2807 x86: {
2808 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002809 "libseccomp_policy_app_sources_x86",
2810 "libseccomp_policy_app_zygote_sources_x86",
2811 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002812 ],
2813 },
2814 x86_64: {
2815 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002816 "libseccomp_policy_app_sources_x86",
2817 "libseccomp_policy_app_zygote_sources_x86",
2818 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002819 ],
2820 },
2821 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002822
2823 srcs: [
2824 "seccomp/seccomp_policy.cpp",
2825 ],
2826
2827 export_include_dirs: ["seccomp/include"],
2828 cflags: [
2829 "-Wall",
2830 "-Werror",
2831 ],
2832 shared: {
2833 shared_libs: ["libbase"],
2834 },
2835 static: {
2836 static_libs: ["libbase"],
2837 },
2838}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002839
Colin Cross048f24e2021-09-01 17:26:00 -07002840cc_library_host_static {
2841 name: "libfts",
2842 srcs: [
2843 "bionic/fts.c",
2844 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
2845 ],
2846 export_include_dirs: ["fts/include"],
2847 local_include_dirs: [
2848 "private",
2849 "upstream-openbsd/android/include",
2850 ],
2851 cflags: [
2852 "-include openbsd-compat.h",
2853 "-Wno-unused-parameter",
2854 ],
2855 enabled: false,
2856 target: {
2857 musl: {
2858 enabled: true,
2859 },
2860 },
Colin Cross2a9843f2022-01-13 12:26:30 -08002861 stl: "none",
2862}
2863
2864cc_library_host_static {
2865 name: "libexecinfo",
2866 visibility: ["//external/musl"],
2867 srcs: ["bionic/execinfo.cpp"],
2868 export_include_dirs: ["execinfo/include"],
2869 local_include_dirs: ["private"],
2870 enabled: false,
2871 target: {
2872 musl: {
2873 enabled: true,
2874 system_shared_libs: [],
2875 header_libs: ["libc_musl_headers"],
2876 },
2877 },
2878 stl: "none",
Colin Cross048f24e2021-09-01 17:26:00 -07002879}
2880
Colin Cross9da85fa2022-01-24 18:20:05 -08002881cc_library_host_static {
2882 name: "libb64",
2883 visibility: ["//external/musl"],
2884 srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
2885 export_include_dirs: ["b64/include"],
2886 local_include_dirs: [
2887 "private",
2888 "upstream-openbsd/android/include",
2889 ],
2890 cflags: [
2891 "-include openbsd-compat.h",
2892 ],
2893 enabled: false,
2894 target: {
2895 musl: {
2896 enabled: true,
2897 system_shared_libs: [],
2898 header_libs: ["libc_musl_headers"],
2899 },
2900 },
2901 stl: "none",
2902}
2903
Colin Cross9d4a56e2022-02-03 10:20:32 -08002904// Export kernel uapi headers to be used in the musl sysroot.
2905// Also include the execinfo headers for the libexecinfo and the
2906// b64 headers for libb64 embedded in musl libc.
2907cc_genrule {
2908 name: "libc_musl_sysroot_bionic_headers",
2909 visibility: ["//external/musl"],
2910 host_supported: true,
2911 device_supported: false,
2912 enabled: false,
2913 target: {
2914 musl: {
2915 enabled: true,
2916 },
2917 },
2918 srcs: [
2919 "kernel/uapi/**/*.h",
2920 "kernel/android/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002921 "execinfo/include/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002922 "b64/include/**/*.h",
Colin Crossaeef9f02022-02-07 21:01:26 -08002923
Colin Crossaeef9f02022-02-07 21:01:26 -08002924 "NOTICE",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002925
2926 ":libc_musl_sysroot_bionic_arch_headers",
2927 ],
2928 out: ["libc_musl_sysroot_bionic_headers.zip"],
2929 tools: [
2930 "soong_zip",
2931 "merge_zips",
2932 "zip2zip",
2933 ],
Colin Crossaeef9f02022-02-07 21:01:26 -08002934 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
2935 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
Colin Crossad33d022022-02-25 18:27:04 -08002936 // NOTICE
2937 " -j -f $(location NOTICE) " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002938 // headers
2939 " -P include " +
Colin Crossaeef9f02022-02-07 21:01:26 -08002940 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
2941 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
2942 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2943 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2944 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2945 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2946 " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
2947 " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
2948 " -C $${BIONIC_LIBC_DIR}/b64/include " +
2949 " -D $${BIONIC_LIBC_DIR}/b64/include " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002950 " && " +
Colin Crossad33d022022-02-25 18:27:04 -08002951 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
Colin Cross1c0a7a02022-08-11 12:22:26 -07002952 " -x **/BUILD " +
Colin Crossad33d022022-02-25 18:27:04 -08002953 " include/**/*:include/ " +
2954 " NOTICE:NOTICE.bionic " +
2955 " && " +
2956 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002957}
2958
2959// The architecture-specific bits have to be handled separately because the label varies based
2960// on architecture, which prevents using $(locations) to find them and requires using $(in)
2961// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
2962// genrule.
2963cc_genrule {
2964 name: "libc_musl_sysroot_bionic_arch_headers",
2965 visibility: ["//visibility:private"],
2966 host_supported: true,
2967 device_supported: false,
2968 enabled: false,
2969 target: {
2970 musl: {
2971 enabled: true,
2972 },
2973 },
2974 arch: {
2975 arm: {
2976 srcs: ["kernel/uapi/asm-arm/**/*.h"],
2977 },
2978 arm64: {
2979 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
2980 },
2981 x86: {
2982 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2983 },
2984 x86_64: {
2985 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2986 },
2987 },
2988 out: ["libc_musl_sysroot_bionic_arch_headers.zip"],
2989 tools: ["soong_zip"],
2990 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
2991}
Colin Cross290c4952022-10-13 12:51:13 -07002992
2993cc_genrule {
2994 name: "bionic_sysroot_crt_objects",
2995 visibility: ["//visibility:private"],
2996 out: ["bionic_sysroot_crt_objects.zip"],
2997 tools: ["soong_zip"],
2998 srcs: [
2999 ":crtbegin_dynamic",
3000 ":crtbegin_so",
3001 ":crtbegin_static",
3002 ":crtend_android",
3003 ":crtend_so",
3004 ],
3005 cmd: "$(location soong_zip) -o $(out) -j " +
3006 "-f $(location :crtbegin_dynamic) " +
3007 "-f $(location :crtbegin_so) " +
3008 "-f $(location :crtbegin_static) " +
3009 "-f $(location :crtend_android) " +
3010 "-f $(location :crtend_so)",
3011 dist: {
3012 targets: ["bionic_sysroot_crt_objects"],
3013 },
3014 arch: {
3015 arm: {
3016 dist: {
3017 suffix: "_arm",
3018 },
3019 },
3020 arm64: {
3021 dist: {
3022 suffix: "_arm64",
3023 },
3024 },
3025 riscv64: {
3026 dist: {
3027 suffix: "_riscv64",
3028 },
3029 },
3030 x86: {
3031 dist: {
3032 suffix: "_x86",
3033 },
3034 },
3035 x86_64: {
3036 dist: {
3037 suffix: "_x86_64",
3038 },
3039 },
3040 },
3041}
Spandan Das8fce52a2023-09-28 18:00:12 +00003042
3043// headers that will be placed on the include path when running versioner in bazel
3044// this module should be a no-op in soong
3045filegroup {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00003046 name: "versioner-dependencies",
3047 srcs: ["versioner-dependencies/**/*"],
Spandan Das8fce52a2023-09-28 18:00:12 +00003048}