blob: f6b7eef136c05435a7b296831b656972266c4e6e [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001// Define the common source files for all the libc instances
2// =========================================================
Bob Badouraa7d8352021-02-19 13:06:22 -08003package {
4 default_applicable_licenses: ["bionic_libc_license"],
5}
6
7license {
8 name: "bionic_libc_license",
9 visibility: [":__subpackages__"],
10 license_kinds: [
11 "SPDX-license-identifier-Apache-2.0",
12 "SPDX-license-identifier-BSD",
13 "SPDX-license-identifier-ISC",
14 "SPDX-license-identifier-MIT",
15 "legacy_notice",
16 "legacy_unencumbered",
17 ],
18 license_text: [
19 "NOTICE",
20 ],
21}
22
Dan Willemsen208ae172015-09-16 16:33:27 -070023libc_common_src_files = [
Dan Willemsen208ae172015-09-16 16:33:27 -070024 "bionic/ether_aton.c",
25 "bionic/ether_ntoa.c",
Victor Khimenko8e0707d2020-06-09 21:57:05 +020026 "bionic/exit.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070027 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070028 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070029 "bionic/sched_cpualloc.c",
30 "bionic/sched_cpucount.c",
Mitch Phillipse6997d52020-11-30 15:04:14 -080031 "bionic/sysprop_helpers.cpp",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070032 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070033 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070034 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080035 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070036 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080037 "stdio/vfscanf.cpp",
Elliott Hughes1f462de2022-08-05 22:51:05 +000038 "stdio/vfwscanf.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070039]
40
Peter Collingbourne570de332019-12-11 10:00:58 -080041// off64_t/time64_t support on LP32.
Dan Willemsen208ae172015-09-16 16:33:27 -070042// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -070043libc_common_src_files_32 = [
44 "bionic/legacy_32_bit_support.cpp",
45 "bionic/time64.c",
46]
47
Elliott Hughes53cf3482016-08-09 13:06:41 -070048libc_common_flags = [
49 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080050 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070051 "-Wall",
52 "-Wextra",
53 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080054 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070055 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070056 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070057 "-Wframe-larger-than=2048",
Elliott Hughes53cf3482016-08-09 13:06:41 -070058
59 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
60 "-Werror=pointer-to-int-cast",
61 "-Werror=int-to-pointer-cast",
62 "-Werror=type-limits",
63 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080064
65 // Clang's exit-time destructor registration hides __dso_handle, but
66 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
67 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080068
69 // GWP-ASan requires platform TLS.
70 "-fno-emulated-tls",
Elliott Hughesa13d0662021-12-02 14:42:16 -080071
72 // We know clang does a lot of harm by rewriting what we've said, and sadly
73 // never see any good it does, so let's just ask it to do what we say...
74 // (The specific motivating example was clang turning a loop that would only
75 // ever touch 0, 1, or 2 bytes into a call to memset, which was never going
76 // to amortize.)
77 "-fno-builtin",
Elliott Hughes53cf3482016-08-09 13:06:41 -070078]
79
Dan Willemsen208ae172015-09-16 16:33:27 -070080// Define some common cflags
81// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070082cc_defaults {
83 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080084 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070085 cflags: libc_common_flags,
86 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070087 conlyflags: ["-std=gnu99"],
88 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070089 include_dirs: [
90 "bionic/libc/async_safe/include",
Peter Collingbourne5d3aa862020-09-11 15:05:17 -070091 "bionic/libc/platform",
Tom Cherry379ed1e2020-09-17 09:36:25 -070092 // For android_filesystem_config.h.
93 "system/core/libcutils/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070094 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070095
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010096 header_libs: [
97 "libc_headers",
Rupert Shuttleworthed80dcd2021-04-22 01:52:53 -040098 "liblog_headers", // needed by bionic/libc/async_safe/include
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010099 ],
100 export_header_lib_headers: [
101 "libc_headers",
102 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800103
Colin Cross50c21ab2015-10-31 23:03:05 -0700104 stl: "none",
105 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -0700106 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -0700107 address: false,
108 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -0700109 // TODO(b/132640749): Fix broken fuzzer support.
110 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -0700111 },
Yifan Hong5a39cee2020-01-21 16:43:56 -0800112 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -0700113 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +0900114 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +0200115 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -0800116
Yi Konge3d90de2019-02-20 14:28:56 -0800117 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
118 // warning since this is intended right now.
119 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -0700120
Quallenauge960d2b72020-10-20 21:19:01 +0200121 multilib: {
122 lib64: {
123 product_variables: {
124 malloc_zero_contents: {
125 cflags: ["-DSCUDO_ZERO_CONTENTS"],
126 },
127 malloc_pattern_fill_contents: {
128 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
129 },
130 malloc_not_svelte: {
131 cflags: ["-DUSE_SCUDO"],
132 },
133 },
Evgenii Stepanov5a73e032020-04-29 14:59:44 -0700134 },
Quallenauge960d2b72020-10-20 21:19:01 +0200135 lib32: {
136 product_variables: {
137 malloc_zero_contents: {
138 cflags: ["-DSCUDO_ZERO_CONTENTS"],
139 },
140 malloc_pattern_fill_contents: {
141 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
142 },
143 malloc_not_svelte_libc32: {
144 cflags: ["-DUSE_SCUDO"],
145 },
146 },
Steven Morelandfb65ee42020-07-31 00:18:38 +0000147 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700148 },
Yi Kong9e33b762021-10-29 02:43:22 +0800149
150 lto: {
151 never: true,
152 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700153}
154
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800155libc_scudo_product_variables = {
156 malloc_not_svelte: {
157 cflags: ["-DUSE_SCUDO"],
158 whole_static_libs: ["libscudo"],
159 exclude_static_libs: [
160 "libjemalloc5",
161 "libc_jemalloc_wrapper",
162 ],
163 },
164}
165
Quallenauge960d2b72020-10-20 21:19:01 +0200166libc32_scudo_product_variables = {
167 malloc_not_svelte_libc32: {
168 cflags: ["-DUSE_SCUDO"],
169 whole_static_libs: ["libscudo"],
170 exclude_static_libs: [
171 "libjemalloc5",
172 "libc_jemalloc_wrapper",
173 ],
174 },
175}
176
177
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700178// Defaults for native allocator libs/includes to make it
179// easier to change.
Christopher Ferris062eba22020-01-31 22:40:45 -0800180// To disable scudo for the non-svelte config remove the line:
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800181// product_variables: libc_scudo_product_variables,
Christopher Ferris062eba22020-01-31 22:40:45 -0800182// in the cc_defaults below.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700183// ========================================================
184cc_defaults {
185 name: "libc_native_allocator_defaults",
186
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700187 whole_static_libs: [
188 "libjemalloc5",
189 "libc_jemalloc_wrapper",
190 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800191 header_libs: ["gwp_asan_headers"],
Quallenauge960d2b72020-10-20 21:19:01 +0200192 multilib: {
193 lib64: {
194 product_variables: libc_scudo_product_variables,
195 },
196 lib32: {
197 product_variables: libc32_scudo_product_variables,
198 }
199 },
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700200}
201
202// Functions not implemented by jemalloc directly, or that need to
203// be modified for Android.
204cc_library_static {
205 name: "libc_jemalloc_wrapper",
206 defaults: ["libc_defaults"],
207 srcs: ["bionic/jemalloc_wrapper.cpp"],
208 cflags: ["-fvisibility=hidden"],
209
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800210 // Used to pull in the jemalloc include directory so that if the
211 // library is removed, the include directory is also removed.
212 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700213}
214
Dan Willemsen208ae172015-09-16 16:33:27 -0700215// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700216// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700217// ========================================================
218//
Ryan Prichard249757b2019-11-01 17:18:28 -0700219// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
220// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
221// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
222// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700223
224cc_library_static {
225
Colin Crossa3f9fca2016-01-11 13:20:55 -0800226 srcs: [
227 "bionic/__libc_init_main_thread.cpp",
228 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700229 "bionic/bionic_call_ifunc_resolver.cpp",
230 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800231 ],
232 arch: {
233 arm64: {
234 srcs: ["arch-arm64/bionic/__set_tls.c"],
235 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000236 riscv64: {
237 srcs: ["arch-riscv64/bionic/__set_tls.c"],
238 },
Colin Crossa3f9fca2016-01-11 13:20:55 -0800239 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700240 srcs: [
241 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Pirama Arumuga Nainar7b89be72021-02-12 15:09:49 -0800242 "arch-x86/bionic/__libc_int0x80.S",
Ryan Prichard27475b52018-05-17 17:14:18 -0700243 "arch-x86/bionic/__set_tls.cpp",
244 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800245 },
246 x86_64: {
247 srcs: ["arch-x86_64/bionic/__set_tls.c"],
248 },
249 },
250
Colin Cross50c21ab2015-10-31 23:03:05 -0700251 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700252 cflags: ["-fno-stack-protector", "-ffreestanding"],
253 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700254}
255
Ryan Prichard249757b2019-11-01 17:18:28 -0700256// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
257// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
258// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800259
260cc_library_static {
261 name: "libc_init_static",
262 defaults: ["libc_defaults"],
263 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700264 cflags: [
265 "-fno-stack-protector",
266
267 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
268 // from the linker before ifunc resolvers have made string.h functions available.
269 "-ffreestanding",
270 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800271}
272
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700273cc_library_static {
274 name: "libc_init_dynamic",
275 defaults: ["libc_defaults"],
276 srcs: ["bionic/libc_init_dynamic.cpp"],
277 cflags: ["-fno-stack-protector"],
278}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800279
Dan Willemsen208ae172015-09-16 16:33:27 -0700280// ========================================================
281// libc_tzcode.a - upstream 'tzcode' code
282// ========================================================
283
284cc_library_static {
285
Colin Cross50c21ab2015-10-31 23:03:05 -0700286 defaults: ["libc_defaults"],
Chih-Hung Hsiehe343db32023-01-03 14:54:34 -0800287 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700288 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800289 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700290 "tzcode/bionic.cpp",
Elliott Hughesd3627a42022-12-06 22:24:27 +0000291 // tzcode doesn't include strptime or wcsftime, so we use the OpenBSD
292 // code (with some local changes in the strptime case).
293 "upstream-openbsd/lib/libc/locale/_def_time.c",
294 "upstream-openbsd/lib/libc/time/wcsftime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700295 ],
296
Colin Cross50c21ab2015-10-31 23:03:05 -0700297 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700298 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700299 // Don't use ridiculous amounts of stack.
300 "-DALL_STATE",
301 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
302 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800303 // Obviously, we want to be thread-safe.
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000304 "-DTHREAD_SAFE=1",
Dan Willemsen208ae172015-09-16 16:33:27 -0700305 // The name of the tm_gmtoff field in our struct tm.
306 "-DTM_GMTOFF=tm_gmtoff",
Almaz Mingaleeva52a0da2022-02-28 16:55:50 +0000307 // TZDEFAULT is not applicable to Android as there is no one file per time zone mapping
308 "-DTZDEFAULT=NULL",
Dan Willemsen208ae172015-09-16 16:33:27 -0700309 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700310 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700311 // Include `tzname`, `timezone`, and `daylight` globals.
312 "-DHAVE_POSIX_DECLS=0",
Almaz Mingaleev5411aff2022-02-11 12:27:12 +0000313 "-DUSG_COMPAT=2",
314 "-DHAVE_TZNAME=2",
315 // stdbool.h is available
316 "-DHAVE_STDBOOL_H",
Colin Crossa35d23d2015-11-19 13:32:49 -0800317 // Use the empty string (instead of " ") as the timezone abbreviation
318 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700319 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700320 "-Dlint",
321 ],
322
Dan Willemsen208ae172015-09-16 16:33:27 -0700323 local_include_dirs: ["tzcode/"],
324 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700325}
326
327// ========================================================
328// libc_dns.a - modified NetBSD DNS code
329// ========================================================
330
331cc_library_static {
332
Colin Cross50c21ab2015-10-31 23:03:05 -0700333 defaults: ["libc_defaults"],
Chih-Hung Hsiehe343db32023-01-03 14:54:34 -0800334 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700335 srcs: [
Elliott Hughesd0bbfa82021-04-08 11:58:51 -0700336 "dns/**/*.c*",
Dan Willemsen208ae172015-09-16 16:33:27 -0700337
338 "upstream-netbsd/lib/libc/isc/ev_streams.c",
339 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700340 ],
341
Colin Cross50c21ab2015-10-31 23:03:05 -0700342 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700343 "-DANDROID_CHANGES",
344 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700345 "-Wno-unused-parameter",
346 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700347 "-Wframe-larger-than=66000",
Elliott Hughese1dc4f62021-01-11 11:51:29 -0800348 "-include private/bsd_sys_param.h",
Dan Willemsen208ae172015-09-16 16:33:27 -0700349 ],
350
Dan Willemsen208ae172015-09-16 16:33:27 -0700351 local_include_dirs: [
352 "dns/include",
353 "private",
354 "upstream-netbsd/lib/libc/include",
355 "upstream-netbsd/android/include",
356 ],
357
358 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700359}
360
361// ========================================================
362// libc_freebsd.a - upstream FreeBSD C library code
363// ========================================================
364//
365// These files are built with the freebsd-compat.h header file
366// automatically included.
367
368cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700369 defaults: ["libc_defaults"],
Chih-Hung Hsiehe343db32023-01-03 14:54:34 -0800370 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700371 srcs: [
372 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700373 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700374 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
375 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
376 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
377 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700378 "upstream-freebsd/lib/libc/stdlib/qsort.c",
379 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700380 "upstream-freebsd/lib/libc/string/wcpcpy.c",
381 "upstream-freebsd/lib/libc/string/wcpncpy.c",
382 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700383 "upstream-freebsd/lib/libc/string/wcscat.c",
384 "upstream-freebsd/lib/libc/string/wcschr.c",
385 "upstream-freebsd/lib/libc/string/wcscmp.c",
386 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700387 "upstream-freebsd/lib/libc/string/wcscspn.c",
388 "upstream-freebsd/lib/libc/string/wcsdup.c",
389 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700390 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700391 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
392 "upstream-freebsd/lib/libc/string/wcsncat.c",
393 "upstream-freebsd/lib/libc/string/wcsncmp.c",
394 "upstream-freebsd/lib/libc/string/wcsncpy.c",
395 "upstream-freebsd/lib/libc/string/wcsnlen.c",
396 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700397 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700398 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700399 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700400 "upstream-freebsd/lib/libc/string/wcstok.c",
401 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700402 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700403 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700404 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800405 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700406 ],
407 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700408 x86: {
409 exclude_srcs: [
410 "upstream-freebsd/lib/libc/string/wcschr.c",
411 "upstream-freebsd/lib/libc/string/wcscmp.c",
412 "upstream-freebsd/lib/libc/string/wcslen.c",
413 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700414 "upstream-freebsd/lib/libc/string/wmemcmp.c",
415 "upstream-freebsd/lib/libc/string/wcscat.c",
416 "upstream-freebsd/lib/libc/string/wcscpy.c",
417 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700418 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700419 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700420 },
421
Colin Cross50c21ab2015-10-31 23:03:05 -0700422 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700423 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700424 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700425 "-include freebsd-compat.h",
426 ],
427
Dan Willemsen208ae172015-09-16 16:33:27 -0700428 local_include_dirs: [
429 "upstream-freebsd/android/include",
430 ],
431
432 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700433}
434
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700435cc_library_static {
436 defaults: ["libc_defaults"],
Chih-Hung Hsiehe343db32023-01-03 14:54:34 -0800437 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700438 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700439 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700440 ],
441
442 cflags: [
443 "-Wno-sign-compare",
444 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700445 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700446 ],
447
448 local_include_dirs: [
449 "upstream-freebsd/android/include",
450 ],
451
452 name: "libc_freebsd_large_stack",
453}
454
Dan Willemsen208ae172015-09-16 16:33:27 -0700455// ========================================================
456// libc_netbsd.a - upstream NetBSD C library code
457// ========================================================
458//
459// These files are built with the netbsd-compat.h header file
460// automatically included.
461
462cc_library_static {
463
Colin Cross50c21ab2015-10-31 23:03:05 -0700464 defaults: ["libc_defaults"],
Chih-Hung Hsiehe343db32023-01-03 14:54:34 -0800465 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700466 srcs: [
467 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700468 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700469 "upstream-netbsd/lib/libc/gen/psignal.c",
470 "upstream-netbsd/lib/libc/gen/utime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700471 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
472 "upstream-netbsd/lib/libc/regex/regcomp.c",
473 "upstream-netbsd/lib/libc/regex/regerror.c",
474 "upstream-netbsd/lib/libc/regex/regexec.c",
475 "upstream-netbsd/lib/libc/regex/regfree.c",
476 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700477 "upstream-netbsd/lib/libc/stdlib/drand48.c",
478 "upstream-netbsd/lib/libc/stdlib/erand48.c",
479 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
480 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700481 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
482 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
483 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
484 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
485 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
486 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
487 "upstream-netbsd/lib/libc/stdlib/seed48.c",
488 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700489 ],
490 multilib: {
491 lib32: {
492 // LP32 cruft
493 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
494 },
495 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700496 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700497 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800498 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 "-DPOSIX_MISTAKE",
500 "-include netbsd-compat.h",
501 ],
502
Dan Willemsen208ae172015-09-16 16:33:27 -0700503 local_include_dirs: [
504 "upstream-netbsd/android/include",
505 "upstream-netbsd/lib/libc/include",
506 ],
507
508 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700509}
510
511// ========================================================
512// libc_openbsd_ndk.a - upstream OpenBSD C library code
513// that can be safely included in the libc_ndk.a (doesn't
514// contain any troublesome global data or constructors).
515// ========================================================
516//
517// These files are built with the openbsd-compat.h header file
518// automatically included.
519
520cc_library_static {
521 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700522 defaults: ["libc_defaults"],
Chih-Hung Hsiehe343db32023-01-03 14:54:34 -0800523 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700524 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700525 "upstream-openbsd/lib/libc/gen/alarm.c",
526 "upstream-openbsd/lib/libc/gen/ctype_.c",
527 "upstream-openbsd/lib/libc/gen/daemon.c",
528 "upstream-openbsd/lib/libc/gen/err.c",
529 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700530 "upstream-openbsd/lib/libc/gen/fnmatch.c",
531 "upstream-openbsd/lib/libc/gen/ftok.c",
532 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700533 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700534 "upstream-openbsd/lib/libc/gen/verr.c",
535 "upstream-openbsd/lib/libc/gen/verrx.c",
536 "upstream-openbsd/lib/libc/gen/vwarn.c",
537 "upstream-openbsd/lib/libc/gen/vwarnx.c",
538 "upstream-openbsd/lib/libc/gen/warn.c",
539 "upstream-openbsd/lib/libc/gen/warnx.c",
540 "upstream-openbsd/lib/libc/locale/btowc.c",
541 "upstream-openbsd/lib/libc/locale/mbrlen.c",
542 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
543 "upstream-openbsd/lib/libc/locale/mbtowc.c",
544 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/locale/wcstombs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700546 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
547 "upstream-openbsd/lib/libc/locale/wctob.c",
548 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700549 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700550 "upstream-openbsd/lib/libc/net/htonl.c",
551 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700552 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
553 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
554 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700555 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
556 "upstream-openbsd/lib/libc/net/inet_ntop.c",
557 "upstream-openbsd/lib/libc/net/inet_pton.c",
558 "upstream-openbsd/lib/libc/net/ntohl.c",
559 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800560 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700561 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700562 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
563 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700564 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700565 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700566 "upstream-openbsd/lib/libc/stdio/fputwc.c",
567 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700568 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700569 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700570 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700571 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700572 "upstream-openbsd/lib/libc/stdio/makebuf.c",
573 "upstream-openbsd/lib/libc/stdio/mktemp.c",
574 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
575 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700576 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700577 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700578 "upstream-openbsd/lib/libc/stdio/ungetc.c",
579 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
580 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
581 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700582 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
583 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
584 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700585 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700586 "upstream-openbsd/lib/libc/stdio/wsetup.c",
587 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800588 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700589 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700590 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700591 "upstream-openbsd/lib/libc/stdlib/insque.c",
592 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
593 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
594 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800595 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700596 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800597 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700598 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughes26b06072020-07-31 11:00:10 -0700599 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700600 "upstream-openbsd/lib/libc/stdlib/remque.c",
601 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700602 "upstream-openbsd/lib/libc/stdlib/tfind.c",
603 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800604 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700605 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800606 "upstream-openbsd/lib/libc/string/strcasestr.c",
607 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700608 "upstream-openbsd/lib/libc/string/strcspn.c",
609 "upstream-openbsd/lib/libc/string/strdup.c",
610 "upstream-openbsd/lib/libc/string/strndup.c",
611 "upstream-openbsd/lib/libc/string/strpbrk.c",
612 "upstream-openbsd/lib/libc/string/strsep.c",
613 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700614 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800615 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700616 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700617 "upstream-openbsd/lib/libc/string/wcswidth.c",
Colin Cross69bcb8b2021-09-08 13:24:16 -0700618
619 // This file is originally from OpenBSD, and benefits from
620 // being compiled with openbsd-compat.h.
621 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700622 ],
623
Colin Cross50c21ab2015-10-31 23:03:05 -0700624 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700625 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700626 "-Wno-unused-parameter",
627 "-include openbsd-compat.h",
628 ],
629
Dan Willemsen208ae172015-09-16 16:33:27 -0700630 local_include_dirs: [
631 "private",
632 "stdio",
633 "upstream-openbsd/android/include",
634 "upstream-openbsd/lib/libc/include",
635 "upstream-openbsd/lib/libc/gdtoa/",
636 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700637}
638
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700639cc_library_static {
640 name: "libc_openbsd_large_stack",
641 defaults: ["libc_defaults"],
Chih-Hung Hsiehe343db32023-01-03 14:54:34 -0800642 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700643 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700644 "stdio/vfprintf.cpp",
645 "stdio/vfwprintf.cpp",
Elliott Hughes5633caa2020-08-06 14:32:43 -0700646 "upstream-openbsd/lib/libc/string/memmem.c",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800647 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700648 ],
649 cflags: [
650 "-include openbsd-compat.h",
651 "-Wno-sign-compare",
652 "-Wframe-larger-than=5000",
653 ],
654
655 local_include_dirs: [
Elliott Hughese1dc4f62021-01-11 11:51:29 -0800656 "private",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700657 "upstream-openbsd/android/include/",
658 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700659 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700660 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700661 ],
662}
663
Dan Willemsen208ae172015-09-16 16:33:27 -0700664// ========================================================
665// libc_openbsd.a - upstream OpenBSD C library code
666// ========================================================
667//
668// These files are built with the openbsd-compat.h header file
669// automatically included.
670cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700671 defaults: ["libc_defaults"],
Chih-Hung Hsiehe343db32023-01-03 14:54:34 -0800672 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700673 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800674 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700675 "upstream-openbsd/lib/libc/crypt/arc4random.c",
676 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
677
678 // May be overriden by per-arch optimized versions
679 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700680 "upstream-openbsd/lib/libc/string/memrchr.c",
681 "upstream-openbsd/lib/libc/string/stpcpy.c",
682 "upstream-openbsd/lib/libc/string/stpncpy.c",
683 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700684 "upstream-openbsd/lib/libc/string/strcpy.c",
685 "upstream-openbsd/lib/libc/string/strlcat.c",
686 "upstream-openbsd/lib/libc/string/strlcpy.c",
687 "upstream-openbsd/lib/libc/string/strncat.c",
688 "upstream-openbsd/lib/libc/string/strncmp.c",
689 "upstream-openbsd/lib/libc/string/strncpy.c",
690 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700691
692 arch: {
693 arm: {
694 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700695 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800696 "upstream-openbsd/lib/libc/string/stpcpy.c",
697 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700698 ],
699 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700700 arm64: {
701 exclude_srcs: [
702 "upstream-openbsd/lib/libc/string/memchr.c",
Peter Collingbourne2361d4e2020-06-03 16:55:37 -0700703 "upstream-openbsd/lib/libc/string/memrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700704 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700705 "upstream-openbsd/lib/libc/string/strcpy.c",
706 "upstream-openbsd/lib/libc/string/strncmp.c",
707 ],
708 },
Elliott Hughesebc19a92022-10-14 23:25:36 +0000709 riscv64: {
710 srcs: [
Elliott Hughesebc19a92022-10-14 23:25:36 +0000711 "upstream-freebsd/lib/libc/string/memcmp.c",
712 "upstream-freebsd/lib/libc/string/memcpy.c",
713 "upstream-freebsd/lib/libc/string/memmove.c",
714 "upstream-freebsd/lib/libc/string/memset.c",
715 "upstream-openbsd/lib/libc/string/strcmp.c",
716 "upstream-openbsd/lib/libc/string/strlen.c",
717 ],
718 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700719 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800720 exclude_srcs: [
721 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800722 "upstream-openbsd/lib/libc/string/memrchr.c",
723 "upstream-openbsd/lib/libc/string/stpcpy.c",
724 "upstream-openbsd/lib/libc/string/stpncpy.c",
725 "upstream-openbsd/lib/libc/string/strcat.c",
726 "upstream-openbsd/lib/libc/string/strcpy.c",
727 "upstream-openbsd/lib/libc/string/strncmp.c",
728 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700729 "upstream-openbsd/lib/libc/string/strlcat.c",
730 "upstream-openbsd/lib/libc/string/strlcpy.c",
731 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800732 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700733 },
734
735 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800736 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800737 "upstream-openbsd/lib/libc/string/stpcpy.c",
738 "upstream-openbsd/lib/libc/string/stpncpy.c",
739 "upstream-openbsd/lib/libc/string/strcat.c",
740 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800741 "upstream-openbsd/lib/libc/string/strncat.c",
742 "upstream-openbsd/lib/libc/string/strncmp.c",
743 "upstream-openbsd/lib/libc/string/strncpy.c",
744 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700745 },
746 },
747
Colin Cross50c21ab2015-10-31 23:03:05 -0700748 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700749 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700750 "-Wno-unused-parameter",
751 "-include openbsd-compat.h",
752 ],
753
Dan Willemsen208ae172015-09-16 16:33:27 -0700754 local_include_dirs: [
755 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700756 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700757 ],
758
759 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700760}
761
762// ========================================================
763// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
764// ========================================================
765//
766// These files are built with the openbsd-compat.h header file
767// automatically included.
768
769cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700770 defaults: ["libc_defaults"],
Chih-Hung Hsiehe343db32023-01-03 14:54:34 -0800771 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700772 srcs: [
773 "upstream-openbsd/android/gdtoa_support.cpp",
774 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
775 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
776 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
777 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
778 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
779 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
780 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
781 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
782 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
783 "upstream-openbsd/lib/libc/gdtoa/misc.c",
784 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
785 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
786 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
787 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
788 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
789 "upstream-openbsd/lib/libc/gdtoa/sum.c",
790 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
791 ],
792 multilib: {
793 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800794 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700795 },
796 },
797
Colin Cross50c21ab2015-10-31 23:03:05 -0700798 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700799 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700800 "-include openbsd-compat.h",
801 ],
802
Dan Willemsen208ae172015-09-16 16:33:27 -0700803 local_include_dirs: [
804 "private",
805 "upstream-openbsd/android/include",
806 "upstream-openbsd/lib/libc/include",
807 ],
808
809 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700810}
811
812// ========================================================
Pierre-Clément Tosi467e58e2023-02-01 13:44:43 +0000813// libc_fortify.a - container for our FORTIFY
George Burgess IV6cb06872017-07-21 13:28:42 -0700814// implementation details
815// ========================================================
816cc_library_static {
817 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700818 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700819
820 name: "libc_fortify",
821
822 // Disable FORTIFY for the compilation of these, so we don't end up having
823 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800824 cflags: [
825 "-U_FORTIFY_SOURCE",
826 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
827 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700828
829 arch: {
830 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800831 cflags: [
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800832 "-DRENAME___STRCAT_CHK",
833 "-DRENAME___STRCPY_CHK",
834 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700835 srcs: [
836 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800837
838 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
839 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
840
841 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
842 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
843
844 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
845 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
846
847 "arch-arm/krait/bionic/__strcat_chk.S",
848 "arch-arm/krait/bionic/__strcpy_chk.S",
849
850 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
851 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
852
Haibo Huang01bfd892018-12-03 15:05:16 -0800853 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
854 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700855 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700856 },
857 arm64: {
858 srcs: [
Elliott Hughes023e4e72022-11-17 19:27:02 +0000859 "arch-arm64/string/__memcpy_chk.S",
860 "arch-arm64/string/__memset_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700861 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700862 },
caowenchengab457f92023-03-06 14:57:55 +0800863 riscv64: {
864 srcs: [
865 "arch-riscv64/string/__memset_chk.S",
caowencheng9a39eb32023-03-20 16:24:41 +0800866 "arch-riscv64/string/__memcpy_chk.S",
caowenchengab457f92023-03-06 14:57:55 +0800867 ],
868 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700869 },
870}
871
872// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700873// libc_bionic.a - home-grown C library code
874// ========================================================
875
876cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700877 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700878 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800879 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700880 "bionic/sysconf.cpp",
881 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700882 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700883
Josh Gao10ec9282017-04-03 15:13:29 -0700884 // The following must not be statically linked into libc_ndk.a, because
885 // debuggerd will look for the abort message in libc.so's copy.
886 "bionic/android_set_abort_message.cpp",
887
Dan Willemsen208ae172015-09-16 16:33:27 -0700888 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800889 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700890 "bionic/strnlen.c",
891 "bionic/strrchr.cpp",
892 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700893
894 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700895 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700896 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700897 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800898 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700899 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800900 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800901 "arch-arm/generic/bionic/stpcpy.c",
902 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800903 "arch-arm/generic/bionic/strcmp.S",
904 "arch-arm/generic/bionic/strcpy.S",
905 "arch-arm/generic/bionic/strlen.c",
906
Ryan Prichard45024fe2018-12-30 21:10:26 -0800907 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700908 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700909 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700910 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700911 "arch-arm/bionic/atomics_arm.c",
912 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800913 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700914 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700915 "arch-arm/bionic/setjmp.S",
916 "arch-arm/bionic/syscall.S",
917 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800918
919 "arch-arm/cortex-a15/bionic/memcpy.S",
920 "arch-arm/cortex-a15/bionic/memmove.S",
921 "arch-arm/cortex-a15/bionic/memset.S",
922 "arch-arm/cortex-a15/bionic/stpcpy.S",
923 "arch-arm/cortex-a15/bionic/strcat.S",
924 "arch-arm/cortex-a15/bionic/strcmp.S",
925 "arch-arm/cortex-a15/bionic/strcpy.S",
926 "arch-arm/cortex-a15/bionic/strlen.S",
927
928 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800929 "arch-arm/cortex-a7/bionic/memset.S",
930
931 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800932 "arch-arm/cortex-a9/bionic/memset.S",
933 "arch-arm/cortex-a9/bionic/stpcpy.S",
934 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800935 "arch-arm/cortex-a9/bionic/strcpy.S",
936 "arch-arm/cortex-a9/bionic/strlen.S",
937
938 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800939 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800940
941 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800942
Haibo Huang01bfd892018-12-03 15:05:16 -0800943 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800944
945 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700946 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700947 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700948 arm64: {
949 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800950 "arch-arm64/bionic/__bionic_clone.S",
951 "arch-arm64/bionic/_exit_with_stack_teardown.S",
952 "arch-arm64/bionic/setjmp.S",
953 "arch-arm64/bionic/syscall.S",
954 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700955 ],
956 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700957 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800958 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700959 "bionic/strnlen.c",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800960 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700961 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700962 },
963
Elliott Hughesebc19a92022-10-14 23:25:36 +0000964 riscv64: {
965 srcs: [
966 "arch-riscv64/bionic/__bionic_clone.S",
967 "arch-riscv64/bionic/_exit_with_stack_teardown.S",
Elliott Hughese1905ed2022-10-17 23:23:36 +0000968 "arch-riscv64/bionic/setjmp.S",
Elliott Hughesebc19a92022-10-14 23:25:36 +0000969 "arch-riscv64/bionic/syscall.S",
970 "arch-riscv64/bionic/vfork.S",
971 ],
972 },
973
Dan Willemsen208ae172015-09-16 16:33:27 -0700974 x86: {
975 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700976 "arch-x86/generic/string/memcmp.S",
977 "arch-x86/generic/string/strcmp.S",
978 "arch-x86/generic/string/strncmp.S",
979 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700980
981 "arch-x86/generic/string/strlcat.c",
982 "arch-x86/generic/string/strlcpy.c",
983 "arch-x86/generic/string/strncat.c",
984 "arch-x86/generic/string/wcscat.c",
985 "arch-x86/generic/string/wcscpy.c",
986 "arch-x86/generic/string/wmemcmp.c",
987
Elliott Hughesed777142022-07-25 16:25:11 +0000988 "arch-x86/string/sse2-memchr-atom.S",
989 "arch-x86/string/sse2-memmove-slm.S",
990 "arch-x86/string/sse2-memrchr-atom.S",
991 "arch-x86/string/sse2-memset-atom.S",
992 "arch-x86/string/sse2-memset-slm.S",
993 "arch-x86/string/sse2-stpcpy-slm.S",
994 "arch-x86/string/sse2-stpncpy-slm.S",
995 "arch-x86/string/sse2-strchr-atom.S",
996 "arch-x86/string/sse2-strcpy-slm.S",
997 "arch-x86/string/sse2-strlen-slm.S",
998 "arch-x86/string/sse2-strncpy-slm.S",
999 "arch-x86/string/sse2-strnlen-atom.S",
1000 "arch-x86/string/sse2-strrchr-atom.S",
1001 "arch-x86/string/sse2-wcschr-atom.S",
1002 "arch-x86/string/sse2-wcsrchr-atom.S",
1003 "arch-x86/string/sse2-wcslen-atom.S",
1004 "arch-x86/string/sse2-wcscmp-atom.S",
1005 "arch-x86/string/sse2-strlen-atom.S",
1006
1007 "arch-x86/string/ssse3-memcmp-atom.S",
1008 "arch-x86/string/ssse3-memmove-atom.S",
1009 "arch-x86/string/ssse3-strcat-atom.S",
1010 "arch-x86/string/ssse3-strcmp-atom.S",
1011 "arch-x86/string/ssse3-strcpy-atom.S",
1012 "arch-x86/string/ssse3-strlcat-atom.S",
1013 "arch-x86/string/ssse3-strlcpy-atom.S",
1014 "arch-x86/string/ssse3-strncat-atom.S",
1015 "arch-x86/string/ssse3-strncmp-atom.S",
1016 "arch-x86/string/ssse3-strncpy-atom.S",
1017 "arch-x86/string/ssse3-wcscat-atom.S",
1018 "arch-x86/string/ssse3-wcscpy-atom.S",
1019 "arch-x86/string/ssse3-wmemcmp-atom.S",
1020
1021 "arch-x86/string/sse4-memcmp-slm.S",
1022 "arch-x86/string/sse4-wmemcmp-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001023
1024 "arch-x86/bionic/__bionic_clone.S",
1025 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -08001026 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -08001027 "arch-x86/bionic/__restore.S",
1028 "arch-x86/bionic/setjmp.S",
1029 "arch-x86/bionic/syscall.S",
1030 "arch-x86/bionic/vfork.S",
Ryan Pricharda992a062020-04-18 02:59:24 -07001031 "arch-x86/bionic/__x86.get_pc_thunk.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001032 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001033
1034 exclude_srcs: [
1035 "bionic/strchr.cpp",
1036 "bionic/strnlen.c",
1037 "bionic/strrchr.cpp",
1038 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001039 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001040 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001041 srcs: [
ahs919fb7f2022-06-10 07:11:14 +05301042 "arch-x86_64/string/avx2-memset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001043 "arch-x86_64/string/sse2-memmove-slm.S",
1044 "arch-x86_64/string/sse2-memset-slm.S",
1045 "arch-x86_64/string/sse2-stpcpy-slm.S",
1046 "arch-x86_64/string/sse2-stpncpy-slm.S",
1047 "arch-x86_64/string/sse2-strcat-slm.S",
1048 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001049 "arch-x86_64/string/sse2-strlen-slm.S",
1050 "arch-x86_64/string/sse2-strncat-slm.S",
1051 "arch-x86_64/string/sse2-strncpy-slm.S",
1052 "arch-x86_64/string/sse4-memcmp-slm.S",
1053 "arch-x86_64/string/ssse3-strcmp-slm.S",
1054 "arch-x86_64/string/ssse3-strncmp-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001055
1056 "arch-x86_64/bionic/__bionic_clone.S",
1057 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1058 "arch-x86_64/bionic/__restore_rt.S",
1059 "arch-x86_64/bionic/setjmp.S",
1060 "arch-x86_64/bionic/syscall.S",
1061 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001062 ],
1063 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001064 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001065
Colin Cross50c21ab2015-10-31 23:03:05 -07001066 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001067 include_dirs: ["bionic/libstdc++/include"],
1068 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001069}
1070
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001071genrule {
1072 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001073 out: ["generated_android_ids.h"],
1074 srcs: [":android_filesystem_config_header"],
1075 tool_files: ["fs_config_generator.py"],
1076 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001077}
1078
Dan Willemsen268a6732015-10-15 14:49:45 -07001079// ========================================================
1080// libc_bionic_ndk.a- The portions of libc_bionic that can
1081// be safely used in libc_ndk.a (no troublesome global data
1082// or constructors).
1083// ========================================================
1084cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001085 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001086 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001087 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001088 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001089 "bionic/__cmsg_nxthdr.cpp",
1090 "bionic/__errno.cpp",
1091 "bionic/__gnu_basename.cpp",
1092 "bionic/__libc_current_sigrtmax.cpp",
1093 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001094 "bionic/abort.cpp",
1095 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001096 "bionic/access.cpp",
1097 "bionic/arpa_inet.cpp",
1098 "bionic/assert.cpp",
1099 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001100 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001101 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001102 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001103 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001104 "bionic/bionic_time_conversions.cpp",
1105 "bionic/brk.cpp",
1106 "bionic/c16rtomb.cpp",
1107 "bionic/c32rtomb.cpp",
1108 "bionic/chmod.cpp",
1109 "bionic/chown.cpp",
1110 "bionic/clearenv.cpp",
1111 "bionic/clock.cpp",
1112 "bionic/clock_getcpuclockid.cpp",
1113 "bionic/clock_nanosleep.cpp",
1114 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001115 "bionic/ctype.cpp",
1116 "bionic/dirent.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001117 "bionic/dup.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001118 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001119 "bionic/error.cpp",
Josh Gao7de41242020-04-29 17:08:46 -07001120 "bionic/eventfd.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001121 "bionic/exec.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001122 "bionic/execinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001123 "bionic/faccessat.cpp",
1124 "bionic/fchmod.cpp",
1125 "bionic/fchmodat.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001126 "bionic/fcntl.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001127 "bionic/fdsan.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001128 "bionic/fdtrack.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001129 "bionic/ffs.cpp",
1130 "bionic/fgetxattr.cpp",
1131 "bionic/flistxattr.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001132 "bionic/fpclassify.cpp",
1133 "bionic/fsetxattr.cpp",
1134 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001135 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001136 "bionic/futimens.cpp",
1137 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001138 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001139 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001140 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001141 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001142 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001143 "bionic/getpgrp.cpp",
1144 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001145 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001146 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001147 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001148 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001149 "bionic/grp_pwd_file.cpp",
Mitch Phillips9cad8422021-01-20 16:03:27 -08001150 "bionic/heap_zero_init.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001151 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001152 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001153 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001154 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001155 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001156 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001157 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001158 "bionic/lchown.cpp",
1159 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001160 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001161 "bionic/libgen.cpp",
1162 "bionic/link.cpp",
1163 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001164 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001165 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001166 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001167 "bionic/mbrtoc16.cpp",
1168 "bionic/mbrtoc32.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001169 "bionic/mempcpy.cpp",
Elliott Hughes0d642432022-08-10 23:35:03 +00001170 "bionic/memset_explicit.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001171 "bionic/mkdir.cpp",
1172 "bionic/mkfifo.cpp",
1173 "bionic/mknod.cpp",
1174 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001175 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001176 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001177 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001178 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001179 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001180 "bionic/open.cpp",
1181 "bionic/pathconf.cpp",
1182 "bionic/pause.cpp",
Josh Gao3de19152021-02-22 18:09:48 -08001183 "bionic/pidfd.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001184 "bionic/pipe.cpp",
1185 "bionic/poll.cpp",
1186 "bionic/posix_fadvise.cpp",
1187 "bionic/posix_fallocate.cpp",
1188 "bionic/posix_madvise.cpp",
1189 "bionic/posix_timers.cpp",
Elliott Hughescf59e192021-10-13 18:25:21 -07001190 "bionic/preadv_pwritev.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001191 "bionic/ptrace.cpp",
1192 "bionic/pty.cpp",
1193 "bionic/raise.cpp",
1194 "bionic/rand.cpp",
1195 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001196 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001197 "bionic/reboot.cpp",
1198 "bionic/recv.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001199 "bionic/recvmsg.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001200 "bionic/rename.cpp",
1201 "bionic/rmdir.cpp",
1202 "bionic/scandir.cpp",
1203 "bionic/sched_getaffinity.cpp",
1204 "bionic/sched_getcpu.cpp",
1205 "bionic/semaphore.cpp",
1206 "bionic/send.cpp",
1207 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001208 "bionic/seteuid.cpp",
1209 "bionic/setpgrp.cpp",
1210 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001211 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001212 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001213 "bionic/sleep.cpp",
Josh Gaob107eab2020-04-29 17:17:56 -07001214 "bionic/socketpair.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001215 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001216 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001217 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001218 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001219 "bionic/string_l.cpp",
1220 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001221 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001222 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001223 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001224 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001225 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001226 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001227 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001228 "bionic/sys_msg.cpp",
1229 "bionic/sys_sem.cpp",
1230 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001231 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001232 "bionic/sys_statfs.cpp",
1233 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001234 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001235 "bionic/sysinfo.cpp",
1236 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001237 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001238 "bionic/system_property_api.cpp",
1239 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001240 "bionic/tdestroy.cpp",
1241 "bionic/termios.cpp",
1242 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001243 "bionic/threads.cpp",
Elliott Hughesd3627a42022-12-06 22:24:27 +00001244 "bionic/time_l.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001245 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001246 "bionic/tmpfile.cpp",
1247 "bionic/umount.cpp",
1248 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001249 "bionic/usleep.cpp",
Elliott Hughes9a1d3972020-08-07 15:55:02 -07001250 "bionic/utmp.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001251 "bionic/wait.cpp",
1252 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001253 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001254 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001255 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001256 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001257 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001258
1259 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1260 // which will be overridden by the actual one in libc.so.
1261 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001262 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001263
Dan Willemsen208ae172015-09-16 16:33:27 -07001264 multilib: {
1265 lib32: {
1266 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001267 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001268 },
1269 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001270 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001271 treble_linker_namespaces: {
1272 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001273 },
1274 },
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001275 whole_static_libs: [
Bowgo Tsai8f14b652021-07-15 10:13:33 +00001276 "libc_bionic_systrace",
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001277 "libsystemproperties",
1278 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001279 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001280 local_include_dirs: ["stdio"],
1281 include_dirs: ["bionic/libstdc++/include"],
1282 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001283 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001284}
1285
Dan Willemsen208ae172015-09-16 16:33:27 -07001286// ========================================================
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001287// libc_bionic_systrace.a
1288// ========================================================
1289
1290cc_library_static {
1291 name: "libc_bionic_systrace",
1292 defaults: ["libc_defaults"],
1293 srcs: [
1294 "bionic/bionic_systrace.cpp",
1295 ],
1296 apex_available: [
1297 "com.android.runtime",
1298 ],
1299}
1300
1301// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001302// libc_pthread.a - pthreads parts that previously lived in
1303// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001304// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001305// pthread_t has changed over the years and has ABI
1306// compatibility issues).
1307// ========================================================
1308
1309cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001310 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001311 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001312 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001313 "bionic/pthread_atfork.cpp",
1314 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001315 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001316 "bionic/pthread_cond.cpp",
1317 "bionic/pthread_create.cpp",
1318 "bionic/pthread_detach.cpp",
1319 "bionic/pthread_equal.cpp",
1320 "bionic/pthread_exit.cpp",
1321 "bionic/pthread_getcpuclockid.cpp",
1322 "bionic/pthread_getschedparam.cpp",
1323 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001324 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001325 "bionic/pthread_join.cpp",
1326 "bionic/pthread_key.cpp",
1327 "bionic/pthread_kill.cpp",
1328 "bionic/pthread_mutex.cpp",
1329 "bionic/pthread_once.cpp",
1330 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001331 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001332 "bionic/pthread_self.cpp",
1333 "bionic/pthread_setname_np.cpp",
1334 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001335 "bionic/pthread_spinlock.cpp",
Vy Nguyend5007512020-07-14 17:37:04 -04001336 "bionic/sys_thread_properties.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001337
1338 // The following implementations depend on pthread data or implementation,
1339 // so we can't include them in libc_ndk.a.
1340 "bionic/__cxa_thread_atexit_impl.cpp",
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001341 "bionic/android_unsafe_frame_pointer_chase.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -08001342 "bionic/atexit.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001343 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001344 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001345
Colin Cross50c21ab2015-10-31 23:03:05 -07001346 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001347 include_dirs: ["bionic/libstdc++/include"],
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001348 header_libs: ["bionic_libc_platform_headers"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001349 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001350}
1351
1352// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001353// libc_syscalls.a
1354// ========================================================
1355
Elliott Hughes782c4852019-04-16 12:31:00 -07001356genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001357 name: "syscalls-arm",
Elliott Hughes782c4852019-04-16 12:31:00 -07001358 out: ["syscalls-arm.S"],
1359 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001360 tools: ["gensyscalls"],
1361 cmd: "$(location gensyscalls) arm $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001362}
1363
1364genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001365 name: "syscalls-arm64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001366 out: ["syscalls-arm64.S"],
1367 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001368 tools: ["gensyscalls"],
1369 cmd: "$(location gensyscalls) arm64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001370}
1371
1372genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001373 name: "syscalls-riscv64",
Elliott Hughes704772b2022-10-10 17:06:43 +00001374 out: ["syscalls-riscv64.S"],
1375 srcs: ["SYSCALLS.TXT"],
1376 tools: ["gensyscalls"],
1377 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)",
1378}
1379
1380genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001381 name: "syscalls-x86",
Elliott Hughes782c4852019-04-16 12:31:00 -07001382 out: ["syscalls-x86.S"],
1383 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001384 tools: ["gensyscalls"],
1385 cmd: "$(location gensyscalls) x86 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001386}
1387
1388genrule {
Cole Faustf5968d82023-04-11 15:20:19 -07001389 name: "syscalls-x86_64",
Elliott Hughes782c4852019-04-16 12:31:00 -07001390 out: ["syscalls-x86_64.S"],
1391 srcs: ["SYSCALLS.TXT"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001392 tools: ["gensyscalls"],
1393 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)",
Elliott Hughes782c4852019-04-16 12:31:00 -07001394}
1395
Dan Willemsen208ae172015-09-16 16:33:27 -07001396cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001397 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001398 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001399 arch: {
1400 arm: {
Cole Faustf5968d82023-04-11 15:20:19 -07001401 srcs: [":syscalls-arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001402 },
1403 arm64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001404 srcs: [":syscalls-arm64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001405 },
Elliott Hughes704772b2022-10-10 17:06:43 +00001406 riscv64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001407 srcs: [":syscalls-riscv64"],
Elliott Hughes704772b2022-10-10 17:06:43 +00001408 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001409 x86: {
Cole Faustf5968d82023-04-11 15:20:19 -07001410 srcs: [":syscalls-x86"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001411 },
1412 x86_64: {
Cole Faustf5968d82023-04-11 15:20:19 -07001413 srcs: [":syscalls-x86_64"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001414 },
1415 },
1416 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001417}
1418
1419// ========================================================
1420// libc_aeabi.a
1421// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1422// to avoid infinite recursion. For the other architectures we just build an
1423// empty library to keep this makefile simple.
1424// ========================================================
1425
1426cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001427 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001428 arch: {
1429 arm: {
1430 srcs: ["arch-arm/bionic/__aeabi.c"],
1431 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001432 },
1433 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001434 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001435}
1436
1437// ========================================================
1438// libc_ndk.a
1439// Compatibility library for the NDK. This library contains
1440// all the parts of libc that are safe to statically link.
1441// We can't safely statically link things that can only run
1442// on a certain version of the OS. Examples include
1443// anything that talks to netd (a large portion of the DNS
1444// code) and anything that is dependent on the layout of a
1445// data structure that has changed across releases (such as
1446// pthread_t).
1447// ========================================================
1448
1449cc_library_static {
1450 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001451 defaults: [
1452 "libc_defaults",
1453 "libc_native_allocator_defaults",
1454 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -08001455 ramdisk_available: false,
Yifan Hongb04490d2020-10-21 18:36:36 -07001456 vendor_ramdisk_available: false,
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001457 srcs: libc_common_src_files + [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001458 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001459 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001460 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001461 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001462 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001463 multilib: {
1464 lib32: {
1465 srcs: libc_common_src_files_32,
1466 },
1467 },
1468 arch: {
1469 arm: {
1470 srcs: [
1471 "arch-arm/bionic/exidx_dynamic.c",
1472 "arch-common/bionic/crtbegin_so.c",
1473 "arch-arm/bionic/atexit_legacy.c",
1474 "arch-common/bionic/crtend_so.S",
1475 ],
1476 whole_static_libs: ["libc_aeabi"],
1477 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001478 },
1479
Colin Cross50c21ab2015-10-31 23:03:05 -07001480 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001481 "-fvisibility=hidden",
1482 "-DLIBC_STATIC",
1483 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001484
1485 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001486 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001487 "gwp_asan_crash_handler",
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001488 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001489 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001490 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001491 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001492 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001493 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001494 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001495 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001496 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001497 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001498 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001499 "libc_syscalls",
1500 "libc_tzcode",
1501 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001502 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001503 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001504}
1505
1506// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001507// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001508// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001509cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001510 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001511 srcs: libc_common_src_files,
1512 multilib: {
1513 lib32: {
1514 srcs: libc_common_src_files_32,
1515 },
1516 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001517 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001518
1519 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001520 "libarm-optimized-routines-string",
Rupert Shuttleworth78f48a52021-03-16 06:39:19 +00001521 "libasync_safe",
Dan Willemsen208ae172015-09-16 16:33:27 -07001522 "libc_bionic",
1523 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001524 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001525 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001526 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001527 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001528 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001529 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001530 "libc_netbsd",
1531 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001532 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001533 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001534 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001535 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001536 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001537 ],
1538
1539 arch: {
1540 arm: {
1541 whole_static_libs: ["libc_aeabi"],
1542 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001543 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001544}
1545
1546// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001547// libc_common.a
1548// ========================================================
1549
1550cc_library_static {
1551 defaults: ["libc_defaults"],
1552 name: "libc_common",
1553
1554 whole_static_libs: [
1555 "libc_nopthread",
1556 "libc_pthread",
1557 ],
1558}
1559
1560// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001561// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001562// ========================================================
1563cc_library_static {
1564 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001565 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001566
Haibo Huangb9244ff2018-08-11 10:12:13 -07001567 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301568 x86_64: {
1569 srcs: ["arch-x86_64/static_function_dispatch.S"],
1570 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001571 x86: {
1572 srcs: ["arch-x86/static_function_dispatch.S"],
1573 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001574 arm: {
1575 srcs: ["arch-arm/static_function_dispatch.S"],
1576 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001577 arm64: {
1578 srcs: ["arch-arm64/static_function_dispatch.S"],
1579 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001580 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001581}
1582
1583// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001584// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001585// ========================================================
1586cc_library_static {
1587 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001588 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001589
Haibo Huangb9244ff2018-08-11 10:12:13 -07001590 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001591 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001592 "-fno-stack-protector",
1593 "-fno-jump-tables",
1594 ],
1595 arch: {
ahs919fb7f2022-06-10 07:11:14 +05301596 x86_64: {
1597 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"],
1598 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001599 x86: {
1600 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1601 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001602 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001603 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001604 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001605 arm64: {
1606 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1607 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001608 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001609}
1610
1611// ========================================================
1612// libc_common_static.a For static binaries.
1613// ========================================================
1614cc_library_static {
1615 defaults: ["libc_defaults"],
1616 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001617
Haibo Huangf71edfa2018-11-12 10:06:56 -08001618 whole_static_libs: [
1619 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001620 "libc_static_dispatch",
1621 ],
1622}
1623
1624// ========================================================
1625// libc_common_shared.a For shared libraries.
1626// ========================================================
1627cc_library_static {
1628 defaults: ["libc_defaults"],
1629 name: "libc_common_shared",
1630
1631 whole_static_libs: [
1632 "libc_common",
1633 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001634 ],
1635}
1636
Ryan Prichard22a6a052019-10-10 23:59:30 -07001637// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1638// executable.
1639cc_library_static {
1640 name: "libc_unwind_static",
1641 defaults: ["libc_defaults"],
1642 cflags: ["-DLIBC_STATIC"],
1643
1644 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1645 arch: {
1646 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1647 arm: {
1648 srcs: ["arch-arm/bionic/exidx_static.c"],
1649 },
1650 },
1651}
1652
Haibo Huangf71edfa2018-11-12 10:06:56 -08001653// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001654// libc_nomalloc.a
1655// ========================================================
1656//
Ryan Prichard249757b2019-11-01 17:18:28 -07001657// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1658// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1659// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001660
1661cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001662 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001663 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001664
Colin Crossa3f9fca2016-01-11 13:20:55 -08001665 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001666 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001667 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001668 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001669 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001670}
1671
dimitryc0c0ef62018-12-05 16:33:52 +01001672filegroup {
1673 name: "libc_sources_shared",
1674 srcs: [
1675 "arch-common/bionic/crtbegin_so.c",
1676 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001677 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001678 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001679 "bionic/icu.cpp",
1680 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001681 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001682 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001683 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001684 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001685 "bionic/ndk_cruft.cpp",
1686 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001687 "bionic/NetdClient.cpp",
1688 "arch-common/bionic/crtend_so.S",
1689 ],
1690}
1691
1692filegroup {
1693 name: "libc_sources_static",
1694 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001695 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001696 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001697 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001698 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001699 ],
1700}
1701
1702filegroup {
1703 name: "libc_sources_shared_arm",
1704 srcs: [
1705 "arch-arm/bionic/exidx_dynamic.c",
1706 "arch-arm/bionic/atexit_legacy.c",
1707 ],
1708}
1709
Dan Willemsen208ae172015-09-16 16:33:27 -07001710// ========================================================
1711// libc.a + libc.so
1712// ========================================================
Florian Mayerc10d0642023-03-22 16:12:49 -07001713cc_defaults {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001714 defaults: [
1715 "libc_defaults",
1716 "libc_native_allocator_defaults",
1717 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001718 name: "libc_library_defaults",
Colin Cross50c21ab2015-10-31 23:03:05 -07001719 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001720 platform_sdk_version: {
1721 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1722 },
1723 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001724 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001725 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001726 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001727 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001728 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001729 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001730 "libc_init_static",
1731 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001732 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001733 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001734 },
1735 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001736 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001737 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001738 "gwp_asan",
Mitch Phillipsa493fe42023-01-19 12:47:22 -08001739 "gwp_asan_crash_handler",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001740 "libc_init_dynamic",
1741 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001742 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001743 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001744 },
1745
Neil Fullera7db90f2019-04-25 09:28:27 +01001746 required: [
MarkDacekd88d7ea2022-06-28 20:14:58 +00001747 "tzdata_prebuilt",
1748 "tz_version_prebuilt", // Version metadata for tzdata to help debugging.
Neil Fullera7db90f2019-04-25 09:28:27 +01001749 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001750
Colin Cross4ce94d22016-11-15 13:15:43 -08001751 // Do not pack libc.so relocations; see http://b/20645321 for details.
1752 pack_relocations: false,
1753
dimitry06016f22018-01-05 11:39:28 +01001754 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1755 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1756 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1757 // those new libraries from libgcc.a are not declared external; if that were the case,
1758 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1759 // on the external symbols from the dependent libraries. That would create a "cloaked"
1760 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001761
dimitry06016f22018-01-05 11:39:28 +01001762 shared_libs: [
1763 "ld-android",
1764 "libdl",
1765 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001766 static_libs: [
1767 "libdl_android",
1768 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001769
1770 nocrt: true,
1771
Dan Willemsen208ae172015-09-16 16:33:27 -07001772 arch: {
1773 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001774 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001775 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001776 ldflags: ["-Wl,--hash-style=both"],
1777
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001778 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001779 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001780
Dan Willemsen208ae172015-09-16 16:33:27 -07001781 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001782 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001783 // special for arm
1784 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001785 // For backwards-compatibility, some arm32 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001786 static_libs: ["libclang_rt.builtins-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001787 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001788
1789 // Arm 32 bit does not produce complete exidx unwind information
1790 // so keep the .debug_frame which is relatively small and does
1791 // include needed unwind information.
1792 // See b/132992102 for details.
1793 strip: {
1794 keep_symbols_and_debug_frame: true,
1795 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001796 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001797 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001798 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001799
1800 // Leave the symbols in the shared library so that stack unwinders can produce
1801 // meaningful name resolution.
1802 strip: {
1803 keep_symbols: true,
1804 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001805 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001806 riscv64: {
1807 version_script: ":libc.riscv64.map",
1808
1809 // Leave the symbols in the shared library so that stack unwinders can produce
1810 // meaningful name resolution.
1811 strip: {
1812 keep_symbols: true,
1813 },
1814 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001815 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001816 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001817 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001818 ldflags: ["-Wl,--hash-style=both"],
1819
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001820 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001821 no_libcrt: true,
1822
1823 shared: {
1824 // For backwards-compatibility, some x86 builtins are exported from libc.so.
Colin Cross335e27b2022-02-10 11:37:28 -08001825 static_libs: ["libclang_rt.builtins-exported"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001826 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001827
1828 // Leave the symbols in the shared library so that stack unwinders can produce
1829 // meaningful name resolution.
1830 strip: {
1831 keep_symbols: true,
1832 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001833 },
1834 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001835 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001836
1837 // Leave the symbols in the shared library so that stack unwinders can produce
1838 // meaningful name resolution.
1839 strip: {
1840 keep_symbols: true,
1841 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001842 },
1843 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001844
Florian Mayerc10d0642023-03-22 16:12:49 -07001845
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001846 apex_available: [
1847 "//apex_available:platform",
1848 "com.android.runtime",
1849 ],
1850
Colin Cross7edd0082021-10-28 13:20:35 -07001851 target: {
1852 native_bridge: {
1853 shared: {
1854 installable: false,
1855 },
1856 },
1857 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001858}
1859
Florian Mayerc10d0642023-03-22 16:12:49 -07001860cc_library {
1861 name: "libc",
1862 defaults: [
1863 "libc_library_defaults",
1864 ],
1865 stubs: {
1866 symbol_file: "libc.map.txt",
1867 versions: [
1868 "29",
1869 "R",
1870 "current",
1871 ],
1872 },
1873 static_ndk_lib: true,
1874 llndk: {
1875 symbol_file: "libc.map.txt",
1876 export_headers_as_system: true,
1877 export_preprocessed_headers: ["include"],
1878 export_llndk_headers: ["libc_llndk_headers"],
1879 },
1880}
1881
1882cc_library {
1883 name: "libc_hwasan",
1884 defaults: [
1885 "libc_library_defaults",
1886 ],
1887 sanitize: {
1888 hwaddress: true,
1889 },
1890 enabled: false,
Florian Mayerff116ed2023-04-14 17:38:53 -07001891 target: {
1892 android_arm64: {
Florian Mayerc10d0642023-03-22 16:12:49 -07001893 enabled: true,
1894 },
1895 },
1896 stem: "libc",
1897 relative_install_path: "hwasan",
1898 // We don't really need the stubs, but this needs to stay to trigger the
1899 // symlink logic in soong.
1900 stubs: {
1901 symbol_file: "libc.map.txt",
1902 },
1903 native_bridge_supported: false,
1904 // It is never correct to depend on this directly. This is only
1905 // needed for the runtime apex, and in base_system.mk.
1906 visibility: ["//bionic/apex"],
1907}
1908
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001909genrule {
1910 name: "libc.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001911 out: ["libc.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001912 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001913 tools: ["generate-version-script"],
1914 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001915}
1916
1917genrule {
1918 name: "libc.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001919 out: ["libc.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001920 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001921 tools: ["generate-version-script"],
1922 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001923}
1924
1925genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001926 name: "libc.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001927 out: ["libc.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00001928 srcs: ["libc.map.txt"],
1929 tools: ["generate-version-script"],
1930 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
1931}
1932
1933genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001934 name: "libc.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001935 out: ["libc.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001936 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001937 tools: ["generate-version-script"],
1938 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001939}
1940
1941genrule {
1942 name: "libc.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07001943 out: ["libc.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001944 srcs: ["libc.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00001945 tools: ["generate-version-script"],
1946 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001947}
1948
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001949// Headers that only other parts of the platform can include.
1950cc_library_headers {
1951 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001952 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001953 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001954 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001955 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001956 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001957 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001958 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001959 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001960 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001961 "//system/core/debuggerd:__subpackages__",
Florian Mayerf5d70ce2022-09-13 13:58:30 -07001962 "//system/core/init:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001963 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001964 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001965 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001966 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001967 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001968 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001969 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001970 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001971 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001972 recovery_available: true,
1973 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001974 export_include_dirs: [
1975 "platform",
1976 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001977 system_shared_libs: [],
1978 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001979 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001980
Steven Moreland0cdf1322020-10-05 21:55:26 +00001981 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001982 apex_available: [
1983 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001984 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001985 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001986}
1987
Logan Chien17af91b2019-01-15 21:19:56 +08001988cc_library_headers {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001989 name: "libc_llndk_headers",
Colin Cross5d50dbb2021-06-29 11:35:29 -07001990 visibility: [
1991 "//external/musl",
1992 ],
Colin Crossa0a4a6c2021-03-02 10:23:04 -08001993 llndk: {
1994 llndk_headers: true,
1995 },
Logan Chien17af91b2019-01-15 21:19:56 +08001996 host_supported: true,
1997 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001998 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001999 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002000 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002001 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002002 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002003 apex_available: [
2004 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09002005 "//apex_available:anyapex",
2006 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09002007 // used by most APEXes indirectly via libunwind_llvm
2008 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08002009
2010 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002011 stl: "none",
2012 system_shared_libs: [],
2013
Peter Collingbournef2b1e032019-12-10 17:41:16 -08002014 // The build system generally requires that any dependencies of a target
2015 // with an sdk_version must have a lower sdk_version. By setting sdk_version
2016 // to 1 we let targets with an sdk_version that need to depend on the libc
2017 // headers but cannot depend on libc itself due to circular dependencies
2018 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
2019 // is correct because the headers can support any sdk_version.
2020 sdk_version: "1",
2021
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01002022 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08002023 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01002024 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002025 "kernel/android/uapi",
2026 ],
2027
2028 arch: {
2029 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01002030 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08002031 },
2032 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01002033 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08002034 },
Elliott Hughes48e53332022-10-07 20:39:25 +00002035 riscv64: {
2036 export_system_include_dirs: ["kernel/uapi/asm-riscv"],
2037 },
Logan Chien17af91b2019-01-15 21:19:56 +08002038 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01002039 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08002040 },
2041 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01002042 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08002043 },
2044 },
2045}
2046
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01002047cc_library_headers {
2048 name: "libc_headers",
2049 host_supported: true,
2050 native_bridge_supported: true,
2051 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002052 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01002053 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002054 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01002055 recovery_available: true,
2056 sdk_version: "1",
2057
2058 apex_available: [
2059 "//apex_available:platform",
2060 "//apex_available:anyapex",
2061 ],
2062 // used by most APEXes indirectly via libunwind_llvm
2063 min_sdk_version: "apex_inherit",
2064 visibility: [
2065 "//bionic:__subpackages__", // visible to bionic
2066 // ... and only to these places (b/152668052)
2067 "//external/arm-optimized-routines",
2068 "//external/gwp_asan",
2069 "//external/jemalloc_new",
2070 "//external/libunwind_llvm",
2071 "//external/scudo",
2072 "//system/core/property_service/libpropertyinfoparser",
2073 "//system/extras/toolchain-extras",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01002074 ],
2075
2076 stl: "none",
2077 no_libcrt: true,
2078 system_shared_libs: [],
2079
2080 target: {
2081 android: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08002082 export_system_include_dirs: ["include"],
2083 header_libs: ["libc_llndk_headers"],
2084 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01002085 },
2086 linux_bionic: {
Colin Crossa0a4a6c2021-03-02 10:23:04 -08002087 export_system_include_dirs: ["include"],
2088 header_libs: ["libc_llndk_headers"],
2089 export_header_lib_headers: ["libc_llndk_headers"],
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01002090 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00002091 },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01002092}
2093
Dan Willemsen208ae172015-09-16 16:33:27 -07002094// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002095// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07002096// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002097
me-cafebabe9dbfa7a2023-10-05 19:38:27 +00002098cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002099 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002100 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002101 srcs: [
2102 "bionic/__cxa_guard.cpp",
2103 "bionic/__cxa_pure_virtual.cpp",
2104 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07002105 ],
me-cafebabe9dbfa7a2023-10-05 19:38:27 +00002106 name: "libstdc++_defaults",
Dan Albert40f15ec2017-10-27 11:21:20 -07002107 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08002108 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002109
Dan Willemsen6b3be172018-12-03 13:57:20 -08002110 static: {
2111 system_shared_libs: [],
2112 },
Colin Crossb5bfe0b2021-07-13 16:26:28 -07002113 target: {
2114 bionic: {
2115 shared: {
2116 system_shared_libs: ["libc"],
2117 },
2118 },
Dan Willemsen6b3be172018-12-03 13:57:20 -08002119 },
2120
Ian Pedowitzb6310c22018-01-18 16:26:19 -08002121 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07002122 arch: {
2123 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002124 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07002125 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08002126 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002127 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07002128 },
2129 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002130 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07002131 },
Elliott Hughes604ab0f2022-10-17 19:58:22 +00002132 riscv64: {
2133 version_script: ":libstdc++.riscv64.map",
2134 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002135 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07002136 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08002137 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002138 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07002139 },
2140 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002141 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07002142 },
2143 },
2144}
2145
me-cafebabe9dbfa7a2023-10-05 19:38:27 +00002146cc_library {
2147 name: "libstdc++",
2148 defaults: ["libstdc++_defaults"],
2149}
2150
2151cc_library_shared {
2152 name: "libstdc++_vendor",
2153 defaults: ["libstdc++_defaults"],
2154 vendor: true,
2155}
2156
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002157genrule {
2158 name: "libstdc++.arm.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002159 out: ["libstdc++.arm.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002160 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002161 tools: ["generate-version-script"],
2162 cmd: "$(location generate-version-script) arm $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002163}
2164
2165genrule {
2166 name: "libstdc++.arm64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002167 out: ["libstdc++.arm64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002168 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002169 tools: ["generate-version-script"],
2170 cmd: "$(location generate-version-script) arm64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002171}
2172
2173genrule {
Elliott Hughes604ab0f2022-10-17 19:58:22 +00002174 name: "libstdc++.riscv64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002175 out: ["libstdc++.riscv64.map.txt"],
Elliott Hughes604ab0f2022-10-17 19:58:22 +00002176 srcs: ["libstdc++.map.txt"],
2177 tools: ["generate-version-script"],
2178 cmd: "$(location generate-version-script) riscv64 $(in) $(out)",
2179}
2180
2181genrule {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002182 name: "libstdc++.x86.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002183 out: ["libstdc++.x86.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002184 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002185 tools: ["generate-version-script"],
2186 cmd: "$(location generate-version-script) x86 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002187}
2188
2189genrule {
2190 name: "libstdc++.x86_64.map",
Cole Faustf5968d82023-04-11 15:20:19 -07002191 out: ["libstdc++.x86_64.map.txt"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002192 srcs: ["libstdc++.map.txt"],
Elliott Hughes291f98a2022-06-30 23:35:11 +00002193 tools: ["generate-version-script"],
2194 cmd: "$(location generate-version-script) x86_64 $(in) $(out)",
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002195}
2196
2197// ========================================================
2198// crt object files.
2199// ========================================================
2200
Colin Cross50c21ab2015-10-31 23:03:05 -07002201cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002202 name: "crt_and_memtag_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002203 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002204 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002205 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002206 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002207 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002208 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002209 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002210 apex_available: [
2211 "//apex_available:platform",
2212 "//apex_available:anyapex",
2213 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002214 // Generate NDK variants of the CRT objects for every supported API level.
2215 min_sdk_version: "16",
2216 stl: "none",
2217 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002218 cflags: [
2219 "-Wno-gcc-compat",
2220 "-Wall",
2221 "-Werror",
2222 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002223 sanitize: {
2224 never: true,
2225 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002226}
2227
Colin Cross50c21ab2015-10-31 23:03:05 -07002228cc_defaults {
Colin Cross10d92682021-06-22 13:25:46 -07002229 name: "crt_defaults",
2230 defaults: ["crt_and_memtag_defaults"],
Colin Cross02f81372021-07-22 12:02:10 -07002231 system_shared_libs: [],
Colin Cross10d92682021-06-22 13:25:46 -07002232}
2233
2234cc_defaults {
Colin Cross50c21ab2015-10-31 23:03:05 -07002235 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002236 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002237
2238 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002239 x86: {
2240 cflags: ["-fPIC"],
2241 },
2242 x86_64: {
2243 cflags: ["-fPIC"],
2244 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002245 },
Colin Crossab179442018-09-27 11:03:22 -07002246 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002247}
2248
Dan Willemsen208ae172015-09-16 16:33:27 -07002249cc_object {
2250 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002251 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Jingwen Chen7e13cf22021-02-23 00:43:01 -05002252 local_include_dirs: [
2253 "include",
2254 "private", // crtbrand.S depends on private/bionic_asm_note.h
2255 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002256 product_variables: {
2257 platform_sdk_version: {
2258 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2259 },
2260 },
2261 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002262
Colin Cross7d7b3682017-11-03 13:38:40 -07002263 defaults: ["crt_so_defaults"],
Dan Alberteee46dc2023-04-04 23:27:52 +00002264 // crtbrand is an intermediate artifact, not a final CRT object.
2265 exclude_from_ndk_sysroot: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07002266}
2267
Dan Willemsen208ae172015-09-16 16:33:27 -07002268cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002269 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002270 local_include_dirs: ["include"],
2271 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002272
Colin Cross7d7b3682017-11-03 13:38:40 -07002273 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002274 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002275 "crtbrand",
2276 ],
2277}
2278
Dan Willemsen208ae172015-09-16 16:33:27 -07002279cc_object {
2280 name: "crtend_so",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002281 local_include_dirs: [
2282 "include",
2283 "private", // crtend_so.S depends on private/bionic_asm_arm64.h
2284 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002285 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002286
Colin Cross7d7b3682017-11-03 13:38:40 -07002287 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002288}
2289
Dan Willemsen208ae172015-09-16 16:33:27 -07002290cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002291 name: "crtbegin_static",
2292
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002293 local_include_dirs: [
2294 "include",
2295 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2296 ],
Liz Kammere718dd72021-03-09 15:00:06 -05002297
Dan Willemsen208ae172015-09-16 16:33:27 -07002298 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002299 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002300 "crtbrand",
2301 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002302 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002303 // When using libc.a, we're using the latest library regardless of target API level.
2304 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002305}
2306
Dan Willemsen208ae172015-09-16 16:33:27 -07002307cc_object {
Liz Kammere718dd72021-03-09 15:00:06 -05002308 name: "crtbegin_dynamic",
2309
Jingwen Chen0b1611e2021-02-18 23:22:03 -05002310 local_include_dirs: [
2311 "include",
2312 "bionic", // crtbegin.c includes bionic/libc_init_common.h
2313 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002314 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002315 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002316 "crtbrand",
2317 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002318 target: {
2319 linux_bionic: {
2320 generated_sources: ["host_bionic_linker_asm"],
2321 objs: [
2322 "linker_wrapper",
2323 ],
2324 },
2325 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002326 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002327}
2328
Dan Willemsen208ae172015-09-16 16:33:27 -07002329cc_object {
2330 // We rename crtend.o to crtend_android.o to avoid a
2331 // name clash between gcc and bionic.
2332 name: "crtend_android",
Liz Kammeraab2ad72021-03-15 18:03:24 -04002333 local_include_dirs: [
2334 "include",
2335 "private", // crtend.S depends on private/bionic_asm_arm64.h
2336 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07002337 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002338
Colin Cross50c21ab2015-10-31 23:03:05 -07002339 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002340}
Colin Crossbaa48992016-07-13 11:15:21 -07002341
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002342cc_library_static {
2343 name: "note_memtag_heap_async",
2344 arch: {
2345 arm64: {
2346 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2347 }
2348 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002349 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002350
Colin Cross10d92682021-06-22 13:25:46 -07002351 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002352}
2353
2354cc_library_static {
2355 name: "note_memtag_heap_sync",
2356 arch: {
2357 arm64: {
2358 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2359 }
2360 },
Mitch Phillips22c90752021-03-03 15:39:57 -08002361 sdk_version: "minimum",
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002362
Colin Cross10d92682021-06-22 13:25:46 -07002363 defaults: ["crt_and_memtag_defaults"],
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002364}
2365
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002366// ========================================================
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002367// libc dependencies for baremetal Rust projects.
2368// ========================================================
2369
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002370// This library contains the following unresolved symbols:
2371// __errno
2372// abort
2373// async_safe_fatal_va_list
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002374cc_library_static {
2375 name: "librust_baremetal",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002376 header_libs: ["libc_headers"],
2377 include_dirs: [
2378 "bionic/libc/async_safe/include",
2379 "bionic/libc/platform",
2380 ],
2381 cflags: [
2382 "-Wall",
2383 "-Werror",
2384 ],
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002385 srcs: [
2386 "bionic/fortify.cpp",
Pierre-Clément Tosi816176c2022-11-30 14:33:41 +00002387 "bionic/strtol.cpp",
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002388 ],
2389 arch: {
2390 arm64: {
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002391 srcs: [
2392 "arch-arm64/string/__memcpy_chk.S",
2393 ],
2394 },
caowencheng9a39eb32023-03-20 16:24:41 +08002395 riscv64: {
2396 srcs: [
2397 "arch-riscv64/string/__memcpy_chk.S",
2398 ],
2399 },
Pierre-Clément Tosi199a62e2022-12-09 19:00:44 +00002400 },
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002401 whole_static_libs: [
2402 "libarm-optimized-routines-mem",
Pierre-Clément Tosieb46ac92023-02-01 13:44:57 +00002403 "libc_netbsd",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002404 ],
Pierre-Clément Tosi3af57992023-01-03 17:57:42 +00002405 system_shared_libs: [],
2406 nocrt: true,
2407 stl: "none",
Pierre-Clément Tosi74a14582022-12-09 18:49:29 +00002408 visibility: [
2409 "//packages/modules/Virtualization/vmbase",
2410 ],
2411}
2412
2413// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002414// NDK headers.
2415// ========================================================
2416
Dan Albert26e1c412018-05-24 14:56:46 -07002417versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002418 name: "common_libc",
2419 from: "include",
2420 to: "",
2421 license: "NOTICE",
2422}
Dan Albert4238a352016-06-28 11:18:05 -07002423
2424ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002425 name: "libc_uapi",
2426 from: "kernel/uapi",
2427 to: "",
2428 srcs: [
2429 "kernel/uapi/asm-generic/**/*.h",
2430 "kernel/uapi/drm/**/*.h",
2431 "kernel/uapi/linux/**/*.h",
2432 "kernel/uapi/misc/**/*.h",
2433 "kernel/uapi/mtd/**/*.h",
2434 "kernel/uapi/rdma/**/*.h",
2435 "kernel/uapi/scsi/**/*.h",
2436 "kernel/uapi/sound/**/*.h",
2437 "kernel/uapi/video/**/*.h",
2438 "kernel/uapi/xen/**/*.h",
2439 ],
Dan Albert92592652016-10-20 01:42:54 -07002440 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002441}
2442
2443ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002444 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002445 from: "kernel/android/uapi/linux",
2446 to: "linux",
2447 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002448 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002449}
2450
2451ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002452 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002453 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002454 to: "scsi",
2455 srcs: ["kernel/android/scsi/**/*.h"],
2456 license: "NOTICE",
2457}
2458
2459ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002460 name: "libc_asm_arm",
2461 from: "kernel/uapi/asm-arm",
2462 to: "arm-linux-androideabi",
2463 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002464 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002465}
2466
2467ndk_headers {
2468 name: "libc_asm_arm64",
2469 from: "kernel/uapi/asm-arm64",
2470 to: "aarch64-linux-android",
2471 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002472 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002473}
2474
Lazar Trsic790d2f72017-11-27 11:54:11 +01002475ndk_headers {
Colin Crossbd26e0f2022-10-19 15:03:14 -07002476 name: "libc_asm_riscv64",
2477 from: "kernel/uapi/asm-riscv",
2478 to: "riscv64-linux-android",
2479 srcs: ["kernel/uapi/asm-riscv/**/*.h"],
2480 license: "NOTICE",
2481}
2482
2483ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002484 name: "libc_asm_x86",
2485 from: "kernel/uapi/asm-x86",
2486 to: "i686-linux-android",
2487 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002488 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002489}
2490
2491ndk_headers {
2492 name: "libc_asm_x86_64",
2493 from: "kernel/uapi/asm-x86",
2494 to: "x86_64-linux-android",
2495 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002496 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002497}
2498
Dan Albert4238a352016-06-28 11:18:05 -07002499ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002500 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002501 symbol_file: "libc.map.txt",
2502 first_version: "9",
Dan Albert2d8d2a02021-10-20 13:11:46 -07002503 // APIs implemented in asm don't have debug info: http://b/190554910.
2504 allow_untyped_symbols: true,
Spandan Das6feb2cc2022-09-08 23:41:42 +00002505 export_header_libs: [
2506 "common_libc",
2507 "libc_uapi",
2508 "libc_kernel_android_uapi_linux",
2509 "libc_kernel_android_scsi",
2510 "libc_asm_arm",
2511 "libc_asm_arm64",
Colin Crossbd26e0f2022-10-19 15:03:14 -07002512 "libc_asm_riscv64",
Spandan Das6feb2cc2022-09-08 23:41:42 +00002513 "libc_asm_x86",
2514 "libc_asm_x86_64",
2515 ],
Dan Albert4238a352016-06-28 11:18:05 -07002516}
2517
Dan Albertdf31aff2016-10-06 15:50:41 -07002518ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002519 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002520 symbol_file: "libstdc++.map.txt",
2521 first_version: "9",
2522}
2523
Dan Willemsenca056d72018-01-08 14:00:24 -08002524// Export these headers for toolbox to process
2525filegroup {
2526 name: "kernel_input_headers",
2527 srcs: [
2528 "kernel/uapi/linux/input.h",
2529 "kernel/uapi/linux/input-event-codes.h",
2530 ],
2531}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002532
2533// Generate a syscall name / number mapping. These objects are text files
2534// (thanks to the -dD -E flags) and not binary files. They will then be
2535// consumed by the genseccomp.py script and converted into C++ code.
2536cc_defaults {
2537 name: "libseccomp_gen_syscall_nrs_defaults",
2538 recovery_available: true,
2539 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2540 cflags: [
2541 "-dD",
2542 "-E",
2543 "-Wall",
2544 "-Werror",
2545 "-nostdinc",
2546 ],
2547}
2548
2549cc_object {
2550 name: "libseccomp_gen_syscall_nrs_arm",
2551 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2552 local_include_dirs: [
2553 "kernel/uapi/asm-arm",
2554 "kernel/uapi",
2555 ],
2556}
2557
2558cc_object {
2559 name: "libseccomp_gen_syscall_nrs_arm64",
2560 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2561 local_include_dirs: [
2562 "kernel/uapi/asm-arm64",
2563 "kernel/uapi",
2564 ],
2565}
2566
2567cc_object {
Elliott Hughes704772b2022-10-10 17:06:43 +00002568 name: "libseccomp_gen_syscall_nrs_riscv64",
2569 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2570 local_include_dirs: [
2571 "kernel/uapi/asm-riscv",
2572 "kernel/uapi",
2573 ],
2574}
2575
2576cc_object {
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002577 name: "libseccomp_gen_syscall_nrs_x86",
2578 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2579 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2580 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2581 local_include_dirs: [
2582 "kernel/uapi/asm-x86",
2583 "kernel/uapi",
2584 ],
2585}
2586
2587cc_object {
2588 name: "libseccomp_gen_syscall_nrs_x86_64",
2589 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2590 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2591 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2592 local_include_dirs: [
2593 "kernel/uapi/asm-x86",
2594 "kernel/uapi",
2595 ],
2596}
2597
Jingwen Chenca366332021-01-29 05:16:32 -05002598filegroup {
2599 name: "all_kernel_uapi_headers",
2600 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002601}
2602
Martijn Coenen0c6de752019-01-02 12:52:51 +01002603
2604cc_genrule {
2605 name: "func_to_syscall_nrs",
2606 recovery_available: true,
2607 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2608
2609 tools: [ "genfunctosyscallnrs" ],
2610
2611 srcs: [
2612 "SYSCALLS.TXT",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002613 ],
2614
Elliott Hughes704772b2022-10-10 17:06:43 +00002615 arch: {
2616 arm: {
2617 srcs: [
2618 ":libseccomp_gen_syscall_nrs_arm",
2619 ":libseccomp_gen_syscall_nrs_arm64",
2620 ],
2621 },
2622 arm64: {
2623 srcs: [
2624 ":libseccomp_gen_syscall_nrs_arm",
2625 ":libseccomp_gen_syscall_nrs_arm64",
2626 ],
2627 },
2628 riscv64: {
2629 srcs: [":libseccomp_gen_syscall_nrs_riscv64"],
2630 },
2631 x86: {
2632 srcs: [
2633 ":libseccomp_gen_syscall_nrs_x86",
2634 ":libseccomp_gen_syscall_nrs_x86_64",
2635 ],
2636 },
2637 x86_64: {
2638 srcs: [
2639 ":libseccomp_gen_syscall_nrs_x86",
2640 ":libseccomp_gen_syscall_nrs_x86_64",
2641 ],
2642 },
2643 },
2644
Martijn Coenen0c6de752019-01-02 12:52:51 +01002645 out: [
2646 "func_to_syscall_nrs.h",
2647 ],
2648}
2649
Victor Hsiehdbb86702020-06-15 09:29:07 -07002650// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002651genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002652 name: "generate_app_zygote_blocklist",
2653 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2654 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002655 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2656}
2657
Yu Liu938ec9b2022-10-17 16:36:30 -07002658filegroup {
2659 name: "seccomp_syscalls_sources_zygote",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002660 srcs: [
2661 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002662 "SECCOMP_ALLOWLIST_COMMON.TXT",
2663 "SECCOMP_ALLOWLIST_APP.TXT",
2664 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002665 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002666 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002667 ],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002668}
2669
Yu Liu938ec9b2022-10-17 16:36:30 -07002670filegroup {
2671 name: "seccomp_syscalls_sources_app",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002672 srcs: [
2673 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002674 "SECCOMP_ALLOWLIST_COMMON.TXT",
2675 "SECCOMP_ALLOWLIST_APP.TXT",
2676 "SECCOMP_BLOCKLIST_COMMON.TXT",
2677 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002678 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002679 ],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002680}
2681
Yu Liu938ec9b2022-10-17 16:36:30 -07002682filegroup {
2683 name: "seccomp_syscalls_sources_system",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002684 srcs: [
2685 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002686 "SECCOMP_ALLOWLIST_COMMON.TXT",
2687 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2688 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002689 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002690 ],
Yu Liu938ec9b2022-10-17 16:36:30 -07002691}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002692
Yu Liu938ec9b2022-10-17 16:36:30 -07002693cc_genrule {
2694 name: "libseccomp_policy_app_zygote_sources_x86",
2695 recovery_available: true,
2696 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2697 tools: [ "genseccomp" ],
2698 srcs: [
2699 ":seccomp_syscalls_sources_zygote",
2700 ":libseccomp_gen_syscall_nrs_x86",
2701 ":libseccomp_gen_syscall_nrs_x86_64",
2702 ],
2703 out: [
2704 "x86_app_zygote_policy.cpp",
2705 "x86_64_app_zygote_policy.cpp",
2706 ],
2707 enabled: false,
Yu Liu3a579692022-10-18 03:02:32 +00002708 arch: {
Yu Liu938ec9b2022-10-17 16:36:30 -07002709 x86: { enabled: true },
2710 x86_64: { enabled: true },
2711 },
2712}
2713
2714cc_genrule {
2715 name: "libseccomp_policy_app_zygote_sources_arm",
2716 recovery_available: true,
2717 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2718 tools: [ "genseccomp" ],
2719 srcs: [
2720 ":seccomp_syscalls_sources_zygote",
2721 ":libseccomp_gen_syscall_nrs_arm",
2722 ":libseccomp_gen_syscall_nrs_arm64",
2723 ],
2724 out: [
2725 "arm_app_zygote_policy.cpp",
2726 "arm64_app_zygote_policy.cpp",
2727 ],
2728 enabled: false,
2729 arch: {
2730 arm: { enabled: true },
2731 arm64: { enabled: true },
2732 },
2733}
2734
2735cc_genrule {
2736 name: "libseccomp_policy_app_zygote_sources_riscv64",
2737 recovery_available: true,
2738 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2739 tools: [ "genseccomp" ],
2740 srcs: [
2741 ":seccomp_syscalls_sources_zygote",
2742 ":libseccomp_gen_syscall_nrs_riscv64",
2743 ],
2744 out: [
2745 "riscv64_app_zygote_policy.cpp",
2746 ],
2747 enabled: false,
2748 arch: {
2749 riscv64: { enabled: true },
2750 },
2751}
2752
2753cc_genrule {
2754 name: "libseccomp_policy_app_sources_x86",
2755 recovery_available: true,
2756 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2757 tools: [ "genseccomp" ],
2758 srcs: [
2759 ":seccomp_syscalls_sources_app",
2760 ":libseccomp_gen_syscall_nrs_x86",
2761 ":libseccomp_gen_syscall_nrs_x86_64",
2762 ],
2763 out: [
2764 "x86_app_policy.cpp",
2765 "x86_64_app_policy.cpp",
2766 ],
2767 enabled: false,
2768 arch: {
2769 x86: { enabled: true },
2770 x86_64: { enabled: true },
2771 },
2772}
2773
2774cc_genrule {
2775 name: "libseccomp_policy_app_sources_arm",
2776 recovery_available: true,
2777 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2778 tools: [ "genseccomp" ],
2779 srcs: [
2780 ":seccomp_syscalls_sources_app",
2781 ":libseccomp_gen_syscall_nrs_arm",
2782 ":libseccomp_gen_syscall_nrs_arm64",
2783 ],
2784 out: [
2785 "arm_app_policy.cpp",
2786 "arm64_app_policy.cpp",
2787 ],
2788 enabled: false,
2789 arch: {
2790 arm: { enabled: true },
2791 arm64: { enabled: true },
2792 },
2793}
2794
2795cc_genrule {
2796 name: "libseccomp_policy_app_sources_riscv64",
2797 recovery_available: true,
2798 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2799 tools: [ "genseccomp" ],
2800 srcs: [
2801 ":seccomp_syscalls_sources_app",
2802 ":libseccomp_gen_syscall_nrs_riscv64",
2803 ],
2804 out: [
2805 "riscv64_app_policy.cpp",
2806 ],
2807 enabled: false,
2808 arch: {
2809 riscv64: { enabled: true },
2810 },
2811}
2812
2813cc_genrule {
2814 name: "libseccomp_policy_system_sources_x86",
2815 recovery_available: true,
2816 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2817 tools: [ "genseccomp" ],
2818 srcs: [
2819 ":seccomp_syscalls_sources_system",
2820 ":libseccomp_gen_syscall_nrs_x86",
2821 ":libseccomp_gen_syscall_nrs_x86_64",
2822 ],
2823 out: [
2824 "x86_system_policy.cpp",
2825 "x86_64_system_policy.cpp",
2826 ],
2827 enabled: false,
2828 arch: {
2829 x86: { enabled: true },
2830 x86_64: { enabled: true },
2831 },
2832}
2833
2834cc_genrule {
2835 name: "libseccomp_policy_system_sources_arm",
2836 recovery_available: true,
2837 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2838 tools: [ "genseccomp" ],
2839 srcs: [
2840 ":seccomp_syscalls_sources_system",
2841 ":libseccomp_gen_syscall_nrs_arm",
2842 ":libseccomp_gen_syscall_nrs_arm64",
2843 ],
2844 out: [
2845 "arm_system_policy.cpp",
2846 "arm64_system_policy.cpp",
2847 ],
2848 enabled: false,
2849 arch: {
2850 arm: { enabled: true },
2851 arm64: { enabled: true },
2852 },
2853}
2854
2855cc_genrule {
2856 name: "libseccomp_policy_system_sources_riscv64",
2857 recovery_available: true,
2858 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2859 tools: [ "genseccomp" ],
2860 srcs: [
2861 ":seccomp_syscalls_sources_system",
2862 ":libseccomp_gen_syscall_nrs_riscv64",
2863 ],
2864 out: [
2865 "riscv64_system_policy.cpp",
2866 ],
2867 enabled: false,
2868 arch: {
2869 riscv64: { enabled: true },
Yu Liu3a579692022-10-18 03:02:32 +00002870 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002871}
2872
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002873cc_library {
2874 name: "libseccomp_policy",
2875 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002876 generated_headers: ["func_to_syscall_nrs"],
Yu Liu938ec9b2022-10-17 16:36:30 -07002877
2878 arch: {
2879 arm: {
2880 generated_sources: [
2881 "libseccomp_policy_app_sources_arm",
2882 "libseccomp_policy_app_zygote_sources_arm",
2883 "libseccomp_policy_system_sources_arm",
2884 ],
2885 },
2886 arm64: {
2887 generated_sources: [
2888 "libseccomp_policy_app_sources_arm",
2889 "libseccomp_policy_app_zygote_sources_arm",
2890 "libseccomp_policy_system_sources_arm",
2891 ],
2892 },
2893 riscv64: {
2894 generated_sources: [
2895 "libseccomp_policy_app_sources_riscv64",
2896 "libseccomp_policy_app_zygote_sources_riscv64",
2897 "libseccomp_policy_system_sources_riscv64",
2898 ],
2899 },
2900 x86: {
2901 generated_sources: [
2902 "libseccomp_policy_app_sources_x86",
2903 "libseccomp_policy_app_zygote_sources_x86",
2904 "libseccomp_policy_system_sources_x86",
2905 ],
2906 },
2907 x86_64: {
2908 generated_sources: [
2909 "libseccomp_policy_app_sources_x86",
2910 "libseccomp_policy_app_zygote_sources_x86",
2911 "libseccomp_policy_system_sources_x86",
2912 ],
2913 },
2914 },
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002915
2916 srcs: [
2917 "seccomp/seccomp_policy.cpp",
2918 ],
2919
2920 export_include_dirs: ["seccomp/include"],
2921 cflags: [
2922 "-Wall",
2923 "-Werror",
2924 ],
2925 shared: {
2926 shared_libs: ["libbase"],
2927 },
2928 static: {
2929 static_libs: ["libbase"],
2930 },
2931}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002932
Colin Cross048f24e2021-09-01 17:26:00 -07002933cc_library_host_static {
2934 name: "libfts",
Chih-Hung Hsiehe343db32023-01-03 14:54:34 -08002935 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Colin Cross048f24e2021-09-01 17:26:00 -07002936 srcs: [
2937 "bionic/fts.c",
2938 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
2939 ],
2940 export_include_dirs: ["fts/include"],
2941 local_include_dirs: [
2942 "private",
2943 "upstream-openbsd/android/include",
2944 ],
2945 cflags: [
2946 "-include openbsd-compat.h",
2947 "-Wno-unused-parameter",
2948 ],
2949 enabled: false,
2950 target: {
2951 musl: {
2952 enabled: true,
2953 },
2954 },
Colin Cross2a9843f2022-01-13 12:26:30 -08002955 stl: "none",
2956}
2957
2958cc_library_host_static {
2959 name: "libexecinfo",
2960 visibility: ["//external/musl"],
2961 srcs: ["bionic/execinfo.cpp"],
2962 export_include_dirs: ["execinfo/include"],
2963 local_include_dirs: ["private"],
2964 enabled: false,
2965 target: {
2966 musl: {
2967 enabled: true,
2968 system_shared_libs: [],
2969 header_libs: ["libc_musl_headers"],
2970 },
2971 },
2972 stl: "none",
Colin Cross048f24e2021-09-01 17:26:00 -07002973}
2974
Colin Cross9da85fa2022-01-24 18:20:05 -08002975cc_library_host_static {
2976 name: "libb64",
2977 visibility: ["//external/musl"],
Chih-Hung Hsiehe343db32023-01-03 14:54:34 -08002978 tidy_disabled_srcs: ["upstream-*/**/*.c"],
Colin Cross9da85fa2022-01-24 18:20:05 -08002979 srcs: ["upstream-openbsd/lib/libc/net/base64.c"],
2980 export_include_dirs: ["b64/include"],
2981 local_include_dirs: [
2982 "private",
2983 "upstream-openbsd/android/include",
2984 ],
2985 cflags: [
2986 "-include openbsd-compat.h",
2987 ],
2988 enabled: false,
2989 target: {
2990 musl: {
2991 enabled: true,
2992 system_shared_libs: [],
2993 header_libs: ["libc_musl_headers"],
2994 },
2995 },
2996 stl: "none",
2997}
2998
Colin Cross9d4a56e2022-02-03 10:20:32 -08002999// Export kernel uapi headers to be used in the musl sysroot.
3000// Also include the execinfo headers for the libexecinfo and the
3001// b64 headers for libb64 embedded in musl libc.
3002cc_genrule {
3003 name: "libc_musl_sysroot_bionic_headers",
3004 visibility: ["//external/musl"],
3005 host_supported: true,
3006 device_supported: false,
3007 enabled: false,
3008 target: {
3009 musl: {
3010 enabled: true,
3011 },
3012 },
3013 srcs: [
3014 "kernel/uapi/**/*.h",
3015 "kernel/android/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08003016 "execinfo/include/**/*.h",
Colin Cross9d4a56e2022-02-03 10:20:32 -08003017 "b64/include/**/*.h",
Colin Crossaeef9f02022-02-07 21:01:26 -08003018
Colin Crossaeef9f02022-02-07 21:01:26 -08003019 "NOTICE",
Colin Cross9d4a56e2022-02-03 10:20:32 -08003020
3021 ":libc_musl_sysroot_bionic_arch_headers",
3022 ],
3023 out: ["libc_musl_sysroot_bionic_headers.zip"],
3024 tools: [
3025 "soong_zip",
3026 "merge_zips",
3027 "zip2zip",
3028 ],
Colin Crossaeef9f02022-02-07 21:01:26 -08003029 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " +
3030 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" +
Colin Crossad33d022022-02-25 18:27:04 -08003031 // NOTICE
3032 " -j -f $(location NOTICE) " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08003033 // headers
3034 " -P include " +
Colin Crossaeef9f02022-02-07 21:01:26 -08003035 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " +
3036 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " +
3037 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
3038 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " +
3039 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
3040 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " +
3041 " -C $${BIONIC_LIBC_DIR}/execinfo/include " +
3042 " -D $${BIONIC_LIBC_DIR}/execinfo/include " +
3043 " -C $${BIONIC_LIBC_DIR}/b64/include " +
3044 " -D $${BIONIC_LIBC_DIR}/b64/include " +
Colin Cross9d4a56e2022-02-03 10:20:32 -08003045 " && " +
Colin Crossad33d022022-02-25 18:27:04 -08003046 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " +
Colin Cross1c0a7a02022-08-11 12:22:26 -07003047 " -x **/BUILD " +
Colin Crossad33d022022-02-25 18:27:04 -08003048 " include/**/*:include/ " +
3049 " NOTICE:NOTICE.bionic " +
3050 " && " +
3051 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip",
Colin Cross9d4a56e2022-02-03 10:20:32 -08003052}
3053
3054// The architecture-specific bits have to be handled separately because the label varies based
3055// on architecture, which prevents using $(locations) to find them and requires using $(in)
3056// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot
3057// genrule.
3058cc_genrule {
3059 name: "libc_musl_sysroot_bionic_arch_headers",
3060 visibility: ["//visibility:private"],
3061 host_supported: true,
3062 device_supported: false,
3063 enabled: false,
3064 target: {
3065 musl: {
3066 enabled: true,
3067 },
3068 },
3069 arch: {
3070 arm: {
3071 srcs: ["kernel/uapi/asm-arm/**/*.h"],
3072 },
3073 arm64: {
3074 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
3075 },
3076 x86: {
3077 srcs: ["kernel/uapi/asm-x86/**/*.h"],
3078 },
3079 x86_64: {
3080 srcs: ["kernel/uapi/asm-x86/**/*.h"],
3081 },
3082 },
3083 out: ["libc_musl_sysroot_bionic_arch_headers.zip"],
3084 tools: ["soong_zip"],
3085 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})",
3086}
Colin Cross290c4952022-10-13 12:51:13 -07003087
3088cc_genrule {
3089 name: "bionic_sysroot_crt_objects",
3090 visibility: ["//visibility:private"],
3091 out: ["bionic_sysroot_crt_objects.zip"],
3092 tools: ["soong_zip"],
3093 srcs: [
3094 ":crtbegin_dynamic",
3095 ":crtbegin_so",
3096 ":crtbegin_static",
3097 ":crtend_android",
3098 ":crtend_so",
3099 ],
3100 cmd: "$(location soong_zip) -o $(out) -j " +
3101 "-f $(location :crtbegin_dynamic) " +
3102 "-f $(location :crtbegin_so) " +
3103 "-f $(location :crtbegin_static) " +
3104 "-f $(location :crtend_android) " +
3105 "-f $(location :crtend_so)",
3106 dist: {
3107 targets: ["bionic_sysroot_crt_objects"],
3108 },
3109 arch: {
3110 arm: {
3111 dist: {
3112 suffix: "_arm",
3113 },
3114 },
3115 arm64: {
3116 dist: {
3117 suffix: "_arm64",
3118 },
3119 },
3120 riscv64: {
3121 dist: {
3122 suffix: "_riscv64",
3123 },
3124 },
3125 x86: {
3126 dist: {
3127 suffix: "_x86",
3128 },
3129 },
3130 x86_64: {
3131 dist: {
3132 suffix: "_x86_64",
3133 },
3134 },
3135 },
3136}