blob: 807073a64a8009c2ac8abf96bc9441bf1d490c25 [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 },
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001282 whole_static_libs: [
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001283 "libsystemproperties",
1284 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001285 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001286 local_include_dirs: ["stdio"],
1287 include_dirs: ["bionic/libstdc++/include"],
1288 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001289 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001290}
1291
Dan Willemsen208ae172015-09-16 16:33:27 -07001292// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001293// libc_syscalls.a
1294// ========================================================
1295
Elliott Hughes782c4852019-04-16 12:31:00 -07001296genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001297 name: "syscalls-arm",
Elliott Hughes782c4852019-04-16 12:31:00 -07001298 out: ["syscalls-arm.S"],
1299 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001300 tools: ["gensyscalls"],
1301 cmd: "$(location gensyscalls) arm $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001302}
1303
1304genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001305 name: "syscalls-arm64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001306 out: ["syscalls-arm64.S"],
1307 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001308 tools: ["gensyscalls"],
1309 cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001310}
1311
1312genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001313 name: "syscalls-riscv64",
Elliott Hughes704772b2022-10-10 17:06:43 +00001314 out: ["syscalls-riscv64.S"],
1315 srcs: ["SYSCALLS.TXT"],
1316 tools: ["gensyscalls"],
1317 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
1318}
1319
1320genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001321 name: "syscalls-x86",
Elliott Hughes782c4852019-04-16 12:31:00 -07001322 out: ["syscalls-x86.S"],
1323 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001324 tools: ["gensyscalls"],
1325 cmd: "$(location gensyscalls) x86 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001326}
1327
1328genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001329 name: "syscalls-x86_64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001330 out: ["syscalls-x86_64.S"],
1331 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001332 tools: ["gensyscalls"],
1333 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001334}
1335
Dan Willemsen208ae172015-09-16 16:33:27 -07001336cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001337 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001338 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001339 arch: {
1340 arm: {
Cole Faustf5968d82023-04-11 15:20:19 -07001341 srcs: [":syscalls-arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001342 },
1343 arm64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001344 srcs: [":syscalls-arm64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001345 },
Elliott Hughes704772b2022-10-10 17:06:43 +00001346 riscv64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001347 srcs: [":syscalls-riscv64"],
Elliott Hughes704772b2022-10-10 17:06:43 +00001348 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001349 x86: {
Cole Faustf5968d82023-04-11 15:20:19 -07001350 srcs: [":syscalls-x86"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001351 },
1352 x86_64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001353 srcs: [":syscalls-x86_64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001354 },
1355 },
1356 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001357}
1358
1359// ========================================================
1360// libc_aeabi.a
1361// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1362// to avoid infinite recursion. For the other architectures we just build an
1363// empty library to keep this makefile simple.
1364// ========================================================
1365
1366cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001367 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001368 arch: {
1369 arm: {
1370 srcs: ["arch-arm/bionic/__aeabi.c"],
1371 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001372 },
1373 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001374 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001375}
1376
1377// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001378// libc_common.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001379// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001380
Dan Willemsen208ae172015-09-16 16:33:27 -07001381cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001382 defaults: ["libc_defaults"],
Elliott Hughesb0948922024-01-26 00:28:12 +00001383 name: "libc_common",
1384
Dan Willemsen208ae172015-09-16 16:33:27 -07001385 srcs: libc_common_src_files,
1386 multilib: {
1387 lib32: {
1388 srcs: libc_common_src_files_32,
1389 },
1390 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001391
1392 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001393 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001394 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001395 "libc_bionic",
1396 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001397 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001398 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001399 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001400 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001401 "libc_freebsd_large_stack",
Elliott Hughesc2043342023-07-20 20:24:09 +00001402 "libc_freebsd_ldexp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001403 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001404 "libc_netbsd",
1405 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001406 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001407 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001408 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001409 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001410 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001411 ],
1412
1413 arch: {
1414 arm: {
1415 whole_static_libs: ["libc_aeabi"],
1416 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001417 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001418}
1419
1420// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001421// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001422// ========================================================
1423cc_library_static {
1424 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001425 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001426
Haibo Huangb9244ff2018-08-11 10:12:13 -07001427 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301428 x86_64: {
1429 srcs: ["arch-x86_64/static_function_dispatch.S"],
1430 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001431 x86: {
1432 srcs: ["arch-x86/static_function_dispatch.S"],
1433 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001434 arm: {
1435 srcs: ["arch-arm/static_function_dispatch.S"],
1436 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001437 arm64: {
1438 srcs: ["arch-arm64/static_function_dispatch.S"],
1439 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001440 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001441 srcs: ["arch-riscv64/static_function_dispatch.S"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001442 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001443 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001444}
1445
1446// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001447// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001448// ========================================================
1449cc_library_static {
1450 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001451 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001452
Haibo Huangb9244ff2018-08-11 10:12:13 -07001453 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001454 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001455 "-fno-stack-protector",
1456 "-fno-jump-tables",
1457 ],
1458 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301459 x86_64: {
1460 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
1461 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001462 x86: {
1463 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1464 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001465 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001466 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001467 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001468 arm64: {
1469 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1470 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001471 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001472 srcs: ["arch-riscv64/dynamic_function_dispatch.cpp"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001473 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001474 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001475}
1476
1477// ========================================================
1478// libc_common_static.a For static binaries.
1479// ========================================================
1480cc_library_static {
1481 defaults: ["libc_defaults"],
1482 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001483
Haibo Huangf71edfa2018-11-12 10:06:56 -08001484 whole_static_libs: [
1485 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001486 "libc_static_dispatch",
1487 ],
1488}
1489
1490// ========================================================
1491// libc_common_shared.a For shared libraries.
1492// ========================================================
1493cc_library_static {
1494 defaults: ["libc_defaults"],
1495 name: "libc_common_shared",
1496
1497 whole_static_libs: [
1498 "libc_common",
1499 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001500 ],
1501}
1502
Ryan Prichard22a6a052019-10-10 23:59:30 -07001503// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1504// executable.
1505cc_library_static {
1506 name: "libc_unwind_static",
1507 defaults: ["libc_defaults"],
1508 cflags: ["-DLIBC_STATIC"],
1509
1510 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1511 arch: {
1512 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1513 arm: {
1514 srcs: ["arch-arm/bionic/exidx_static.c"],
1515 },
1516 },
1517}
1518
Haibo Huangf71edfa2018-11-12 10:06:56 -08001519// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001520// libc_nomalloc.a
1521// ========================================================
1522//
Ryan Prichard249757b2019-11-01 17:18:28 -07001523// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1524// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1525// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001526
1527cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001528 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001529 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001530
Colin Crossa3f9fca2016-01-11 13:20:55 -08001531 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001532 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001533 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001534 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001535 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001536}
1537
dimitryc0c0ef62018-12-05 16:33:52 +01001538filegroup {
1539 name: "libc_sources_shared",
1540 srcs: [
1541 "arch-common/bionic/crtbegin_so.c",
1542 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001543 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001544 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001545 "bionic/icu.cpp",
1546 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001547 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001548 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001549 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001550 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001551 "bionic/ndk_cruft.cpp",
1552 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001553 "bionic/NetdClient.cpp",
1554 "arch-common/bionic/crtend_so.S",
1555 ],
1556}
1557
1558filegroup {
1559 name: "libc_sources_static",
1560 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001561 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001562 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001563 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001564 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001565 ],
1566}
1567
1568filegroup {
1569 name: "libc_sources_shared_arm",
1570 srcs: [
1571 "arch-arm/bionic/exidx_dynamic.c",
1572 "arch-arm/bionic/atexit_legacy.c",
1573 ],
1574}
1575
Dan Willemsen208ae172015-09-16 16:33:27 -07001576// ========================================================
1577// libc.a + libc.so
1578// ========================================================
Florian Mayerc10d0642023-03-22 16:12:49 -07001579cc_defaults {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001580 defaults: [
1581 "libc_defaults",
1582 "libc_native_allocator_defaults",
1583 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001584 name: "libc_library_defaults",
Colin Cross50c21ab2015-10-31 23:03:05 -07001585 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001586 platform_sdk_version: {
1587 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1588 },
1589 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001590 static: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001591 srcs: [":libc_sources_static"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001592 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001593 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001594 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001595 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001596 "libc_init_static",
1597 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001598 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001599 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001600 },
1601 shared: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001602 srcs: [":libc_sources_shared"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001603 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001604 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001605 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001606 "libc_init_dynamic",
1607 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001608 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001609 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001610 },
1611
Neil Fullera7db90f2019-04-25 09:28:27 +01001612 required: [
MarkDacekd88d7ea2022-06-28 20:14:58 +00001613 "tzdata_prebuilt",
1614 "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
Neil Fullera7db90f2019-04-25 09:28:27 +01001615 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001616
Colin Cross4ce94d22016-11-15 13:15:43 -08001617 // Do not pack libc.so relocations; see http://b/20645321 for details.
1618 pack_relocations: false,
1619
dimitry06016f22018-01-05 11:39:28 +01001620 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1621 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1622 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1623 // those new libraries from libgcc.a are not declared external; if that were the case,
1624 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1625 // on the external symbols from the dependent libraries. That would create a "cloaked"
1626 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001627
dimitry06016f22018-01-05 11:39:28 +01001628 shared_libs: [
1629 "ld-android",
1630 "libdl",
1631 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001632 static_libs: [
1633 "libdl_android",
1634 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001635
1636 nocrt: true,
1637
Dan Willemsen208ae172015-09-16 16:33:27 -07001638 arch: {
1639 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001640 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001641 pack_relocations: false,
Christopher Ferris9d03a162023-11-10 11:19:11 -08001642 ldflags: [
1643 "-Wl,--hash-style=both",
1644 // Since we are preserving the debug_frame, do not compress
1645 // in this case to make unwinds as fast as possible.
1646 "-Wl,--compress-debug-sections=none",
1647 ],
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001648
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001649 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001650 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001651
Dan Willemsen208ae172015-09-16 16:33:27 -07001652 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001653 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001654 // special for arm
1655 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001656 // For backwards-compatibility, some arm32 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001657 static_libs: ["libclang_rt.builtins-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001658 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001659
1660 // Arm 32 bit does not produce complete exidx unwind information
1661 // so keep the .debug_frame which is relatively small and does
1662 // include needed unwind information.
1663 // See b/132992102 for details.
1664 strip: {
1665 keep_symbols_and_debug_frame: true,
1666 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001667 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001668 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001669 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001670
1671 // Leave the symbols in the shared library so that stack unwinders can produce
1672 // meaningful name resolution.
1673 strip: {
1674 keep_symbols: true,
1675 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001676 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001677 riscv64: {
1678 version_script: ":libc.riscv64.map",
1679
1680 // Leave the symbols in the shared library so that stack unwinders can produce
1681 // meaningful name resolution.
1682 strip: {
1683 keep_symbols: true,
1684 },
1685 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001686 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001687 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001688 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001689 ldflags: ["-Wl,--hash-style=both"],
1690
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001691 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001692 no_libcrt: true,
1693
1694 shared: {
1695 // For backwards-compatibility, some x86 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001696 static_libs: ["libclang_rt.builtins-exported"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001697 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001698
1699 // Leave the symbols in the shared library so that stack unwinders can produce
1700 // meaningful name resolution.
1701 strip: {
1702 keep_symbols: true,
1703 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001704 },
1705 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001706 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001707
1708 // Leave the symbols in the shared library so that stack unwinders can produce
1709 // meaningful name resolution.
1710 strip: {
1711 keep_symbols: true,
1712 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001713 },
1714 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001715
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001716 apex_available: [
1717 "//apex_available:platform",
1718 "com.android.runtime",
1719 ],
1720
Colin Cross7edd0082021-10-28 13:20:35 -07001721 target: {
1722 native_bridge: {
1723 shared: {
1724 installable: false,
1725 },
1726 },
1727 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001728}
1729
Florian Mayerc10d0642023-03-22 16:12:49 -07001730cc_library {
1731 name: "libc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001732 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001733 "libc_library_defaults",
1734 ],
1735 stubs: {
1736 symbol_file: "libc.map.txt",
1737 versions: [
1738 "29",
1739 "R",
1740 "current",
1741 ],
1742 },
1743 static_ndk_lib: true,
1744 llndk: {
1745 symbol_file: "libc.map.txt",
1746 export_headers_as_system: true,
1747 export_preprocessed_headers: ["include"],
1748 export_llndk_headers: ["libc_llndk_headers"],
1749 },
1750}
1751
1752cc_library {
1753 name: "libc_hwasan",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001754 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001755 "libc_library_defaults",
1756 ],
1757 sanitize: {
1758 hwaddress: true,
1759 },
1760 enabled: false,
Florian Mayerff116ed2023-04-14 17:38:53 -07001761 target: {
1762 android_arm64: {
Florian Mayerc10d0642023-03-22 16:12:49 -07001763 enabled: true,
1764 },
1765 },
1766 stem: "libc",
1767 relative_install_path: "hwasan",
1768 // We don't really need the stubs, but this needs to stay to trigger the
1769 // symlink logic in soong.
1770 stubs: {
1771 symbol_file: "libc.map.txt",
1772 },
1773 native_bridge_supported: false,
1774 // It is never correct to depend on this directly. This is only
1775 // needed for the runtime apex, and in base_system.mk.
1776 visibility: ["//bionic/apex"],
1777}
1778
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001779genrule {
1780 name: "libc.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001781 out: ["libc.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001782 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001783 tools: ["generate-version-script"],
1784 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001785}
1786
1787genrule {
1788 name: "libc.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001789 out: ["libc.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001790 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001791 tools: ["generate-version-script"],
1792 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001793}
1794
1795genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001796 name: "libc.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001797 out: ["libc.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001798 srcs: ["libc.map.txt"],
1799 tools: ["generate-version-script"],
1800 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1801}
1802
1803genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001804 name: "libc.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001805 out: ["libc.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001806 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001807 tools: ["generate-version-script"],
1808 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001809}
1810
1811genrule {
1812 name: "libc.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001813 out: ["libc.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001814 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001815 tools: ["generate-version-script"],
1816 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001817}
1818
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001819// Headers that only other parts of the platform can include.
1820cc_library_headers {
1821 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001822 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001823 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001824 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001825 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001826 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001827 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001828 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001829 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001830 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001831 "//system/core/debuggerd:__subpackages__",
Florian Mayerf5d70ce2022-09-13 13:58:30 -07001832 "//system/core/init:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001833 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001834 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001835 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001836 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001837 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001838 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001839 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001840 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001841 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001842 recovery_available: true,
1843 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001844 export_include_dirs: [
1845 "platform",
1846 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001847 system_shared_libs: [],
1848 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001849 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001850
Steven Moreland0cdf1322020-10-05 21:55:26 +00001851 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001852 apex_available: [
1853 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001854 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001855 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001856}
1857
Logan Chien17af91b2019-01-15 21:19:56 +08001858cc_library_headers {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001859 name: "libc_llndk_headers",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001860 visibility: [
1861 "//external/musl",
1862 ],
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001863 llndk: {
1864 llndk_headers: true,
1865 },
Logan Chien17af91b2019-01-15 21:19:56 +08001866 host_supported: true,
1867 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001868 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001869 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001870 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001871 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001872 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001873 apex_available: [
1874 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001875 "//apex_available:anyapex",
1876 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001877 // used by most APEXes indirectly via libunwind_llvm
1878 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001879
1880 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001881 stl: "none",
1882 system_shared_libs: [],
1883
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001884 // The build system generally requires that any dependencies of a target
1885 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1886 // to 1 we let targets with an sdk_version that need to depend on the libc
1887 // headers but cannot depend on libc itself due to circular dependencies
1888 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1889 // is correct because the headers can support any sdk_version.
1890 sdk_version: "1",
1891
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001892 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001893 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001894 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001895 "kernel/android/uapi",
1896 ],
1897
1898 arch: {
1899 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001900 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001901 },
1902 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001903 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001904 },
Elliott Hughes48e53332022-10-07 20:39:25 +00001905 riscv64: {
1906 export_system_include_dirs: ["kernel/uapi/asm-riscv"],
1907 },
Logan Chien17af91b2019-01-15 21:19:56 +08001908 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001909 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001910 },
1911 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001912 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001913 },
1914 },
1915}
1916
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001917cc_library_headers {
1918 name: "libc_headers",
1919 host_supported: true,
1920 native_bridge_supported: true,
1921 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001922 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001923 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001924 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001925 recovery_available: true,
1926 sdk_version: "1",
1927
1928 apex_available: [
1929 "//apex_available:platform",
1930 "//apex_available:anyapex",
1931 ],
1932 // used by most APEXes indirectly via libunwind_llvm
1933 min_sdk_version: "apex_inherit",
1934 visibility: [
1935 "//bionic:__subpackages__", // visible to bionic
1936 // ... and only to these places (b/152668052)
1937 "//external/arm-optimized-routines",
1938 "//external/gwp_asan",
1939 "//external/jemalloc_new",
1940 "//external/libunwind_llvm",
1941 "//external/scudo",
1942 "//system/core/property_service/libpropertyinfoparser",
1943 "//system/extras/toolchain-extras",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001944 ],
1945
1946 stl: "none",
1947 no_libcrt: true,
1948 system_shared_libs: [],
1949
1950 target: {
1951 android: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001952 export_system_include_dirs: ["include"],
1953 header_libs: ["libc_llndk_headers"],
1954 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001955 },
1956 linux_bionic: {
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 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001961 },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001962}
1963
Dan Willemsen208ae172015-09-16 16:33:27 -07001964// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001965// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001966// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001967
Dan Willemsen208ae172015-09-16 16:33:27 -07001968cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001969 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001970 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001971 srcs: [
1972 "bionic/__cxa_guard.cpp",
1973 "bionic/__cxa_pure_virtual.cpp",
1974 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001975 ],
1976 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001977 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001978 static_libs: ["libasync_safe"],
Elliott Hughesc2043342023-07-20 20:24:09 +00001979 apex_available: [
1980 "//apex_available:platform",
1981 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001982
Dan Willemsen6b3be172018-12-03 13:57:20 -08001983 static: {
1984 system_shared_libs: [],
1985 },
Colin Crossb5bfe0b2021-07-13 16:26:28 -07001986 target: {
1987 bionic: {
1988 shared: {
1989 system_shared_libs: ["libc"],
1990 },
1991 },
Dan Willemsen6b3be172018-12-03 13:57:20 -08001992 },
1993
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001994 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001995 arch: {
1996 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001997 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001998 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001999 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002000 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07002001 },
2002 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002003 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07002004 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00002005 riscv64: {
2006 version_script: ":libstdc++.riscv64.map",
2007 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002008 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07002009 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08002010 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002011 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07002012 },
2013 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002014 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07002015 },
2016 },
2017}
2018
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002019genrule {
2020 name: "libstdc++.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002021 out: ["libstdc++.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002022 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002023 tools: ["generate-version-script"],
2024 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002025}
2026
2027genrule {
2028 name: "libstdc++.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002029 out: ["libstdc++.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002030 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002031 tools: ["generate-version-script"],
2032 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002033}
2034
2035genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00002036 name: "libstdc++.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002037 out: ["libstdc++.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00002038 srcs: ["libstdc++.map.txt"],
2039 tools: ["generate-version-script"],
2040 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
2041}
2042
2043genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002044 name: "libstdc++.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002045 out: ["libstdc++.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002046 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002047 tools: ["generate-version-script"],
2048 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002049}
2050
2051genrule {
2052 name: "libstdc++.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002053 out: ["libstdc++.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002054 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002055 tools: ["generate-version-script"],
2056 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002057}
2058
2059// ========================================================
2060// crt object files.
2061// ========================================================
2062
Colin Cross50c21ab2015-10-31 23:03:05 -07002063cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002064 name: "crt_and_memtag_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002065 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002066 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002067 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002068 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002069 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002070 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002071 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002072 apex_available: [
2073 "//apex_available:platform",
2074 "//apex_available:anyapex",
2075 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002076 // Generate NDK variants of the CRT objects for every supported API level.
2077 min_sdk_version: "16",
2078 stl: "none",
2079 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002080 cflags: [
2081 "-Wno-gcc-compat",
2082 "-Wall",
2083 "-Werror",
2084 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002085 sanitize: {
2086 never: true,
2087 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002088}
2089
Colin Cross50c21ab2015-10-31 23:03:05 -07002090cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002091 name: "crt_defaults",
2092 defaults: ["crt_and_memtag_defaults"],
Colin Cross02f81372021-07-22 12:02:10 -07002093 system_shared_libs: [],
Colin Cross10d92682021-06-22 13:25:46 -07002094}
2095
2096cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002097 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002098 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002099
2100 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002101 x86: {
2102 cflags: ["-fPIC"],
2103 },
2104 x86_64: {
2105 cflags: ["-fPIC"],
2106 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002107 },
Colin Crossab179442018-09-27 11:03:22 -07002108 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002109}
2110
Dan Willemsen208ae172015-09-16 16:33:27 -07002111cc_object {
2112 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002113 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002114 local_include_dirs: [
2115 "include",
2116 "private", // crtbrand.S depends on private/bionic_asm_note.h
2117 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002118 product_variables: {
2119 platform_sdk_version: {
2120 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2121 },
2122 },
2123 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002124
Colin Cross7d7b3682017-11-03 13:38:40 -07002125 defaults: ["crt_so_defaults"],
Dan Alberteee46dc2023-04-04 23:27:52 +00002126 // crtbrand is an intermediate artifact, not a final CRT object.
2127 exclude_from_ndk_sysroot: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07002128}
2129
Dan Willemsen208ae172015-09-16 16:33:27 -07002130cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002131 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002132 local_include_dirs: ["include"],
2133 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002134
Colin Cross7d7b3682017-11-03 13:38:40 -07002135 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002136 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002137 "crtbrand",
2138 ],
2139}
2140
Dan Willemsen208ae172015-09-16 16:33:27 -07002141cc_object {
2142 name: "crtend_so",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002143 local_include_dirs: [
2144 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002145 "private", // crtend_so.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002146 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002147 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002148
Colin Cross7d7b3682017-11-03 13:38:40 -07002149 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002150}
2151
Dan Willemsen208ae172015-09-16 16:33:27 -07002152cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002153 name: "crtbegin_static",
2154
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002155 local_include_dirs: [
2156 "include",
2157 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2158 ],
Liz Kammere718dd72021-03-09 15:00:06 -05002159
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002160 cflags: ["-DCRTBEGIN_STATIC"],
Yabin Cui744cfd32023-08-24 13:20:23 -07002161
Dan Willemsen208ae172015-09-16 16:33:27 -07002162 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002163 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002164 "crtbrand",
2165 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002166 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002167 // When using libc.a, we're using the latest library regardless of target API level.
2168 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002169}
2170
Dan Willemsen208ae172015-09-16 16:33:27 -07002171cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002172 name: "crtbegin_dynamic",
2173
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002174 local_include_dirs: [
2175 "include",
2176 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2177 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002178 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002179 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002180 "crtbrand",
2181 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002182 target: {
2183 linux_bionic: {
2184 generated_sources: ["host_bionic_linker_asm"],
2185 objs: [
2186 "linker_wrapper",
2187 ],
2188 },
2189 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002190 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002191}
2192
Dan Willemsen208ae172015-09-16 16:33:27 -07002193cc_object {
2194 // We rename crtend.o to crtend_android.o to avoid a
2195 // name clash between gcc and bionic.
2196 name: "crtend_android",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002197 local_include_dirs: [
2198 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002199 "private", // crtend.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002200 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002201 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002202
Colin Cross50c21ab2015-10-31 23:03:05 -07002203 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002204}
Colin Crossbaa48992016-07-13 11:15:21 -07002205
Kalesh Singh862a23d2024-01-09 13:13:50 -08002206cc_object {
2207 name: "crt_pad_segment",
2208 local_include_dirs: [
2209 "include",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002210 "private", // crt_pad_segment.S depends on private/bionic_asm_note.h
Kalesh Singh862a23d2024-01-09 13:13:50 -08002211 ],
2212 srcs: ["arch-common/bionic/crt_pad_segment.S"],
2213
2214 defaults: ["crt_defaults"],
2215}
2216
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002217cc_library_static {
2218 name: "note_memtag_heap_async",
2219 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002220 arm64: {
2221 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2222 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002223 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002224 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002225
Colin Cross10d92682021-06-22 13:25:46 -07002226 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002227}
2228
2229cc_library_static {
2230 name: "note_memtag_heap_sync",
2231 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002232 arm64: {
2233 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2234 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002235 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002236 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002237
Colin Cross10d92682021-06-22 13:25:46 -07002238 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002239}
2240
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002241// ========================================================
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002242// libc dependencies for baremetal Rust projects.
2243// ========================================================
2244
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002245// This library contains the following unresolved symbols:
2246// __errno
2247// abort
2248// async_safe_fatal_va_list
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002249cc_library_static {
2250 name: "librust_baremetal",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002251 header_libs: ["libc_headers"],
2252 include_dirs: [
2253 "bionic/libc/async_safe/include",
2254 "bionic/libc/platform",
2255 ],
2256 cflags: [
2257 "-Wall",
2258 "-Werror",
2259 ],
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002260 srcs: [
2261 "bionic/fortify.cpp",
Pierre-Clément Tosi816176c2022-11-30 14:33:41 +00002262 "bionic/strtol.cpp",
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002263 ],
2264 arch: {
2265 arm64: {
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002266 srcs: [
2267 "arch-arm64/string/__memcpy_chk.S",
2268 ],
2269 },
caowencheng9a39eb32023-03-20 16:24:41 +08002270 riscv64: {
2271 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002272 "arch-riscv64/string/__memcpy_chk.S",
caowencheng9a39eb32023-03-20 16:24:41 +08002273 ],
2274 },
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002275 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002276 whole_static_libs: [
2277 "libarm-optimized-routines-mem",
Pierre-Clément Tosieb46ac92023-02-01 13:44:57 +00002278 "libc_netbsd",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002279 ],
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002280 system_shared_libs: [],
2281 nocrt: true,
2282 stl: "none",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002283 visibility: [
2284 "//packages/modules/Virtualization/vmbase",
2285 ],
2286}
2287
2288// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002289// NDK headers.
2290// ========================================================
2291
Dan Albert26e1c412018-05-24 14:56:46 -07002292versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002293 name: "common_libc",
2294 from: "include",
2295 to: "",
2296 license: "NOTICE",
2297}
Dan Albert4238a352016-06-28 11:18:05 -07002298
2299ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002300 name: "libc_uapi",
2301 from: "kernel/uapi",
2302 to: "",
2303 srcs: [
2304 "kernel/uapi/asm-generic/**/*.h",
2305 "kernel/uapi/drm/**/*.h",
2306 "kernel/uapi/linux/**/*.h",
2307 "kernel/uapi/misc/**/*.h",
2308 "kernel/uapi/mtd/**/*.h",
2309 "kernel/uapi/rdma/**/*.h",
2310 "kernel/uapi/scsi/**/*.h",
2311 "kernel/uapi/sound/**/*.h",
2312 "kernel/uapi/video/**/*.h",
2313 "kernel/uapi/xen/**/*.h",
2314 ],
Dan Albert92592652016-10-20 01:42:54 -07002315 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002316}
2317
2318ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002319 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002320 from: "kernel/android/uapi/linux",
2321 to: "linux",
2322 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002323 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002324}
2325
2326ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002327 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002328 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002329 to: "scsi",
2330 srcs: ["kernel/android/scsi/**/*.h"],
2331 license: "NOTICE",
2332}
2333
2334ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002335 name: "libc_asm_arm",
2336 from: "kernel/uapi/asm-arm",
2337 to: "arm-linux-androideabi",
2338 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002339 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002340}
2341
2342ndk_headers {
2343 name: "libc_asm_arm64",
2344 from: "kernel/uapi/asm-arm64",
2345 to: "aarch64-linux-android",
2346 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002347 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002348}
2349
Lazar Trsic790d2f72017-11-27 11:54:11 +01002350ndk_headers {
Colin Crossbd26e0f2022-10-19 15:03:14 -07002351 name: "libc_asm_riscv64",
2352 from: "kernel/uapi/asm-riscv",
2353 to: "riscv64-linux-android",
2354 srcs: ["kernel/uapi/asm-riscv/**/*.h"],
2355 license: "NOTICE",
2356}
2357
2358ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002359 name: "libc_asm_x86",
2360 from: "kernel/uapi/asm-x86",
2361 to: "i686-linux-android",
2362 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002363 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002364}
2365
2366ndk_headers {
2367 name: "libc_asm_x86_64",
2368 from: "kernel/uapi/asm-x86",
2369 to: "x86_64-linux-android",
2370 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002371 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002372}
2373
Dan Albert4238a352016-06-28 11:18:05 -07002374ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002375 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002376 symbol_file: "libc.map.txt",
2377 first_version: "9",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002378 export_header_libs: [
2379 "common_libc",
2380 "libc_uapi",
2381 "libc_kernel_android_uapi_linux",
2382 "libc_kernel_android_scsi",
2383 "libc_asm_arm",
2384 "libc_asm_arm64",
Colin Crossbd26e0f2022-10-19 15:03:14 -07002385 "libc_asm_riscv64",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002386 "libc_asm_x86",
2387 "libc_asm_x86_64",
2388 ],
Dan Albert4238a352016-06-28 11:18:05 -07002389}
2390
Dan Albertdf31aff2016-10-06 15:50:41 -07002391ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002392 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002393 symbol_file: "libstdc++.map.txt",
2394 first_version: "9",
2395}
2396
Dan Willemsenca056d72018-01-08 14:00:24 -08002397// Export these headers for toolbox to process
2398filegroup {
2399 name: "kernel_input_headers",
2400 srcs: [
2401 "kernel/uapi/linux/input.h",
2402 "kernel/uapi/linux/input-event-codes.h",
2403 ],
2404}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002405
2406// Generate a syscall name / number mapping. These objects are text files
2407// (thanks to the -dD -E flags) and not binary files. They will then be
2408// consumed by the genseccomp.py script and converted into C++ code.
2409cc_defaults {
2410 name: "libseccomp_gen_syscall_nrs_defaults",
2411 recovery_available: true,
2412 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2413 cflags: [
2414 "-dD",
2415 "-E",
2416 "-Wall",
2417 "-Werror",
2418 "-nostdinc",
2419 ],
2420}
2421
2422cc_object {
2423 name: "libseccomp_gen_syscall_nrs_arm",
2424 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2425 local_include_dirs: [
2426 "kernel/uapi/asm-arm",
2427 "kernel/uapi",
2428 ],
2429}
2430
2431cc_object {
2432 name: "libseccomp_gen_syscall_nrs_arm64",
2433 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2434 local_include_dirs: [
2435 "kernel/uapi/asm-arm64",
2436 "kernel/uapi",
2437 ],
2438}
2439
2440cc_object {
Elliott Hughes704772b2022-10-10 17:06:43 +00002441 name: "libseccomp_gen_syscall_nrs_riscv64",
2442 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2443 local_include_dirs: [
2444 "kernel/uapi/asm-riscv",
2445 "kernel/uapi",
2446 ],
2447}
2448
2449cc_object {
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002450 name: "libseccomp_gen_syscall_nrs_x86",
2451 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2452 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2453 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2454 local_include_dirs: [
2455 "kernel/uapi/asm-x86",
2456 "kernel/uapi",
2457 ],
2458}
2459
2460cc_object {
2461 name: "libseccomp_gen_syscall_nrs_x86_64",
2462 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2463 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2464 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2465 local_include_dirs: [
2466 "kernel/uapi/asm-x86",
2467 "kernel/uapi",
2468 ],
2469}
2470
Jingwen Chenca366332021-01-29 05:16:32 -05002471filegroup {
2472 name: "all_kernel_uapi_headers",
2473 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002474}
2475
Martijn Coenen0c6de752019-01-02 12:52:51 +01002476cc_genrule {
2477 name: "func_to_syscall_nrs",
2478 recovery_available: true,
2479 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2480
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002481 tools: ["genfunctosyscallnrs"],
Martijn Coenen0c6de752019-01-02 12:52:51 +01002482
2483 srcs: [
2484 "SYSCALLS.TXT",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002485 ],
2486
Elliott Hughes704772b2022-10-10 17:06:43 +00002487 arch: {
2488 arm: {
2489 srcs: [
2490 ":libseccomp_gen_syscall_nrs_arm",
2491 ":libseccomp_gen_syscall_nrs_arm64",
2492 ],
2493 },
2494 arm64: {
2495 srcs: [
2496 ":libseccomp_gen_syscall_nrs_arm",
2497 ":libseccomp_gen_syscall_nrs_arm64",
2498 ],
2499 },
2500 riscv64: {
2501 srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
2502 },
2503 x86: {
2504 srcs: [
2505 ":libseccomp_gen_syscall_nrs_x86",
2506 ":libseccomp_gen_syscall_nrs_x86_64",
2507 ],
2508 },
2509 x86_64: {
2510 srcs: [
2511 ":libseccomp_gen_syscall_nrs_x86",
2512 ":libseccomp_gen_syscall_nrs_x86_64",
2513 ],
2514 },
2515 },
2516
Martijn Coenen0c6de752019-01-02 12:52:51 +01002517 out: [
2518 "func_to_syscall_nrs.h",
2519 ],
2520}
2521
Victor Hsiehdbb86702020-06-15 09:29:07 -07002522// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002523genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002524 name: "generate_app_zygote_blocklist",
2525 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2526 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002527 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2528}
2529
Yu Liu938ec9b2022-10-17 16:36:30 -07002530filegroup {
2531 name: "seccomp_syscalls_sources_zygote",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002532 srcs: [
2533 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002534 "SECCOMP_ALLOWLIST_COMMON.TXT",
2535 "SECCOMP_ALLOWLIST_APP.TXT",
2536 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002537 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002538 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002539 ],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002540}
2541
Yu Liu938ec9b2022-10-17 16:36:30 -07002542filegroup {
2543 name: "seccomp_syscalls_sources_app",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002544 srcs: [
2545 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002546 "SECCOMP_ALLOWLIST_COMMON.TXT",
2547 "SECCOMP_ALLOWLIST_APP.TXT",
2548 "SECCOMP_BLOCKLIST_COMMON.TXT",
2549 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002550 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002551 ],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002552}
2553
Yu Liu938ec9b2022-10-17 16:36:30 -07002554filegroup {
2555 name: "seccomp_syscalls_sources_system",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002556 srcs: [
2557 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002558 "SECCOMP_ALLOWLIST_COMMON.TXT",
2559 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2560 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002561 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002562 ],
Yu Liu938ec9b2022-10-17 16:36:30 -07002563}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002564
Yu Liu938ec9b2022-10-17 16:36:30 -07002565cc_genrule {
2566 name: "libseccomp_policy_app_zygote_sources_x86",
2567 recovery_available: true,
2568 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002569 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002570 srcs: [
2571 ":seccomp_syscalls_sources_zygote",
2572 ":libseccomp_gen_syscall_nrs_x86",
2573 ":libseccomp_gen_syscall_nrs_x86_64",
2574 ],
2575 out: [
2576 "x86_app_zygote_policy.cpp",
2577 "x86_64_app_zygote_policy.cpp",
2578 ],
2579 enabled: false,
Yu Liu3a579692022-10-18 03:02:32 +00002580 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002581 x86: {
2582 enabled: true,
2583 },
2584 x86_64: {
2585 enabled: true,
2586 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002587 },
2588}
2589
2590cc_genrule {
2591 name: "libseccomp_policy_app_zygote_sources_arm",
2592 recovery_available: true,
2593 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002594 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002595 srcs: [
2596 ":seccomp_syscalls_sources_zygote",
2597 ":libseccomp_gen_syscall_nrs_arm",
2598 ":libseccomp_gen_syscall_nrs_arm64",
2599 ],
2600 out: [
2601 "arm_app_zygote_policy.cpp",
2602 "arm64_app_zygote_policy.cpp",
2603 ],
2604 enabled: false,
2605 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002606 arm: {
2607 enabled: true,
2608 },
2609 arm64: {
2610 enabled: true,
2611 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002612 },
2613}
2614
2615cc_genrule {
2616 name: "libseccomp_policy_app_zygote_sources_riscv64",
2617 recovery_available: true,
2618 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002619 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002620 srcs: [
2621 ":seccomp_syscalls_sources_zygote",
2622 ":libseccomp_gen_syscall_nrs_riscv64",
2623 ],
2624 out: [
2625 "riscv64_app_zygote_policy.cpp",
2626 ],
2627 enabled: false,
2628 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002629 riscv64: {
2630 enabled: true,
2631 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002632 },
2633}
2634
2635cc_genrule {
2636 name: "libseccomp_policy_app_sources_x86",
2637 recovery_available: true,
2638 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002639 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002640 srcs: [
2641 ":seccomp_syscalls_sources_app",
2642 ":libseccomp_gen_syscall_nrs_x86",
2643 ":libseccomp_gen_syscall_nrs_x86_64",
2644 ],
2645 out: [
2646 "x86_app_policy.cpp",
2647 "x86_64_app_policy.cpp",
2648 ],
2649 enabled: false,
2650 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002651 x86: {
2652 enabled: true,
2653 },
2654 x86_64: {
2655 enabled: true,
2656 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002657 },
2658}
2659
2660cc_genrule {
2661 name: "libseccomp_policy_app_sources_arm",
2662 recovery_available: true,
2663 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002664 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002665 srcs: [
2666 ":seccomp_syscalls_sources_app",
2667 ":libseccomp_gen_syscall_nrs_arm",
2668 ":libseccomp_gen_syscall_nrs_arm64",
2669 ],
2670 out: [
2671 "arm_app_policy.cpp",
2672 "arm64_app_policy.cpp",
2673 ],
2674 enabled: false,
2675 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002676 arm: {
2677 enabled: true,
2678 },
2679 arm64: {
2680 enabled: true,
2681 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002682 },
2683}
2684
2685cc_genrule {
2686 name: "libseccomp_policy_app_sources_riscv64",
2687 recovery_available: true,
2688 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002689 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002690 srcs: [
2691 ":seccomp_syscalls_sources_app",
2692 ":libseccomp_gen_syscall_nrs_riscv64",
2693 ],
2694 out: [
2695 "riscv64_app_policy.cpp",
2696 ],
2697 enabled: false,
2698 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002699 riscv64: {
2700 enabled: true,
2701 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002702 },
2703}
2704
2705cc_genrule {
2706 name: "libseccomp_policy_system_sources_x86",
2707 recovery_available: true,
2708 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002709 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002710 srcs: [
2711 ":seccomp_syscalls_sources_system",
2712 ":libseccomp_gen_syscall_nrs_x86",
2713 ":libseccomp_gen_syscall_nrs_x86_64",
2714 ],
2715 out: [
2716 "x86_system_policy.cpp",
2717 "x86_64_system_policy.cpp",
2718 ],
2719 enabled: false,
2720 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002721 x86: {
2722 enabled: true,
2723 },
2724 x86_64: {
2725 enabled: true,
2726 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002727 },
2728}
2729
2730cc_genrule {
2731 name: "libseccomp_policy_system_sources_arm",
2732 recovery_available: true,
2733 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002734 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002735 srcs: [
2736 ":seccomp_syscalls_sources_system",
2737 ":libseccomp_gen_syscall_nrs_arm",
2738 ":libseccomp_gen_syscall_nrs_arm64",
2739 ],
2740 out: [
2741 "arm_system_policy.cpp",
2742 "arm64_system_policy.cpp",
2743 ],
2744 enabled: false,
2745 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002746 arm: {
2747 enabled: true,
2748 },
2749 arm64: {
2750 enabled: true,
2751 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002752 },
2753}
2754
2755cc_genrule {
2756 name: "libseccomp_policy_system_sources_riscv64",
2757 recovery_available: true,
2758 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002759 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002760 srcs: [
2761 ":seccomp_syscalls_sources_system",
2762 ":libseccomp_gen_syscall_nrs_riscv64",
2763 ],
2764 out: [
2765 "riscv64_system_policy.cpp",
2766 ],
2767 enabled: false,
2768 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002769 riscv64: {
2770 enabled: true,
2771 },
Yu Liu3a579692022-10-18 03:02:32 +00002772 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002773}
2774
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002775cc_library {
2776 name: "libseccomp_policy",
2777 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002778 generated_headers: ["func_to_syscall_nrs"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002779
2780 arch: {
2781 arm: {
2782 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002783 "libseccomp_policy_app_sources_arm",
2784 "libseccomp_policy_app_zygote_sources_arm",
2785 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002786 ],
2787 },
2788 arm64: {
2789 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002790 "libseccomp_policy_app_sources_arm",
2791 "libseccomp_policy_app_zygote_sources_arm",
2792 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002793 ],
2794 },
2795 riscv64: {
2796 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002797 "libseccomp_policy_app_sources_riscv64",
2798 "libseccomp_policy_app_zygote_sources_riscv64",
2799 "libseccomp_policy_system_sources_riscv64",
Yu Liu938ec9b2022-10-17 16:36:30 -07002800 ],
2801 },
2802 x86: {
2803 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002804 "libseccomp_policy_app_sources_x86",
2805 "libseccomp_policy_app_zygote_sources_x86",
2806 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002807 ],
2808 },
2809 x86_64: {
2810 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002811 "libseccomp_policy_app_sources_x86",
2812 "libseccomp_policy_app_zygote_sources_x86",
2813 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002814 ],
2815 },
2816 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002817
2818 srcs: [
2819 "seccomp/seccomp_policy.cpp",
2820 ],
2821
2822 export_include_dirs: ["seccomp/include"],
2823 cflags: [
2824 "-Wall",
2825 "-Werror",
2826 ],
2827 shared: {
2828 shared_libs: ["libbase"],
2829 },
2830 static: {
2831 static_libs: ["libbase"],
2832 },
2833}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002834
Colin Cross048f24e2021-09-01 17:26:00 -07002835cc_library_host_static {
2836 name: "libfts",
2837 srcs: [
2838 "bionic/fts.c",
2839 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
2840 ],
2841 export_include_dirs: ["fts/include"],
2842 local_include_dirs: [
2843 "private",
2844 "upstream-openbsd/android/include",
2845 ],
2846 cflags: [
2847 "-include openbsd-compat.h",
2848 "-Wno-unused-parameter",
2849 ],
2850 enabled: false,
2851 target: {
2852 musl: {
2853 enabled: true,
2854 },
2855 },
Colin Cross2a9843f2022-01-13 12:26:30 -08002856 stl: "none",
2857}
2858
2859cc_library_host_static {
2860 name: "libexecinfo",
2861 visibility: ["//external/musl"],
2862 srcs: ["bionic/execinfo.cpp"],
2863 export_include_dirs: ["execinfo/include"],
2864 local_include_dirs: ["private"],
2865 enabled: false,
2866 target: {
2867 musl: {
2868 enabled: true,
2869 system_shared_libs: [],
2870 header_libs: ["libc_musl_headers"],
2871 },
2872 },
2873 stl: "none",
Colin Cross048f24e2021-09-01 17:26:00 -07002874}
2875
Colin Cross9da85fa2022-01-24 18:20:05 -08002876cc_library_host_static {
2877 name: "libb64",
2878 visibility: ["//external/musl"],
2879 srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
2880 export_include_dirs: ["b64/include"],
2881 local_include_dirs: [
2882 "private",
2883 "upstream-openbsd/android/include",
2884 ],
2885 cflags: [
2886 "-include openbsd-compat.h",
2887 ],
2888 enabled: false,
2889 target: {
2890 musl: {
2891 enabled: true,
2892 system_shared_libs: [],
2893 header_libs: ["libc_musl_headers"],
2894 },
2895 },
2896 stl: "none",
2897}
2898
Colin Cross9d4a56e2022-02-03 10:20:32 -08002899// Export kernel uapi headers to be used in the musl sysroot.
2900// Also include the execinfo headers for the libexecinfo and the
2901// b64 headers for libb64 embedded in musl libc.
2902cc_genrule {
2903 name: "libc_musl_sysroot_bionic_headers",
2904 visibility: ["//external/musl"],
2905 host_supported: true,
2906 device_supported: false,
2907 enabled: false,
2908 target: {
2909 musl: {
2910 enabled: true,
2911 },
2912 },
2913 srcs: [
2914 "kernel/uapi/**/*.h",
2915 "kernel/android/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002916 "execinfo/include/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002917 "b64/include/**/*.h",
Colin Crossaeef9f02022-02-07 21:01:26 -08002918
Colin Crossaeef9f02022-02-07 21:01:26 -08002919 "NOTICE",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002920
2921 ":libc_musl_sysroot_bionic_arch_headers",
2922 ],
2923 out: ["libc_musl_sysroot_bionic_headers.zip"],
2924 tools: [
2925 "soong_zip",
2926 "merge_zips",
2927 "zip2zip",
2928 ],
Colin Crossaeef9f02022-02-07 21:01:26 -08002929 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
2930 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
Colin Crossad33d022022-02-25 18:27:04 -08002931 // NOTICE
2932 " -j -f $(location NOTICE) " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002933 // headers
2934 " -P include " +
Colin Crossaeef9f02022-02-07 21:01:26 -08002935 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
2936 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
2937 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2938 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2939 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2940 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2941 " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
2942 " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
2943 " -C $${BIONIC_LIBC_DIR}/b64/include " +
2944 " -D $${BIONIC_LIBC_DIR}/b64/include " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002945 " && " +
Colin Crossad33d022022-02-25 18:27:04 -08002946 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
Colin Cross1c0a7a02022-08-11 12:22:26 -07002947 " -x **/BUILD " +
Colin Crossad33d022022-02-25 18:27:04 -08002948 " include/**/*:include/ " +
2949 " NOTICE:NOTICE.bionic " +
2950 " && " +
2951 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002952}
2953
2954// The architecture-specific bits have to be handled separately because the label varies based
2955// on architecture, which prevents using $(locations) to find them and requires using $(in)
2956// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
2957// genrule.
2958cc_genrule {
2959 name: "libc_musl_sysroot_bionic_arch_headers",
2960 visibility: ["//visibility:private"],
2961 host_supported: true,
2962 device_supported: false,
2963 enabled: false,
2964 target: {
2965 musl: {
2966 enabled: true,
2967 },
2968 },
2969 arch: {
2970 arm: {
2971 srcs: ["kernel/uapi/asm-arm/**/*.h"],
2972 },
2973 arm64: {
2974 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
2975 },
2976 x86: {
2977 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2978 },
2979 x86_64: {
2980 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2981 },
2982 },
2983 out: ["libc_musl_sysroot_bionic_arch_headers.zip"],
2984 tools: ["soong_zip"],
2985 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
2986}
Colin Cross290c4952022-10-13 12:51:13 -07002987
2988cc_genrule {
2989 name: "bionic_sysroot_crt_objects",
2990 visibility: ["//visibility:private"],
2991 out: ["bionic_sysroot_crt_objects.zip"],
2992 tools: ["soong_zip"],
2993 srcs: [
2994 ":crtbegin_dynamic",
2995 ":crtbegin_so",
2996 ":crtbegin_static",
2997 ":crtend_android",
2998 ":crtend_so",
2999 ],
3000 cmd: "$(location soong_zip) -o $(out) -j " +
3001 "-f $(location :crtbegin_dynamic) " +
3002 "-f $(location :crtbegin_so) " +
3003 "-f $(location :crtbegin_static) " +
3004 "-f $(location :crtend_android) " +
3005 "-f $(location :crtend_so)",
3006 dist: {
3007 targets: ["bionic_sysroot_crt_objects"],
3008 },
3009 arch: {
3010 arm: {
3011 dist: {
3012 suffix: "_arm",
3013 },
3014 },
3015 arm64: {
3016 dist: {
3017 suffix: "_arm64",
3018 },
3019 },
3020 riscv64: {
3021 dist: {
3022 suffix: "_riscv64",
3023 },
3024 },
3025 x86: {
3026 dist: {
3027 suffix: "_x86",
3028 },
3029 },
3030 x86_64: {
3031 dist: {
3032 suffix: "_x86_64",
3033 },
3034 },
3035 },
3036}
Spandan Das8fce52a2023-09-28 18:00:12 +00003037
3038// headers that will be placed on the include path when running versioner in bazel
3039// this module should be a no-op in soong
3040filegroup {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00003041 name: "versioner-dependencies",
3042 srcs: ["versioner-dependencies/**/*"],
Spandan Das8fce52a2023-09-28 18:00:12 +00003043}