blob: 80b24b4ec2a1b5564d2694691d1e9e6add0f01ad [file] [log] [blame]
Bob Badouraa7d8352021-02-19 13:06:22 -08001package {
2 default_applicable_licenses: ["bionic_libc_license"],
3}
4
5license {
6 name: "bionic_libc_license",
7 visibility: [":__subpackages__"],
8 license_kinds: [
9 "SPDX-license-identifier-Apache-2.0",
10 "SPDX-license-identifier-BSD",
11 "SPDX-license-identifier-ISC",
12 "SPDX-license-identifier-MIT",
13 "legacy_notice",
14 "legacy_unencumbered",
15 ],
16 license_text: [
17 "NOTICE",
18 ],
19}
20
Elliott Hughes53cf3482016-08-09 13:06:41 -070021libc_common_flags = [
22 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080023 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070024 "-Wall",
25 "-Wextra",
26 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080027 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070028 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070029 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070030 "-Wframe-larger-than=2048",
Christopher Ferris1de7a482023-09-12 11:06:29 -070031 "-Wno-reorder-init-list",
Elliott Hughes53cf3482016-08-09 13:06:41 -070032
33 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
34 "-Werror=pointer-to-int-cast",
35 "-Werror=int-to-pointer-cast",
36 "-Werror=type-limits",
37 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080038
39 // Clang's exit-time destructor registration hides __dso_handle, but
40 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
41 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080042
Elliott Hughesa13d0662021-12-02 14:42:16 -080043 // We know clang does a lot of harm by rewriting what we've said, and sadly
44 // never see any good it does, so let's just ask it to do what we say...
45 // (The specific motivating example was clang turning a loop that would only
46 // ever touch 0, 1, or 2 bytes into a call to memset, which was never going
47 // to amortize.)
48 "-fno-builtin",
Elliott Hughes53cf3482016-08-09 13:06:41 -070049]
50
Dan Willemsen208ae172015-09-16 16:33:27 -070051// Define some common cflags
52// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070053cc_defaults {
54 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080055 defaults: ["linux_bionic_supported"],
Christopher Ferrisb5425052024-04-23 17:15:39 -070056 cflags: libc_common_flags + [
57 "-DUSE_SCUDO",
58 ],
Elliott Hughes53cf3482016-08-09 13:06:41 -070059 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070060 conlyflags: ["-std=gnu99"],
61 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070062 include_dirs: [
63 "bionic/libc/async_safe/include",
Peter Collingbourne5d3aa862020-09-11 15:05:17 -070064 "bionic/libc/platform",
Tom Cherry379ed1e2020-09-17 09:36:25 -070065 // For android_filesystem_config.h.
66 "system/core/libcutils/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070067 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070068
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010069 header_libs: [
70 "libc_headers",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +000071 "liblog_headers", // needed by bionic/libc/async_safe/include
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010072 ],
73 export_header_lib_headers: [
74 "libc_headers",
75 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -080076
Colin Cross50c21ab2015-10-31 23:03:05 -070077 stl: "none",
78 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070079 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070080 address: false,
81 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070082 // TODO(b/132640749): Fix broken fuzzer support.
83 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070084 },
Yifan Hong5a39cee2020-01-21 16:43:56 -080085 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -070086 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090087 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020088 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080089
Peter Collingbournee99912f2019-11-01 15:37:00 -070090 product_variables: {
Evgenii Stepanov5a73e032020-04-29 14:59:44 -070091 malloc_zero_contents: {
92 cflags: ["-DSCUDO_ZERO_CONTENTS"],
93 },
94 malloc_pattern_fill_contents: {
95 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
96 },
Christopher Ferrisb5425052024-04-23 17:15:39 -070097 malloc_low_memory: {
98 cflags: ["-UUSE_SCUDO"],
Steven Morelandfb65ee42020-07-31 00:18:38 +000099 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700100 },
Yi Kong9e33b762021-10-29 02:43:22 +0800101
102 lto: {
103 never: true,
104 },
Elliott Hughesc2043342023-07-20 20:24:09 +0000105
106 apex_available: ["com.android.runtime"],
Elliott Hughes7d136662023-10-27 15:40:32 -0700107
108 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700109}
110
Elliott Hughes788075a2024-06-18 12:25:37 +0000111// Workaround for b/24465209.
112// We're unlikely to be able to remove this before we just
113// remove ILP32 support completely.
114// Note that we also still have `pack_relocations: false`
115// for both libc and libm, even on LP64.
116// ========================================================
117cc_defaults {
118 name: "bug_24465209_workaround",
Elliott Hughesfeb94732024-06-18 19:44:18 +0000119 target: {
120 android_arm: {
Elliott Hughes788075a2024-06-18 12:25:37 +0000121 pack_relocations: false,
122 ldflags: ["-Wl,--hash-style=both"],
123 },
Elliott Hughesfeb94732024-06-18 19:44:18 +0000124 android_x86: {
Elliott Hughes788075a2024-06-18 12:25:37 +0000125 pack_relocations: false,
126 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesb4e02782024-06-21 11:35:18 +0000127 },
Elliott Hughes788075a2024-06-18 12:25:37 +0000128 },
129}
130
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700131// Defaults for native allocator libs/includes to make it
132// easier to change.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700133// ========================================================
134cc_defaults {
135 name: "libc_native_allocator_defaults",
136
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700137 whole_static_libs: [
Christopher Ferrisb5425052024-04-23 17:15:39 -0700138 "libscudo",
139 ],
140 cflags: [
141 "-DUSE_SCUDO",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700142 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800143 header_libs: ["gwp_asan_headers"],
Christopher Ferrisb5425052024-04-23 17:15:39 -0700144 product_variables: {
145 malloc_low_memory: {
146 cflags: ["-UUSE_SCUDO"],
147 whole_static_libs: [
148 "libjemalloc5",
149 "libc_jemalloc_wrapper",
150 ],
151 exclude_static_libs: [
152 "libscudo",
153 ],
154 },
155 },
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700156}
157
158// Functions not implemented by jemalloc directly, or that need to
159// be modified for Android.
160cc_library_static {
161 name: "libc_jemalloc_wrapper",
162 defaults: ["libc_defaults"],
163 srcs: ["bionic/jemalloc_wrapper.cpp"],
164 cflags: ["-fvisibility=hidden"],
165
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800166 // Used to pull in the jemalloc include directory so that if the
167 // library is removed, the include directory is also removed.
168 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700169}
170
Dan Willemsen208ae172015-09-16 16:33:27 -0700171// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700172// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700173// ========================================================
174//
Ryan Prichard249757b2019-11-01 17:18:28 -0700175// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
176// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
177// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
178// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700179
180cc_library_static {
181
Colin Crossa3f9fca2016-01-11 13:20:55 -0800182 srcs: [
183 "bionic/__libc_init_main_thread.cpp",
184 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700185 "bionic/bionic_call_ifunc_resolver.cpp",
186 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800187 ],
188 arch: {
189 arm64: {
190 srcs: ["arch-arm64/bionic/__set_tls.c"],
191 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000192 riscv64: {
193 srcs: ["arch-riscv64/bionic/__set_tls.c"],
194 },
Colin Crossa3f9fca2016-01-11 13:20:55 -0800195 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700196 srcs: [
197 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Pirama Arumuga Nainar7b89be72021-02-12 15:09:49 -0800198 "arch-x86/bionic/__libc_int0x80.S",
Ryan Prichard27475b52018-05-17 17:14:18 -0700199 "arch-x86/bionic/__set_tls.cpp",
200 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800201 },
202 x86_64: {
203 srcs: ["arch-x86_64/bionic/__set_tls.c"],
204 },
205 },
206
Colin Cross50c21ab2015-10-31 23:03:05 -0700207 defaults: ["libc_defaults"],
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000208 cflags: [
209 "-fno-stack-protector",
210 "-ffreestanding",
211 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700212 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700213}
214
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800215filegroup {
216 name: "elf_note_sources",
217 srcs: ["bionic/elf_note.cpp"],
218}
219
Ryan Prichard249757b2019-11-01 17:18:28 -0700220// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
221// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
222// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800223
224cc_library_static {
225 name: "libc_init_static",
226 defaults: ["libc_defaults"],
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800227 srcs: [
228 "bionic/libc_init_static.cpp",
229 ":elf_note_sources",
230 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700231 cflags: [
232 "-fno-stack-protector",
233
234 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
235 // from the linker before ifunc resolvers have made string.h functions available.
236 "-ffreestanding",
237 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800238}
239
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700240cc_library_static {
241 name: "libc_init_dynamic",
242 defaults: ["libc_defaults"],
243 srcs: ["bionic/libc_init_dynamic.cpp"],
244 cflags: ["-fno-stack-protector"],
245}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800246
Dan Willemsen208ae172015-09-16 16:33:27 -0700247// ========================================================
248// libc_tzcode.a - upstream 'tzcode' code
249// ========================================================
250
251cc_library_static {
252
Colin Cross50c21ab2015-10-31 23:03:05 -0700253 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700254 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800255 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700256 "tzcode/bionic.cpp",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700257 // tzcode doesn't include strptime, so we use a fork of the
258 // OpenBSD code which needs this global data.
Elliott Hughesd3627a42022-12-06 22:24:27 +0000259 "upstream-openbsd/lib/libc/locale/_def_time.c",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700260 // tzcode doesn't include wcsftime, so we use the FreeBSD code.
261 "upstream-freebsd/lib/libc/locale/wcsftime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700262 ],
263
Colin Cross50c21ab2015-10-31 23:03:05 -0700264 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700265 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700266 // Don't use ridiculous amounts of stack.
267 "-DALL_STATE",
268 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
269 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800270 // Obviously, we want to be thread-safe.
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000271 "-DTHREAD_SAFE=1",
Dan Willemsen208ae172015-09-16 16:33:27 -0700272 // The name of the tm_gmtoff field in our struct tm.
273 "-DTM_GMTOFF=tm_gmtoff",
Elliott Hughes31fc69f2023-06-20 15:36:11 -0700274 // Android uses a system property instead of /etc/localtime, so make callers crash.
Almaz Mingaleeva52a0da2022-02-28 16:55:50 +0000275 "-DTZDEFAULT=NULL",
Dan Willemsen208ae172015-09-16 16:33:27 -0700276 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700277 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700278 // Include `tzname`, `timezone`, and `daylight` globals.
279 "-DHAVE_POSIX_DECLS=0",
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000280 "-DUSG_COMPAT=2",
281 "-DHAVE_TZNAME=2",
282 // stdbool.h is available
283 "-DHAVE_STDBOOL_H",
Colin Crossa35d23d2015-11-19 13:32:49 -0800284 // Use the empty string (instead of " ") as the timezone abbreviation
285 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700286 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700287 "-Dlint",
288 ],
289
Elliott Hughes2bd43162023-06-15 13:17:08 -0700290 local_include_dirs: [
291 "tzcode/",
292 "upstream-freebsd/android/include",
293 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700294 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700295}
296
297// ========================================================
298// libc_dns.a - modified NetBSD DNS code
299// ========================================================
300
301cc_library_static {
302
Colin Cross50c21ab2015-10-31 23:03:05 -0700303 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700304 srcs: [
Elliott Hughesd0bbfa82021-04-08 11:58:51 -0700305 "dns/**/*.c*",
Dan Willemsen208ae172015-09-16 16:33:27 -0700306
307 "upstream-netbsd/lib/libc/isc/ev_streams.c",
308 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700309 ],
310
Colin Cross50c21ab2015-10-31 23:03:05 -0700311 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700312 "-DANDROID_CHANGES",
313 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700314 "-Wno-unused-parameter",
315 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700316 "-Wframe-larger-than=66000",
Elliott Hughese1dc4f62021-01-11 11:51:29 -0800317 "-include private/bsd_sys_param.h",
Dan Willemsen208ae172015-09-16 16:33:27 -0700318 ],
319
Dan Willemsen208ae172015-09-16 16:33:27 -0700320 local_include_dirs: [
321 "dns/include",
322 "private",
323 "upstream-netbsd/lib/libc/include",
324 "upstream-netbsd/android/include",
325 ],
326
327 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700328}
329
330// ========================================================
331// libc_freebsd.a - upstream FreeBSD C library code
332// ========================================================
333//
334// These files are built with the freebsd-compat.h header file
335// automatically included.
336
337cc_library_static {
Elliott Hughesc2043342023-07-20 20:24:09 +0000338 name: "libc_freebsd_ldexp",
339 defaults: ["libc_defaults"],
340 cflags: ["-Dscalbn=ldexp"],
341 srcs: [":libc_ldexp_srcs"],
342}
343
344cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700345 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700346 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700347 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700348 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
349 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
350 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
351 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700352 "upstream-freebsd/lib/libc/stdlib/qsort.c",
353 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700354 "upstream-freebsd/lib/libc/string/wcpcpy.c",
355 "upstream-freebsd/lib/libc/string/wcpncpy.c",
356 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700357 "upstream-freebsd/lib/libc/string/wcscat.c",
358 "upstream-freebsd/lib/libc/string/wcschr.c",
359 "upstream-freebsd/lib/libc/string/wcscmp.c",
360 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700361 "upstream-freebsd/lib/libc/string/wcscspn.c",
362 "upstream-freebsd/lib/libc/string/wcsdup.c",
363 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700364 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700365 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
366 "upstream-freebsd/lib/libc/string/wcsncat.c",
367 "upstream-freebsd/lib/libc/string/wcsncmp.c",
368 "upstream-freebsd/lib/libc/string/wcsncpy.c",
369 "upstream-freebsd/lib/libc/string/wcsnlen.c",
370 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700371 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700372 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700373 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700374 "upstream-freebsd/lib/libc/string/wcstok.c",
375 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700376 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700377 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700378 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800379 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700380 ],
381 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700382 x86: {
383 exclude_srcs: [
384 "upstream-freebsd/lib/libc/string/wcschr.c",
385 "upstream-freebsd/lib/libc/string/wcscmp.c",
386 "upstream-freebsd/lib/libc/string/wcslen.c",
387 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700388 "upstream-freebsd/lib/libc/string/wmemcmp.c",
389 "upstream-freebsd/lib/libc/string/wcscat.c",
390 "upstream-freebsd/lib/libc/string/wcscpy.c",
391 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700392 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700393 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700394 },
395
Colin Cross50c21ab2015-10-31 23:03:05 -0700396 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700397 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700398 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700399 "-include freebsd-compat.h",
400 ],
401
Dan Willemsen208ae172015-09-16 16:33:27 -0700402 local_include_dirs: [
403 "upstream-freebsd/android/include",
404 ],
405
406 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700407}
408
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700409cc_library_static {
410 defaults: ["libc_defaults"],
411 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700412 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700413 ],
414
415 cflags: [
416 "-Wno-sign-compare",
417 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700418 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700419 ],
420
421 local_include_dirs: [
422 "upstream-freebsd/android/include",
423 ],
424
425 name: "libc_freebsd_large_stack",
426}
427
Dan Willemsen208ae172015-09-16 16:33:27 -0700428// ========================================================
429// libc_netbsd.a - upstream NetBSD C library code
430// ========================================================
431//
432// These files are built with the netbsd-compat.h header file
433// automatically included.
434
435cc_library_static {
436
Colin Cross50c21ab2015-10-31 23:03:05 -0700437 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700438 srcs: [
439 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700440 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700441 "upstream-netbsd/lib/libc/gen/psignal.c",
442 "upstream-netbsd/lib/libc/gen/utime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700443 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
444 "upstream-netbsd/lib/libc/regex/regcomp.c",
445 "upstream-netbsd/lib/libc/regex/regerror.c",
446 "upstream-netbsd/lib/libc/regex/regexec.c",
447 "upstream-netbsd/lib/libc/regex/regfree.c",
448 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700449 "upstream-netbsd/lib/libc/stdlib/drand48.c",
450 "upstream-netbsd/lib/libc/stdlib/erand48.c",
451 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
452 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700453 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
454 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
455 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
456 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
457 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
458 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
459 "upstream-netbsd/lib/libc/stdlib/seed48.c",
460 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700461 ],
462 multilib: {
463 lib32: {
464 // LP32 cruft
465 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
466 },
467 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700468 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700469 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800470 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700471 "-DPOSIX_MISTAKE",
472 "-include netbsd-compat.h",
473 ],
474
Dan Willemsen208ae172015-09-16 16:33:27 -0700475 local_include_dirs: [
476 "upstream-netbsd/android/include",
477 "upstream-netbsd/lib/libc/include",
478 ],
479
480 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700481}
482
483// ========================================================
Elliott Hughes968adf92024-02-08 13:15:53 -0800484// libc_openbsd.a - upstream OpenBSD C library code
Dan Willemsen208ae172015-09-16 16:33:27 -0700485// ========================================================
486//
487// These files are built with the openbsd-compat.h header file
488// automatically included.
Dan Willemsen208ae172015-09-16 16:33:27 -0700489cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700490 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700491 srcs: [
Elliott Hughes968adf92024-02-08 13:15:53 -0800492 "upstream-openbsd/lib/libc/crypt/arc4random.c",
493 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700494 "upstream-openbsd/lib/libc/gen/alarm.c",
495 "upstream-openbsd/lib/libc/gen/ctype_.c",
496 "upstream-openbsd/lib/libc/gen/daemon.c",
497 "upstream-openbsd/lib/libc/gen/err.c",
498 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 "upstream-openbsd/lib/libc/gen/fnmatch.c",
500 "upstream-openbsd/lib/libc/gen/ftok.c",
501 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700502 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700503 "upstream-openbsd/lib/libc/gen/verr.c",
504 "upstream-openbsd/lib/libc/gen/verrx.c",
505 "upstream-openbsd/lib/libc/gen/vwarn.c",
506 "upstream-openbsd/lib/libc/gen/vwarnx.c",
507 "upstream-openbsd/lib/libc/gen/warn.c",
508 "upstream-openbsd/lib/libc/gen/warnx.c",
509 "upstream-openbsd/lib/libc/locale/btowc.c",
510 "upstream-openbsd/lib/libc/locale/mbrlen.c",
511 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
512 "upstream-openbsd/lib/libc/locale/mbtowc.c",
513 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700514 "upstream-openbsd/lib/libc/locale/wcstombs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700515 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
516 "upstream-openbsd/lib/libc/locale/wctob.c",
517 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700518 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700519 "upstream-openbsd/lib/libc/net/htonl.c",
520 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700521 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
522 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
523 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700524 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
525 "upstream-openbsd/lib/libc/net/inet_ntop.c",
526 "upstream-openbsd/lib/libc/net/inet_pton.c",
527 "upstream-openbsd/lib/libc/net/ntohl.c",
528 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800529 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700530 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700531 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
532 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700533 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700534 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700535 "upstream-openbsd/lib/libc/stdio/fputwc.c",
536 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700537 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700538 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700539 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700540 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700541 "upstream-openbsd/lib/libc/stdio/makebuf.c",
542 "upstream-openbsd/lib/libc/stdio/mktemp.c",
543 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
544 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700546 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700547 "upstream-openbsd/lib/libc/stdio/ungetc.c",
548 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
549 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
550 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700551 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
552 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
553 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700554 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700555 "upstream-openbsd/lib/libc/stdio/wsetup.c",
556 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800557 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700558 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700559 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700560 "upstream-openbsd/lib/libc/stdlib/insque.c",
561 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
562 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
563 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800564 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700565 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800566 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700567 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughes26b06072020-07-31 11:00:10 -0700568 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700569 "upstream-openbsd/lib/libc/stdlib/remque.c",
570 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700571 "upstream-openbsd/lib/libc/stdlib/tfind.c",
572 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800573 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700574 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800575 "upstream-openbsd/lib/libc/string/strcasestr.c",
576 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700577 "upstream-openbsd/lib/libc/string/strcspn.c",
578 "upstream-openbsd/lib/libc/string/strdup.c",
579 "upstream-openbsd/lib/libc/string/strndup.c",
580 "upstream-openbsd/lib/libc/string/strpbrk.c",
581 "upstream-openbsd/lib/libc/string/strsep.c",
582 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700583 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800584 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700585 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700586 "upstream-openbsd/lib/libc/string/wcswidth.c",
Colin Cross69bcb8b2021-09-08 13:24:16 -0700587
588 // This file is originally from OpenBSD, and benefits from
589 // being compiled with openbsd-compat.h.
Elliott Hughes968adf92024-02-08 13:15:53 -0800590 // TODO: clean this up instead.
Colin Cross69bcb8b2021-09-08 13:24:16 -0700591 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700592 ],
593
Elliott Hughes7d136662023-10-27 15:40:32 -0700594 // Each architecture has optimized versions of some routines,
595 // and only includes the portable C versions of ones it's missing.
Dan Willemsen208ae172015-09-16 16:33:27 -0700596 arch: {
597 arm: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700598 srcs: [
599 "upstream-openbsd/lib/libc/string/memchr.c",
600 "upstream-openbsd/lib/libc/string/memrchr.c",
601 "upstream-openbsd/lib/libc/string/stpncpy.c",
602 "upstream-openbsd/lib/libc/string/strlcat.c",
603 "upstream-openbsd/lib/libc/string/strlcpy.c",
604 "upstream-openbsd/lib/libc/string/strncat.c",
605 "upstream-openbsd/lib/libc/string/strncmp.c",
606 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700607 ],
608 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700609 arm64: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700610 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700611 "upstream-openbsd/lib/libc/string/strcat.c",
Elliott Hughesaefe9992023-11-08 12:04:41 -0800612 "upstream-openbsd/lib/libc/string/stpncpy.c",
Elliott Hughes7d136662023-10-27 15:40:32 -0700613 "upstream-openbsd/lib/libc/string/strlcat.c",
614 "upstream-openbsd/lib/libc/string/strlcpy.c",
615 "upstream-openbsd/lib/libc/string/strncat.c",
616 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700617 ],
618 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000619 riscv64: {
620 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700621 "upstream-openbsd/lib/libc/string/memrchr.c",
622 "upstream-openbsd/lib/libc/string/stpncpy.c",
623 "upstream-openbsd/lib/libc/string/strlcat.c",
624 "upstream-openbsd/lib/libc/string/strlcpy.c",
Elliott Hughesebc19a92022-10-14 23:25:36 +0000625 ],
626 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700627 x86: {
Elliott Hughesaefe9992023-11-08 12:04:41 -0800628 srcs: [
629 // x86 has custom implementations of all of these.
630 ],
Elliott Hughes7d136662023-10-27 15:40:32 -0700631 },
632 x86_64: {
633 srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800634 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800635 "upstream-openbsd/lib/libc/string/memrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700636 "upstream-openbsd/lib/libc/string/strlcat.c",
637 "upstream-openbsd/lib/libc/string/strlcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800638 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700639 },
640 },
641
Colin Cross50c21ab2015-10-31 23:03:05 -0700642 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700643 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700644 "-Wno-unused-parameter",
645 "-include openbsd-compat.h",
646 ],
647
Dan Willemsen208ae172015-09-16 16:33:27 -0700648 local_include_dirs: [
649 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700650 "upstream-openbsd/android/include",
Elliott Hughes968adf92024-02-08 13:15:53 -0800651 "stdio",
652 "upstream-openbsd/lib/libc/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700653 ],
654
655 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700656}
657
Elliott Hughes968adf92024-02-08 13:15:53 -0800658cc_library_static {
659 name: "libc_openbsd_large_stack",
660 defaults: ["libc_defaults"],
661 srcs: [
662 "stdio/vfprintf.cpp",
663 "stdio/vfwprintf.cpp",
664 "upstream-openbsd/lib/libc/string/memmem.c",
665 "upstream-openbsd/lib/libc/string/strstr.c",
666 ],
667 cflags: [
668 "-include openbsd-compat.h",
669 "-Wno-sign-compare",
670 "-Wframe-larger-than=5000",
671 ],
672
673 local_include_dirs: [
674 "private",
675 "upstream-openbsd/android/include/",
676 "upstream-openbsd/lib/libc/gdtoa/",
677 "upstream-openbsd/lib/libc/include/",
678 "upstream-openbsd/lib/libc/stdio/",
679 ],
680}
681
Dan Willemsen208ae172015-09-16 16:33:27 -0700682// ========================================================
683// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
684// ========================================================
685//
686// These files are built with the openbsd-compat.h header file
687// automatically included.
688
689cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700690 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700691 srcs: [
692 "upstream-openbsd/android/gdtoa_support.cpp",
693 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
694 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
695 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
696 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
697 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
698 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
699 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
700 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
701 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
702 "upstream-openbsd/lib/libc/gdtoa/misc.c",
703 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
704 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
705 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
706 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
707 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
708 "upstream-openbsd/lib/libc/gdtoa/sum.c",
709 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
710 ],
711 multilib: {
712 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800713 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700714 },
715 },
716
Colin Cross50c21ab2015-10-31 23:03:05 -0700717 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700718 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700719 "-include openbsd-compat.h",
720 ],
721
Dan Willemsen208ae172015-09-16 16:33:27 -0700722 local_include_dirs: [
723 "private",
724 "upstream-openbsd/android/include",
725 "upstream-openbsd/lib/libc/include",
726 ],
727
728 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700729}
730
731// ========================================================
Pierre-Clément Tosi467e58e2023-02-01 13:44:43 +0000732// libc_fortify.a - container for our FORTIFY
George Burgess IV6cb06872017-07-21 13:28:42 -0700733// implementation details
734// ========================================================
735cc_library_static {
736 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700737 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700738
739 name: "libc_fortify",
740
741 // Disable FORTIFY for the compilation of these, so we don't end up having
742 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800743 cflags: [
744 "-U_FORTIFY_SOURCE",
745 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
746 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700747
748 arch: {
749 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800750 cflags: [
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800751 "-DRENAME___STRCAT_CHK",
752 "-DRENAME___STRCPY_CHK",
753 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700754 srcs: [
755 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800756
757 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
758 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
759
760 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
761 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
762
763 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
764 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
765
766 "arch-arm/krait/bionic/__strcat_chk.S",
767 "arch-arm/krait/bionic/__strcpy_chk.S",
768
769 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
770 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
771
Haibo Huang01bfd892018-12-03 15:05:16 -0800772 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
773 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700774 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700775 },
776 arm64: {
777 srcs: [
Elliott Hughes023e4e72022-11-17 19:27:02 +0000778 "arch-arm64/string/__memcpy_chk.S",
779 "arch-arm64/string/__memset_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700780 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700781 },
caowenchengab457f92023-03-06 14:57:55 +0800782 riscv64: {
783 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000784 "arch-riscv64/string/__memset_chk.S",
785 "arch-riscv64/string/__memcpy_chk.S",
caowenchengab457f92023-03-06 14:57:55 +0800786 ],
787 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700788 },
789}
790
791// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700792// libc_bionic.a - home-grown C library code
793// ========================================================
794
795cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700796 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700797 srcs: [
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800798 "bionic/NetdClientDispatch.cpp",
799 "bionic/__bionic_get_shell_path.cpp",
800 "bionic/__cmsg_nxthdr.cpp",
801 "bionic/__cxa_thread_atexit_impl.cpp",
802 "bionic/__errno.cpp",
803 "bionic/__gnu_basename.cpp",
804 "bionic/__libc_current_sigrtmax.cpp",
805 "bionic/__libc_current_sigrtmin.cpp",
806 "bionic/abort.cpp",
807 "bionic/accept.cpp",
808 "bionic/access.cpp",
Florian Mayerca4749a2024-02-14 12:55:46 -0800809 "bionic/android_crash_detail.cpp",
Josh Gao10ec9282017-04-03 15:13:29 -0700810 "bionic/android_set_abort_message.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000811 "bionic/android_unsafe_frame_pointer_chase.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800812 "bionic/arpa_inet.cpp",
813 "bionic/assert.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000814 "bionic/atexit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800815 "bionic/atof.cpp",
816 "bionic/bionic_allocator.cpp",
817 "bionic/bionic_arc4random.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000818 "bionic/bionic_elf_tls.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800819 "bionic/bionic_futex.cpp",
820 "bionic/bionic_netlink.cpp",
821 "bionic/bionic_systrace.cpp",
822 "bionic/bionic_time_conversions.cpp",
823 "bionic/brk.cpp",
824 "bionic/c16rtomb.cpp",
825 "bionic/c32rtomb.cpp",
826 "bionic/chmod.cpp",
827 "bionic/chown.cpp",
828 "bionic/clearenv.cpp",
829 "bionic/clock.cpp",
830 "bionic/clock_getcpuclockid.cpp",
831 "bionic/clock_nanosleep.cpp",
832 "bionic/clone.cpp",
833 "bionic/ctype.cpp",
834 "bionic/dirent.cpp",
835 "bionic/dup.cpp",
836 "bionic/environ.cpp",
837 "bionic/error.cpp",
838 "bionic/eventfd.cpp",
839 "bionic/exec.cpp",
840 "bionic/execinfo.cpp",
Elliott Hughes69bd8e92024-02-09 10:04:26 -0800841 "bionic/exit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800842 "bionic/faccessat.cpp",
843 "bionic/fchmod.cpp",
844 "bionic/fchmodat.cpp",
845 "bionic/fcntl.cpp",
846 "bionic/fdsan.cpp",
847 "bionic/fdtrack.cpp",
848 "bionic/ffs.cpp",
849 "bionic/fgetxattr.cpp",
850 "bionic/flistxattr.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000851 "bionic/fork.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800852 "bionic/fpclassify.cpp",
853 "bionic/fsetxattr.cpp",
854 "bionic/ftruncate.cpp",
855 "bionic/ftw.cpp",
856 "bionic/futimens.cpp",
857 "bionic/getcwd.cpp",
858 "bionic/getdomainname.cpp",
859 "bionic/getentropy.cpp",
860 "bionic/gethostname.cpp",
861 "bionic/getloadavg.cpp",
862 "bionic/getpagesize.cpp",
863 "bionic/getpgrp.cpp",
864 "bionic/getpid.cpp",
865 "bionic/getpriority.cpp",
866 "bionic/gettid.cpp",
867 "bionic/get_device_api_level.cpp",
868 "bionic/grp_pwd.cpp",
869 "bionic/grp_pwd_file.cpp",
870 "bionic/heap_zero_init.cpp",
871 "bionic/iconv.cpp",
872 "bionic/icu_wrappers.cpp",
873 "bionic/ifaddrs.cpp",
874 "bionic/inotify_init.cpp",
875 "bionic/ioctl.cpp",
Elliott Hughes17e40682024-02-13 16:32:29 -0800876 "bionic/isatty.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800877 "bionic/killpg.cpp",
878 "bionic/langinfo.cpp",
879 "bionic/lchown.cpp",
880 "bionic/lfs64_support.cpp",
881 "bionic/libc_init_common.cpp",
882 "bionic/libgen.cpp",
883 "bionic/link.cpp",
884 "bionic/locale.cpp",
885 "bionic/lockf.cpp",
886 "bionic/lstat.cpp",
887 "bionic/mblen.cpp",
888 "bionic/mbrtoc16.cpp",
889 "bionic/mbrtoc32.cpp",
890 "bionic/mempcpy.cpp",
891 "bionic/memset_explicit.cpp",
892 "bionic/mkdir.cpp",
893 "bionic/mkfifo.cpp",
894 "bionic/mknod.cpp",
895 "bionic/mntent.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800896 "bionic/netdb.cpp",
Elliott Hughes3ed6e722024-02-16 01:18:01 +0000897 "bionic/net_if.cpp",
898 "bionic/netinet_ether.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800899 "bionic/netinet_in.cpp",
900 "bionic/nl_types.cpp",
901 "bionic/open.cpp",
902 "bionic/pathconf.cpp",
903 "bionic/pause.cpp",
904 "bionic/pidfd.cpp",
905 "bionic/pipe.cpp",
906 "bionic/poll.cpp",
907 "bionic/posix_fadvise.cpp",
908 "bionic/posix_fallocate.cpp",
909 "bionic/posix_madvise.cpp",
910 "bionic/posix_timers.cpp",
911 "bionic/preadv_pwritev.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000912 "bionic/pthread_atfork.cpp",
913 "bionic/pthread_attr.cpp",
914 "bionic/pthread_barrier.cpp",
915 "bionic/pthread_cond.cpp",
916 "bionic/pthread_create.cpp",
917 "bionic/pthread_detach.cpp",
918 "bionic/pthread_equal.cpp",
919 "bionic/pthread_exit.cpp",
920 "bionic/pthread_getcpuclockid.cpp",
921 "bionic/pthread_getschedparam.cpp",
922 "bionic/pthread_gettid_np.cpp",
923 "bionic/pthread_internal.cpp",
924 "bionic/pthread_join.cpp",
925 "bionic/pthread_key.cpp",
926 "bionic/pthread_kill.cpp",
927 "bionic/pthread_mutex.cpp",
928 "bionic/pthread_once.cpp",
929 "bionic/pthread_rwlock.cpp",
930 "bionic/pthread_sigqueue.cpp",
931 "bionic/pthread_self.cpp",
932 "bionic/pthread_setname_np.cpp",
933 "bionic/pthread_setschedparam.cpp",
934 "bionic/pthread_spinlock.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800935 "bionic/ptrace.cpp",
936 "bionic/pty.cpp",
937 "bionic/raise.cpp",
938 "bionic/rand.cpp",
939 "bionic/readlink.cpp",
940 "bionic/realpath.cpp",
941 "bionic/reboot.cpp",
942 "bionic/recv.cpp",
943 "bionic/recvmsg.cpp",
944 "bionic/rename.cpp",
945 "bionic/rmdir.cpp",
946 "bionic/scandir.cpp",
Elliott Hughes17e40682024-02-13 16:32:29 -0800947 "bionic/sched_cpualloc.cpp",
948 "bionic/sched_cpucount.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800949 "bionic/sched_getaffinity.cpp",
950 "bionic/sched_getcpu.cpp",
951 "bionic/semaphore.cpp",
952 "bionic/send.cpp",
953 "bionic/setegid.cpp",
954 "bionic/seteuid.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000955 "bionic/setjmp_cookie.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800956 "bionic/setpgrp.cpp",
957 "bionic/sigaction.cpp",
958 "bionic/signal.cpp",
959 "bionic/sigprocmask.cpp",
960 "bionic/sleep.cpp",
961 "bionic/socketpair.cpp",
962 "bionic/spawn.cpp",
963 "bionic/stat.cpp",
964 "bionic/stdlib_l.cpp",
965 "bionic/strerror.cpp",
966 "bionic/string_l.cpp",
967 "bionic/strings_l.cpp",
968 "bionic/strsignal.cpp",
969 "bionic/strtol.cpp",
970 "bionic/strtold.cpp",
971 "bionic/swab.cpp",
972 "bionic/symlink.cpp",
973 "bionic/sync_file_range.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000974 "bionic/sysconf.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800975 "bionic/sys_epoll.cpp",
976 "bionic/sys_msg.cpp",
977 "bionic/sys_sem.cpp",
978 "bionic/sys_shm.cpp",
979 "bionic/sys_signalfd.cpp",
980 "bionic/sys_statfs.cpp",
981 "bionic/sys_statvfs.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000982 "bionic/sys_thread_properties.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800983 "bionic/sys_time.cpp",
984 "bionic/sysinfo.cpp",
985 "bionic/syslog.cpp",
Elliott Hughes69bd8e92024-02-09 10:04:26 -0800986 "bionic/sysprop_helpers.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800987 "bionic/system.cpp",
988 "bionic/system_property_api.cpp",
989 "bionic/system_property_set.cpp",
990 "bionic/tdestroy.cpp",
991 "bionic/termios.cpp",
992 "bionic/thread_private.cpp",
993 "bionic/threads.cpp",
994 "bionic/time.cpp",
995 "bionic/time_l.cpp",
996 "bionic/tmpfile.cpp",
997 "bionic/umount.cpp",
998 "bionic/unlink.cpp",
999 "bionic/usleep.cpp",
1000 "bionic/utmp.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001001 "bionic/vdso.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001002 "bionic/wait.cpp",
1003 "bionic/wchar.cpp",
1004 "bionic/wchar_l.cpp",
1005 "bionic/wcstod.cpp",
1006 "bionic/wctype.cpp",
1007 "bionic/wcwidth.cpp",
1008 "bionic/wmempcpy.cpp",
1009
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001010 // Forked but not yet cleaned up/rewritten stdio code.
1011 // TODO: finish cleanup.
1012 "stdio/fmemopen.cpp",
1013 "stdio/parsefloat.c",
1014 "stdio/refill.c",
1015 "stdio/stdio.cpp",
1016 "stdio/stdio_ext.cpp",
1017 "stdio/vfscanf.cpp",
1018 "stdio/vfwscanf.cpp",
1019
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001020 // TODO: why isn't this in a static-libc-only module?
1021 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1022 // which will be overridden by the actual one in libc.so.
1023 "bionic/icu_static.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001024 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001025
1026 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001027 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -07001028 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001029 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -08001030 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001031 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001032 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001033 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001034 "arch-arm/bionic/atomics_arm.c",
1035 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -08001036 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001037 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001038 "arch-arm/bionic/setjmp.S",
1039 "arch-arm/bionic/syscall.S",
1040 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001041
Haibo Huangea9957a2018-11-19 11:00:32 -08001042 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001043 "arch-arm/cortex-a7/bionic/memset.S",
1044
1045 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001046 "arch-arm/cortex-a9/bionic/memset.S",
1047 "arch-arm/cortex-a9/bionic/stpcpy.S",
1048 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001049 "arch-arm/cortex-a9/bionic/strcpy.S",
1050 "arch-arm/cortex-a9/bionic/strlen.S",
1051
Elliott Hughesaefe9992023-11-08 12:04:41 -08001052 "arch-arm/cortex-a15/bionic/memcpy.S",
1053 "arch-arm/cortex-a15/bionic/memmove.S",
1054 "arch-arm/cortex-a15/bionic/memset.S",
1055 "arch-arm/cortex-a15/bionic/stpcpy.S",
1056 "arch-arm/cortex-a15/bionic/strcat.S",
1057 "arch-arm/cortex-a15/bionic/strcmp.S",
1058 "arch-arm/cortex-a15/bionic/strcpy.S",
1059 "arch-arm/cortex-a15/bionic/strlen.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001060
1061 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001062
Haibo Huang01bfd892018-12-03 15:05:16 -08001063 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001064
Elliott Hughesaefe9992023-11-08 12:04:41 -08001065 "arch-arm/generic/bionic/memcmp.S",
1066 "arch-arm/generic/bionic/memmove.S",
1067 "arch-arm/generic/bionic/memset.S",
1068 "arch-arm/generic/bionic/stpcpy.c",
1069 "arch-arm/generic/bionic/strcat.c",
1070 "arch-arm/generic/bionic/strcmp.S",
1071 "arch-arm/generic/bionic/strcpy.S",
1072 "arch-arm/generic/bionic/strlen.c",
1073
1074 "arch-arm/krait/bionic/memcpy.S",
1075 "arch-arm/krait/bionic/memset.S",
1076
Haibo Huangea9957a2018-11-19 11:00:32 -08001077 "arch-arm/kryo/bionic/memcpy.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001078
1079 "bionic/strchr.cpp",
1080 "bionic/strchrnul.cpp",
1081 "bionic/strnlen.cpp",
1082 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001083 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001084 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001085 arm64: {
1086 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001087 "arch-arm64/bionic/__bionic_clone.S",
1088 "arch-arm64/bionic/_exit_with_stack_teardown.S",
1089 "arch-arm64/bionic/setjmp.S",
1090 "arch-arm64/bionic/syscall.S",
1091 "arch-arm64/bionic/vfork.S",
Vaisakh K V83e55842024-03-29 12:47:39 +05301092 "arch-arm64/oryon/memcpy-nt.S",
Vaisakh K V54a61212024-03-29 13:32:45 +05301093 "arch-arm64/oryon/memset-nt.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001094 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001095 },
1096
Elliott Hughesebc19a92022-10-14 23:25:36 +00001097 riscv64: {
1098 srcs: [
1099 "arch-riscv64/bionic/__bionic_clone.S",
1100 "arch-riscv64/bionic/_exit_with_stack_teardown.S",
Elliott Hughese1905ed2022-10-17 23:23:36 +00001101 "arch-riscv64/bionic/setjmp.S",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001102 "arch-riscv64/bionic/syscall.S",
1103 "arch-riscv64/bionic/vfork.S",
Yun Hsiang40a82d02023-05-26 10:10:40 +08001104
Elliott Hughesaefe9992023-11-08 12:04:41 -08001105 "arch-riscv64/string/memchr_v.S",
1106 "arch-riscv64/string/memcmp_v.S",
1107 "arch-riscv64/string/memcpy_v.S",
1108 "arch-riscv64/string/memmove_v.S",
1109 "arch-riscv64/string/memset_v.S",
1110 "arch-riscv64/string/stpcpy_v.S",
1111 "arch-riscv64/string/strcat_v.S",
1112 "arch-riscv64/string/strchr_v.S",
1113 "arch-riscv64/string/strcmp_v.S",
1114 "arch-riscv64/string/strcpy_v.S",
1115 "arch-riscv64/string/strlen_v.S",
1116 "arch-riscv64/string/strncat_v.S",
1117 "arch-riscv64/string/strncmp_v.S",
1118 "arch-riscv64/string/strncpy_v.S",
1119 "arch-riscv64/string/strnlen_v.S",
1120
1121 "arch-riscv64/string/memchr.c",
1122 "arch-riscv64/string/memcmp.c",
1123 "arch-riscv64/string/memcpy.c",
1124 "arch-riscv64/string/memmove.c",
1125 "arch-riscv64/string/memset.c",
1126 "arch-riscv64/string/stpcpy.c",
1127 "arch-riscv64/string/strcat.c",
1128 "arch-riscv64/string/strchr.c",
1129 "arch-riscv64/string/strcmp.c",
1130 "arch-riscv64/string/strcpy.c",
1131 "arch-riscv64/string/strlen.c",
1132 "arch-riscv64/string/strncat.c",
1133 "arch-riscv64/string/strncmp.c",
1134 "arch-riscv64/string/strncpy.c",
1135 "arch-riscv64/string/strnlen.c",
Prashanth Swaminathana4d71022023-10-30 17:35:19 -07001136
Elliott Hughes7d136662023-10-27 15:40:32 -07001137 "bionic/strchrnul.cpp",
1138 "bionic/strrchr.cpp",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001139 ],
1140 },
1141
Dan Willemsen208ae172015-09-16 16:33:27 -07001142 x86: {
1143 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001144 "arch-x86/bionic/__bionic_clone.S",
1145 "arch-x86/bionic/_exit_with_stack_teardown.S",
1146 "arch-x86/bionic/libcrt_compat.c",
Elliott Hughes7d136662023-10-27 15:40:32 -07001147 "arch-x86/bionic/setjmp.S",
1148 "arch-x86/bionic/syscall.S",
1149 "arch-x86/bionic/vfork.S",
1150 "arch-x86/bionic/__x86.get_pc_thunk.S",
1151
Dan Willemsen208ae172015-09-16 16:33:27 -07001152 "arch-x86/generic/string/memcmp.S",
1153 "arch-x86/generic/string/strcmp.S",
1154 "arch-x86/generic/string/strncmp.S",
1155 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001156
1157 "arch-x86/generic/string/strlcat.c",
1158 "arch-x86/generic/string/strlcpy.c",
1159 "arch-x86/generic/string/strncat.c",
1160 "arch-x86/generic/string/wcscat.c",
1161 "arch-x86/generic/string/wcscpy.c",
1162 "arch-x86/generic/string/wmemcmp.c",
1163
Elliott Hughesed777142022-07-25 16:25:11 +00001164 "arch-x86/string/sse2-memchr-atom.S",
1165 "arch-x86/string/sse2-memmove-slm.S",
1166 "arch-x86/string/sse2-memrchr-atom.S",
1167 "arch-x86/string/sse2-memset-atom.S",
1168 "arch-x86/string/sse2-memset-slm.S",
1169 "arch-x86/string/sse2-stpcpy-slm.S",
1170 "arch-x86/string/sse2-stpncpy-slm.S",
1171 "arch-x86/string/sse2-strchr-atom.S",
1172 "arch-x86/string/sse2-strcpy-slm.S",
1173 "arch-x86/string/sse2-strlen-slm.S",
1174 "arch-x86/string/sse2-strncpy-slm.S",
1175 "arch-x86/string/sse2-strnlen-atom.S",
1176 "arch-x86/string/sse2-strrchr-atom.S",
1177 "arch-x86/string/sse2-wcschr-atom.S",
1178 "arch-x86/string/sse2-wcsrchr-atom.S",
1179 "arch-x86/string/sse2-wcslen-atom.S",
1180 "arch-x86/string/sse2-wcscmp-atom.S",
1181 "arch-x86/string/sse2-strlen-atom.S",
1182
1183 "arch-x86/string/ssse3-memcmp-atom.S",
1184 "arch-x86/string/ssse3-memmove-atom.S",
1185 "arch-x86/string/ssse3-strcat-atom.S",
1186 "arch-x86/string/ssse3-strcmp-atom.S",
1187 "arch-x86/string/ssse3-strcpy-atom.S",
1188 "arch-x86/string/ssse3-strlcat-atom.S",
1189 "arch-x86/string/ssse3-strlcpy-atom.S",
1190 "arch-x86/string/ssse3-strncat-atom.S",
1191 "arch-x86/string/ssse3-strncmp-atom.S",
1192 "arch-x86/string/ssse3-strncpy-atom.S",
1193 "arch-x86/string/ssse3-wcscat-atom.S",
1194 "arch-x86/string/ssse3-wcscpy-atom.S",
1195 "arch-x86/string/ssse3-wmemcmp-atom.S",
1196
1197 "arch-x86/string/sse4-memcmp-slm.S",
1198 "arch-x86/string/sse4-wmemcmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001199
1200 "bionic/strchrnul.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001201 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001202 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001203 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001204 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001205 "arch-x86_64/bionic/__bionic_clone.S",
1206 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1207 "arch-x86_64/bionic/__restore_rt.S",
1208 "arch-x86_64/bionic/setjmp.S",
1209 "arch-x86_64/bionic/syscall.S",
1210 "arch-x86_64/bionic/vfork.S",
1211
ahs919fb7f2022-06-10 07:11:14 +05301212 "arch-x86_64/string/avx2-memset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001213 "arch-x86_64/string/sse2-memmove-slm.S",
1214 "arch-x86_64/string/sse2-memset-slm.S",
1215 "arch-x86_64/string/sse2-stpcpy-slm.S",
1216 "arch-x86_64/string/sse2-stpncpy-slm.S",
1217 "arch-x86_64/string/sse2-strcat-slm.S",
1218 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001219 "arch-x86_64/string/sse2-strlen-slm.S",
1220 "arch-x86_64/string/sse2-strncat-slm.S",
1221 "arch-x86_64/string/sse2-strncpy-slm.S",
1222 "arch-x86_64/string/sse4-memcmp-slm.S",
1223 "arch-x86_64/string/ssse3-strcmp-slm.S",
1224 "arch-x86_64/string/ssse3-strncmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001225
1226 "bionic/strchr.cpp",
1227 "bionic/strchrnul.cpp",
1228 "bionic/strnlen.cpp",
1229 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001230 ],
1231 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001232 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001233
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001234 multilib: {
1235 lib32: {
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001236 srcs: [
1237 // off64_t/time64_t support on LP32.
1238 "bionic/legacy_32_bit_support.cpp",
1239 "bionic/time64.c",
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001240 ],
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001241 },
1242 },
1243
1244 local_include_dirs: ["stdio"],
1245 generated_headers: ["generated_android_ids"],
1246
1247 whole_static_libs: [
1248 "libsystemproperties",
1249 ],
1250
Colin Cross50c21ab2015-10-31 23:03:05 -07001251 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001252 include_dirs: ["bionic/libstdc++/include"],
1253 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001254}
1255
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001256genrule {
1257 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001258 out: ["generated_android_ids.h"],
1259 srcs: [":android_filesystem_config_header"],
Cole Faustb1a0a9d2023-11-28 17:51:16 -08001260 tools: ["fs_config_generator"],
1261 cmd: "$(location fs_config_generator) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001262}
1263
Dan Willemsen268a6732015-10-15 14:49:45 -07001264// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001265// libc_syscalls.a
1266// ========================================================
1267
Elliott Hughes782c4852019-04-16 12:31:00 -07001268genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001269 name: "syscalls-arm",
Elliott Hughes782c4852019-04-16 12:31:00 -07001270 out: ["syscalls-arm.S"],
1271 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001272 tools: ["gensyscalls"],
1273 cmd: "$(location gensyscalls) arm $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001274}
1275
1276genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001277 name: "syscalls-arm64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001278 out: ["syscalls-arm64.S"],
1279 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001280 tools: ["gensyscalls"],
1281 cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001282}
1283
1284genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001285 name: "syscalls-riscv64",
Elliott Hughes704772b2022-10-10 17:06:43 +00001286 out: ["syscalls-riscv64.S"],
1287 srcs: ["SYSCALLS.TXT"],
1288 tools: ["gensyscalls"],
1289 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
1290}
1291
1292genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001293 name: "syscalls-x86",
Elliott Hughes782c4852019-04-16 12:31:00 -07001294 out: ["syscalls-x86.S"],
1295 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001296 tools: ["gensyscalls"],
1297 cmd: "$(location gensyscalls) x86 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001298}
1299
1300genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001301 name: "syscalls-x86_64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001302 out: ["syscalls-x86_64.S"],
1303 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001304 tools: ["gensyscalls"],
1305 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001306}
1307
Dan Willemsen208ae172015-09-16 16:33:27 -07001308cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001309 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001310 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001311 arch: {
1312 arm: {
Cole Faustf5968d82023-04-11 15:20:19 -07001313 srcs: [":syscalls-arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001314 },
1315 arm64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001316 srcs: [":syscalls-arm64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001317 },
Elliott Hughes704772b2022-10-10 17:06:43 +00001318 riscv64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001319 srcs: [":syscalls-riscv64"],
Elliott Hughes704772b2022-10-10 17:06:43 +00001320 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001321 x86: {
Cole Faustf5968d82023-04-11 15:20:19 -07001322 srcs: [":syscalls-x86"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001323 },
1324 x86_64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001325 srcs: [":syscalls-x86_64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001326 },
1327 },
1328 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001329}
1330
1331// ========================================================
1332// libc_aeabi.a
1333// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1334// to avoid infinite recursion. For the other architectures we just build an
1335// empty library to keep this makefile simple.
1336// ========================================================
1337
1338cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001339 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001340 arch: {
1341 arm: {
1342 srcs: ["arch-arm/bionic/__aeabi.c"],
1343 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001344 },
1345 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001346 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001347}
1348
1349// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001350// libc_common.a --- everything shared by libc.a and libc.so
Dan Willemsen208ae172015-09-16 16:33:27 -07001351// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001352
Dan Willemsen208ae172015-09-16 16:33:27 -07001353cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001354 defaults: ["libc_defaults"],
Elliott Hughesb0948922024-01-26 00:28:12 +00001355 name: "libc_common",
1356
Dan Willemsen208ae172015-09-16 16:33:27 -07001357 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001358 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001359 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001360 "libc_bionic",
Ryan Prichard249757b2019-11-01 17:18:28 -07001361 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001362 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001363 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001364 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001365 "libc_freebsd_large_stack",
Elliott Hughesc2043342023-07-20 20:24:09 +00001366 "libc_freebsd_ldexp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001367 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001368 "libc_netbsd",
1369 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001370 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001371 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001372 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001373 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001374 ],
1375
1376 arch: {
1377 arm: {
1378 whole_static_libs: ["libc_aeabi"],
1379 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001380 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001381}
1382
1383// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001384// libc_static_dispatch.a --- libc.a ifuncs
Haibo Huangf71edfa2018-11-12 10:06:56 -08001385// ========================================================
1386cc_library_static {
1387 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001388 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001389
Haibo Huangb9244ff2018-08-11 10:12:13 -07001390 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301391 x86_64: {
1392 srcs: ["arch-x86_64/static_function_dispatch.S"],
1393 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001394 x86: {
1395 srcs: ["arch-x86/static_function_dispatch.S"],
1396 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001397 arm: {
1398 srcs: ["arch-arm/static_function_dispatch.S"],
1399 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001400 arm64: {
1401 srcs: ["arch-arm64/static_function_dispatch.S"],
1402 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001403 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001404 srcs: ["arch-riscv64/static_function_dispatch.S"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001405 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001406 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001407}
1408
1409// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001410// libc_dynamic_dispatch.a --- libc.so ifuncs
Haibo Huangf71edfa2018-11-12 10:06:56 -08001411// ========================================================
1412cc_library_static {
1413 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001414 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001415
Haibo Huangb9244ff2018-08-11 10:12:13 -07001416 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001417 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001418 "-fno-stack-protector",
1419 "-fno-jump-tables",
1420 ],
1421 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301422 x86_64: {
1423 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
1424 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001425 x86: {
1426 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1427 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001428 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001429 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001430 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001431 arm64: {
1432 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1433 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001434 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001435 srcs: ["arch-riscv64/dynamic_function_dispatch.cpp"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001436 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001437 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001438}
1439
1440// ========================================================
1441// libc_common_static.a For static binaries.
1442// ========================================================
1443cc_library_static {
1444 defaults: ["libc_defaults"],
1445 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001446
Haibo Huangf71edfa2018-11-12 10:06:56 -08001447 whole_static_libs: [
1448 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001449 "libc_static_dispatch",
1450 ],
1451}
1452
1453// ========================================================
1454// libc_common_shared.a For shared libraries.
1455// ========================================================
1456cc_library_static {
1457 defaults: ["libc_defaults"],
1458 name: "libc_common_shared",
1459
1460 whole_static_libs: [
1461 "libc_common",
1462 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001463 ],
1464}
1465
Ryan Prichard22a6a052019-10-10 23:59:30 -07001466// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1467// executable.
1468cc_library_static {
1469 name: "libc_unwind_static",
1470 defaults: ["libc_defaults"],
1471 cflags: ["-DLIBC_STATIC"],
1472
1473 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1474 arch: {
1475 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1476 arm: {
1477 srcs: ["arch-arm/bionic/exidx_static.c"],
1478 },
1479 },
1480}
1481
Haibo Huangf71edfa2018-11-12 10:06:56 -08001482// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001483// libc_nomalloc.a
1484// ========================================================
1485//
Ryan Prichard249757b2019-11-01 17:18:28 -07001486// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1487// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1488// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001489
1490cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001491 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001492 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001493
Colin Crossa3f9fca2016-01-11 13:20:55 -08001494 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001495 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001496 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001497 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001498 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001499}
1500
dimitryc0c0ef62018-12-05 16:33:52 +01001501filegroup {
1502 name: "libc_sources_shared",
1503 srcs: [
1504 "arch-common/bionic/crtbegin_so.c",
1505 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001506 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001507 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001508 "bionic/icu.cpp",
1509 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001510 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001511 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001512 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001513 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001514 "bionic/ndk_cruft.cpp",
1515 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001516 "bionic/NetdClient.cpp",
1517 "arch-common/bionic/crtend_so.S",
1518 ],
1519}
1520
1521filegroup {
1522 name: "libc_sources_static",
1523 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001524 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001525 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001526 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001527 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001528 ],
1529}
1530
1531filegroup {
1532 name: "libc_sources_shared_arm",
1533 srcs: [
1534 "arch-arm/bionic/exidx_dynamic.c",
1535 "arch-arm/bionic/atexit_legacy.c",
1536 ],
1537}
1538
Dan Willemsen208ae172015-09-16 16:33:27 -07001539// ========================================================
1540// libc.a + libc.so
1541// ========================================================
Florian Mayerc10d0642023-03-22 16:12:49 -07001542cc_defaults {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001543 defaults: [
1544 "libc_defaults",
1545 "libc_native_allocator_defaults",
Elliott Hughes788075a2024-06-18 12:25:37 +00001546 "bug_24465209_workaround",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001547 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001548 name: "libc_library_defaults",
Colin Cross50c21ab2015-10-31 23:03:05 -07001549 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001550 platform_sdk_version: {
1551 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1552 },
1553 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001554 static: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001555 srcs: [":libc_sources_static"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001556 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001557 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001558 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001559 "libc_init_static",
1560 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001561 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001562 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001563 },
1564 shared: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001565 srcs: [":libc_sources_shared"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001566 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001567 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001568 "libc_init_dynamic",
1569 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001570 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001571 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001572 },
1573
Neil Fullera7db90f2019-04-25 09:28:27 +01001574 required: [
MarkDacekd88d7ea2022-06-28 20:14:58 +00001575 "tzdata_prebuilt",
1576 "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
Neil Fullera7db90f2019-04-25 09:28:27 +01001577 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001578
Colin Cross4ce94d22016-11-15 13:15:43 -08001579 // Do not pack libc.so relocations; see http://b/20645321 for details.
1580 pack_relocations: false,
1581
dimitry06016f22018-01-05 11:39:28 +01001582 shared_libs: [
1583 "ld-android",
1584 "libdl",
1585 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001586 static_libs: [
1587 "libdl_android",
1588 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001589
1590 nocrt: true,
1591
Dan Willemsen208ae172015-09-16 16:33:27 -07001592 arch: {
1593 arm: {
Christopher Ferris9d03a162023-11-10 11:19:11 -08001594 ldflags: [
Christopher Ferris9d03a162023-11-10 11:19:11 -08001595 // Since we are preserving the debug_frame, do not compress
1596 // in this case to make unwinds as fast as possible.
1597 "-Wl,--compress-debug-sections=none",
1598 ],
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001599
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001600 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001601 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001602
Dan Willemsen208ae172015-09-16 16:33:27 -07001603 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001604 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001605 // special for arm
1606 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001607 // For backwards-compatibility, some arm32 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001608 static_libs: ["libclang_rt.builtins-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001609 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001610
1611 // Arm 32 bit does not produce complete exidx unwind information
1612 // so keep the .debug_frame which is relatively small and does
1613 // include needed unwind information.
1614 // See b/132992102 for details.
1615 strip: {
1616 keep_symbols_and_debug_frame: true,
1617 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001618 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001619 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001620 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001621
1622 // Leave the symbols in the shared library so that stack unwinders can produce
1623 // meaningful name resolution.
1624 strip: {
1625 keep_symbols: true,
1626 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001627 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001628 riscv64: {
1629 version_script: ":libc.riscv64.map",
1630
1631 // Leave the symbols in the shared library so that stack unwinders can produce
1632 // meaningful name resolution.
1633 strip: {
1634 keep_symbols: true,
1635 },
1636 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001637 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001638 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001639 no_libcrt: true,
1640
1641 shared: {
1642 // For backwards-compatibility, some x86 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001643 static_libs: ["libclang_rt.builtins-exported"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001644 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001645
1646 // Leave the symbols in the shared library so that stack unwinders can produce
1647 // meaningful name resolution.
1648 strip: {
1649 keep_symbols: true,
1650 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001651 },
1652 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001653 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001654
1655 // Leave the symbols in the shared library so that stack unwinders can produce
1656 // meaningful name resolution.
1657 strip: {
1658 keep_symbols: true,
1659 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001660 },
1661 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001662
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001663 apex_available: [
1664 "//apex_available:platform",
1665 "com.android.runtime",
1666 ],
1667
Colin Cross7edd0082021-10-28 13:20:35 -07001668 target: {
1669 native_bridge: {
1670 shared: {
1671 installable: false,
1672 },
1673 },
1674 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001675}
1676
Florian Mayerc10d0642023-03-22 16:12:49 -07001677cc_library {
1678 name: "libc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001679 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001680 "libc_library_defaults",
1681 ],
1682 stubs: {
1683 symbol_file: "libc.map.txt",
1684 versions: [
1685 "29",
1686 "R",
1687 "current",
1688 ],
1689 },
1690 static_ndk_lib: true,
1691 llndk: {
1692 symbol_file: "libc.map.txt",
1693 export_headers_as_system: true,
1694 export_preprocessed_headers: ["include"],
1695 export_llndk_headers: ["libc_llndk_headers"],
1696 },
1697}
1698
1699cc_library {
1700 name: "libc_hwasan",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001701 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001702 "libc_library_defaults",
1703 ],
1704 sanitize: {
1705 hwaddress: true,
1706 },
1707 enabled: false,
Florian Mayerff116ed2023-04-14 17:38:53 -07001708 target: {
1709 android_arm64: {
Florian Mayerc10d0642023-03-22 16:12:49 -07001710 enabled: true,
1711 },
1712 },
1713 stem: "libc",
1714 relative_install_path: "hwasan",
1715 // We don't really need the stubs, but this needs to stay to trigger the
1716 // symlink logic in soong.
1717 stubs: {
1718 symbol_file: "libc.map.txt",
1719 },
1720 native_bridge_supported: false,
1721 // It is never correct to depend on this directly. This is only
1722 // needed for the runtime apex, and in base_system.mk.
1723 visibility: ["//bionic/apex"],
1724}
1725
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001726genrule {
1727 name: "libc.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001728 out: ["libc.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001729 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001730 tools: ["generate-version-script"],
1731 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001732}
1733
1734genrule {
1735 name: "libc.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001736 out: ["libc.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001737 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001738 tools: ["generate-version-script"],
1739 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001740}
1741
1742genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001743 name: "libc.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001744 out: ["libc.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001745 srcs: ["libc.map.txt"],
1746 tools: ["generate-version-script"],
1747 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1748}
1749
1750genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001751 name: "libc.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001752 out: ["libc.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001753 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001754 tools: ["generate-version-script"],
1755 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001756}
1757
1758genrule {
1759 name: "libc.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001760 out: ["libc.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001761 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001762 tools: ["generate-version-script"],
1763 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001764}
1765
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001766// Headers that only other parts of the platform can include.
1767cc_library_headers {
1768 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001769 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001770 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001771 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001772 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001773 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001774 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001775 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001776 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001777 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001778 "//system/core/debuggerd:__subpackages__",
Florian Mayerf5d70ce2022-09-13 13:58:30 -07001779 "//system/core/init:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001780 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001781 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001782 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001783 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001784 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001785 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001786 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001787 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001788 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001789 recovery_available: true,
1790 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001791 export_include_dirs: [
1792 "platform",
1793 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001794 system_shared_libs: [],
1795 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001796 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001797
Steven Moreland0cdf1322020-10-05 21:55:26 +00001798 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001799 apex_available: [
1800 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001801 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001802 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001803}
1804
Logan Chien17af91b2019-01-15 21:19:56 +08001805cc_library_headers {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001806 name: "libc_llndk_headers",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001807 visibility: [
1808 "//external/musl",
1809 ],
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001810 llndk: {
1811 llndk_headers: true,
1812 },
Logan Chien17af91b2019-01-15 21:19:56 +08001813 host_supported: true,
1814 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001815 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001816 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001817 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001818 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001819 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001820 apex_available: [
1821 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001822 "//apex_available:anyapex",
1823 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001824 // used by most APEXes indirectly via libunwind_llvm
1825 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001826
1827 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001828 stl: "none",
1829 system_shared_libs: [],
1830
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001831 // The build system generally requires that any dependencies of a target
1832 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1833 // to 1 we let targets with an sdk_version that need to depend on the libc
1834 // headers but cannot depend on libc itself due to circular dependencies
1835 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1836 // is correct because the headers can support any sdk_version.
1837 sdk_version: "1",
1838
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001839 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001840 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001841 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001842 "kernel/android/uapi",
1843 ],
1844
1845 arch: {
1846 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001847 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001848 },
1849 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001850 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001851 },
Elliott Hughes48e53332022-10-07 20:39:25 +00001852 riscv64: {
1853 export_system_include_dirs: ["kernel/uapi/asm-riscv"],
1854 },
Logan Chien17af91b2019-01-15 21:19:56 +08001855 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001856 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001857 },
1858 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001859 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001860 },
1861 },
1862}
1863
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001864cc_library_headers {
1865 name: "libc_headers",
1866 host_supported: true,
1867 native_bridge_supported: true,
1868 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001869 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001870 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001871 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001872 recovery_available: true,
1873 sdk_version: "1",
1874
1875 apex_available: [
1876 "//apex_available:platform",
1877 "//apex_available:anyapex",
1878 ],
1879 // used by most APEXes indirectly via libunwind_llvm
1880 min_sdk_version: "apex_inherit",
1881 visibility: [
1882 "//bionic:__subpackages__", // visible to bionic
1883 // ... and only to these places (b/152668052)
1884 "//external/arm-optimized-routines",
1885 "//external/gwp_asan",
1886 "//external/jemalloc_new",
1887 "//external/libunwind_llvm",
Nick Desaulniers942ae552024-02-12 10:26:19 -08001888 "//external/llvm-libc",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001889 "//external/scudo",
1890 "//system/core/property_service/libpropertyinfoparser",
1891 "//system/extras/toolchain-extras",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001892 ],
1893
1894 stl: "none",
1895 no_libcrt: true,
1896 system_shared_libs: [],
1897
1898 target: {
1899 android: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001900 export_system_include_dirs: ["include"],
1901 header_libs: ["libc_llndk_headers"],
1902 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001903 },
1904 linux_bionic: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001905 export_system_include_dirs: ["include"],
1906 header_libs: ["libc_llndk_headers"],
1907 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001908 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001909 },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001910}
1911
Dan Willemsen208ae172015-09-16 16:33:27 -07001912// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001913// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001914// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001915
Dan Willemsen208ae172015-09-16 16:33:27 -07001916cc_library {
Elliott Hughes788075a2024-06-18 12:25:37 +00001917 defaults: [
1918 "libc_defaults",
1919 "bug_24465209_workaround",
1920 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001921 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001922 srcs: [
1923 "bionic/__cxa_guard.cpp",
1924 "bionic/__cxa_pure_virtual.cpp",
1925 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001926 ],
1927 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001928 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001929 static_libs: ["libasync_safe"],
Elliott Hughesc2043342023-07-20 20:24:09 +00001930 apex_available: [
1931 "//apex_available:platform",
1932 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001933
Dan Willemsen6b3be172018-12-03 13:57:20 -08001934 static: {
1935 system_shared_libs: [],
1936 },
Colin Crossb5bfe0b2021-07-13 16:26:28 -07001937 target: {
1938 bionic: {
1939 shared: {
1940 system_shared_libs: ["libc"],
1941 },
1942 },
Dan Willemsen6b3be172018-12-03 13:57:20 -08001943 },
1944
Dan Willemsen208ae172015-09-16 16:33:27 -07001945 arch: {
1946 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001947 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001948 },
1949 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001950 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001951 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001952 riscv64: {
1953 version_script: ":libstdc++.riscv64.map",
1954 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001955 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001956 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001957 },
1958 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001959 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001960 },
1961 },
1962}
1963
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001964genrule {
1965 name: "libstdc++.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001966 out: ["libstdc++.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001967 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001968 tools: ["generate-version-script"],
1969 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001970}
1971
1972genrule {
1973 name: "libstdc++.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001974 out: ["libstdc++.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001975 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001976 tools: ["generate-version-script"],
1977 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001978}
1979
1980genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001981 name: "libstdc++.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001982 out: ["libstdc++.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001983 srcs: ["libstdc++.map.txt"],
1984 tools: ["generate-version-script"],
1985 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1986}
1987
1988genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001989 name: "libstdc++.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001990 out: ["libstdc++.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001991 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001992 tools: ["generate-version-script"],
1993 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001994}
1995
1996genrule {
1997 name: "libstdc++.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001998 out: ["libstdc++.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001999 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002000 tools: ["generate-version-script"],
2001 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002002}
2003
2004// ========================================================
2005// crt object files.
2006// ========================================================
2007
Colin Cross50c21ab2015-10-31 23:03:05 -07002008cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002009 name: "crt_and_memtag_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002010 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002011 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002012 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002013 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002014 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002015 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002016 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002017 apex_available: [
2018 "//apex_available:platform",
2019 "//apex_available:anyapex",
2020 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002021 // Generate NDK variants of the CRT objects for every supported API level.
2022 min_sdk_version: "16",
2023 stl: "none",
2024 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002025 cflags: [
2026 "-Wno-gcc-compat",
2027 "-Wall",
2028 "-Werror",
2029 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002030 sanitize: {
2031 never: true,
2032 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002033}
2034
Colin Cross50c21ab2015-10-31 23:03:05 -07002035cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002036 name: "crt_defaults",
2037 defaults: ["crt_and_memtag_defaults"],
Colin Cross02f81372021-07-22 12:02:10 -07002038 system_shared_libs: [],
Colin Cross10d92682021-06-22 13:25:46 -07002039}
2040
2041cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002042 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002043 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002044
2045 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002046 x86: {
2047 cflags: ["-fPIC"],
2048 },
2049 x86_64: {
2050 cflags: ["-fPIC"],
2051 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002052 },
Colin Crossab179442018-09-27 11:03:22 -07002053 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002054}
2055
Dan Willemsen208ae172015-09-16 16:33:27 -07002056cc_object {
2057 name: "crtbrand",
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002058 local_include_dirs: [
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002059 "private", // crtbrand.S depends on private/bionic_asm_note.h
2060 ],
Elliott Hughes6a30b712024-03-13 23:41:32 +00002061 // crtbrand.S needs to know the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002062 product_variables: {
2063 platform_sdk_version: {
2064 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2065 },
2066 },
2067 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002068
Colin Cross7d7b3682017-11-03 13:38:40 -07002069 defaults: ["crt_so_defaults"],
Dan Alberteee46dc2023-04-04 23:27:52 +00002070 // crtbrand is an intermediate artifact, not a final CRT object.
2071 exclude_from_ndk_sysroot: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07002072}
2073
Dan Willemsen208ae172015-09-16 16:33:27 -07002074cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002075 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002076 local_include_dirs: ["include"],
2077 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002078
Colin Cross7d7b3682017-11-03 13:38:40 -07002079 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002080 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002081 "crtbrand",
2082 ],
2083}
2084
Dan Willemsen208ae172015-09-16 16:33:27 -07002085cc_object {
2086 name: "crtend_so",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002087 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002088 "private", // crtend_so.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002089 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002090 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002091
Colin Cross7d7b3682017-11-03 13:38:40 -07002092 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002093}
2094
Dan Willemsen208ae172015-09-16 16:33:27 -07002095cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002096 name: "crtbegin_static",
2097
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002098 local_include_dirs: [
2099 "include",
2100 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2101 ],
Liz Kammere718dd72021-03-09 15:00:06 -05002102
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002103 cflags: ["-DCRTBEGIN_STATIC"],
Yabin Cui744cfd32023-08-24 13:20:23 -07002104
Dan Willemsen208ae172015-09-16 16:33:27 -07002105 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002106 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002107 "crtbrand",
2108 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002109 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002110 // When using libc.a, we're using the latest library regardless of target API level.
2111 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002112}
2113
Dan Willemsen208ae172015-09-16 16:33:27 -07002114cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002115 name: "crtbegin_dynamic",
2116
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002117 local_include_dirs: [
2118 "include",
2119 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2120 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002121 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002122 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002123 "crtbrand",
2124 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002125 target: {
2126 linux_bionic: {
2127 generated_sources: ["host_bionic_linker_asm"],
2128 objs: [
2129 "linker_wrapper",
2130 ],
2131 },
2132 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002133 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002134}
2135
Dan Willemsen208ae172015-09-16 16:33:27 -07002136cc_object {
2137 // We rename crtend.o to crtend_android.o to avoid a
2138 // name clash between gcc and bionic.
2139 name: "crtend_android",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002140 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002141 "private", // crtend.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002142 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002143 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002144
Colin Cross50c21ab2015-10-31 23:03:05 -07002145 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002146}
Colin Crossbaa48992016-07-13 11:15:21 -07002147
Kalesh Singh862a23d2024-01-09 13:13:50 -08002148cc_object {
2149 name: "crt_pad_segment",
2150 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002151 "private", // crt_pad_segment.S depends on private/bionic_asm_note.h
Kalesh Singh862a23d2024-01-09 13:13:50 -08002152 ],
2153 srcs: ["arch-common/bionic/crt_pad_segment.S"],
2154
2155 defaults: ["crt_defaults"],
2156}
2157
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002158cc_library_static {
2159 name: "note_memtag_heap_async",
2160 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002161 arm64: {
2162 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2163 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002164 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002165 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002166
Colin Cross10d92682021-06-22 13:25:46 -07002167 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002168}
2169
2170cc_library_static {
2171 name: "note_memtag_heap_sync",
2172 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002173 arm64: {
2174 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2175 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002176 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002177 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002178
Colin Cross10d92682021-06-22 13:25:46 -07002179 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002180}
2181
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002182// ========================================================
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002183// libc dependencies for baremetal Rust projects.
2184// ========================================================
2185
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002186// This library contains the following unresolved symbols:
2187// __errno
2188// abort
2189// async_safe_fatal_va_list
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002190cc_library_static {
2191 name: "librust_baremetal",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002192 header_libs: ["libc_headers"],
2193 include_dirs: [
2194 "bionic/libc/async_safe/include",
2195 "bionic/libc/platform",
2196 ],
2197 cflags: [
2198 "-Wall",
2199 "-Werror",
2200 ],
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002201 srcs: [
2202 "bionic/fortify.cpp",
Pierre-Clément Tosi816176c2022-11-30 14:33:41 +00002203 "bionic/strtol.cpp",
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002204 ],
2205 arch: {
2206 arm64: {
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002207 srcs: [
2208 "arch-arm64/string/__memcpy_chk.S",
2209 ],
2210 },
caowencheng9a39eb32023-03-20 16:24:41 +08002211 riscv64: {
2212 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002213 "arch-riscv64/string/__memcpy_chk.S",
caowencheng9a39eb32023-03-20 16:24:41 +08002214 ],
2215 },
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002216 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002217 whole_static_libs: [
2218 "libarm-optimized-routines-mem",
Pierre-Clément Tosieb46ac92023-02-01 13:44:57 +00002219 "libc_netbsd",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002220 ],
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002221 system_shared_libs: [],
2222 nocrt: true,
2223 stl: "none",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002224 visibility: [
2225 "//packages/modules/Virtualization/vmbase",
2226 ],
2227}
2228
2229// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002230// NDK headers.
2231// ========================================================
2232
Dan Albert26e1c412018-05-24 14:56:46 -07002233versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002234 name: "common_libc",
2235 from: "include",
2236 to: "",
2237 license: "NOTICE",
2238}
Dan Albert4238a352016-06-28 11:18:05 -07002239
2240ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002241 name: "libc_uapi",
2242 from: "kernel/uapi",
2243 to: "",
2244 srcs: [
2245 "kernel/uapi/asm-generic/**/*.h",
2246 "kernel/uapi/drm/**/*.h",
2247 "kernel/uapi/linux/**/*.h",
2248 "kernel/uapi/misc/**/*.h",
2249 "kernel/uapi/mtd/**/*.h",
2250 "kernel/uapi/rdma/**/*.h",
2251 "kernel/uapi/scsi/**/*.h",
2252 "kernel/uapi/sound/**/*.h",
2253 "kernel/uapi/video/**/*.h",
2254 "kernel/uapi/xen/**/*.h",
2255 ],
Dan Albert92592652016-10-20 01:42:54 -07002256 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002257}
2258
2259ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002260 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002261 from: "kernel/android/uapi/linux",
2262 to: "linux",
2263 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002264 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002265}
2266
2267ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002268 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002269 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002270 to: "scsi",
2271 srcs: ["kernel/android/scsi/**/*.h"],
2272 license: "NOTICE",
2273}
2274
2275ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002276 name: "libc_asm_arm",
2277 from: "kernel/uapi/asm-arm",
2278 to: "arm-linux-androideabi",
2279 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002280 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002281}
2282
2283ndk_headers {
2284 name: "libc_asm_arm64",
2285 from: "kernel/uapi/asm-arm64",
2286 to: "aarch64-linux-android",
2287 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002288 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002289}
2290
Lazar Trsic790d2f72017-11-27 11:54:11 +01002291ndk_headers {
Colin Crossbd26e0f2022-10-19 15:03:14 -07002292 name: "libc_asm_riscv64",
2293 from: "kernel/uapi/asm-riscv",
2294 to: "riscv64-linux-android",
2295 srcs: ["kernel/uapi/asm-riscv/**/*.h"],
2296 license: "NOTICE",
2297}
2298
2299ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002300 name: "libc_asm_x86",
2301 from: "kernel/uapi/asm-x86",
2302 to: "i686-linux-android",
2303 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002304 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002305}
2306
2307ndk_headers {
2308 name: "libc_asm_x86_64",
2309 from: "kernel/uapi/asm-x86",
2310 to: "x86_64-linux-android",
2311 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002312 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002313}
2314
Dan Albert4238a352016-06-28 11:18:05 -07002315ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002316 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002317 symbol_file: "libc.map.txt",
2318 first_version: "9",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002319 export_header_libs: [
2320 "common_libc",
2321 "libc_uapi",
2322 "libc_kernel_android_uapi_linux",
2323 "libc_kernel_android_scsi",
2324 "libc_asm_arm",
2325 "libc_asm_arm64",
Colin Crossbd26e0f2022-10-19 15:03:14 -07002326 "libc_asm_riscv64",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002327 "libc_asm_x86",
2328 "libc_asm_x86_64",
2329 ],
Dan Albert4238a352016-06-28 11:18:05 -07002330}
2331
Dan Albertdf31aff2016-10-06 15:50:41 -07002332ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002333 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002334 symbol_file: "libstdc++.map.txt",
2335 first_version: "9",
2336}
2337
Dan Willemsenca056d72018-01-08 14:00:24 -08002338// Export these headers for toolbox to process
2339filegroup {
2340 name: "kernel_input_headers",
2341 srcs: [
2342 "kernel/uapi/linux/input.h",
2343 "kernel/uapi/linux/input-event-codes.h",
2344 ],
2345}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002346
2347// Generate a syscall name / number mapping. These objects are text files
2348// (thanks to the -dD -E flags) and not binary files. They will then be
2349// consumed by the genseccomp.py script and converted into C++ code.
2350cc_defaults {
2351 name: "libseccomp_gen_syscall_nrs_defaults",
2352 recovery_available: true,
2353 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2354 cflags: [
2355 "-dD",
2356 "-E",
2357 "-Wall",
2358 "-Werror",
2359 "-nostdinc",
2360 ],
2361}
2362
2363cc_object {
2364 name: "libseccomp_gen_syscall_nrs_arm",
2365 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2366 local_include_dirs: [
2367 "kernel/uapi/asm-arm",
2368 "kernel/uapi",
2369 ],
2370}
2371
2372cc_object {
2373 name: "libseccomp_gen_syscall_nrs_arm64",
2374 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2375 local_include_dirs: [
2376 "kernel/uapi/asm-arm64",
2377 "kernel/uapi",
2378 ],
2379}
2380
2381cc_object {
Elliott Hughes704772b2022-10-10 17:06:43 +00002382 name: "libseccomp_gen_syscall_nrs_riscv64",
2383 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2384 local_include_dirs: [
2385 "kernel/uapi/asm-riscv",
2386 "kernel/uapi",
2387 ],
2388}
2389
2390cc_object {
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002391 name: "libseccomp_gen_syscall_nrs_x86",
2392 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2393 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2394 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2395 local_include_dirs: [
2396 "kernel/uapi/asm-x86",
2397 "kernel/uapi",
2398 ],
2399}
2400
2401cc_object {
2402 name: "libseccomp_gen_syscall_nrs_x86_64",
2403 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2404 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2405 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2406 local_include_dirs: [
2407 "kernel/uapi/asm-x86",
2408 "kernel/uapi",
2409 ],
2410}
2411
Jingwen Chenca366332021-01-29 05:16:32 -05002412filegroup {
2413 name: "all_kernel_uapi_headers",
2414 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002415}
2416
Martijn Coenen0c6de752019-01-02 12:52:51 +01002417cc_genrule {
2418 name: "func_to_syscall_nrs",
2419 recovery_available: true,
2420 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2421
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002422 tools: ["genfunctosyscallnrs"],
Martijn Coenen0c6de752019-01-02 12:52:51 +01002423
2424 srcs: [
2425 "SYSCALLS.TXT",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002426 ],
2427
Elliott Hughes704772b2022-10-10 17:06:43 +00002428 arch: {
2429 arm: {
2430 srcs: [
2431 ":libseccomp_gen_syscall_nrs_arm",
2432 ":libseccomp_gen_syscall_nrs_arm64",
2433 ],
2434 },
2435 arm64: {
2436 srcs: [
2437 ":libseccomp_gen_syscall_nrs_arm",
2438 ":libseccomp_gen_syscall_nrs_arm64",
2439 ],
2440 },
2441 riscv64: {
2442 srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
2443 },
2444 x86: {
2445 srcs: [
2446 ":libseccomp_gen_syscall_nrs_x86",
2447 ":libseccomp_gen_syscall_nrs_x86_64",
2448 ],
2449 },
2450 x86_64: {
2451 srcs: [
2452 ":libseccomp_gen_syscall_nrs_x86",
2453 ":libseccomp_gen_syscall_nrs_x86_64",
2454 ],
2455 },
2456 },
2457
Martijn Coenen0c6de752019-01-02 12:52:51 +01002458 out: [
2459 "func_to_syscall_nrs.h",
2460 ],
2461}
2462
Victor Hsiehdbb86702020-06-15 09:29:07 -07002463// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002464genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002465 name: "generate_app_zygote_blocklist",
2466 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2467 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002468 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2469}
2470
Yu Liu938ec9b2022-10-17 16:36:30 -07002471filegroup {
2472 name: "seccomp_syscalls_sources_zygote",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002473 srcs: [
2474 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002475 "SECCOMP_ALLOWLIST_COMMON.TXT",
2476 "SECCOMP_ALLOWLIST_APP.TXT",
2477 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002478 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002479 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002480 ],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002481}
2482
Yu Liu938ec9b2022-10-17 16:36:30 -07002483filegroup {
2484 name: "seccomp_syscalls_sources_app",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002485 srcs: [
2486 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002487 "SECCOMP_ALLOWLIST_COMMON.TXT",
2488 "SECCOMP_ALLOWLIST_APP.TXT",
2489 "SECCOMP_BLOCKLIST_COMMON.TXT",
2490 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002491 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002492 ],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002493}
2494
Yu Liu938ec9b2022-10-17 16:36:30 -07002495filegroup {
2496 name: "seccomp_syscalls_sources_system",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002497 srcs: [
2498 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002499 "SECCOMP_ALLOWLIST_COMMON.TXT",
2500 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2501 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002502 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002503 ],
Yu Liu938ec9b2022-10-17 16:36:30 -07002504}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002505
Yu Liu938ec9b2022-10-17 16:36:30 -07002506cc_genrule {
2507 name: "libseccomp_policy_app_zygote_sources_x86",
2508 recovery_available: true,
2509 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002510 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002511 srcs: [
2512 ":seccomp_syscalls_sources_zygote",
2513 ":libseccomp_gen_syscall_nrs_x86",
2514 ":libseccomp_gen_syscall_nrs_x86_64",
2515 ],
2516 out: [
2517 "x86_app_zygote_policy.cpp",
2518 "x86_64_app_zygote_policy.cpp",
2519 ],
2520 enabled: false,
Yu Liu3a579692022-10-18 03:02:32 +00002521 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002522 x86: {
2523 enabled: true,
2524 },
2525 x86_64: {
2526 enabled: true,
2527 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002528 },
2529}
2530
2531cc_genrule {
2532 name: "libseccomp_policy_app_zygote_sources_arm",
2533 recovery_available: true,
2534 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002535 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002536 srcs: [
2537 ":seccomp_syscalls_sources_zygote",
2538 ":libseccomp_gen_syscall_nrs_arm",
2539 ":libseccomp_gen_syscall_nrs_arm64",
2540 ],
2541 out: [
2542 "arm_app_zygote_policy.cpp",
2543 "arm64_app_zygote_policy.cpp",
2544 ],
2545 enabled: false,
2546 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002547 arm: {
2548 enabled: true,
2549 },
2550 arm64: {
2551 enabled: true,
2552 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002553 },
2554}
2555
2556cc_genrule {
2557 name: "libseccomp_policy_app_zygote_sources_riscv64",
2558 recovery_available: true,
2559 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002560 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002561 srcs: [
2562 ":seccomp_syscalls_sources_zygote",
2563 ":libseccomp_gen_syscall_nrs_riscv64",
2564 ],
2565 out: [
2566 "riscv64_app_zygote_policy.cpp",
2567 ],
2568 enabled: false,
2569 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002570 riscv64: {
2571 enabled: true,
2572 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002573 },
2574}
2575
2576cc_genrule {
2577 name: "libseccomp_policy_app_sources_x86",
2578 recovery_available: true,
2579 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002580 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002581 srcs: [
2582 ":seccomp_syscalls_sources_app",
2583 ":libseccomp_gen_syscall_nrs_x86",
2584 ":libseccomp_gen_syscall_nrs_x86_64",
2585 ],
2586 out: [
2587 "x86_app_policy.cpp",
2588 "x86_64_app_policy.cpp",
2589 ],
2590 enabled: false,
2591 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002592 x86: {
2593 enabled: true,
2594 },
2595 x86_64: {
2596 enabled: true,
2597 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002598 },
2599}
2600
2601cc_genrule {
2602 name: "libseccomp_policy_app_sources_arm",
2603 recovery_available: true,
2604 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002605 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002606 srcs: [
2607 ":seccomp_syscalls_sources_app",
2608 ":libseccomp_gen_syscall_nrs_arm",
2609 ":libseccomp_gen_syscall_nrs_arm64",
2610 ],
2611 out: [
2612 "arm_app_policy.cpp",
2613 "arm64_app_policy.cpp",
2614 ],
2615 enabled: false,
2616 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002617 arm: {
2618 enabled: true,
2619 },
2620 arm64: {
2621 enabled: true,
2622 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002623 },
2624}
2625
2626cc_genrule {
2627 name: "libseccomp_policy_app_sources_riscv64",
2628 recovery_available: true,
2629 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002630 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002631 srcs: [
2632 ":seccomp_syscalls_sources_app",
2633 ":libseccomp_gen_syscall_nrs_riscv64",
2634 ],
2635 out: [
2636 "riscv64_app_policy.cpp",
2637 ],
2638 enabled: false,
2639 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002640 riscv64: {
2641 enabled: true,
2642 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002643 },
2644}
2645
2646cc_genrule {
2647 name: "libseccomp_policy_system_sources_x86",
2648 recovery_available: true,
2649 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002650 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002651 srcs: [
2652 ":seccomp_syscalls_sources_system",
2653 ":libseccomp_gen_syscall_nrs_x86",
2654 ":libseccomp_gen_syscall_nrs_x86_64",
2655 ],
2656 out: [
2657 "x86_system_policy.cpp",
2658 "x86_64_system_policy.cpp",
2659 ],
2660 enabled: false,
2661 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002662 x86: {
2663 enabled: true,
2664 },
2665 x86_64: {
2666 enabled: true,
2667 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002668 },
2669}
2670
2671cc_genrule {
2672 name: "libseccomp_policy_system_sources_arm",
2673 recovery_available: true,
2674 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002675 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002676 srcs: [
2677 ":seccomp_syscalls_sources_system",
2678 ":libseccomp_gen_syscall_nrs_arm",
2679 ":libseccomp_gen_syscall_nrs_arm64",
2680 ],
2681 out: [
2682 "arm_system_policy.cpp",
2683 "arm64_system_policy.cpp",
2684 ],
2685 enabled: false,
2686 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002687 arm: {
2688 enabled: true,
2689 },
2690 arm64: {
2691 enabled: true,
2692 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002693 },
2694}
2695
2696cc_genrule {
2697 name: "libseccomp_policy_system_sources_riscv64",
2698 recovery_available: true,
2699 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002700 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002701 srcs: [
2702 ":seccomp_syscalls_sources_system",
2703 ":libseccomp_gen_syscall_nrs_riscv64",
2704 ],
2705 out: [
2706 "riscv64_system_policy.cpp",
2707 ],
2708 enabled: false,
2709 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002710 riscv64: {
2711 enabled: true,
2712 },
Yu Liu3a579692022-10-18 03:02:32 +00002713 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002714}
2715
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002716cc_library {
2717 name: "libseccomp_policy",
2718 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002719 generated_headers: ["func_to_syscall_nrs"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002720
2721 arch: {
2722 arm: {
2723 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002724 "libseccomp_policy_app_sources_arm",
2725 "libseccomp_policy_app_zygote_sources_arm",
2726 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002727 ],
2728 },
2729 arm64: {
2730 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002731 "libseccomp_policy_app_sources_arm",
2732 "libseccomp_policy_app_zygote_sources_arm",
2733 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002734 ],
2735 },
2736 riscv64: {
2737 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002738 "libseccomp_policy_app_sources_riscv64",
2739 "libseccomp_policy_app_zygote_sources_riscv64",
2740 "libseccomp_policy_system_sources_riscv64",
Yu Liu938ec9b2022-10-17 16:36:30 -07002741 ],
2742 },
2743 x86: {
2744 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002745 "libseccomp_policy_app_sources_x86",
2746 "libseccomp_policy_app_zygote_sources_x86",
2747 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002748 ],
2749 },
2750 x86_64: {
2751 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002752 "libseccomp_policy_app_sources_x86",
2753 "libseccomp_policy_app_zygote_sources_x86",
2754 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002755 ],
2756 },
2757 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002758
2759 srcs: [
2760 "seccomp/seccomp_policy.cpp",
2761 ],
2762
2763 export_include_dirs: ["seccomp/include"],
2764 cflags: [
2765 "-Wall",
2766 "-Werror",
2767 ],
2768 shared: {
2769 shared_libs: ["libbase"],
2770 },
2771 static: {
2772 static_libs: ["libbase"],
2773 },
2774}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002775
Colin Cross048f24e2021-09-01 17:26:00 -07002776cc_library_host_static {
2777 name: "libfts",
2778 srcs: [
2779 "bionic/fts.c",
2780 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
2781 ],
2782 export_include_dirs: ["fts/include"],
2783 local_include_dirs: [
2784 "private",
2785 "upstream-openbsd/android/include",
2786 ],
2787 cflags: [
2788 "-include openbsd-compat.h",
2789 "-Wno-unused-parameter",
2790 ],
2791 enabled: false,
2792 target: {
2793 musl: {
2794 enabled: true,
2795 },
2796 },
Colin Cross2a9843f2022-01-13 12:26:30 -08002797 stl: "none",
2798}
2799
2800cc_library_host_static {
2801 name: "libexecinfo",
2802 visibility: ["//external/musl"],
2803 srcs: ["bionic/execinfo.cpp"],
2804 export_include_dirs: ["execinfo/include"],
2805 local_include_dirs: ["private"],
2806 enabled: false,
2807 target: {
2808 musl: {
2809 enabled: true,
2810 system_shared_libs: [],
2811 header_libs: ["libc_musl_headers"],
2812 },
2813 },
2814 stl: "none",
Colin Cross048f24e2021-09-01 17:26:00 -07002815}
2816
Colin Cross9da85fa2022-01-24 18:20:05 -08002817cc_library_host_static {
2818 name: "libb64",
2819 visibility: ["//external/musl"],
2820 srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
2821 export_include_dirs: ["b64/include"],
2822 local_include_dirs: [
2823 "private",
2824 "upstream-openbsd/android/include",
2825 ],
2826 cflags: [
2827 "-include openbsd-compat.h",
2828 ],
2829 enabled: false,
2830 target: {
2831 musl: {
2832 enabled: true,
2833 system_shared_libs: [],
2834 header_libs: ["libc_musl_headers"],
2835 },
2836 },
2837 stl: "none",
2838}
2839
Colin Cross9d4a56e2022-02-03 10:20:32 -08002840// Export kernel uapi headers to be used in the musl sysroot.
2841// Also include the execinfo headers for the libexecinfo and the
2842// b64 headers for libb64 embedded in musl libc.
2843cc_genrule {
2844 name: "libc_musl_sysroot_bionic_headers",
2845 visibility: ["//external/musl"],
2846 host_supported: true,
2847 device_supported: false,
2848 enabled: false,
2849 target: {
2850 musl: {
2851 enabled: true,
2852 },
2853 },
2854 srcs: [
2855 "kernel/uapi/**/*.h",
2856 "kernel/android/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002857 "execinfo/include/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002858 "b64/include/**/*.h",
Colin Crossaeef9f02022-02-07 21:01:26 -08002859
Colin Crossaeef9f02022-02-07 21:01:26 -08002860 "NOTICE",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002861
2862 ":libc_musl_sysroot_bionic_arch_headers",
2863 ],
2864 out: ["libc_musl_sysroot_bionic_headers.zip"],
2865 tools: [
2866 "soong_zip",
2867 "merge_zips",
2868 "zip2zip",
2869 ],
Colin Crossaeef9f02022-02-07 21:01:26 -08002870 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
2871 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
Colin Crossad33d022022-02-25 18:27:04 -08002872 // NOTICE
2873 " -j -f $(location NOTICE) " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002874 // headers
2875 " -P include " +
Colin Crossaeef9f02022-02-07 21:01:26 -08002876 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
2877 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
2878 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2879 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2880 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2881 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2882 " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
2883 " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
2884 " -C $${BIONIC_LIBC_DIR}/b64/include " +
2885 " -D $${BIONIC_LIBC_DIR}/b64/include " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002886 " && " +
Colin Crossad33d022022-02-25 18:27:04 -08002887 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
Colin Cross1c0a7a02022-08-11 12:22:26 -07002888 " -x **/BUILD " +
Colin Crossad33d022022-02-25 18:27:04 -08002889 " include/**/*:include/ " +
2890 " NOTICE:NOTICE.bionic " +
2891 " && " +
2892 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002893}
2894
2895// The architecture-specific bits have to be handled separately because the label varies based
2896// on architecture, which prevents using $(locations) to find them and requires using $(in)
2897// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
2898// genrule.
2899cc_genrule {
2900 name: "libc_musl_sysroot_bionic_arch_headers",
2901 visibility: ["//visibility:private"],
2902 host_supported: true,
2903 device_supported: false,
2904 enabled: false,
2905 target: {
2906 musl: {
2907 enabled: true,
2908 },
2909 },
2910 arch: {
2911 arm: {
2912 srcs: ["kernel/uapi/asm-arm/**/*.h"],
2913 },
2914 arm64: {
2915 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
2916 },
2917 x86: {
2918 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2919 },
2920 x86_64: {
2921 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2922 },
2923 },
2924 out: ["libc_musl_sysroot_bionic_arch_headers.zip"],
2925 tools: ["soong_zip"],
2926 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
2927}
Colin Cross290c4952022-10-13 12:51:13 -07002928
2929cc_genrule {
2930 name: "bionic_sysroot_crt_objects",
2931 visibility: ["//visibility:private"],
2932 out: ["bionic_sysroot_crt_objects.zip"],
2933 tools: ["soong_zip"],
2934 srcs: [
2935 ":crtbegin_dynamic",
2936 ":crtbegin_so",
2937 ":crtbegin_static",
2938 ":crtend_android",
2939 ":crtend_so",
2940 ],
2941 cmd: "$(location soong_zip) -o $(out) -j " +
2942 "-f $(location :crtbegin_dynamic) " +
2943 "-f $(location :crtbegin_so) " +
2944 "-f $(location :crtbegin_static) " +
2945 "-f $(location :crtend_android) " +
2946 "-f $(location :crtend_so)",
2947 dist: {
2948 targets: ["bionic_sysroot_crt_objects"],
2949 },
2950 arch: {
2951 arm: {
2952 dist: {
2953 suffix: "_arm",
2954 },
2955 },
2956 arm64: {
2957 dist: {
2958 suffix: "_arm64",
2959 },
2960 },
2961 riscv64: {
2962 dist: {
2963 suffix: "_riscv64",
2964 },
2965 },
2966 x86: {
2967 dist: {
2968 suffix: "_x86",
2969 },
2970 },
2971 x86_64: {
2972 dist: {
2973 suffix: "_x86_64",
2974 },
2975 },
2976 },
2977}
Spandan Das8fce52a2023-09-28 18:00:12 +00002978
2979// headers that will be placed on the include path when running versioner in bazel
2980// this module should be a no-op in soong
2981filegroup {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002982 name: "versioner-dependencies",
2983 srcs: ["versioner-dependencies/**/*"],
Spandan Das8fce52a2023-09-28 18:00:12 +00002984}
Jiyong Park35a280d2024-05-03 16:53:39 +09002985
2986filegroup {
2987 name: "linux_capability_header",
2988 srcs: ["kernel/uapi/linux/capability.h"],
2989}