blob: bc933e0ee4cb8afc55819cfdf61ec8ab2fb8e4ae [file] [log] [blame]
Bob Badouraa7d8352021-02-19 13:06:22 -08001package {
2 default_applicable_licenses: ["bionic_libc_license"],
3}
4
5license {
6 name: "bionic_libc_license",
7 visibility: [":__subpackages__"],
8 license_kinds: [
9 "SPDX-license-identifier-Apache-2.0",
10 "SPDX-license-identifier-BSD",
11 "SPDX-license-identifier-ISC",
12 "SPDX-license-identifier-MIT",
13 "legacy_notice",
14 "legacy_unencumbered",
15 ],
16 license_text: [
17 "NOTICE",
18 ],
19}
20
Elliott Hughes53cf3482016-08-09 13:06:41 -070021libc_common_flags = [
22 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080023 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070024 "-Wall",
25 "-Wextra",
26 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080027 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070028 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070029 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070030 "-Wframe-larger-than=2048",
Christopher Ferris1de7a482023-09-12 11:06:29 -070031 "-Wno-reorder-init-list",
Elliott Hughes53cf3482016-08-09 13:06:41 -070032
33 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
34 "-Werror=pointer-to-int-cast",
35 "-Werror=int-to-pointer-cast",
36 "-Werror=type-limits",
37 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080038
39 // Clang's exit-time destructor registration hides __dso_handle, but
40 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
41 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080042
Elliott Hughesa13d0662021-12-02 14:42:16 -080043 // We know clang does a lot of harm by rewriting what we've said, and sadly
44 // never see any good it does, so let's just ask it to do what we say...
45 // (The specific motivating example was clang turning a loop that would only
46 // ever touch 0, 1, or 2 bytes into a call to memset, which was never going
47 // to amortize.)
48 "-fno-builtin",
Elliott Hughes53cf3482016-08-09 13:06:41 -070049]
50
Dan Willemsen208ae172015-09-16 16:33:27 -070051// Define some common cflags
52// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070053cc_defaults {
54 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080055 defaults: ["linux_bionic_supported"],
Christopher Ferrisb5425052024-04-23 17:15:39 -070056 cflags: libc_common_flags + [
57 "-DUSE_SCUDO",
58 ],
Elliott Hughes53cf3482016-08-09 13:06:41 -070059 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070060 conlyflags: ["-std=gnu99"],
61 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070062 include_dirs: [
63 "bionic/libc/async_safe/include",
Peter Collingbourne5d3aa862020-09-11 15:05:17 -070064 "bionic/libc/platform",
Tom Cherry379ed1e2020-09-17 09:36:25 -070065 // For android_filesystem_config.h.
66 "system/core/libcutils/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070067 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070068
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010069 header_libs: [
70 "libc_headers",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +000071 "liblog_headers", // needed by bionic/libc/async_safe/include
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010072 ],
73 export_header_lib_headers: [
74 "libc_headers",
75 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -080076
Colin Cross50c21ab2015-10-31 23:03:05 -070077 stl: "none",
78 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070079 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070080 address: false,
81 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070082 // TODO(b/132640749): Fix broken fuzzer support.
83 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070084 },
Yifan Hong5a39cee2020-01-21 16:43:56 -080085 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -070086 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090087 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020088 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080089
Yi Konge3d90de2019-02-20 14:28:56 -080090 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
91 // warning since this is intended right now.
92 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070093
94 product_variables: {
Evgenii Stepanov5a73e032020-04-29 14:59:44 -070095 malloc_zero_contents: {
96 cflags: ["-DSCUDO_ZERO_CONTENTS"],
97 },
98 malloc_pattern_fill_contents: {
99 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
100 },
Christopher Ferrisb5425052024-04-23 17:15:39 -0700101 malloc_low_memory: {
102 cflags: ["-UUSE_SCUDO"],
Steven Morelandfb65ee42020-07-31 00:18:38 +0000103 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700104 },
Yi Kong9e33b762021-10-29 02:43:22 +0800105
106 lto: {
107 never: true,
108 },
Elliott Hughesc2043342023-07-20 20:24:09 +0000109
110 apex_available: ["com.android.runtime"],
Elliott Hughes7d136662023-10-27 15:40:32 -0700111
112 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700113}
114
Elliott Hughes788075a2024-06-18 12:25:37 +0000115// Workaround for b/24465209.
116// We're unlikely to be able to remove this before we just
117// remove ILP32 support completely.
118// Note that we also still have `pack_relocations: false`
119// for both libc and libm, even on LP64.
120// ========================================================
121cc_defaults {
122 name: "bug_24465209_workaround",
Elliott Hughesfeb94732024-06-18 19:44:18 +0000123 target: {
124 android_arm: {
Elliott Hughes788075a2024-06-18 12:25:37 +0000125 pack_relocations: false,
126 ldflags: ["-Wl,--hash-style=both"],
127 },
Elliott Hughesfeb94732024-06-18 19:44:18 +0000128 android_x86: {
Elliott Hughes788075a2024-06-18 12:25:37 +0000129 pack_relocations: false,
130 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesb4e02782024-06-21 11:35:18 +0000131 },
Elliott Hughes788075a2024-06-18 12:25:37 +0000132 },
133}
134
Elliott Hughes89aada12024-07-01 21:59:04 +0000135// Leave the symbols in the shared library so that stack unwinders can produce
136// meaningful name resolution. This is a bit more ugly than it sounds because
137// arm32 is a bit broken.
138// ========================================================
139cc_defaults {
140 name: "keep_symbols",
141 arch: {
142 arm: {
143 // arm32 does not produce complete exidx unwind information,
144 // so keep the .debug_frame which is relatively small and does
145 // include needed unwind information.
146 // See b/132992102 for details.
147 strip: {
148 keep_symbols_and_debug_frame: true,
149 },
150 },
151 arm64: {
152 strip: {
153 keep_symbols: true,
154 },
155 },
156 riscv64: {
157 strip: {
158 keep_symbols: true,
159 },
160 },
161 x86: {
162 strip: {
163 keep_symbols: true,
164 },
165 },
166 x86_64: {
167 strip: {
168 keep_symbols: true,
169 },
170 },
171 },
172}
173
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700174// Defaults for native allocator libs/includes to make it
175// easier to change.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700176// ========================================================
177cc_defaults {
178 name: "libc_native_allocator_defaults",
179
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700180 whole_static_libs: [
Christopher Ferrisb5425052024-04-23 17:15:39 -0700181 "libscudo",
182 ],
183 cflags: [
184 "-DUSE_SCUDO",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700185 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800186 header_libs: ["gwp_asan_headers"],
Christopher Ferrisb5425052024-04-23 17:15:39 -0700187 product_variables: {
188 malloc_low_memory: {
189 cflags: ["-UUSE_SCUDO"],
190 whole_static_libs: [
191 "libjemalloc5",
192 "libc_jemalloc_wrapper",
193 ],
194 exclude_static_libs: [
195 "libscudo",
196 ],
197 },
198 },
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700199}
200
201// Functions not implemented by jemalloc directly, or that need to
202// be modified for Android.
203cc_library_static {
204 name: "libc_jemalloc_wrapper",
205 defaults: ["libc_defaults"],
206 srcs: ["bionic/jemalloc_wrapper.cpp"],
207 cflags: ["-fvisibility=hidden"],
208
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800209 // Used to pull in the jemalloc include directory so that if the
210 // library is removed, the include directory is also removed.
211 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700212}
213
Dan Willemsen208ae172015-09-16 16:33:27 -0700214// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700215// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700216// ========================================================
217//
Ryan Prichard249757b2019-11-01 17:18:28 -0700218// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
219// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
220// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
221// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700222
223cc_library_static {
224
Colin Crossa3f9fca2016-01-11 13:20:55 -0800225 srcs: [
226 "bionic/__libc_init_main_thread.cpp",
227 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700228 "bionic/bionic_call_ifunc_resolver.cpp",
229 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800230 ],
231 arch: {
232 arm64: {
233 srcs: ["arch-arm64/bionic/__set_tls.c"],
234 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000235 riscv64: {
236 srcs: ["arch-riscv64/bionic/__set_tls.c"],
237 },
Colin Crossa3f9fca2016-01-11 13:20:55 -0800238 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700239 srcs: [
240 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Pirama Arumuga Nainar7b89be72021-02-12 15:09:49 -0800241 "arch-x86/bionic/__libc_int0x80.S",
Ryan Prichard27475b52018-05-17 17:14:18 -0700242 "arch-x86/bionic/__set_tls.cpp",
243 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800244 },
245 x86_64: {
246 srcs: ["arch-x86_64/bionic/__set_tls.c"],
247 },
248 },
249
Colin Cross50c21ab2015-10-31 23:03:05 -0700250 defaults: ["libc_defaults"],
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000251 cflags: [
252 "-fno-stack-protector",
253 "-ffreestanding",
254 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700255 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700256}
257
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800258filegroup {
259 name: "elf_note_sources",
260 srcs: ["bionic/elf_note.cpp"],
261}
262
Ryan Prichard249757b2019-11-01 17:18:28 -0700263// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
264// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
265// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800266
267cc_library_static {
268 name: "libc_init_static",
269 defaults: ["libc_defaults"],
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800270 srcs: [
271 "bionic/libc_init_static.cpp",
272 ":elf_note_sources",
273 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700274 cflags: [
275 "-fno-stack-protector",
276
277 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
278 // from the linker before ifunc resolvers have made string.h functions available.
279 "-ffreestanding",
280 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800281}
282
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700283cc_library_static {
284 name: "libc_init_dynamic",
285 defaults: ["libc_defaults"],
286 srcs: ["bionic/libc_init_dynamic.cpp"],
287 cflags: ["-fno-stack-protector"],
288}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800289
Dan Willemsen208ae172015-09-16 16:33:27 -0700290// ========================================================
291// libc_tzcode.a - upstream 'tzcode' code
292// ========================================================
293
294cc_library_static {
295
Colin Cross50c21ab2015-10-31 23:03:05 -0700296 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700297 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800298 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700299 "tzcode/bionic.cpp",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700300 // tzcode doesn't include strptime, so we use a fork of the
301 // OpenBSD code which needs this global data.
Elliott Hughesd3627a42022-12-06 22:24:27 +0000302 "upstream-openbsd/lib/libc/locale/_def_time.c",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700303 // tzcode doesn't include wcsftime, so we use the FreeBSD code.
304 "upstream-freebsd/lib/libc/locale/wcsftime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700305 ],
306
Colin Cross50c21ab2015-10-31 23:03:05 -0700307 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700308 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700309 // Don't use ridiculous amounts of stack.
310 "-DALL_STATE",
311 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
312 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800313 // Obviously, we want to be thread-safe.
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000314 "-DTHREAD_SAFE=1",
Dan Willemsen208ae172015-09-16 16:33:27 -0700315 // The name of the tm_gmtoff field in our struct tm.
316 "-DTM_GMTOFF=tm_gmtoff",
Elliott Hughes31fc69f2023-06-20 15:36:11 -0700317 // Android uses a system property instead of /etc/localtime, so make callers crash.
Almaz Mingaleeva52a0da2022-02-28 16:55:50 +0000318 "-DTZDEFAULT=NULL",
Dan Willemsen208ae172015-09-16 16:33:27 -0700319 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700320 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700321 // Include `tzname`, `timezone`, and `daylight` globals.
322 "-DHAVE_POSIX_DECLS=0",
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000323 "-DUSG_COMPAT=2",
324 "-DHAVE_TZNAME=2",
325 // stdbool.h is available
326 "-DHAVE_STDBOOL_H",
Colin Crossa35d23d2015-11-19 13:32:49 -0800327 // Use the empty string (instead of " ") as the timezone abbreviation
328 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700329 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700330 "-Dlint",
331 ],
332
Elliott Hughes2bd43162023-06-15 13:17:08 -0700333 local_include_dirs: [
334 "tzcode/",
335 "upstream-freebsd/android/include",
336 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700337 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700338}
339
340// ========================================================
341// libc_dns.a - modified NetBSD DNS code
342// ========================================================
343
344cc_library_static {
345
Colin Cross50c21ab2015-10-31 23:03:05 -0700346 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700347 srcs: [
Elliott Hughesd0bbfa82021-04-08 11:58:51 -0700348 "dns/**/*.c*",
Dan Willemsen208ae172015-09-16 16:33:27 -0700349
350 "upstream-netbsd/lib/libc/isc/ev_streams.c",
351 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700352 ],
353
Colin Cross50c21ab2015-10-31 23:03:05 -0700354 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700355 "-DANDROID_CHANGES",
356 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700357 "-Wno-unused-parameter",
358 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700359 "-Wframe-larger-than=66000",
Elliott Hughese1dc4f62021-01-11 11:51:29 -0800360 "-include private/bsd_sys_param.h",
Dan Willemsen208ae172015-09-16 16:33:27 -0700361 ],
362
Dan Willemsen208ae172015-09-16 16:33:27 -0700363 local_include_dirs: [
364 "dns/include",
365 "private",
366 "upstream-netbsd/lib/libc/include",
367 "upstream-netbsd/android/include",
368 ],
369
370 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700371}
372
373// ========================================================
374// libc_freebsd.a - upstream FreeBSD C library code
375// ========================================================
376//
377// These files are built with the freebsd-compat.h header file
378// automatically included.
379
380cc_library_static {
Elliott Hughesc2043342023-07-20 20:24:09 +0000381 name: "libc_freebsd_ldexp",
382 defaults: ["libc_defaults"],
383 cflags: ["-Dscalbn=ldexp"],
384 srcs: [":libc_ldexp_srcs"],
385}
386
387cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700388 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700389 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700390 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700391 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
392 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
393 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
394 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700395 "upstream-freebsd/lib/libc/stdlib/qsort.c",
396 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700397 "upstream-freebsd/lib/libc/string/wcpcpy.c",
398 "upstream-freebsd/lib/libc/string/wcpncpy.c",
399 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700400 "upstream-freebsd/lib/libc/string/wcscat.c",
401 "upstream-freebsd/lib/libc/string/wcschr.c",
402 "upstream-freebsd/lib/libc/string/wcscmp.c",
403 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700404 "upstream-freebsd/lib/libc/string/wcscspn.c",
405 "upstream-freebsd/lib/libc/string/wcsdup.c",
406 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700407 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700408 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
409 "upstream-freebsd/lib/libc/string/wcsncat.c",
410 "upstream-freebsd/lib/libc/string/wcsncmp.c",
411 "upstream-freebsd/lib/libc/string/wcsncpy.c",
412 "upstream-freebsd/lib/libc/string/wcsnlen.c",
413 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700414 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700415 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700416 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700417 "upstream-freebsd/lib/libc/string/wcstok.c",
418 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700419 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700420 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700421 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800422 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700423 ],
424 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700425 x86: {
426 exclude_srcs: [
427 "upstream-freebsd/lib/libc/string/wcschr.c",
428 "upstream-freebsd/lib/libc/string/wcscmp.c",
429 "upstream-freebsd/lib/libc/string/wcslen.c",
430 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700431 "upstream-freebsd/lib/libc/string/wmemcmp.c",
432 "upstream-freebsd/lib/libc/string/wcscat.c",
433 "upstream-freebsd/lib/libc/string/wcscpy.c",
434 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700435 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700436 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700437 },
438
Colin Cross50c21ab2015-10-31 23:03:05 -0700439 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700440 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700441 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700442 "-include freebsd-compat.h",
443 ],
444
Dan Willemsen208ae172015-09-16 16:33:27 -0700445 local_include_dirs: [
446 "upstream-freebsd/android/include",
447 ],
448
449 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700450}
451
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700452cc_library_static {
453 defaults: ["libc_defaults"],
454 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700455 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700456 ],
457
458 cflags: [
459 "-Wno-sign-compare",
460 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700461 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700462 ],
463
464 local_include_dirs: [
465 "upstream-freebsd/android/include",
466 ],
467
468 name: "libc_freebsd_large_stack",
469}
470
Dan Willemsen208ae172015-09-16 16:33:27 -0700471// ========================================================
472// libc_netbsd.a - upstream NetBSD C library code
473// ========================================================
474//
475// These files are built with the netbsd-compat.h header file
476// automatically included.
477
478cc_library_static {
479
Colin Cross50c21ab2015-10-31 23:03:05 -0700480 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700481 srcs: [
482 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700483 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700484 "upstream-netbsd/lib/libc/gen/psignal.c",
485 "upstream-netbsd/lib/libc/gen/utime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700486 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
487 "upstream-netbsd/lib/libc/regex/regcomp.c",
488 "upstream-netbsd/lib/libc/regex/regerror.c",
489 "upstream-netbsd/lib/libc/regex/regexec.c",
490 "upstream-netbsd/lib/libc/regex/regfree.c",
491 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700492 "upstream-netbsd/lib/libc/stdlib/drand48.c",
493 "upstream-netbsd/lib/libc/stdlib/erand48.c",
494 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
495 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700496 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
497 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
498 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
499 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
500 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
501 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
502 "upstream-netbsd/lib/libc/stdlib/seed48.c",
503 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700504 ],
505 multilib: {
506 lib32: {
507 // LP32 cruft
508 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
509 },
510 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700511 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700512 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800513 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700514 "-DPOSIX_MISTAKE",
515 "-include netbsd-compat.h",
516 ],
517
Dan Willemsen208ae172015-09-16 16:33:27 -0700518 local_include_dirs: [
519 "upstream-netbsd/android/include",
520 "upstream-netbsd/lib/libc/include",
521 ],
522
523 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700524}
525
526// ========================================================
Elliott Hughes968adf92024-02-08 13:15:53 -0800527// libc_openbsd.a - upstream OpenBSD C library code
Dan Willemsen208ae172015-09-16 16:33:27 -0700528// ========================================================
529//
530// These files are built with the openbsd-compat.h header file
531// automatically included.
Dan Willemsen208ae172015-09-16 16:33:27 -0700532cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700533 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700534 srcs: [
Elliott Hughes968adf92024-02-08 13:15:53 -0800535 "upstream-openbsd/lib/libc/crypt/arc4random.c",
536 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700537 "upstream-openbsd/lib/libc/gen/alarm.c",
538 "upstream-openbsd/lib/libc/gen/ctype_.c",
539 "upstream-openbsd/lib/libc/gen/daemon.c",
540 "upstream-openbsd/lib/libc/gen/err.c",
541 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700542 "upstream-openbsd/lib/libc/gen/fnmatch.c",
543 "upstream-openbsd/lib/libc/gen/ftok.c",
544 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700546 "upstream-openbsd/lib/libc/gen/verr.c",
547 "upstream-openbsd/lib/libc/gen/verrx.c",
548 "upstream-openbsd/lib/libc/gen/vwarn.c",
549 "upstream-openbsd/lib/libc/gen/vwarnx.c",
550 "upstream-openbsd/lib/libc/gen/warn.c",
551 "upstream-openbsd/lib/libc/gen/warnx.c",
552 "upstream-openbsd/lib/libc/locale/btowc.c",
553 "upstream-openbsd/lib/libc/locale/mbrlen.c",
554 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
555 "upstream-openbsd/lib/libc/locale/mbtowc.c",
556 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700557 "upstream-openbsd/lib/libc/locale/wcstombs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700558 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
559 "upstream-openbsd/lib/libc/locale/wctob.c",
560 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700561 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700562 "upstream-openbsd/lib/libc/net/htonl.c",
563 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700564 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
565 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
566 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700567 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
568 "upstream-openbsd/lib/libc/net/inet_ntop.c",
569 "upstream-openbsd/lib/libc/net/inet_pton.c",
570 "upstream-openbsd/lib/libc/net/ntohl.c",
571 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800572 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700573 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700574 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
575 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700576 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700577 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700578 "upstream-openbsd/lib/libc/stdio/fputwc.c",
579 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700580 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700581 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700582 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700583 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700584 "upstream-openbsd/lib/libc/stdio/makebuf.c",
585 "upstream-openbsd/lib/libc/stdio/mktemp.c",
586 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
587 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700588 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700589 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700590 "upstream-openbsd/lib/libc/stdio/ungetc.c",
591 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
592 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
593 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700594 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
595 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
596 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700597 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700598 "upstream-openbsd/lib/libc/stdio/wsetup.c",
599 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800600 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700601 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700602 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700603 "upstream-openbsd/lib/libc/stdlib/insque.c",
604 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
605 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
606 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800607 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700608 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800609 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700610 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughes26b06072020-07-31 11:00:10 -0700611 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700612 "upstream-openbsd/lib/libc/stdlib/remque.c",
613 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700614 "upstream-openbsd/lib/libc/stdlib/tfind.c",
615 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800616 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700617 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800618 "upstream-openbsd/lib/libc/string/strcasestr.c",
619 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700620 "upstream-openbsd/lib/libc/string/strcspn.c",
621 "upstream-openbsd/lib/libc/string/strdup.c",
622 "upstream-openbsd/lib/libc/string/strndup.c",
623 "upstream-openbsd/lib/libc/string/strpbrk.c",
624 "upstream-openbsd/lib/libc/string/strsep.c",
625 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700626 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800627 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700628 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700629 "upstream-openbsd/lib/libc/string/wcswidth.c",
Colin Cross69bcb8b2021-09-08 13:24:16 -0700630
631 // This file is originally from OpenBSD, and benefits from
632 // being compiled with openbsd-compat.h.
Elliott Hughes968adf92024-02-08 13:15:53 -0800633 // TODO: clean this up instead.
Colin Cross69bcb8b2021-09-08 13:24:16 -0700634 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700635 ],
636
Elliott Hughes7d136662023-10-27 15:40:32 -0700637 // Each architecture has optimized versions of some routines,
638 // and only includes the portable C versions of ones it's missing.
Dan Willemsen208ae172015-09-16 16:33:27 -0700639 arch: {
640 arm: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700641 srcs: [
642 "upstream-openbsd/lib/libc/string/memchr.c",
643 "upstream-openbsd/lib/libc/string/memrchr.c",
644 "upstream-openbsd/lib/libc/string/stpncpy.c",
645 "upstream-openbsd/lib/libc/string/strlcat.c",
646 "upstream-openbsd/lib/libc/string/strlcpy.c",
647 "upstream-openbsd/lib/libc/string/strncat.c",
648 "upstream-openbsd/lib/libc/string/strncmp.c",
649 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700650 ],
651 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700652 arm64: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700653 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700654 "upstream-openbsd/lib/libc/string/strcat.c",
Elliott Hughesaefe9992023-11-08 12:04:41 -0800655 "upstream-openbsd/lib/libc/string/stpncpy.c",
Elliott Hughes7d136662023-10-27 15:40:32 -0700656 "upstream-openbsd/lib/libc/string/strlcat.c",
657 "upstream-openbsd/lib/libc/string/strlcpy.c",
658 "upstream-openbsd/lib/libc/string/strncat.c",
659 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700660 ],
661 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000662 riscv64: {
663 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700664 "upstream-openbsd/lib/libc/string/memrchr.c",
665 "upstream-openbsd/lib/libc/string/stpncpy.c",
666 "upstream-openbsd/lib/libc/string/strlcat.c",
667 "upstream-openbsd/lib/libc/string/strlcpy.c",
Elliott Hughesebc19a92022-10-14 23:25:36 +0000668 ],
669 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700670 x86: {
Elliott Hughesaefe9992023-11-08 12:04:41 -0800671 srcs: [
672 // x86 has custom implementations of all of these.
673 ],
Elliott Hughes7d136662023-10-27 15:40:32 -0700674 },
675 x86_64: {
676 srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800677 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800678 "upstream-openbsd/lib/libc/string/memrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700679 "upstream-openbsd/lib/libc/string/strlcat.c",
680 "upstream-openbsd/lib/libc/string/strlcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800681 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700682 },
683 },
684
Colin Cross50c21ab2015-10-31 23:03:05 -0700685 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700686 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700687 "-Wno-unused-parameter",
688 "-include openbsd-compat.h",
689 ],
690
Dan Willemsen208ae172015-09-16 16:33:27 -0700691 local_include_dirs: [
692 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700693 "upstream-openbsd/android/include",
Elliott Hughes968adf92024-02-08 13:15:53 -0800694 "stdio",
695 "upstream-openbsd/lib/libc/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700696 ],
697
698 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700699}
700
Elliott Hughes968adf92024-02-08 13:15:53 -0800701cc_library_static {
702 name: "libc_openbsd_large_stack",
703 defaults: ["libc_defaults"],
704 srcs: [
705 "stdio/vfprintf.cpp",
706 "stdio/vfwprintf.cpp",
707 "upstream-openbsd/lib/libc/string/memmem.c",
708 "upstream-openbsd/lib/libc/string/strstr.c",
709 ],
710 cflags: [
711 "-include openbsd-compat.h",
712 "-Wno-sign-compare",
713 "-Wframe-larger-than=5000",
714 ],
715
716 local_include_dirs: [
717 "private",
718 "upstream-openbsd/android/include/",
719 "upstream-openbsd/lib/libc/gdtoa/",
720 "upstream-openbsd/lib/libc/include/",
721 "upstream-openbsd/lib/libc/stdio/",
722 ],
723}
724
Dan Willemsen208ae172015-09-16 16:33:27 -0700725// ========================================================
726// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
727// ========================================================
728//
729// These files are built with the openbsd-compat.h header file
730// automatically included.
731
732cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700733 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700734 srcs: [
735 "upstream-openbsd/android/gdtoa_support.cpp",
736 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
737 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
738 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
739 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
740 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
741 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
742 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
743 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
744 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
745 "upstream-openbsd/lib/libc/gdtoa/misc.c",
746 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
747 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
748 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
749 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
750 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
751 "upstream-openbsd/lib/libc/gdtoa/sum.c",
752 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
753 ],
754 multilib: {
755 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800756 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700757 },
758 },
759
Colin Cross50c21ab2015-10-31 23:03:05 -0700760 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700761 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700762 "-include openbsd-compat.h",
763 ],
764
Dan Willemsen208ae172015-09-16 16:33:27 -0700765 local_include_dirs: [
766 "private",
767 "upstream-openbsd/android/include",
768 "upstream-openbsd/lib/libc/include",
769 ],
770
771 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700772}
773
774// ========================================================
Pierre-Clément Tosi467e58e2023-02-01 13:44:43 +0000775// libc_fortify.a - container for our FORTIFY
George Burgess IV6cb06872017-07-21 13:28:42 -0700776// implementation details
777// ========================================================
778cc_library_static {
779 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700780 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700781
782 name: "libc_fortify",
783
784 // Disable FORTIFY for the compilation of these, so we don't end up having
785 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800786 cflags: [
787 "-U_FORTIFY_SOURCE",
788 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
789 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700790
791 arch: {
792 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800793 cflags: [
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800794 "-DRENAME___STRCAT_CHK",
795 "-DRENAME___STRCPY_CHK",
796 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700797 srcs: [
798 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800799
800 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
801 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
802
803 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
804 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
805
806 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
807 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
808
809 "arch-arm/krait/bionic/__strcat_chk.S",
810 "arch-arm/krait/bionic/__strcpy_chk.S",
811
812 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
813 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
814
Haibo Huang01bfd892018-12-03 15:05:16 -0800815 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
816 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700817 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700818 },
819 arm64: {
820 srcs: [
Elliott Hughes023e4e72022-11-17 19:27:02 +0000821 "arch-arm64/string/__memcpy_chk.S",
822 "arch-arm64/string/__memset_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700823 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700824 },
caowenchengab457f92023-03-06 14:57:55 +0800825 riscv64: {
826 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000827 "arch-riscv64/string/__memset_chk.S",
828 "arch-riscv64/string/__memcpy_chk.S",
caowenchengab457f92023-03-06 14:57:55 +0800829 ],
830 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700831 },
832}
833
834// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700835// libc_bionic.a - home-grown C library code
836// ========================================================
837
838cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700839 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700840 srcs: [
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800841 "bionic/NetdClientDispatch.cpp",
842 "bionic/__bionic_get_shell_path.cpp",
843 "bionic/__cmsg_nxthdr.cpp",
844 "bionic/__cxa_thread_atexit_impl.cpp",
845 "bionic/__errno.cpp",
846 "bionic/__gnu_basename.cpp",
847 "bionic/__libc_current_sigrtmax.cpp",
848 "bionic/__libc_current_sigrtmin.cpp",
849 "bionic/abort.cpp",
850 "bionic/accept.cpp",
851 "bionic/access.cpp",
Florian Mayerca4749a2024-02-14 12:55:46 -0800852 "bionic/android_crash_detail.cpp",
Josh Gao10ec9282017-04-03 15:13:29 -0700853 "bionic/android_set_abort_message.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000854 "bionic/android_unsafe_frame_pointer_chase.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800855 "bionic/arpa_inet.cpp",
856 "bionic/assert.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000857 "bionic/atexit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800858 "bionic/atof.cpp",
859 "bionic/bionic_allocator.cpp",
860 "bionic/bionic_arc4random.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000861 "bionic/bionic_elf_tls.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800862 "bionic/bionic_futex.cpp",
863 "bionic/bionic_netlink.cpp",
864 "bionic/bionic_systrace.cpp",
865 "bionic/bionic_time_conversions.cpp",
866 "bionic/brk.cpp",
867 "bionic/c16rtomb.cpp",
868 "bionic/c32rtomb.cpp",
869 "bionic/chmod.cpp",
870 "bionic/chown.cpp",
871 "bionic/clearenv.cpp",
872 "bionic/clock.cpp",
873 "bionic/clock_getcpuclockid.cpp",
874 "bionic/clock_nanosleep.cpp",
875 "bionic/clone.cpp",
876 "bionic/ctype.cpp",
877 "bionic/dirent.cpp",
878 "bionic/dup.cpp",
879 "bionic/environ.cpp",
880 "bionic/error.cpp",
881 "bionic/eventfd.cpp",
882 "bionic/exec.cpp",
883 "bionic/execinfo.cpp",
Elliott Hughes69bd8e92024-02-09 10:04:26 -0800884 "bionic/exit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800885 "bionic/faccessat.cpp",
886 "bionic/fchmod.cpp",
887 "bionic/fchmodat.cpp",
888 "bionic/fcntl.cpp",
889 "bionic/fdsan.cpp",
890 "bionic/fdtrack.cpp",
891 "bionic/ffs.cpp",
892 "bionic/fgetxattr.cpp",
893 "bionic/flistxattr.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000894 "bionic/fork.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800895 "bionic/fpclassify.cpp",
896 "bionic/fsetxattr.cpp",
897 "bionic/ftruncate.cpp",
898 "bionic/ftw.cpp",
899 "bionic/futimens.cpp",
900 "bionic/getcwd.cpp",
901 "bionic/getdomainname.cpp",
902 "bionic/getentropy.cpp",
903 "bionic/gethostname.cpp",
904 "bionic/getloadavg.cpp",
905 "bionic/getpagesize.cpp",
906 "bionic/getpgrp.cpp",
907 "bionic/getpid.cpp",
908 "bionic/getpriority.cpp",
909 "bionic/gettid.cpp",
910 "bionic/get_device_api_level.cpp",
911 "bionic/grp_pwd.cpp",
912 "bionic/grp_pwd_file.cpp",
913 "bionic/heap_zero_init.cpp",
914 "bionic/iconv.cpp",
915 "bionic/icu_wrappers.cpp",
916 "bionic/ifaddrs.cpp",
917 "bionic/inotify_init.cpp",
918 "bionic/ioctl.cpp",
Elliott Hughes17e40682024-02-13 16:32:29 -0800919 "bionic/isatty.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800920 "bionic/killpg.cpp",
921 "bionic/langinfo.cpp",
922 "bionic/lchown.cpp",
923 "bionic/lfs64_support.cpp",
924 "bionic/libc_init_common.cpp",
925 "bionic/libgen.cpp",
926 "bionic/link.cpp",
927 "bionic/locale.cpp",
928 "bionic/lockf.cpp",
929 "bionic/lstat.cpp",
930 "bionic/mblen.cpp",
931 "bionic/mbrtoc16.cpp",
932 "bionic/mbrtoc32.cpp",
933 "bionic/mempcpy.cpp",
934 "bionic/memset_explicit.cpp",
935 "bionic/mkdir.cpp",
936 "bionic/mkfifo.cpp",
937 "bionic/mknod.cpp",
938 "bionic/mntent.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800939 "bionic/netdb.cpp",
Elliott Hughes3ed6e722024-02-16 01:18:01 +0000940 "bionic/net_if.cpp",
941 "bionic/netinet_ether.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800942 "bionic/netinet_in.cpp",
943 "bionic/nl_types.cpp",
944 "bionic/open.cpp",
945 "bionic/pathconf.cpp",
946 "bionic/pause.cpp",
947 "bionic/pidfd.cpp",
948 "bionic/pipe.cpp",
949 "bionic/poll.cpp",
950 "bionic/posix_fadvise.cpp",
951 "bionic/posix_fallocate.cpp",
952 "bionic/posix_madvise.cpp",
953 "bionic/posix_timers.cpp",
954 "bionic/preadv_pwritev.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000955 "bionic/pthread_atfork.cpp",
956 "bionic/pthread_attr.cpp",
957 "bionic/pthread_barrier.cpp",
958 "bionic/pthread_cond.cpp",
959 "bionic/pthread_create.cpp",
960 "bionic/pthread_detach.cpp",
961 "bionic/pthread_equal.cpp",
962 "bionic/pthread_exit.cpp",
963 "bionic/pthread_getcpuclockid.cpp",
964 "bionic/pthread_getschedparam.cpp",
965 "bionic/pthread_gettid_np.cpp",
966 "bionic/pthread_internal.cpp",
967 "bionic/pthread_join.cpp",
968 "bionic/pthread_key.cpp",
969 "bionic/pthread_kill.cpp",
970 "bionic/pthread_mutex.cpp",
971 "bionic/pthread_once.cpp",
972 "bionic/pthread_rwlock.cpp",
973 "bionic/pthread_sigqueue.cpp",
974 "bionic/pthread_self.cpp",
975 "bionic/pthread_setname_np.cpp",
976 "bionic/pthread_setschedparam.cpp",
977 "bionic/pthread_spinlock.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800978 "bionic/ptrace.cpp",
979 "bionic/pty.cpp",
980 "bionic/raise.cpp",
981 "bionic/rand.cpp",
982 "bionic/readlink.cpp",
983 "bionic/realpath.cpp",
984 "bionic/reboot.cpp",
985 "bionic/recv.cpp",
986 "bionic/recvmsg.cpp",
987 "bionic/rename.cpp",
988 "bionic/rmdir.cpp",
989 "bionic/scandir.cpp",
Elliott Hughes17e40682024-02-13 16:32:29 -0800990 "bionic/sched_cpualloc.cpp",
991 "bionic/sched_cpucount.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800992 "bionic/sched_getaffinity.cpp",
993 "bionic/sched_getcpu.cpp",
994 "bionic/semaphore.cpp",
995 "bionic/send.cpp",
996 "bionic/setegid.cpp",
997 "bionic/seteuid.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000998 "bionic/setjmp_cookie.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800999 "bionic/setpgrp.cpp",
1000 "bionic/sigaction.cpp",
1001 "bionic/signal.cpp",
1002 "bionic/sigprocmask.cpp",
1003 "bionic/sleep.cpp",
1004 "bionic/socketpair.cpp",
1005 "bionic/spawn.cpp",
1006 "bionic/stat.cpp",
1007 "bionic/stdlib_l.cpp",
1008 "bionic/strerror.cpp",
1009 "bionic/string_l.cpp",
1010 "bionic/strings_l.cpp",
1011 "bionic/strsignal.cpp",
1012 "bionic/strtol.cpp",
1013 "bionic/strtold.cpp",
1014 "bionic/swab.cpp",
1015 "bionic/symlink.cpp",
1016 "bionic/sync_file_range.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001017 "bionic/sysconf.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001018 "bionic/sys_epoll.cpp",
1019 "bionic/sys_msg.cpp",
1020 "bionic/sys_sem.cpp",
1021 "bionic/sys_shm.cpp",
1022 "bionic/sys_signalfd.cpp",
1023 "bionic/sys_statfs.cpp",
1024 "bionic/sys_statvfs.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001025 "bionic/sys_thread_properties.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001026 "bionic/sys_time.cpp",
1027 "bionic/sysinfo.cpp",
1028 "bionic/syslog.cpp",
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001029 "bionic/sysprop_helpers.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001030 "bionic/system.cpp",
1031 "bionic/system_property_api.cpp",
1032 "bionic/system_property_set.cpp",
1033 "bionic/tdestroy.cpp",
1034 "bionic/termios.cpp",
1035 "bionic/thread_private.cpp",
1036 "bionic/threads.cpp",
1037 "bionic/time.cpp",
1038 "bionic/time_l.cpp",
1039 "bionic/tmpfile.cpp",
1040 "bionic/umount.cpp",
1041 "bionic/unlink.cpp",
1042 "bionic/usleep.cpp",
1043 "bionic/utmp.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001044 "bionic/vdso.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001045 "bionic/wait.cpp",
1046 "bionic/wchar.cpp",
1047 "bionic/wchar_l.cpp",
1048 "bionic/wcstod.cpp",
1049 "bionic/wctype.cpp",
1050 "bionic/wcwidth.cpp",
1051 "bionic/wmempcpy.cpp",
1052
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001053 // Forked but not yet cleaned up/rewritten stdio code.
1054 // TODO: finish cleanup.
1055 "stdio/fmemopen.cpp",
1056 "stdio/parsefloat.c",
1057 "stdio/refill.c",
1058 "stdio/stdio.cpp",
1059 "stdio/stdio_ext.cpp",
1060 "stdio/vfscanf.cpp",
1061 "stdio/vfwscanf.cpp",
1062
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001063 // TODO: why isn't this in a static-libc-only module?
1064 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1065 // which will be overridden by the actual one in libc.so.
1066 "bionic/icu_static.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001067 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001068
1069 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001070 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -07001071 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001072 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -08001073 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001074 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001075 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001076 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001077 "arch-arm/bionic/atomics_arm.c",
1078 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -08001079 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001080 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001081 "arch-arm/bionic/setjmp.S",
1082 "arch-arm/bionic/syscall.S",
1083 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001084
Haibo Huangea9957a2018-11-19 11:00:32 -08001085 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001086 "arch-arm/cortex-a7/bionic/memset.S",
1087
1088 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001089 "arch-arm/cortex-a9/bionic/memset.S",
1090 "arch-arm/cortex-a9/bionic/stpcpy.S",
1091 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001092 "arch-arm/cortex-a9/bionic/strcpy.S",
1093 "arch-arm/cortex-a9/bionic/strlen.S",
1094
Elliott Hughesaefe9992023-11-08 12:04:41 -08001095 "arch-arm/cortex-a15/bionic/memcpy.S",
1096 "arch-arm/cortex-a15/bionic/memmove.S",
1097 "arch-arm/cortex-a15/bionic/memset.S",
1098 "arch-arm/cortex-a15/bionic/stpcpy.S",
1099 "arch-arm/cortex-a15/bionic/strcat.S",
1100 "arch-arm/cortex-a15/bionic/strcmp.S",
1101 "arch-arm/cortex-a15/bionic/strcpy.S",
1102 "arch-arm/cortex-a15/bionic/strlen.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001103
1104 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001105
Haibo Huang01bfd892018-12-03 15:05:16 -08001106 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001107
Elliott Hughesaefe9992023-11-08 12:04:41 -08001108 "arch-arm/generic/bionic/memcmp.S",
1109 "arch-arm/generic/bionic/memmove.S",
1110 "arch-arm/generic/bionic/memset.S",
1111 "arch-arm/generic/bionic/stpcpy.c",
1112 "arch-arm/generic/bionic/strcat.c",
1113 "arch-arm/generic/bionic/strcmp.S",
1114 "arch-arm/generic/bionic/strcpy.S",
1115 "arch-arm/generic/bionic/strlen.c",
1116
1117 "arch-arm/krait/bionic/memcpy.S",
1118 "arch-arm/krait/bionic/memset.S",
1119
Haibo Huangea9957a2018-11-19 11:00:32 -08001120 "arch-arm/kryo/bionic/memcpy.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001121
1122 "bionic/strchr.cpp",
1123 "bionic/strchrnul.cpp",
1124 "bionic/strnlen.cpp",
1125 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001126 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001127 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001128 arm64: {
1129 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001130 "arch-arm64/bionic/__bionic_clone.S",
1131 "arch-arm64/bionic/_exit_with_stack_teardown.S",
1132 "arch-arm64/bionic/setjmp.S",
1133 "arch-arm64/bionic/syscall.S",
1134 "arch-arm64/bionic/vfork.S",
Vaisakh K V83e55842024-03-29 12:47:39 +05301135 "arch-arm64/oryon/memcpy-nt.S",
Vaisakh K V54a61212024-03-29 13:32:45 +05301136 "arch-arm64/oryon/memset-nt.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001137 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001138 },
1139
Elliott Hughesebc19a92022-10-14 23:25:36 +00001140 riscv64: {
1141 srcs: [
1142 "arch-riscv64/bionic/__bionic_clone.S",
1143 "arch-riscv64/bionic/_exit_with_stack_teardown.S",
Elliott Hughese1905ed2022-10-17 23:23:36 +00001144 "arch-riscv64/bionic/setjmp.S",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001145 "arch-riscv64/bionic/syscall.S",
1146 "arch-riscv64/bionic/vfork.S",
Yun Hsiang40a82d02023-05-26 10:10:40 +08001147
Elliott Hughesaefe9992023-11-08 12:04:41 -08001148 "arch-riscv64/string/memchr_v.S",
1149 "arch-riscv64/string/memcmp_v.S",
1150 "arch-riscv64/string/memcpy_v.S",
1151 "arch-riscv64/string/memmove_v.S",
1152 "arch-riscv64/string/memset_v.S",
1153 "arch-riscv64/string/stpcpy_v.S",
1154 "arch-riscv64/string/strcat_v.S",
1155 "arch-riscv64/string/strchr_v.S",
1156 "arch-riscv64/string/strcmp_v.S",
1157 "arch-riscv64/string/strcpy_v.S",
1158 "arch-riscv64/string/strlen_v.S",
1159 "arch-riscv64/string/strncat_v.S",
1160 "arch-riscv64/string/strncmp_v.S",
1161 "arch-riscv64/string/strncpy_v.S",
1162 "arch-riscv64/string/strnlen_v.S",
1163
1164 "arch-riscv64/string/memchr.c",
1165 "arch-riscv64/string/memcmp.c",
1166 "arch-riscv64/string/memcpy.c",
1167 "arch-riscv64/string/memmove.c",
1168 "arch-riscv64/string/memset.c",
1169 "arch-riscv64/string/stpcpy.c",
1170 "arch-riscv64/string/strcat.c",
1171 "arch-riscv64/string/strchr.c",
1172 "arch-riscv64/string/strcmp.c",
1173 "arch-riscv64/string/strcpy.c",
1174 "arch-riscv64/string/strlen.c",
1175 "arch-riscv64/string/strncat.c",
1176 "arch-riscv64/string/strncmp.c",
1177 "arch-riscv64/string/strncpy.c",
1178 "arch-riscv64/string/strnlen.c",
Prashanth Swaminathana4d71022023-10-30 17:35:19 -07001179
Elliott Hughes7d136662023-10-27 15:40:32 -07001180 "bionic/strchrnul.cpp",
1181 "bionic/strrchr.cpp",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001182 ],
1183 },
1184
Dan Willemsen208ae172015-09-16 16:33:27 -07001185 x86: {
1186 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001187 "arch-x86/bionic/__bionic_clone.S",
1188 "arch-x86/bionic/_exit_with_stack_teardown.S",
1189 "arch-x86/bionic/libcrt_compat.c",
Elliott Hughes7d136662023-10-27 15:40:32 -07001190 "arch-x86/bionic/setjmp.S",
1191 "arch-x86/bionic/syscall.S",
1192 "arch-x86/bionic/vfork.S",
1193 "arch-x86/bionic/__x86.get_pc_thunk.S",
1194
Dan Willemsen208ae172015-09-16 16:33:27 -07001195 "arch-x86/generic/string/memcmp.S",
1196 "arch-x86/generic/string/strcmp.S",
1197 "arch-x86/generic/string/strncmp.S",
1198 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001199
1200 "arch-x86/generic/string/strlcat.c",
1201 "arch-x86/generic/string/strlcpy.c",
1202 "arch-x86/generic/string/strncat.c",
1203 "arch-x86/generic/string/wcscat.c",
1204 "arch-x86/generic/string/wcscpy.c",
1205 "arch-x86/generic/string/wmemcmp.c",
1206
Elliott Hughesed777142022-07-25 16:25:11 +00001207 "arch-x86/string/sse2-memchr-atom.S",
1208 "arch-x86/string/sse2-memmove-slm.S",
1209 "arch-x86/string/sse2-memrchr-atom.S",
1210 "arch-x86/string/sse2-memset-atom.S",
1211 "arch-x86/string/sse2-memset-slm.S",
1212 "arch-x86/string/sse2-stpcpy-slm.S",
1213 "arch-x86/string/sse2-stpncpy-slm.S",
1214 "arch-x86/string/sse2-strchr-atom.S",
1215 "arch-x86/string/sse2-strcpy-slm.S",
1216 "arch-x86/string/sse2-strlen-slm.S",
1217 "arch-x86/string/sse2-strncpy-slm.S",
1218 "arch-x86/string/sse2-strnlen-atom.S",
1219 "arch-x86/string/sse2-strrchr-atom.S",
1220 "arch-x86/string/sse2-wcschr-atom.S",
1221 "arch-x86/string/sse2-wcsrchr-atom.S",
1222 "arch-x86/string/sse2-wcslen-atom.S",
1223 "arch-x86/string/sse2-wcscmp-atom.S",
1224 "arch-x86/string/sse2-strlen-atom.S",
1225
1226 "arch-x86/string/ssse3-memcmp-atom.S",
1227 "arch-x86/string/ssse3-memmove-atom.S",
1228 "arch-x86/string/ssse3-strcat-atom.S",
1229 "arch-x86/string/ssse3-strcmp-atom.S",
1230 "arch-x86/string/ssse3-strcpy-atom.S",
1231 "arch-x86/string/ssse3-strlcat-atom.S",
1232 "arch-x86/string/ssse3-strlcpy-atom.S",
1233 "arch-x86/string/ssse3-strncat-atom.S",
1234 "arch-x86/string/ssse3-strncmp-atom.S",
1235 "arch-x86/string/ssse3-strncpy-atom.S",
1236 "arch-x86/string/ssse3-wcscat-atom.S",
1237 "arch-x86/string/ssse3-wcscpy-atom.S",
1238 "arch-x86/string/ssse3-wmemcmp-atom.S",
1239
1240 "arch-x86/string/sse4-memcmp-slm.S",
1241 "arch-x86/string/sse4-wmemcmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001242
1243 "bionic/strchrnul.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001244 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001245 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001246 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001247 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001248 "arch-x86_64/bionic/__bionic_clone.S",
1249 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1250 "arch-x86_64/bionic/__restore_rt.S",
1251 "arch-x86_64/bionic/setjmp.S",
1252 "arch-x86_64/bionic/syscall.S",
1253 "arch-x86_64/bionic/vfork.S",
1254
ahs919fb7f2022-06-10 07:11:14 +05301255 "arch-x86_64/string/avx2-memset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001256 "arch-x86_64/string/sse2-memmove-slm.S",
1257 "arch-x86_64/string/sse2-memset-slm.S",
1258 "arch-x86_64/string/sse2-stpcpy-slm.S",
1259 "arch-x86_64/string/sse2-stpncpy-slm.S",
1260 "arch-x86_64/string/sse2-strcat-slm.S",
1261 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001262 "arch-x86_64/string/sse2-strlen-slm.S",
1263 "arch-x86_64/string/sse2-strncat-slm.S",
1264 "arch-x86_64/string/sse2-strncpy-slm.S",
1265 "arch-x86_64/string/sse4-memcmp-slm.S",
1266 "arch-x86_64/string/ssse3-strcmp-slm.S",
1267 "arch-x86_64/string/ssse3-strncmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001268
1269 "bionic/strchr.cpp",
1270 "bionic/strchrnul.cpp",
1271 "bionic/strnlen.cpp",
1272 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001273 ],
1274 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001275 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001276
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001277 multilib: {
1278 lib32: {
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001279 srcs: [
1280 // off64_t/time64_t support on LP32.
1281 "bionic/legacy_32_bit_support.cpp",
1282 "bionic/time64.c",
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001283 ],
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001284 },
1285 },
1286
1287 local_include_dirs: ["stdio"],
1288 generated_headers: ["generated_android_ids"],
1289
1290 whole_static_libs: [
1291 "libsystemproperties",
1292 ],
1293
Colin Cross50c21ab2015-10-31 23:03:05 -07001294 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001295 include_dirs: ["bionic/libstdc++/include"],
1296 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001297}
1298
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001299genrule {
1300 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001301 out: ["generated_android_ids.h"],
1302 srcs: [":android_filesystem_config_header"],
Cole Faustb1a0a9d2023-11-28 17:51:16 -08001303 tools: ["fs_config_generator"],
1304 cmd: "$(location fs_config_generator) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001305}
1306
Dan Willemsen268a6732015-10-15 14:49:45 -07001307// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001308// libc_syscalls.a
1309// ========================================================
1310
Elliott Hughes782c4852019-04-16 12:31:00 -07001311genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001312 name: "syscalls-arm",
Elliott Hughes782c4852019-04-16 12:31:00 -07001313 out: ["syscalls-arm.S"],
1314 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001315 tools: ["gensyscalls"],
1316 cmd: "$(location gensyscalls) arm $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001317}
1318
1319genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001320 name: "syscalls-arm64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001321 out: ["syscalls-arm64.S"],
1322 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001323 tools: ["gensyscalls"],
1324 cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001325}
1326
1327genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001328 name: "syscalls-riscv64",
Elliott Hughes704772b2022-10-10 17:06:43 +00001329 out: ["syscalls-riscv64.S"],
1330 srcs: ["SYSCALLS.TXT"],
1331 tools: ["gensyscalls"],
1332 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
1333}
1334
1335genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001336 name: "syscalls-x86",
Elliott Hughes782c4852019-04-16 12:31:00 -07001337 out: ["syscalls-x86.S"],
1338 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001339 tools: ["gensyscalls"],
1340 cmd: "$(location gensyscalls) x86 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001341}
1342
1343genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001344 name: "syscalls-x86_64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001345 out: ["syscalls-x86_64.S"],
1346 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001347 tools: ["gensyscalls"],
1348 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001349}
1350
Dan Willemsen208ae172015-09-16 16:33:27 -07001351cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001352 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001353 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001354 arch: {
1355 arm: {
Cole Faustf5968d82023-04-11 15:20:19 -07001356 srcs: [":syscalls-arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001357 },
1358 arm64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001359 srcs: [":syscalls-arm64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001360 },
Elliott Hughes704772b2022-10-10 17:06:43 +00001361 riscv64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001362 srcs: [":syscalls-riscv64"],
Elliott Hughes704772b2022-10-10 17:06:43 +00001363 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001364 x86: {
Cole Faustf5968d82023-04-11 15:20:19 -07001365 srcs: [":syscalls-x86"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001366 },
1367 x86_64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001368 srcs: [":syscalls-x86_64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001369 },
1370 },
1371 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001372}
1373
1374// ========================================================
1375// libc_aeabi.a
1376// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1377// to avoid infinite recursion. For the other architectures we just build an
1378// empty library to keep this makefile simple.
1379// ========================================================
1380
1381cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001382 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001383 arch: {
1384 arm: {
1385 srcs: ["arch-arm/bionic/__aeabi.c"],
1386 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001387 },
1388 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001389 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001390}
1391
1392// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001393// libc_common.a --- everything shared by libc.a and libc.so
Dan Willemsen208ae172015-09-16 16:33:27 -07001394// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001395
Dan Willemsen208ae172015-09-16 16:33:27 -07001396cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001397 defaults: ["libc_defaults"],
Elliott Hughesb0948922024-01-26 00:28:12 +00001398 name: "libc_common",
1399
Dan Willemsen208ae172015-09-16 16:33:27 -07001400 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001401 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001402 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001403 "libc_bionic",
Ryan Prichard249757b2019-11-01 17:18:28 -07001404 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001405 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001406 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001407 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001408 "libc_freebsd_large_stack",
Elliott Hughesc2043342023-07-20 20:24:09 +00001409 "libc_freebsd_ldexp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001410 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001411 "libc_netbsd",
1412 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001413 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001414 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001415 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001416 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001417 ],
1418
1419 arch: {
1420 arm: {
1421 whole_static_libs: ["libc_aeabi"],
1422 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001423 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001424}
1425
1426// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001427// libc_static_dispatch.a --- libc.a ifuncs
Haibo Huangf71edfa2018-11-12 10:06:56 -08001428// ========================================================
1429cc_library_static {
1430 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001431 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001432
Haibo Huangb9244ff2018-08-11 10:12:13 -07001433 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301434 x86_64: {
1435 srcs: ["arch-x86_64/static_function_dispatch.S"],
1436 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001437 x86: {
1438 srcs: ["arch-x86/static_function_dispatch.S"],
1439 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001440 arm: {
1441 srcs: ["arch-arm/static_function_dispatch.S"],
1442 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001443 arm64: {
1444 srcs: ["arch-arm64/static_function_dispatch.S"],
1445 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001446 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001447 srcs: ["arch-riscv64/static_function_dispatch.S"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001448 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001449 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001450}
1451
1452// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001453// libc_dynamic_dispatch.a --- libc.so ifuncs
Haibo Huangf71edfa2018-11-12 10:06:56 -08001454// ========================================================
1455cc_library_static {
1456 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001457 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001458
Haibo Huangb9244ff2018-08-11 10:12:13 -07001459 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001460 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001461 "-fno-stack-protector",
1462 "-fno-jump-tables",
1463 ],
1464 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301465 x86_64: {
1466 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
1467 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001468 x86: {
1469 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1470 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001471 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001472 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001473 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001474 arm64: {
1475 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1476 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001477 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001478 srcs: ["arch-riscv64/dynamic_function_dispatch.cpp"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001479 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001480 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001481}
1482
1483// ========================================================
1484// libc_common_static.a For static binaries.
1485// ========================================================
1486cc_library_static {
1487 defaults: ["libc_defaults"],
1488 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001489
Haibo Huangf71edfa2018-11-12 10:06:56 -08001490 whole_static_libs: [
1491 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001492 "libc_static_dispatch",
1493 ],
1494}
1495
1496// ========================================================
1497// libc_common_shared.a For shared libraries.
1498// ========================================================
1499cc_library_static {
1500 defaults: ["libc_defaults"],
1501 name: "libc_common_shared",
1502
1503 whole_static_libs: [
1504 "libc_common",
1505 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001506 ],
1507}
1508
Ryan Prichard22a6a052019-10-10 23:59:30 -07001509// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1510// executable.
1511cc_library_static {
1512 name: "libc_unwind_static",
1513 defaults: ["libc_defaults"],
1514 cflags: ["-DLIBC_STATIC"],
1515
1516 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1517 arch: {
1518 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1519 arm: {
1520 srcs: ["arch-arm/bionic/exidx_static.c"],
1521 },
1522 },
1523}
1524
Haibo Huangf71edfa2018-11-12 10:06:56 -08001525// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001526// libc_nomalloc.a
1527// ========================================================
1528//
Ryan Prichard249757b2019-11-01 17:18:28 -07001529// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1530// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1531// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001532
1533cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001534 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001535 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001536
Colin Crossa3f9fca2016-01-11 13:20:55 -08001537 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001538 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001539 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001540 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001541 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001542}
1543
dimitryc0c0ef62018-12-05 16:33:52 +01001544filegroup {
1545 name: "libc_sources_shared",
1546 srcs: [
1547 "arch-common/bionic/crtbegin_so.c",
1548 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001549 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001550 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001551 "bionic/icu.cpp",
1552 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001553 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001554 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001555 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001556 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001557 "bionic/ndk_cruft.cpp",
1558 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001559 "bionic/NetdClient.cpp",
1560 "arch-common/bionic/crtend_so.S",
1561 ],
1562}
1563
1564filegroup {
1565 name: "libc_sources_static",
1566 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001567 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001568 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001569 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001570 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001571 ],
1572}
1573
1574filegroup {
1575 name: "libc_sources_shared_arm",
1576 srcs: [
1577 "arch-arm/bionic/exidx_dynamic.c",
1578 "arch-arm/bionic/atexit_legacy.c",
1579 ],
1580}
1581
Dan Willemsen208ae172015-09-16 16:33:27 -07001582// ========================================================
1583// libc.a + libc.so
1584// ========================================================
Florian Mayerc10d0642023-03-22 16:12:49 -07001585cc_defaults {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001586 defaults: [
1587 "libc_defaults",
1588 "libc_native_allocator_defaults",
Elliott Hughes788075a2024-06-18 12:25:37 +00001589 "bug_24465209_workaround",
Elliott Hughes89aada12024-07-01 21:59:04 +00001590 "keep_symbols",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001591 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001592 name: "libc_library_defaults",
Colin Cross50c21ab2015-10-31 23:03:05 -07001593 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001594 platform_sdk_version: {
1595 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1596 },
1597 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001598 static: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001599 srcs: [":libc_sources_static"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001600 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001601 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001602 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001603 "libc_init_static",
1604 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001605 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001606 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001607 },
1608 shared: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001609 srcs: [":libc_sources_shared"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001610 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001611 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001612 "libc_init_dynamic",
1613 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001614 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001615 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001616 },
1617
Neil Fullera7db90f2019-04-25 09:28:27 +01001618 required: [
MarkDacekd88d7ea2022-06-28 20:14:58 +00001619 "tzdata_prebuilt",
1620 "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
Neil Fullera7db90f2019-04-25 09:28:27 +01001621 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001622
Colin Cross4ce94d22016-11-15 13:15:43 -08001623 // Do not pack libc.so relocations; see http://b/20645321 for details.
1624 pack_relocations: false,
1625
dimitry06016f22018-01-05 11:39:28 +01001626 shared_libs: [
1627 "ld-android",
1628 "libdl",
1629 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001630 static_libs: [
1631 "libdl_android",
1632 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001633
1634 nocrt: true,
1635
Dan Willemsen208ae172015-09-16 16:33:27 -07001636 arch: {
1637 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001638 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001639 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001640
Dan Willemsen208ae172015-09-16 16:33:27 -07001641 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001642 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001643 // special for arm
1644 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Elliott Hughes89aada12024-07-01 21:59:04 +00001645 // For backwards compatibility, some arm32 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001646 static_libs: ["libclang_rt.builtins-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001647 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001648
Elliott Hughes89aada12024-07-01 21:59:04 +00001649 ldflags: [
1650 // Since we preserve the debug_frame for libc, do not compress
1651 // in this case to make unwinds as fast as possible.
1652 "-Wl,--compress-debug-sections=none",
1653 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001654 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001655 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001656 version_script: ":libc.arm64.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001657 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001658 riscv64: {
1659 version_script: ":libc.riscv64.map",
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001660 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001661 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001662 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001663 no_libcrt: true,
1664
1665 shared: {
Elliott Hughes89aada12024-07-01 21:59:04 +00001666 // For backwards compatibility, some x86 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001667 static_libs: ["libclang_rt.builtins-exported"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001668 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001669 },
1670 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001671 version_script: ":libc.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001672 },
1673 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001674
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001675 apex_available: [
1676 "//apex_available:platform",
1677 "com.android.runtime",
1678 ],
1679
Colin Cross7edd0082021-10-28 13:20:35 -07001680 target: {
1681 native_bridge: {
1682 shared: {
1683 installable: false,
1684 },
1685 },
1686 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001687}
1688
Florian Mayerc10d0642023-03-22 16:12:49 -07001689cc_library {
1690 name: "libc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001691 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001692 "libc_library_defaults",
1693 ],
1694 stubs: {
1695 symbol_file: "libc.map.txt",
1696 versions: [
1697 "29",
1698 "R",
1699 "current",
1700 ],
1701 },
1702 static_ndk_lib: true,
1703 llndk: {
1704 symbol_file: "libc.map.txt",
1705 export_headers_as_system: true,
1706 export_preprocessed_headers: ["include"],
1707 export_llndk_headers: ["libc_llndk_headers"],
1708 },
1709}
1710
1711cc_library {
1712 name: "libc_hwasan",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001713 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001714 "libc_library_defaults",
1715 ],
1716 sanitize: {
1717 hwaddress: true,
1718 },
1719 enabled: false,
Florian Mayerff116ed2023-04-14 17:38:53 -07001720 target: {
1721 android_arm64: {
Florian Mayerc10d0642023-03-22 16:12:49 -07001722 enabled: true,
1723 },
1724 },
1725 stem: "libc",
1726 relative_install_path: "hwasan",
1727 // We don't really need the stubs, but this needs to stay to trigger the
1728 // symlink logic in soong.
1729 stubs: {
1730 symbol_file: "libc.map.txt",
1731 },
1732 native_bridge_supported: false,
1733 // It is never correct to depend on this directly. This is only
1734 // needed for the runtime apex, and in base_system.mk.
1735 visibility: ["//bionic/apex"],
1736}
1737
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001738genrule {
1739 name: "libc.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001740 out: ["libc.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001741 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001742 tools: ["generate-version-script"],
1743 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001744}
1745
1746genrule {
1747 name: "libc.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001748 out: ["libc.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001749 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001750 tools: ["generate-version-script"],
1751 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001752}
1753
1754genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001755 name: "libc.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001756 out: ["libc.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001757 srcs: ["libc.map.txt"],
1758 tools: ["generate-version-script"],
1759 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1760}
1761
1762genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001763 name: "libc.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001764 out: ["libc.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001765 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001766 tools: ["generate-version-script"],
1767 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001768}
1769
1770genrule {
1771 name: "libc.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001772 out: ["libc.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001773 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001774 tools: ["generate-version-script"],
1775 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001776}
1777
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001778// Headers that only other parts of the platform can include.
1779cc_library_headers {
1780 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001781 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001782 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001783 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001784 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001785 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001786 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001787 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001788 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001789 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001790 "//system/core/debuggerd:__subpackages__",
Florian Mayerf5d70ce2022-09-13 13:58:30 -07001791 "//system/core/init:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001792 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001793 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001794 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001795 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001796 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001797 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001798 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001799 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001800 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001801 recovery_available: true,
1802 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001803 export_include_dirs: [
1804 "platform",
1805 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001806 system_shared_libs: [],
1807 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001808 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001809
Steven Moreland0cdf1322020-10-05 21:55:26 +00001810 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001811 apex_available: [
1812 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001813 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001814 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001815}
1816
Logan Chien17af91b2019-01-15 21:19:56 +08001817cc_library_headers {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001818 name: "libc_llndk_headers",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001819 visibility: [
1820 "//external/musl",
1821 ],
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001822 llndk: {
1823 llndk_headers: true,
1824 },
Logan Chien17af91b2019-01-15 21:19:56 +08001825 host_supported: true,
1826 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001827 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001828 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001829 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001830 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001831 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001832 apex_available: [
1833 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001834 "//apex_available:anyapex",
1835 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001836 // used by most APEXes indirectly via libunwind_llvm
1837 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001838
1839 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001840 stl: "none",
1841 system_shared_libs: [],
1842
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001843 // The build system generally requires that any dependencies of a target
1844 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1845 // to 1 we let targets with an sdk_version that need to depend on the libc
1846 // headers but cannot depend on libc itself due to circular dependencies
1847 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1848 // is correct because the headers can support any sdk_version.
1849 sdk_version: "1",
1850
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001851 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001852 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001853 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001854 "kernel/android/uapi",
1855 ],
1856
1857 arch: {
1858 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001859 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001860 },
1861 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001862 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001863 },
Elliott Hughes48e53332022-10-07 20:39:25 +00001864 riscv64: {
1865 export_system_include_dirs: ["kernel/uapi/asm-riscv"],
1866 },
Logan Chien17af91b2019-01-15 21:19:56 +08001867 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001868 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001869 },
1870 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001871 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001872 },
1873 },
1874}
1875
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001876cc_library_headers {
1877 name: "libc_headers",
1878 host_supported: true,
1879 native_bridge_supported: true,
1880 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001881 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001882 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001883 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001884 recovery_available: true,
1885 sdk_version: "1",
1886
1887 apex_available: [
1888 "//apex_available:platform",
1889 "//apex_available:anyapex",
1890 ],
1891 // used by most APEXes indirectly via libunwind_llvm
1892 min_sdk_version: "apex_inherit",
1893 visibility: [
1894 "//bionic:__subpackages__", // visible to bionic
1895 // ... and only to these places (b/152668052)
1896 "//external/arm-optimized-routines",
1897 "//external/gwp_asan",
1898 "//external/jemalloc_new",
1899 "//external/libunwind_llvm",
Nick Desaulniers942ae552024-02-12 10:26:19 -08001900 "//external/llvm-libc",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001901 "//external/scudo",
1902 "//system/core/property_service/libpropertyinfoparser",
1903 "//system/extras/toolchain-extras",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001904 ],
1905
1906 stl: "none",
1907 no_libcrt: true,
1908 system_shared_libs: [],
1909
1910 target: {
1911 android: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001912 export_system_include_dirs: ["include"],
1913 header_libs: ["libc_llndk_headers"],
1914 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001915 },
1916 linux_bionic: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001917 export_system_include_dirs: ["include"],
1918 header_libs: ["libc_llndk_headers"],
1919 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001920 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001921 },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001922}
1923
Dan Willemsen208ae172015-09-16 16:33:27 -07001924// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001925// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001926// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001927
Dan Willemsen208ae172015-09-16 16:33:27 -07001928cc_library {
Elliott Hughes788075a2024-06-18 12:25:37 +00001929 defaults: [
1930 "libc_defaults",
1931 "bug_24465209_workaround",
1932 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001933 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001934 srcs: [
1935 "bionic/__cxa_guard.cpp",
1936 "bionic/__cxa_pure_virtual.cpp",
1937 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001938 ],
1939 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001940 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001941 static_libs: ["libasync_safe"],
Elliott Hughesc2043342023-07-20 20:24:09 +00001942 apex_available: [
1943 "//apex_available:platform",
1944 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001945
Dan Willemsen6b3be172018-12-03 13:57:20 -08001946 static: {
1947 system_shared_libs: [],
1948 },
Colin Crossb5bfe0b2021-07-13 16:26:28 -07001949 target: {
1950 bionic: {
1951 shared: {
1952 system_shared_libs: ["libc"],
1953 },
1954 },
Dan Willemsen6b3be172018-12-03 13:57:20 -08001955 },
1956
Dan Willemsen208ae172015-09-16 16:33:27 -07001957 arch: {
1958 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001959 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001960 },
1961 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001962 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001963 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001964 riscv64: {
1965 version_script: ":libstdc++.riscv64.map",
1966 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001967 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001968 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001969 },
1970 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001971 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001972 },
1973 },
1974}
1975
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001976genrule {
1977 name: "libstdc++.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001978 out: ["libstdc++.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001979 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001980 tools: ["generate-version-script"],
1981 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001982}
1983
1984genrule {
1985 name: "libstdc++.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001986 out: ["libstdc++.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001987 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001988 tools: ["generate-version-script"],
1989 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001990}
1991
1992genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001993 name: "libstdc++.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001994 out: ["libstdc++.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001995 srcs: ["libstdc++.map.txt"],
1996 tools: ["generate-version-script"],
1997 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1998}
1999
2000genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002001 name: "libstdc++.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002002 out: ["libstdc++.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002003 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002004 tools: ["generate-version-script"],
2005 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002006}
2007
2008genrule {
2009 name: "libstdc++.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002010 out: ["libstdc++.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002011 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002012 tools: ["generate-version-script"],
2013 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002014}
2015
2016// ========================================================
2017// crt object files.
2018// ========================================================
2019
Colin Cross50c21ab2015-10-31 23:03:05 -07002020cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002021 name: "crt_and_memtag_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002022 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002023 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002024 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002025 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002026 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002027 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002028 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002029 apex_available: [
2030 "//apex_available:platform",
2031 "//apex_available:anyapex",
2032 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002033 // Generate NDK variants of the CRT objects for every supported API level.
2034 min_sdk_version: "16",
2035 stl: "none",
2036 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002037 cflags: [
2038 "-Wno-gcc-compat",
2039 "-Wall",
2040 "-Werror",
2041 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002042 sanitize: {
2043 never: true,
2044 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002045}
2046
Colin Cross50c21ab2015-10-31 23:03:05 -07002047cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002048 name: "crt_defaults",
2049 defaults: ["crt_and_memtag_defaults"],
Colin Cross02f81372021-07-22 12:02:10 -07002050 system_shared_libs: [],
Colin Cross10d92682021-06-22 13:25:46 -07002051}
2052
2053cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002054 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002055 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002056
2057 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002058 x86: {
2059 cflags: ["-fPIC"],
2060 },
2061 x86_64: {
2062 cflags: ["-fPIC"],
2063 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002064 },
Colin Crossab179442018-09-27 11:03:22 -07002065 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002066}
2067
Dan Willemsen208ae172015-09-16 16:33:27 -07002068cc_object {
2069 name: "crtbrand",
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002070 local_include_dirs: [
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002071 "private", // crtbrand.S depends on private/bionic_asm_note.h
2072 ],
Elliott Hughes6a30b712024-03-13 23:41:32 +00002073 // crtbrand.S needs to know the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002074 product_variables: {
2075 platform_sdk_version: {
2076 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2077 },
2078 },
2079 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002080
Colin Cross7d7b3682017-11-03 13:38:40 -07002081 defaults: ["crt_so_defaults"],
Dan Alberteee46dc2023-04-04 23:27:52 +00002082 // crtbrand is an intermediate artifact, not a final CRT object.
2083 exclude_from_ndk_sysroot: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07002084}
2085
Dan Willemsen208ae172015-09-16 16:33:27 -07002086cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002087 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002088 local_include_dirs: ["include"],
2089 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002090
Colin Cross7d7b3682017-11-03 13:38:40 -07002091 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002092 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002093 "crtbrand",
2094 ],
2095}
2096
Dan Willemsen208ae172015-09-16 16:33:27 -07002097cc_object {
2098 name: "crtend_so",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002099 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002100 "private", // crtend_so.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002101 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002102 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002103
Colin Cross7d7b3682017-11-03 13:38:40 -07002104 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002105}
2106
Dan Willemsen208ae172015-09-16 16:33:27 -07002107cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002108 name: "crtbegin_static",
2109
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002110 local_include_dirs: [
2111 "include",
2112 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2113 ],
Liz Kammere718dd72021-03-09 15:00:06 -05002114
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002115 cflags: ["-DCRTBEGIN_STATIC"],
Yabin Cui744cfd32023-08-24 13:20:23 -07002116
Dan Willemsen208ae172015-09-16 16:33:27 -07002117 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002118 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002119 "crtbrand",
2120 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002121 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002122 // When using libc.a, we're using the latest library regardless of target API level.
2123 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002124}
2125
Dan Willemsen208ae172015-09-16 16:33:27 -07002126cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002127 name: "crtbegin_dynamic",
2128
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002129 local_include_dirs: [
2130 "include",
2131 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2132 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002133 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002134 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002135 "crtbrand",
2136 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002137 target: {
2138 linux_bionic: {
2139 generated_sources: ["host_bionic_linker_asm"],
2140 objs: [
2141 "linker_wrapper",
2142 ],
2143 },
2144 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002145 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002146}
2147
Dan Willemsen208ae172015-09-16 16:33:27 -07002148cc_object {
2149 // We rename crtend.o to crtend_android.o to avoid a
2150 // name clash between gcc and bionic.
2151 name: "crtend_android",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002152 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002153 "private", // crtend.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002154 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002155 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002156
Colin Cross50c21ab2015-10-31 23:03:05 -07002157 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002158}
Colin Crossbaa48992016-07-13 11:15:21 -07002159
Kalesh Singh862a23d2024-01-09 13:13:50 -08002160cc_object {
2161 name: "crt_pad_segment",
2162 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002163 "private", // crt_pad_segment.S depends on private/bionic_asm_note.h
Kalesh Singh862a23d2024-01-09 13:13:50 -08002164 ],
2165 srcs: ["arch-common/bionic/crt_pad_segment.S"],
2166
2167 defaults: ["crt_defaults"],
2168}
2169
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002170cc_library_static {
2171 name: "note_memtag_heap_async",
2172 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002173 arm64: {
2174 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2175 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002176 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002177 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002178
Colin Cross10d92682021-06-22 13:25:46 -07002179 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002180}
2181
2182cc_library_static {
2183 name: "note_memtag_heap_sync",
2184 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002185 arm64: {
2186 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2187 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002188 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002189 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002190
Colin Cross10d92682021-06-22 13:25:46 -07002191 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002192}
2193
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002194// ========================================================
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002195// libc dependencies for baremetal Rust projects.
2196// ========================================================
2197
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002198// This library contains the following unresolved symbols:
2199// __errno
2200// abort
2201// async_safe_fatal_va_list
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002202cc_library_static {
2203 name: "librust_baremetal",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002204 header_libs: ["libc_headers"],
2205 include_dirs: [
2206 "bionic/libc/async_safe/include",
2207 "bionic/libc/platform",
2208 ],
2209 cflags: [
2210 "-Wall",
2211 "-Werror",
2212 ],
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002213 srcs: [
2214 "bionic/fortify.cpp",
Pierre-Clément Tosi816176c2022-11-30 14:33:41 +00002215 "bionic/strtol.cpp",
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002216 ],
2217 arch: {
2218 arm64: {
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002219 srcs: [
2220 "arch-arm64/string/__memcpy_chk.S",
2221 ],
2222 },
caowencheng9a39eb32023-03-20 16:24:41 +08002223 riscv64: {
2224 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002225 "arch-riscv64/string/__memcpy_chk.S",
caowencheng9a39eb32023-03-20 16:24:41 +08002226 ],
2227 },
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002228 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002229 whole_static_libs: [
2230 "libarm-optimized-routines-mem",
Pierre-Clément Tosieb46ac92023-02-01 13:44:57 +00002231 "libc_netbsd",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002232 ],
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002233 system_shared_libs: [],
2234 nocrt: true,
2235 stl: "none",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002236 visibility: [
2237 "//packages/modules/Virtualization/vmbase",
2238 ],
2239}
2240
2241// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002242// NDK headers.
2243// ========================================================
2244
Dan Albert26e1c412018-05-24 14:56:46 -07002245versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002246 name: "common_libc",
2247 from: "include",
2248 to: "",
2249 license: "NOTICE",
2250}
Dan Albert4238a352016-06-28 11:18:05 -07002251
2252ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002253 name: "libc_uapi",
2254 from: "kernel/uapi",
2255 to: "",
2256 srcs: [
2257 "kernel/uapi/asm-generic/**/*.h",
2258 "kernel/uapi/drm/**/*.h",
2259 "kernel/uapi/linux/**/*.h",
2260 "kernel/uapi/misc/**/*.h",
2261 "kernel/uapi/mtd/**/*.h",
2262 "kernel/uapi/rdma/**/*.h",
2263 "kernel/uapi/scsi/**/*.h",
2264 "kernel/uapi/sound/**/*.h",
2265 "kernel/uapi/video/**/*.h",
2266 "kernel/uapi/xen/**/*.h",
2267 ],
Dan Albert92592652016-10-20 01:42:54 -07002268 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002269}
2270
2271ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002272 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002273 from: "kernel/android/uapi/linux",
2274 to: "linux",
2275 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002276 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002277}
2278
2279ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002280 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002281 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002282 to: "scsi",
2283 srcs: ["kernel/android/scsi/**/*.h"],
2284 license: "NOTICE",
2285}
2286
2287ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002288 name: "libc_asm_arm",
2289 from: "kernel/uapi/asm-arm",
2290 to: "arm-linux-androideabi",
2291 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002292 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002293}
2294
2295ndk_headers {
2296 name: "libc_asm_arm64",
2297 from: "kernel/uapi/asm-arm64",
2298 to: "aarch64-linux-android",
2299 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002300 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002301}
2302
Lazar Trsic790d2f72017-11-27 11:54:11 +01002303ndk_headers {
Colin Crossbd26e0f2022-10-19 15:03:14 -07002304 name: "libc_asm_riscv64",
2305 from: "kernel/uapi/asm-riscv",
2306 to: "riscv64-linux-android",
2307 srcs: ["kernel/uapi/asm-riscv/**/*.h"],
2308 license: "NOTICE",
2309}
2310
2311ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002312 name: "libc_asm_x86",
2313 from: "kernel/uapi/asm-x86",
2314 to: "i686-linux-android",
2315 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002316 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002317}
2318
2319ndk_headers {
2320 name: "libc_asm_x86_64",
2321 from: "kernel/uapi/asm-x86",
2322 to: "x86_64-linux-android",
2323 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002324 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002325}
2326
Dan Albert4238a352016-06-28 11:18:05 -07002327ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002328 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002329 symbol_file: "libc.map.txt",
2330 first_version: "9",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002331 export_header_libs: [
2332 "common_libc",
2333 "libc_uapi",
2334 "libc_kernel_android_uapi_linux",
2335 "libc_kernel_android_scsi",
2336 "libc_asm_arm",
2337 "libc_asm_arm64",
Colin Crossbd26e0f2022-10-19 15:03:14 -07002338 "libc_asm_riscv64",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002339 "libc_asm_x86",
2340 "libc_asm_x86_64",
2341 ],
Dan Albert4238a352016-06-28 11:18:05 -07002342}
2343
Dan Albertdf31aff2016-10-06 15:50:41 -07002344ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002345 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002346 symbol_file: "libstdc++.map.txt",
2347 first_version: "9",
2348}
2349
Dan Willemsenca056d72018-01-08 14:00:24 -08002350// Export these headers for toolbox to process
2351filegroup {
2352 name: "kernel_input_headers",
2353 srcs: [
2354 "kernel/uapi/linux/input.h",
2355 "kernel/uapi/linux/input-event-codes.h",
2356 ],
2357}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002358
2359// Generate a syscall name / number mapping. These objects are text files
2360// (thanks to the -dD -E flags) and not binary files. They will then be
2361// consumed by the genseccomp.py script and converted into C++ code.
2362cc_defaults {
2363 name: "libseccomp_gen_syscall_nrs_defaults",
2364 recovery_available: true,
2365 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2366 cflags: [
2367 "-dD",
2368 "-E",
2369 "-Wall",
2370 "-Werror",
2371 "-nostdinc",
2372 ],
2373}
2374
2375cc_object {
2376 name: "libseccomp_gen_syscall_nrs_arm",
2377 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2378 local_include_dirs: [
2379 "kernel/uapi/asm-arm",
2380 "kernel/uapi",
2381 ],
2382}
2383
2384cc_object {
2385 name: "libseccomp_gen_syscall_nrs_arm64",
2386 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2387 local_include_dirs: [
2388 "kernel/uapi/asm-arm64",
2389 "kernel/uapi",
2390 ],
2391}
2392
2393cc_object {
Elliott Hughes704772b2022-10-10 17:06:43 +00002394 name: "libseccomp_gen_syscall_nrs_riscv64",
2395 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2396 local_include_dirs: [
2397 "kernel/uapi/asm-riscv",
2398 "kernel/uapi",
2399 ],
2400}
2401
2402cc_object {
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002403 name: "libseccomp_gen_syscall_nrs_x86",
2404 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2405 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2406 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2407 local_include_dirs: [
2408 "kernel/uapi/asm-x86",
2409 "kernel/uapi",
2410 ],
2411}
2412
2413cc_object {
2414 name: "libseccomp_gen_syscall_nrs_x86_64",
2415 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2416 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2417 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2418 local_include_dirs: [
2419 "kernel/uapi/asm-x86",
2420 "kernel/uapi",
2421 ],
2422}
2423
Jingwen Chenca366332021-01-29 05:16:32 -05002424filegroup {
2425 name: "all_kernel_uapi_headers",
2426 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002427}
2428
Martijn Coenen0c6de752019-01-02 12:52:51 +01002429cc_genrule {
2430 name: "func_to_syscall_nrs",
2431 recovery_available: true,
2432 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2433
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002434 tools: ["genfunctosyscallnrs"],
Martijn Coenen0c6de752019-01-02 12:52:51 +01002435
2436 srcs: [
2437 "SYSCALLS.TXT",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002438 ],
2439
Elliott Hughes704772b2022-10-10 17:06:43 +00002440 arch: {
2441 arm: {
2442 srcs: [
2443 ":libseccomp_gen_syscall_nrs_arm",
2444 ":libseccomp_gen_syscall_nrs_arm64",
2445 ],
2446 },
2447 arm64: {
2448 srcs: [
2449 ":libseccomp_gen_syscall_nrs_arm",
2450 ":libseccomp_gen_syscall_nrs_arm64",
2451 ],
2452 },
2453 riscv64: {
2454 srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
2455 },
2456 x86: {
2457 srcs: [
2458 ":libseccomp_gen_syscall_nrs_x86",
2459 ":libseccomp_gen_syscall_nrs_x86_64",
2460 ],
2461 },
2462 x86_64: {
2463 srcs: [
2464 ":libseccomp_gen_syscall_nrs_x86",
2465 ":libseccomp_gen_syscall_nrs_x86_64",
2466 ],
2467 },
2468 },
2469
Martijn Coenen0c6de752019-01-02 12:52:51 +01002470 out: [
2471 "func_to_syscall_nrs.h",
2472 ],
2473}
2474
Victor Hsiehdbb86702020-06-15 09:29:07 -07002475// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002476genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002477 name: "generate_app_zygote_blocklist",
2478 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2479 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002480 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2481}
2482
Yu Liu938ec9b2022-10-17 16:36:30 -07002483filegroup {
2484 name: "seccomp_syscalls_sources_zygote",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002485 srcs: [
2486 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002487 "SECCOMP_ALLOWLIST_COMMON.TXT",
2488 "SECCOMP_ALLOWLIST_APP.TXT",
2489 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002490 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002491 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002492 ],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002493}
2494
Yu Liu938ec9b2022-10-17 16:36:30 -07002495filegroup {
2496 name: "seccomp_syscalls_sources_app",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002497 srcs: [
2498 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002499 "SECCOMP_ALLOWLIST_COMMON.TXT",
2500 "SECCOMP_ALLOWLIST_APP.TXT",
2501 "SECCOMP_BLOCKLIST_COMMON.TXT",
2502 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002503 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002504 ],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002505}
2506
Yu Liu938ec9b2022-10-17 16:36:30 -07002507filegroup {
2508 name: "seccomp_syscalls_sources_system",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002509 srcs: [
2510 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002511 "SECCOMP_ALLOWLIST_COMMON.TXT",
2512 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2513 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002514 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002515 ],
Yu Liu938ec9b2022-10-17 16:36:30 -07002516}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002517
Yu Liu938ec9b2022-10-17 16:36:30 -07002518cc_genrule {
2519 name: "libseccomp_policy_app_zygote_sources_x86",
2520 recovery_available: true,
2521 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002522 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002523 srcs: [
2524 ":seccomp_syscalls_sources_zygote",
2525 ":libseccomp_gen_syscall_nrs_x86",
2526 ":libseccomp_gen_syscall_nrs_x86_64",
2527 ],
2528 out: [
2529 "x86_app_zygote_policy.cpp",
2530 "x86_64_app_zygote_policy.cpp",
2531 ],
2532 enabled: false,
Yu Liu3a579692022-10-18 03:02:32 +00002533 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002534 x86: {
2535 enabled: true,
2536 },
2537 x86_64: {
2538 enabled: true,
2539 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002540 },
2541}
2542
2543cc_genrule {
2544 name: "libseccomp_policy_app_zygote_sources_arm",
2545 recovery_available: true,
2546 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002547 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002548 srcs: [
2549 ":seccomp_syscalls_sources_zygote",
2550 ":libseccomp_gen_syscall_nrs_arm",
2551 ":libseccomp_gen_syscall_nrs_arm64",
2552 ],
2553 out: [
2554 "arm_app_zygote_policy.cpp",
2555 "arm64_app_zygote_policy.cpp",
2556 ],
2557 enabled: false,
2558 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002559 arm: {
2560 enabled: true,
2561 },
2562 arm64: {
2563 enabled: true,
2564 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002565 },
2566}
2567
2568cc_genrule {
2569 name: "libseccomp_policy_app_zygote_sources_riscv64",
2570 recovery_available: true,
2571 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002572 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002573 srcs: [
2574 ":seccomp_syscalls_sources_zygote",
2575 ":libseccomp_gen_syscall_nrs_riscv64",
2576 ],
2577 out: [
2578 "riscv64_app_zygote_policy.cpp",
2579 ],
2580 enabled: false,
2581 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002582 riscv64: {
2583 enabled: true,
2584 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002585 },
2586}
2587
2588cc_genrule {
2589 name: "libseccomp_policy_app_sources_x86",
2590 recovery_available: true,
2591 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002592 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002593 srcs: [
2594 ":seccomp_syscalls_sources_app",
2595 ":libseccomp_gen_syscall_nrs_x86",
2596 ":libseccomp_gen_syscall_nrs_x86_64",
2597 ],
2598 out: [
2599 "x86_app_policy.cpp",
2600 "x86_64_app_policy.cpp",
2601 ],
2602 enabled: false,
2603 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002604 x86: {
2605 enabled: true,
2606 },
2607 x86_64: {
2608 enabled: true,
2609 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002610 },
2611}
2612
2613cc_genrule {
2614 name: "libseccomp_policy_app_sources_arm",
2615 recovery_available: true,
2616 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002617 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002618 srcs: [
2619 ":seccomp_syscalls_sources_app",
2620 ":libseccomp_gen_syscall_nrs_arm",
2621 ":libseccomp_gen_syscall_nrs_arm64",
2622 ],
2623 out: [
2624 "arm_app_policy.cpp",
2625 "arm64_app_policy.cpp",
2626 ],
2627 enabled: false,
2628 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002629 arm: {
2630 enabled: true,
2631 },
2632 arm64: {
2633 enabled: true,
2634 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002635 },
2636}
2637
2638cc_genrule {
2639 name: "libseccomp_policy_app_sources_riscv64",
2640 recovery_available: true,
2641 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002642 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002643 srcs: [
2644 ":seccomp_syscalls_sources_app",
2645 ":libseccomp_gen_syscall_nrs_riscv64",
2646 ],
2647 out: [
2648 "riscv64_app_policy.cpp",
2649 ],
2650 enabled: false,
2651 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002652 riscv64: {
2653 enabled: true,
2654 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002655 },
2656}
2657
2658cc_genrule {
2659 name: "libseccomp_policy_system_sources_x86",
2660 recovery_available: true,
2661 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002662 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002663 srcs: [
2664 ":seccomp_syscalls_sources_system",
2665 ":libseccomp_gen_syscall_nrs_x86",
2666 ":libseccomp_gen_syscall_nrs_x86_64",
2667 ],
2668 out: [
2669 "x86_system_policy.cpp",
2670 "x86_64_system_policy.cpp",
2671 ],
2672 enabled: false,
2673 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002674 x86: {
2675 enabled: true,
2676 },
2677 x86_64: {
2678 enabled: true,
2679 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002680 },
2681}
2682
2683cc_genrule {
2684 name: "libseccomp_policy_system_sources_arm",
2685 recovery_available: true,
2686 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002687 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002688 srcs: [
2689 ":seccomp_syscalls_sources_system",
2690 ":libseccomp_gen_syscall_nrs_arm",
2691 ":libseccomp_gen_syscall_nrs_arm64",
2692 ],
2693 out: [
2694 "arm_system_policy.cpp",
2695 "arm64_system_policy.cpp",
2696 ],
2697 enabled: false,
2698 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002699 arm: {
2700 enabled: true,
2701 },
2702 arm64: {
2703 enabled: true,
2704 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002705 },
2706}
2707
2708cc_genrule {
2709 name: "libseccomp_policy_system_sources_riscv64",
2710 recovery_available: true,
2711 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002712 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002713 srcs: [
2714 ":seccomp_syscalls_sources_system",
2715 ":libseccomp_gen_syscall_nrs_riscv64",
2716 ],
2717 out: [
2718 "riscv64_system_policy.cpp",
2719 ],
2720 enabled: false,
2721 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002722 riscv64: {
2723 enabled: true,
2724 },
Yu Liu3a579692022-10-18 03:02:32 +00002725 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002726}
2727
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002728cc_library {
2729 name: "libseccomp_policy",
2730 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002731 generated_headers: ["func_to_syscall_nrs"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002732
2733 arch: {
2734 arm: {
2735 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002736 "libseccomp_policy_app_sources_arm",
2737 "libseccomp_policy_app_zygote_sources_arm",
2738 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002739 ],
2740 },
2741 arm64: {
2742 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002743 "libseccomp_policy_app_sources_arm",
2744 "libseccomp_policy_app_zygote_sources_arm",
2745 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002746 ],
2747 },
2748 riscv64: {
2749 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002750 "libseccomp_policy_app_sources_riscv64",
2751 "libseccomp_policy_app_zygote_sources_riscv64",
2752 "libseccomp_policy_system_sources_riscv64",
Yu Liu938ec9b2022-10-17 16:36:30 -07002753 ],
2754 },
2755 x86: {
2756 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002757 "libseccomp_policy_app_sources_x86",
2758 "libseccomp_policy_app_zygote_sources_x86",
2759 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002760 ],
2761 },
2762 x86_64: {
2763 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002764 "libseccomp_policy_app_sources_x86",
2765 "libseccomp_policy_app_zygote_sources_x86",
2766 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002767 ],
2768 },
2769 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002770
2771 srcs: [
2772 "seccomp/seccomp_policy.cpp",
2773 ],
2774
2775 export_include_dirs: ["seccomp/include"],
2776 cflags: [
2777 "-Wall",
2778 "-Werror",
2779 ],
2780 shared: {
2781 shared_libs: ["libbase"],
2782 },
2783 static: {
2784 static_libs: ["libbase"],
2785 },
2786}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002787
Colin Cross048f24e2021-09-01 17:26:00 -07002788cc_library_host_static {
2789 name: "libfts",
2790 srcs: [
2791 "bionic/fts.c",
2792 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
2793 ],
2794 export_include_dirs: ["fts/include"],
2795 local_include_dirs: [
2796 "private",
2797 "upstream-openbsd/android/include",
2798 ],
2799 cflags: [
2800 "-include openbsd-compat.h",
2801 "-Wno-unused-parameter",
2802 ],
2803 enabled: false,
2804 target: {
2805 musl: {
2806 enabled: true,
2807 },
2808 },
Colin Cross2a9843f2022-01-13 12:26:30 -08002809 stl: "none",
2810}
2811
2812cc_library_host_static {
2813 name: "libexecinfo",
2814 visibility: ["//external/musl"],
2815 srcs: ["bionic/execinfo.cpp"],
2816 export_include_dirs: ["execinfo/include"],
2817 local_include_dirs: ["private"],
2818 enabled: false,
2819 target: {
2820 musl: {
2821 enabled: true,
2822 system_shared_libs: [],
2823 header_libs: ["libc_musl_headers"],
2824 },
2825 },
2826 stl: "none",
Colin Cross048f24e2021-09-01 17:26:00 -07002827}
2828
Colin Cross9da85fa2022-01-24 18:20:05 -08002829cc_library_host_static {
2830 name: "libb64",
2831 visibility: ["//external/musl"],
2832 srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
2833 export_include_dirs: ["b64/include"],
2834 local_include_dirs: [
2835 "private",
2836 "upstream-openbsd/android/include",
2837 ],
2838 cflags: [
2839 "-include openbsd-compat.h",
2840 ],
2841 enabled: false,
2842 target: {
2843 musl: {
2844 enabled: true,
2845 system_shared_libs: [],
2846 header_libs: ["libc_musl_headers"],
2847 },
2848 },
2849 stl: "none",
2850}
2851
Colin Cross9d4a56e2022-02-03 10:20:32 -08002852// Export kernel uapi headers to be used in the musl sysroot.
2853// Also include the execinfo headers for the libexecinfo and the
2854// b64 headers for libb64 embedded in musl libc.
2855cc_genrule {
2856 name: "libc_musl_sysroot_bionic_headers",
2857 visibility: ["//external/musl"],
2858 host_supported: true,
2859 device_supported: false,
2860 enabled: false,
2861 target: {
2862 musl: {
2863 enabled: true,
2864 },
2865 },
2866 srcs: [
2867 "kernel/uapi/**/*.h",
2868 "kernel/android/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002869 "execinfo/include/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002870 "b64/include/**/*.h",
Colin Crossaeef9f02022-02-07 21:01:26 -08002871
Colin Crossaeef9f02022-02-07 21:01:26 -08002872 "NOTICE",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002873
2874 ":libc_musl_sysroot_bionic_arch_headers",
2875 ],
2876 out: ["libc_musl_sysroot_bionic_headers.zip"],
2877 tools: [
2878 "soong_zip",
2879 "merge_zips",
2880 "zip2zip",
2881 ],
Colin Crossaeef9f02022-02-07 21:01:26 -08002882 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
2883 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
Colin Crossad33d022022-02-25 18:27:04 -08002884 // NOTICE
2885 " -j -f $(location NOTICE) " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002886 // headers
2887 " -P include " +
Colin Crossaeef9f02022-02-07 21:01:26 -08002888 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
2889 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
2890 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2891 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2892 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2893 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2894 " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
2895 " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
2896 " -C $${BIONIC_LIBC_DIR}/b64/include " +
2897 " -D $${BIONIC_LIBC_DIR}/b64/include " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002898 " && " +
Colin Crossad33d022022-02-25 18:27:04 -08002899 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
Colin Cross1c0a7a02022-08-11 12:22:26 -07002900 " -x **/BUILD " +
Colin Crossad33d022022-02-25 18:27:04 -08002901 " include/**/*:include/ " +
2902 " NOTICE:NOTICE.bionic " +
2903 " && " +
2904 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002905}
2906
2907// The architecture-specific bits have to be handled separately because the label varies based
2908// on architecture, which prevents using $(locations) to find them and requires using $(in)
2909// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
2910// genrule.
2911cc_genrule {
2912 name: "libc_musl_sysroot_bionic_arch_headers",
2913 visibility: ["//visibility:private"],
2914 host_supported: true,
2915 device_supported: false,
2916 enabled: false,
2917 target: {
2918 musl: {
2919 enabled: true,
2920 },
2921 },
2922 arch: {
2923 arm: {
2924 srcs: ["kernel/uapi/asm-arm/**/*.h"],
2925 },
2926 arm64: {
2927 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
2928 },
2929 x86: {
2930 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2931 },
2932 x86_64: {
2933 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2934 },
2935 },
2936 out: ["libc_musl_sysroot_bionic_arch_headers.zip"],
2937 tools: ["soong_zip"],
2938 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
2939}
Colin Cross290c4952022-10-13 12:51:13 -07002940
2941cc_genrule {
2942 name: "bionic_sysroot_crt_objects",
2943 visibility: ["//visibility:private"],
2944 out: ["bionic_sysroot_crt_objects.zip"],
2945 tools: ["soong_zip"],
2946 srcs: [
2947 ":crtbegin_dynamic",
2948 ":crtbegin_so",
2949 ":crtbegin_static",
2950 ":crtend_android",
2951 ":crtend_so",
2952 ],
2953 cmd: "$(location soong_zip) -o $(out) -j " +
2954 "-f $(location :crtbegin_dynamic) " +
2955 "-f $(location :crtbegin_so) " +
2956 "-f $(location :crtbegin_static) " +
2957 "-f $(location :crtend_android) " +
2958 "-f $(location :crtend_so)",
2959 dist: {
2960 targets: ["bionic_sysroot_crt_objects"],
2961 },
2962 arch: {
2963 arm: {
2964 dist: {
2965 suffix: "_arm",
2966 },
2967 },
2968 arm64: {
2969 dist: {
2970 suffix: "_arm64",
2971 },
2972 },
2973 riscv64: {
2974 dist: {
2975 suffix: "_riscv64",
2976 },
2977 },
2978 x86: {
2979 dist: {
2980 suffix: "_x86",
2981 },
2982 },
2983 x86_64: {
2984 dist: {
2985 suffix: "_x86_64",
2986 },
2987 },
2988 },
2989}
Spandan Das8fce52a2023-09-28 18:00:12 +00002990
2991// headers that will be placed on the include path when running versioner in bazel
2992// this module should be a no-op in soong
2993filegroup {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002994 name: "versioner-dependencies",
2995 srcs: ["versioner-dependencies/**/*"],
Spandan Das8fce52a2023-09-28 18:00:12 +00002996}
Jiyong Park35a280d2024-05-03 16:53:39 +09002997
2998filegroup {
2999 name: "linux_capability_header",
3000 srcs: ["kernel/uapi/linux/capability.h"],
3001}