blob: 7788a48bf267f788d1957312f6deba1b7bde9577 [file] [log] [blame]
Bob Badouraa7d8352021-02-19 13:06:22 -08001package {
2 default_applicable_licenses: ["bionic_libc_license"],
3}
4
5license {
6 name: "bionic_libc_license",
7 visibility: [":__subpackages__"],
8 license_kinds: [
9 "SPDX-license-identifier-Apache-2.0",
10 "SPDX-license-identifier-BSD",
11 "SPDX-license-identifier-ISC",
12 "SPDX-license-identifier-MIT",
13 "legacy_notice",
14 "legacy_unencumbered",
15 ],
16 license_text: [
17 "NOTICE",
18 ],
19}
20
Elliott Hughes53cf3482016-08-09 13:06:41 -070021libc_common_flags = [
22 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080023 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070024 "-Wall",
25 "-Wextra",
26 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080027 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070028 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070029 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070030 "-Wframe-larger-than=2048",
Christopher Ferris1de7a482023-09-12 11:06:29 -070031 "-Wno-reorder-init-list",
Elliott Hughes53cf3482016-08-09 13:06:41 -070032
33 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
34 "-Werror=pointer-to-int-cast",
35 "-Werror=int-to-pointer-cast",
36 "-Werror=type-limits",
37 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080038
39 // Clang's exit-time destructor registration hides __dso_handle, but
40 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
41 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080042
Elliott Hughesa13d0662021-12-02 14:42:16 -080043 // We know clang does a lot of harm by rewriting what we've said, and sadly
44 // never see any good it does, so let's just ask it to do what we say...
45 // (The specific motivating example was clang turning a loop that would only
46 // ever touch 0, 1, or 2 bytes into a call to memset, which was never going
47 // to amortize.)
48 "-fno-builtin",
Elliott Hughes53cf3482016-08-09 13:06:41 -070049]
50
Dan Willemsen208ae172015-09-16 16:33:27 -070051// Define some common cflags
52// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070053cc_defaults {
54 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080055 defaults: ["linux_bionic_supported"],
Christopher Ferrisb5425052024-04-23 17:15:39 -070056 cflags: libc_common_flags + [
57 "-DUSE_SCUDO",
58 ],
Elliott Hughes53cf3482016-08-09 13:06:41 -070059 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070060 conlyflags: ["-std=gnu99"],
61 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070062 include_dirs: [
63 "bionic/libc/async_safe/include",
Peter Collingbourne5d3aa862020-09-11 15:05:17 -070064 "bionic/libc/platform",
Tom Cherry379ed1e2020-09-17 09:36:25 -070065 // For android_filesystem_config.h.
66 "system/core/libcutils/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070067 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070068
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010069 header_libs: [
70 "libc_headers",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +000071 "liblog_headers", // needed by bionic/libc/async_safe/include
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010072 ],
73 export_header_lib_headers: [
74 "libc_headers",
75 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -080076
Colin Cross50c21ab2015-10-31 23:03:05 -070077 stl: "none",
78 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070079 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070080 address: false,
81 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070082 // TODO(b/132640749): Fix broken fuzzer support.
83 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070084 },
Yifan Hong5a39cee2020-01-21 16:43:56 -080085 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -070086 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090087 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020088 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080089
Peter Collingbournee99912f2019-11-01 15:37:00 -070090 product_variables: {
Evgenii Stepanov5a73e032020-04-29 14:59:44 -070091 malloc_zero_contents: {
92 cflags: ["-DSCUDO_ZERO_CONTENTS"],
93 },
94 malloc_pattern_fill_contents: {
95 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
96 },
Christopher Ferrisb5425052024-04-23 17:15:39 -070097 malloc_low_memory: {
98 cflags: ["-UUSE_SCUDO"],
Steven Morelandfb65ee42020-07-31 00:18:38 +000099 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700100 },
Yi Kong9e33b762021-10-29 02:43:22 +0800101
102 lto: {
103 never: true,
104 },
Elliott Hughesc2043342023-07-20 20:24:09 +0000105
106 apex_available: ["com.android.runtime"],
Elliott Hughes7d136662023-10-27 15:40:32 -0700107
108 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700109}
110
Elliott Hughes788075a2024-06-18 12:25:37 +0000111// Workaround for b/24465209.
112// We're unlikely to be able to remove this before we just
113// remove ILP32 support completely.
114// Note that we also still have `pack_relocations: false`
115// for both libc and libm, even on LP64.
116// ========================================================
117cc_defaults {
118 name: "bug_24465209_workaround",
Elliott Hughesfeb94732024-06-18 19:44:18 +0000119 target: {
120 android_arm: {
Elliott Hughes788075a2024-06-18 12:25:37 +0000121 pack_relocations: false,
122 ldflags: ["-Wl,--hash-style=both"],
123 },
Elliott Hughesfeb94732024-06-18 19:44:18 +0000124 android_x86: {
Elliott Hughes788075a2024-06-18 12:25:37 +0000125 pack_relocations: false,
126 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesb4e02782024-06-21 11:35:18 +0000127 },
Elliott Hughes788075a2024-06-18 12:25:37 +0000128 },
129}
130
Elliott Hughes89aada12024-07-01 21:59:04 +0000131// Leave the symbols in the shared library so that stack unwinders can produce
132// meaningful name resolution. This is a bit more ugly than it sounds because
133// arm32 is a bit broken.
134// ========================================================
135cc_defaults {
136 name: "keep_symbols",
137 arch: {
138 arm: {
139 // arm32 does not produce complete exidx unwind information,
140 // so keep the .debug_frame which is relatively small and does
141 // include needed unwind information.
142 // See b/132992102 for details.
143 strip: {
144 keep_symbols_and_debug_frame: true,
145 },
146 },
147 arm64: {
148 strip: {
149 keep_symbols: true,
150 },
151 },
152 riscv64: {
153 strip: {
154 keep_symbols: true,
155 },
156 },
157 x86: {
158 strip: {
159 keep_symbols: true,
160 },
161 },
162 x86_64: {
163 strip: {
164 keep_symbols: true,
165 },
166 },
167 },
168}
169
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700170// Defaults for native allocator libs/includes to make it
171// easier to change.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700172// ========================================================
173cc_defaults {
174 name: "libc_native_allocator_defaults",
175
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700176 whole_static_libs: [
Christopher Ferrisb5425052024-04-23 17:15:39 -0700177 "libscudo",
178 ],
179 cflags: [
180 "-DUSE_SCUDO",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700181 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800182 header_libs: ["gwp_asan_headers"],
Christopher Ferrisb5425052024-04-23 17:15:39 -0700183 product_variables: {
184 malloc_low_memory: {
185 cflags: ["-UUSE_SCUDO"],
186 whole_static_libs: [
187 "libjemalloc5",
188 "libc_jemalloc_wrapper",
189 ],
190 exclude_static_libs: [
191 "libscudo",
192 ],
193 },
194 },
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700195}
196
197// Functions not implemented by jemalloc directly, or that need to
198// be modified for Android.
199cc_library_static {
200 name: "libc_jemalloc_wrapper",
201 defaults: ["libc_defaults"],
202 srcs: ["bionic/jemalloc_wrapper.cpp"],
203 cflags: ["-fvisibility=hidden"],
204
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800205 // Used to pull in the jemalloc include directory so that if the
206 // library is removed, the include directory is also removed.
207 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700208}
209
Dan Willemsen208ae172015-09-16 16:33:27 -0700210// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700211// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700212// ========================================================
213//
Ryan Prichard249757b2019-11-01 17:18:28 -0700214// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
215// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
216// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
217// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700218
219cc_library_static {
220
Colin Crossa3f9fca2016-01-11 13:20:55 -0800221 srcs: [
222 "bionic/__libc_init_main_thread.cpp",
223 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700224 "bionic/bionic_call_ifunc_resolver.cpp",
225 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800226 ],
227 arch: {
228 arm64: {
229 srcs: ["arch-arm64/bionic/__set_tls.c"],
230 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000231 riscv64: {
232 srcs: ["arch-riscv64/bionic/__set_tls.c"],
233 },
Colin Crossa3f9fca2016-01-11 13:20:55 -0800234 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700235 srcs: [
236 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Pirama Arumuga Nainar7b89be72021-02-12 15:09:49 -0800237 "arch-x86/bionic/__libc_int0x80.S",
Ryan Prichard27475b52018-05-17 17:14:18 -0700238 "arch-x86/bionic/__set_tls.cpp",
239 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800240 },
241 x86_64: {
242 srcs: ["arch-x86_64/bionic/__set_tls.c"],
243 },
244 },
245
Colin Cross50c21ab2015-10-31 23:03:05 -0700246 defaults: ["libc_defaults"],
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000247 cflags: [
248 "-fno-stack-protector",
249 "-ffreestanding",
250 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700251 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700252}
253
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800254filegroup {
255 name: "elf_note_sources",
256 srcs: ["bionic/elf_note.cpp"],
257}
258
Ryan Prichard249757b2019-11-01 17:18:28 -0700259// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
260// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
261// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800262
263cc_library_static {
264 name: "libc_init_static",
265 defaults: ["libc_defaults"],
Kalesh Singhf0050fb2023-12-15 10:02:01 -0800266 srcs: [
267 "bionic/libc_init_static.cpp",
268 ":elf_note_sources",
269 ],
Ryan Prichard249757b2019-11-01 17:18:28 -0700270 cflags: [
271 "-fno-stack-protector",
272
273 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
274 // from the linker before ifunc resolvers have made string.h functions available.
275 "-ffreestanding",
276 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800277}
278
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700279cc_library_static {
280 name: "libc_init_dynamic",
281 defaults: ["libc_defaults"],
282 srcs: ["bionic/libc_init_dynamic.cpp"],
283 cflags: ["-fno-stack-protector"],
284}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800285
Dan Willemsen208ae172015-09-16 16:33:27 -0700286// ========================================================
287// libc_tzcode.a - upstream 'tzcode' code
288// ========================================================
289
290cc_library_static {
291
Colin Cross50c21ab2015-10-31 23:03:05 -0700292 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700293 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800294 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700295 "tzcode/bionic.cpp",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700296 // tzcode doesn't include strptime, so we use a fork of the
297 // OpenBSD code which needs this global data.
Elliott Hughesd3627a42022-12-06 22:24:27 +0000298 "upstream-openbsd/lib/libc/locale/_def_time.c",
Elliott Hughes2bd43162023-06-15 13:17:08 -0700299 // tzcode doesn't include wcsftime, so we use the FreeBSD code.
300 "upstream-freebsd/lib/libc/locale/wcsftime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700301 ],
302
Colin Cross50c21ab2015-10-31 23:03:05 -0700303 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700304 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700305 // Don't use ridiculous amounts of stack.
306 "-DALL_STATE",
307 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
308 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800309 // Obviously, we want to be thread-safe.
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000310 "-DTHREAD_SAFE=1",
Dan Willemsen208ae172015-09-16 16:33:27 -0700311 // The name of the tm_gmtoff field in our struct tm.
312 "-DTM_GMTOFF=tm_gmtoff",
Elliott Hughes31fc69f2023-06-20 15:36:11 -0700313 // Android uses a system property instead of /etc/localtime, so make callers crash.
Almaz Mingaleeva52a0da2022-02-28 16:55:50 +0000314 "-DTZDEFAULT=NULL",
Dan Willemsen208ae172015-09-16 16:33:27 -0700315 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700316 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700317 // Include `tzname`, `timezone`, and `daylight` globals.
318 "-DHAVE_POSIX_DECLS=0",
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000319 "-DUSG_COMPAT=2",
320 "-DHAVE_TZNAME=2",
321 // stdbool.h is available
322 "-DHAVE_STDBOOL_H",
Colin Crossa35d23d2015-11-19 13:32:49 -0800323 // Use the empty string (instead of " ") as the timezone abbreviation
324 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700325 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700326 "-Dlint",
327 ],
328
Elliott Hughes2bd43162023-06-15 13:17:08 -0700329 local_include_dirs: [
330 "tzcode/",
331 "upstream-freebsd/android/include",
332 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700333 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700334}
335
336// ========================================================
337// libc_dns.a - modified NetBSD DNS code
338// ========================================================
339
340cc_library_static {
341
Colin Cross50c21ab2015-10-31 23:03:05 -0700342 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700343 srcs: [
Elliott Hughesd0bbfa82021-04-08 11:58:51 -0700344 "dns/**/*.c*",
Dan Willemsen208ae172015-09-16 16:33:27 -0700345
346 "upstream-netbsd/lib/libc/isc/ev_streams.c",
347 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700348 ],
349
Colin Cross50c21ab2015-10-31 23:03:05 -0700350 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700351 "-DANDROID_CHANGES",
352 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700353 "-Wno-unused-parameter",
354 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700355 "-Wframe-larger-than=66000",
Elliott Hughese1dc4f62021-01-11 11:51:29 -0800356 "-include private/bsd_sys_param.h",
Dan Willemsen208ae172015-09-16 16:33:27 -0700357 ],
358
Dan Willemsen208ae172015-09-16 16:33:27 -0700359 local_include_dirs: [
360 "dns/include",
361 "private",
362 "upstream-netbsd/lib/libc/include",
363 "upstream-netbsd/android/include",
364 ],
365
366 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700367}
368
369// ========================================================
370// libc_freebsd.a - upstream FreeBSD C library code
371// ========================================================
372//
373// These files are built with the freebsd-compat.h header file
374// automatically included.
375
376cc_library_static {
Elliott Hughesc2043342023-07-20 20:24:09 +0000377 name: "libc_freebsd_ldexp",
378 defaults: ["libc_defaults"],
379 cflags: ["-Dscalbn=ldexp"],
380 srcs: [":libc_ldexp_srcs"],
381}
382
383cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700384 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700385 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700386 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700387 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
388 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
389 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
390 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700391 "upstream-freebsd/lib/libc/stdlib/qsort.c",
392 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700393 "upstream-freebsd/lib/libc/string/wcpcpy.c",
394 "upstream-freebsd/lib/libc/string/wcpncpy.c",
395 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700396 "upstream-freebsd/lib/libc/string/wcscat.c",
397 "upstream-freebsd/lib/libc/string/wcschr.c",
398 "upstream-freebsd/lib/libc/string/wcscmp.c",
399 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700400 "upstream-freebsd/lib/libc/string/wcscspn.c",
401 "upstream-freebsd/lib/libc/string/wcsdup.c",
402 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700403 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700404 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
405 "upstream-freebsd/lib/libc/string/wcsncat.c",
406 "upstream-freebsd/lib/libc/string/wcsncmp.c",
407 "upstream-freebsd/lib/libc/string/wcsncpy.c",
408 "upstream-freebsd/lib/libc/string/wcsnlen.c",
409 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700410 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700411 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700412 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700413 "upstream-freebsd/lib/libc/string/wcstok.c",
414 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700415 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700416 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700417 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800418 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700419 ],
420 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700421 x86: {
422 exclude_srcs: [
423 "upstream-freebsd/lib/libc/string/wcschr.c",
424 "upstream-freebsd/lib/libc/string/wcscmp.c",
425 "upstream-freebsd/lib/libc/string/wcslen.c",
426 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700427 "upstream-freebsd/lib/libc/string/wmemcmp.c",
428 "upstream-freebsd/lib/libc/string/wcscat.c",
429 "upstream-freebsd/lib/libc/string/wcscpy.c",
430 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700431 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700432 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700433 },
434
Colin Cross50c21ab2015-10-31 23:03:05 -0700435 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700436 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700437 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700438 "-include freebsd-compat.h",
439 ],
440
Dan Willemsen208ae172015-09-16 16:33:27 -0700441 local_include_dirs: [
442 "upstream-freebsd/android/include",
443 ],
444
445 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700446}
447
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700448cc_library_static {
449 defaults: ["libc_defaults"],
450 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700451 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700452 ],
453
454 cflags: [
455 "-Wno-sign-compare",
456 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700457 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700458 ],
459
460 local_include_dirs: [
461 "upstream-freebsd/android/include",
462 ],
463
464 name: "libc_freebsd_large_stack",
465}
466
Dan Willemsen208ae172015-09-16 16:33:27 -0700467// ========================================================
468// libc_netbsd.a - upstream NetBSD C library code
469// ========================================================
470//
471// These files are built with the netbsd-compat.h header file
472// automatically included.
473
474cc_library_static {
475
Colin Cross50c21ab2015-10-31 23:03:05 -0700476 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700477 srcs: [
478 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700479 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700480 "upstream-netbsd/lib/libc/gen/psignal.c",
481 "upstream-netbsd/lib/libc/gen/utime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700482 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
483 "upstream-netbsd/lib/libc/regex/regcomp.c",
484 "upstream-netbsd/lib/libc/regex/regerror.c",
485 "upstream-netbsd/lib/libc/regex/regexec.c",
486 "upstream-netbsd/lib/libc/regex/regfree.c",
487 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700488 "upstream-netbsd/lib/libc/stdlib/drand48.c",
489 "upstream-netbsd/lib/libc/stdlib/erand48.c",
490 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
491 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700492 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
493 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
494 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
495 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
496 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
497 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
498 "upstream-netbsd/lib/libc/stdlib/seed48.c",
499 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700500 ],
501 multilib: {
502 lib32: {
503 // LP32 cruft
504 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
505 },
506 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700507 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700508 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800509 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700510 "-DPOSIX_MISTAKE",
511 "-include netbsd-compat.h",
512 ],
513
Dan Willemsen208ae172015-09-16 16:33:27 -0700514 local_include_dirs: [
515 "upstream-netbsd/android/include",
516 "upstream-netbsd/lib/libc/include",
517 ],
518
519 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700520}
521
522// ========================================================
Elliott Hughes968adf92024-02-08 13:15:53 -0800523// libc_openbsd.a - upstream OpenBSD C library code
Dan Willemsen208ae172015-09-16 16:33:27 -0700524// ========================================================
525//
526// These files are built with the openbsd-compat.h header file
527// automatically included.
Dan Willemsen208ae172015-09-16 16:33:27 -0700528cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700529 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700530 srcs: [
Elliott Hughes968adf92024-02-08 13:15:53 -0800531 "upstream-openbsd/lib/libc/crypt/arc4random.c",
532 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700533 "upstream-openbsd/lib/libc/gen/alarm.c",
534 "upstream-openbsd/lib/libc/gen/ctype_.c",
535 "upstream-openbsd/lib/libc/gen/daemon.c",
536 "upstream-openbsd/lib/libc/gen/err.c",
537 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700538 "upstream-openbsd/lib/libc/gen/fnmatch.c",
539 "upstream-openbsd/lib/libc/gen/ftok.c",
540 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700541 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700542 "upstream-openbsd/lib/libc/gen/verr.c",
543 "upstream-openbsd/lib/libc/gen/verrx.c",
544 "upstream-openbsd/lib/libc/gen/vwarn.c",
545 "upstream-openbsd/lib/libc/gen/vwarnx.c",
546 "upstream-openbsd/lib/libc/gen/warn.c",
547 "upstream-openbsd/lib/libc/gen/warnx.c",
548 "upstream-openbsd/lib/libc/locale/btowc.c",
549 "upstream-openbsd/lib/libc/locale/mbrlen.c",
550 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
551 "upstream-openbsd/lib/libc/locale/mbtowc.c",
552 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700553 "upstream-openbsd/lib/libc/locale/wcstombs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700554 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
555 "upstream-openbsd/lib/libc/locale/wctob.c",
556 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700557 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700558 "upstream-openbsd/lib/libc/net/htonl.c",
559 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700560 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
561 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
562 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700563 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
564 "upstream-openbsd/lib/libc/net/inet_ntop.c",
565 "upstream-openbsd/lib/libc/net/inet_pton.c",
566 "upstream-openbsd/lib/libc/net/ntohl.c",
567 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800568 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700569 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700570 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
571 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700572 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700573 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700574 "upstream-openbsd/lib/libc/stdio/fputwc.c",
575 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700576 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700577 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700578 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700579 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700580 "upstream-openbsd/lib/libc/stdio/makebuf.c",
581 "upstream-openbsd/lib/libc/stdio/mktemp.c",
582 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
583 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700584 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700585 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700586 "upstream-openbsd/lib/libc/stdio/ungetc.c",
587 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
588 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
589 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700590 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
591 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
592 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700593 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700594 "upstream-openbsd/lib/libc/stdio/wsetup.c",
595 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800596 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700597 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700598 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700599 "upstream-openbsd/lib/libc/stdlib/insque.c",
600 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
601 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
602 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800603 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700604 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800605 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700606 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughes26b06072020-07-31 11:00:10 -0700607 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700608 "upstream-openbsd/lib/libc/stdlib/remque.c",
609 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700610 "upstream-openbsd/lib/libc/stdlib/tfind.c",
611 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800612 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700613 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800614 "upstream-openbsd/lib/libc/string/strcasestr.c",
615 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700616 "upstream-openbsd/lib/libc/string/strcspn.c",
617 "upstream-openbsd/lib/libc/string/strdup.c",
618 "upstream-openbsd/lib/libc/string/strndup.c",
619 "upstream-openbsd/lib/libc/string/strpbrk.c",
620 "upstream-openbsd/lib/libc/string/strsep.c",
621 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700622 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800623 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700624 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700625 "upstream-openbsd/lib/libc/string/wcswidth.c",
Colin Cross69bcb8b2021-09-08 13:24:16 -0700626
627 // This file is originally from OpenBSD, and benefits from
628 // being compiled with openbsd-compat.h.
Elliott Hughes968adf92024-02-08 13:15:53 -0800629 // TODO: clean this up instead.
Colin Cross69bcb8b2021-09-08 13:24:16 -0700630 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700631 ],
632
Elliott Hughes7d136662023-10-27 15:40:32 -0700633 // Each architecture has optimized versions of some routines,
634 // and only includes the portable C versions of ones it's missing.
Dan Willemsen208ae172015-09-16 16:33:27 -0700635 arch: {
636 arm: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700637 srcs: [
638 "upstream-openbsd/lib/libc/string/memchr.c",
639 "upstream-openbsd/lib/libc/string/memrchr.c",
640 "upstream-openbsd/lib/libc/string/stpncpy.c",
641 "upstream-openbsd/lib/libc/string/strlcat.c",
642 "upstream-openbsd/lib/libc/string/strlcpy.c",
643 "upstream-openbsd/lib/libc/string/strncat.c",
644 "upstream-openbsd/lib/libc/string/strncmp.c",
645 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700646 ],
647 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700648 arm64: {
Elliott Hughes7d136662023-10-27 15:40:32 -0700649 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700650 "upstream-openbsd/lib/libc/string/strcat.c",
Elliott Hughesaefe9992023-11-08 12:04:41 -0800651 "upstream-openbsd/lib/libc/string/stpncpy.c",
Elliott Hughes7d136662023-10-27 15:40:32 -0700652 "upstream-openbsd/lib/libc/string/strlcat.c",
653 "upstream-openbsd/lib/libc/string/strlcpy.c",
654 "upstream-openbsd/lib/libc/string/strncat.c",
655 "upstream-openbsd/lib/libc/string/strncpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700656 ],
657 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000658 riscv64: {
659 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -0700660 "upstream-openbsd/lib/libc/string/memrchr.c",
661 "upstream-openbsd/lib/libc/string/stpncpy.c",
662 "upstream-openbsd/lib/libc/string/strlcat.c",
663 "upstream-openbsd/lib/libc/string/strlcpy.c",
Elliott Hughesebc19a92022-10-14 23:25:36 +0000664 ],
665 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700666 x86: {
Elliott Hughesaefe9992023-11-08 12:04:41 -0800667 srcs: [
668 // x86 has custom implementations of all of these.
669 ],
Elliott Hughes7d136662023-10-27 15:40:32 -0700670 },
671 x86_64: {
672 srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800673 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800674 "upstream-openbsd/lib/libc/string/memrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700675 "upstream-openbsd/lib/libc/string/strlcat.c",
676 "upstream-openbsd/lib/libc/string/strlcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800677 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700678 },
679 },
680
Colin Cross50c21ab2015-10-31 23:03:05 -0700681 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700682 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700683 "-Wno-unused-parameter",
684 "-include openbsd-compat.h",
685 ],
686
Dan Willemsen208ae172015-09-16 16:33:27 -0700687 local_include_dirs: [
688 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700689 "upstream-openbsd/android/include",
Elliott Hughes968adf92024-02-08 13:15:53 -0800690 "stdio",
691 "upstream-openbsd/lib/libc/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700692 ],
693
694 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700695}
696
Elliott Hughes968adf92024-02-08 13:15:53 -0800697cc_library_static {
698 name: "libc_openbsd_large_stack",
699 defaults: ["libc_defaults"],
700 srcs: [
701 "stdio/vfprintf.cpp",
702 "stdio/vfwprintf.cpp",
703 "upstream-openbsd/lib/libc/string/memmem.c",
704 "upstream-openbsd/lib/libc/string/strstr.c",
705 ],
706 cflags: [
707 "-include openbsd-compat.h",
708 "-Wno-sign-compare",
709 "-Wframe-larger-than=5000",
710 ],
711
712 local_include_dirs: [
713 "private",
714 "upstream-openbsd/android/include/",
715 "upstream-openbsd/lib/libc/gdtoa/",
716 "upstream-openbsd/lib/libc/include/",
717 "upstream-openbsd/lib/libc/stdio/",
718 ],
719}
720
Dan Willemsen208ae172015-09-16 16:33:27 -0700721// ========================================================
722// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
723// ========================================================
724//
725// These files are built with the openbsd-compat.h header file
726// automatically included.
727
728cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700729 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700730 srcs: [
731 "upstream-openbsd/android/gdtoa_support.cpp",
732 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
733 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
734 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
735 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
736 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
737 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
738 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
739 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
740 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
741 "upstream-openbsd/lib/libc/gdtoa/misc.c",
742 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
743 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
744 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
745 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
746 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
747 "upstream-openbsd/lib/libc/gdtoa/sum.c",
748 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
749 ],
750 multilib: {
751 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800752 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700753 },
754 },
755
Colin Cross50c21ab2015-10-31 23:03:05 -0700756 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700757 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700758 "-include openbsd-compat.h",
759 ],
760
Dan Willemsen208ae172015-09-16 16:33:27 -0700761 local_include_dirs: [
762 "private",
763 "upstream-openbsd/android/include",
764 "upstream-openbsd/lib/libc/include",
765 ],
766
767 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700768}
769
770// ========================================================
Pierre-Clément Tosi467e58e2023-02-01 13:44:43 +0000771// libc_fortify.a - container for our FORTIFY
George Burgess IV6cb06872017-07-21 13:28:42 -0700772// implementation details
773// ========================================================
774cc_library_static {
775 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700776 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700777
778 name: "libc_fortify",
779
780 // Disable FORTIFY for the compilation of these, so we don't end up having
781 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800782 cflags: [
783 "-U_FORTIFY_SOURCE",
784 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
785 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700786
787 arch: {
788 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800789 cflags: [
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800790 "-DRENAME___STRCAT_CHK",
791 "-DRENAME___STRCPY_CHK",
792 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700793 srcs: [
794 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800795
796 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
797 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
798
799 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
800 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
801
802 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
803 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
804
805 "arch-arm/krait/bionic/__strcat_chk.S",
806 "arch-arm/krait/bionic/__strcpy_chk.S",
807
808 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
809 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
810
Haibo Huang01bfd892018-12-03 15:05:16 -0800811 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
812 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700813 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700814 },
815 arm64: {
816 srcs: [
Elliott Hughes023e4e72022-11-17 19:27:02 +0000817 "arch-arm64/string/__memcpy_chk.S",
818 "arch-arm64/string/__memset_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700819 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700820 },
caowenchengab457f92023-03-06 14:57:55 +0800821 riscv64: {
822 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +0000823 "arch-riscv64/string/__memset_chk.S",
824 "arch-riscv64/string/__memcpy_chk.S",
caowenchengab457f92023-03-06 14:57:55 +0800825 ],
826 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700827 },
828}
829
830// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700831// libc_bionic.a - home-grown C library code
832// ========================================================
833
834cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700835 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700836 srcs: [
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800837 "bionic/NetdClientDispatch.cpp",
838 "bionic/__bionic_get_shell_path.cpp",
839 "bionic/__cmsg_nxthdr.cpp",
840 "bionic/__cxa_thread_atexit_impl.cpp",
841 "bionic/__errno.cpp",
842 "bionic/__gnu_basename.cpp",
843 "bionic/__libc_current_sigrtmax.cpp",
844 "bionic/__libc_current_sigrtmin.cpp",
845 "bionic/abort.cpp",
846 "bionic/accept.cpp",
847 "bionic/access.cpp",
Florian Mayerca4749a2024-02-14 12:55:46 -0800848 "bionic/android_crash_detail.cpp",
Josh Gao10ec9282017-04-03 15:13:29 -0700849 "bionic/android_set_abort_message.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000850 "bionic/android_unsafe_frame_pointer_chase.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800851 "bionic/arpa_inet.cpp",
852 "bionic/assert.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000853 "bionic/atexit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800854 "bionic/atof.cpp",
855 "bionic/bionic_allocator.cpp",
856 "bionic/bionic_arc4random.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000857 "bionic/bionic_elf_tls.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800858 "bionic/bionic_futex.cpp",
859 "bionic/bionic_netlink.cpp",
860 "bionic/bionic_systrace.cpp",
861 "bionic/bionic_time_conversions.cpp",
862 "bionic/brk.cpp",
863 "bionic/c16rtomb.cpp",
864 "bionic/c32rtomb.cpp",
865 "bionic/chmod.cpp",
866 "bionic/chown.cpp",
867 "bionic/clearenv.cpp",
868 "bionic/clock.cpp",
869 "bionic/clock_getcpuclockid.cpp",
870 "bionic/clock_nanosleep.cpp",
871 "bionic/clone.cpp",
872 "bionic/ctype.cpp",
873 "bionic/dirent.cpp",
874 "bionic/dup.cpp",
875 "bionic/environ.cpp",
876 "bionic/error.cpp",
877 "bionic/eventfd.cpp",
878 "bionic/exec.cpp",
879 "bionic/execinfo.cpp",
Elliott Hughes69bd8e92024-02-09 10:04:26 -0800880 "bionic/exit.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800881 "bionic/faccessat.cpp",
882 "bionic/fchmod.cpp",
883 "bionic/fchmodat.cpp",
884 "bionic/fcntl.cpp",
885 "bionic/fdsan.cpp",
886 "bionic/fdtrack.cpp",
887 "bionic/ffs.cpp",
888 "bionic/fgetxattr.cpp",
889 "bionic/flistxattr.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000890 "bionic/fork.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800891 "bionic/fpclassify.cpp",
892 "bionic/fsetxattr.cpp",
893 "bionic/ftruncate.cpp",
894 "bionic/ftw.cpp",
895 "bionic/futimens.cpp",
896 "bionic/getcwd.cpp",
897 "bionic/getdomainname.cpp",
898 "bionic/getentropy.cpp",
899 "bionic/gethostname.cpp",
900 "bionic/getloadavg.cpp",
901 "bionic/getpagesize.cpp",
902 "bionic/getpgrp.cpp",
903 "bionic/getpid.cpp",
904 "bionic/getpriority.cpp",
905 "bionic/gettid.cpp",
906 "bionic/get_device_api_level.cpp",
907 "bionic/grp_pwd.cpp",
908 "bionic/grp_pwd_file.cpp",
909 "bionic/heap_zero_init.cpp",
910 "bionic/iconv.cpp",
911 "bionic/icu_wrappers.cpp",
912 "bionic/ifaddrs.cpp",
913 "bionic/inotify_init.cpp",
914 "bionic/ioctl.cpp",
Elliott Hughes17e40682024-02-13 16:32:29 -0800915 "bionic/isatty.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800916 "bionic/killpg.cpp",
917 "bionic/langinfo.cpp",
918 "bionic/lchown.cpp",
919 "bionic/lfs64_support.cpp",
920 "bionic/libc_init_common.cpp",
921 "bionic/libgen.cpp",
922 "bionic/link.cpp",
923 "bionic/locale.cpp",
924 "bionic/lockf.cpp",
925 "bionic/lstat.cpp",
926 "bionic/mblen.cpp",
927 "bionic/mbrtoc16.cpp",
928 "bionic/mbrtoc32.cpp",
929 "bionic/mempcpy.cpp",
930 "bionic/memset_explicit.cpp",
931 "bionic/mkdir.cpp",
932 "bionic/mkfifo.cpp",
933 "bionic/mknod.cpp",
934 "bionic/mntent.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800935 "bionic/netdb.cpp",
Elliott Hughes3ed6e722024-02-16 01:18:01 +0000936 "bionic/net_if.cpp",
937 "bionic/netinet_ether.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800938 "bionic/netinet_in.cpp",
939 "bionic/nl_types.cpp",
940 "bionic/open.cpp",
941 "bionic/pathconf.cpp",
942 "bionic/pause.cpp",
943 "bionic/pidfd.cpp",
944 "bionic/pipe.cpp",
945 "bionic/poll.cpp",
946 "bionic/posix_fadvise.cpp",
947 "bionic/posix_fallocate.cpp",
948 "bionic/posix_madvise.cpp",
949 "bionic/posix_timers.cpp",
950 "bionic/preadv_pwritev.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000951 "bionic/pthread_atfork.cpp",
952 "bionic/pthread_attr.cpp",
953 "bionic/pthread_barrier.cpp",
954 "bionic/pthread_cond.cpp",
955 "bionic/pthread_create.cpp",
956 "bionic/pthread_detach.cpp",
957 "bionic/pthread_equal.cpp",
958 "bionic/pthread_exit.cpp",
959 "bionic/pthread_getcpuclockid.cpp",
960 "bionic/pthread_getschedparam.cpp",
961 "bionic/pthread_gettid_np.cpp",
962 "bionic/pthread_internal.cpp",
963 "bionic/pthread_join.cpp",
964 "bionic/pthread_key.cpp",
965 "bionic/pthread_kill.cpp",
966 "bionic/pthread_mutex.cpp",
967 "bionic/pthread_once.cpp",
968 "bionic/pthread_rwlock.cpp",
969 "bionic/pthread_sigqueue.cpp",
970 "bionic/pthread_self.cpp",
971 "bionic/pthread_setname_np.cpp",
972 "bionic/pthread_setschedparam.cpp",
973 "bionic/pthread_spinlock.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800974 "bionic/ptrace.cpp",
975 "bionic/pty.cpp",
976 "bionic/raise.cpp",
977 "bionic/rand.cpp",
978 "bionic/readlink.cpp",
979 "bionic/realpath.cpp",
980 "bionic/reboot.cpp",
981 "bionic/recv.cpp",
982 "bionic/recvmsg.cpp",
983 "bionic/rename.cpp",
984 "bionic/rmdir.cpp",
985 "bionic/scandir.cpp",
Elliott Hughes17e40682024-02-13 16:32:29 -0800986 "bionic/sched_cpualloc.cpp",
987 "bionic/sched_cpucount.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800988 "bionic/sched_getaffinity.cpp",
989 "bionic/sched_getcpu.cpp",
990 "bionic/semaphore.cpp",
991 "bionic/send.cpp",
992 "bionic/setegid.cpp",
993 "bionic/seteuid.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +0000994 "bionic/setjmp_cookie.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -0800995 "bionic/setpgrp.cpp",
996 "bionic/sigaction.cpp",
997 "bionic/signal.cpp",
998 "bionic/sigprocmask.cpp",
999 "bionic/sleep.cpp",
1000 "bionic/socketpair.cpp",
1001 "bionic/spawn.cpp",
1002 "bionic/stat.cpp",
1003 "bionic/stdlib_l.cpp",
1004 "bionic/strerror.cpp",
1005 "bionic/string_l.cpp",
1006 "bionic/strings_l.cpp",
1007 "bionic/strsignal.cpp",
1008 "bionic/strtol.cpp",
1009 "bionic/strtold.cpp",
1010 "bionic/swab.cpp",
1011 "bionic/symlink.cpp",
1012 "bionic/sync_file_range.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001013 "bionic/sysconf.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001014 "bionic/sys_epoll.cpp",
1015 "bionic/sys_msg.cpp",
1016 "bionic/sys_sem.cpp",
1017 "bionic/sys_shm.cpp",
1018 "bionic/sys_signalfd.cpp",
1019 "bionic/sys_statfs.cpp",
1020 "bionic/sys_statvfs.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001021 "bionic/sys_thread_properties.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001022 "bionic/sys_time.cpp",
1023 "bionic/sysinfo.cpp",
1024 "bionic/syslog.cpp",
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001025 "bionic/sysprop_helpers.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001026 "bionic/system.cpp",
1027 "bionic/system_property_api.cpp",
1028 "bionic/system_property_set.cpp",
1029 "bionic/tdestroy.cpp",
1030 "bionic/termios.cpp",
1031 "bionic/thread_private.cpp",
1032 "bionic/threads.cpp",
1033 "bionic/time.cpp",
1034 "bionic/time_l.cpp",
1035 "bionic/tmpfile.cpp",
1036 "bionic/umount.cpp",
1037 "bionic/unlink.cpp",
1038 "bionic/usleep.cpp",
1039 "bionic/utmp.cpp",
Elliott Hughesb0948922024-01-26 00:28:12 +00001040 "bionic/vdso.cpp",
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001041 "bionic/wait.cpp",
1042 "bionic/wchar.cpp",
1043 "bionic/wchar_l.cpp",
1044 "bionic/wcstod.cpp",
1045 "bionic/wctype.cpp",
1046 "bionic/wcwidth.cpp",
1047 "bionic/wmempcpy.cpp",
1048
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001049 // Forked but not yet cleaned up/rewritten stdio code.
1050 // TODO: finish cleanup.
1051 "stdio/fmemopen.cpp",
1052 "stdio/parsefloat.c",
1053 "stdio/refill.c",
1054 "stdio/stdio.cpp",
1055 "stdio/stdio_ext.cpp",
1056 "stdio/vfscanf.cpp",
1057 "stdio/vfwscanf.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001058 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001059
1060 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001061 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -07001062 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001063 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -08001064 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001065 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001066 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001067 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -07001068 "arch-arm/bionic/atomics_arm.c",
1069 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -08001070 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001071 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001072 "arch-arm/bionic/setjmp.S",
1073 "arch-arm/bionic/syscall.S",
1074 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001075
Haibo Huangea9957a2018-11-19 11:00:32 -08001076 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001077 "arch-arm/cortex-a7/bionic/memset.S",
1078
1079 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001080 "arch-arm/cortex-a9/bionic/memset.S",
1081 "arch-arm/cortex-a9/bionic/stpcpy.S",
1082 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001083 "arch-arm/cortex-a9/bionic/strcpy.S",
1084 "arch-arm/cortex-a9/bionic/strlen.S",
1085
Elliott Hughesaefe9992023-11-08 12:04:41 -08001086 "arch-arm/cortex-a15/bionic/memcpy.S",
1087 "arch-arm/cortex-a15/bionic/memmove.S",
1088 "arch-arm/cortex-a15/bionic/memset.S",
1089 "arch-arm/cortex-a15/bionic/stpcpy.S",
1090 "arch-arm/cortex-a15/bionic/strcat.S",
1091 "arch-arm/cortex-a15/bionic/strcmp.S",
1092 "arch-arm/cortex-a15/bionic/strcpy.S",
1093 "arch-arm/cortex-a15/bionic/strlen.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001094
1095 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001096
Haibo Huang01bfd892018-12-03 15:05:16 -08001097 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -08001098
Elliott Hughesaefe9992023-11-08 12:04:41 -08001099 "arch-arm/generic/bionic/memcmp.S",
1100 "arch-arm/generic/bionic/memmove.S",
1101 "arch-arm/generic/bionic/memset.S",
1102 "arch-arm/generic/bionic/stpcpy.c",
1103 "arch-arm/generic/bionic/strcat.c",
1104 "arch-arm/generic/bionic/strcmp.S",
1105 "arch-arm/generic/bionic/strcpy.S",
1106 "arch-arm/generic/bionic/strlen.c",
1107
1108 "arch-arm/krait/bionic/memcpy.S",
1109 "arch-arm/krait/bionic/memset.S",
1110
Haibo Huangea9957a2018-11-19 11:00:32 -08001111 "arch-arm/kryo/bionic/memcpy.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001112
1113 "bionic/strchr.cpp",
1114 "bionic/strchrnul.cpp",
1115 "bionic/strnlen.cpp",
1116 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001117 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001118 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001119 arm64: {
1120 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001121 "arch-arm64/bionic/__bionic_clone.S",
1122 "arch-arm64/bionic/_exit_with_stack_teardown.S",
1123 "arch-arm64/bionic/setjmp.S",
1124 "arch-arm64/bionic/syscall.S",
1125 "arch-arm64/bionic/vfork.S",
Vaisakh K V83e55842024-03-29 12:47:39 +05301126 "arch-arm64/oryon/memcpy-nt.S",
Vaisakh K V54a61212024-03-29 13:32:45 +05301127 "arch-arm64/oryon/memset-nt.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001128 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001129 },
1130
Elliott Hughesebc19a92022-10-14 23:25:36 +00001131 riscv64: {
1132 srcs: [
1133 "arch-riscv64/bionic/__bionic_clone.S",
1134 "arch-riscv64/bionic/_exit_with_stack_teardown.S",
Elliott Hughese1905ed2022-10-17 23:23:36 +00001135 "arch-riscv64/bionic/setjmp.S",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001136 "arch-riscv64/bionic/syscall.S",
1137 "arch-riscv64/bionic/vfork.S",
Yun Hsiang40a82d02023-05-26 10:10:40 +08001138
Elliott Hughesaefe9992023-11-08 12:04:41 -08001139 "arch-riscv64/string/memchr_v.S",
1140 "arch-riscv64/string/memcmp_v.S",
1141 "arch-riscv64/string/memcpy_v.S",
1142 "arch-riscv64/string/memmove_v.S",
1143 "arch-riscv64/string/memset_v.S",
1144 "arch-riscv64/string/stpcpy_v.S",
1145 "arch-riscv64/string/strcat_v.S",
1146 "arch-riscv64/string/strchr_v.S",
1147 "arch-riscv64/string/strcmp_v.S",
1148 "arch-riscv64/string/strcpy_v.S",
1149 "arch-riscv64/string/strlen_v.S",
1150 "arch-riscv64/string/strncat_v.S",
1151 "arch-riscv64/string/strncmp_v.S",
1152 "arch-riscv64/string/strncpy_v.S",
1153 "arch-riscv64/string/strnlen_v.S",
1154
1155 "arch-riscv64/string/memchr.c",
1156 "arch-riscv64/string/memcmp.c",
1157 "arch-riscv64/string/memcpy.c",
1158 "arch-riscv64/string/memmove.c",
1159 "arch-riscv64/string/memset.c",
1160 "arch-riscv64/string/stpcpy.c",
1161 "arch-riscv64/string/strcat.c",
1162 "arch-riscv64/string/strchr.c",
1163 "arch-riscv64/string/strcmp.c",
1164 "arch-riscv64/string/strcpy.c",
1165 "arch-riscv64/string/strlen.c",
1166 "arch-riscv64/string/strncat.c",
1167 "arch-riscv64/string/strncmp.c",
1168 "arch-riscv64/string/strncpy.c",
1169 "arch-riscv64/string/strnlen.c",
Prashanth Swaminathana4d71022023-10-30 17:35:19 -07001170
Elliott Hughes7d136662023-10-27 15:40:32 -07001171 "bionic/strchrnul.cpp",
1172 "bionic/strrchr.cpp",
Elliott Hughesebc19a92022-10-14 23:25:36 +00001173 ],
1174 },
1175
Dan Willemsen208ae172015-09-16 16:33:27 -07001176 x86: {
1177 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001178 "arch-x86/bionic/__bionic_clone.S",
1179 "arch-x86/bionic/_exit_with_stack_teardown.S",
1180 "arch-x86/bionic/libcrt_compat.c",
Elliott Hughes7d136662023-10-27 15:40:32 -07001181 "arch-x86/bionic/setjmp.S",
1182 "arch-x86/bionic/syscall.S",
1183 "arch-x86/bionic/vfork.S",
1184 "arch-x86/bionic/__x86.get_pc_thunk.S",
1185
Dan Willemsen208ae172015-09-16 16:33:27 -07001186 "arch-x86/generic/string/memcmp.S",
1187 "arch-x86/generic/string/strcmp.S",
1188 "arch-x86/generic/string/strncmp.S",
1189 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001190
1191 "arch-x86/generic/string/strlcat.c",
1192 "arch-x86/generic/string/strlcpy.c",
1193 "arch-x86/generic/string/strncat.c",
1194 "arch-x86/generic/string/wcscat.c",
1195 "arch-x86/generic/string/wcscpy.c",
1196 "arch-x86/generic/string/wmemcmp.c",
1197
Elliott Hughesed777142022-07-25 16:25:11 +00001198 "arch-x86/string/sse2-memchr-atom.S",
1199 "arch-x86/string/sse2-memmove-slm.S",
1200 "arch-x86/string/sse2-memrchr-atom.S",
1201 "arch-x86/string/sse2-memset-atom.S",
1202 "arch-x86/string/sse2-memset-slm.S",
1203 "arch-x86/string/sse2-stpcpy-slm.S",
1204 "arch-x86/string/sse2-stpncpy-slm.S",
1205 "arch-x86/string/sse2-strchr-atom.S",
1206 "arch-x86/string/sse2-strcpy-slm.S",
1207 "arch-x86/string/sse2-strlen-slm.S",
1208 "arch-x86/string/sse2-strncpy-slm.S",
1209 "arch-x86/string/sse2-strnlen-atom.S",
1210 "arch-x86/string/sse2-strrchr-atom.S",
1211 "arch-x86/string/sse2-wcschr-atom.S",
1212 "arch-x86/string/sse2-wcsrchr-atom.S",
1213 "arch-x86/string/sse2-wcslen-atom.S",
1214 "arch-x86/string/sse2-wcscmp-atom.S",
1215 "arch-x86/string/sse2-strlen-atom.S",
1216
1217 "arch-x86/string/ssse3-memcmp-atom.S",
1218 "arch-x86/string/ssse3-memmove-atom.S",
1219 "arch-x86/string/ssse3-strcat-atom.S",
1220 "arch-x86/string/ssse3-strcmp-atom.S",
1221 "arch-x86/string/ssse3-strcpy-atom.S",
1222 "arch-x86/string/ssse3-strlcat-atom.S",
1223 "arch-x86/string/ssse3-strlcpy-atom.S",
1224 "arch-x86/string/ssse3-strncat-atom.S",
1225 "arch-x86/string/ssse3-strncmp-atom.S",
1226 "arch-x86/string/ssse3-strncpy-atom.S",
1227 "arch-x86/string/ssse3-wcscat-atom.S",
1228 "arch-x86/string/ssse3-wcscpy-atom.S",
1229 "arch-x86/string/ssse3-wmemcmp-atom.S",
1230
1231 "arch-x86/string/sse4-memcmp-slm.S",
1232 "arch-x86/string/sse4-wmemcmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001233
1234 "bionic/strchrnul.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001235 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001236 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001237 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001238 srcs: [
Elliott Hughes7d136662023-10-27 15:40:32 -07001239 "arch-x86_64/bionic/__bionic_clone.S",
1240 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1241 "arch-x86_64/bionic/__restore_rt.S",
1242 "arch-x86_64/bionic/setjmp.S",
1243 "arch-x86_64/bionic/syscall.S",
1244 "arch-x86_64/bionic/vfork.S",
1245
ahs919fb7f2022-06-10 07:11:14 +05301246 "arch-x86_64/string/avx2-memset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001247 "arch-x86_64/string/sse2-memmove-slm.S",
1248 "arch-x86_64/string/sse2-memset-slm.S",
1249 "arch-x86_64/string/sse2-stpcpy-slm.S",
1250 "arch-x86_64/string/sse2-stpncpy-slm.S",
1251 "arch-x86_64/string/sse2-strcat-slm.S",
1252 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001253 "arch-x86_64/string/sse2-strlen-slm.S",
1254 "arch-x86_64/string/sse2-strncat-slm.S",
1255 "arch-x86_64/string/sse2-strncpy-slm.S",
1256 "arch-x86_64/string/sse4-memcmp-slm.S",
1257 "arch-x86_64/string/ssse3-strcmp-slm.S",
1258 "arch-x86_64/string/ssse3-strncmp-slm.S",
Elliott Hughesaefe9992023-11-08 12:04:41 -08001259
1260 "bionic/strchr.cpp",
1261 "bionic/strchrnul.cpp",
1262 "bionic/strnlen.cpp",
1263 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001264 ],
1265 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001266 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001267
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001268 multilib: {
1269 lib32: {
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001270 srcs: [
1271 // off64_t/time64_t support on LP32.
1272 "bionic/legacy_32_bit_support.cpp",
1273 "bionic/time64.c",
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001274 ],
Elliott Hughes2e2b9bc2024-02-07 16:10:23 -08001275 },
1276 },
1277
1278 local_include_dirs: ["stdio"],
1279 generated_headers: ["generated_android_ids"],
1280
1281 whole_static_libs: [
1282 "libsystemproperties",
1283 ],
1284
Colin Cross50c21ab2015-10-31 23:03:05 -07001285 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001286 include_dirs: ["bionic/libstdc++/include"],
1287 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001288}
1289
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001290genrule {
1291 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001292 out: ["generated_android_ids.h"],
1293 srcs: [":android_filesystem_config_header"],
Cole Faustb1a0a9d2023-11-28 17:51:16 -08001294 tools: ["fs_config_generator"],
1295 cmd: "$(location fs_config_generator) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001296}
1297
Dan Willemsen268a6732015-10-15 14:49:45 -07001298// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001299// libc_syscalls.a
1300// ========================================================
1301
Elliott Hughes782c4852019-04-16 12:31:00 -07001302genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001303 name: "syscalls-arm",
Elliott Hughes782c4852019-04-16 12:31:00 -07001304 out: ["syscalls-arm.S"],
1305 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001306 tools: ["gensyscalls"],
1307 cmd: "$(location gensyscalls) arm $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001308}
1309
1310genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001311 name: "syscalls-arm64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001312 out: ["syscalls-arm64.S"],
1313 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001314 tools: ["gensyscalls"],
1315 cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001316}
1317
1318genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001319 name: "syscalls-riscv64",
Elliott Hughes704772b2022-10-10 17:06:43 +00001320 out: ["syscalls-riscv64.S"],
1321 srcs: ["SYSCALLS.TXT"],
1322 tools: ["gensyscalls"],
1323 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
1324}
1325
1326genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001327 name: "syscalls-x86",
Elliott Hughes782c4852019-04-16 12:31:00 -07001328 out: ["syscalls-x86.S"],
1329 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001330 tools: ["gensyscalls"],
1331 cmd: "$(location gensyscalls) x86 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001332}
1333
1334genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001335 name: "syscalls-x86_64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001336 out: ["syscalls-x86_64.S"],
1337 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001338 tools: ["gensyscalls"],
1339 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001340}
1341
Dan Willemsen208ae172015-09-16 16:33:27 -07001342cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001343 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001344 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001345 arch: {
1346 arm: {
Cole Faustf5968d82023-04-11 15:20:19 -07001347 srcs: [":syscalls-arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001348 },
1349 arm64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001350 srcs: [":syscalls-arm64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001351 },
Elliott Hughes704772b2022-10-10 17:06:43 +00001352 riscv64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001353 srcs: [":syscalls-riscv64"],
Elliott Hughes704772b2022-10-10 17:06:43 +00001354 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001355 x86: {
Cole Faustf5968d82023-04-11 15:20:19 -07001356 srcs: [":syscalls-x86"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001357 },
1358 x86_64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001359 srcs: [":syscalls-x86_64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001360 },
1361 },
1362 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001363}
1364
1365// ========================================================
1366// libc_aeabi.a
1367// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1368// to avoid infinite recursion. For the other architectures we just build an
1369// empty library to keep this makefile simple.
1370// ========================================================
1371
1372cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001373 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001374 arch: {
1375 arm: {
1376 srcs: ["arch-arm/bionic/__aeabi.c"],
1377 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001378 },
1379 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001380 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001381}
1382
1383// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001384// libc_common.a --- everything shared by libc.a and libc.so
Dan Willemsen208ae172015-09-16 16:33:27 -07001385// ========================================================
Elliott Hughesb0948922024-01-26 00:28:12 +00001386
Dan Willemsen208ae172015-09-16 16:33:27 -07001387cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001388 defaults: ["libc_defaults"],
Elliott Hughesb0948922024-01-26 00:28:12 +00001389 name: "libc_common",
1390
Dan Willemsen208ae172015-09-16 16:33:27 -07001391 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001392 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001393 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001394 "libc_bionic",
Ryan Prichard249757b2019-11-01 17:18:28 -07001395 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001396 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001397 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001398 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001399 "libc_freebsd_large_stack",
Elliott Hughesc2043342023-07-20 20:24:09 +00001400 "libc_freebsd_ldexp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001401 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001402 "libc_netbsd",
1403 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001404 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001405 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001406 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001407 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001408 ],
1409
1410 arch: {
1411 arm: {
1412 whole_static_libs: ["libc_aeabi"],
1413 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001414 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001415}
1416
1417// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001418// libc_static_dispatch.a --- libc.a ifuncs
Haibo Huangf71edfa2018-11-12 10:06:56 -08001419// ========================================================
1420cc_library_static {
1421 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001422 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001423
Haibo Huangb9244ff2018-08-11 10:12:13 -07001424 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301425 x86_64: {
1426 srcs: ["arch-x86_64/static_function_dispatch.S"],
1427 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001428 x86: {
1429 srcs: ["arch-x86/static_function_dispatch.S"],
1430 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001431 arm: {
1432 srcs: ["arch-arm/static_function_dispatch.S"],
1433 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001434 arm64: {
1435 srcs: ["arch-arm64/static_function_dispatch.S"],
1436 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001437 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001438 srcs: ["arch-riscv64/static_function_dispatch.S"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001439 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001440 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001441}
1442
1443// ========================================================
Elliott Hughes69bd8e92024-02-09 10:04:26 -08001444// libc_dynamic_dispatch.a --- libc.so ifuncs
Haibo Huangf71edfa2018-11-12 10:06:56 -08001445// ========================================================
1446cc_library_static {
1447 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001448 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001449
Haibo Huangb9244ff2018-08-11 10:12:13 -07001450 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001451 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001452 "-fno-stack-protector",
1453 "-fno-jump-tables",
1454 ],
1455 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301456 x86_64: {
1457 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
1458 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001459 x86: {
1460 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1461 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001462 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001463 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001464 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001465 arm64: {
1466 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1467 },
Elliott Hughesaefe9992023-11-08 12:04:41 -08001468 riscv64: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001469 srcs: ["arch-riscv64/dynamic_function_dispatch.cpp"],
Elliott Hughesaefe9992023-11-08 12:04:41 -08001470 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001471 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001472}
1473
1474// ========================================================
1475// libc_common_static.a For static binaries.
1476// ========================================================
1477cc_library_static {
1478 defaults: ["libc_defaults"],
1479 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001480
Haibo Huangf71edfa2018-11-12 10:06:56 -08001481 whole_static_libs: [
1482 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001483 "libc_static_dispatch",
1484 ],
1485}
1486
1487// ========================================================
1488// libc_common_shared.a For shared libraries.
1489// ========================================================
1490cc_library_static {
1491 defaults: ["libc_defaults"],
1492 name: "libc_common_shared",
1493
1494 whole_static_libs: [
1495 "libc_common",
1496 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001497 ],
1498}
1499
Ryan Prichard22a6a052019-10-10 23:59:30 -07001500// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1501// executable.
1502cc_library_static {
1503 name: "libc_unwind_static",
1504 defaults: ["libc_defaults"],
1505 cflags: ["-DLIBC_STATIC"],
1506
1507 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1508 arch: {
1509 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1510 arm: {
1511 srcs: ["arch-arm/bionic/exidx_static.c"],
1512 },
1513 },
1514}
1515
Haibo Huangf71edfa2018-11-12 10:06:56 -08001516// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001517// libc_nomalloc.a
1518// ========================================================
1519//
Ryan Prichard249757b2019-11-01 17:18:28 -07001520// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1521// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1522// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001523
1524cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001525 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001526 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001527
Colin Crossa3f9fca2016-01-11 13:20:55 -08001528 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001529 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001530 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001531 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001532 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001533}
1534
dimitryc0c0ef62018-12-05 16:33:52 +01001535filegroup {
1536 name: "libc_sources_shared",
1537 srcs: [
1538 "arch-common/bionic/crtbegin_so.c",
1539 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001540 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001541 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001542 "bionic/icu.cpp",
1543 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001544 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001545 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001546 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001547 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001548 "bionic/ndk_cruft.cpp",
1549 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001550 "bionic/NetdClient.cpp",
1551 "arch-common/bionic/crtend_so.S",
1552 ],
1553}
1554
1555filegroup {
1556 name: "libc_sources_static",
1557 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001558 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001559 "bionic/heap_tagging.cpp",
Elliott Hughes72b0f3b2024-07-02 20:22:35 +00001560 "bionic/icu_static.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001561 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001562 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001563 ],
1564}
1565
1566filegroup {
1567 name: "libc_sources_shared_arm",
1568 srcs: [
1569 "arch-arm/bionic/exidx_dynamic.c",
1570 "arch-arm/bionic/atexit_legacy.c",
1571 ],
1572}
1573
Dan Willemsen208ae172015-09-16 16:33:27 -07001574// ========================================================
1575// libc.a + libc.so
1576// ========================================================
Florian Mayerc10d0642023-03-22 16:12:49 -07001577cc_defaults {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001578 defaults: [
1579 "libc_defaults",
1580 "libc_native_allocator_defaults",
Elliott Hughes788075a2024-06-18 12:25:37 +00001581 "bug_24465209_workaround",
Elliott Hughes89aada12024-07-01 21:59:04 +00001582 "keep_symbols",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001583 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001584 name: "libc_library_defaults",
Colin Cross50c21ab2015-10-31 23:03:05 -07001585 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001586 platform_sdk_version: {
1587 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1588 },
1589 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001590 static: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001591 srcs: [":libc_sources_static"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001592 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001593 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001594 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001595 "libc_init_static",
1596 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001597 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001598 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001599 },
1600 shared: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001601 srcs: [":libc_sources_shared"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001602 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001603 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001604 "libc_init_dynamic",
1605 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001606 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001607 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001608 },
1609
Neil Fullera7db90f2019-04-25 09:28:27 +01001610 required: [
MarkDacekd88d7ea2022-06-28 20:14:58 +00001611 "tzdata_prebuilt",
1612 "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
Neil Fullera7db90f2019-04-25 09:28:27 +01001613 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001614
Colin Cross4ce94d22016-11-15 13:15:43 -08001615 // Do not pack libc.so relocations; see http://b/20645321 for details.
1616 pack_relocations: false,
1617
dimitry06016f22018-01-05 11:39:28 +01001618 shared_libs: [
1619 "ld-android",
1620 "libdl",
1621 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001622 static_libs: [
1623 "libdl_android",
1624 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001625
1626 nocrt: true,
1627
Dan Willemsen208ae172015-09-16 16:33:27 -07001628 arch: {
1629 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001630 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001631 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001632
Dan Willemsen208ae172015-09-16 16:33:27 -07001633 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001634 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001635 // special for arm
1636 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Elliott Hughes89aada12024-07-01 21:59:04 +00001637 // For backwards compatibility, some arm32 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001638 static_libs: ["libclang_rt.builtins-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001639 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001640
Elliott Hughes89aada12024-07-01 21:59:04 +00001641 ldflags: [
1642 // Since we preserve the debug_frame for libc, do not compress
1643 // in this case to make unwinds as fast as possible.
1644 "-Wl,--compress-debug-sections=none",
1645 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001646 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001647 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001648 version_script: ":libc.arm64.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001649 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001650 riscv64: {
1651 version_script: ":libc.riscv64.map",
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001652 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001653 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001654 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001655 no_libcrt: true,
1656
1657 shared: {
Elliott Hughes89aada12024-07-01 21:59:04 +00001658 // For backwards compatibility, some x86 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001659 static_libs: ["libclang_rt.builtins-exported"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001660 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001661 },
1662 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001663 version_script: ":libc.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001664 },
1665 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001666
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001667 apex_available: [
1668 "//apex_available:platform",
1669 "com.android.runtime",
1670 ],
1671
Colin Cross7edd0082021-10-28 13:20:35 -07001672 target: {
1673 native_bridge: {
1674 shared: {
1675 installable: false,
1676 },
1677 },
1678 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001679}
1680
Florian Mayerc10d0642023-03-22 16:12:49 -07001681cc_library {
1682 name: "libc",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001683 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001684 "libc_library_defaults",
1685 ],
1686 stubs: {
1687 symbol_file: "libc.map.txt",
1688 versions: [
1689 "29",
1690 "R",
1691 "current",
1692 ],
1693 },
1694 static_ndk_lib: true,
1695 llndk: {
1696 symbol_file: "libc.map.txt",
1697 export_headers_as_system: true,
1698 export_preprocessed_headers: ["include"],
1699 export_llndk_headers: ["libc_llndk_headers"],
1700 },
1701}
1702
1703cc_library {
1704 name: "libc_hwasan",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001705 defaults: [
Florian Mayerc10d0642023-03-22 16:12:49 -07001706 "libc_library_defaults",
1707 ],
1708 sanitize: {
1709 hwaddress: true,
1710 },
1711 enabled: false,
Florian Mayerff116ed2023-04-14 17:38:53 -07001712 target: {
1713 android_arm64: {
Florian Mayerc10d0642023-03-22 16:12:49 -07001714 enabled: true,
1715 },
1716 },
1717 stem: "libc",
1718 relative_install_path: "hwasan",
1719 // We don't really need the stubs, but this needs to stay to trigger the
1720 // symlink logic in soong.
1721 stubs: {
1722 symbol_file: "libc.map.txt",
1723 },
1724 native_bridge_supported: false,
1725 // It is never correct to depend on this directly. This is only
1726 // needed for the runtime apex, and in base_system.mk.
1727 visibility: ["//bionic/apex"],
1728}
1729
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001730genrule {
1731 name: "libc.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001732 out: ["libc.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001733 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001734 tools: ["generate-version-script"],
1735 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001736}
1737
1738genrule {
1739 name: "libc.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001740 out: ["libc.arm64.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) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001744}
1745
1746genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001747 name: "libc.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001748 out: ["libc.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001749 srcs: ["libc.map.txt"],
1750 tools: ["generate-version-script"],
1751 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1752}
1753
1754genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001755 name: "libc.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001756 out: ["libc.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001757 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001758 tools: ["generate-version-script"],
1759 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001760}
1761
1762genrule {
1763 name: "libc.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001764 out: ["libc.x86_64.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_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001768}
1769
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001770// Headers that only other parts of the platform can include.
1771cc_library_headers {
1772 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001773 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001774 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001775 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001776 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001777 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001778 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001779 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001780 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001781 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001782 "//system/core/debuggerd:__subpackages__",
Florian Mayerf5d70ce2022-09-13 13:58:30 -07001783 "//system/core/init:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001784 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001785 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001786 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001787 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001788 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001789 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001790 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001791 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001792 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001793 recovery_available: true,
1794 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001795 export_include_dirs: [
1796 "platform",
1797 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001798 system_shared_libs: [],
1799 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001800 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001801
Steven Moreland0cdf1322020-10-05 21:55:26 +00001802 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001803 apex_available: [
1804 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001805 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001806 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001807}
1808
Logan Chien17af91b2019-01-15 21:19:56 +08001809cc_library_headers {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001810 name: "libc_llndk_headers",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001811 visibility: [
1812 "//external/musl",
1813 ],
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001814 llndk: {
1815 llndk_headers: true,
1816 },
Logan Chien17af91b2019-01-15 21:19:56 +08001817 host_supported: true,
1818 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001819 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001820 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001821 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001822 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001823 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001824 apex_available: [
1825 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001826 "//apex_available:anyapex",
1827 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001828 // used by most APEXes indirectly via libunwind_llvm
1829 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001830
1831 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001832 stl: "none",
1833 system_shared_libs: [],
1834
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001835 // The build system generally requires that any dependencies of a target
1836 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1837 // to 1 we let targets with an sdk_version that need to depend on the libc
1838 // headers but cannot depend on libc itself due to circular dependencies
1839 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1840 // is correct because the headers can support any sdk_version.
1841 sdk_version: "1",
1842
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001843 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001844 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001845 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001846 "kernel/android/uapi",
1847 ],
1848
1849 arch: {
1850 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001851 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001852 },
1853 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001854 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001855 },
Elliott Hughes48e53332022-10-07 20:39:25 +00001856 riscv64: {
1857 export_system_include_dirs: ["kernel/uapi/asm-riscv"],
1858 },
Logan Chien17af91b2019-01-15 21:19:56 +08001859 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001860 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001861 },
1862 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001863 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001864 },
1865 },
1866}
1867
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001868cc_library_headers {
1869 name: "libc_headers",
1870 host_supported: true,
1871 native_bridge_supported: true,
1872 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001873 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001874 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001875 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001876 recovery_available: true,
1877 sdk_version: "1",
1878
1879 apex_available: [
1880 "//apex_available:platform",
1881 "//apex_available:anyapex",
1882 ],
1883 // used by most APEXes indirectly via libunwind_llvm
1884 min_sdk_version: "apex_inherit",
1885 visibility: [
1886 "//bionic:__subpackages__", // visible to bionic
1887 // ... and only to these places (b/152668052)
1888 "//external/arm-optimized-routines",
1889 "//external/gwp_asan",
1890 "//external/jemalloc_new",
1891 "//external/libunwind_llvm",
Nick Desaulniers942ae552024-02-12 10:26:19 -08001892 "//external/llvm-libc",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001893 "//external/scudo",
1894 "//system/core/property_service/libpropertyinfoparser",
1895 "//system/extras/toolchain-extras",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001896 ],
1897
1898 stl: "none",
1899 no_libcrt: true,
1900 system_shared_libs: [],
1901
1902 target: {
1903 android: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001904 export_system_include_dirs: ["include"],
1905 header_libs: ["libc_llndk_headers"],
1906 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001907 },
1908 linux_bionic: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001909 export_system_include_dirs: ["include"],
1910 header_libs: ["libc_llndk_headers"],
1911 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001912 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001913 },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001914}
1915
Dan Willemsen208ae172015-09-16 16:33:27 -07001916// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001917// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001918// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001919
Dan Willemsen208ae172015-09-16 16:33:27 -07001920cc_library {
Elliott Hughes788075a2024-06-18 12:25:37 +00001921 defaults: [
1922 "libc_defaults",
1923 "bug_24465209_workaround",
1924 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001925 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001926 srcs: [
1927 "bionic/__cxa_guard.cpp",
1928 "bionic/__cxa_pure_virtual.cpp",
1929 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001930 ],
1931 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001932 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001933 static_libs: ["libasync_safe"],
Elliott Hughesc2043342023-07-20 20:24:09 +00001934 apex_available: [
1935 "//apex_available:platform",
1936 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001937
Dan Willemsen6b3be172018-12-03 13:57:20 -08001938 static: {
1939 system_shared_libs: [],
1940 },
Colin Crossb5bfe0b2021-07-13 16:26:28 -07001941 target: {
1942 bionic: {
1943 shared: {
1944 system_shared_libs: ["libc"],
1945 },
1946 },
Dan Willemsen6b3be172018-12-03 13:57:20 -08001947 },
1948
Dan Willemsen208ae172015-09-16 16:33:27 -07001949 arch: {
1950 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001951 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001952 },
1953 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001954 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001955 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001956 riscv64: {
1957 version_script: ":libstdc++.riscv64.map",
1958 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001959 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001960 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001961 },
1962 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001963 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001964 },
1965 },
1966}
1967
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001968genrule {
1969 name: "libstdc++.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001970 out: ["libstdc++.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001971 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001972 tools: ["generate-version-script"],
1973 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001974}
1975
1976genrule {
1977 name: "libstdc++.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001978 out: ["libstdc++.arm64.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) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001982}
1983
1984genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001985 name: "libstdc++.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001986 out: ["libstdc++.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001987 srcs: ["libstdc++.map.txt"],
1988 tools: ["generate-version-script"],
1989 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1990}
1991
1992genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001993 name: "libstdc++.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001994 out: ["libstdc++.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001995 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001996 tools: ["generate-version-script"],
1997 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001998}
1999
2000genrule {
2001 name: "libstdc++.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002002 out: ["libstdc++.x86_64.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_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002006}
2007
2008// ========================================================
2009// crt object files.
2010// ========================================================
2011
Colin Cross50c21ab2015-10-31 23:03:05 -07002012cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002013 name: "crt_and_memtag_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002014 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002015 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002016 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002017 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002018 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002019 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002020 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002021 apex_available: [
2022 "//apex_available:platform",
2023 "//apex_available:anyapex",
2024 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002025 // Generate NDK variants of the CRT objects for every supported API level.
2026 min_sdk_version: "16",
2027 stl: "none",
2028 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002029 cflags: [
2030 "-Wno-gcc-compat",
2031 "-Wall",
2032 "-Werror",
2033 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002034 sanitize: {
2035 never: true,
2036 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002037}
2038
Colin Cross50c21ab2015-10-31 23:03:05 -07002039cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002040 name: "crt_defaults",
2041 defaults: ["crt_and_memtag_defaults"],
Colin Cross02f81372021-07-22 12:02:10 -07002042 system_shared_libs: [],
Colin Cross10d92682021-06-22 13:25:46 -07002043}
2044
2045cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002046 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002047 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002048
2049 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002050 x86: {
2051 cflags: ["-fPIC"],
2052 },
2053 x86_64: {
2054 cflags: ["-fPIC"],
2055 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002056 },
Colin Crossab179442018-09-27 11:03:22 -07002057 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002058}
2059
Dan Willemsen208ae172015-09-16 16:33:27 -07002060cc_object {
2061 name: "crtbrand",
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002062 local_include_dirs: [
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002063 "private", // crtbrand.S depends on private/bionic_asm_note.h
2064 ],
Elliott Hughes6a30b712024-03-13 23:41:32 +00002065 // crtbrand.S needs to know the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002066 product_variables: {
2067 platform_sdk_version: {
2068 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2069 },
2070 },
2071 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002072
Colin Cross7d7b3682017-11-03 13:38:40 -07002073 defaults: ["crt_so_defaults"],
Dan Alberteee46dc2023-04-04 23:27:52 +00002074 // crtbrand is an intermediate artifact, not a final CRT object.
2075 exclude_from_ndk_sysroot: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07002076}
2077
Dan Willemsen208ae172015-09-16 16:33:27 -07002078cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002079 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002080 local_include_dirs: ["include"],
2081 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002082
Colin Cross7d7b3682017-11-03 13:38:40 -07002083 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002084 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002085 "crtbrand",
2086 ],
2087}
2088
Dan Willemsen208ae172015-09-16 16:33:27 -07002089cc_object {
2090 name: "crtend_so",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002091 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002092 "private", // crtend_so.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002093 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002094 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002095
Colin Cross7d7b3682017-11-03 13:38:40 -07002096 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002097}
2098
Dan Willemsen208ae172015-09-16 16:33:27 -07002099cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002100 name: "crtbegin_static",
2101
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002102 local_include_dirs: [
2103 "include",
2104 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2105 ],
Liz Kammere718dd72021-03-09 15:00:06 -05002106
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002107 cflags: ["-DCRTBEGIN_STATIC"],
Yabin Cui744cfd32023-08-24 13:20:23 -07002108
Dan Willemsen208ae172015-09-16 16:33:27 -07002109 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002110 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002111 "crtbrand",
2112 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002113 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002114 // When using libc.a, we're using the latest library regardless of target API level.
2115 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002116}
2117
Dan Willemsen208ae172015-09-16 16:33:27 -07002118cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002119 name: "crtbegin_dynamic",
2120
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002121 local_include_dirs: [
2122 "include",
2123 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2124 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002125 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002126 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002127 "crtbrand",
2128 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002129 target: {
2130 linux_bionic: {
2131 generated_sources: ["host_bionic_linker_asm"],
2132 objs: [
2133 "linker_wrapper",
2134 ],
2135 },
2136 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002137 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002138}
2139
Dan Willemsen208ae172015-09-16 16:33:27 -07002140cc_object {
2141 // We rename crtend.o to crtend_android.o to avoid a
2142 // name clash between gcc and bionic.
2143 name: "crtend_android",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002144 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002145 "private", // crtend.S depends on private/bionic_asm_arm64.h
Liz Kammeraab2ad72021-03-15 18:03:24 -04002146 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002147 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002148
Colin Cross50c21ab2015-10-31 23:03:05 -07002149 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002150}
Colin Crossbaa48992016-07-13 11:15:21 -07002151
Kalesh Singh862a23d2024-01-09 13:13:50 -08002152cc_object {
2153 name: "crt_pad_segment",
2154 local_include_dirs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002155 "private", // crt_pad_segment.S depends on private/bionic_asm_note.h
Kalesh Singh862a23d2024-01-09 13:13:50 -08002156 ],
2157 srcs: ["arch-common/bionic/crt_pad_segment.S"],
2158
2159 defaults: ["crt_defaults"],
2160}
2161
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002162cc_library_static {
2163 name: "note_memtag_heap_async",
2164 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002165 arm64: {
2166 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2167 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002168 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002169 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002170
Colin Cross10d92682021-06-22 13:25:46 -07002171 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002172}
2173
2174cc_library_static {
2175 name: "note_memtag_heap_sync",
2176 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002177 arm64: {
2178 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2179 },
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002180 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002181 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002182
Colin Cross10d92682021-06-22 13:25:46 -07002183 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002184}
2185
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002186// ========================================================
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002187// libc dependencies for baremetal Rust projects.
2188// ========================================================
2189
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002190// This library contains the following unresolved symbols:
2191// __errno
2192// abort
2193// async_safe_fatal_va_list
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002194cc_library_static {
2195 name: "librust_baremetal",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002196 header_libs: ["libc_headers"],
2197 include_dirs: [
2198 "bionic/libc/async_safe/include",
2199 "bionic/libc/platform",
2200 ],
2201 cflags: [
2202 "-Wall",
2203 "-Werror",
2204 ],
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002205 srcs: [
2206 "bionic/fortify.cpp",
Pierre-Clément Tosi816176c2022-11-30 14:33:41 +00002207 "bionic/strtol.cpp",
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002208 ],
2209 arch: {
2210 arm64: {
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002211 srcs: [
2212 "arch-arm64/string/__memcpy_chk.S",
2213 ],
2214 },
caowencheng9a39eb32023-03-20 16:24:41 +08002215 riscv64: {
2216 srcs: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002217 "arch-riscv64/string/__memcpy_chk.S",
caowencheng9a39eb32023-03-20 16:24:41 +08002218 ],
2219 },
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002220 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002221 whole_static_libs: [
2222 "libarm-optimized-routines-mem",
Pierre-Clément Tosieb46ac92023-02-01 13:44:57 +00002223 "libc_netbsd",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002224 ],
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002225 system_shared_libs: [],
2226 nocrt: true,
2227 stl: "none",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002228 visibility: [
2229 "//packages/modules/Virtualization/vmbase",
2230 ],
2231}
2232
2233// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002234// NDK headers.
2235// ========================================================
2236
Dan Albert26e1c412018-05-24 14:56:46 -07002237versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002238 name: "common_libc",
2239 from: "include",
2240 to: "",
2241 license: "NOTICE",
2242}
Dan Albert4238a352016-06-28 11:18:05 -07002243
2244ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002245 name: "libc_uapi",
2246 from: "kernel/uapi",
2247 to: "",
2248 srcs: [
2249 "kernel/uapi/asm-generic/**/*.h",
2250 "kernel/uapi/drm/**/*.h",
2251 "kernel/uapi/linux/**/*.h",
2252 "kernel/uapi/misc/**/*.h",
2253 "kernel/uapi/mtd/**/*.h",
2254 "kernel/uapi/rdma/**/*.h",
2255 "kernel/uapi/scsi/**/*.h",
2256 "kernel/uapi/sound/**/*.h",
2257 "kernel/uapi/video/**/*.h",
2258 "kernel/uapi/xen/**/*.h",
2259 ],
Dan Albert92592652016-10-20 01:42:54 -07002260 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002261}
2262
2263ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002264 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002265 from: "kernel/android/uapi/linux",
2266 to: "linux",
2267 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002268 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002269}
2270
2271ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002272 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002273 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002274 to: "scsi",
2275 srcs: ["kernel/android/scsi/**/*.h"],
2276 license: "NOTICE",
2277}
2278
2279ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002280 name: "libc_asm_arm",
2281 from: "kernel/uapi/asm-arm",
2282 to: "arm-linux-androideabi",
2283 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002284 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002285}
2286
2287ndk_headers {
2288 name: "libc_asm_arm64",
2289 from: "kernel/uapi/asm-arm64",
2290 to: "aarch64-linux-android",
2291 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002292 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002293}
2294
Lazar Trsic790d2f72017-11-27 11:54:11 +01002295ndk_headers {
Colin Crossbd26e0f2022-10-19 15:03:14 -07002296 name: "libc_asm_riscv64",
2297 from: "kernel/uapi/asm-riscv",
2298 to: "riscv64-linux-android",
2299 srcs: ["kernel/uapi/asm-riscv/**/*.h"],
2300 license: "NOTICE",
2301}
2302
2303ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002304 name: "libc_asm_x86",
2305 from: "kernel/uapi/asm-x86",
2306 to: "i686-linux-android",
2307 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002308 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002309}
2310
2311ndk_headers {
2312 name: "libc_asm_x86_64",
2313 from: "kernel/uapi/asm-x86",
2314 to: "x86_64-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
Dan Albert4238a352016-06-28 11:18:05 -07002319ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002320 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002321 symbol_file: "libc.map.txt",
2322 first_version: "9",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002323 export_header_libs: [
2324 "common_libc",
2325 "libc_uapi",
2326 "libc_kernel_android_uapi_linux",
2327 "libc_kernel_android_scsi",
2328 "libc_asm_arm",
2329 "libc_asm_arm64",
Colin Crossbd26e0f2022-10-19 15:03:14 -07002330 "libc_asm_riscv64",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002331 "libc_asm_x86",
2332 "libc_asm_x86_64",
2333 ],
Dan Albert4238a352016-06-28 11:18:05 -07002334}
2335
Dan Albertdf31aff2016-10-06 15:50:41 -07002336ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002337 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002338 symbol_file: "libstdc++.map.txt",
2339 first_version: "9",
2340}
2341
Dan Willemsenca056d72018-01-08 14:00:24 -08002342// Export these headers for toolbox to process
2343filegroup {
2344 name: "kernel_input_headers",
2345 srcs: [
2346 "kernel/uapi/linux/input.h",
2347 "kernel/uapi/linux/input-event-codes.h",
2348 ],
2349}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002350
2351// Generate a syscall name / number mapping. These objects are text files
2352// (thanks to the -dD -E flags) and not binary files. They will then be
2353// consumed by the genseccomp.py script and converted into C++ code.
2354cc_defaults {
2355 name: "libseccomp_gen_syscall_nrs_defaults",
2356 recovery_available: true,
2357 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2358 cflags: [
2359 "-dD",
2360 "-E",
2361 "-Wall",
2362 "-Werror",
2363 "-nostdinc",
2364 ],
2365}
2366
2367cc_object {
2368 name: "libseccomp_gen_syscall_nrs_arm",
2369 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2370 local_include_dirs: [
2371 "kernel/uapi/asm-arm",
2372 "kernel/uapi",
2373 ],
2374}
2375
2376cc_object {
2377 name: "libseccomp_gen_syscall_nrs_arm64",
2378 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2379 local_include_dirs: [
2380 "kernel/uapi/asm-arm64",
2381 "kernel/uapi",
2382 ],
2383}
2384
2385cc_object {
Elliott Hughes704772b2022-10-10 17:06:43 +00002386 name: "libseccomp_gen_syscall_nrs_riscv64",
2387 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2388 local_include_dirs: [
2389 "kernel/uapi/asm-riscv",
2390 "kernel/uapi",
2391 ],
2392}
2393
2394cc_object {
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002395 name: "libseccomp_gen_syscall_nrs_x86",
2396 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2397 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2398 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2399 local_include_dirs: [
2400 "kernel/uapi/asm-x86",
2401 "kernel/uapi",
2402 ],
2403}
2404
2405cc_object {
2406 name: "libseccomp_gen_syscall_nrs_x86_64",
2407 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2408 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2409 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2410 local_include_dirs: [
2411 "kernel/uapi/asm-x86",
2412 "kernel/uapi",
2413 ],
2414}
2415
Jingwen Chenca366332021-01-29 05:16:32 -05002416filegroup {
2417 name: "all_kernel_uapi_headers",
2418 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002419}
2420
Martijn Coenen0c6de752019-01-02 12:52:51 +01002421cc_genrule {
2422 name: "func_to_syscall_nrs",
2423 recovery_available: true,
2424 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2425
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002426 tools: ["genfunctosyscallnrs"],
Martijn Coenen0c6de752019-01-02 12:52:51 +01002427
2428 srcs: [
2429 "SYSCALLS.TXT",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002430 ],
2431
Elliott Hughes704772b2022-10-10 17:06:43 +00002432 arch: {
2433 arm: {
2434 srcs: [
2435 ":libseccomp_gen_syscall_nrs_arm",
2436 ":libseccomp_gen_syscall_nrs_arm64",
2437 ],
2438 },
2439 arm64: {
2440 srcs: [
2441 ":libseccomp_gen_syscall_nrs_arm",
2442 ":libseccomp_gen_syscall_nrs_arm64",
2443 ],
2444 },
2445 riscv64: {
2446 srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
2447 },
2448 x86: {
2449 srcs: [
2450 ":libseccomp_gen_syscall_nrs_x86",
2451 ":libseccomp_gen_syscall_nrs_x86_64",
2452 ],
2453 },
2454 x86_64: {
2455 srcs: [
2456 ":libseccomp_gen_syscall_nrs_x86",
2457 ":libseccomp_gen_syscall_nrs_x86_64",
2458 ],
2459 },
2460 },
2461
Martijn Coenen0c6de752019-01-02 12:52:51 +01002462 out: [
2463 "func_to_syscall_nrs.h",
2464 ],
2465}
2466
Victor Hsiehdbb86702020-06-15 09:29:07 -07002467// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002468genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002469 name: "generate_app_zygote_blocklist",
2470 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2471 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002472 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2473}
2474
Yu Liu938ec9b2022-10-17 16:36:30 -07002475filegroup {
2476 name: "seccomp_syscalls_sources_zygote",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002477 srcs: [
2478 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002479 "SECCOMP_ALLOWLIST_COMMON.TXT",
2480 "SECCOMP_ALLOWLIST_APP.TXT",
2481 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002482 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002483 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002484 ],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002485}
2486
Yu Liu938ec9b2022-10-17 16:36:30 -07002487filegroup {
2488 name: "seccomp_syscalls_sources_app",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002489 srcs: [
2490 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002491 "SECCOMP_ALLOWLIST_COMMON.TXT",
2492 "SECCOMP_ALLOWLIST_APP.TXT",
2493 "SECCOMP_BLOCKLIST_COMMON.TXT",
2494 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002495 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002496 ],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002497}
2498
Yu Liu938ec9b2022-10-17 16:36:30 -07002499filegroup {
2500 name: "seccomp_syscalls_sources_system",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002501 srcs: [
2502 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002503 "SECCOMP_ALLOWLIST_COMMON.TXT",
2504 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2505 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002506 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002507 ],
Yu Liu938ec9b2022-10-17 16:36:30 -07002508}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002509
Yu Liu938ec9b2022-10-17 16:36:30 -07002510cc_genrule {
2511 name: "libseccomp_policy_app_zygote_sources_x86",
2512 recovery_available: true,
2513 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002514 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002515 srcs: [
2516 ":seccomp_syscalls_sources_zygote",
2517 ":libseccomp_gen_syscall_nrs_x86",
2518 ":libseccomp_gen_syscall_nrs_x86_64",
2519 ],
2520 out: [
2521 "x86_app_zygote_policy.cpp",
2522 "x86_64_app_zygote_policy.cpp",
2523 ],
2524 enabled: false,
Yu Liu3a579692022-10-18 03:02:32 +00002525 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002526 x86: {
2527 enabled: true,
2528 },
2529 x86_64: {
2530 enabled: true,
2531 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002532 },
2533}
2534
2535cc_genrule {
2536 name: "libseccomp_policy_app_zygote_sources_arm",
2537 recovery_available: true,
2538 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002539 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002540 srcs: [
2541 ":seccomp_syscalls_sources_zygote",
2542 ":libseccomp_gen_syscall_nrs_arm",
2543 ":libseccomp_gen_syscall_nrs_arm64",
2544 ],
2545 out: [
2546 "arm_app_zygote_policy.cpp",
2547 "arm64_app_zygote_policy.cpp",
2548 ],
2549 enabled: false,
2550 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002551 arm: {
2552 enabled: true,
2553 },
2554 arm64: {
2555 enabled: true,
2556 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002557 },
2558}
2559
2560cc_genrule {
2561 name: "libseccomp_policy_app_zygote_sources_riscv64",
2562 recovery_available: true,
2563 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002564 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002565 srcs: [
2566 ":seccomp_syscalls_sources_zygote",
2567 ":libseccomp_gen_syscall_nrs_riscv64",
2568 ],
2569 out: [
2570 "riscv64_app_zygote_policy.cpp",
2571 ],
2572 enabled: false,
2573 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002574 riscv64: {
2575 enabled: true,
2576 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002577 },
2578}
2579
2580cc_genrule {
2581 name: "libseccomp_policy_app_sources_x86",
2582 recovery_available: true,
2583 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002584 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002585 srcs: [
2586 ":seccomp_syscalls_sources_app",
2587 ":libseccomp_gen_syscall_nrs_x86",
2588 ":libseccomp_gen_syscall_nrs_x86_64",
2589 ],
2590 out: [
2591 "x86_app_policy.cpp",
2592 "x86_64_app_policy.cpp",
2593 ],
2594 enabled: false,
2595 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002596 x86: {
2597 enabled: true,
2598 },
2599 x86_64: {
2600 enabled: true,
2601 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002602 },
2603}
2604
2605cc_genrule {
2606 name: "libseccomp_policy_app_sources_arm",
2607 recovery_available: true,
2608 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002609 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002610 srcs: [
2611 ":seccomp_syscalls_sources_app",
2612 ":libseccomp_gen_syscall_nrs_arm",
2613 ":libseccomp_gen_syscall_nrs_arm64",
2614 ],
2615 out: [
2616 "arm_app_policy.cpp",
2617 "arm64_app_policy.cpp",
2618 ],
2619 enabled: false,
2620 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002621 arm: {
2622 enabled: true,
2623 },
2624 arm64: {
2625 enabled: true,
2626 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002627 },
2628}
2629
2630cc_genrule {
2631 name: "libseccomp_policy_app_sources_riscv64",
2632 recovery_available: true,
2633 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002634 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002635 srcs: [
2636 ":seccomp_syscalls_sources_app",
2637 ":libseccomp_gen_syscall_nrs_riscv64",
2638 ],
2639 out: [
2640 "riscv64_app_policy.cpp",
2641 ],
2642 enabled: false,
2643 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002644 riscv64: {
2645 enabled: true,
2646 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002647 },
2648}
2649
2650cc_genrule {
2651 name: "libseccomp_policy_system_sources_x86",
2652 recovery_available: true,
2653 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002654 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002655 srcs: [
2656 ":seccomp_syscalls_sources_system",
2657 ":libseccomp_gen_syscall_nrs_x86",
2658 ":libseccomp_gen_syscall_nrs_x86_64",
2659 ],
2660 out: [
2661 "x86_system_policy.cpp",
2662 "x86_64_system_policy.cpp",
2663 ],
2664 enabled: false,
2665 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002666 x86: {
2667 enabled: true,
2668 },
2669 x86_64: {
2670 enabled: true,
2671 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002672 },
2673}
2674
2675cc_genrule {
2676 name: "libseccomp_policy_system_sources_arm",
2677 recovery_available: true,
2678 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002679 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002680 srcs: [
2681 ":seccomp_syscalls_sources_system",
2682 ":libseccomp_gen_syscall_nrs_arm",
2683 ":libseccomp_gen_syscall_nrs_arm64",
2684 ],
2685 out: [
2686 "arm_system_policy.cpp",
2687 "arm64_system_policy.cpp",
2688 ],
2689 enabled: false,
2690 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002691 arm: {
2692 enabled: true,
2693 },
2694 arm64: {
2695 enabled: true,
2696 },
Yu Liu938ec9b2022-10-17 16:36:30 -07002697 },
2698}
2699
2700cc_genrule {
2701 name: "libseccomp_policy_system_sources_riscv64",
2702 recovery_available: true,
2703 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002704 tools: ["genseccomp"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002705 srcs: [
2706 ":seccomp_syscalls_sources_system",
2707 ":libseccomp_gen_syscall_nrs_riscv64",
2708 ],
2709 out: [
2710 "riscv64_system_policy.cpp",
2711 ],
2712 enabled: false,
2713 arch: {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002714 riscv64: {
2715 enabled: true,
2716 },
Yu Liu3a579692022-10-18 03:02:32 +00002717 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002718}
2719
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002720cc_library {
2721 name: "libseccomp_policy",
2722 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002723 generated_headers: ["func_to_syscall_nrs"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002724
2725 arch: {
2726 arm: {
2727 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002728 "libseccomp_policy_app_sources_arm",
2729 "libseccomp_policy_app_zygote_sources_arm",
2730 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002731 ],
2732 },
2733 arm64: {
2734 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002735 "libseccomp_policy_app_sources_arm",
2736 "libseccomp_policy_app_zygote_sources_arm",
2737 "libseccomp_policy_system_sources_arm",
Yu Liu938ec9b2022-10-17 16:36:30 -07002738 ],
2739 },
2740 riscv64: {
2741 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002742 "libseccomp_policy_app_sources_riscv64",
2743 "libseccomp_policy_app_zygote_sources_riscv64",
2744 "libseccomp_policy_system_sources_riscv64",
Yu Liu938ec9b2022-10-17 16:36:30 -07002745 ],
2746 },
2747 x86: {
2748 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002749 "libseccomp_policy_app_sources_x86",
2750 "libseccomp_policy_app_zygote_sources_x86",
2751 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002752 ],
2753 },
2754 x86_64: {
2755 generated_sources: [
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002756 "libseccomp_policy_app_sources_x86",
2757 "libseccomp_policy_app_zygote_sources_x86",
2758 "libseccomp_policy_system_sources_x86",
Yu Liu938ec9b2022-10-17 16:36:30 -07002759 ],
2760 },
2761 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002762
2763 srcs: [
2764 "seccomp/seccomp_policy.cpp",
2765 ],
2766
2767 export_include_dirs: ["seccomp/include"],
2768 cflags: [
2769 "-Wall",
2770 "-Werror",
2771 ],
2772 shared: {
2773 shared_libs: ["libbase"],
2774 },
2775 static: {
2776 static_libs: ["libbase"],
2777 },
2778}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002779
Colin Cross048f24e2021-09-01 17:26:00 -07002780cc_library_host_static {
2781 name: "libfts",
2782 srcs: [
2783 "bionic/fts.c",
2784 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
2785 ],
2786 export_include_dirs: ["fts/include"],
2787 local_include_dirs: [
2788 "private",
2789 "upstream-openbsd/android/include",
2790 ],
2791 cflags: [
2792 "-include openbsd-compat.h",
2793 "-Wno-unused-parameter",
2794 ],
2795 enabled: false,
2796 target: {
2797 musl: {
2798 enabled: true,
2799 },
2800 },
Colin Cross2a9843f2022-01-13 12:26:30 -08002801 stl: "none",
2802}
2803
2804cc_library_host_static {
2805 name: "libexecinfo",
2806 visibility: ["//external/musl"],
2807 srcs: ["bionic/execinfo.cpp"],
2808 export_include_dirs: ["execinfo/include"],
2809 local_include_dirs: ["private"],
2810 enabled: false,
2811 target: {
2812 musl: {
2813 enabled: true,
2814 system_shared_libs: [],
2815 header_libs: ["libc_musl_headers"],
2816 },
2817 },
2818 stl: "none",
Colin Cross048f24e2021-09-01 17:26:00 -07002819}
2820
Colin Cross9da85fa2022-01-24 18:20:05 -08002821cc_library_host_static {
2822 name: "libb64",
2823 visibility: ["//external/musl"],
2824 srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
2825 export_include_dirs: ["b64/include"],
2826 local_include_dirs: [
2827 "private",
2828 "upstream-openbsd/android/include",
2829 ],
2830 cflags: [
2831 "-include openbsd-compat.h",
2832 ],
2833 enabled: false,
2834 target: {
2835 musl: {
2836 enabled: true,
2837 system_shared_libs: [],
2838 header_libs: ["libc_musl_headers"],
2839 },
2840 },
2841 stl: "none",
2842}
2843
Colin Cross9d4a56e2022-02-03 10:20:32 -08002844// Export kernel uapi headers to be used in the musl sysroot.
2845// Also include the execinfo headers for the libexecinfo and the
2846// b64 headers for libb64 embedded in musl libc.
2847cc_genrule {
2848 name: "libc_musl_sysroot_bionic_headers",
2849 visibility: ["//external/musl"],
2850 host_supported: true,
2851 device_supported: false,
2852 enabled: false,
2853 target: {
2854 musl: {
2855 enabled: true,
2856 },
2857 },
2858 srcs: [
2859 "kernel/uapi/**/*.h",
2860 "kernel/android/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002861 "execinfo/include/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002862 "b64/include/**/*.h",
Colin Crossaeef9f02022-02-07 21:01:26 -08002863
Colin Crossaeef9f02022-02-07 21:01:26 -08002864 "NOTICE",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002865
2866 ":libc_musl_sysroot_bionic_arch_headers",
2867 ],
2868 out: ["libc_musl_sysroot_bionic_headers.zip"],
2869 tools: [
2870 "soong_zip",
2871 "merge_zips",
2872 "zip2zip",
2873 ],
Colin Crossaeef9f02022-02-07 21:01:26 -08002874 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
2875 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
Colin Crossad33d022022-02-25 18:27:04 -08002876 // NOTICE
2877 " -j -f $(location NOTICE) " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002878 // headers
2879 " -P include " +
Colin Crossaeef9f02022-02-07 21:01:26 -08002880 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
2881 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
2882 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2883 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
2884 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2885 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
2886 " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
2887 " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
2888 " -C $${BIONIC_LIBC_DIR}/b64/include " +
2889 " -D $${BIONIC_LIBC_DIR}/b64/include " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08002890 " && " +
Colin Crossad33d022022-02-25 18:27:04 -08002891 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
Colin Cross1c0a7a02022-08-11 12:22:26 -07002892 " -x **/BUILD " +
Colin Crossad33d022022-02-25 18:27:04 -08002893 " include/**/*:include/ " +
2894 " NOTICE:NOTICE.bionic " +
2895 " && " +
2896 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip",
Colin Cross9d4a56e2022-02-03 10:20:32 -08002897}
2898
2899// The architecture-specific bits have to be handled separately because the label varies based
2900// on architecture, which prevents using $(locations) to find them and requires using $(in)
2901// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
2902// genrule.
2903cc_genrule {
2904 name: "libc_musl_sysroot_bionic_arch_headers",
2905 visibility: ["//visibility:private"],
2906 host_supported: true,
2907 device_supported: false,
2908 enabled: false,
2909 target: {
2910 musl: {
2911 enabled: true,
2912 },
2913 },
2914 arch: {
2915 arm: {
2916 srcs: ["kernel/uapi/asm-arm/**/*.h"],
2917 },
2918 arm64: {
2919 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
2920 },
2921 x86: {
2922 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2923 },
2924 x86_64: {
2925 srcs: ["kernel/uapi/asm-x86/**/*.h"],
2926 },
2927 },
2928 out: ["libc_musl_sysroot_bionic_arch_headers.zip"],
2929 tools: ["soong_zip"],
2930 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
2931}
Colin Cross290c4952022-10-13 12:51:13 -07002932
2933cc_genrule {
2934 name: "bionic_sysroot_crt_objects",
2935 visibility: ["//visibility:private"],
2936 out: ["bionic_sysroot_crt_objects.zip"],
2937 tools: ["soong_zip"],
2938 srcs: [
2939 ":crtbegin_dynamic",
2940 ":crtbegin_so",
2941 ":crtbegin_static",
2942 ":crtend_android",
2943 ":crtend_so",
2944 ],
2945 cmd: "$(location soong_zip) -o $(out) -j " +
2946 "-f $(location :crtbegin_dynamic) " +
2947 "-f $(location :crtbegin_so) " +
2948 "-f $(location :crtbegin_static) " +
2949 "-f $(location :crtend_android) " +
2950 "-f $(location :crtend_so)",
2951 dist: {
2952 targets: ["bionic_sysroot_crt_objects"],
2953 },
2954 arch: {
2955 arm: {
2956 dist: {
2957 suffix: "_arm",
2958 },
2959 },
2960 arm64: {
2961 dist: {
2962 suffix: "_arm64",
2963 },
2964 },
2965 riscv64: {
2966 dist: {
2967 suffix: "_riscv64",
2968 },
2969 },
2970 x86: {
2971 dist: {
2972 suffix: "_x86",
2973 },
2974 },
2975 x86_64: {
2976 dist: {
2977 suffix: "_x86_64",
2978 },
2979 },
2980 },
2981}
Spandan Das8fce52a2023-09-28 18:00:12 +00002982
2983// headers that will be placed on the include path when running versioner in bazel
2984// this module should be a no-op in soong
2985filegroup {
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00002986 name: "versioner-dependencies",
2987 srcs: ["versioner-dependencies/**/*"],
Spandan Das8fce52a2023-09-28 18:00:12 +00002988}
Jiyong Park35a280d2024-05-03 16:53:39 +09002989
2990filegroup {
2991 name: "linux_capability_header",
2992 srcs: ["kernel/uapi/linux/capability.h"],
2993}