blob: 8241d45cbf77837ce2baaa604d4e3fb19aa93912 [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
Yi Konge3d90de2019-02-20 14:28:56 -080090 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
91 // warning since this is intended right now.
92 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070093
Quallenaugeb6384862020-10-20 21:19:01 +020094 multilib: {
95 lib64: {
96 product_variables: {
97 malloc_zero_contents: {
98 cflags: ["-DSCUDO_ZERO_CONTENTS"],
99 },
100 malloc_pattern_fill_contents: {
101 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
102 },
103 malloc_low_memory: {
104 cflags: ["-UUSE_SCUDO"],
105 },
106 },
Evgenii Stepanov5a73e032020-04-29 14:59:44 -0700107 },
Quallenaugeb6384862020-10-20 21:19:01 +0200108 lib32: {
109 product_variables: {
110 malloc_zero_contents: {
111 cflags: ["-DSCUDO_ZERO_CONTENTS"],
112 },
113 malloc_pattern_fill_contents: {
114 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
115 },
116 malloc_low_memory_libc32: {
117 cflags: ["-UUSE_SCUDO"],
118 },
119 },
Steven Morelandfb65ee42020-07-31 00:18:38 +0000120 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700121 },
Yi Kong9e33b762021-10-29 02:43:22 +0800122
123 lto: {
124 never: true,
125 },
Elliott Hughesc2043342023-07-20 20:24:09 +0000126
127 apex_available: ["com.android.runtime"],
Elliott Hughes7d136662023-10-27 15:40:32 -0700128
129 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700130}
131
Elliott Hughes788075a2024-06-18 12:25:37 +0000132// Workaround for b/24465209.
133// We're unlikely to be able to remove this before we just
134// remove ILP32 support completely.
135// Note that we also still have `pack_relocations: false`
136// for both libc and libm, even on LP64.
137// ========================================================
138cc_defaults {
139 name: "bug_24465209_workaround",
Elliott Hughesfeb94732024-06-18 19:44:18 +0000140 target: {
141 android_arm: {
Elliott Hughes788075a2024-06-18 12:25:37 +0000142 pack_relocations: false,
143 ldflags: ["-Wl,--hash-style=both"],
144 },
Elliott Hughesfeb94732024-06-18 19:44:18 +0000145 android_x86: {
Elliott Hughes788075a2024-06-18 12:25:37 +0000146 pack_relocations: false,
147 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesb4e02782024-06-21 11:35:18 +0000148 },
Elliott Hughes788075a2024-06-18 12:25:37 +0000149 },
150}
151
Elliott Hughes89aada12024-07-01 21:59:04 +0000152// Leave the symbols in the shared library so that stack unwinders can produce
153// meaningful name resolution. This is a bit more ugly than it sounds because
154// arm32 is a bit broken.
155// ========================================================
156cc_defaults {
157 name: "keep_symbols",
158 arch: {
159 arm: {
160 // arm32 does not produce complete exidx unwind information,
161 // so keep the .debug_frame which is relatively small and does
162 // include needed unwind information.
163 // See b/132992102 for details.
164 strip: {
165 keep_symbols_and_debug_frame: true,
166 },
167 },
168 arm64: {
169 strip: {
170 keep_symbols: true,
171 },
172 },
173 riscv64: {
174 strip: {
175 keep_symbols: true,
176 },
177 },
178 x86: {
179 strip: {
180 keep_symbols: true,
181 },
182 },
183 x86_64: {
184 strip: {
185 keep_symbols: true,
186 },
187 },
188 },
189}
190
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700191// Defaults for native allocator libs/includes to make it
192// easier to change.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700193// ========================================================
194cc_defaults {
195 name: "libc_native_allocator_defaults",
196
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700197 whole_static_libs: [
Christopher Ferrisb5425052024-04-23 17:15:39 -0700198 "libscudo",
199 ],
200 cflags: [
201 "-DUSE_SCUDO",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700202 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800203 header_libs: ["gwp_asan_headers"],
Quallenaugeb6384862020-10-20 21:19:01 +0200204 multilib: {
205 lib64: {
206 product_variables: {
207 malloc_low_memory: {
208 cflags: ["-UUSE_SCUDO"],
209 whole_static_libs: [
210 "libjemalloc5",
211 "libc_jemalloc_wrapper",
212 ],
213 exclude_static_libs: [
214 "libscudo",
215 ],
216 },
217 },
Christopher Ferrisb5425052024-04-23 17:15:39 -0700218 },
Quallenaugeb6384862020-10-20 21:19:01 +0200219 lib32: {
220 product_variables: {
221 malloc_low_memory_libc32: {
222 cflags: ["-UUSE_SCUDO"],
223 whole_static_libs: [
224 "libjemalloc5",
225 "libc_jemalloc_wrapper",
226 ],
227 exclude_static_libs: [
228 "libscudo",
229 ],
230 },
231 },
232 }
Christopher Ferrisb5425052024-04-23 17:15:39 -0700233 },
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700234}
235
236// Functions not implemented by jemalloc directly, or that need to
237// be modified for Android.
238cc_library_static {
239 name: "libc_jemalloc_wrapper",
240 defaults: ["libc_defaults"],
241 srcs: ["bionic/jemalloc_wrapper.cpp"],
242 cflags: ["-fvisibility=hidden"],
243
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800244 // Used to pull in the jemalloc include directory so that if the
245 // library is removed, the include directory is also removed.
246 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700247}
248
Dan Willemsen208ae172015-09-16 16:33:27 -0700249// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700250// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700251// ========================================================
252//
Ryan Prichard249757b2019-11-01 17:18:28 -0700253// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
254// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
255// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
256// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700257
258cc_library_static {
259
Colin Crossa3f9fca2016-01-11 13:20:55 -0800260 srcs: [
261 "bionic/__libc_init_main_thread.cpp",
262 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700263 "bionic/bionic_call_ifunc_resolver.cpp",
264 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800265 ],
266 arch: {
267 arm64: {
268 srcs: ["arch-arm64/bionic/__set_tls.c"],
269 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000270 riscv64: {
271 srcs: ["arch-riscv64/bionic/__set_tls.c"],
272 },
Colin Crossa3f9fca2016-01-11 13:20:55 -0800273 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700274 srcs: [
275 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Pirama Arumuga Nainar7b89be72021-02-12 15:09:49 -0800276 "arch-x86/bionic/__libc_int0x80.S",
Ryan Prichard27475b52018-05-17 17:14:18 -0700277 "arch-x86/bionic/__set_tls.cpp",
278 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800279 },
280 x86_64: {
281 srcs: ["arch-x86_64/bionic/__set_tls.c"],
282 },
283 },
284
Colin Cross50c21ab2015-10-31 23:03:05 -0700285 defaults: ["libc_defaults"],
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000286 cflags: [
287 "-fno-stack-protector",
288 "-ffreestanding",
289 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700290 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700291}
292
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800293filegroup {
294 name: "elf_note_sources",
295 srcs: ["bionic/elf_note.cpp"],
296}
297
Ryan Prichard249757b2019-11-01 17:18:28 -0700298// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
299// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
300// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800301
302cc_library_static {
303 name: "libc_init_static",
304 defaults: ["libc_defaults"],
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800305 srcs: [
306 "bionic/libc_init_static.cpp",
307 ":elf_note_sources",
308 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700309 cflags: [
310 "-fno-stack-protector",
311
312 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
313 // from the linker before ifunc resolvers have made string.h functions available.
314 "-ffreestanding",
315 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800316}
317
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700318cc_library_static {
319 name: "libc_init_dynamic",
320 defaults: ["libc_defaults"],
321 srcs: ["bionic/libc_init_dynamic.cpp"],
322 cflags: ["-fno-stack-protector"],
323}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800324
Dan Willemsen208ae172015-09-16 16:33:27 -0700325// ========================================================
326// libc_tzcode.a - upstream 'tzcode' code
327// ========================================================
328
329cc_library_static {
330
Colin Cross50c21ab2015-10-31 23:03:05 -0700331 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700332 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800333 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700334 "tzcode/bionic.cpp",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700335 // tzcode doesn't include strptime, so we use a fork of the
336 // OpenBSD code which needs this global data.
Elliott Hughesd3627a42022-12-06 22:24:27 +0000337 "upstream-openbsd/lib/libc/locale/_def_time.c",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700338 // tzcode doesn't include wcsftime, so we use the FreeBSD code.
339 "upstream-freebsd/lib/libc/locale/wcsftime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700340 ],
341
Colin Cross50c21ab2015-10-31 23:03:05 -0700342 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700343 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700344 // Don't use ridiculous amounts of stack.
345 "-DALL_STATE",
346 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
347 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800348 // Obviously, we want to be thread-safe.
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000349 "-DTHREAD_SAFE=1",
Dan Willemsen208ae172015-09-16 16:33:27 -0700350 // The name of the tm_gmtoff field in our struct tm.
351 "-DTM_GMTOFF=tm_gmtoff",
Elliott Hughes31fc69f2023-06-20 15:36:11 -0700352 // Android uses a system property instead of /etc/localtime, so make callers crash.
Almaz Mingaleeva52a0da2022-02-28 16:55:50 +0000353 "-DTZDEFAULT=NULL",
Dan Willemsen208ae172015-09-16 16:33:27 -0700354 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700355 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700356 // Include `tzname`, `timezone`, and `daylight` globals.
357 "-DHAVE_POSIX_DECLS=0",
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000358 "-DUSG_COMPAT=2",
359 "-DHAVE_TZNAME=2",
360 // stdbool.h is available
361 "-DHAVE_STDBOOL_H",
Colin Crossa35d23d2015-11-19 13:32:49 -0800362 // Use the empty string (instead of " ") as the timezone abbreviation
363 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700364 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700365 "-Dlint",
366 ],
367
Elliott Hughes2bd43162023-06-15 13:17:08 -0700368 local_include_dirs: [
369 "tzcode/",
370 "upstream-freebsd/android/include",
371 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700372 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700373}
374
375// ========================================================
376// libc_dns.a - modified NetBSD DNS code
377// ========================================================
378
379cc_library_static {
380
Colin Cross50c21ab2015-10-31 23:03:05 -0700381 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700382 srcs: [
Elliott Hughesd0bbfa82021-04-08 11:58:51 -0700383 "dns/**/*.c*",
Dan Willemsen208ae172015-09-16 16:33:27 -0700384
385 "upstream-netbsd/lib/libc/isc/ev_streams.c",
386 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700387 ],
388
Colin Cross50c21ab2015-10-31 23:03:05 -0700389 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700390 "-DANDROID_CHANGES",
391 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700392 "-Wno-unused-parameter",
393 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700394 "-Wframe-larger-than=66000",
Elliott Hughese1dc4f62021-01-11 11:51:29 -0800395 "-include private/bsd_sys_param.h",
Dan Willemsen208ae172015-09-16 16:33:27 -0700396 ],
397
Dan Willemsen208ae172015-09-16 16:33:27 -0700398 local_include_dirs: [
399 "dns/include",
400 "private",
401 "upstream-netbsd/lib/libc/include",
402 "upstream-netbsd/android/include",
403 ],
404
405 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700406}
407
408// ========================================================
409// libc_freebsd.a - upstream FreeBSD C library code
410// ========================================================
411//
412// These files are built with the freebsd-compat.h header file
413// automatically included.
414
415cc_library_static {
Elliott Hughesc2043342023-07-20 20:24:09 +0000416 name: "libc_freebsd_ldexp",
417 defaults: ["libc_defaults"],
418 cflags: ["-Dscalbn=ldexp"],
419 srcs: [":libc_ldexp_srcs"],
420}
421
422cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700423 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700424 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700425 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700426 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
427 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
428 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
429 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700430 "upstream-freebsd/lib/libc/stdlib/qsort.c",
Elliott Hughes5bae5722024-07-30 12:47:33 -0400431 "upstream-freebsd/lib/libc/stdlib/qsort_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700432 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700433 "upstream-freebsd/lib/libc/string/wcpcpy.c",
434 "upstream-freebsd/lib/libc/string/wcpncpy.c",
435 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700436 "upstream-freebsd/lib/libc/string/wcscat.c",
437 "upstream-freebsd/lib/libc/string/wcschr.c",
438 "upstream-freebsd/lib/libc/string/wcscmp.c",
439 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700440 "upstream-freebsd/lib/libc/string/wcscspn.c",
441 "upstream-freebsd/lib/libc/string/wcsdup.c",
442 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700443 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700444 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
445 "upstream-freebsd/lib/libc/string/wcsncat.c",
446 "upstream-freebsd/lib/libc/string/wcsncmp.c",
447 "upstream-freebsd/lib/libc/string/wcsncpy.c",
448 "upstream-freebsd/lib/libc/string/wcsnlen.c",
449 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700450 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700451 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700452 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700453 "upstream-freebsd/lib/libc/string/wcstok.c",
454 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700455 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700456 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700457 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800458 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700459 ],
460 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700461 x86: {
462 exclude_srcs: [
463 "upstream-freebsd/lib/libc/string/wcschr.c",
464 "upstream-freebsd/lib/libc/string/wcscmp.c",
465 "upstream-freebsd/lib/libc/string/wcslen.c",
466 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700467 "upstream-freebsd/lib/libc/string/wmemcmp.c",
468 "upstream-freebsd/lib/libc/string/wcscat.c",
469 "upstream-freebsd/lib/libc/string/wcscpy.c",
470 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700471 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700472 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700473 },
474
Colin Cross50c21ab2015-10-31 23:03:05 -0700475 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700476 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700477 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700478 "-include freebsd-compat.h",
479 ],
480
Dan Willemsen208ae172015-09-16 16:33:27 -0700481 local_include_dirs: [
482 "upstream-freebsd/android/include",
483 ],
484
485 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700486}
487
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700488cc_library_static {
489 defaults: ["libc_defaults"],
490 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700491 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700492 ],
493
494 cflags: [
495 "-Wno-sign-compare",
496 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700497 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700498 ],
499
500 local_include_dirs: [
501 "upstream-freebsd/android/include",
502 ],
503
504 name: "libc_freebsd_large_stack",
505}
506
Dan Willemsen208ae172015-09-16 16:33:27 -0700507// ========================================================
508// libc_netbsd.a - upstream NetBSD C library code
509// ========================================================
510//
511// These files are built with the netbsd-compat.h header file
512// automatically included.
513
514cc_library_static {
515
Colin Cross50c21ab2015-10-31 23:03:05 -0700516 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700517 srcs: [
518 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700519 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700520 "upstream-netbsd/lib/libc/gen/psignal.c",
521 "upstream-netbsd/lib/libc/gen/utime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700522 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
523 "upstream-netbsd/lib/libc/regex/regcomp.c",
524 "upstream-netbsd/lib/libc/regex/regerror.c",
525 "upstream-netbsd/lib/libc/regex/regexec.c",
526 "upstream-netbsd/lib/libc/regex/regfree.c",
527 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700528 "upstream-netbsd/lib/libc/stdlib/drand48.c",
529 "upstream-netbsd/lib/libc/stdlib/erand48.c",
530 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
531 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700532 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
533 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
534 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
535 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
536 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
537 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
538 "upstream-netbsd/lib/libc/stdlib/seed48.c",
539 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700540 ],
541 multilib: {
542 lib32: {
543 // LP32 cruft
544 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
545 },
546 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700547 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700548 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800549 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700550 "-DPOSIX_MISTAKE",
551 "-include netbsd-compat.h",
552 ],
553
Dan Willemsen208ae172015-09-16 16:33:27 -0700554 local_include_dirs: [
555 "upstream-netbsd/android/include",
556 "upstream-netbsd/lib/libc/include",
557 ],
558
559 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700560}
561
562// ========================================================
Elliott Hughes968adf92024-02-08 13:15:53 -0800563// libc_openbsd.a - upstream OpenBSD C library code
Dan Willemsen208ae172015-09-16 16:33:27 -0700564// ========================================================
565//
566// These files are built with the openbsd-compat.h header file
567// automatically included.
Dan Willemsen208ae172015-09-16 16:33:27 -0700568cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700569 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700570 srcs: [
Elliott Hughes968adf92024-02-08 13:15:53 -0800571 "upstream-openbsd/lib/libc/crypt/arc4random.c",
572 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700573 "upstream-openbsd/lib/libc/gen/alarm.c",
574 "upstream-openbsd/lib/libc/gen/ctype_.c",
575 "upstream-openbsd/lib/libc/gen/daemon.c",
576 "upstream-openbsd/lib/libc/gen/err.c",
577 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700578 "upstream-openbsd/lib/libc/gen/fnmatch.c",
579 "upstream-openbsd/lib/libc/gen/ftok.c",
580 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700581 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700582 "upstream-openbsd/lib/libc/gen/verr.c",
583 "upstream-openbsd/lib/libc/gen/verrx.c",
584 "upstream-openbsd/lib/libc/gen/vwarn.c",
585 "upstream-openbsd/lib/libc/gen/vwarnx.c",
586 "upstream-openbsd/lib/libc/gen/warn.c",
587 "upstream-openbsd/lib/libc/gen/warnx.c",
588 "upstream-openbsd/lib/libc/locale/btowc.c",
589 "upstream-openbsd/lib/libc/locale/mbrlen.c",
590 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
591 "upstream-openbsd/lib/libc/locale/mbtowc.c",
592 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700593 "upstream-openbsd/lib/libc/locale/wcstombs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700594 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
595 "upstream-openbsd/lib/libc/locale/wctob.c",
596 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700597 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700598 "upstream-openbsd/lib/libc/net/htonl.c",
599 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700600 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
601 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
602 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700603 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
604 "upstream-openbsd/lib/libc/net/inet_ntop.c",
605 "upstream-openbsd/lib/libc/net/inet_pton.c",
606 "upstream-openbsd/lib/libc/net/ntohl.c",
607 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800608 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700609 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700610 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
611 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700612 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700613 "upstream-openbsd/lib/libc/stdio/fputwc.c",
614 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700615 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700616 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700617 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700618 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700619 "upstream-openbsd/lib/libc/stdio/makebuf.c",
620 "upstream-openbsd/lib/libc/stdio/mktemp.c",
621 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
622 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700623 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700624 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700625 "upstream-openbsd/lib/libc/stdio/ungetc.c",
626 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
627 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
628 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700629 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
630 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
631 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700632 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700633 "upstream-openbsd/lib/libc/stdio/wsetup.c",
634 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800635 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700636 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700637 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700638 "upstream-openbsd/lib/libc/stdlib/insque.c",
639 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
640 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
641 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800642 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700643 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800644 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700645 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughes26b06072020-07-31 11:00:10 -0700646 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700647 "upstream-openbsd/lib/libc/stdlib/remque.c",
648 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700649 "upstream-openbsd/lib/libc/stdlib/tfind.c",
650 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800651 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700652 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800653 "upstream-openbsd/lib/libc/string/strcasestr.c",
654 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700655 "upstream-openbsd/lib/libc/string/strcspn.c",
656 "upstream-openbsd/lib/libc/string/strdup.c",
657 "upstream-openbsd/lib/libc/string/strndup.c",
658 "upstream-openbsd/lib/libc/string/strpbrk.c",
659 "upstream-openbsd/lib/libc/string/strsep.c",
660 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700661 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800662 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700663 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700664 "upstream-openbsd/lib/libc/string/wcswidth.c",
Colin Cross69bcb8b2021-09-08 13:24:16 -0700665
Elliott Hughesd4c61182024-08-16 17:31:24 -0400666 // These files are originally from OpenBSD,
667 // and benefit from being compiled with openbsd-compat.h.
668 // TODO: clean them up instead.
Colin Cross69bcb8b2021-09-08 13:24:16 -0700669 "bionic/fts.c",
Elliott Hughesd4c61182024-08-16 17:31:24 -0400670 "stdio/vfprintf.cpp",
671 "stdio/vfwprintf.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700672 ],
673
Elliott Hughes7d136662023-10-27 15:40:32 -0700674 // Each architecture has optimized versions of some routines,
675 // and only includes the portable C versions of ones it's missing.
Dan Willemsen208ae172015-09-16 16:33:27 -0700676 arch: {
677 arm: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700678 srcs: [
679 "upstream-openbsd/lib/libc/string/memchr.c",
680 "upstream-openbsd/lib/libc/string/memrchr.c",
681 "upstream-openbsd/lib/libc/string/stpncpy.c",
682 "upstream-openbsd/lib/libc/string/strlcat.c",
683 "upstream-openbsd/lib/libc/string/strlcpy.c",
684 "upstream-openbsd/lib/libc/string/strncat.c",
685 "upstream-openbsd/lib/libc/string/strncmp.c",
686 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700687 ],
688 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700689 arm64: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700690 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700691 "upstream-openbsd/lib/libc/string/strcat.c",
Elliott Hughesaefe9992023-11-08 12:04:41 -0800692 "upstream-openbsd/lib/libc/string/stpncpy.c",
Elliott Hughes7d136662023-10-27 15:40:32 -0700693 "upstream-openbsd/lib/libc/string/strlcat.c",
694 "upstream-openbsd/lib/libc/string/strlcpy.c",
695 "upstream-openbsd/lib/libc/string/strncat.c",
696 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700697 ],
698 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000699 riscv64: {
700 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700701 "upstream-openbsd/lib/libc/string/memrchr.c",
702 "upstream-openbsd/lib/libc/string/stpncpy.c",
703 "upstream-openbsd/lib/libc/string/strlcat.c",
704 "upstream-openbsd/lib/libc/string/strlcpy.c",
Elliott Hughesebc19a92022-10-14 23:25:36 +0000705 ],
706 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700707 x86: {
Elliott Hughesaefe9992023-11-08 12:04:41 -0800708 srcs: [
709 // x86 has custom implementations of all of these.
710 ],
Elliott Hughes7d136662023-10-27 15:40:32 -0700711 },
712 x86_64: {
713 srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800714 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800715 "upstream-openbsd/lib/libc/string/memrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700716 "upstream-openbsd/lib/libc/string/strlcat.c",
717 "upstream-openbsd/lib/libc/string/strlcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800718 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700719 },
720 },
721
Colin Cross50c21ab2015-10-31 23:03:05 -0700722 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700723 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700724 "-Wno-unused-parameter",
725 "-include openbsd-compat.h",
726 ],
727
Dan Willemsen208ae172015-09-16 16:33:27 -0700728 local_include_dirs: [
729 "private",
Elliott Hughes968adf92024-02-08 13:15:53 -0800730 "stdio",
Elliott Hughesd4c61182024-08-16 17:31:24 -0400731 "upstream-openbsd/android/include/",
732 "upstream-openbsd/lib/libc/gdtoa/",
733 "upstream-openbsd/lib/libc/include/",
734 "upstream-openbsd/lib/libc/stdio/",
Dan Willemsen208ae172015-09-16 16:33:27 -0700735 ],
736
737 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700738}
739
Elliott Hughes968adf92024-02-08 13:15:53 -0800740cc_library_static {
741 name: "libc_openbsd_large_stack",
742 defaults: ["libc_defaults"],
743 srcs: [
Elliott Hughes968adf92024-02-08 13:15:53 -0800744 "upstream-openbsd/lib/libc/string/memmem.c",
745 "upstream-openbsd/lib/libc/string/strstr.c",
746 ],
747 cflags: [
748 "-include openbsd-compat.h",
749 "-Wno-sign-compare",
750 "-Wframe-larger-than=5000",
751 ],
752
753 local_include_dirs: [
Elliott Hughes968adf92024-02-08 13:15:53 -0800754 "upstream-openbsd/android/include/",
Elliott Hughes968adf92024-02-08 13:15:53 -0800755 ],
756}
757
Dan Willemsen208ae172015-09-16 16:33:27 -0700758// ========================================================
759// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
760// ========================================================
761//
762// These files are built with the openbsd-compat.h header file
763// automatically included.
764
765cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700766 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700767 srcs: [
768 "upstream-openbsd/android/gdtoa_support.cpp",
769 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
770 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
771 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
772 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
773 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
774 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
775 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
776 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
777 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
778 "upstream-openbsd/lib/libc/gdtoa/misc.c",
779 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
780 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
781 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
782 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
783 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
784 "upstream-openbsd/lib/libc/gdtoa/sum.c",
785 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
786 ],
787 multilib: {
788 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800789 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700790 },
791 },
792
Colin Cross50c21ab2015-10-31 23:03:05 -0700793 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700794 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700795 "-include openbsd-compat.h",
796 ],
797
Dan Willemsen208ae172015-09-16 16:33:27 -0700798 local_include_dirs: [
799 "private",
800 "upstream-openbsd/android/include",
801 "upstream-openbsd/lib/libc/include",
802 ],
803
804 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700805}
806
807// ========================================================
Pierre-Clément Tosi467e58e2023-02-01 13:44:43 +0000808// libc_fortify.a - container for our FORTIFY
George Burgess IV6cb06872017-07-21 13:28:42 -0700809// implementation details
810// ========================================================
811cc_library_static {
812 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700813 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700814
815 name: "libc_fortify",
816
817 // Disable FORTIFY for the compilation of these, so we don't end up having
818 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800819 cflags: [
820 "-U_FORTIFY_SOURCE",
821 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
822 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700823
824 arch: {
825 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800826 cflags: [
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800827 "-DRENAME___STRCAT_CHK",
828 "-DRENAME___STRCPY_CHK",
829 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700830 srcs: [
831 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800832
833 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
834 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
835
836 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
837 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
838
839 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
840 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
841
842 "arch-arm/krait/bionic/__strcat_chk.S",
843 "arch-arm/krait/bionic/__strcpy_chk.S",
844
845 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
846 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
847
Haibo Huang01bfd892018-12-03 15:05:16 -0800848 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
849 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700850 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700851 },
852 arm64: {
853 srcs: [
Elliott Hughes023e4e72022-11-17 19:27:02 +0000854 "arch-arm64/string/__memcpy_chk.S",
855 "arch-arm64/string/__memset_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700856 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700857 },
caowenchengab457f92023-03-06 14:57:55 +0800858 riscv64: {
859 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000860 "arch-riscv64/string/__memset_chk.S",
861 "arch-riscv64/string/__memcpy_chk.S",
caowenchengab457f92023-03-06 14:57:55 +0800862 ],
863 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700864 },
865}
866
867// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700868// libc_bionic.a - home-grown C library code
869// ========================================================
870
871cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700872 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700873 srcs: [
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800874 "bionic/NetdClientDispatch.cpp",
875 "bionic/__bionic_get_shell_path.cpp",
876 "bionic/__cmsg_nxthdr.cpp",
877 "bionic/__cxa_thread_atexit_impl.cpp",
878 "bionic/__errno.cpp",
879 "bionic/__gnu_basename.cpp",
880 "bionic/__libc_current_sigrtmax.cpp",
881 "bionic/__libc_current_sigrtmin.cpp",
882 "bionic/abort.cpp",
883 "bionic/accept.cpp",
884 "bionic/access.cpp",
Florian Mayerca4749a2024-02-14 12:55:46 -0800885 "bionic/android_crash_detail.cpp",
Josh Gao10ec9282017-04-03 15:13:29 -0700886 "bionic/android_set_abort_message.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000887 "bionic/android_unsafe_frame_pointer_chase.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800888 "bionic/arpa_inet.cpp",
889 "bionic/assert.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000890 "bionic/atexit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800891 "bionic/atof.cpp",
892 "bionic/bionic_allocator.cpp",
893 "bionic/bionic_arc4random.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000894 "bionic/bionic_elf_tls.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800895 "bionic/bionic_futex.cpp",
896 "bionic/bionic_netlink.cpp",
897 "bionic/bionic_systrace.cpp",
898 "bionic/bionic_time_conversions.cpp",
899 "bionic/brk.cpp",
900 "bionic/c16rtomb.cpp",
901 "bionic/c32rtomb.cpp",
902 "bionic/chmod.cpp",
903 "bionic/chown.cpp",
904 "bionic/clearenv.cpp",
905 "bionic/clock.cpp",
906 "bionic/clock_getcpuclockid.cpp",
907 "bionic/clock_nanosleep.cpp",
908 "bionic/clone.cpp",
909 "bionic/ctype.cpp",
910 "bionic/dirent.cpp",
911 "bionic/dup.cpp",
912 "bionic/environ.cpp",
913 "bionic/error.cpp",
914 "bionic/eventfd.cpp",
915 "bionic/exec.cpp",
916 "bionic/execinfo.cpp",
Elliott Hughes69bd8e92024-02-09 10:04:26 -0800917 "bionic/exit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800918 "bionic/faccessat.cpp",
919 "bionic/fchmod.cpp",
920 "bionic/fchmodat.cpp",
921 "bionic/fcntl.cpp",
922 "bionic/fdsan.cpp",
923 "bionic/fdtrack.cpp",
924 "bionic/ffs.cpp",
925 "bionic/fgetxattr.cpp",
926 "bionic/flistxattr.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000927 "bionic/fork.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800928 "bionic/fpclassify.cpp",
929 "bionic/fsetxattr.cpp",
930 "bionic/ftruncate.cpp",
931 "bionic/ftw.cpp",
932 "bionic/futimens.cpp",
933 "bionic/getcwd.cpp",
934 "bionic/getdomainname.cpp",
935 "bionic/getentropy.cpp",
936 "bionic/gethostname.cpp",
937 "bionic/getloadavg.cpp",
938 "bionic/getpagesize.cpp",
939 "bionic/getpgrp.cpp",
940 "bionic/getpid.cpp",
941 "bionic/getpriority.cpp",
942 "bionic/gettid.cpp",
943 "bionic/get_device_api_level.cpp",
944 "bionic/grp_pwd.cpp",
945 "bionic/grp_pwd_file.cpp",
946 "bionic/heap_zero_init.cpp",
947 "bionic/iconv.cpp",
948 "bionic/icu_wrappers.cpp",
949 "bionic/ifaddrs.cpp",
950 "bionic/inotify_init.cpp",
951 "bionic/ioctl.cpp",
Elliott Hughes17e40682024-02-13 16:32:29 -0800952 "bionic/isatty.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800953 "bionic/killpg.cpp",
954 "bionic/langinfo.cpp",
Elliott Hughes219e6022024-08-27 19:12:08 +0000955 "bionic/lchmod.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800956 "bionic/lchown.cpp",
957 "bionic/lfs64_support.cpp",
958 "bionic/libc_init_common.cpp",
959 "bionic/libgen.cpp",
960 "bionic/link.cpp",
961 "bionic/locale.cpp",
962 "bionic/lockf.cpp",
963 "bionic/lstat.cpp",
964 "bionic/mblen.cpp",
965 "bionic/mbrtoc16.cpp",
966 "bionic/mbrtoc32.cpp",
967 "bionic/mempcpy.cpp",
968 "bionic/memset_explicit.cpp",
969 "bionic/mkdir.cpp",
970 "bionic/mkfifo.cpp",
971 "bionic/mknod.cpp",
972 "bionic/mntent.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800973 "bionic/netdb.cpp",
Elliott Hughes3ed6e722024-02-16 01:18:01 +0000974 "bionic/net_if.cpp",
975 "bionic/netinet_ether.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800976 "bionic/netinet_in.cpp",
977 "bionic/nl_types.cpp",
978 "bionic/open.cpp",
979 "bionic/pathconf.cpp",
980 "bionic/pause.cpp",
981 "bionic/pidfd.cpp",
982 "bionic/pipe.cpp",
983 "bionic/poll.cpp",
984 "bionic/posix_fadvise.cpp",
985 "bionic/posix_fallocate.cpp",
986 "bionic/posix_madvise.cpp",
987 "bionic/posix_timers.cpp",
988 "bionic/preadv_pwritev.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000989 "bionic/pthread_atfork.cpp",
990 "bionic/pthread_attr.cpp",
991 "bionic/pthread_barrier.cpp",
992 "bionic/pthread_cond.cpp",
993 "bionic/pthread_create.cpp",
994 "bionic/pthread_detach.cpp",
995 "bionic/pthread_equal.cpp",
996 "bionic/pthread_exit.cpp",
997 "bionic/pthread_getcpuclockid.cpp",
998 "bionic/pthread_getschedparam.cpp",
999 "bionic/pthread_gettid_np.cpp",
1000 "bionic/pthread_internal.cpp",
1001 "bionic/pthread_join.cpp",
1002 "bionic/pthread_key.cpp",
1003 "bionic/pthread_kill.cpp",
1004 "bionic/pthread_mutex.cpp",
1005 "bionic/pthread_once.cpp",
1006 "bionic/pthread_rwlock.cpp",
1007 "bionic/pthread_sigqueue.cpp",
1008 "bionic/pthread_self.cpp",
1009 "bionic/pthread_setname_np.cpp",
1010 "bionic/pthread_setschedparam.cpp",
1011 "bionic/pthread_spinlock.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001012 "bionic/ptrace.cpp",
1013 "bionic/pty.cpp",
1014 "bionic/raise.cpp",
1015 "bionic/rand.cpp",
1016 "bionic/readlink.cpp",
1017 "bionic/realpath.cpp",
1018 "bionic/reboot.cpp",
1019 "bionic/recv.cpp",
1020 "bionic/recvmsg.cpp",
1021 "bionic/rename.cpp",
1022 "bionic/rmdir.cpp",
1023 "bionic/scandir.cpp",
Elliott Hughes17e40682024-02-13 16:32:29 -08001024 "bionic/sched_cpualloc.cpp",
1025 "bionic/sched_cpucount.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001026 "bionic/sched_getaffinity.cpp",
1027 "bionic/sched_getcpu.cpp",
1028 "bionic/semaphore.cpp",
1029 "bionic/send.cpp",
1030 "bionic/setegid.cpp",
1031 "bionic/seteuid.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001032 "bionic/setjmp_cookie.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001033 "bionic/setpgrp.cpp",
1034 "bionic/sigaction.cpp",
1035 "bionic/signal.cpp",
1036 "bionic/sigprocmask.cpp",
1037 "bionic/sleep.cpp",
1038 "bionic/socketpair.cpp",
1039 "bionic/spawn.cpp",
1040 "bionic/stat.cpp",
1041 "bionic/stdlib_l.cpp",
1042 "bionic/strerror.cpp",
1043 "bionic/string_l.cpp",
1044 "bionic/strings_l.cpp",
1045 "bionic/strsignal.cpp",
1046 "bionic/strtol.cpp",
1047 "bionic/strtold.cpp",
1048 "bionic/swab.cpp",
1049 "bionic/symlink.cpp",
1050 "bionic/sync_file_range.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001051 "bionic/sysconf.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001052 "bionic/sys_epoll.cpp",
1053 "bionic/sys_msg.cpp",
1054 "bionic/sys_sem.cpp",
1055 "bionic/sys_shm.cpp",
1056 "bionic/sys_signalfd.cpp",
1057 "bionic/sys_statfs.cpp",
1058 "bionic/sys_statvfs.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001059 "bionic/sys_thread_properties.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001060 "bionic/sys_time.cpp",
1061 "bionic/sysinfo.cpp",
1062 "bionic/syslog.cpp",
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001063 "bionic/sysprop_helpers.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001064 "bionic/system.cpp",
1065 "bionic/system_property_api.cpp",
1066 "bionic/system_property_set.cpp",
1067 "bionic/tdestroy.cpp",
1068 "bionic/termios.cpp",
1069 "bionic/thread_private.cpp",
1070 "bionic/threads.cpp",
1071 "bionic/time.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001072 "bionic/tmpfile.cpp",
1073 "bionic/umount.cpp",
1074 "bionic/unlink.cpp",
1075 "bionic/usleep.cpp",
1076 "bionic/utmp.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001077 "bionic/vdso.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001078 "bionic/wait.cpp",
1079 "bionic/wchar.cpp",
1080 "bionic/wchar_l.cpp",
1081 "bionic/wcstod.cpp",
1082 "bionic/wctype.cpp",
1083 "bionic/wcwidth.cpp",
1084 "bionic/wmempcpy.cpp",
1085
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001086 // Forked but not yet cleaned up/rewritten stdio code.
1087 // TODO: finish cleanup.
1088 "stdio/fmemopen.cpp",
1089 "stdio/parsefloat.c",
1090 "stdio/refill.c",
1091 "stdio/stdio.cpp",
1092 "stdio/stdio_ext.cpp",
1093 "stdio/vfscanf.cpp",
1094 "stdio/vfwscanf.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001095 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001096
1097 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001098 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -07001099 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001100 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -08001101 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001102 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001103 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001104 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001105 "arch-arm/bionic/atomics_arm.c",
1106 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -08001107 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001108 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001109 "arch-arm/bionic/setjmp.S",
1110 "arch-arm/bionic/syscall.S",
1111 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001112
Haibo Huangea9957a2018-11-19 11:00:32 -08001113 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001114 "arch-arm/cortex-a7/bionic/memset.S",
1115
1116 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001117 "arch-arm/cortex-a9/bionic/memset.S",
1118 "arch-arm/cortex-a9/bionic/stpcpy.S",
1119 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001120 "arch-arm/cortex-a9/bionic/strcpy.S",
1121 "arch-arm/cortex-a9/bionic/strlen.S",
1122
Elliott Hughesaefe9992023-11-08 12:04:41 -08001123 "arch-arm/cortex-a15/bionic/memcpy.S",
1124 "arch-arm/cortex-a15/bionic/memmove.S",
1125 "arch-arm/cortex-a15/bionic/memset.S",
1126 "arch-arm/cortex-a15/bionic/stpcpy.S",
1127 "arch-arm/cortex-a15/bionic/strcat.S",
1128 "arch-arm/cortex-a15/bionic/strcmp.S",
1129 "arch-arm/cortex-a15/bionic/strcpy.S",
1130 "arch-arm/cortex-a15/bionic/strlen.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001131
1132 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001133
Haibo Huang01bfd892018-12-03 15:05:16 -08001134 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001135
Elliott Hughesaefe9992023-11-08 12:04:41 -08001136 "arch-arm/generic/bionic/memcmp.S",
1137 "arch-arm/generic/bionic/memmove.S",
1138 "arch-arm/generic/bionic/memset.S",
1139 "arch-arm/generic/bionic/stpcpy.c",
1140 "arch-arm/generic/bionic/strcat.c",
1141 "arch-arm/generic/bionic/strcmp.S",
1142 "arch-arm/generic/bionic/strcpy.S",
1143 "arch-arm/generic/bionic/strlen.c",
1144
1145 "arch-arm/krait/bionic/memcpy.S",
1146 "arch-arm/krait/bionic/memset.S",
1147
Haibo Huangea9957a2018-11-19 11:00:32 -08001148 "arch-arm/kryo/bionic/memcpy.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001149
1150 "bionic/strchr.cpp",
1151 "bionic/strchrnul.cpp",
1152 "bionic/strnlen.cpp",
1153 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001154 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001155 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001156 arm64: {
1157 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001158 "arch-arm64/bionic/__bionic_clone.S",
1159 "arch-arm64/bionic/_exit_with_stack_teardown.S",
1160 "arch-arm64/bionic/setjmp.S",
1161 "arch-arm64/bionic/syscall.S",
1162 "arch-arm64/bionic/vfork.S",
Vaisakh K V83e55842024-03-29 12:47:39 +05301163 "arch-arm64/oryon/memcpy-nt.S",
Vaisakh K V54a61212024-03-29 13:32:45 +05301164 "arch-arm64/oryon/memset-nt.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001165 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001166 },
1167
Elliott Hughesebc19a92022-10-14 23:25:36 +00001168 riscv64: {
1169 srcs: [
1170 "arch-riscv64/bionic/__bionic_clone.S",
1171 "arch-riscv64/bionic/_exit_with_stack_teardown.S",
Elliott Hughese1905ed2022-10-17 23:23:36 +00001172 "arch-riscv64/bionic/setjmp.S",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001173 "arch-riscv64/bionic/syscall.S",
1174 "arch-riscv64/bionic/vfork.S",
Yun Hsiang40a82d02023-05-26 10:10:40 +08001175
Elliott Hughesaefe9992023-11-08 12:04:41 -08001176 "arch-riscv64/string/memchr_v.S",
1177 "arch-riscv64/string/memcmp_v.S",
1178 "arch-riscv64/string/memcpy_v.S",
1179 "arch-riscv64/string/memmove_v.S",
1180 "arch-riscv64/string/memset_v.S",
1181 "arch-riscv64/string/stpcpy_v.S",
1182 "arch-riscv64/string/strcat_v.S",
1183 "arch-riscv64/string/strchr_v.S",
1184 "arch-riscv64/string/strcmp_v.S",
1185 "arch-riscv64/string/strcpy_v.S",
1186 "arch-riscv64/string/strlen_v.S",
1187 "arch-riscv64/string/strncat_v.S",
1188 "arch-riscv64/string/strncmp_v.S",
1189 "arch-riscv64/string/strncpy_v.S",
1190 "arch-riscv64/string/strnlen_v.S",
1191
1192 "arch-riscv64/string/memchr.c",
1193 "arch-riscv64/string/memcmp.c",
1194 "arch-riscv64/string/memcpy.c",
1195 "arch-riscv64/string/memmove.c",
1196 "arch-riscv64/string/memset.c",
1197 "arch-riscv64/string/stpcpy.c",
1198 "arch-riscv64/string/strcat.c",
1199 "arch-riscv64/string/strchr.c",
1200 "arch-riscv64/string/strcmp.c",
1201 "arch-riscv64/string/strcpy.c",
1202 "arch-riscv64/string/strlen.c",
1203 "arch-riscv64/string/strncat.c",
1204 "arch-riscv64/string/strncmp.c",
1205 "arch-riscv64/string/strncpy.c",
1206 "arch-riscv64/string/strnlen.c",
Prashanth Swaminathana4d71022023-10-30 17:35:19 -07001207
Elliott Hughes7d136662023-10-27 15:40:32 -07001208 "bionic/strchrnul.cpp",
1209 "bionic/strrchr.cpp",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001210 ],
1211 },
1212
Dan Willemsen208ae172015-09-16 16:33:27 -07001213 x86: {
1214 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001215 "arch-x86/bionic/__bionic_clone.S",
1216 "arch-x86/bionic/_exit_with_stack_teardown.S",
1217 "arch-x86/bionic/libcrt_compat.c",
Elliott Hughes7d136662023-10-27 15:40:32 -07001218 "arch-x86/bionic/setjmp.S",
1219 "arch-x86/bionic/syscall.S",
1220 "arch-x86/bionic/vfork.S",
1221 "arch-x86/bionic/__x86.get_pc_thunk.S",
1222
Elliott Hughesed777142022-07-25 16:25:11 +00001223 "arch-x86/string/sse2-memchr-atom.S",
1224 "arch-x86/string/sse2-memmove-slm.S",
1225 "arch-x86/string/sse2-memrchr-atom.S",
Elliott Hughesed777142022-07-25 16:25:11 +00001226 "arch-x86/string/sse2-memset-slm.S",
1227 "arch-x86/string/sse2-stpcpy-slm.S",
1228 "arch-x86/string/sse2-stpncpy-slm.S",
1229 "arch-x86/string/sse2-strchr-atom.S",
1230 "arch-x86/string/sse2-strcpy-slm.S",
1231 "arch-x86/string/sse2-strlen-slm.S",
1232 "arch-x86/string/sse2-strncpy-slm.S",
1233 "arch-x86/string/sse2-strnlen-atom.S",
1234 "arch-x86/string/sse2-strrchr-atom.S",
1235 "arch-x86/string/sse2-wcschr-atom.S",
1236 "arch-x86/string/sse2-wcsrchr-atom.S",
1237 "arch-x86/string/sse2-wcslen-atom.S",
1238 "arch-x86/string/sse2-wcscmp-atom.S",
Elliott Hughesed777142022-07-25 16:25:11 +00001239
1240 "arch-x86/string/ssse3-memcmp-atom.S",
Elliott Hughesed777142022-07-25 16:25:11 +00001241 "arch-x86/string/ssse3-strcat-atom.S",
1242 "arch-x86/string/ssse3-strcmp-atom.S",
Elliott Hughesed777142022-07-25 16:25:11 +00001243 "arch-x86/string/ssse3-strlcat-atom.S",
1244 "arch-x86/string/ssse3-strlcpy-atom.S",
1245 "arch-x86/string/ssse3-strncat-atom.S",
1246 "arch-x86/string/ssse3-strncmp-atom.S",
Elliott Hughesed777142022-07-25 16:25:11 +00001247 "arch-x86/string/ssse3-wcscat-atom.S",
1248 "arch-x86/string/ssse3-wcscpy-atom.S",
1249 "arch-x86/string/ssse3-wmemcmp-atom.S",
1250
1251 "arch-x86/string/sse4-memcmp-slm.S",
1252 "arch-x86/string/sse4-wmemcmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001253
1254 "bionic/strchrnul.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001255 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001256 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001257 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001258 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001259 "arch-x86_64/bionic/__bionic_clone.S",
1260 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1261 "arch-x86_64/bionic/__restore_rt.S",
1262 "arch-x86_64/bionic/setjmp.S",
1263 "arch-x86_64/bionic/syscall.S",
1264 "arch-x86_64/bionic/vfork.S",
1265
ahs919fb7f2022-06-10 07:11:14 +05301266 "arch-x86_64/string/avx2-memset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001267 "arch-x86_64/string/sse2-memmove-slm.S",
1268 "arch-x86_64/string/sse2-memset-slm.S",
1269 "arch-x86_64/string/sse2-stpcpy-slm.S",
1270 "arch-x86_64/string/sse2-stpncpy-slm.S",
1271 "arch-x86_64/string/sse2-strcat-slm.S",
1272 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001273 "arch-x86_64/string/sse2-strlen-slm.S",
1274 "arch-x86_64/string/sse2-strncat-slm.S",
1275 "arch-x86_64/string/sse2-strncpy-slm.S",
1276 "arch-x86_64/string/sse4-memcmp-slm.S",
1277 "arch-x86_64/string/ssse3-strcmp-slm.S",
1278 "arch-x86_64/string/ssse3-strncmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001279
1280 "bionic/strchr.cpp",
1281 "bionic/strchrnul.cpp",
1282 "bionic/strnlen.cpp",
1283 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001284 ],
1285 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001286 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001287
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001288 multilib: {
1289 lib32: {
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001290 srcs: [
1291 // off64_t/time64_t support on LP32.
1292 "bionic/legacy_32_bit_support.cpp",
1293 "bionic/time64.c",
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001294 ],
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001295 },
1296 },
1297
1298 local_include_dirs: ["stdio"],
1299 generated_headers: ["generated_android_ids"],
1300
1301 whole_static_libs: [
1302 "libsystemproperties",
1303 ],
1304
Colin Cross50c21ab2015-10-31 23:03:05 -07001305 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001306 include_dirs: ["bionic/libstdc++/include"],
1307 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001308}
1309
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001310genrule {
1311 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001312 out: ["generated_android_ids.h"],
1313 srcs: [":android_filesystem_config_header"],
Cole Faustb1a0a9d2023-11-28 17:51:16 -08001314 tools: ["fs_config_generator"],
1315 cmd: "$(location fs_config_generator) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001316}
1317
Dan Willemsen268a6732015-10-15 14:49:45 -07001318// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001319// libc_syscalls.a
1320// ========================================================
1321
Elliott Hughes782c4852019-04-16 12:31:00 -07001322genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001323 name: "syscalls-arm",
Elliott Hughes782c4852019-04-16 12:31:00 -07001324 out: ["syscalls-arm.S"],
1325 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001326 tools: ["gensyscalls"],
1327 cmd: "$(location gensyscalls) arm $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001328}
1329
1330genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001331 name: "syscalls-arm64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001332 out: ["syscalls-arm64.S"],
1333 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001334 tools: ["gensyscalls"],
1335 cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001336}
1337
1338genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001339 name: "syscalls-riscv64",
Elliott Hughes704772b2022-10-10 17:06:43 +00001340 out: ["syscalls-riscv64.S"],
1341 srcs: ["SYSCALLS.TXT"],
1342 tools: ["gensyscalls"],
1343 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
1344}
1345
1346genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001347 name: "syscalls-x86",
Elliott Hughes782c4852019-04-16 12:31:00 -07001348 out: ["syscalls-x86.S"],
1349 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001350 tools: ["gensyscalls"],
1351 cmd: "$(location gensyscalls) x86 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001352}
1353
1354genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001355 name: "syscalls-x86_64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001356 out: ["syscalls-x86_64.S"],
1357 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001358 tools: ["gensyscalls"],
1359 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001360}
1361
Dan Willemsen208ae172015-09-16 16:33:27 -07001362cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001363 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001364 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001365 arch: {
1366 arm: {
Cole Faustf5968d82023-04-11 15:20:19 -07001367 srcs: [":syscalls-arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001368 },
1369 arm64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001370 srcs: [":syscalls-arm64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001371 },
Elliott Hughes704772b2022-10-10 17:06:43 +00001372 riscv64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001373 srcs: [":syscalls-riscv64"],
Elliott Hughes704772b2022-10-10 17:06:43 +00001374 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001375 x86: {
Cole Faustf5968d82023-04-11 15:20:19 -07001376 srcs: [":syscalls-x86"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001377 },
1378 x86_64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001379 srcs: [":syscalls-x86_64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001380 },
1381 },
1382 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001383}
1384
1385// ========================================================
1386// libc_aeabi.a
1387// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1388// to avoid infinite recursion. For the other architectures we just build an
1389// empty library to keep this makefile simple.
1390// ========================================================
1391
1392cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001393 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001394 arch: {
1395 arm: {
1396 srcs: ["arch-arm/bionic/__aeabi.c"],
1397 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001398 },
1399 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001400 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001401}
1402
1403// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001404// libc_common.a --- everything shared by libc.a and libc.so
Dan Willemsen208ae172015-09-16 16:33:27 -07001405// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001406
Dan Willemsen208ae172015-09-16 16:33:27 -07001407cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001408 defaults: ["libc_defaults"],
Elliott Hughesb0948922024-01-26 00:28:12 +00001409 name: "libc_common",
1410
Dan Willemsen208ae172015-09-16 16:33:27 -07001411 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001412 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001413 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001414 "libc_bionic",
Ryan Prichard249757b2019-11-01 17:18:28 -07001415 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001416 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001417 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001418 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001419 "libc_freebsd_large_stack",
Elliott Hughesc2043342023-07-20 20:24:09 +00001420 "libc_freebsd_ldexp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001421 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001422 "libc_netbsd",
1423 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001424 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001425 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001426 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001427 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001428 ],
1429
1430 arch: {
1431 arm: {
1432 whole_static_libs: ["libc_aeabi"],
1433 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001434 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001435}
1436
1437// ========================================================
Elliott Hughesadc41712024-08-16 13:08:11 +00001438// libc_static_dispatch.a/libc_dynamic_dispatch.a --- string/memory "ifuncs"
1439// (Actually ifuncs for libc.so, but a home-grown alternative for libc.a.)
Haibo Huangf71edfa2018-11-12 10:06:56 -08001440// ========================================================
Elliott Hughesadc41712024-08-16 13:08:11 +00001441
1442cc_defaults {
1443 name: "libc_dispatch_defaults",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001444 defaults: ["libc_defaults"],
Haibo Huangb9244ff2018-08-11 10:12:13 -07001445 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301446 x86_64: {
1447 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
1448 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001449 x86: {
1450 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1451 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001452 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001453 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001454 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001455 arm64: {
1456 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1457 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001458 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001459 srcs: ["arch-riscv64/dynamic_function_dispatch.cpp"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001460 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001461 },
Elliott Hughesadc41712024-08-16 13:08:11 +00001462 // Prevent the compiler from inserting calls to libc/taking the address of
1463 // a jump table from within an ifunc (or, in the static case, code that
1464 // can be executed arbitrarily early).
1465 cflags: [
1466 "-ffreestanding",
1467 "-fno-stack-protector",
1468 "-fno-jump-tables",
1469 ],
1470}
1471
1472cc_library_static {
1473 name: "libc_static_dispatch",
1474 defaults: ["libc_dispatch_defaults"],
1475 cflags: [
1476 "-DBIONIC_STATIC_DISPATCH",
1477 ],
1478}
1479
1480cc_library_static {
1481 name: "libc_dynamic_dispatch",
1482 defaults: ["libc_dispatch_defaults"],
1483 cflags: [
1484 "-DBIONIC_DYNAMIC_DISPATCH",
1485 ],
Ryan Prichard249757b2019-11-01 17:18:28 -07001486}
1487
1488// ========================================================
1489// libc_common_static.a For static binaries.
1490// ========================================================
1491cc_library_static {
1492 defaults: ["libc_defaults"],
1493 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001494
Haibo Huangf71edfa2018-11-12 10:06:56 -08001495 whole_static_libs: [
1496 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001497 "libc_static_dispatch",
1498 ],
1499}
1500
1501// ========================================================
1502// libc_common_shared.a For shared libraries.
1503// ========================================================
1504cc_library_static {
1505 defaults: ["libc_defaults"],
1506 name: "libc_common_shared",
1507
1508 whole_static_libs: [
1509 "libc_common",
1510 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001511 ],
1512}
1513
Ryan Prichard22a6a052019-10-10 23:59:30 -07001514// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1515// executable.
1516cc_library_static {
1517 name: "libc_unwind_static",
1518 defaults: ["libc_defaults"],
1519 cflags: ["-DLIBC_STATIC"],
1520
1521 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1522 arch: {
1523 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1524 arm: {
1525 srcs: ["arch-arm/bionic/exidx_static.c"],
1526 },
1527 },
1528}
1529
Haibo Huangf71edfa2018-11-12 10:06:56 -08001530// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001531// libc_nomalloc.a
1532// ========================================================
1533//
Ryan Prichard249757b2019-11-01 17:18:28 -07001534// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1535// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1536// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001537
1538cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001539 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001540 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001541
Colin Crossa3f9fca2016-01-11 13:20:55 -08001542 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001543 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001544 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001545 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001546 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001547}
1548
dimitryc0c0ef62018-12-05 16:33:52 +01001549filegroup {
1550 name: "libc_sources_shared",
1551 srcs: [
1552 "arch-common/bionic/crtbegin_so.c",
1553 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001554 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001555 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001556 "bionic/icu.cpp",
1557 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001558 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001559 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001560 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001561 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001562 "bionic/ndk_cruft.cpp",
1563 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001564 "bionic/NetdClient.cpp",
1565 "arch-common/bionic/crtend_so.S",
1566 ],
1567}
1568
1569filegroup {
1570 name: "libc_sources_static",
1571 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001572 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001573 "bionic/heap_tagging.cpp",
Elliott Hughes72b0f3b2024-07-02 20:22:35 +00001574 "bionic/icu_static.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001575 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001576 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001577 ],
1578}
1579
1580filegroup {
1581 name: "libc_sources_shared_arm",
1582 srcs: [
1583 "arch-arm/bionic/exidx_dynamic.c",
1584 "arch-arm/bionic/atexit_legacy.c",
1585 ],
1586}
1587
Dan Willemsen208ae172015-09-16 16:33:27 -07001588// ========================================================
1589// libc.a + libc.so
1590// ========================================================
Florian Mayerc10d0642023-03-22 16:12:49 -07001591cc_defaults {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001592 defaults: [
1593 "libc_defaults",
1594 "libc_native_allocator_defaults",
Elliott Hughes788075a2024-06-18 12:25:37 +00001595 "bug_24465209_workaround",
Elliott Hughes89aada12024-07-01 21:59:04 +00001596 "keep_symbols",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001597 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001598 name: "libc_library_defaults",
Colin Cross50c21ab2015-10-31 23:03:05 -07001599 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001600 platform_sdk_version: {
1601 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1602 },
1603 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001604 static: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001605 srcs: [":libc_sources_static"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001606 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001607 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001608 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001609 "libc_init_static",
1610 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001611 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001612 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001613 },
1614 shared: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001615 srcs: [":libc_sources_shared"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001616 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001617 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001618 "libc_init_dynamic",
1619 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001620 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001621 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001622 },
1623
Neil Fullera7db90f2019-04-25 09:28:27 +01001624 required: [
MarkDacekd88d7ea2022-06-28 20:14:58 +00001625 "tzdata_prebuilt",
1626 "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
Neil Fullera7db90f2019-04-25 09:28:27 +01001627 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001628
Colin Cross4ce94d22016-11-15 13:15:43 -08001629 // Do not pack libc.so relocations; see http://b/20645321 for details.
1630 pack_relocations: false,
1631
dimitry06016f22018-01-05 11:39:28 +01001632 shared_libs: [
1633 "ld-android",
1634 "libdl",
1635 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001636 static_libs: [
1637 "libdl_android",
1638 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001639
1640 nocrt: true,
1641
Dan Willemsen208ae172015-09-16 16:33:27 -07001642 arch: {
1643 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001644 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001645 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001646
Dan Willemsen208ae172015-09-16 16:33:27 -07001647 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001648 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001649 // special for arm
1650 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Elliott Hughes89aada12024-07-01 21:59:04 +00001651 // For backwards compatibility, some arm32 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001652 static_libs: ["libclang_rt.builtins-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001653 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001654
Elliott Hughes89aada12024-07-01 21:59:04 +00001655 ldflags: [
1656 // Since we preserve the debug_frame for libc, do not compress
1657 // in this case to make unwinds as fast as possible.
1658 "-Wl,--compress-debug-sections=none",
1659 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001660 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001661 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001662 version_script: ":libc.arm64.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001663 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001664 riscv64: {
1665 version_script: ":libc.riscv64.map",
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001666 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001667 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001668 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001669 no_libcrt: true,
1670
1671 shared: {
Elliott Hughes89aada12024-07-01 21:59:04 +00001672 // For backwards compatibility, some x86 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001673 static_libs: ["libclang_rt.builtins-exported"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001674 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001675 },
1676 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001677 version_script: ":libc.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001678 },
1679 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001680
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001681 apex_available: [
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001682 "com.android.runtime",
1683 ],
1684
Colin Cross7edd0082021-10-28 13:20:35 -07001685 target: {
1686 native_bridge: {
1687 shared: {
1688 installable: false,
1689 },
1690 },
1691 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001692}
1693
Florian Mayerc10d0642023-03-22 16:12:49 -07001694cc_library {
1695 name: "libc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001696 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001697 "libc_library_defaults",
1698 ],
1699 stubs: {
1700 symbol_file: "libc.map.txt",
1701 versions: [
1702 "29",
1703 "R",
1704 "current",
1705 ],
1706 },
1707 static_ndk_lib: true,
1708 llndk: {
1709 symbol_file: "libc.map.txt",
1710 export_headers_as_system: true,
Dan Alberte9f02e02024-08-28 23:20:20 +00001711 export_llndk_headers: ["libc_headers"],
Florian Mayerc10d0642023-03-22 16:12:49 -07001712 },
1713}
1714
1715cc_library {
1716 name: "libc_hwasan",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001717 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001718 "libc_library_defaults",
1719 ],
1720 sanitize: {
1721 hwaddress: true,
1722 },
1723 enabled: false,
Florian Mayerff116ed2023-04-14 17:38:53 -07001724 target: {
1725 android_arm64: {
Florian Mayerc10d0642023-03-22 16:12:49 -07001726 enabled: true,
1727 },
1728 },
1729 stem: "libc",
1730 relative_install_path: "hwasan",
1731 // We don't really need the stubs, but this needs to stay to trigger the
1732 // symlink logic in soong.
1733 stubs: {
1734 symbol_file: "libc.map.txt",
1735 },
1736 native_bridge_supported: false,
1737 // It is never correct to depend on this directly. This is only
1738 // needed for the runtime apex, and in base_system.mk.
1739 visibility: ["//bionic/apex"],
1740}
1741
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001742genrule {
1743 name: "libc.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001744 out: ["libc.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001745 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001746 tools: ["generate-version-script"],
1747 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001748}
1749
1750genrule {
1751 name: "libc.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001752 out: ["libc.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001753 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001754 tools: ["generate-version-script"],
1755 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001756}
1757
1758genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001759 name: "libc.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001760 out: ["libc.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001761 srcs: ["libc.map.txt"],
1762 tools: ["generate-version-script"],
1763 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1764}
1765
1766genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001767 name: "libc.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001768 out: ["libc.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001769 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001770 tools: ["generate-version-script"],
1771 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001772}
1773
1774genrule {
1775 name: "libc.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001776 out: ["libc.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001777 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001778 tools: ["generate-version-script"],
1779 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001780}
1781
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001782// Headers that only other parts of the platform can include.
1783cc_library_headers {
1784 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001785 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001786 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001787 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001788 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001789 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001790 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001791 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001792 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001793 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001794 "//system/core/debuggerd:__subpackages__",
Florian Mayerf5d70ce2022-09-13 13:58:30 -07001795 "//system/core/init:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001796 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001797 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001798 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001799 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001800 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001801 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001802 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001803 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001804 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001805 recovery_available: true,
1806 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001807 export_include_dirs: [
1808 "platform",
1809 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001810 system_shared_libs: [],
1811 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001812 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001813
Steven Moreland0cdf1322020-10-05 21:55:26 +00001814 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001815 apex_available: [
1816 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001817 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001818 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001819}
1820
Logan Chien17af91b2019-01-15 21:19:56 +08001821cc_library_headers {
Dan Albert64a6efc2024-08-29 19:04:59 +00001822 name: "libc_uapi_headers",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001823 visibility: [
1824 "//external/musl",
1825 ],
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001826 llndk: {
1827 llndk_headers: true,
1828 },
Logan Chien17af91b2019-01-15 21:19:56 +08001829 host_supported: true,
1830 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001831 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001832 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001833 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001834 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001835 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001836 apex_available: [
1837 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001838 "//apex_available:anyapex",
1839 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001840 // used by most APEXes indirectly via libunwind_llvm
1841 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001842
1843 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001844 stl: "none",
1845 system_shared_libs: [],
1846
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001847 // The build system generally requires that any dependencies of a target
1848 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1849 // to 1 we let targets with an sdk_version that need to depend on the libc
1850 // headers but cannot depend on libc itself due to circular dependencies
1851 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1852 // is correct because the headers can support any sdk_version.
1853 sdk_version: "1",
1854
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001855 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001856 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001857 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001858 "kernel/android/uapi",
1859 ],
1860
1861 arch: {
1862 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001863 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001864 },
1865 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001866 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001867 },
Elliott Hughes48e53332022-10-07 20:39:25 +00001868 riscv64: {
1869 export_system_include_dirs: ["kernel/uapi/asm-riscv"],
1870 },
Logan Chien17af91b2019-01-15 21:19:56 +08001871 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001872 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001873 },
1874 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001875 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001876 },
1877 },
1878}
1879
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001880cc_library_headers {
1881 name: "libc_headers",
1882 host_supported: true,
1883 native_bridge_supported: true,
1884 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001885 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001886 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001887 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001888 recovery_available: true,
1889 sdk_version: "1",
1890
1891 apex_available: [
1892 "//apex_available:platform",
1893 "//apex_available:anyapex",
1894 ],
1895 // used by most APEXes indirectly via libunwind_llvm
1896 min_sdk_version: "apex_inherit",
1897 visibility: [
1898 "//bionic:__subpackages__", // visible to bionic
1899 // ... and only to these places (b/152668052)
1900 "//external/arm-optimized-routines",
1901 "//external/gwp_asan",
1902 "//external/jemalloc_new",
1903 "//external/libunwind_llvm",
Nick Desaulniers942ae552024-02-12 10:26:19 -08001904 "//external/llvm-libc",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001905 "//external/scudo",
1906 "//system/core/property_service/libpropertyinfoparser",
1907 "//system/extras/toolchain-extras",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001908 ],
1909
1910 stl: "none",
1911 no_libcrt: true,
1912 system_shared_libs: [],
1913
1914 target: {
1915 android: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001916 export_system_include_dirs: ["include"],
Dan Albert64a6efc2024-08-29 19:04:59 +00001917 header_libs: ["libc_uapi_headers"],
1918 export_header_lib_headers: ["libc_uapi_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001919 },
1920 linux_bionic: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001921 export_system_include_dirs: ["include"],
Dan Albert64a6efc2024-08-29 19:04:59 +00001922 header_libs: ["libc_uapi_headers"],
1923 export_header_lib_headers: ["libc_uapi_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001924 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001925 },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001926}
1927
Dan Willemsen208ae172015-09-16 16:33:27 -07001928// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001929// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001930// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001931
me-cafebabe77ebb7e2023-10-05 19:38:27 +00001932cc_defaults {
Elliott Hughes788075a2024-06-18 12:25:37 +00001933 defaults: [
1934 "libc_defaults",
1935 "bug_24465209_workaround",
1936 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001937 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001938 srcs: [
1939 "bionic/__cxa_guard.cpp",
1940 "bionic/__cxa_pure_virtual.cpp",
1941 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001942 ],
me-cafebabe77ebb7e2023-10-05 19:38:27 +00001943 name: "libstdc++_defaults",
Dan Albert40f15ec2017-10-27 11:21:20 -07001944 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001945 static_libs: ["libasync_safe"],
Elliott Hughesc2043342023-07-20 20:24:09 +00001946 apex_available: [
1947 "//apex_available:platform",
1948 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001949
Dan Willemsen6b3be172018-12-03 13:57:20 -08001950 static: {
1951 system_shared_libs: [],
1952 },
Colin Crossb5bfe0b2021-07-13 16:26:28 -07001953 target: {
1954 bionic: {
1955 shared: {
1956 system_shared_libs: ["libc"],
1957 },
1958 },
Dan Willemsen6b3be172018-12-03 13:57:20 -08001959 },
1960
Dan Willemsen208ae172015-09-16 16:33:27 -07001961 arch: {
1962 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001963 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001964 },
1965 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001966 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001967 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001968 riscv64: {
1969 version_script: ":libstdc++.riscv64.map",
1970 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001971 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001972 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001973 },
1974 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001975 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001976 },
1977 },
1978}
1979
me-cafebabe77ebb7e2023-10-05 19:38:27 +00001980cc_library {
1981 name: "libstdc++",
1982 defaults: ["libstdc++_defaults"],
1983}
1984
1985cc_library_shared {
1986 name: "libstdc++_vendor",
1987 defaults: ["libstdc++_defaults"],
1988 vendor: true,
1989}
1990
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001991genrule {
1992 name: "libstdc++.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001993 out: ["libstdc++.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001994 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001995 tools: ["generate-version-script"],
1996 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001997}
1998
1999genrule {
2000 name: "libstdc++.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002001 out: ["libstdc++.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002002 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002003 tools: ["generate-version-script"],
2004 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002005}
2006
2007genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00002008 name: "libstdc++.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002009 out: ["libstdc++.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00002010 srcs: ["libstdc++.map.txt"],
2011 tools: ["generate-version-script"],
2012 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
2013}
2014
2015genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002016 name: "libstdc++.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002017 out: ["libstdc++.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002018 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002019 tools: ["generate-version-script"],
2020 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002021}
2022
2023genrule {
2024 name: "libstdc++.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002025 out: ["libstdc++.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002026 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002027 tools: ["generate-version-script"],
2028 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002029}
2030
2031// ========================================================
2032// crt object files.
2033// ========================================================
2034
Colin Cross50c21ab2015-10-31 23:03:05 -07002035cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002036 name: "crt_and_memtag_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002037 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002038 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002039 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002040 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002041 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002042 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002043 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002044 apex_available: [
2045 "//apex_available:platform",
2046 "//apex_available:anyapex",
2047 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002048 // Generate NDK variants of the CRT objects for every supported API level.
2049 min_sdk_version: "16",
2050 stl: "none",
2051 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002052 cflags: [
2053 "-Wno-gcc-compat",
2054 "-Wall",
2055 "-Werror",
2056 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002057 sanitize: {
2058 never: true,
2059 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002060}
2061
Colin Cross50c21ab2015-10-31 23:03:05 -07002062cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002063 name: "crt_defaults",
2064 defaults: ["crt_and_memtag_defaults"],
Colin Cross02f81372021-07-22 12:02:10 -07002065 system_shared_libs: [],
Colin Cross10d92682021-06-22 13:25:46 -07002066}
2067
2068cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002069 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002070 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002071
2072 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002073 x86: {
2074 cflags: ["-fPIC"],
2075 },
2076 x86_64: {
2077 cflags: ["-fPIC"],
2078 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002079 },
Colin Crossab179442018-09-27 11:03:22 -07002080 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002081}
2082
Dan Willemsen208ae172015-09-16 16:33:27 -07002083cc_object {
2084 name: "crtbrand",
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002085 local_include_dirs: [
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002086 "private", // crtbrand.S depends on private/bionic_asm_note.h
2087 ],
Elliott Hughes6a30b712024-03-13 23:41:32 +00002088 // crtbrand.S needs to know the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002089 product_variables: {
2090 platform_sdk_version: {
2091 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2092 },
2093 },
2094 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002095
Colin Cross7d7b3682017-11-03 13:38:40 -07002096 defaults: ["crt_so_defaults"],
Dan Alberteee46dc2023-04-04 23:27:52 +00002097 // crtbrand is an intermediate artifact, not a final CRT object.
2098 exclude_from_ndk_sysroot: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07002099}
2100
Dan Willemsen208ae172015-09-16 16:33:27 -07002101cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002102 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002103 local_include_dirs: ["include"],
2104 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002105
Colin Cross7d7b3682017-11-03 13:38:40 -07002106 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002107 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002108 "crtbrand",
2109 ],
2110}
2111
Dan Willemsen208ae172015-09-16 16:33:27 -07002112cc_object {
2113 name: "crtend_so",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002114 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002115 "private", // crtend_so.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002116 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002117 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002118
Colin Cross7d7b3682017-11-03 13:38:40 -07002119 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002120}
2121
Dan Willemsen208ae172015-09-16 16:33:27 -07002122cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002123 name: "crtbegin_static",
2124
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002125 local_include_dirs: [
2126 "include",
2127 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2128 ],
Liz Kammere718dd72021-03-09 15:00:06 -05002129
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002130 cflags: ["-DCRTBEGIN_STATIC"],
Yabin Cui744cfd32023-08-24 13:20:23 -07002131
Dan Willemsen208ae172015-09-16 16:33:27 -07002132 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002133 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002134 "crtbrand",
2135 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002136 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002137 // When using libc.a, we're using the latest library regardless of target API level.
2138 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002139}
2140
Dan Willemsen208ae172015-09-16 16:33:27 -07002141cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002142 name: "crtbegin_dynamic",
2143
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002144 local_include_dirs: [
2145 "include",
2146 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2147 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002148 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002149 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002150 "crtbrand",
2151 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002152 target: {
2153 linux_bionic: {
2154 generated_sources: ["host_bionic_linker_asm"],
2155 objs: [
2156 "linker_wrapper",
2157 ],
2158 },
2159 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002160 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002161}
2162
Dan Willemsen208ae172015-09-16 16:33:27 -07002163cc_object {
2164 // We rename crtend.o to crtend_android.o to avoid a
2165 // name clash between gcc and bionic.
2166 name: "crtend_android",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002167 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002168 "private", // crtend.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002169 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002170 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002171
Colin Cross50c21ab2015-10-31 23:03:05 -07002172 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002173}
Colin Crossbaa48992016-07-13 11:15:21 -07002174
Kalesh Singh862a23d2024-01-09 13:13:50 -08002175cc_object {
2176 name: "crt_pad_segment",
2177 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002178 "private", // crt_pad_segment.S depends on private/bionic_asm_note.h
Kalesh Singh862a23d2024-01-09 13:13:50 -08002179 ],
2180 srcs: ["arch-common/bionic/crt_pad_segment.S"],
2181
2182 defaults: ["crt_defaults"],
2183}
2184
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002185cc_library_static {
2186 name: "note_memtag_heap_async",
2187 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002188 arm64: {
2189 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2190 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002191 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002192 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002193
Colin Cross10d92682021-06-22 13:25:46 -07002194 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002195}
2196
2197cc_library_static {
2198 name: "note_memtag_heap_sync",
2199 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002200 arm64: {
2201 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2202 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002203 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002204 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002205
Colin Cross10d92682021-06-22 13:25:46 -07002206 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002207}
2208
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002209// ========================================================
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002210// libc dependencies for baremetal Rust projects.
2211// ========================================================
2212
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002213// This library contains the following unresolved symbols:
2214// __errno
2215// abort
2216// async_safe_fatal_va_list
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002217cc_library_static {
2218 name: "librust_baremetal",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002219 header_libs: ["libc_headers"],
2220 include_dirs: [
2221 "bionic/libc/async_safe/include",
2222 "bionic/libc/platform",
2223 ],
2224 cflags: [
2225 "-Wall",
2226 "-Werror",
2227 ],
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002228 srcs: [
2229 "bionic/fortify.cpp",
Pierre-Clément Tosi816176c2022-11-30 14:33:41 +00002230 "bionic/strtol.cpp",
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002231 ],
2232 arch: {
2233 arm64: {
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002234 srcs: [
2235 "arch-arm64/string/__memcpy_chk.S",
2236 ],
2237 },
caowencheng9a39eb32023-03-20 16:24:41 +08002238 riscv64: {
2239 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002240 "arch-riscv64/string/__memcpy_chk.S",
caowencheng9a39eb32023-03-20 16:24:41 +08002241 ],
2242 },
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002243 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002244 whole_static_libs: [
2245 "libarm-optimized-routines-mem",
Pierre-Clément Tosieb46ac92023-02-01 13:44:57 +00002246 "libc_netbsd",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002247 ],
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002248 system_shared_libs: [],
2249 nocrt: true,
2250 stl: "none",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002251 visibility: [
Jiyong Park072ce532024-07-22 11:20:47 +09002252 "//packages/modules/Virtualization/libs/libvmbase",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002253 ],
Zijun427504a2024-08-15 23:16:27 +00002254
2255 // b/358211032: This library gets linked into a rust rlib. Disable LTO
2256 // until cross-language lto is supported.
2257 lto: {
2258 never: true,
2259 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002260}
2261
2262// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002263// NDK headers.
2264// ========================================================
2265
Dan Albertcce54372024-08-22 18:24:30 +00002266ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002267 name: "common_libc",
2268 from: "include",
2269 to: "",
Dan Albertcce54372024-08-22 18:24:30 +00002270 srcs: ["include/**/*.h"],
Dan Albert22805ea2017-03-22 15:28:05 -07002271 license: "NOTICE",
Dan Albertcce54372024-08-22 18:24:30 +00002272 // These don't pass the bad verification we do because many of them are
2273 // arch-specific, and they aren't necessarily independently includable.
2274 // That's not much of a problem though, since C-incompaitibilities in the
2275 // UAPI headers should run into problems long before they reach us.
2276 skip_verification: true,
Dan Albert22805ea2017-03-22 15:28:05 -07002277}
Dan Albert4238a352016-06-28 11:18:05 -07002278
2279ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002280 name: "libc_uapi",
2281 from: "kernel/uapi",
2282 to: "",
2283 srcs: [
2284 "kernel/uapi/asm-generic/**/*.h",
2285 "kernel/uapi/drm/**/*.h",
2286 "kernel/uapi/linux/**/*.h",
2287 "kernel/uapi/misc/**/*.h",
2288 "kernel/uapi/mtd/**/*.h",
2289 "kernel/uapi/rdma/**/*.h",
2290 "kernel/uapi/scsi/**/*.h",
2291 "kernel/uapi/sound/**/*.h",
2292 "kernel/uapi/video/**/*.h",
2293 "kernel/uapi/xen/**/*.h",
2294 ],
Dan Albert92592652016-10-20 01:42:54 -07002295 license: "NOTICE",
Dan Albert6aa62772024-08-13 22:01:23 +00002296 skip_verification: true,
Dan Albert4238a352016-06-28 11:18:05 -07002297}
2298
2299ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002300 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002301 from: "kernel/android/uapi/linux",
2302 to: "linux",
2303 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002304 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002305}
2306
2307ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002308 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002309 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002310 to: "scsi",
2311 srcs: ["kernel/android/scsi/**/*.h"],
2312 license: "NOTICE",
Dan Albert6aa62772024-08-13 22:01:23 +00002313 skip_verification: true,
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002314}
2315
2316ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002317 name: "libc_asm_arm",
2318 from: "kernel/uapi/asm-arm",
2319 to: "arm-linux-androideabi",
2320 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002321 license: "NOTICE",
Dan Albert6aa62772024-08-13 22:01:23 +00002322 skip_verification: true,
Dan Albert4238a352016-06-28 11:18:05 -07002323}
2324
2325ndk_headers {
2326 name: "libc_asm_arm64",
2327 from: "kernel/uapi/asm-arm64",
2328 to: "aarch64-linux-android",
2329 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002330 license: "NOTICE",
Dan Albert6aa62772024-08-13 22:01:23 +00002331 skip_verification: true,
Dan Albert4238a352016-06-28 11:18:05 -07002332}
2333
Lazar Trsic790d2f72017-11-27 11:54:11 +01002334ndk_headers {
Colin Crossbd26e0f2022-10-19 15:03:14 -07002335 name: "libc_asm_riscv64",
2336 from: "kernel/uapi/asm-riscv",
2337 to: "riscv64-linux-android",
2338 srcs: ["kernel/uapi/asm-riscv/**/*.h"],
2339 license: "NOTICE",
Dan Albert6aa62772024-08-13 22:01:23 +00002340 skip_verification: true,
Colin Crossbd26e0f2022-10-19 15:03:14 -07002341}
2342
2343ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002344 name: "libc_asm_x86",
2345 from: "kernel/uapi/asm-x86",
2346 to: "i686-linux-android",
2347 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002348 license: "NOTICE",
Dan Albert6aa62772024-08-13 22:01:23 +00002349 skip_verification: true,
Dan Albert4238a352016-06-28 11:18:05 -07002350}
2351
2352ndk_headers {
2353 name: "libc_asm_x86_64",
2354 from: "kernel/uapi/asm-x86",
2355 to: "x86_64-linux-android",
2356 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002357 license: "NOTICE",
Dan Albert6aa62772024-08-13 22:01:23 +00002358 skip_verification: true,
Dan Albert4238a352016-06-28 11:18:05 -07002359}
2360
Dan Albert4238a352016-06-28 11:18:05 -07002361ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002362 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002363 symbol_file: "libc.map.txt",
2364 first_version: "9",
2365}
2366
Dan Albertdf31aff2016-10-06 15:50:41 -07002367ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002368 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002369 symbol_file: "libstdc++.map.txt",
2370 first_version: "9",
2371}
2372
Dan Willemsenca056d72018-01-08 14:00:24 -08002373// Export these headers for toolbox to process
2374filegroup {
2375 name: "kernel_input_headers",
2376 srcs: [
2377 "kernel/uapi/linux/input.h",
2378 "kernel/uapi/linux/input-event-codes.h",
2379 ],
2380}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002381
2382// Generate a syscall name / number mapping. These objects are text files
2383// (thanks to the -dD -E flags) and not binary files. They will then be
2384// consumed by the genseccomp.py script and converted into C++ code.
2385cc_defaults {
2386 name: "libseccomp_gen_syscall_nrs_defaults",
2387 recovery_available: true,
2388 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2389 cflags: [
2390 "-dD",
2391 "-E",
2392 "-Wall",
2393 "-Werror",
2394 "-nostdinc",
2395 ],
2396}
2397
2398cc_object {
2399 name: "libseccomp_gen_syscall_nrs_arm",
2400 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2401 local_include_dirs: [
2402 "kernel/uapi/asm-arm",
2403 "kernel/uapi",
2404 ],
2405}
2406
2407cc_object {
2408 name: "libseccomp_gen_syscall_nrs_arm64",
2409 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2410 local_include_dirs: [
2411 "kernel/uapi/asm-arm64",
2412 "kernel/uapi",
2413 ],
2414}
2415
2416cc_object {
Elliott Hughes704772b2022-10-10 17:06:43 +00002417 name: "libseccomp_gen_syscall_nrs_riscv64",
2418 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2419 local_include_dirs: [
2420 "kernel/uapi/asm-riscv",
2421 "kernel/uapi",
2422 ],
2423}
2424
2425cc_object {
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002426 name: "libseccomp_gen_syscall_nrs_x86",
2427 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2428 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2429 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2430 local_include_dirs: [
2431 "kernel/uapi/asm-x86",
2432 "kernel/uapi",
2433 ],
2434}
2435
2436cc_object {
2437 name: "libseccomp_gen_syscall_nrs_x86_64",
2438 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2439 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2440 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2441 local_include_dirs: [
2442 "kernel/uapi/asm-x86",
2443 "kernel/uapi",
2444 ],
2445}
2446
Jingwen Chenca366332021-01-29 05:16:32 -05002447filegroup {
2448 name: "all_kernel_uapi_headers",
2449 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002450}
2451
Martijn Coenen0c6de752019-01-02 12:52:51 +01002452cc_genrule {
2453 name: "func_to_syscall_nrs",
2454 recovery_available: true,
2455 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2456
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002457 tools: ["genfunctosyscallnrs"],
Martijn Coenen0c6de752019-01-02 12:52:51 +01002458
2459 srcs: [
2460 "SYSCALLS.TXT",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002461 ],
2462
Elliott Hughes704772b2022-10-10 17:06:43 +00002463 arch: {
2464 arm: {
2465 srcs: [
2466 ":libseccomp_gen_syscall_nrs_arm",
2467 ":libseccomp_gen_syscall_nrs_arm64",
2468 ],
2469 },
2470 arm64: {
2471 srcs: [
2472 ":libseccomp_gen_syscall_nrs_arm",
2473 ":libseccomp_gen_syscall_nrs_arm64",
2474 ],
2475 },
2476 riscv64: {
2477 srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
2478 },
2479 x86: {
2480 srcs: [
2481 ":libseccomp_gen_syscall_nrs_x86",
2482 ":libseccomp_gen_syscall_nrs_x86_64",
2483 ],
2484 },
2485 x86_64: {
2486 srcs: [
2487 ":libseccomp_gen_syscall_nrs_x86",
2488 ":libseccomp_gen_syscall_nrs_x86_64",
2489 ],
2490 },
2491 },
2492
Martijn Coenen0c6de752019-01-02 12:52:51 +01002493 out: [
2494 "func_to_syscall_nrs.h",
2495 ],
2496}
2497
Victor Hsiehdbb86702020-06-15 09:29:07 -07002498// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002499genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002500 name: "generate_app_zygote_blocklist",
2501 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2502 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002503 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2504}
2505
Yu Liu938ec9b2022-10-17 16:36:30 -07002506filegroup {
2507 name: "seccomp_syscalls_sources_zygote",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002508 srcs: [
2509 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002510 "SECCOMP_ALLOWLIST_COMMON.TXT",
2511 "SECCOMP_ALLOWLIST_APP.TXT",
2512 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002513 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002514 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002515 ],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002516}
2517
Yu Liu938ec9b2022-10-17 16:36:30 -07002518filegroup {
2519 name: "seccomp_syscalls_sources_app",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002520 srcs: [
2521 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002522 "SECCOMP_ALLOWLIST_COMMON.TXT",
2523 "SECCOMP_ALLOWLIST_APP.TXT",
2524 "SECCOMP_BLOCKLIST_COMMON.TXT",
2525 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002526 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002527 ],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002528}
2529
Yu Liu938ec9b2022-10-17 16:36:30 -07002530filegroup {
2531 name: "seccomp_syscalls_sources_system",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002532 srcs: [
2533 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002534 "SECCOMP_ALLOWLIST_COMMON.TXT",
2535 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2536 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002537 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002538 ],
Yu Liu938ec9b2022-10-17 16:36:30 -07002539}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002540
Yu Liu938ec9b2022-10-17 16:36:30 -07002541cc_genrule {
2542 name: "libseccomp_policy_app_zygote_sources_x86",
2543 recovery_available: true,
2544 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002545 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002546 srcs: [
2547 ":seccomp_syscalls_sources_zygote",
2548 ":libseccomp_gen_syscall_nrs_x86",
2549 ":libseccomp_gen_syscall_nrs_x86_64",
2550 ],
2551 out: [
2552 "x86_app_zygote_policy.cpp",
2553 "x86_64_app_zygote_policy.cpp",
2554 ],
2555 enabled: false,
Yu Liu3a579692022-10-18 03:02:32 +00002556 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002557 x86: {
2558 enabled: true,
2559 },
2560 x86_64: {
2561 enabled: true,
2562 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002563 },
2564}
2565
2566cc_genrule {
2567 name: "libseccomp_policy_app_zygote_sources_arm",
2568 recovery_available: true,
2569 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002570 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002571 srcs: [
2572 ":seccomp_syscalls_sources_zygote",
2573 ":libseccomp_gen_syscall_nrs_arm",
2574 ":libseccomp_gen_syscall_nrs_arm64",
2575 ],
2576 out: [
2577 "arm_app_zygote_policy.cpp",
2578 "arm64_app_zygote_policy.cpp",
2579 ],
2580 enabled: false,
2581 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002582 arm: {
2583 enabled: true,
2584 },
2585 arm64: {
2586 enabled: true,
2587 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002588 },
2589}
2590
2591cc_genrule {
2592 name: "libseccomp_policy_app_zygote_sources_riscv64",
2593 recovery_available: true,
2594 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002595 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002596 srcs: [
2597 ":seccomp_syscalls_sources_zygote",
2598 ":libseccomp_gen_syscall_nrs_riscv64",
2599 ],
2600 out: [
2601 "riscv64_app_zygote_policy.cpp",
2602 ],
2603 enabled: false,
2604 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002605 riscv64: {
2606 enabled: true,
2607 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002608 },
2609}
2610
2611cc_genrule {
2612 name: "libseccomp_policy_app_sources_x86",
2613 recovery_available: true,
2614 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002615 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002616 srcs: [
2617 ":seccomp_syscalls_sources_app",
2618 ":libseccomp_gen_syscall_nrs_x86",
2619 ":libseccomp_gen_syscall_nrs_x86_64",
2620 ],
2621 out: [
2622 "x86_app_policy.cpp",
2623 "x86_64_app_policy.cpp",
2624 ],
2625 enabled: false,
2626 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002627 x86: {
2628 enabled: true,
2629 },
2630 x86_64: {
2631 enabled: true,
2632 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002633 },
2634}
2635
2636cc_genrule {
2637 name: "libseccomp_policy_app_sources_arm",
2638 recovery_available: true,
2639 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002640 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002641 srcs: [
2642 ":seccomp_syscalls_sources_app",
2643 ":libseccomp_gen_syscall_nrs_arm",
2644 ":libseccomp_gen_syscall_nrs_arm64",
2645 ],
2646 out: [
2647 "arm_app_policy.cpp",
2648 "arm64_app_policy.cpp",
2649 ],
2650 enabled: false,
2651 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002652 arm: {
2653 enabled: true,
2654 },
2655 arm64: {
2656 enabled: true,
2657 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002658 },
2659}
2660
2661cc_genrule {
2662 name: "libseccomp_policy_app_sources_riscv64",
2663 recovery_available: true,
2664 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002665 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002666 srcs: [
2667 ":seccomp_syscalls_sources_app",
2668 ":libseccomp_gen_syscall_nrs_riscv64",
2669 ],
2670 out: [
2671 "riscv64_app_policy.cpp",
2672 ],
2673 enabled: false,
2674 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002675 riscv64: {
2676 enabled: true,
2677 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002678 },
2679}
2680
2681cc_genrule {
2682 name: "libseccomp_policy_system_sources_x86",
2683 recovery_available: true,
2684 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002685 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002686 srcs: [
2687 ":seccomp_syscalls_sources_system",
2688 ":libseccomp_gen_syscall_nrs_x86",
2689 ":libseccomp_gen_syscall_nrs_x86_64",
2690 ],
2691 out: [
2692 "x86_system_policy.cpp",
2693 "x86_64_system_policy.cpp",
2694 ],
2695 enabled: false,
2696 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002697 x86: {
2698 enabled: true,
2699 },
2700 x86_64: {
2701 enabled: true,
2702 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002703 },
2704}
2705
2706cc_genrule {
2707 name: "libseccomp_policy_system_sources_arm",
2708 recovery_available: true,
2709 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002710 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002711 srcs: [
2712 ":seccomp_syscalls_sources_system",
2713 ":libseccomp_gen_syscall_nrs_arm",
2714 ":libseccomp_gen_syscall_nrs_arm64",
2715 ],
2716 out: [
2717 "arm_system_policy.cpp",
2718 "arm64_system_policy.cpp",
2719 ],
2720 enabled: false,
2721 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002722 arm: {
2723 enabled: true,
2724 },
2725 arm64: {
2726 enabled: true,
2727 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002728 },
2729}
2730
2731cc_genrule {
2732 name: "libseccomp_policy_system_sources_riscv64",
2733 recovery_available: true,
2734 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002735 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002736 srcs: [
2737 ":seccomp_syscalls_sources_system",
2738 ":libseccomp_gen_syscall_nrs_riscv64",
2739 ],
2740 out: [
2741 "riscv64_system_policy.cpp",
2742 ],
2743 enabled: false,
2744 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002745 riscv64: {
2746 enabled: true,
2747 },
Yu Liu3a579692022-10-18 03:02:32 +00002748 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002749}
2750
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002751cc_library {
2752 name: "libseccomp_policy",
2753 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002754 generated_headers: ["func_to_syscall_nrs"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002755
2756 arch: {
2757 arm: {
2758 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002759 "libseccomp_policy_app_sources_arm",
2760 "libseccomp_policy_app_zygote_sources_arm",
2761 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002762 ],
2763 },
2764 arm64: {
2765 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002766 "libseccomp_policy_app_sources_arm",
2767 "libseccomp_policy_app_zygote_sources_arm",
2768 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002769 ],
2770 },
2771 riscv64: {
2772 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002773 "libseccomp_policy_app_sources_riscv64",
2774 "libseccomp_policy_app_zygote_sources_riscv64",
2775 "libseccomp_policy_system_sources_riscv64",
Yu Liu938ec9b2022-10-17 16:36:30 -07002776 ],
2777 },
2778 x86: {
2779 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002780 "libseccomp_policy_app_sources_x86",
2781 "libseccomp_policy_app_zygote_sources_x86",
2782 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002783 ],
2784 },
2785 x86_64: {
2786 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002787 "libseccomp_policy_app_sources_x86",
2788 "libseccomp_policy_app_zygote_sources_x86",
2789 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002790 ],
2791 },
2792 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002793
2794 srcs: [
2795 "seccomp/seccomp_policy.cpp",
2796 ],
2797
2798 export_include_dirs: ["seccomp/include"],
2799 cflags: [
2800 "-Wall",
2801 "-Werror",
2802 ],
2803 shared: {
2804 shared_libs: ["libbase"],
2805 },
2806 static: {
2807 static_libs: ["libbase"],
2808 },
2809}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002810
Colin Cross048f24e2021-09-01 17:26:00 -07002811cc_library_host_static {
2812 name: "libfts",
2813 srcs: [
2814 "bionic/fts.c",
2815 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
2816 ],
2817 export_include_dirs: ["fts/include"],
2818 local_include_dirs: [
2819 "private",
2820 "upstream-openbsd/android/include",
2821 ],
2822 cflags: [
2823 "-include openbsd-compat.h",
2824 "-Wno-unused-parameter",
2825 ],
2826 enabled: false,
2827 target: {
2828 musl: {
2829 enabled: true,
2830 },
2831 },
Colin Cross2a9843f2022-01-13 12:26:30 -08002832 stl: "none",
2833}
2834
2835cc_library_host_static {
2836 name: "libexecinfo",
2837 visibility: ["//external/musl"],
2838 srcs: ["bionic/execinfo.cpp"],
2839 export_include_dirs: ["execinfo/include"],
2840 local_include_dirs: ["private"],
2841 enabled: false,
2842 target: {
2843 musl: {
2844 enabled: true,
2845 system_shared_libs: [],
2846 header_libs: ["libc_musl_headers"],
2847 },
2848 },
2849 stl: "none",
Colin Cross048f24e2021-09-01 17:26:00 -07002850}
2851
Colin Cross9da85fa2022-01-24 18:20:05 -08002852cc_library_host_static {
2853 name: "libb64",
2854 visibility: ["//external/musl"],
2855 srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
2856 export_include_dirs: ["b64/include"],
2857 local_include_dirs: [
2858 "private",
2859 "upstream-openbsd/android/include",
2860 ],
2861 cflags: [
2862 "-include openbsd-compat.h",
2863 ],
2864 enabled: false,
2865 target: {
2866 musl: {
2867 enabled: true,
2868 system_shared_libs: [],
2869 header_libs: ["libc_musl_headers"],
2870 },
2871 },
2872 stl: "none",
2873}
2874
Colin Cross9d4a56e2022-02-03 10:20:32 -08002875// Export kernel uapi headers to be used in the musl sysroot.
2876// Also include the execinfo headers for the libexecinfo and the
2877// b64 headers for libb64 embedded in musl libc.
2878cc_genrule {
2879 name: "libc_musl_sysroot_bionic_headers",
2880 visibility: ["//external/musl"],
2881 host_supported: true,
2882 device_supported: false,
2883 enabled: false,
2884 target: {
2885 musl: {
2886 enabled: true,
2887 },
2888 },
2889 srcs: [
2890 "kernel/uapi/**/*.h",
2891 "kernel/android/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002892 "execinfo/include/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002893 "b64/include/**/*.h",
Colin Crossaeef9f02022-02-07 21:01:26 -08002894
Colin Crossaeef9f02022-02-07 21:01:26 -08002895 "NOTICE",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002896
2897 ":libc_musl_sysroot_bionic_arch_headers",
2898 ],
2899 out: ["libc_musl_sysroot_bionic_headers.zip"],
2900 tools: [
2901 "soong_zip",
2902 "merge_zips",
2903 "zip2zip",
2904 ],
Colin Crossaeef9f02022-02-07 21:01:26 -08002905 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
2906 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
Colin Crossad33d022022-02-25 18:27:04 -08002907 // NOTICE
2908 " -j -f $(location NOTICE) " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002909 // headers
2910 " -P include " +
Colin Crossaeef9f02022-02-07 21:01:26 -08002911 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
2912 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
2913 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2914 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2915 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2916 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2917 " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
2918 " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
2919 " -C $${BIONIC_LIBC_DIR}/b64/include " +
2920 " -D $${BIONIC_LIBC_DIR}/b64/include " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002921 " && " +
Colin Crossad33d022022-02-25 18:27:04 -08002922 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
Colin Cross1c0a7a02022-08-11 12:22:26 -07002923 " -x **/BUILD " +
Colin Crossad33d022022-02-25 18:27:04 -08002924 " include/**/*:include/ " +
2925 " NOTICE:NOTICE.bionic " +
2926 " && " +
2927 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002928}
2929
2930// The architecture-specific bits have to be handled separately because the label varies based
2931// on architecture, which prevents using $(locations) to find them and requires using $(in)
2932// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
2933// genrule.
2934cc_genrule {
2935 name: "libc_musl_sysroot_bionic_arch_headers",
2936 visibility: ["//visibility:private"],
2937 host_supported: true,
2938 device_supported: false,
2939 enabled: false,
2940 target: {
2941 musl: {
2942 enabled: true,
2943 },
2944 },
2945 arch: {
2946 arm: {
2947 srcs: ["kernel/uapi/asm-arm/**/*.h"],
2948 },
2949 arm64: {
2950 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
2951 },
2952 x86: {
2953 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2954 },
2955 x86_64: {
2956 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2957 },
2958 },
2959 out: ["libc_musl_sysroot_bionic_arch_headers.zip"],
2960 tools: ["soong_zip"],
2961 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
2962}
Colin Cross290c4952022-10-13 12:51:13 -07002963
2964cc_genrule {
2965 name: "bionic_sysroot_crt_objects",
2966 visibility: ["//visibility:private"],
2967 out: ["bionic_sysroot_crt_objects.zip"],
2968 tools: ["soong_zip"],
2969 srcs: [
2970 ":crtbegin_dynamic",
2971 ":crtbegin_so",
2972 ":crtbegin_static",
2973 ":crtend_android",
2974 ":crtend_so",
2975 ],
2976 cmd: "$(location soong_zip) -o $(out) -j " +
2977 "-f $(location :crtbegin_dynamic) " +
2978 "-f $(location :crtbegin_so) " +
2979 "-f $(location :crtbegin_static) " +
2980 "-f $(location :crtend_android) " +
2981 "-f $(location :crtend_so)",
2982 dist: {
2983 targets: ["bionic_sysroot_crt_objects"],
2984 },
2985 arch: {
2986 arm: {
2987 dist: {
2988 suffix: "_arm",
2989 },
2990 },
2991 arm64: {
2992 dist: {
2993 suffix: "_arm64",
2994 },
2995 },
2996 riscv64: {
2997 dist: {
2998 suffix: "_riscv64",
2999 },
3000 },
3001 x86: {
3002 dist: {
3003 suffix: "_x86",
3004 },
3005 },
3006 x86_64: {
3007 dist: {
3008 suffix: "_x86_64",
3009 },
3010 },
3011 },
3012}
Spandan Das8fce52a2023-09-28 18:00:12 +00003013
Jiyong Park35a280d2024-05-03 16:53:39 +09003014filegroup {
3015 name: "linux_capability_header",
3016 srcs: ["kernel/uapi/linux/capability.h"],
3017}