blob: d9be8a47d2dbaae808e14627dea4eb18c6879358 [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",
Dan Willemsen208ae172015-09-16 16:33:27 -07001019 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001020
1021 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001022 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -07001023 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001024 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -08001025 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001026 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001027 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001028 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001029 "arch-arm/bionic/atomics_arm.c",
1030 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -08001031 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001032 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001033 "arch-arm/bionic/setjmp.S",
1034 "arch-arm/bionic/syscall.S",
1035 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001036
Haibo Huangea9957a2018-11-19 11:00:32 -08001037 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001038 "arch-arm/cortex-a7/bionic/memset.S",
1039
1040 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001041 "arch-arm/cortex-a9/bionic/memset.S",
1042 "arch-arm/cortex-a9/bionic/stpcpy.S",
1043 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001044 "arch-arm/cortex-a9/bionic/strcpy.S",
1045 "arch-arm/cortex-a9/bionic/strlen.S",
1046
Elliott Hughesaefe9992023-11-08 12:04:41 -08001047 "arch-arm/cortex-a15/bionic/memcpy.S",
1048 "arch-arm/cortex-a15/bionic/memmove.S",
1049 "arch-arm/cortex-a15/bionic/memset.S",
1050 "arch-arm/cortex-a15/bionic/stpcpy.S",
1051 "arch-arm/cortex-a15/bionic/strcat.S",
1052 "arch-arm/cortex-a15/bionic/strcmp.S",
1053 "arch-arm/cortex-a15/bionic/strcpy.S",
1054 "arch-arm/cortex-a15/bionic/strlen.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001055
1056 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001057
Haibo Huang01bfd892018-12-03 15:05:16 -08001058 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001059
Elliott Hughesaefe9992023-11-08 12:04:41 -08001060 "arch-arm/generic/bionic/memcmp.S",
1061 "arch-arm/generic/bionic/memmove.S",
1062 "arch-arm/generic/bionic/memset.S",
1063 "arch-arm/generic/bionic/stpcpy.c",
1064 "arch-arm/generic/bionic/strcat.c",
1065 "arch-arm/generic/bionic/strcmp.S",
1066 "arch-arm/generic/bionic/strcpy.S",
1067 "arch-arm/generic/bionic/strlen.c",
1068
1069 "arch-arm/krait/bionic/memcpy.S",
1070 "arch-arm/krait/bionic/memset.S",
1071
Haibo Huangea9957a2018-11-19 11:00:32 -08001072 "arch-arm/kryo/bionic/memcpy.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001073
1074 "bionic/strchr.cpp",
1075 "bionic/strchrnul.cpp",
1076 "bionic/strnlen.cpp",
1077 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001078 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001079 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001080 arm64: {
1081 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001082 "arch-arm64/bionic/__bionic_clone.S",
1083 "arch-arm64/bionic/_exit_with_stack_teardown.S",
1084 "arch-arm64/bionic/setjmp.S",
1085 "arch-arm64/bionic/syscall.S",
1086 "arch-arm64/bionic/vfork.S",
Vaisakh K V83e55842024-03-29 12:47:39 +05301087 "arch-arm64/oryon/memcpy-nt.S",
Vaisakh K V54a61212024-03-29 13:32:45 +05301088 "arch-arm64/oryon/memset-nt.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001089 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001090 },
1091
Elliott Hughesebc19a92022-10-14 23:25:36 +00001092 riscv64: {
1093 srcs: [
1094 "arch-riscv64/bionic/__bionic_clone.S",
1095 "arch-riscv64/bionic/_exit_with_stack_teardown.S",
Elliott Hughese1905ed2022-10-17 23:23:36 +00001096 "arch-riscv64/bionic/setjmp.S",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001097 "arch-riscv64/bionic/syscall.S",
1098 "arch-riscv64/bionic/vfork.S",
Yun Hsiang40a82d02023-05-26 10:10:40 +08001099
Elliott Hughesaefe9992023-11-08 12:04:41 -08001100 "arch-riscv64/string/memchr_v.S",
1101 "arch-riscv64/string/memcmp_v.S",
1102 "arch-riscv64/string/memcpy_v.S",
1103 "arch-riscv64/string/memmove_v.S",
1104 "arch-riscv64/string/memset_v.S",
1105 "arch-riscv64/string/stpcpy_v.S",
1106 "arch-riscv64/string/strcat_v.S",
1107 "arch-riscv64/string/strchr_v.S",
1108 "arch-riscv64/string/strcmp_v.S",
1109 "arch-riscv64/string/strcpy_v.S",
1110 "arch-riscv64/string/strlen_v.S",
1111 "arch-riscv64/string/strncat_v.S",
1112 "arch-riscv64/string/strncmp_v.S",
1113 "arch-riscv64/string/strncpy_v.S",
1114 "arch-riscv64/string/strnlen_v.S",
1115
1116 "arch-riscv64/string/memchr.c",
1117 "arch-riscv64/string/memcmp.c",
1118 "arch-riscv64/string/memcpy.c",
1119 "arch-riscv64/string/memmove.c",
1120 "arch-riscv64/string/memset.c",
1121 "arch-riscv64/string/stpcpy.c",
1122 "arch-riscv64/string/strcat.c",
1123 "arch-riscv64/string/strchr.c",
1124 "arch-riscv64/string/strcmp.c",
1125 "arch-riscv64/string/strcpy.c",
1126 "arch-riscv64/string/strlen.c",
1127 "arch-riscv64/string/strncat.c",
1128 "arch-riscv64/string/strncmp.c",
1129 "arch-riscv64/string/strncpy.c",
1130 "arch-riscv64/string/strnlen.c",
Prashanth Swaminathana4d71022023-10-30 17:35:19 -07001131
Elliott Hughes7d136662023-10-27 15:40:32 -07001132 "bionic/strchrnul.cpp",
1133 "bionic/strrchr.cpp",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001134 ],
1135 },
1136
Dan Willemsen208ae172015-09-16 16:33:27 -07001137 x86: {
1138 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001139 "arch-x86/bionic/__bionic_clone.S",
1140 "arch-x86/bionic/_exit_with_stack_teardown.S",
1141 "arch-x86/bionic/libcrt_compat.c",
Elliott Hughes7d136662023-10-27 15:40:32 -07001142 "arch-x86/bionic/setjmp.S",
1143 "arch-x86/bionic/syscall.S",
1144 "arch-x86/bionic/vfork.S",
1145 "arch-x86/bionic/__x86.get_pc_thunk.S",
1146
Dan Willemsen208ae172015-09-16 16:33:27 -07001147 "arch-x86/generic/string/memcmp.S",
1148 "arch-x86/generic/string/strcmp.S",
1149 "arch-x86/generic/string/strncmp.S",
1150 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001151
1152 "arch-x86/generic/string/strlcat.c",
1153 "arch-x86/generic/string/strlcpy.c",
1154 "arch-x86/generic/string/strncat.c",
1155 "arch-x86/generic/string/wcscat.c",
1156 "arch-x86/generic/string/wcscpy.c",
1157 "arch-x86/generic/string/wmemcmp.c",
1158
Elliott Hughesed777142022-07-25 16:25:11 +00001159 "arch-x86/string/sse2-memchr-atom.S",
1160 "arch-x86/string/sse2-memmove-slm.S",
1161 "arch-x86/string/sse2-memrchr-atom.S",
1162 "arch-x86/string/sse2-memset-atom.S",
1163 "arch-x86/string/sse2-memset-slm.S",
1164 "arch-x86/string/sse2-stpcpy-slm.S",
1165 "arch-x86/string/sse2-stpncpy-slm.S",
1166 "arch-x86/string/sse2-strchr-atom.S",
1167 "arch-x86/string/sse2-strcpy-slm.S",
1168 "arch-x86/string/sse2-strlen-slm.S",
1169 "arch-x86/string/sse2-strncpy-slm.S",
1170 "arch-x86/string/sse2-strnlen-atom.S",
1171 "arch-x86/string/sse2-strrchr-atom.S",
1172 "arch-x86/string/sse2-wcschr-atom.S",
1173 "arch-x86/string/sse2-wcsrchr-atom.S",
1174 "arch-x86/string/sse2-wcslen-atom.S",
1175 "arch-x86/string/sse2-wcscmp-atom.S",
1176 "arch-x86/string/sse2-strlen-atom.S",
1177
1178 "arch-x86/string/ssse3-memcmp-atom.S",
1179 "arch-x86/string/ssse3-memmove-atom.S",
1180 "arch-x86/string/ssse3-strcat-atom.S",
1181 "arch-x86/string/ssse3-strcmp-atom.S",
1182 "arch-x86/string/ssse3-strcpy-atom.S",
1183 "arch-x86/string/ssse3-strlcat-atom.S",
1184 "arch-x86/string/ssse3-strlcpy-atom.S",
1185 "arch-x86/string/ssse3-strncat-atom.S",
1186 "arch-x86/string/ssse3-strncmp-atom.S",
1187 "arch-x86/string/ssse3-strncpy-atom.S",
1188 "arch-x86/string/ssse3-wcscat-atom.S",
1189 "arch-x86/string/ssse3-wcscpy-atom.S",
1190 "arch-x86/string/ssse3-wmemcmp-atom.S",
1191
1192 "arch-x86/string/sse4-memcmp-slm.S",
1193 "arch-x86/string/sse4-wmemcmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001194
1195 "bionic/strchrnul.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001196 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001197 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001198 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001199 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001200 "arch-x86_64/bionic/__bionic_clone.S",
1201 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1202 "arch-x86_64/bionic/__restore_rt.S",
1203 "arch-x86_64/bionic/setjmp.S",
1204 "arch-x86_64/bionic/syscall.S",
1205 "arch-x86_64/bionic/vfork.S",
1206
ahs919fb7f2022-06-10 07:11:14 +05301207 "arch-x86_64/string/avx2-memset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001208 "arch-x86_64/string/sse2-memmove-slm.S",
1209 "arch-x86_64/string/sse2-memset-slm.S",
1210 "arch-x86_64/string/sse2-stpcpy-slm.S",
1211 "arch-x86_64/string/sse2-stpncpy-slm.S",
1212 "arch-x86_64/string/sse2-strcat-slm.S",
1213 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001214 "arch-x86_64/string/sse2-strlen-slm.S",
1215 "arch-x86_64/string/sse2-strncat-slm.S",
1216 "arch-x86_64/string/sse2-strncpy-slm.S",
1217 "arch-x86_64/string/sse4-memcmp-slm.S",
1218 "arch-x86_64/string/ssse3-strcmp-slm.S",
1219 "arch-x86_64/string/ssse3-strncmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001220
1221 "bionic/strchr.cpp",
1222 "bionic/strchrnul.cpp",
1223 "bionic/strnlen.cpp",
1224 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001225 ],
1226 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001227 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001228
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001229 multilib: {
1230 lib32: {
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001231 srcs: [
1232 // off64_t/time64_t support on LP32.
1233 "bionic/legacy_32_bit_support.cpp",
1234 "bionic/time64.c",
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001235 ],
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001236 },
1237 },
1238
1239 local_include_dirs: ["stdio"],
1240 generated_headers: ["generated_android_ids"],
1241
1242 whole_static_libs: [
1243 "libsystemproperties",
1244 ],
1245
Colin Cross50c21ab2015-10-31 23:03:05 -07001246 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001247 include_dirs: ["bionic/libstdc++/include"],
1248 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001249}
1250
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001251genrule {
1252 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001253 out: ["generated_android_ids.h"],
1254 srcs: [":android_filesystem_config_header"],
Cole Faustb1a0a9d2023-11-28 17:51:16 -08001255 tools: ["fs_config_generator"],
1256 cmd: "$(location fs_config_generator) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001257}
1258
Dan Willemsen268a6732015-10-15 14:49:45 -07001259// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001260// libc_syscalls.a
1261// ========================================================
1262
Elliott Hughes782c4852019-04-16 12:31:00 -07001263genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001264 name: "syscalls-arm",
Elliott Hughes782c4852019-04-16 12:31:00 -07001265 out: ["syscalls-arm.S"],
1266 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001267 tools: ["gensyscalls"],
1268 cmd: "$(location gensyscalls) arm $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001269}
1270
1271genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001272 name: "syscalls-arm64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001273 out: ["syscalls-arm64.S"],
1274 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001275 tools: ["gensyscalls"],
1276 cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001277}
1278
1279genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001280 name: "syscalls-riscv64",
Elliott Hughes704772b2022-10-10 17:06:43 +00001281 out: ["syscalls-riscv64.S"],
1282 srcs: ["SYSCALLS.TXT"],
1283 tools: ["gensyscalls"],
1284 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
1285}
1286
1287genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001288 name: "syscalls-x86",
Elliott Hughes782c4852019-04-16 12:31:00 -07001289 out: ["syscalls-x86.S"],
1290 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001291 tools: ["gensyscalls"],
1292 cmd: "$(location gensyscalls) x86 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001293}
1294
1295genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001296 name: "syscalls-x86_64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001297 out: ["syscalls-x86_64.S"],
1298 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001299 tools: ["gensyscalls"],
1300 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001301}
1302
Dan Willemsen208ae172015-09-16 16:33:27 -07001303cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001304 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001305 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001306 arch: {
1307 arm: {
Cole Faustf5968d82023-04-11 15:20:19 -07001308 srcs: [":syscalls-arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001309 },
1310 arm64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001311 srcs: [":syscalls-arm64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001312 },
Elliott Hughes704772b2022-10-10 17:06:43 +00001313 riscv64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001314 srcs: [":syscalls-riscv64"],
Elliott Hughes704772b2022-10-10 17:06:43 +00001315 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001316 x86: {
Cole Faustf5968d82023-04-11 15:20:19 -07001317 srcs: [":syscalls-x86"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001318 },
1319 x86_64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001320 srcs: [":syscalls-x86_64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001321 },
1322 },
1323 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001324}
1325
1326// ========================================================
1327// libc_aeabi.a
1328// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1329// to avoid infinite recursion. For the other architectures we just build an
1330// empty library to keep this makefile simple.
1331// ========================================================
1332
1333cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001334 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001335 arch: {
1336 arm: {
1337 srcs: ["arch-arm/bionic/__aeabi.c"],
1338 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001339 },
1340 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001341 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001342}
1343
1344// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001345// libc_common.a --- everything shared by libc.a and libc.so
Dan Willemsen208ae172015-09-16 16:33:27 -07001346// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001347
Dan Willemsen208ae172015-09-16 16:33:27 -07001348cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001349 defaults: ["libc_defaults"],
Elliott Hughesb0948922024-01-26 00:28:12 +00001350 name: "libc_common",
1351
Dan Willemsen208ae172015-09-16 16:33:27 -07001352 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001353 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001354 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001355 "libc_bionic",
Ryan Prichard249757b2019-11-01 17:18:28 -07001356 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001357 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001358 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001359 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001360 "libc_freebsd_large_stack",
Elliott Hughesc2043342023-07-20 20:24:09 +00001361 "libc_freebsd_ldexp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001362 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001363 "libc_netbsd",
1364 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001365 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001366 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001367 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001368 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001369 ],
1370
1371 arch: {
1372 arm: {
1373 whole_static_libs: ["libc_aeabi"],
1374 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001375 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001376}
1377
1378// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001379// libc_static_dispatch.a --- libc.a ifuncs
Haibo Huangf71edfa2018-11-12 10:06:56 -08001380// ========================================================
1381cc_library_static {
1382 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001383 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001384
Haibo Huangb9244ff2018-08-11 10:12:13 -07001385 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301386 x86_64: {
1387 srcs: ["arch-x86_64/static_function_dispatch.S"],
1388 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001389 x86: {
1390 srcs: ["arch-x86/static_function_dispatch.S"],
1391 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001392 arm: {
1393 srcs: ["arch-arm/static_function_dispatch.S"],
1394 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001395 arm64: {
1396 srcs: ["arch-arm64/static_function_dispatch.S"],
1397 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001398 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001399 srcs: ["arch-riscv64/static_function_dispatch.S"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001400 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001401 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001402}
1403
1404// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001405// libc_dynamic_dispatch.a --- libc.so ifuncs
Haibo Huangf71edfa2018-11-12 10:06:56 -08001406// ========================================================
1407cc_library_static {
1408 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001409 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001410
Haibo Huangb9244ff2018-08-11 10:12:13 -07001411 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001412 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001413 "-fno-stack-protector",
1414 "-fno-jump-tables",
1415 ],
1416 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301417 x86_64: {
1418 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
1419 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001420 x86: {
1421 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1422 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001423 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001424 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001425 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001426 arm64: {
1427 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1428 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001429 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001430 srcs: ["arch-riscv64/dynamic_function_dispatch.cpp"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001431 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001432 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001433}
1434
1435// ========================================================
1436// libc_common_static.a For static binaries.
1437// ========================================================
1438cc_library_static {
1439 defaults: ["libc_defaults"],
1440 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001441
Haibo Huangf71edfa2018-11-12 10:06:56 -08001442 whole_static_libs: [
1443 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001444 "libc_static_dispatch",
1445 ],
1446}
1447
1448// ========================================================
1449// libc_common_shared.a For shared libraries.
1450// ========================================================
1451cc_library_static {
1452 defaults: ["libc_defaults"],
1453 name: "libc_common_shared",
1454
1455 whole_static_libs: [
1456 "libc_common",
1457 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001458 ],
1459}
1460
Ryan Prichard22a6a052019-10-10 23:59:30 -07001461// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1462// executable.
1463cc_library_static {
1464 name: "libc_unwind_static",
1465 defaults: ["libc_defaults"],
1466 cflags: ["-DLIBC_STATIC"],
1467
1468 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1469 arch: {
1470 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1471 arm: {
1472 srcs: ["arch-arm/bionic/exidx_static.c"],
1473 },
1474 },
1475}
1476
Haibo Huangf71edfa2018-11-12 10:06:56 -08001477// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001478// libc_nomalloc.a
1479// ========================================================
1480//
Ryan Prichard249757b2019-11-01 17:18:28 -07001481// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1482// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1483// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001484
1485cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001486 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001487 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001488
Colin Crossa3f9fca2016-01-11 13:20:55 -08001489 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001490 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001491 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001492 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001493 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001494}
1495
dimitryc0c0ef62018-12-05 16:33:52 +01001496filegroup {
1497 name: "libc_sources_shared",
1498 srcs: [
1499 "arch-common/bionic/crtbegin_so.c",
1500 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001501 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001502 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001503 "bionic/icu.cpp",
1504 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001505 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001506 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001507 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001508 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001509 "bionic/ndk_cruft.cpp",
1510 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001511 "bionic/NetdClient.cpp",
1512 "arch-common/bionic/crtend_so.S",
1513 ],
1514}
1515
1516filegroup {
1517 name: "libc_sources_static",
1518 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001519 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001520 "bionic/heap_tagging.cpp",
Elliott Hughes72b0f3b2024-07-02 20:22:35 +00001521 "bionic/icu_static.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001522 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001523 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001524 ],
1525}
1526
1527filegroup {
1528 name: "libc_sources_shared_arm",
1529 srcs: [
1530 "arch-arm/bionic/exidx_dynamic.c",
1531 "arch-arm/bionic/atexit_legacy.c",
1532 ],
1533}
1534
Dan Willemsen208ae172015-09-16 16:33:27 -07001535// ========================================================
1536// libc.a + libc.so
1537// ========================================================
Florian Mayerc10d0642023-03-22 16:12:49 -07001538cc_defaults {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001539 defaults: [
1540 "libc_defaults",
1541 "libc_native_allocator_defaults",
Elliott Hughes788075a2024-06-18 12:25:37 +00001542 "bug_24465209_workaround",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001543 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001544 name: "libc_library_defaults",
Colin Cross50c21ab2015-10-31 23:03:05 -07001545 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001546 platform_sdk_version: {
1547 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1548 },
1549 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001550 static: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001551 srcs: [":libc_sources_static"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001552 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001553 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001554 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001555 "libc_init_static",
1556 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001557 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001558 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001559 },
1560 shared: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001561 srcs: [":libc_sources_shared"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001562 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001563 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001564 "libc_init_dynamic",
1565 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001566 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001567 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001568 },
1569
Neil Fullera7db90f2019-04-25 09:28:27 +01001570 required: [
MarkDacekd88d7ea2022-06-28 20:14:58 +00001571 "tzdata_prebuilt",
1572 "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
Neil Fullera7db90f2019-04-25 09:28:27 +01001573 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001574
Colin Cross4ce94d22016-11-15 13:15:43 -08001575 // Do not pack libc.so relocations; see http://b/20645321 for details.
1576 pack_relocations: false,
1577
dimitry06016f22018-01-05 11:39:28 +01001578 shared_libs: [
1579 "ld-android",
1580 "libdl",
1581 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001582 static_libs: [
1583 "libdl_android",
1584 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001585
1586 nocrt: true,
1587
Dan Willemsen208ae172015-09-16 16:33:27 -07001588 arch: {
1589 arm: {
Christopher Ferris9d03a162023-11-10 11:19:11 -08001590 ldflags: [
Christopher Ferris9d03a162023-11-10 11:19:11 -08001591 // Since we are preserving the debug_frame, do not compress
1592 // in this case to make unwinds as fast as possible.
1593 "-Wl,--compress-debug-sections=none",
1594 ],
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001595
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001596 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001597 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001598
Dan Willemsen208ae172015-09-16 16:33:27 -07001599 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001600 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001601 // special for arm
1602 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001603 // For backwards-compatibility, some arm32 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001604 static_libs: ["libclang_rt.builtins-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001605 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001606
1607 // Arm 32 bit does not produce complete exidx unwind information
1608 // so keep the .debug_frame which is relatively small and does
1609 // include needed unwind information.
1610 // See b/132992102 for details.
1611 strip: {
1612 keep_symbols_and_debug_frame: true,
1613 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001614 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001615 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001616 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001617
1618 // Leave the symbols in the shared library so that stack unwinders can produce
1619 // meaningful name resolution.
1620 strip: {
1621 keep_symbols: true,
1622 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001623 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001624 riscv64: {
1625 version_script: ":libc.riscv64.map",
1626
1627 // Leave the symbols in the shared library so that stack unwinders can produce
1628 // meaningful name resolution.
1629 strip: {
1630 keep_symbols: true,
1631 },
1632 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001633 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001634 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001635 no_libcrt: true,
1636
1637 shared: {
1638 // For backwards-compatibility, some x86 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001639 static_libs: ["libclang_rt.builtins-exported"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001640 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001641
1642 // Leave the symbols in the shared library so that stack unwinders can produce
1643 // meaningful name resolution.
1644 strip: {
1645 keep_symbols: true,
1646 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001647 },
1648 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001649 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001650
1651 // Leave the symbols in the shared library so that stack unwinders can produce
1652 // meaningful name resolution.
1653 strip: {
1654 keep_symbols: true,
1655 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001656 },
1657 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001658
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001659 apex_available: [
1660 "//apex_available:platform",
1661 "com.android.runtime",
1662 ],
1663
Colin Cross7edd0082021-10-28 13:20:35 -07001664 target: {
1665 native_bridge: {
1666 shared: {
1667 installable: false,
1668 },
1669 },
1670 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001671}
1672
Florian Mayerc10d0642023-03-22 16:12:49 -07001673cc_library {
1674 name: "libc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001675 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001676 "libc_library_defaults",
1677 ],
1678 stubs: {
1679 symbol_file: "libc.map.txt",
1680 versions: [
1681 "29",
1682 "R",
1683 "current",
1684 ],
1685 },
1686 static_ndk_lib: true,
1687 llndk: {
1688 symbol_file: "libc.map.txt",
1689 export_headers_as_system: true,
1690 export_preprocessed_headers: ["include"],
1691 export_llndk_headers: ["libc_llndk_headers"],
1692 },
1693}
1694
1695cc_library {
1696 name: "libc_hwasan",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001697 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001698 "libc_library_defaults",
1699 ],
1700 sanitize: {
1701 hwaddress: true,
1702 },
1703 enabled: false,
Florian Mayerff116ed2023-04-14 17:38:53 -07001704 target: {
1705 android_arm64: {
Florian Mayerc10d0642023-03-22 16:12:49 -07001706 enabled: true,
1707 },
1708 },
1709 stem: "libc",
1710 relative_install_path: "hwasan",
1711 // We don't really need the stubs, but this needs to stay to trigger the
1712 // symlink logic in soong.
1713 stubs: {
1714 symbol_file: "libc.map.txt",
1715 },
1716 native_bridge_supported: false,
1717 // It is never correct to depend on this directly. This is only
1718 // needed for the runtime apex, and in base_system.mk.
1719 visibility: ["//bionic/apex"],
1720}
1721
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001722genrule {
1723 name: "libc.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001724 out: ["libc.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001725 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001726 tools: ["generate-version-script"],
1727 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001728}
1729
1730genrule {
1731 name: "libc.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001732 out: ["libc.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001733 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001734 tools: ["generate-version-script"],
1735 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001736}
1737
1738genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001739 name: "libc.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001740 out: ["libc.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001741 srcs: ["libc.map.txt"],
1742 tools: ["generate-version-script"],
1743 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1744}
1745
1746genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001747 name: "libc.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001748 out: ["libc.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001749 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001750 tools: ["generate-version-script"],
1751 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001752}
1753
1754genrule {
1755 name: "libc.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001756 out: ["libc.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001757 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001758 tools: ["generate-version-script"],
1759 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001760}
1761
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001762// Headers that only other parts of the platform can include.
1763cc_library_headers {
1764 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001765 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001766 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001767 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001768 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001769 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001770 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001771 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001772 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001773 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001774 "//system/core/debuggerd:__subpackages__",
Florian Mayerf5d70ce2022-09-13 13:58:30 -07001775 "//system/core/init:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001776 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001777 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001778 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001779 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001780 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001781 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001782 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001783 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001784 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001785 recovery_available: true,
1786 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001787 export_include_dirs: [
1788 "platform",
1789 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001790 system_shared_libs: [],
1791 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001792 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001793
Steven Moreland0cdf1322020-10-05 21:55:26 +00001794 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001795 apex_available: [
1796 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001797 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001798 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001799}
1800
Logan Chien17af91b2019-01-15 21:19:56 +08001801cc_library_headers {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001802 name: "libc_llndk_headers",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001803 visibility: [
1804 "//external/musl",
1805 ],
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001806 llndk: {
1807 llndk_headers: true,
1808 },
Logan Chien17af91b2019-01-15 21:19:56 +08001809 host_supported: true,
1810 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001811 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001812 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001813 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001814 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001815 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001816 apex_available: [
1817 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001818 "//apex_available:anyapex",
1819 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001820 // used by most APEXes indirectly via libunwind_llvm
1821 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001822
1823 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001824 stl: "none",
1825 system_shared_libs: [],
1826
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001827 // The build system generally requires that any dependencies of a target
1828 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1829 // to 1 we let targets with an sdk_version that need to depend on the libc
1830 // headers but cannot depend on libc itself due to circular dependencies
1831 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1832 // is correct because the headers can support any sdk_version.
1833 sdk_version: "1",
1834
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001835 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001836 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001837 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001838 "kernel/android/uapi",
1839 ],
1840
1841 arch: {
1842 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001843 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001844 },
1845 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001846 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001847 },
Elliott Hughes48e53332022-10-07 20:39:25 +00001848 riscv64: {
1849 export_system_include_dirs: ["kernel/uapi/asm-riscv"],
1850 },
Logan Chien17af91b2019-01-15 21:19:56 +08001851 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001852 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001853 },
1854 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001855 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001856 },
1857 },
1858}
1859
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001860cc_library_headers {
1861 name: "libc_headers",
1862 host_supported: true,
1863 native_bridge_supported: true,
1864 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001865 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001866 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001867 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001868 recovery_available: true,
1869 sdk_version: "1",
1870
1871 apex_available: [
1872 "//apex_available:platform",
1873 "//apex_available:anyapex",
1874 ],
1875 // used by most APEXes indirectly via libunwind_llvm
1876 min_sdk_version: "apex_inherit",
1877 visibility: [
1878 "//bionic:__subpackages__", // visible to bionic
1879 // ... and only to these places (b/152668052)
1880 "//external/arm-optimized-routines",
1881 "//external/gwp_asan",
1882 "//external/jemalloc_new",
1883 "//external/libunwind_llvm",
Nick Desaulniers942ae552024-02-12 10:26:19 -08001884 "//external/llvm-libc",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001885 "//external/scudo",
1886 "//system/core/property_service/libpropertyinfoparser",
1887 "//system/extras/toolchain-extras",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001888 ],
1889
1890 stl: "none",
1891 no_libcrt: true,
1892 system_shared_libs: [],
1893
1894 target: {
1895 android: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001896 export_system_include_dirs: ["include"],
1897 header_libs: ["libc_llndk_headers"],
1898 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001899 },
1900 linux_bionic: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001901 export_system_include_dirs: ["include"],
1902 header_libs: ["libc_llndk_headers"],
1903 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001904 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001905 },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001906}
1907
Dan Willemsen208ae172015-09-16 16:33:27 -07001908// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001909// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001910// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001911
Dan Willemsen208ae172015-09-16 16:33:27 -07001912cc_library {
Elliott Hughes788075a2024-06-18 12:25:37 +00001913 defaults: [
1914 "libc_defaults",
1915 "bug_24465209_workaround",
1916 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001917 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001918 srcs: [
1919 "bionic/__cxa_guard.cpp",
1920 "bionic/__cxa_pure_virtual.cpp",
1921 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001922 ],
1923 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001924 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001925 static_libs: ["libasync_safe"],
Elliott Hughesc2043342023-07-20 20:24:09 +00001926 apex_available: [
1927 "//apex_available:platform",
1928 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001929
Dan Willemsen6b3be172018-12-03 13:57:20 -08001930 static: {
1931 system_shared_libs: [],
1932 },
Colin Crossb5bfe0b2021-07-13 16:26:28 -07001933 target: {
1934 bionic: {
1935 shared: {
1936 system_shared_libs: ["libc"],
1937 },
1938 },
Dan Willemsen6b3be172018-12-03 13:57:20 -08001939 },
1940
Dan Willemsen208ae172015-09-16 16:33:27 -07001941 arch: {
1942 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001943 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001944 },
1945 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001946 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001947 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001948 riscv64: {
1949 version_script: ":libstdc++.riscv64.map",
1950 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001951 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001952 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001953 },
1954 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001955 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001956 },
1957 },
1958}
1959
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001960genrule {
1961 name: "libstdc++.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001962 out: ["libstdc++.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001963 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001964 tools: ["generate-version-script"],
1965 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001966}
1967
1968genrule {
1969 name: "libstdc++.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001970 out: ["libstdc++.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001971 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001972 tools: ["generate-version-script"],
1973 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001974}
1975
1976genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001977 name: "libstdc++.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001978 out: ["libstdc++.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001979 srcs: ["libstdc++.map.txt"],
1980 tools: ["generate-version-script"],
1981 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1982}
1983
1984genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001985 name: "libstdc++.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001986 out: ["libstdc++.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001987 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001988 tools: ["generate-version-script"],
1989 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001990}
1991
1992genrule {
1993 name: "libstdc++.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001994 out: ["libstdc++.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001995 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001996 tools: ["generate-version-script"],
1997 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001998}
1999
2000// ========================================================
2001// crt object files.
2002// ========================================================
2003
Colin Cross50c21ab2015-10-31 23:03:05 -07002004cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002005 name: "crt_and_memtag_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002006 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002007 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002008 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002009 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002010 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002011 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002012 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002013 apex_available: [
2014 "//apex_available:platform",
2015 "//apex_available:anyapex",
2016 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002017 // Generate NDK variants of the CRT objects for every supported API level.
2018 min_sdk_version: "16",
2019 stl: "none",
2020 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002021 cflags: [
2022 "-Wno-gcc-compat",
2023 "-Wall",
2024 "-Werror",
2025 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002026 sanitize: {
2027 never: true,
2028 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002029}
2030
Colin Cross50c21ab2015-10-31 23:03:05 -07002031cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002032 name: "crt_defaults",
2033 defaults: ["crt_and_memtag_defaults"],
Colin Cross02f81372021-07-22 12:02:10 -07002034 system_shared_libs: [],
Colin Cross10d92682021-06-22 13:25:46 -07002035}
2036
2037cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002038 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002039 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002040
2041 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002042 x86: {
2043 cflags: ["-fPIC"],
2044 },
2045 x86_64: {
2046 cflags: ["-fPIC"],
2047 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002048 },
Colin Crossab179442018-09-27 11:03:22 -07002049 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002050}
2051
Dan Willemsen208ae172015-09-16 16:33:27 -07002052cc_object {
2053 name: "crtbrand",
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002054 local_include_dirs: [
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002055 "private", // crtbrand.S depends on private/bionic_asm_note.h
2056 ],
Elliott Hughes6a30b712024-03-13 23:41:32 +00002057 // crtbrand.S needs to know the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002058 product_variables: {
2059 platform_sdk_version: {
2060 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2061 },
2062 },
2063 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002064
Colin Cross7d7b3682017-11-03 13:38:40 -07002065 defaults: ["crt_so_defaults"],
Dan Alberteee46dc2023-04-04 23:27:52 +00002066 // crtbrand is an intermediate artifact, not a final CRT object.
2067 exclude_from_ndk_sysroot: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07002068}
2069
Dan Willemsen208ae172015-09-16 16:33:27 -07002070cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002071 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002072 local_include_dirs: ["include"],
2073 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002074
Colin Cross7d7b3682017-11-03 13:38:40 -07002075 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002076 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002077 "crtbrand",
2078 ],
2079}
2080
Dan Willemsen208ae172015-09-16 16:33:27 -07002081cc_object {
2082 name: "crtend_so",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002083 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002084 "private", // crtend_so.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002085 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002086 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002087
Colin Cross7d7b3682017-11-03 13:38:40 -07002088 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002089}
2090
Dan Willemsen208ae172015-09-16 16:33:27 -07002091cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002092 name: "crtbegin_static",
2093
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002094 local_include_dirs: [
2095 "include",
2096 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2097 ],
Liz Kammere718dd72021-03-09 15:00:06 -05002098
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002099 cflags: ["-DCRTBEGIN_STATIC"],
Yabin Cui744cfd32023-08-24 13:20:23 -07002100
Dan Willemsen208ae172015-09-16 16:33:27 -07002101 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002102 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002103 "crtbrand",
2104 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002105 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002106 // When using libc.a, we're using the latest library regardless of target API level.
2107 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002108}
2109
Dan Willemsen208ae172015-09-16 16:33:27 -07002110cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002111 name: "crtbegin_dynamic",
2112
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002113 local_include_dirs: [
2114 "include",
2115 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2116 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002117 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002118 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002119 "crtbrand",
2120 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002121 target: {
2122 linux_bionic: {
2123 generated_sources: ["host_bionic_linker_asm"],
2124 objs: [
2125 "linker_wrapper",
2126 ],
2127 },
2128 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002129 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002130}
2131
Dan Willemsen208ae172015-09-16 16:33:27 -07002132cc_object {
2133 // We rename crtend.o to crtend_android.o to avoid a
2134 // name clash between gcc and bionic.
2135 name: "crtend_android",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002136 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002137 "private", // crtend.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002138 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002139 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002140
Colin Cross50c21ab2015-10-31 23:03:05 -07002141 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002142}
Colin Crossbaa48992016-07-13 11:15:21 -07002143
Kalesh Singh862a23d2024-01-09 13:13:50 -08002144cc_object {
2145 name: "crt_pad_segment",
2146 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002147 "private", // crt_pad_segment.S depends on private/bionic_asm_note.h
Kalesh Singh862a23d2024-01-09 13:13:50 -08002148 ],
2149 srcs: ["arch-common/bionic/crt_pad_segment.S"],
2150
2151 defaults: ["crt_defaults"],
2152}
2153
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002154cc_library_static {
2155 name: "note_memtag_heap_async",
2156 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002157 arm64: {
2158 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2159 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002160 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002161 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002162
Colin Cross10d92682021-06-22 13:25:46 -07002163 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002164}
2165
2166cc_library_static {
2167 name: "note_memtag_heap_sync",
2168 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002169 arm64: {
2170 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2171 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002172 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002173 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002174
Colin Cross10d92682021-06-22 13:25:46 -07002175 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002176}
2177
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002178// ========================================================
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002179// libc dependencies for baremetal Rust projects.
2180// ========================================================
2181
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002182// This library contains the following unresolved symbols:
2183// __errno
2184// abort
2185// async_safe_fatal_va_list
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002186cc_library_static {
2187 name: "librust_baremetal",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002188 header_libs: ["libc_headers"],
2189 include_dirs: [
2190 "bionic/libc/async_safe/include",
2191 "bionic/libc/platform",
2192 ],
2193 cflags: [
2194 "-Wall",
2195 "-Werror",
2196 ],
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002197 srcs: [
2198 "bionic/fortify.cpp",
Pierre-Clément Tosi816176c2022-11-30 14:33:41 +00002199 "bionic/strtol.cpp",
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002200 ],
2201 arch: {
2202 arm64: {
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002203 srcs: [
2204 "arch-arm64/string/__memcpy_chk.S",
2205 ],
2206 },
caowencheng9a39eb32023-03-20 16:24:41 +08002207 riscv64: {
2208 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002209 "arch-riscv64/string/__memcpy_chk.S",
caowencheng9a39eb32023-03-20 16:24:41 +08002210 ],
2211 },
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002212 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002213 whole_static_libs: [
2214 "libarm-optimized-routines-mem",
Pierre-Clément Tosieb46ac92023-02-01 13:44:57 +00002215 "libc_netbsd",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002216 ],
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002217 system_shared_libs: [],
2218 nocrt: true,
2219 stl: "none",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002220 visibility: [
2221 "//packages/modules/Virtualization/vmbase",
2222 ],
2223}
2224
2225// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002226// NDK headers.
2227// ========================================================
2228
Dan Albert26e1c412018-05-24 14:56:46 -07002229versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002230 name: "common_libc",
2231 from: "include",
2232 to: "",
2233 license: "NOTICE",
2234}
Dan Albert4238a352016-06-28 11:18:05 -07002235
2236ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002237 name: "libc_uapi",
2238 from: "kernel/uapi",
2239 to: "",
2240 srcs: [
2241 "kernel/uapi/asm-generic/**/*.h",
2242 "kernel/uapi/drm/**/*.h",
2243 "kernel/uapi/linux/**/*.h",
2244 "kernel/uapi/misc/**/*.h",
2245 "kernel/uapi/mtd/**/*.h",
2246 "kernel/uapi/rdma/**/*.h",
2247 "kernel/uapi/scsi/**/*.h",
2248 "kernel/uapi/sound/**/*.h",
2249 "kernel/uapi/video/**/*.h",
2250 "kernel/uapi/xen/**/*.h",
2251 ],
Dan Albert92592652016-10-20 01:42:54 -07002252 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002253}
2254
2255ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002256 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002257 from: "kernel/android/uapi/linux",
2258 to: "linux",
2259 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002260 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002261}
2262
2263ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002264 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002265 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002266 to: "scsi",
2267 srcs: ["kernel/android/scsi/**/*.h"],
2268 license: "NOTICE",
2269}
2270
2271ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002272 name: "libc_asm_arm",
2273 from: "kernel/uapi/asm-arm",
2274 to: "arm-linux-androideabi",
2275 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002276 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002277}
2278
2279ndk_headers {
2280 name: "libc_asm_arm64",
2281 from: "kernel/uapi/asm-arm64",
2282 to: "aarch64-linux-android",
2283 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002284 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002285}
2286
Lazar Trsic790d2f72017-11-27 11:54:11 +01002287ndk_headers {
Colin Crossbd26e0f2022-10-19 15:03:14 -07002288 name: "libc_asm_riscv64",
2289 from: "kernel/uapi/asm-riscv",
2290 to: "riscv64-linux-android",
2291 srcs: ["kernel/uapi/asm-riscv/**/*.h"],
2292 license: "NOTICE",
2293}
2294
2295ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002296 name: "libc_asm_x86",
2297 from: "kernel/uapi/asm-x86",
2298 to: "i686-linux-android",
2299 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002300 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002301}
2302
2303ndk_headers {
2304 name: "libc_asm_x86_64",
2305 from: "kernel/uapi/asm-x86",
2306 to: "x86_64-linux-android",
2307 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002308 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002309}
2310
Dan Albert4238a352016-06-28 11:18:05 -07002311ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002312 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002313 symbol_file: "libc.map.txt",
2314 first_version: "9",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002315 export_header_libs: [
2316 "common_libc",
2317 "libc_uapi",
2318 "libc_kernel_android_uapi_linux",
2319 "libc_kernel_android_scsi",
2320 "libc_asm_arm",
2321 "libc_asm_arm64",
Colin Crossbd26e0f2022-10-19 15:03:14 -07002322 "libc_asm_riscv64",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002323 "libc_asm_x86",
2324 "libc_asm_x86_64",
2325 ],
Dan Albert4238a352016-06-28 11:18:05 -07002326}
2327
Dan Albertdf31aff2016-10-06 15:50:41 -07002328ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002329 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002330 symbol_file: "libstdc++.map.txt",
2331 first_version: "9",
2332}
2333
Dan Willemsenca056d72018-01-08 14:00:24 -08002334// Export these headers for toolbox to process
2335filegroup {
2336 name: "kernel_input_headers",
2337 srcs: [
2338 "kernel/uapi/linux/input.h",
2339 "kernel/uapi/linux/input-event-codes.h",
2340 ],
2341}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002342
2343// Generate a syscall name / number mapping. These objects are text files
2344// (thanks to the -dD -E flags) and not binary files. They will then be
2345// consumed by the genseccomp.py script and converted into C++ code.
2346cc_defaults {
2347 name: "libseccomp_gen_syscall_nrs_defaults",
2348 recovery_available: true,
2349 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2350 cflags: [
2351 "-dD",
2352 "-E",
2353 "-Wall",
2354 "-Werror",
2355 "-nostdinc",
2356 ],
2357}
2358
2359cc_object {
2360 name: "libseccomp_gen_syscall_nrs_arm",
2361 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2362 local_include_dirs: [
2363 "kernel/uapi/asm-arm",
2364 "kernel/uapi",
2365 ],
2366}
2367
2368cc_object {
2369 name: "libseccomp_gen_syscall_nrs_arm64",
2370 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2371 local_include_dirs: [
2372 "kernel/uapi/asm-arm64",
2373 "kernel/uapi",
2374 ],
2375}
2376
2377cc_object {
Elliott Hughes704772b2022-10-10 17:06:43 +00002378 name: "libseccomp_gen_syscall_nrs_riscv64",
2379 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2380 local_include_dirs: [
2381 "kernel/uapi/asm-riscv",
2382 "kernel/uapi",
2383 ],
2384}
2385
2386cc_object {
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002387 name: "libseccomp_gen_syscall_nrs_x86",
2388 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2389 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2390 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2391 local_include_dirs: [
2392 "kernel/uapi/asm-x86",
2393 "kernel/uapi",
2394 ],
2395}
2396
2397cc_object {
2398 name: "libseccomp_gen_syscall_nrs_x86_64",
2399 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2400 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2401 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2402 local_include_dirs: [
2403 "kernel/uapi/asm-x86",
2404 "kernel/uapi",
2405 ],
2406}
2407
Jingwen Chenca366332021-01-29 05:16:32 -05002408filegroup {
2409 name: "all_kernel_uapi_headers",
2410 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002411}
2412
Martijn Coenen0c6de752019-01-02 12:52:51 +01002413cc_genrule {
2414 name: "func_to_syscall_nrs",
2415 recovery_available: true,
2416 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2417
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002418 tools: ["genfunctosyscallnrs"],
Martijn Coenen0c6de752019-01-02 12:52:51 +01002419
2420 srcs: [
2421 "SYSCALLS.TXT",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002422 ],
2423
Elliott Hughes704772b2022-10-10 17:06:43 +00002424 arch: {
2425 arm: {
2426 srcs: [
2427 ":libseccomp_gen_syscall_nrs_arm",
2428 ":libseccomp_gen_syscall_nrs_arm64",
2429 ],
2430 },
2431 arm64: {
2432 srcs: [
2433 ":libseccomp_gen_syscall_nrs_arm",
2434 ":libseccomp_gen_syscall_nrs_arm64",
2435 ],
2436 },
2437 riscv64: {
2438 srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
2439 },
2440 x86: {
2441 srcs: [
2442 ":libseccomp_gen_syscall_nrs_x86",
2443 ":libseccomp_gen_syscall_nrs_x86_64",
2444 ],
2445 },
2446 x86_64: {
2447 srcs: [
2448 ":libseccomp_gen_syscall_nrs_x86",
2449 ":libseccomp_gen_syscall_nrs_x86_64",
2450 ],
2451 },
2452 },
2453
Martijn Coenen0c6de752019-01-02 12:52:51 +01002454 out: [
2455 "func_to_syscall_nrs.h",
2456 ],
2457}
2458
Victor Hsiehdbb86702020-06-15 09:29:07 -07002459// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002460genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002461 name: "generate_app_zygote_blocklist",
2462 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2463 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002464 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2465}
2466
Yu Liu938ec9b2022-10-17 16:36:30 -07002467filegroup {
2468 name: "seccomp_syscalls_sources_zygote",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002469 srcs: [
2470 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002471 "SECCOMP_ALLOWLIST_COMMON.TXT",
2472 "SECCOMP_ALLOWLIST_APP.TXT",
2473 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002474 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002475 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002476 ],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002477}
2478
Yu Liu938ec9b2022-10-17 16:36:30 -07002479filegroup {
2480 name: "seccomp_syscalls_sources_app",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002481 srcs: [
2482 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002483 "SECCOMP_ALLOWLIST_COMMON.TXT",
2484 "SECCOMP_ALLOWLIST_APP.TXT",
2485 "SECCOMP_BLOCKLIST_COMMON.TXT",
2486 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002487 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002488 ],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002489}
2490
Yu Liu938ec9b2022-10-17 16:36:30 -07002491filegroup {
2492 name: "seccomp_syscalls_sources_system",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002493 srcs: [
2494 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002495 "SECCOMP_ALLOWLIST_COMMON.TXT",
2496 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2497 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002498 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002499 ],
Yu Liu938ec9b2022-10-17 16:36:30 -07002500}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002501
Yu Liu938ec9b2022-10-17 16:36:30 -07002502cc_genrule {
2503 name: "libseccomp_policy_app_zygote_sources_x86",
2504 recovery_available: true,
2505 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002506 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002507 srcs: [
2508 ":seccomp_syscalls_sources_zygote",
2509 ":libseccomp_gen_syscall_nrs_x86",
2510 ":libseccomp_gen_syscall_nrs_x86_64",
2511 ],
2512 out: [
2513 "x86_app_zygote_policy.cpp",
2514 "x86_64_app_zygote_policy.cpp",
2515 ],
2516 enabled: false,
Yu Liu3a579692022-10-18 03:02:32 +00002517 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002518 x86: {
2519 enabled: true,
2520 },
2521 x86_64: {
2522 enabled: true,
2523 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002524 },
2525}
2526
2527cc_genrule {
2528 name: "libseccomp_policy_app_zygote_sources_arm",
2529 recovery_available: true,
2530 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002531 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002532 srcs: [
2533 ":seccomp_syscalls_sources_zygote",
2534 ":libseccomp_gen_syscall_nrs_arm",
2535 ":libseccomp_gen_syscall_nrs_arm64",
2536 ],
2537 out: [
2538 "arm_app_zygote_policy.cpp",
2539 "arm64_app_zygote_policy.cpp",
2540 ],
2541 enabled: false,
2542 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002543 arm: {
2544 enabled: true,
2545 },
2546 arm64: {
2547 enabled: true,
2548 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002549 },
2550}
2551
2552cc_genrule {
2553 name: "libseccomp_policy_app_zygote_sources_riscv64",
2554 recovery_available: true,
2555 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002556 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002557 srcs: [
2558 ":seccomp_syscalls_sources_zygote",
2559 ":libseccomp_gen_syscall_nrs_riscv64",
2560 ],
2561 out: [
2562 "riscv64_app_zygote_policy.cpp",
2563 ],
2564 enabled: false,
2565 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002566 riscv64: {
2567 enabled: true,
2568 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002569 },
2570}
2571
2572cc_genrule {
2573 name: "libseccomp_policy_app_sources_x86",
2574 recovery_available: true,
2575 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002576 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002577 srcs: [
2578 ":seccomp_syscalls_sources_app",
2579 ":libseccomp_gen_syscall_nrs_x86",
2580 ":libseccomp_gen_syscall_nrs_x86_64",
2581 ],
2582 out: [
2583 "x86_app_policy.cpp",
2584 "x86_64_app_policy.cpp",
2585 ],
2586 enabled: false,
2587 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002588 x86: {
2589 enabled: true,
2590 },
2591 x86_64: {
2592 enabled: true,
2593 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002594 },
2595}
2596
2597cc_genrule {
2598 name: "libseccomp_policy_app_sources_arm",
2599 recovery_available: true,
2600 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002601 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002602 srcs: [
2603 ":seccomp_syscalls_sources_app",
2604 ":libseccomp_gen_syscall_nrs_arm",
2605 ":libseccomp_gen_syscall_nrs_arm64",
2606 ],
2607 out: [
2608 "arm_app_policy.cpp",
2609 "arm64_app_policy.cpp",
2610 ],
2611 enabled: false,
2612 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002613 arm: {
2614 enabled: true,
2615 },
2616 arm64: {
2617 enabled: true,
2618 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002619 },
2620}
2621
2622cc_genrule {
2623 name: "libseccomp_policy_app_sources_riscv64",
2624 recovery_available: true,
2625 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002626 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002627 srcs: [
2628 ":seccomp_syscalls_sources_app",
2629 ":libseccomp_gen_syscall_nrs_riscv64",
2630 ],
2631 out: [
2632 "riscv64_app_policy.cpp",
2633 ],
2634 enabled: false,
2635 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002636 riscv64: {
2637 enabled: true,
2638 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002639 },
2640}
2641
2642cc_genrule {
2643 name: "libseccomp_policy_system_sources_x86",
2644 recovery_available: true,
2645 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002646 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002647 srcs: [
2648 ":seccomp_syscalls_sources_system",
2649 ":libseccomp_gen_syscall_nrs_x86",
2650 ":libseccomp_gen_syscall_nrs_x86_64",
2651 ],
2652 out: [
2653 "x86_system_policy.cpp",
2654 "x86_64_system_policy.cpp",
2655 ],
2656 enabled: false,
2657 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002658 x86: {
2659 enabled: true,
2660 },
2661 x86_64: {
2662 enabled: true,
2663 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002664 },
2665}
2666
2667cc_genrule {
2668 name: "libseccomp_policy_system_sources_arm",
2669 recovery_available: true,
2670 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002671 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002672 srcs: [
2673 ":seccomp_syscalls_sources_system",
2674 ":libseccomp_gen_syscall_nrs_arm",
2675 ":libseccomp_gen_syscall_nrs_arm64",
2676 ],
2677 out: [
2678 "arm_system_policy.cpp",
2679 "arm64_system_policy.cpp",
2680 ],
2681 enabled: false,
2682 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002683 arm: {
2684 enabled: true,
2685 },
2686 arm64: {
2687 enabled: true,
2688 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002689 },
2690}
2691
2692cc_genrule {
2693 name: "libseccomp_policy_system_sources_riscv64",
2694 recovery_available: true,
2695 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002696 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002697 srcs: [
2698 ":seccomp_syscalls_sources_system",
2699 ":libseccomp_gen_syscall_nrs_riscv64",
2700 ],
2701 out: [
2702 "riscv64_system_policy.cpp",
2703 ],
2704 enabled: false,
2705 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002706 riscv64: {
2707 enabled: true,
2708 },
Yu Liu3a579692022-10-18 03:02:32 +00002709 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002710}
2711
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002712cc_library {
2713 name: "libseccomp_policy",
2714 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002715 generated_headers: ["func_to_syscall_nrs"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002716
2717 arch: {
2718 arm: {
2719 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002720 "libseccomp_policy_app_sources_arm",
2721 "libseccomp_policy_app_zygote_sources_arm",
2722 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002723 ],
2724 },
2725 arm64: {
2726 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002727 "libseccomp_policy_app_sources_arm",
2728 "libseccomp_policy_app_zygote_sources_arm",
2729 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002730 ],
2731 },
2732 riscv64: {
2733 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002734 "libseccomp_policy_app_sources_riscv64",
2735 "libseccomp_policy_app_zygote_sources_riscv64",
2736 "libseccomp_policy_system_sources_riscv64",
Yu Liu938ec9b2022-10-17 16:36:30 -07002737 ],
2738 },
2739 x86: {
2740 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002741 "libseccomp_policy_app_sources_x86",
2742 "libseccomp_policy_app_zygote_sources_x86",
2743 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002744 ],
2745 },
2746 x86_64: {
2747 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002748 "libseccomp_policy_app_sources_x86",
2749 "libseccomp_policy_app_zygote_sources_x86",
2750 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002751 ],
2752 },
2753 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002754
2755 srcs: [
2756 "seccomp/seccomp_policy.cpp",
2757 ],
2758
2759 export_include_dirs: ["seccomp/include"],
2760 cflags: [
2761 "-Wall",
2762 "-Werror",
2763 ],
2764 shared: {
2765 shared_libs: ["libbase"],
2766 },
2767 static: {
2768 static_libs: ["libbase"],
2769 },
2770}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002771
Colin Cross048f24e2021-09-01 17:26:00 -07002772cc_library_host_static {
2773 name: "libfts",
2774 srcs: [
2775 "bionic/fts.c",
2776 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
2777 ],
2778 export_include_dirs: ["fts/include"],
2779 local_include_dirs: [
2780 "private",
2781 "upstream-openbsd/android/include",
2782 ],
2783 cflags: [
2784 "-include openbsd-compat.h",
2785 "-Wno-unused-parameter",
2786 ],
2787 enabled: false,
2788 target: {
2789 musl: {
2790 enabled: true,
2791 },
2792 },
Colin Cross2a9843f2022-01-13 12:26:30 -08002793 stl: "none",
2794}
2795
2796cc_library_host_static {
2797 name: "libexecinfo",
2798 visibility: ["//external/musl"],
2799 srcs: ["bionic/execinfo.cpp"],
2800 export_include_dirs: ["execinfo/include"],
2801 local_include_dirs: ["private"],
2802 enabled: false,
2803 target: {
2804 musl: {
2805 enabled: true,
2806 system_shared_libs: [],
2807 header_libs: ["libc_musl_headers"],
2808 },
2809 },
2810 stl: "none",
Colin Cross048f24e2021-09-01 17:26:00 -07002811}
2812
Colin Cross9da85fa2022-01-24 18:20:05 -08002813cc_library_host_static {
2814 name: "libb64",
2815 visibility: ["//external/musl"],
2816 srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
2817 export_include_dirs: ["b64/include"],
2818 local_include_dirs: [
2819 "private",
2820 "upstream-openbsd/android/include",
2821 ],
2822 cflags: [
2823 "-include openbsd-compat.h",
2824 ],
2825 enabled: false,
2826 target: {
2827 musl: {
2828 enabled: true,
2829 system_shared_libs: [],
2830 header_libs: ["libc_musl_headers"],
2831 },
2832 },
2833 stl: "none",
2834}
2835
Colin Cross9d4a56e2022-02-03 10:20:32 -08002836// Export kernel uapi headers to be used in the musl sysroot.
2837// Also include the execinfo headers for the libexecinfo and the
2838// b64 headers for libb64 embedded in musl libc.
2839cc_genrule {
2840 name: "libc_musl_sysroot_bionic_headers",
2841 visibility: ["//external/musl"],
2842 host_supported: true,
2843 device_supported: false,
2844 enabled: false,
2845 target: {
2846 musl: {
2847 enabled: true,
2848 },
2849 },
2850 srcs: [
2851 "kernel/uapi/**/*.h",
2852 "kernel/android/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002853 "execinfo/include/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002854 "b64/include/**/*.h",
Colin Crossaeef9f02022-02-07 21:01:26 -08002855
Colin Crossaeef9f02022-02-07 21:01:26 -08002856 "NOTICE",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002857
2858 ":libc_musl_sysroot_bionic_arch_headers",
2859 ],
2860 out: ["libc_musl_sysroot_bionic_headers.zip"],
2861 tools: [
2862 "soong_zip",
2863 "merge_zips",
2864 "zip2zip",
2865 ],
Colin Crossaeef9f02022-02-07 21:01:26 -08002866 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
2867 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
Colin Crossad33d022022-02-25 18:27:04 -08002868 // NOTICE
2869 " -j -f $(location NOTICE) " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002870 // headers
2871 " -P include " +
Colin Crossaeef9f02022-02-07 21:01:26 -08002872 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
2873 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
2874 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2875 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2876 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2877 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2878 " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
2879 " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
2880 " -C $${BIONIC_LIBC_DIR}/b64/include " +
2881 " -D $${BIONIC_LIBC_DIR}/b64/include " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002882 " && " +
Colin Crossad33d022022-02-25 18:27:04 -08002883 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
Colin Cross1c0a7a02022-08-11 12:22:26 -07002884 " -x **/BUILD " +
Colin Crossad33d022022-02-25 18:27:04 -08002885 " include/**/*:include/ " +
2886 " NOTICE:NOTICE.bionic " +
2887 " && " +
2888 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002889}
2890
2891// The architecture-specific bits have to be handled separately because the label varies based
2892// on architecture, which prevents using $(locations) to find them and requires using $(in)
2893// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
2894// genrule.
2895cc_genrule {
2896 name: "libc_musl_sysroot_bionic_arch_headers",
2897 visibility: ["//visibility:private"],
2898 host_supported: true,
2899 device_supported: false,
2900 enabled: false,
2901 target: {
2902 musl: {
2903 enabled: true,
2904 },
2905 },
2906 arch: {
2907 arm: {
2908 srcs: ["kernel/uapi/asm-arm/**/*.h"],
2909 },
2910 arm64: {
2911 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
2912 },
2913 x86: {
2914 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2915 },
2916 x86_64: {
2917 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2918 },
2919 },
2920 out: ["libc_musl_sysroot_bionic_arch_headers.zip"],
2921 tools: ["soong_zip"],
2922 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
2923}
Colin Cross290c4952022-10-13 12:51:13 -07002924
2925cc_genrule {
2926 name: "bionic_sysroot_crt_objects",
2927 visibility: ["//visibility:private"],
2928 out: ["bionic_sysroot_crt_objects.zip"],
2929 tools: ["soong_zip"],
2930 srcs: [
2931 ":crtbegin_dynamic",
2932 ":crtbegin_so",
2933 ":crtbegin_static",
2934 ":crtend_android",
2935 ":crtend_so",
2936 ],
2937 cmd: "$(location soong_zip) -o $(out) -j " +
2938 "-f $(location :crtbegin_dynamic) " +
2939 "-f $(location :crtbegin_so) " +
2940 "-f $(location :crtbegin_static) " +
2941 "-f $(location :crtend_android) " +
2942 "-f $(location :crtend_so)",
2943 dist: {
2944 targets: ["bionic_sysroot_crt_objects"],
2945 },
2946 arch: {
2947 arm: {
2948 dist: {
2949 suffix: "_arm",
2950 },
2951 },
2952 arm64: {
2953 dist: {
2954 suffix: "_arm64",
2955 },
2956 },
2957 riscv64: {
2958 dist: {
2959 suffix: "_riscv64",
2960 },
2961 },
2962 x86: {
2963 dist: {
2964 suffix: "_x86",
2965 },
2966 },
2967 x86_64: {
2968 dist: {
2969 suffix: "_x86_64",
2970 },
2971 },
2972 },
2973}
Spandan Das8fce52a2023-09-28 18:00:12 +00002974
2975// headers that will be placed on the include path when running versioner in bazel
2976// this module should be a no-op in soong
2977filegroup {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002978 name: "versioner-dependencies",
2979 srcs: ["versioner-dependencies/**/*"],
Spandan Das8fce52a2023-09-28 18:00:12 +00002980}
Jiyong Park35a280d2024-05-03 16:53:39 +09002981
2982filegroup {
2983 name: "linux_capability_header",
2984 srcs: ["kernel/uapi/linux/capability.h"],
2985}