blob: e0d89948cc1c899fd3d8a1d376a306b039557607 [file] [log] [blame]
Bob Badouraa7d8352021-02-19 13:06:22 -08001package {
2 default_applicable_licenses: ["bionic_libc_license"],
3}
4
5license {
6 name: "bionic_libc_license",
7 visibility: [":__subpackages__"],
8 license_kinds: [
9 "SPDX-license-identifier-Apache-2.0",
10 "SPDX-license-identifier-BSD",
11 "SPDX-license-identifier-ISC",
12 "SPDX-license-identifier-MIT",
13 "legacy_notice",
14 "legacy_unencumbered",
15 ],
16 license_text: [
17 "NOTICE",
18 ],
19}
20
Elliott Hughes53cf3482016-08-09 13:06:41 -070021libc_common_flags = [
22 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080023 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070024 "-Wall",
25 "-Wextra",
26 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080027 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070028 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070029 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070030 "-Wframe-larger-than=2048",
Christopher Ferris1de7a482023-09-12 11:06:29 -070031 "-Wno-reorder-init-list",
Elliott Hughes53cf3482016-08-09 13:06:41 -070032
33 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
34 "-Werror=pointer-to-int-cast",
35 "-Werror=int-to-pointer-cast",
36 "-Werror=type-limits",
37 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080038
39 // Clang's exit-time destructor registration hides __dso_handle, but
40 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
41 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080042
Elliott Hughesa13d0662021-12-02 14:42:16 -080043 // We know clang does a lot of harm by rewriting what we've said, and sadly
44 // never see any good it does, so let's just ask it to do what we say...
45 // (The specific motivating example was clang turning a loop that would only
46 // ever touch 0, 1, or 2 bytes into a call to memset, which was never going
47 // to amortize.)
48 "-fno-builtin",
Elliott Hughes53cf3482016-08-09 13:06:41 -070049]
50
Dan Willemsen208ae172015-09-16 16:33:27 -070051// Define some common cflags
52// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070053cc_defaults {
54 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080055 defaults: ["linux_bionic_supported"],
Christopher Ferrisb5425052024-04-23 17:15:39 -070056 cflags: libc_common_flags + [
57 "-DUSE_SCUDO",
58 ],
Elliott Hughes53cf3482016-08-09 13:06:41 -070059 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070060 conlyflags: ["-std=gnu99"],
61 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070062 include_dirs: [
63 "bionic/libc/async_safe/include",
Peter Collingbourne5d3aa862020-09-11 15:05:17 -070064 "bionic/libc/platform",
Tom Cherry379ed1e2020-09-17 09:36:25 -070065 // For android_filesystem_config.h.
66 "system/core/libcutils/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070067 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070068
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010069 header_libs: [
70 "libc_headers",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +000071 "liblog_headers", // needed by bionic/libc/async_safe/include
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010072 ],
73 export_header_lib_headers: [
74 "libc_headers",
75 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -080076
Colin Cross50c21ab2015-10-31 23:03:05 -070077 stl: "none",
78 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070079 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070080 address: false,
81 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070082 // TODO(b/132640749): Fix broken fuzzer support.
83 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070084 },
Yifan Hong5a39cee2020-01-21 16:43:56 -080085 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -070086 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090087 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020088 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080089
Peter Collingbournee99912f2019-11-01 15:37:00 -070090 product_variables: {
Evgenii Stepanov5a73e032020-04-29 14:59:44 -070091 malloc_zero_contents: {
92 cflags: ["-DSCUDO_ZERO_CONTENTS"],
93 },
94 malloc_pattern_fill_contents: {
95 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
96 },
Christopher Ferrisb5425052024-04-23 17:15:39 -070097 malloc_low_memory: {
98 cflags: ["-UUSE_SCUDO"],
Steven Morelandfb65ee42020-07-31 00:18:38 +000099 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700100 },
Yi Kong9e33b762021-10-29 02:43:22 +0800101
102 lto: {
103 never: true,
104 },
Elliott Hughesc2043342023-07-20 20:24:09 +0000105
106 apex_available: ["com.android.runtime"],
Elliott Hughes7d136662023-10-27 15:40:32 -0700107
108 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700109}
110
Elliott Hughes788075a2024-06-18 12:25:37 +0000111// Workaround for b/24465209.
112// We're unlikely to be able to remove this before we just
113// remove ILP32 support completely.
114// Note that we also still have `pack_relocations: false`
115// for both libc and libm, even on LP64.
116// ========================================================
117cc_defaults {
118 name: "bug_24465209_workaround",
Elliott Hughesfeb94732024-06-18 19:44:18 +0000119 target: {
120 android_arm: {
Elliott Hughes788075a2024-06-18 12:25:37 +0000121 pack_relocations: false,
122 ldflags: ["-Wl,--hash-style=both"],
123 },
Elliott Hughesfeb94732024-06-18 19:44:18 +0000124 android_x86: {
Elliott Hughes788075a2024-06-18 12:25:37 +0000125 pack_relocations: false,
126 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesb4e02782024-06-21 11:35:18 +0000127 },
Elliott Hughes788075a2024-06-18 12:25:37 +0000128 },
129}
130
Elliott Hughes89aada12024-07-01 21:59:04 +0000131// Leave the symbols in the shared library so that stack unwinders can produce
132// meaningful name resolution. This is a bit more ugly than it sounds because
133// arm32 is a bit broken.
134// ========================================================
135cc_defaults {
136 name: "keep_symbols",
137 arch: {
138 arm: {
139 // arm32 does not produce complete exidx unwind information,
140 // so keep the .debug_frame which is relatively small and does
141 // include needed unwind information.
142 // See b/132992102 for details.
143 strip: {
144 keep_symbols_and_debug_frame: true,
145 },
146 },
147 arm64: {
148 strip: {
149 keep_symbols: true,
150 },
151 },
152 riscv64: {
153 strip: {
154 keep_symbols: true,
155 },
156 },
157 x86: {
158 strip: {
159 keep_symbols: true,
160 },
161 },
162 x86_64: {
163 strip: {
164 keep_symbols: true,
165 },
166 },
167 },
168}
169
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700170// Defaults for native allocator libs/includes to make it
171// easier to change.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700172// ========================================================
173cc_defaults {
174 name: "libc_native_allocator_defaults",
175
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700176 whole_static_libs: [
Christopher Ferrisb5425052024-04-23 17:15:39 -0700177 "libscudo",
178 ],
179 cflags: [
180 "-DUSE_SCUDO",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700181 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800182 header_libs: ["gwp_asan_headers"],
Christopher Ferrisb5425052024-04-23 17:15:39 -0700183 product_variables: {
184 malloc_low_memory: {
185 cflags: ["-UUSE_SCUDO"],
186 whole_static_libs: [
187 "libjemalloc5",
188 "libc_jemalloc_wrapper",
189 ],
190 exclude_static_libs: [
191 "libscudo",
192 ],
193 },
194 },
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700195}
196
197// Functions not implemented by jemalloc directly, or that need to
198// be modified for Android.
199cc_library_static {
200 name: "libc_jemalloc_wrapper",
201 defaults: ["libc_defaults"],
202 srcs: ["bionic/jemalloc_wrapper.cpp"],
203 cflags: ["-fvisibility=hidden"],
204
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800205 // Used to pull in the jemalloc include directory so that if the
206 // library is removed, the include directory is also removed.
207 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700208}
209
Dan Willemsen208ae172015-09-16 16:33:27 -0700210// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700211// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700212// ========================================================
213//
Ryan Prichard249757b2019-11-01 17:18:28 -0700214// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
215// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
216// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
217// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700218
219cc_library_static {
220
Colin Crossa3f9fca2016-01-11 13:20:55 -0800221 srcs: [
222 "bionic/__libc_init_main_thread.cpp",
223 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700224 "bionic/bionic_call_ifunc_resolver.cpp",
225 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800226 ],
227 arch: {
228 arm64: {
229 srcs: ["arch-arm64/bionic/__set_tls.c"],
230 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000231 riscv64: {
232 srcs: ["arch-riscv64/bionic/__set_tls.c"],
233 },
Colin Crossa3f9fca2016-01-11 13:20:55 -0800234 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700235 srcs: [
236 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Pirama Arumuga Nainar7b89be72021-02-12 15:09:49 -0800237 "arch-x86/bionic/__libc_int0x80.S",
Ryan Prichard27475b52018-05-17 17:14:18 -0700238 "arch-x86/bionic/__set_tls.cpp",
239 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800240 },
241 x86_64: {
242 srcs: ["arch-x86_64/bionic/__set_tls.c"],
243 },
244 },
245
Colin Cross50c21ab2015-10-31 23:03:05 -0700246 defaults: ["libc_defaults"],
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000247 cflags: [
248 "-fno-stack-protector",
249 "-ffreestanding",
250 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700251 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700252}
253
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800254filegroup {
255 name: "elf_note_sources",
256 srcs: ["bionic/elf_note.cpp"],
257}
258
Ryan Prichard249757b2019-11-01 17:18:28 -0700259// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
260// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
261// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800262
263cc_library_static {
264 name: "libc_init_static",
265 defaults: ["libc_defaults"],
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800266 srcs: [
Florian Mayera6e9dcf2024-11-06 12:41:22 -0800267 "bionic/libc_init_mte.cpp",
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800268 "bionic/libc_init_static.cpp",
269 ":elf_note_sources",
270 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700271 cflags: [
272 "-fno-stack-protector",
273
274 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
275 // from the linker before ifunc resolvers have made string.h functions available.
276 "-ffreestanding",
277 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800278}
279
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700280cc_library_static {
281 name: "libc_init_dynamic",
282 defaults: ["libc_defaults"],
283 srcs: ["bionic/libc_init_dynamic.cpp"],
284 cflags: ["-fno-stack-protector"],
285}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800286
Dan Willemsen208ae172015-09-16 16:33:27 -0700287// ========================================================
288// libc_tzcode.a - upstream 'tzcode' code
289// ========================================================
290
291cc_library_static {
292
Colin Cross50c21ab2015-10-31 23:03:05 -0700293 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700294 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800295 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700296 "tzcode/bionic.cpp",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700297 // tzcode doesn't include strptime, so we use a fork of the
298 // OpenBSD code which needs this global data.
Elliott Hughesd3627a42022-12-06 22:24:27 +0000299 "upstream-openbsd/lib/libc/locale/_def_time.c",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700300 // tzcode doesn't include wcsftime, so we use the FreeBSD code.
301 "upstream-freebsd/lib/libc/locale/wcsftime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700302 ],
303
Colin Cross50c21ab2015-10-31 23:03:05 -0700304 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700305 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700306 // Don't use ridiculous amounts of stack.
307 "-DALL_STATE",
308 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
309 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800310 // Obviously, we want to be thread-safe.
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000311 "-DTHREAD_SAFE=1",
Dan Willemsen208ae172015-09-16 16:33:27 -0700312 // The name of the tm_gmtoff field in our struct tm.
313 "-DTM_GMTOFF=tm_gmtoff",
Elliott Hughes31fc69f2023-06-20 15:36:11 -0700314 // Android uses a system property instead of /etc/localtime, so make callers crash.
Almaz Mingaleeva52a0da2022-02-28 16:55:50 +0000315 "-DTZDEFAULT=NULL",
Dan Willemsen208ae172015-09-16 16:33:27 -0700316 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700317 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700318 // Include `tzname`, `timezone`, and `daylight` globals.
319 "-DHAVE_POSIX_DECLS=0",
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000320 "-DUSG_COMPAT=2",
321 "-DHAVE_TZNAME=2",
322 // stdbool.h is available
323 "-DHAVE_STDBOOL_H",
Colin Crossa35d23d2015-11-19 13:32:49 -0800324 // Use the empty string (instead of " ") as the timezone abbreviation
325 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700326 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700327 "-Dlint",
328 ],
329
Elliott Hughes2bd43162023-06-15 13:17:08 -0700330 local_include_dirs: [
331 "tzcode/",
332 "upstream-freebsd/android/include",
333 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700334 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700335}
336
337// ========================================================
338// libc_dns.a - modified NetBSD DNS code
339// ========================================================
340
341cc_library_static {
342
Colin Cross50c21ab2015-10-31 23:03:05 -0700343 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700344 srcs: [
Elliott Hughesd0bbfa82021-04-08 11:58:51 -0700345 "dns/**/*.c*",
Dan Willemsen208ae172015-09-16 16:33:27 -0700346
347 "upstream-netbsd/lib/libc/isc/ev_streams.c",
348 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700349 ],
350
Colin Cross50c21ab2015-10-31 23:03:05 -0700351 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700352 "-DANDROID_CHANGES",
353 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700354 "-Wno-unused-parameter",
355 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700356 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700357 ],
358
Dan Willemsen208ae172015-09-16 16:33:27 -0700359 local_include_dirs: [
360 "dns/include",
361 "private",
362 "upstream-netbsd/lib/libc/include",
363 "upstream-netbsd/android/include",
364 ],
365
366 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700367}
368
369// ========================================================
370// libc_freebsd.a - upstream FreeBSD C library code
371// ========================================================
372//
373// These files are built with the freebsd-compat.h header file
374// automatically included.
375
376cc_library_static {
Elliott Hughesc2043342023-07-20 20:24:09 +0000377 name: "libc_freebsd_ldexp",
378 defaults: ["libc_defaults"],
379 cflags: ["-Dscalbn=ldexp"],
380 srcs: [":libc_ldexp_srcs"],
381}
382
383cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700384 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700385 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700386 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700387 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
388 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
389 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
390 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700391 "upstream-freebsd/lib/libc/stdlib/qsort.c",
Elliott Hughes5bae5722024-07-30 12:47:33 -0400392 "upstream-freebsd/lib/libc/stdlib/qsort_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700393 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700394 "upstream-freebsd/lib/libc/string/wcpcpy.c",
395 "upstream-freebsd/lib/libc/string/wcpncpy.c",
396 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700397 "upstream-freebsd/lib/libc/string/wcscat.c",
398 "upstream-freebsd/lib/libc/string/wcschr.c",
399 "upstream-freebsd/lib/libc/string/wcscmp.c",
400 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700401 "upstream-freebsd/lib/libc/string/wcscspn.c",
402 "upstream-freebsd/lib/libc/string/wcsdup.c",
403 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700404 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700405 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
406 "upstream-freebsd/lib/libc/string/wcsncat.c",
407 "upstream-freebsd/lib/libc/string/wcsncmp.c",
408 "upstream-freebsd/lib/libc/string/wcsncpy.c",
409 "upstream-freebsd/lib/libc/string/wcsnlen.c",
410 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700411 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700412 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700413 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700414 "upstream-freebsd/lib/libc/string/wcstok.c",
415 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700416 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700417 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700418 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800419 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700420 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700421
Colin Cross50c21ab2015-10-31 23:03:05 -0700422 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700423 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700424 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700425 "-include freebsd-compat.h",
426 ],
427
Dan Willemsen208ae172015-09-16 16:33:27 -0700428 local_include_dirs: [
429 "upstream-freebsd/android/include",
430 ],
431
432 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700433}
434
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700435cc_library_static {
436 defaults: ["libc_defaults"],
437 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700438 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700439 ],
440
441 cflags: [
442 "-Wno-sign-compare",
443 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700444 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700445 ],
446
447 local_include_dirs: [
448 "upstream-freebsd/android/include",
449 ],
450
451 name: "libc_freebsd_large_stack",
452}
453
Dan Willemsen208ae172015-09-16 16:33:27 -0700454// ========================================================
455// libc_netbsd.a - upstream NetBSD C library code
456// ========================================================
457//
458// These files are built with the netbsd-compat.h header file
459// automatically included.
460
461cc_library_static {
462
Colin Cross50c21ab2015-10-31 23:03:05 -0700463 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700464 srcs: [
465 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700466 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700467 "upstream-netbsd/lib/libc/gen/psignal.c",
468 "upstream-netbsd/lib/libc/gen/utime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700469 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
470 "upstream-netbsd/lib/libc/regex/regcomp.c",
471 "upstream-netbsd/lib/libc/regex/regerror.c",
472 "upstream-netbsd/lib/libc/regex/regexec.c",
473 "upstream-netbsd/lib/libc/regex/regfree.c",
474 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700475 "upstream-netbsd/lib/libc/stdlib/drand48.c",
476 "upstream-netbsd/lib/libc/stdlib/erand48.c",
477 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
478 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700479 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
480 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
481 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
482 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
483 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
484 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
485 "upstream-netbsd/lib/libc/stdlib/seed48.c",
486 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700487 ],
488 multilib: {
489 lib32: {
490 // LP32 cruft
491 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
492 },
493 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700494 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700495 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800496 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700497 "-DPOSIX_MISTAKE",
498 "-include netbsd-compat.h",
499 ],
500
Dan Willemsen208ae172015-09-16 16:33:27 -0700501 local_include_dirs: [
502 "upstream-netbsd/android/include",
503 "upstream-netbsd/lib/libc/include",
504 ],
505
506 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700507}
508
509// ========================================================
Elliott Hughes968adf92024-02-08 13:15:53 -0800510// libc_openbsd.a - upstream OpenBSD C library code
Dan Willemsen208ae172015-09-16 16:33:27 -0700511// ========================================================
512//
513// These files are built with the openbsd-compat.h header file
514// automatically included.
Dan Willemsen208ae172015-09-16 16:33:27 -0700515cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700516 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700517 srcs: [
Elliott Hughes968adf92024-02-08 13:15:53 -0800518 "upstream-openbsd/lib/libc/crypt/arc4random.c",
519 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700520 "upstream-openbsd/lib/libc/gen/alarm.c",
521 "upstream-openbsd/lib/libc/gen/ctype_.c",
522 "upstream-openbsd/lib/libc/gen/daemon.c",
523 "upstream-openbsd/lib/libc/gen/err.c",
524 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700525 "upstream-openbsd/lib/libc/gen/fnmatch.c",
526 "upstream-openbsd/lib/libc/gen/ftok.c",
527 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700528 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700529 "upstream-openbsd/lib/libc/gen/verr.c",
530 "upstream-openbsd/lib/libc/gen/verrx.c",
531 "upstream-openbsd/lib/libc/gen/vwarn.c",
532 "upstream-openbsd/lib/libc/gen/vwarnx.c",
533 "upstream-openbsd/lib/libc/gen/warn.c",
534 "upstream-openbsd/lib/libc/gen/warnx.c",
535 "upstream-openbsd/lib/libc/locale/btowc.c",
536 "upstream-openbsd/lib/libc/locale/mbrlen.c",
537 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
538 "upstream-openbsd/lib/libc/locale/mbtowc.c",
539 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700540 "upstream-openbsd/lib/libc/locale/wcstombs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700541 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
542 "upstream-openbsd/lib/libc/locale/wctob.c",
543 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700544 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/net/htonl.c",
546 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700547 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
548 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
549 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700550 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
551 "upstream-openbsd/lib/libc/net/inet_ntop.c",
552 "upstream-openbsd/lib/libc/net/inet_pton.c",
553 "upstream-openbsd/lib/libc/net/ntohl.c",
554 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800555 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700556 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700557 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
558 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700559 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700560 "upstream-openbsd/lib/libc/stdio/fputwc.c",
561 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700562 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700563 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700564 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700565 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700566 "upstream-openbsd/lib/libc/stdio/makebuf.c",
567 "upstream-openbsd/lib/libc/stdio/mktemp.c",
568 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
569 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700570 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700571 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700572 "upstream-openbsd/lib/libc/stdio/ungetc.c",
573 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
574 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
575 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700576 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
577 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
578 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700579 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700580 "upstream-openbsd/lib/libc/stdio/wsetup.c",
581 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800582 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700583 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700584 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700585 "upstream-openbsd/lib/libc/stdlib/insque.c",
586 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
587 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
588 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800589 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700590 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800591 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700592 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughes26b06072020-07-31 11:00:10 -0700593 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700594 "upstream-openbsd/lib/libc/stdlib/remque.c",
595 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700596 "upstream-openbsd/lib/libc/stdlib/tfind.c",
597 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800598 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700599 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800600 "upstream-openbsd/lib/libc/string/strcasestr.c",
601 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700602 "upstream-openbsd/lib/libc/string/strcspn.c",
603 "upstream-openbsd/lib/libc/string/strdup.c",
604 "upstream-openbsd/lib/libc/string/strndup.c",
605 "upstream-openbsd/lib/libc/string/strpbrk.c",
606 "upstream-openbsd/lib/libc/string/strsep.c",
607 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700608 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800609 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700610 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700611 "upstream-openbsd/lib/libc/string/wcswidth.c",
Colin Cross69bcb8b2021-09-08 13:24:16 -0700612
Elliott Hughesd4c61182024-08-16 17:31:24 -0400613 // These files are originally from OpenBSD,
614 // and benefit from being compiled with openbsd-compat.h.
615 // TODO: clean them up instead.
Colin Cross69bcb8b2021-09-08 13:24:16 -0700616 "bionic/fts.c",
Elliott Hughesd4c61182024-08-16 17:31:24 -0400617 "stdio/vfprintf.cpp",
618 "stdio/vfwprintf.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700619 ],
620
Elliott Hughes7d136662023-10-27 15:40:32 -0700621 // Each architecture has optimized versions of some routines,
622 // and only includes the portable C versions of ones it's missing.
Dan Willemsen208ae172015-09-16 16:33:27 -0700623 arch: {
624 arm: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700625 srcs: [
626 "upstream-openbsd/lib/libc/string/memchr.c",
627 "upstream-openbsd/lib/libc/string/memrchr.c",
628 "upstream-openbsd/lib/libc/string/stpncpy.c",
629 "upstream-openbsd/lib/libc/string/strlcat.c",
630 "upstream-openbsd/lib/libc/string/strlcpy.c",
631 "upstream-openbsd/lib/libc/string/strncat.c",
632 "upstream-openbsd/lib/libc/string/strncmp.c",
633 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700634 ],
635 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700636 arm64: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700637 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700638 "upstream-openbsd/lib/libc/string/strcat.c",
Elliott Hughesaefe9992023-11-08 12:04:41 -0800639 "upstream-openbsd/lib/libc/string/stpncpy.c",
Elliott Hughes7d136662023-10-27 15:40:32 -0700640 "upstream-openbsd/lib/libc/string/strlcat.c",
641 "upstream-openbsd/lib/libc/string/strlcpy.c",
642 "upstream-openbsd/lib/libc/string/strncat.c",
643 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700644 ],
645 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000646 riscv64: {
647 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700648 "upstream-openbsd/lib/libc/string/memrchr.c",
649 "upstream-openbsd/lib/libc/string/stpncpy.c",
650 "upstream-openbsd/lib/libc/string/strlcat.c",
651 "upstream-openbsd/lib/libc/string/strlcpy.c",
Elliott Hughesebc19a92022-10-14 23:25:36 +0000652 ],
653 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700654 x86: {
Elliott Hughesaefe9992023-11-08 12:04:41 -0800655 srcs: [
656 // x86 has custom implementations of all of these.
657 ],
Elliott Hughes7d136662023-10-27 15:40:32 -0700658 },
659 x86_64: {
660 srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800661 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800662 "upstream-openbsd/lib/libc/string/memrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700663 "upstream-openbsd/lib/libc/string/strlcat.c",
664 "upstream-openbsd/lib/libc/string/strlcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800665 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700666 },
667 },
668
Colin Cross50c21ab2015-10-31 23:03:05 -0700669 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700670 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700671 "-Wno-unused-parameter",
672 "-include openbsd-compat.h",
673 ],
674
Dan Willemsen208ae172015-09-16 16:33:27 -0700675 local_include_dirs: [
676 "private",
Elliott Hughes968adf92024-02-08 13:15:53 -0800677 "stdio",
Elliott Hughesd4c61182024-08-16 17:31:24 -0400678 "upstream-openbsd/android/include/",
679 "upstream-openbsd/lib/libc/gdtoa/",
680 "upstream-openbsd/lib/libc/include/",
681 "upstream-openbsd/lib/libc/stdio/",
Dan Willemsen208ae172015-09-16 16:33:27 -0700682 ],
683
684 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700685}
686
Elliott Hughes968adf92024-02-08 13:15:53 -0800687cc_library_static {
688 name: "libc_openbsd_large_stack",
689 defaults: ["libc_defaults"],
690 srcs: [
Elliott Hughes968adf92024-02-08 13:15:53 -0800691 "upstream-openbsd/lib/libc/string/memmem.c",
692 "upstream-openbsd/lib/libc/string/strstr.c",
693 ],
694 cflags: [
695 "-include openbsd-compat.h",
696 "-Wno-sign-compare",
697 "-Wframe-larger-than=5000",
698 ],
699
700 local_include_dirs: [
Elliott Hughes968adf92024-02-08 13:15:53 -0800701 "upstream-openbsd/android/include/",
Elliott Hughes968adf92024-02-08 13:15:53 -0800702 ],
703}
704
Dan Willemsen208ae172015-09-16 16:33:27 -0700705// ========================================================
706// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
707// ========================================================
708//
709// These files are built with the openbsd-compat.h header file
710// automatically included.
711
712cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700713 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700714 srcs: [
715 "upstream-openbsd/android/gdtoa_support.cpp",
716 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
717 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
718 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
719 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
720 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
721 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
722 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
723 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
724 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
725 "upstream-openbsd/lib/libc/gdtoa/misc.c",
726 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
727 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
728 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
729 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
730 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
731 "upstream-openbsd/lib/libc/gdtoa/sum.c",
732 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
733 ],
734 multilib: {
735 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800736 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700737 },
738 },
739
Colin Cross50c21ab2015-10-31 23:03:05 -0700740 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700741 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700742 "-include openbsd-compat.h",
743 ],
744
Dan Willemsen208ae172015-09-16 16:33:27 -0700745 local_include_dirs: [
746 "private",
747 "upstream-openbsd/android/include",
748 "upstream-openbsd/lib/libc/include",
749 ],
750
751 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700752}
753
754// ========================================================
Pierre-Clément Tosi467e58e2023-02-01 13:44:43 +0000755// libc_fortify.a - container for our FORTIFY
George Burgess IV6cb06872017-07-21 13:28:42 -0700756// implementation details
757// ========================================================
758cc_library_static {
759 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700760 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700761
762 name: "libc_fortify",
763
764 // Disable FORTIFY for the compilation of these, so we don't end up having
765 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800766 cflags: [
767 "-U_FORTIFY_SOURCE",
768 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
769 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700770
771 arch: {
772 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800773 cflags: [
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800774 "-DRENAME___STRCAT_CHK",
775 "-DRENAME___STRCPY_CHK",
776 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700777 srcs: [
778 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800779
780 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
781 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
782
783 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
784 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
785
786 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
787 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
788
789 "arch-arm/krait/bionic/__strcat_chk.S",
790 "arch-arm/krait/bionic/__strcpy_chk.S",
791
792 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
793 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
794
Haibo Huang01bfd892018-12-03 15:05:16 -0800795 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
796 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700797 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700798 },
799 arm64: {
800 srcs: [
Elliott Hughes023e4e72022-11-17 19:27:02 +0000801 "arch-arm64/string/__memcpy_chk.S",
802 "arch-arm64/string/__memset_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700803 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700804 },
caowenchengab457f92023-03-06 14:57:55 +0800805 riscv64: {
806 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000807 "arch-riscv64/string/__memset_chk.S",
808 "arch-riscv64/string/__memcpy_chk.S",
caowenchengab457f92023-03-06 14:57:55 +0800809 ],
810 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700811 },
812}
813
814// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700815// libc_bionic.a - home-grown C library code
816// ========================================================
817
818cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700819 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700820 srcs: [
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800821 "bionic/NetdClientDispatch.cpp",
822 "bionic/__bionic_get_shell_path.cpp",
823 "bionic/__cmsg_nxthdr.cpp",
824 "bionic/__cxa_thread_atexit_impl.cpp",
825 "bionic/__errno.cpp",
826 "bionic/__gnu_basename.cpp",
827 "bionic/__libc_current_sigrtmax.cpp",
828 "bionic/__libc_current_sigrtmin.cpp",
829 "bionic/abort.cpp",
830 "bionic/accept.cpp",
831 "bionic/access.cpp",
Florian Mayerca4749a2024-02-14 12:55:46 -0800832 "bionic/android_crash_detail.cpp",
Josh Gao10ec9282017-04-03 15:13:29 -0700833 "bionic/android_set_abort_message.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000834 "bionic/android_unsafe_frame_pointer_chase.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800835 "bionic/arpa_inet.cpp",
836 "bionic/assert.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000837 "bionic/atexit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800838 "bionic/atof.cpp",
839 "bionic/bionic_allocator.cpp",
840 "bionic/bionic_arc4random.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000841 "bionic/bionic_elf_tls.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800842 "bionic/bionic_futex.cpp",
843 "bionic/bionic_netlink.cpp",
844 "bionic/bionic_systrace.cpp",
845 "bionic/bionic_time_conversions.cpp",
846 "bionic/brk.cpp",
847 "bionic/c16rtomb.cpp",
848 "bionic/c32rtomb.cpp",
849 "bionic/chmod.cpp",
850 "bionic/chown.cpp",
851 "bionic/clearenv.cpp",
852 "bionic/clock.cpp",
853 "bionic/clock_getcpuclockid.cpp",
854 "bionic/clock_nanosleep.cpp",
855 "bionic/clone.cpp",
856 "bionic/ctype.cpp",
857 "bionic/dirent.cpp",
858 "bionic/dup.cpp",
859 "bionic/environ.cpp",
860 "bionic/error.cpp",
861 "bionic/eventfd.cpp",
862 "bionic/exec.cpp",
863 "bionic/execinfo.cpp",
Elliott Hughes69bd8e92024-02-09 10:04:26 -0800864 "bionic/exit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800865 "bionic/faccessat.cpp",
866 "bionic/fchmod.cpp",
867 "bionic/fchmodat.cpp",
868 "bionic/fcntl.cpp",
869 "bionic/fdsan.cpp",
870 "bionic/fdtrack.cpp",
871 "bionic/ffs.cpp",
872 "bionic/fgetxattr.cpp",
873 "bionic/flistxattr.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000874 "bionic/fork.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800875 "bionic/fpclassify.cpp",
876 "bionic/fsetxattr.cpp",
877 "bionic/ftruncate.cpp",
878 "bionic/ftw.cpp",
879 "bionic/futimens.cpp",
880 "bionic/getcwd.cpp",
881 "bionic/getdomainname.cpp",
882 "bionic/getentropy.cpp",
883 "bionic/gethostname.cpp",
884 "bionic/getloadavg.cpp",
885 "bionic/getpagesize.cpp",
886 "bionic/getpgrp.cpp",
887 "bionic/getpid.cpp",
888 "bionic/getpriority.cpp",
889 "bionic/gettid.cpp",
890 "bionic/get_device_api_level.cpp",
891 "bionic/grp_pwd.cpp",
892 "bionic/grp_pwd_file.cpp",
893 "bionic/heap_zero_init.cpp",
894 "bionic/iconv.cpp",
895 "bionic/icu_wrappers.cpp",
896 "bionic/ifaddrs.cpp",
897 "bionic/inotify_init.cpp",
898 "bionic/ioctl.cpp",
Elliott Hughes17e40682024-02-13 16:32:29 -0800899 "bionic/isatty.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800900 "bionic/killpg.cpp",
901 "bionic/langinfo.cpp",
Elliott Hughes219e6022024-08-27 19:12:08 +0000902 "bionic/lchmod.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800903 "bionic/lchown.cpp",
904 "bionic/lfs64_support.cpp",
905 "bionic/libc_init_common.cpp",
906 "bionic/libgen.cpp",
907 "bionic/link.cpp",
908 "bionic/locale.cpp",
909 "bionic/lockf.cpp",
910 "bionic/lstat.cpp",
911 "bionic/mblen.cpp",
912 "bionic/mbrtoc16.cpp",
913 "bionic/mbrtoc32.cpp",
914 "bionic/mempcpy.cpp",
915 "bionic/memset_explicit.cpp",
916 "bionic/mkdir.cpp",
917 "bionic/mkfifo.cpp",
918 "bionic/mknod.cpp",
919 "bionic/mntent.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800920 "bionic/netdb.cpp",
Elliott Hughes3ed6e722024-02-16 01:18:01 +0000921 "bionic/net_if.cpp",
922 "bionic/netinet_ether.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800923 "bionic/netinet_in.cpp",
924 "bionic/nl_types.cpp",
925 "bionic/open.cpp",
926 "bionic/pathconf.cpp",
927 "bionic/pause.cpp",
928 "bionic/pidfd.cpp",
929 "bionic/pipe.cpp",
930 "bionic/poll.cpp",
931 "bionic/posix_fadvise.cpp",
932 "bionic/posix_fallocate.cpp",
933 "bionic/posix_madvise.cpp",
934 "bionic/posix_timers.cpp",
935 "bionic/preadv_pwritev.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000936 "bionic/pthread_atfork.cpp",
937 "bionic/pthread_attr.cpp",
938 "bionic/pthread_barrier.cpp",
939 "bionic/pthread_cond.cpp",
940 "bionic/pthread_create.cpp",
941 "bionic/pthread_detach.cpp",
942 "bionic/pthread_equal.cpp",
943 "bionic/pthread_exit.cpp",
Elliott Hughese117d6e2024-11-14 17:31:13 +0000944 "bionic/pthread_getaffinity.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000945 "bionic/pthread_getcpuclockid.cpp",
946 "bionic/pthread_getschedparam.cpp",
947 "bionic/pthread_gettid_np.cpp",
948 "bionic/pthread_internal.cpp",
949 "bionic/pthread_join.cpp",
950 "bionic/pthread_key.cpp",
951 "bionic/pthread_kill.cpp",
952 "bionic/pthread_mutex.cpp",
953 "bionic/pthread_once.cpp",
954 "bionic/pthread_rwlock.cpp",
955 "bionic/pthread_sigqueue.cpp",
956 "bionic/pthread_self.cpp",
957 "bionic/pthread_setname_np.cpp",
Elliott Hughese117d6e2024-11-14 17:31:13 +0000958 "bionic/pthread_setaffinity.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000959 "bionic/pthread_setschedparam.cpp",
960 "bionic/pthread_spinlock.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800961 "bionic/ptrace.cpp",
962 "bionic/pty.cpp",
963 "bionic/raise.cpp",
964 "bionic/rand.cpp",
965 "bionic/readlink.cpp",
966 "bionic/realpath.cpp",
967 "bionic/reboot.cpp",
968 "bionic/recv.cpp",
969 "bionic/recvmsg.cpp",
970 "bionic/rename.cpp",
971 "bionic/rmdir.cpp",
972 "bionic/scandir.cpp",
Elliott Hughes17e40682024-02-13 16:32:29 -0800973 "bionic/sched_cpualloc.cpp",
974 "bionic/sched_cpucount.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800975 "bionic/sched_getaffinity.cpp",
976 "bionic/sched_getcpu.cpp",
977 "bionic/semaphore.cpp",
978 "bionic/send.cpp",
979 "bionic/setegid.cpp",
980 "bionic/seteuid.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000981 "bionic/setjmp_cookie.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800982 "bionic/setpgrp.cpp",
983 "bionic/sigaction.cpp",
984 "bionic/signal.cpp",
985 "bionic/sigprocmask.cpp",
986 "bionic/sleep.cpp",
987 "bionic/socketpair.cpp",
988 "bionic/spawn.cpp",
989 "bionic/stat.cpp",
990 "bionic/stdlib_l.cpp",
991 "bionic/strerror.cpp",
992 "bionic/string_l.cpp",
993 "bionic/strings_l.cpp",
994 "bionic/strsignal.cpp",
995 "bionic/strtol.cpp",
996 "bionic/strtold.cpp",
997 "bionic/swab.cpp",
998 "bionic/symlink.cpp",
999 "bionic/sync_file_range.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001000 "bionic/sysconf.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001001 "bionic/sys_epoll.cpp",
1002 "bionic/sys_msg.cpp",
1003 "bionic/sys_sem.cpp",
1004 "bionic/sys_shm.cpp",
1005 "bionic/sys_signalfd.cpp",
1006 "bionic/sys_statfs.cpp",
1007 "bionic/sys_statvfs.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001008 "bionic/sys_thread_properties.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001009 "bionic/sys_time.cpp",
1010 "bionic/sysinfo.cpp",
1011 "bionic/syslog.cpp",
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001012 "bionic/sysprop_helpers.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001013 "bionic/system.cpp",
1014 "bionic/system_property_api.cpp",
1015 "bionic/system_property_set.cpp",
1016 "bionic/tdestroy.cpp",
1017 "bionic/termios.cpp",
1018 "bionic/thread_private.cpp",
1019 "bionic/threads.cpp",
1020 "bionic/time.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001021 "bionic/tmpfile.cpp",
1022 "bionic/umount.cpp",
1023 "bionic/unlink.cpp",
1024 "bionic/usleep.cpp",
1025 "bionic/utmp.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001026 "bionic/vdso.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001027 "bionic/wait.cpp",
1028 "bionic/wchar.cpp",
1029 "bionic/wchar_l.cpp",
1030 "bionic/wcstod.cpp",
1031 "bionic/wctype.cpp",
1032 "bionic/wcwidth.cpp",
1033 "bionic/wmempcpy.cpp",
1034
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001035 // Forked but not yet cleaned up/rewritten stdio code.
1036 // TODO: finish cleanup.
1037 "stdio/fmemopen.cpp",
1038 "stdio/parsefloat.c",
1039 "stdio/refill.c",
1040 "stdio/stdio.cpp",
1041 "stdio/stdio_ext.cpp",
1042 "stdio/vfscanf.cpp",
1043 "stdio/vfwscanf.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001044 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001045
1046 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001047 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -07001048 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001049 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -08001050 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001051 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001052 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001053 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001054 "arch-arm/bionic/atomics_arm.c",
1055 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -08001056 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001057 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001058 "arch-arm/bionic/setjmp.S",
1059 "arch-arm/bionic/syscall.S",
1060 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001061
Haibo Huangea9957a2018-11-19 11:00:32 -08001062 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001063 "arch-arm/cortex-a7/bionic/memset.S",
1064
1065 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001066 "arch-arm/cortex-a9/bionic/memset.S",
1067 "arch-arm/cortex-a9/bionic/stpcpy.S",
1068 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001069 "arch-arm/cortex-a9/bionic/strcpy.S",
1070 "arch-arm/cortex-a9/bionic/strlen.S",
1071
Elliott Hughesaefe9992023-11-08 12:04:41 -08001072 "arch-arm/cortex-a15/bionic/memcpy.S",
1073 "arch-arm/cortex-a15/bionic/memmove.S",
1074 "arch-arm/cortex-a15/bionic/memset.S",
1075 "arch-arm/cortex-a15/bionic/stpcpy.S",
1076 "arch-arm/cortex-a15/bionic/strcat.S",
1077 "arch-arm/cortex-a15/bionic/strcmp.S",
1078 "arch-arm/cortex-a15/bionic/strcpy.S",
1079 "arch-arm/cortex-a15/bionic/strlen.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001080
1081 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001082
Haibo Huang01bfd892018-12-03 15:05:16 -08001083 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001084
Elliott Hughesaefe9992023-11-08 12:04:41 -08001085 "arch-arm/generic/bionic/memcmp.S",
1086 "arch-arm/generic/bionic/memmove.S",
1087 "arch-arm/generic/bionic/memset.S",
1088 "arch-arm/generic/bionic/stpcpy.c",
1089 "arch-arm/generic/bionic/strcat.c",
1090 "arch-arm/generic/bionic/strcmp.S",
1091 "arch-arm/generic/bionic/strcpy.S",
1092 "arch-arm/generic/bionic/strlen.c",
1093
1094 "arch-arm/krait/bionic/memcpy.S",
1095 "arch-arm/krait/bionic/memset.S",
1096
Haibo Huangea9957a2018-11-19 11:00:32 -08001097 "arch-arm/kryo/bionic/memcpy.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001098
1099 "bionic/strchr.cpp",
1100 "bionic/strchrnul.cpp",
1101 "bionic/strnlen.cpp",
1102 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001103 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001104 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001105 arm64: {
1106 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001107 "arch-arm64/bionic/__bionic_clone.S",
1108 "arch-arm64/bionic/_exit_with_stack_teardown.S",
1109 "arch-arm64/bionic/setjmp.S",
1110 "arch-arm64/bionic/syscall.S",
1111 "arch-arm64/bionic/vfork.S",
Vaisakh K V83e55842024-03-29 12:47:39 +05301112 "arch-arm64/oryon/memcpy-nt.S",
Vaisakh K V54a61212024-03-29 13:32:45 +05301113 "arch-arm64/oryon/memset-nt.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001114 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001115 },
1116
Elliott Hughesebc19a92022-10-14 23:25:36 +00001117 riscv64: {
1118 srcs: [
1119 "arch-riscv64/bionic/__bionic_clone.S",
1120 "arch-riscv64/bionic/_exit_with_stack_teardown.S",
Elliott Hughese1905ed2022-10-17 23:23:36 +00001121 "arch-riscv64/bionic/setjmp.S",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001122 "arch-riscv64/bionic/syscall.S",
1123 "arch-riscv64/bionic/vfork.S",
Yun Hsiang40a82d02023-05-26 10:10:40 +08001124
Elliott Hughesaefe9992023-11-08 12:04:41 -08001125 "arch-riscv64/string/memchr_v.S",
1126 "arch-riscv64/string/memcmp_v.S",
1127 "arch-riscv64/string/memcpy_v.S",
1128 "arch-riscv64/string/memmove_v.S",
1129 "arch-riscv64/string/memset_v.S",
1130 "arch-riscv64/string/stpcpy_v.S",
1131 "arch-riscv64/string/strcat_v.S",
1132 "arch-riscv64/string/strchr_v.S",
1133 "arch-riscv64/string/strcmp_v.S",
1134 "arch-riscv64/string/strcpy_v.S",
1135 "arch-riscv64/string/strlen_v.S",
1136 "arch-riscv64/string/strncat_v.S",
1137 "arch-riscv64/string/strncmp_v.S",
1138 "arch-riscv64/string/strncpy_v.S",
1139 "arch-riscv64/string/strnlen_v.S",
1140
1141 "arch-riscv64/string/memchr.c",
1142 "arch-riscv64/string/memcmp.c",
1143 "arch-riscv64/string/memcpy.c",
1144 "arch-riscv64/string/memmove.c",
1145 "arch-riscv64/string/memset.c",
1146 "arch-riscv64/string/stpcpy.c",
1147 "arch-riscv64/string/strcat.c",
1148 "arch-riscv64/string/strchr.c",
1149 "arch-riscv64/string/strcmp.c",
1150 "arch-riscv64/string/strcpy.c",
1151 "arch-riscv64/string/strlen.c",
1152 "arch-riscv64/string/strncat.c",
1153 "arch-riscv64/string/strncmp.c",
1154 "arch-riscv64/string/strncpy.c",
1155 "arch-riscv64/string/strnlen.c",
Prashanth Swaminathana4d71022023-10-30 17:35:19 -07001156
Elliott Hughes7d136662023-10-27 15:40:32 -07001157 "bionic/strchrnul.cpp",
1158 "bionic/strrchr.cpp",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001159 ],
1160 },
1161
Dan Willemsen208ae172015-09-16 16:33:27 -07001162 x86: {
1163 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001164 "arch-x86/bionic/__bionic_clone.S",
1165 "arch-x86/bionic/_exit_with_stack_teardown.S",
1166 "arch-x86/bionic/libcrt_compat.c",
Elliott Hughes7d136662023-10-27 15:40:32 -07001167 "arch-x86/bionic/setjmp.S",
1168 "arch-x86/bionic/syscall.S",
1169 "arch-x86/bionic/vfork.S",
1170 "arch-x86/bionic/__x86.get_pc_thunk.S",
1171
Elliott Hughesed777142022-07-25 16:25:11 +00001172 "arch-x86/string/sse2-memchr-atom.S",
1173 "arch-x86/string/sse2-memmove-slm.S",
1174 "arch-x86/string/sse2-memrchr-atom.S",
Elliott Hughesed777142022-07-25 16:25:11 +00001175 "arch-x86/string/sse2-memset-slm.S",
1176 "arch-x86/string/sse2-stpcpy-slm.S",
1177 "arch-x86/string/sse2-stpncpy-slm.S",
1178 "arch-x86/string/sse2-strchr-atom.S",
1179 "arch-x86/string/sse2-strcpy-slm.S",
1180 "arch-x86/string/sse2-strlen-slm.S",
1181 "arch-x86/string/sse2-strncpy-slm.S",
1182 "arch-x86/string/sse2-strnlen-atom.S",
1183 "arch-x86/string/sse2-strrchr-atom.S",
Elliott Hughesed777142022-07-25 16:25:11 +00001184
1185 "arch-x86/string/ssse3-memcmp-atom.S",
Elliott Hughesed777142022-07-25 16:25:11 +00001186 "arch-x86/string/ssse3-strcat-atom.S",
1187 "arch-x86/string/ssse3-strcmp-atom.S",
Elliott Hughesed777142022-07-25 16:25:11 +00001188 "arch-x86/string/ssse3-strlcat-atom.S",
1189 "arch-x86/string/ssse3-strlcpy-atom.S",
1190 "arch-x86/string/ssse3-strncat-atom.S",
1191 "arch-x86/string/ssse3-strncmp-atom.S",
Elliott Hughesed777142022-07-25 16:25:11 +00001192
1193 "arch-x86/string/sse4-memcmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001194
1195 "bionic/strchrnul.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001196 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001197 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001198 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001199 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001200 "arch-x86_64/bionic/__bionic_clone.S",
1201 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1202 "arch-x86_64/bionic/__restore_rt.S",
1203 "arch-x86_64/bionic/setjmp.S",
1204 "arch-x86_64/bionic/syscall.S",
1205 "arch-x86_64/bionic/vfork.S",
1206
ahs919fb7f2022-06-10 07:11:14 +05301207 "arch-x86_64/string/avx2-memset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001208 "arch-x86_64/string/sse2-memmove-slm.S",
1209 "arch-x86_64/string/sse2-memset-slm.S",
1210 "arch-x86_64/string/sse2-stpcpy-slm.S",
1211 "arch-x86_64/string/sse2-stpncpy-slm.S",
1212 "arch-x86_64/string/sse2-strcat-slm.S",
1213 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001214 "arch-x86_64/string/sse2-strlen-slm.S",
1215 "arch-x86_64/string/sse2-strncat-slm.S",
1216 "arch-x86_64/string/sse2-strncpy-slm.S",
1217 "arch-x86_64/string/sse4-memcmp-slm.S",
1218 "arch-x86_64/string/ssse3-strcmp-slm.S",
1219 "arch-x86_64/string/ssse3-strncmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001220
1221 "bionic/strchr.cpp",
1222 "bionic/strchrnul.cpp",
1223 "bionic/strnlen.cpp",
1224 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001225 ],
1226 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001227 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001228
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001229 multilib: {
1230 lib32: {
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001231 srcs: [
1232 // off64_t/time64_t support on LP32.
1233 "bionic/legacy_32_bit_support.cpp",
1234 "bionic/time64.c",
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001235 ],
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001236 },
1237 },
1238
1239 local_include_dirs: ["stdio"],
1240 generated_headers: ["generated_android_ids"],
1241
1242 whole_static_libs: [
1243 "libsystemproperties",
1244 ],
1245
Colin Cross50c21ab2015-10-31 23:03:05 -07001246 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001247 include_dirs: ["bionic/libstdc++/include"],
1248 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001249}
1250
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001251genrule {
1252 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001253 out: ["generated_android_ids.h"],
1254 srcs: [":android_filesystem_config_header"],
Cole Faustb1a0a9d2023-11-28 17:51:16 -08001255 tools: ["fs_config_generator"],
1256 cmd: "$(location fs_config_generator) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001257}
1258
Dan Willemsen268a6732015-10-15 14:49:45 -07001259// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001260// libc_syscalls.a
1261// ========================================================
1262
Elliott Hughes782c4852019-04-16 12:31:00 -07001263genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001264 name: "syscalls-arm",
Elliott Hughes782c4852019-04-16 12:31:00 -07001265 out: ["syscalls-arm.S"],
1266 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001267 tools: ["gensyscalls"],
1268 cmd: "$(location gensyscalls) arm $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001269}
1270
1271genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001272 name: "syscalls-arm64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001273 out: ["syscalls-arm64.S"],
1274 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001275 tools: ["gensyscalls"],
1276 cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001277}
1278
1279genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001280 name: "syscalls-riscv64",
Elliott Hughes704772b2022-10-10 17:06:43 +00001281 out: ["syscalls-riscv64.S"],
1282 srcs: ["SYSCALLS.TXT"],
1283 tools: ["gensyscalls"],
1284 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
1285}
1286
1287genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001288 name: "syscalls-x86",
Elliott Hughes782c4852019-04-16 12:31:00 -07001289 out: ["syscalls-x86.S"],
1290 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001291 tools: ["gensyscalls"],
1292 cmd: "$(location gensyscalls) x86 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001293}
1294
1295genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001296 name: "syscalls-x86_64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001297 out: ["syscalls-x86_64.S"],
1298 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001299 tools: ["gensyscalls"],
1300 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001301}
1302
Dan Willemsen208ae172015-09-16 16:33:27 -07001303cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001304 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001305 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001306 arch: {
1307 arm: {
Cole Faustf5968d82023-04-11 15:20:19 -07001308 srcs: [":syscalls-arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001309 },
1310 arm64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001311 srcs: [":syscalls-arm64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001312 },
Elliott Hughes704772b2022-10-10 17:06:43 +00001313 riscv64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001314 srcs: [":syscalls-riscv64"],
Elliott Hughes704772b2022-10-10 17:06:43 +00001315 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001316 x86: {
Cole Faustf5968d82023-04-11 15:20:19 -07001317 srcs: [":syscalls-x86"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001318 },
1319 x86_64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001320 srcs: [":syscalls-x86_64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001321 },
1322 },
1323 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001324}
1325
1326// ========================================================
1327// libc_aeabi.a
1328// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1329// to avoid infinite recursion. For the other architectures we just build an
1330// empty library to keep this makefile simple.
1331// ========================================================
1332
1333cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001334 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001335 arch: {
1336 arm: {
1337 srcs: ["arch-arm/bionic/__aeabi.c"],
1338 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001339 },
1340 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001341 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001342}
1343
1344// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001345// libc_common.a --- everything shared by libc.a and libc.so
Dan Willemsen208ae172015-09-16 16:33:27 -07001346// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001347
Dan Willemsen208ae172015-09-16 16:33:27 -07001348cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001349 defaults: ["libc_defaults"],
Elliott Hughesb0948922024-01-26 00:28:12 +00001350 name: "libc_common",
1351
Dan Willemsen208ae172015-09-16 16:33:27 -07001352 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001353 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001354 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001355 "libc_bionic",
Ryan Prichard249757b2019-11-01 17:18:28 -07001356 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001357 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001358 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001359 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001360 "libc_freebsd_large_stack",
Elliott Hughesc2043342023-07-20 20:24:09 +00001361 "libc_freebsd_ldexp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001362 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001363 "libc_netbsd",
1364 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001365 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001366 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001367 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001368 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001369 ],
1370
1371 arch: {
1372 arm: {
1373 whole_static_libs: ["libc_aeabi"],
1374 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001375 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001376}
1377
1378// ========================================================
Elliott Hughesadc41712024-08-16 13:08:11 +00001379// libc_static_dispatch.a/libc_dynamic_dispatch.a --- string/memory "ifuncs"
1380// (Actually ifuncs for libc.so, but a home-grown alternative for libc.a.)
Haibo Huangf71edfa2018-11-12 10:06:56 -08001381// ========================================================
Elliott Hughesadc41712024-08-16 13:08:11 +00001382
1383cc_defaults {
1384 name: "libc_dispatch_defaults",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001385 defaults: ["libc_defaults"],
Haibo Huangb9244ff2018-08-11 10:12:13 -07001386 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301387 x86_64: {
1388 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
1389 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001390 x86: {
1391 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1392 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001393 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001394 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001395 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001396 arm64: {
1397 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1398 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001399 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001400 srcs: ["arch-riscv64/dynamic_function_dispatch.cpp"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001401 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001402 },
Elliott Hughesadc41712024-08-16 13:08:11 +00001403 // Prevent the compiler from inserting calls to libc/taking the address of
1404 // a jump table from within an ifunc (or, in the static case, code that
1405 // can be executed arbitrarily early).
1406 cflags: [
1407 "-ffreestanding",
1408 "-fno-stack-protector",
1409 "-fno-jump-tables",
1410 ],
1411}
1412
1413cc_library_static {
1414 name: "libc_static_dispatch",
1415 defaults: ["libc_dispatch_defaults"],
1416 cflags: [
1417 "-DBIONIC_STATIC_DISPATCH",
1418 ],
1419}
1420
1421cc_library_static {
1422 name: "libc_dynamic_dispatch",
1423 defaults: ["libc_dispatch_defaults"],
1424 cflags: [
1425 "-DBIONIC_DYNAMIC_DISPATCH",
1426 ],
Ryan Prichard249757b2019-11-01 17:18:28 -07001427}
1428
1429// ========================================================
1430// libc_common_static.a For static binaries.
1431// ========================================================
1432cc_library_static {
1433 defaults: ["libc_defaults"],
1434 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001435
Haibo Huangf71edfa2018-11-12 10:06:56 -08001436 whole_static_libs: [
1437 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001438 "libc_static_dispatch",
1439 ],
1440}
1441
1442// ========================================================
1443// libc_common_shared.a For shared libraries.
1444// ========================================================
1445cc_library_static {
1446 defaults: ["libc_defaults"],
1447 name: "libc_common_shared",
1448
1449 whole_static_libs: [
1450 "libc_common",
1451 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001452 ],
1453}
1454
Ryan Prichard22a6a052019-10-10 23:59:30 -07001455// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1456// executable.
1457cc_library_static {
1458 name: "libc_unwind_static",
1459 defaults: ["libc_defaults"],
1460 cflags: ["-DLIBC_STATIC"],
1461
1462 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1463 arch: {
1464 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1465 arm: {
1466 srcs: ["arch-arm/bionic/exidx_static.c"],
1467 },
1468 },
1469}
1470
Haibo Huangf71edfa2018-11-12 10:06:56 -08001471// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001472// libc_nomalloc.a
1473// ========================================================
1474//
Ryan Prichard249757b2019-11-01 17:18:28 -07001475// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1476// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1477// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001478
1479cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001480 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001481 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001482
Colin Crossa3f9fca2016-01-11 13:20:55 -08001483 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001484 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001485 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001486 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001487 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001488}
1489
dimitryc0c0ef62018-12-05 16:33:52 +01001490filegroup {
1491 name: "libc_sources_shared",
1492 srcs: [
1493 "arch-common/bionic/crtbegin_so.c",
1494 "arch-common/bionic/crtbrand.S",
Christopher Ferris0ac5da02024-11-07 06:59:33 +00001495 "bionic/android_mallopt.cpp",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001496 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001497 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001498 "bionic/icu.cpp",
1499 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001500 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001501 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001502 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001503 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001504 "bionic/ndk_cruft.cpp",
1505 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001506 "bionic/NetdClient.cpp",
1507 "arch-common/bionic/crtend_so.S",
1508 ],
1509}
1510
1511filegroup {
1512 name: "libc_sources_static",
1513 srcs: [
Christopher Ferris0ac5da02024-11-07 06:59:33 +00001514 "bionic/android_mallopt.cpp",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001515 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001516 "bionic/heap_tagging.cpp",
Elliott Hughes72b0f3b2024-07-02 20:22:35 +00001517 "bionic/icu_static.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001518 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001519 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001520 ],
1521}
1522
1523filegroup {
1524 name: "libc_sources_shared_arm",
1525 srcs: [
1526 "arch-arm/bionic/exidx_dynamic.c",
1527 "arch-arm/bionic/atexit_legacy.c",
1528 ],
1529}
1530
Dan Willemsen208ae172015-09-16 16:33:27 -07001531// ========================================================
1532// libc.a + libc.so
1533// ========================================================
Florian Mayerc10d0642023-03-22 16:12:49 -07001534cc_defaults {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001535 defaults: [
1536 "libc_defaults",
1537 "libc_native_allocator_defaults",
Elliott Hughes788075a2024-06-18 12:25:37 +00001538 "bug_24465209_workaround",
Elliott Hughes89aada12024-07-01 21:59:04 +00001539 "keep_symbols",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001540 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001541 name: "libc_library_defaults",
Colin Cross50c21ab2015-10-31 23:03:05 -07001542 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001543 platform_sdk_version: {
1544 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1545 },
1546 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001547 static: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001548 srcs: [":libc_sources_static"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001549 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001550 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001551 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001552 "libc_init_static",
1553 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001554 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001555 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001556 },
1557 shared: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001558 srcs: [":libc_sources_shared"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001559 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001560 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001561 "libc_init_dynamic",
1562 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001563 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001564 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001565 },
1566
Neil Fullera7db90f2019-04-25 09:28:27 +01001567 required: [
MarkDacekd88d7ea2022-06-28 20:14:58 +00001568 "tzdata_prebuilt",
1569 "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
Neil Fullera7db90f2019-04-25 09:28:27 +01001570 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001571
Colin Cross4ce94d22016-11-15 13:15:43 -08001572 // Do not pack libc.so relocations; see http://b/20645321 for details.
1573 pack_relocations: false,
1574
dimitry06016f22018-01-05 11:39:28 +01001575 shared_libs: [
1576 "ld-android",
1577 "libdl",
1578 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001579 static_libs: [
1580 "libdl_android",
1581 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001582
1583 nocrt: true,
1584
Dan Willemsen208ae172015-09-16 16:33:27 -07001585 arch: {
1586 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001587 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001588 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001589
Dan Willemsen208ae172015-09-16 16:33:27 -07001590 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001591 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001592 // special for arm
1593 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Elliott Hughes89aada12024-07-01 21:59:04 +00001594 // For backwards compatibility, some arm32 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001595 static_libs: ["libclang_rt.builtins-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001596 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001597
Elliott Hughes89aada12024-07-01 21:59:04 +00001598 ldflags: [
1599 // Since we preserve the debug_frame for libc, do not compress
1600 // in this case to make unwinds as fast as possible.
1601 "-Wl,--compress-debug-sections=none",
1602 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001603 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001604 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001605 version_script: ":libc.arm64.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001606 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001607 riscv64: {
1608 version_script: ":libc.riscv64.map",
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001609 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001610 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001611 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001612 no_libcrt: true,
1613
1614 shared: {
Elliott Hughes89aada12024-07-01 21:59:04 +00001615 // For backwards compatibility, some x86 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001616 static_libs: ["libclang_rt.builtins-exported"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001617 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001618 },
1619 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001620 version_script: ":libc.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001621 },
1622 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001623
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001624 apex_available: [
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001625 "com.android.runtime",
1626 ],
1627
Colin Cross7edd0082021-10-28 13:20:35 -07001628 target: {
1629 native_bridge: {
1630 shared: {
1631 installable: false,
1632 },
1633 },
1634 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001635}
1636
Florian Mayerc10d0642023-03-22 16:12:49 -07001637cc_library {
1638 name: "libc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001639 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001640 "libc_library_defaults",
1641 ],
1642 stubs: {
1643 symbol_file: "libc.map.txt",
1644 versions: [
1645 "29",
1646 "R",
1647 "current",
1648 ],
1649 },
1650 static_ndk_lib: true,
1651 llndk: {
1652 symbol_file: "libc.map.txt",
1653 export_headers_as_system: true,
Dan Alberte9f02e02024-08-28 23:20:20 +00001654 export_llndk_headers: ["libc_headers"],
Florian Mayerc10d0642023-03-22 16:12:49 -07001655 },
1656}
1657
1658cc_library {
1659 name: "libc_hwasan",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001660 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001661 "libc_library_defaults",
1662 ],
1663 sanitize: {
1664 hwaddress: true,
1665 },
1666 enabled: false,
Florian Mayerff116ed2023-04-14 17:38:53 -07001667 target: {
1668 android_arm64: {
Florian Mayerc10d0642023-03-22 16:12:49 -07001669 enabled: true,
1670 },
1671 },
1672 stem: "libc",
1673 relative_install_path: "hwasan",
1674 // We don't really need the stubs, but this needs to stay to trigger the
1675 // symlink logic in soong.
1676 stubs: {
1677 symbol_file: "libc.map.txt",
1678 },
1679 native_bridge_supported: false,
1680 // It is never correct to depend on this directly. This is only
1681 // needed for the runtime apex, and in base_system.mk.
1682 visibility: ["//bionic/apex"],
1683}
1684
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001685genrule {
1686 name: "libc.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001687 out: ["libc.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001688 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001689 tools: ["generate-version-script"],
1690 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001691}
1692
1693genrule {
1694 name: "libc.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001695 out: ["libc.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001696 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001697 tools: ["generate-version-script"],
1698 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001699}
1700
1701genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001702 name: "libc.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001703 out: ["libc.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001704 srcs: ["libc.map.txt"],
1705 tools: ["generate-version-script"],
1706 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1707}
1708
1709genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001710 name: "libc.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001711 out: ["libc.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001712 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001713 tools: ["generate-version-script"],
1714 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001715}
1716
1717genrule {
1718 name: "libc.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001719 out: ["libc.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001720 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001721 tools: ["generate-version-script"],
1722 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001723}
1724
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001725// Headers that only other parts of the platform can include.
1726cc_library_headers {
1727 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001728 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001729 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001730 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001731 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001732 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001733 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001734 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001735 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001736 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001737 "//system/core/debuggerd:__subpackages__",
Florian Mayerf5d70ce2022-09-13 13:58:30 -07001738 "//system/core/init:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001739 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001740 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001741 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001742 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001743 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001744 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001745 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001746 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001747 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001748 recovery_available: true,
1749 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001750 export_include_dirs: [
1751 "platform",
1752 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001753 system_shared_libs: [],
1754 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001755 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001756
Steven Moreland0cdf1322020-10-05 21:55:26 +00001757 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001758 apex_available: [
1759 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001760 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001761 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001762}
1763
Logan Chien17af91b2019-01-15 21:19:56 +08001764cc_library_headers {
Dan Albert64a6efc2024-08-29 19:04:59 +00001765 name: "libc_uapi_headers",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001766 visibility: [
1767 "//external/musl",
Alistair Delvabad22722024-10-07 12:52:40 -07001768 "//external/rust/crates/v4l2r/android",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001769 ],
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001770 llndk: {
1771 llndk_headers: true,
1772 },
Logan Chien17af91b2019-01-15 21:19:56 +08001773 host_supported: true,
1774 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001775 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001776 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001777 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001778 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001779 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001780 apex_available: [
1781 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001782 "//apex_available:anyapex",
1783 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001784 // used by most APEXes indirectly via libunwind_llvm
1785 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001786
1787 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001788 stl: "none",
1789 system_shared_libs: [],
1790
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001791 // The build system generally requires that any dependencies of a target
1792 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1793 // to 1 we let targets with an sdk_version that need to depend on the libc
1794 // headers but cannot depend on libc itself due to circular dependencies
1795 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1796 // is correct because the headers can support any sdk_version.
1797 sdk_version: "1",
1798
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001799 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001800 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001801 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001802 "kernel/android/uapi",
1803 ],
1804
1805 arch: {
1806 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001807 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001808 },
1809 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001810 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001811 },
Elliott Hughes48e53332022-10-07 20:39:25 +00001812 riscv64: {
1813 export_system_include_dirs: ["kernel/uapi/asm-riscv"],
1814 },
Logan Chien17af91b2019-01-15 21:19:56 +08001815 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001816 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001817 },
1818 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001819 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001820 },
1821 },
1822}
1823
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001824cc_library_headers {
1825 name: "libc_headers",
1826 host_supported: true,
1827 native_bridge_supported: true,
1828 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001829 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001830 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001831 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001832 recovery_available: true,
1833 sdk_version: "1",
1834
1835 apex_available: [
1836 "//apex_available:platform",
1837 "//apex_available:anyapex",
1838 ],
1839 // used by most APEXes indirectly via libunwind_llvm
1840 min_sdk_version: "apex_inherit",
1841 visibility: [
1842 "//bionic:__subpackages__", // visible to bionic
1843 // ... and only to these places (b/152668052)
1844 "//external/arm-optimized-routines",
1845 "//external/gwp_asan",
1846 "//external/jemalloc_new",
1847 "//external/libunwind_llvm",
Nick Desaulniers942ae552024-02-12 10:26:19 -08001848 "//external/llvm-libc",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001849 "//external/scudo",
1850 "//system/core/property_service/libpropertyinfoparser",
1851 "//system/extras/toolchain-extras",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001852 ],
1853
1854 stl: "none",
1855 no_libcrt: true,
1856 system_shared_libs: [],
1857
1858 target: {
1859 android: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001860 export_system_include_dirs: ["include"],
Dan Albert64a6efc2024-08-29 19:04:59 +00001861 header_libs: ["libc_uapi_headers"],
1862 export_header_lib_headers: ["libc_uapi_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001863 },
1864 linux_bionic: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001865 export_system_include_dirs: ["include"],
Dan Albert64a6efc2024-08-29 19:04:59 +00001866 header_libs: ["libc_uapi_headers"],
1867 export_header_lib_headers: ["libc_uapi_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001868 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001869 },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001870}
1871
Dan Willemsen208ae172015-09-16 16:33:27 -07001872// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001873// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001874// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001875
Dan Willemsen208ae172015-09-16 16:33:27 -07001876cc_library {
Elliott Hughes788075a2024-06-18 12:25:37 +00001877 defaults: [
1878 "libc_defaults",
1879 "bug_24465209_workaround",
1880 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001881 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001882 srcs: [
1883 "bionic/__cxa_guard.cpp",
1884 "bionic/__cxa_pure_virtual.cpp",
1885 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001886 ],
1887 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001888 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001889 static_libs: ["libasync_safe"],
Elliott Hughesc2043342023-07-20 20:24:09 +00001890 apex_available: [
1891 "//apex_available:platform",
1892 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001893
Dan Willemsen6b3be172018-12-03 13:57:20 -08001894 static: {
1895 system_shared_libs: [],
1896 },
Colin Crossb5bfe0b2021-07-13 16:26:28 -07001897 target: {
1898 bionic: {
1899 shared: {
1900 system_shared_libs: ["libc"],
1901 },
1902 },
Dan Willemsen6b3be172018-12-03 13:57:20 -08001903 },
1904
Dan Willemsen208ae172015-09-16 16:33:27 -07001905 arch: {
1906 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001907 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001908 },
1909 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001910 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001911 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001912 riscv64: {
1913 version_script: ":libstdc++.riscv64.map",
1914 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001915 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001916 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001917 },
1918 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001919 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001920 },
1921 },
1922}
1923
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001924genrule {
1925 name: "libstdc++.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001926 out: ["libstdc++.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001927 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001928 tools: ["generate-version-script"],
1929 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001930}
1931
1932genrule {
1933 name: "libstdc++.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001934 out: ["libstdc++.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001935 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001936 tools: ["generate-version-script"],
1937 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001938}
1939
1940genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001941 name: "libstdc++.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001942 out: ["libstdc++.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001943 srcs: ["libstdc++.map.txt"],
1944 tools: ["generate-version-script"],
1945 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1946}
1947
1948genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001949 name: "libstdc++.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001950 out: ["libstdc++.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001951 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001952 tools: ["generate-version-script"],
1953 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001954}
1955
1956genrule {
1957 name: "libstdc++.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001958 out: ["libstdc++.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001959 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001960 tools: ["generate-version-script"],
1961 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001962}
1963
1964// ========================================================
1965// crt object files.
1966// ========================================================
1967
Colin Cross50c21ab2015-10-31 23:03:05 -07001968cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07001969 name: "crt_and_memtag_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001970 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001971 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001972 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001973 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001974 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001975 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001976 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001977 apex_available: [
1978 "//apex_available:platform",
1979 "//apex_available:anyapex",
1980 ],
Dan Albertdc503f62020-07-15 17:22:18 -07001981 // Generate NDK variants of the CRT objects for every supported API level.
1982 min_sdk_version: "16",
1983 stl: "none",
1984 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001985 cflags: [
1986 "-Wno-gcc-compat",
1987 "-Wall",
1988 "-Werror",
1989 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07001990 sanitize: {
1991 never: true,
1992 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001993}
1994
Colin Cross50c21ab2015-10-31 23:03:05 -07001995cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07001996 name: "crt_defaults",
1997 defaults: ["crt_and_memtag_defaults"],
Colin Cross02f81372021-07-22 12:02:10 -07001998 system_shared_libs: [],
Colin Cross10d92682021-06-22 13:25:46 -07001999}
2000
2001cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002002 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002003 defaults: ["crt_defaults"],
Colin Crossab179442018-09-27 11:03:22 -07002004 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002005}
2006
Dan Willemsen208ae172015-09-16 16:33:27 -07002007cc_object {
2008 name: "crtbrand",
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002009 local_include_dirs: [
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002010 "private", // crtbrand.S depends on private/bionic_asm_note.h
2011 ],
Elliott Hughes6a30b712024-03-13 23:41:32 +00002012 // crtbrand.S needs to know the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002013 product_variables: {
2014 platform_sdk_version: {
2015 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2016 },
2017 },
2018 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002019
Colin Cross7d7b3682017-11-03 13:38:40 -07002020 defaults: ["crt_so_defaults"],
Dan Alberteee46dc2023-04-04 23:27:52 +00002021 // crtbrand is an intermediate artifact, not a final CRT object.
2022 exclude_from_ndk_sysroot: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07002023}
2024
Dan Willemsen208ae172015-09-16 16:33:27 -07002025cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002026 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002027 local_include_dirs: ["include"],
2028 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002029
Colin Cross7d7b3682017-11-03 13:38:40 -07002030 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002031 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002032 "crtbrand",
2033 ],
2034}
2035
Dan Willemsen208ae172015-09-16 16:33:27 -07002036cc_object {
2037 name: "crtend_so",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002038 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002039 "private", // crtend_so.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002040 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002041 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002042
Colin Cross7d7b3682017-11-03 13:38:40 -07002043 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002044}
2045
Dan Willemsen208ae172015-09-16 16:33:27 -07002046cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002047 name: "crtbegin_static",
2048
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002049 local_include_dirs: [
2050 "include",
2051 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2052 ],
Liz Kammere718dd72021-03-09 15:00:06 -05002053
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002054 cflags: ["-DCRTBEGIN_STATIC"],
Yabin Cui744cfd32023-08-24 13:20:23 -07002055
Dan Willemsen208ae172015-09-16 16:33:27 -07002056 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002057 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002058 "crtbrand",
2059 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002060 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002061 // When using libc.a, we're using the latest library regardless of target API level.
2062 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002063}
2064
Dan Willemsen208ae172015-09-16 16:33:27 -07002065cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002066 name: "crtbegin_dynamic",
2067
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002068 local_include_dirs: [
2069 "include",
2070 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2071 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002072 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002073 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002074 "crtbrand",
2075 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002076 target: {
2077 linux_bionic: {
2078 generated_sources: ["host_bionic_linker_asm"],
2079 objs: [
2080 "linker_wrapper",
2081 ],
2082 },
2083 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002084 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002085}
2086
Dan Willemsen208ae172015-09-16 16:33:27 -07002087cc_object {
2088 // We rename crtend.o to crtend_android.o to avoid a
2089 // name clash between gcc and bionic.
2090 name: "crtend_android",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002091 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002092 "private", // crtend.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002093 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002094 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002095
Colin Cross50c21ab2015-10-31 23:03:05 -07002096 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002097}
Colin Crossbaa48992016-07-13 11:15:21 -07002098
Kalesh Singh862a23d2024-01-09 13:13:50 -08002099cc_object {
2100 name: "crt_pad_segment",
2101 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002102 "private", // crt_pad_segment.S depends on private/bionic_asm_note.h
Kalesh Singh862a23d2024-01-09 13:13:50 -08002103 ],
2104 srcs: ["arch-common/bionic/crt_pad_segment.S"],
2105
2106 defaults: ["crt_defaults"],
2107}
2108
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002109cc_library_static {
2110 name: "note_memtag_heap_async",
2111 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002112 arm64: {
2113 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2114 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002115 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002116 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002117
Colin Cross10d92682021-06-22 13:25:46 -07002118 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002119}
2120
2121cc_library_static {
2122 name: "note_memtag_heap_sync",
2123 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002124 arm64: {
2125 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2126 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002127 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002128 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002129
Colin Cross10d92682021-06-22 13:25:46 -07002130 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002131}
2132
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002133// ========================================================
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002134// libc dependencies for baremetal Rust projects.
2135// ========================================================
2136
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002137// This library contains the following unresolved symbols:
2138// __errno
2139// abort
2140// async_safe_fatal_va_list
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002141cc_library_static {
2142 name: "librust_baremetal",
Pierre-Clément Tosi9018e5f2024-10-02 15:57:00 +01002143 defaults: ["cc_baremetal_defaults"],
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002144 header_libs: ["libc_headers"],
2145 include_dirs: [
2146 "bionic/libc/async_safe/include",
2147 "bionic/libc/platform",
2148 ],
2149 cflags: [
2150 "-Wall",
2151 "-Werror",
2152 ],
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002153 srcs: [
2154 "bionic/fortify.cpp",
Pierre-Clément Tosi816176c2022-11-30 14:33:41 +00002155 "bionic/strtol.cpp",
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002156 ],
2157 arch: {
2158 arm64: {
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002159 srcs: [
2160 "arch-arm64/string/__memcpy_chk.S",
2161 ],
2162 },
caowencheng9a39eb32023-03-20 16:24:41 +08002163 riscv64: {
2164 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002165 "arch-riscv64/string/__memcpy_chk.S",
caowencheng9a39eb32023-03-20 16:24:41 +08002166 ],
2167 },
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002168 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002169 whole_static_libs: [
2170 "libarm-optimized-routines-mem",
Pierre-Clément Tosieb46ac92023-02-01 13:44:57 +00002171 "libc_netbsd",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002172 ],
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002173 system_shared_libs: [],
2174 nocrt: true,
2175 stl: "none",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002176 visibility: [
Jiyong Park072ce532024-07-22 11:20:47 +09002177 "//packages/modules/Virtualization/libs/libvmbase",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002178 ],
Zijun427504a2024-08-15 23:16:27 +00002179
2180 // b/358211032: This library gets linked into a rust rlib. Disable LTO
2181 // until cross-language lto is supported.
2182 lto: {
2183 never: true,
2184 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002185}
2186
2187// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002188// NDK headers.
2189// ========================================================
2190
Dan Albertcce54372024-08-22 18:24:30 +00002191ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002192 name: "common_libc",
2193 from: "include",
2194 to: "",
Dan Albertcce54372024-08-22 18:24:30 +00002195 srcs: ["include/**/*.h"],
Dan Albert22805ea2017-03-22 15:28:05 -07002196 license: "NOTICE",
Dan Albertcce54372024-08-22 18:24:30 +00002197 // These don't pass the bad verification we do because many of them are
2198 // arch-specific, and they aren't necessarily independently includable.
2199 // That's not much of a problem though, since C-incompaitibilities in the
2200 // UAPI headers should run into problems long before they reach us.
2201 skip_verification: true,
Dan Albert22805ea2017-03-22 15:28:05 -07002202}
Dan Albert4238a352016-06-28 11:18:05 -07002203
2204ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002205 name: "libc_uapi",
2206 from: "kernel/uapi",
2207 to: "",
2208 srcs: [
2209 "kernel/uapi/asm-generic/**/*.h",
2210 "kernel/uapi/drm/**/*.h",
2211 "kernel/uapi/linux/**/*.h",
2212 "kernel/uapi/misc/**/*.h",
2213 "kernel/uapi/mtd/**/*.h",
2214 "kernel/uapi/rdma/**/*.h",
2215 "kernel/uapi/scsi/**/*.h",
2216 "kernel/uapi/sound/**/*.h",
2217 "kernel/uapi/video/**/*.h",
2218 "kernel/uapi/xen/**/*.h",
2219 ],
Dan Albert92592652016-10-20 01:42:54 -07002220 license: "NOTICE",
Dan Albert6aa62772024-08-13 22:01:23 +00002221 skip_verification: true,
Dan Albert4238a352016-06-28 11:18:05 -07002222}
2223
2224ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002225 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002226 from: "kernel/android/uapi/linux",
2227 to: "linux",
2228 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002229 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002230}
2231
2232ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002233 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002234 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002235 to: "scsi",
2236 srcs: ["kernel/android/scsi/**/*.h"],
2237 license: "NOTICE",
Dan Albert6aa62772024-08-13 22:01:23 +00002238 skip_verification: true,
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002239}
2240
2241ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002242 name: "libc_asm_arm",
2243 from: "kernel/uapi/asm-arm",
2244 to: "arm-linux-androideabi",
2245 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002246 license: "NOTICE",
Dan Albert6aa62772024-08-13 22:01:23 +00002247 skip_verification: true,
Dan Albert4238a352016-06-28 11:18:05 -07002248}
2249
2250ndk_headers {
2251 name: "libc_asm_arm64",
2252 from: "kernel/uapi/asm-arm64",
2253 to: "aarch64-linux-android",
2254 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002255 license: "NOTICE",
Dan Albert6aa62772024-08-13 22:01:23 +00002256 skip_verification: true,
Dan Albert4238a352016-06-28 11:18:05 -07002257}
2258
Lazar Trsic790d2f72017-11-27 11:54:11 +01002259ndk_headers {
Colin Crossbd26e0f2022-10-19 15:03:14 -07002260 name: "libc_asm_riscv64",
2261 from: "kernel/uapi/asm-riscv",
2262 to: "riscv64-linux-android",
2263 srcs: ["kernel/uapi/asm-riscv/**/*.h"],
2264 license: "NOTICE",
Dan Albert6aa62772024-08-13 22:01:23 +00002265 skip_verification: true,
Colin Crossbd26e0f2022-10-19 15:03:14 -07002266}
2267
2268ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002269 name: "libc_asm_x86",
2270 from: "kernel/uapi/asm-x86",
2271 to: "i686-linux-android",
2272 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002273 license: "NOTICE",
Dan Albert6aa62772024-08-13 22:01:23 +00002274 skip_verification: true,
Dan Albert4238a352016-06-28 11:18:05 -07002275}
2276
2277ndk_headers {
2278 name: "libc_asm_x86_64",
2279 from: "kernel/uapi/asm-x86",
2280 to: "x86_64-linux-android",
2281 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002282 license: "NOTICE",
Dan Albert6aa62772024-08-13 22:01:23 +00002283 skip_verification: true,
Dan Albert4238a352016-06-28 11:18:05 -07002284}
2285
Dan Albert4238a352016-06-28 11:18:05 -07002286ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002287 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002288 symbol_file: "libc.map.txt",
2289 first_version: "9",
2290}
2291
Dan Albertdf31aff2016-10-06 15:50:41 -07002292ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002293 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002294 symbol_file: "libstdc++.map.txt",
2295 first_version: "9",
2296}
2297
Dan Willemsenca056d72018-01-08 14:00:24 -08002298// Export these headers for toolbox to process
2299filegroup {
2300 name: "kernel_input_headers",
2301 srcs: [
2302 "kernel/uapi/linux/input.h",
2303 "kernel/uapi/linux/input-event-codes.h",
2304 ],
2305}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002306
2307// Generate a syscall name / number mapping. These objects are text files
2308// (thanks to the -dD -E flags) and not binary files. They will then be
2309// consumed by the genseccomp.py script and converted into C++ code.
2310cc_defaults {
2311 name: "libseccomp_gen_syscall_nrs_defaults",
2312 recovery_available: true,
2313 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2314 cflags: [
2315 "-dD",
2316 "-E",
2317 "-Wall",
2318 "-Werror",
2319 "-nostdinc",
2320 ],
2321}
2322
2323cc_object {
2324 name: "libseccomp_gen_syscall_nrs_arm",
2325 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2326 local_include_dirs: [
2327 "kernel/uapi/asm-arm",
2328 "kernel/uapi",
2329 ],
2330}
2331
2332cc_object {
2333 name: "libseccomp_gen_syscall_nrs_arm64",
2334 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2335 local_include_dirs: [
2336 "kernel/uapi/asm-arm64",
2337 "kernel/uapi",
2338 ],
2339}
2340
2341cc_object {
Elliott Hughes704772b2022-10-10 17:06:43 +00002342 name: "libseccomp_gen_syscall_nrs_riscv64",
2343 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2344 local_include_dirs: [
2345 "kernel/uapi/asm-riscv",
2346 "kernel/uapi",
2347 ],
2348}
2349
2350cc_object {
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002351 name: "libseccomp_gen_syscall_nrs_x86",
2352 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2353 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2354 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2355 local_include_dirs: [
2356 "kernel/uapi/asm-x86",
2357 "kernel/uapi",
2358 ],
2359}
2360
2361cc_object {
2362 name: "libseccomp_gen_syscall_nrs_x86_64",
2363 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2364 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2365 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2366 local_include_dirs: [
2367 "kernel/uapi/asm-x86",
2368 "kernel/uapi",
2369 ],
2370}
2371
Jingwen Chenca366332021-01-29 05:16:32 -05002372filegroup {
2373 name: "all_kernel_uapi_headers",
2374 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002375}
2376
Martijn Coenen0c6de752019-01-02 12:52:51 +01002377cc_genrule {
2378 name: "func_to_syscall_nrs",
2379 recovery_available: true,
2380 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2381
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002382 tools: ["genfunctosyscallnrs"],
Martijn Coenen0c6de752019-01-02 12:52:51 +01002383
2384 srcs: [
2385 "SYSCALLS.TXT",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002386 ],
2387
Elliott Hughes704772b2022-10-10 17:06:43 +00002388 arch: {
2389 arm: {
2390 srcs: [
2391 ":libseccomp_gen_syscall_nrs_arm",
2392 ":libseccomp_gen_syscall_nrs_arm64",
2393 ],
2394 },
2395 arm64: {
2396 srcs: [
2397 ":libseccomp_gen_syscall_nrs_arm",
2398 ":libseccomp_gen_syscall_nrs_arm64",
2399 ],
2400 },
2401 riscv64: {
2402 srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
2403 },
2404 x86: {
2405 srcs: [
2406 ":libseccomp_gen_syscall_nrs_x86",
2407 ":libseccomp_gen_syscall_nrs_x86_64",
2408 ],
2409 },
2410 x86_64: {
2411 srcs: [
2412 ":libseccomp_gen_syscall_nrs_x86",
2413 ":libseccomp_gen_syscall_nrs_x86_64",
2414 ],
2415 },
2416 },
2417
Martijn Coenen0c6de752019-01-02 12:52:51 +01002418 out: [
2419 "func_to_syscall_nrs.h",
2420 ],
2421}
2422
Victor Hsiehdbb86702020-06-15 09:29:07 -07002423// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002424genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002425 name: "generate_app_zygote_blocklist",
2426 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2427 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002428 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2429}
2430
Yu Liu938ec9b2022-10-17 16:36:30 -07002431filegroup {
2432 name: "seccomp_syscalls_sources_zygote",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002433 srcs: [
2434 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002435 "SECCOMP_ALLOWLIST_COMMON.TXT",
2436 "SECCOMP_ALLOWLIST_APP.TXT",
2437 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002438 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002439 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002440 ],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002441}
2442
Yu Liu938ec9b2022-10-17 16:36:30 -07002443filegroup {
2444 name: "seccomp_syscalls_sources_app",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002445 srcs: [
2446 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002447 "SECCOMP_ALLOWLIST_COMMON.TXT",
2448 "SECCOMP_ALLOWLIST_APP.TXT",
2449 "SECCOMP_BLOCKLIST_COMMON.TXT",
2450 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002451 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002452 ],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002453}
2454
Yu Liu938ec9b2022-10-17 16:36:30 -07002455filegroup {
2456 name: "seccomp_syscalls_sources_system",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002457 srcs: [
2458 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002459 "SECCOMP_ALLOWLIST_COMMON.TXT",
2460 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2461 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002462 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002463 ],
Yu Liu938ec9b2022-10-17 16:36:30 -07002464}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002465
Yu Liu938ec9b2022-10-17 16:36:30 -07002466cc_genrule {
2467 name: "libseccomp_policy_app_zygote_sources_x86",
2468 recovery_available: true,
2469 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002470 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002471 srcs: [
2472 ":seccomp_syscalls_sources_zygote",
2473 ":libseccomp_gen_syscall_nrs_x86",
2474 ":libseccomp_gen_syscall_nrs_x86_64",
2475 ],
2476 out: [
2477 "x86_app_zygote_policy.cpp",
2478 "x86_64_app_zygote_policy.cpp",
2479 ],
2480 enabled: false,
Yu Liu3a579692022-10-18 03:02:32 +00002481 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002482 x86: {
2483 enabled: true,
2484 },
2485 x86_64: {
2486 enabled: true,
2487 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002488 },
2489}
2490
2491cc_genrule {
2492 name: "libseccomp_policy_app_zygote_sources_arm",
2493 recovery_available: true,
2494 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002495 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002496 srcs: [
2497 ":seccomp_syscalls_sources_zygote",
2498 ":libseccomp_gen_syscall_nrs_arm",
2499 ":libseccomp_gen_syscall_nrs_arm64",
2500 ],
2501 out: [
2502 "arm_app_zygote_policy.cpp",
2503 "arm64_app_zygote_policy.cpp",
2504 ],
2505 enabled: false,
2506 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002507 arm: {
2508 enabled: true,
2509 },
2510 arm64: {
2511 enabled: true,
2512 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002513 },
2514}
2515
2516cc_genrule {
2517 name: "libseccomp_policy_app_zygote_sources_riscv64",
2518 recovery_available: true,
2519 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002520 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002521 srcs: [
2522 ":seccomp_syscalls_sources_zygote",
2523 ":libseccomp_gen_syscall_nrs_riscv64",
2524 ],
2525 out: [
2526 "riscv64_app_zygote_policy.cpp",
2527 ],
2528 enabled: false,
2529 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002530 riscv64: {
2531 enabled: true,
2532 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002533 },
2534}
2535
2536cc_genrule {
2537 name: "libseccomp_policy_app_sources_x86",
2538 recovery_available: true,
2539 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002540 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002541 srcs: [
2542 ":seccomp_syscalls_sources_app",
2543 ":libseccomp_gen_syscall_nrs_x86",
2544 ":libseccomp_gen_syscall_nrs_x86_64",
2545 ],
2546 out: [
2547 "x86_app_policy.cpp",
2548 "x86_64_app_policy.cpp",
2549 ],
2550 enabled: false,
2551 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002552 x86: {
2553 enabled: true,
2554 },
2555 x86_64: {
2556 enabled: true,
2557 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002558 },
2559}
2560
2561cc_genrule {
2562 name: "libseccomp_policy_app_sources_arm",
2563 recovery_available: true,
2564 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002565 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002566 srcs: [
2567 ":seccomp_syscalls_sources_app",
2568 ":libseccomp_gen_syscall_nrs_arm",
2569 ":libseccomp_gen_syscall_nrs_arm64",
2570 ],
2571 out: [
2572 "arm_app_policy.cpp",
2573 "arm64_app_policy.cpp",
2574 ],
2575 enabled: false,
2576 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002577 arm: {
2578 enabled: true,
2579 },
2580 arm64: {
2581 enabled: true,
2582 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002583 },
2584}
2585
2586cc_genrule {
2587 name: "libseccomp_policy_app_sources_riscv64",
2588 recovery_available: true,
2589 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002590 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002591 srcs: [
2592 ":seccomp_syscalls_sources_app",
2593 ":libseccomp_gen_syscall_nrs_riscv64",
2594 ],
2595 out: [
2596 "riscv64_app_policy.cpp",
2597 ],
2598 enabled: false,
2599 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002600 riscv64: {
2601 enabled: true,
2602 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002603 },
2604}
2605
2606cc_genrule {
2607 name: "libseccomp_policy_system_sources_x86",
2608 recovery_available: true,
2609 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002610 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002611 srcs: [
2612 ":seccomp_syscalls_sources_system",
2613 ":libseccomp_gen_syscall_nrs_x86",
2614 ":libseccomp_gen_syscall_nrs_x86_64",
2615 ],
2616 out: [
2617 "x86_system_policy.cpp",
2618 "x86_64_system_policy.cpp",
2619 ],
2620 enabled: false,
2621 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002622 x86: {
2623 enabled: true,
2624 },
2625 x86_64: {
2626 enabled: true,
2627 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002628 },
2629}
2630
2631cc_genrule {
2632 name: "libseccomp_policy_system_sources_arm",
2633 recovery_available: true,
2634 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002635 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002636 srcs: [
2637 ":seccomp_syscalls_sources_system",
2638 ":libseccomp_gen_syscall_nrs_arm",
2639 ":libseccomp_gen_syscall_nrs_arm64",
2640 ],
2641 out: [
2642 "arm_system_policy.cpp",
2643 "arm64_system_policy.cpp",
2644 ],
2645 enabled: false,
2646 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002647 arm: {
2648 enabled: true,
2649 },
2650 arm64: {
2651 enabled: true,
2652 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002653 },
2654}
2655
2656cc_genrule {
2657 name: "libseccomp_policy_system_sources_riscv64",
2658 recovery_available: true,
2659 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002660 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002661 srcs: [
2662 ":seccomp_syscalls_sources_system",
2663 ":libseccomp_gen_syscall_nrs_riscv64",
2664 ],
2665 out: [
2666 "riscv64_system_policy.cpp",
2667 ],
2668 enabled: false,
2669 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002670 riscv64: {
2671 enabled: true,
2672 },
Yu Liu3a579692022-10-18 03:02:32 +00002673 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002674}
2675
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002676cc_library {
2677 name: "libseccomp_policy",
2678 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002679 generated_headers: ["func_to_syscall_nrs"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002680
2681 arch: {
2682 arm: {
2683 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002684 "libseccomp_policy_app_sources_arm",
2685 "libseccomp_policy_app_zygote_sources_arm",
2686 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002687 ],
2688 },
2689 arm64: {
2690 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002691 "libseccomp_policy_app_sources_arm",
2692 "libseccomp_policy_app_zygote_sources_arm",
2693 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002694 ],
2695 },
2696 riscv64: {
2697 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002698 "libseccomp_policy_app_sources_riscv64",
2699 "libseccomp_policy_app_zygote_sources_riscv64",
2700 "libseccomp_policy_system_sources_riscv64",
Yu Liu938ec9b2022-10-17 16:36:30 -07002701 ],
2702 },
2703 x86: {
2704 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002705 "libseccomp_policy_app_sources_x86",
2706 "libseccomp_policy_app_zygote_sources_x86",
2707 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002708 ],
2709 },
2710 x86_64: {
2711 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002712 "libseccomp_policy_app_sources_x86",
2713 "libseccomp_policy_app_zygote_sources_x86",
2714 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002715 ],
2716 },
2717 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002718
2719 srcs: [
2720 "seccomp/seccomp_policy.cpp",
2721 ],
2722
2723 export_include_dirs: ["seccomp/include"],
2724 cflags: [
2725 "-Wall",
2726 "-Werror",
2727 ],
2728 shared: {
2729 shared_libs: ["libbase"],
2730 },
2731 static: {
2732 static_libs: ["libbase"],
2733 },
2734}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002735
Colin Cross048f24e2021-09-01 17:26:00 -07002736cc_library_host_static {
2737 name: "libfts",
2738 srcs: [
2739 "bionic/fts.c",
2740 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
2741 ],
2742 export_include_dirs: ["fts/include"],
2743 local_include_dirs: [
2744 "private",
2745 "upstream-openbsd/android/include",
2746 ],
2747 cflags: [
2748 "-include openbsd-compat.h",
2749 "-Wno-unused-parameter",
2750 ],
2751 enabled: false,
2752 target: {
2753 musl: {
2754 enabled: true,
2755 },
2756 },
Colin Cross2a9843f2022-01-13 12:26:30 -08002757 stl: "none",
2758}
2759
2760cc_library_host_static {
2761 name: "libexecinfo",
2762 visibility: ["//external/musl"],
2763 srcs: ["bionic/execinfo.cpp"],
2764 export_include_dirs: ["execinfo/include"],
2765 local_include_dirs: ["private"],
2766 enabled: false,
2767 target: {
2768 musl: {
2769 enabled: true,
2770 system_shared_libs: [],
2771 header_libs: ["libc_musl_headers"],
2772 },
2773 },
2774 stl: "none",
Colin Cross048f24e2021-09-01 17:26:00 -07002775}
2776
Colin Cross9da85fa2022-01-24 18:20:05 -08002777cc_library_host_static {
2778 name: "libb64",
2779 visibility: ["//external/musl"],
2780 srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
2781 export_include_dirs: ["b64/include"],
2782 local_include_dirs: [
2783 "private",
2784 "upstream-openbsd/android/include",
2785 ],
2786 cflags: [
2787 "-include openbsd-compat.h",
2788 ],
2789 enabled: false,
2790 target: {
2791 musl: {
2792 enabled: true,
2793 system_shared_libs: [],
2794 header_libs: ["libc_musl_headers"],
2795 },
2796 },
2797 stl: "none",
2798}
2799
Colin Cross9d4a56e2022-02-03 10:20:32 -08002800// Export kernel uapi headers to be used in the musl sysroot.
2801// Also include the execinfo headers for the libexecinfo and the
2802// b64 headers for libb64 embedded in musl libc.
2803cc_genrule {
2804 name: "libc_musl_sysroot_bionic_headers",
2805 visibility: ["//external/musl"],
2806 host_supported: true,
2807 device_supported: false,
2808 enabled: false,
2809 target: {
2810 musl: {
2811 enabled: true,
2812 },
2813 },
2814 srcs: [
2815 "kernel/uapi/**/*.h",
2816 "kernel/android/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002817 "execinfo/include/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002818 "b64/include/**/*.h",
Colin Crossaeef9f02022-02-07 21:01:26 -08002819
Colin Crossaeef9f02022-02-07 21:01:26 -08002820 "NOTICE",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002821
2822 ":libc_musl_sysroot_bionic_arch_headers",
2823 ],
2824 out: ["libc_musl_sysroot_bionic_headers.zip"],
2825 tools: [
2826 "soong_zip",
2827 "merge_zips",
2828 "zip2zip",
2829 ],
Colin Crossaeef9f02022-02-07 21:01:26 -08002830 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
2831 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
Colin Crossad33d022022-02-25 18:27:04 -08002832 // NOTICE
2833 " -j -f $(location NOTICE) " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002834 // headers
2835 " -P include " +
Colin Crossaeef9f02022-02-07 21:01:26 -08002836 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
2837 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
2838 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2839 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2840 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2841 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2842 " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
2843 " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
2844 " -C $${BIONIC_LIBC_DIR}/b64/include " +
2845 " -D $${BIONIC_LIBC_DIR}/b64/include " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002846 " && " +
Colin Crossad33d022022-02-25 18:27:04 -08002847 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
Colin Cross1c0a7a02022-08-11 12:22:26 -07002848 " -x **/BUILD " +
Colin Crossad33d022022-02-25 18:27:04 -08002849 " include/**/*:include/ " +
2850 " NOTICE:NOTICE.bionic " +
2851 " && " +
2852 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002853}
2854
2855// The architecture-specific bits have to be handled separately because the label varies based
2856// on architecture, which prevents using $(locations) to find them and requires using $(in)
2857// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
2858// genrule.
2859cc_genrule {
2860 name: "libc_musl_sysroot_bionic_arch_headers",
2861 visibility: ["//visibility:private"],
2862 host_supported: true,
2863 device_supported: false,
2864 enabled: false,
2865 target: {
2866 musl: {
2867 enabled: true,
2868 },
2869 },
2870 arch: {
2871 arm: {
2872 srcs: ["kernel/uapi/asm-arm/**/*.h"],
2873 },
2874 arm64: {
2875 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
2876 },
2877 x86: {
2878 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2879 },
2880 x86_64: {
2881 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2882 },
2883 },
2884 out: ["libc_musl_sysroot_bionic_arch_headers.zip"],
2885 tools: ["soong_zip"],
2886 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
2887}
Colin Cross290c4952022-10-13 12:51:13 -07002888
2889cc_genrule {
2890 name: "bionic_sysroot_crt_objects",
2891 visibility: ["//visibility:private"],
2892 out: ["bionic_sysroot_crt_objects.zip"],
2893 tools: ["soong_zip"],
2894 srcs: [
2895 ":crtbegin_dynamic",
2896 ":crtbegin_so",
2897 ":crtbegin_static",
2898 ":crtend_android",
2899 ":crtend_so",
2900 ],
2901 cmd: "$(location soong_zip) -o $(out) -j " +
2902 "-f $(location :crtbegin_dynamic) " +
2903 "-f $(location :crtbegin_so) " +
2904 "-f $(location :crtbegin_static) " +
2905 "-f $(location :crtend_android) " +
2906 "-f $(location :crtend_so)",
2907 dist: {
2908 targets: ["bionic_sysroot_crt_objects"],
2909 },
2910 arch: {
2911 arm: {
2912 dist: {
2913 suffix: "_arm",
2914 },
2915 },
2916 arm64: {
2917 dist: {
2918 suffix: "_arm64",
2919 },
2920 },
2921 riscv64: {
2922 dist: {
2923 suffix: "_riscv64",
2924 },
2925 },
2926 x86: {
2927 dist: {
2928 suffix: "_x86",
2929 },
2930 },
2931 x86_64: {
2932 dist: {
2933 suffix: "_x86_64",
2934 },
2935 },
2936 },
2937}
Spandan Das8fce52a2023-09-28 18:00:12 +00002938
Jiyong Park35a280d2024-05-03 16:53:39 +09002939filegroup {
2940 name: "linux_capability_header",
2941 srcs: ["kernel/uapi/linux/capability.h"],
2942}