blob: 2db2edfd80a87cbe6a6dd0bbe47ce050013c3837 [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001// Define the common source files for all the libc instances
2// =========================================================
3libc_common_src_files = [
Christopher Ferris7a3681e2017-04-24 17:48:32 -07004 "async_safe/async_safe_log.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07005 "bionic/ether_aton.c",
6 "bionic/ether_ntoa.c",
Victor Khimenko8e0707d2020-06-09 21:57:05 +02007 "bionic/exit.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070011 "bionic/sched_cpualloc.c",
12 "bionic/sched_cpucount.c",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070013 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070014 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070015 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080016 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070017 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080018 "stdio/vfscanf.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070019 "stdio/vfwscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070020]
21
Peter Collingbourne570de332019-12-11 10:00:58 -080022// off64_t/time64_t support on LP32.
Dan Willemsen208ae172015-09-16 16:33:27 -070023// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -070024libc_common_src_files_32 = [
25 "bionic/legacy_32_bit_support.cpp",
26 "bionic/time64.c",
27]
28
Elliott Hughes53cf3482016-08-09 13:06:41 -070029libc_common_flags = [
30 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080031 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070032 "-Wall",
33 "-Wextra",
34 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080035 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070036 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070037 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070038 "-Wframe-larger-than=2048",
Elliott Hughes53cf3482016-08-09 13:06:41 -070039
40 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
41 "-Werror=pointer-to-int-cast",
42 "-Werror=int-to-pointer-cast",
43 "-Werror=type-limits",
44 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080045
46 // Clang's exit-time destructor registration hides __dso_handle, but
47 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
48 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080049
50 // GWP-ASan requires platform TLS.
51 "-fno-emulated-tls",
Elliott Hughes53cf3482016-08-09 13:06:41 -070052]
53
Dan Willemsen208ae172015-09-16 16:33:27 -070054// Define some common cflags
55// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070056cc_defaults {
57 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080058 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070059 cflags: libc_common_flags,
60 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070061 conlyflags: ["-std=gnu99"],
62 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070063 include_dirs: [
64 "bionic/libc/async_safe/include",
Peter Collingbourne5d3aa862020-09-11 15:05:17 -070065 "bionic/libc/platform",
Tom Cherry379ed1e2020-09-17 09:36:25 -070066 // For android_filesystem_config.h.
67 "system/core/libcutils/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070068 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070069
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010070 header_libs: [
71 "libc_headers",
72 "gwp_asan_headers",
73 ],
74 export_header_lib_headers: [
75 "libc_headers",
76 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -080077
Colin Cross50c21ab2015-10-31 23:03:05 -070078 stl: "none",
79 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070080 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070081 address: false,
82 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070083 // TODO(b/132640749): Fix broken fuzzer support.
84 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070085 },
Yifan Hong5a39cee2020-01-21 16:43:56 -080086 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -070087 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090088 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020089 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080090
Yi Konge3d90de2019-02-20 14:28:56 -080091 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
92 // warning since this is intended right now.
93 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070094
95 product_variables: {
Evgenii Stepanov5a73e032020-04-29 14:59:44 -070096 malloc_zero_contents: {
97 cflags: ["-DSCUDO_ZERO_CONTENTS"],
98 },
99 malloc_pattern_fill_contents: {
100 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
101 },
Steven Morelandfb65ee42020-07-31 00:18:38 +0000102 malloc_not_svelte: {
103 cflags: ["-DUSE_SCUDO"],
104 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700105 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700106}
107
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800108libc_scudo_product_variables = {
109 malloc_not_svelte: {
110 cflags: ["-DUSE_SCUDO"],
111 whole_static_libs: ["libscudo"],
112 exclude_static_libs: [
113 "libjemalloc5",
114 "libc_jemalloc_wrapper",
115 ],
116 },
117}
118
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700119// Defaults for native allocator libs/includes to make it
120// easier to change.
Christopher Ferris062eba22020-01-31 22:40:45 -0800121// To disable scudo for the non-svelte config remove the line:
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800122// product_variables: libc_scudo_product_variables,
Christopher Ferris062eba22020-01-31 22:40:45 -0800123// in the cc_defaults below.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700124// ========================================================
125cc_defaults {
126 name: "libc_native_allocator_defaults",
127
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700128 whole_static_libs: [
129 "libjemalloc5",
130 "libc_jemalloc_wrapper",
131 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800132 header_libs: ["gwp_asan_headers"],
Christopher Ferris062eba22020-01-31 22:40:45 -0800133 product_variables: libc_scudo_product_variables,
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700134}
135
136// Functions not implemented by jemalloc directly, or that need to
137// be modified for Android.
138cc_library_static {
139 name: "libc_jemalloc_wrapper",
140 defaults: ["libc_defaults"],
141 srcs: ["bionic/jemalloc_wrapper.cpp"],
142 cflags: ["-fvisibility=hidden"],
143
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800144 // Used to pull in the jemalloc include directory so that if the
145 // library is removed, the include directory is also removed.
146 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700147}
148
Dan Willemsen208ae172015-09-16 16:33:27 -0700149// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700150// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700151// ========================================================
152//
Ryan Prichard249757b2019-11-01 17:18:28 -0700153// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
154// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
155// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
156// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700157
158cc_library_static {
159
Colin Crossa3f9fca2016-01-11 13:20:55 -0800160 srcs: [
161 "bionic/__libc_init_main_thread.cpp",
162 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700163 "bionic/bionic_call_ifunc_resolver.cpp",
164 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800165 ],
166 arch: {
167 arm64: {
168 srcs: ["arch-arm64/bionic/__set_tls.c"],
169 },
170 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700171 srcs: [
172 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Pirama Arumuga Nainar7b89be72021-02-12 15:09:49 -0800173 "arch-x86/bionic/__libc_int0x80.S",
Ryan Prichard27475b52018-05-17 17:14:18 -0700174 "arch-x86/bionic/__set_tls.cpp",
175 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800176 },
177 x86_64: {
178 srcs: ["arch-x86_64/bionic/__set_tls.c"],
179 },
180 },
181
Colin Cross50c21ab2015-10-31 23:03:05 -0700182 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700183 cflags: ["-fno-stack-protector", "-ffreestanding"],
184 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700185}
186
Ryan Prichard249757b2019-11-01 17:18:28 -0700187// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
188// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
189// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800190
191cc_library_static {
192 name: "libc_init_static",
193 defaults: ["libc_defaults"],
194 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700195 cflags: [
196 "-fno-stack-protector",
197
198 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
199 // from the linker before ifunc resolvers have made string.h functions available.
200 "-ffreestanding",
201 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800202}
203
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700204cc_library_static {
205 name: "libc_init_dynamic",
206 defaults: ["libc_defaults"],
207 srcs: ["bionic/libc_init_dynamic.cpp"],
208 cflags: ["-fno-stack-protector"],
209}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800210
Dan Willemsen208ae172015-09-16 16:33:27 -0700211// ========================================================
212// libc_tzcode.a - upstream 'tzcode' code
213// ========================================================
214
215cc_library_static {
216
Colin Cross50c21ab2015-10-31 23:03:05 -0700217 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700218 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800219 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700220 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700221 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
222 ],
223
Colin Cross50c21ab2015-10-31 23:03:05 -0700224 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700225 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700226 // Don't use ridiculous amounts of stack.
227 "-DALL_STATE",
228 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
229 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800230 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700231 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700232 // The name of the tm_gmtoff field in our struct tm.
233 "-DTM_GMTOFF=tm_gmtoff",
234 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700235 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700236 // Include `tzname`, `timezone`, and `daylight` globals.
237 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700238 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800239 // Use the empty string (instead of " ") as the timezone abbreviation
240 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700241 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700242 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
243 "-Dlint",
244 ],
245
Dan Willemsen208ae172015-09-16 16:33:27 -0700246 local_include_dirs: ["tzcode/"],
247 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700248}
249
250// ========================================================
251// libc_dns.a - modified NetBSD DNS code
252// ========================================================
253
254cc_library_static {
255
Colin Cross50c21ab2015-10-31 23:03:05 -0700256 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700257 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800258 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700259
260 "upstream-netbsd/lib/libc/isc/ev_streams.c",
261 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700262 ],
263
Colin Cross50c21ab2015-10-31 23:03:05 -0700264 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700265 "-DANDROID_CHANGES",
266 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700267 "-Wno-unused-parameter",
268 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700269 "-Wframe-larger-than=66000",
Elliott Hughese1dc4f62021-01-11 11:51:29 -0800270 "-include private/bsd_sys_param.h",
Dan Willemsen208ae172015-09-16 16:33:27 -0700271 ],
272
Dan Willemsen208ae172015-09-16 16:33:27 -0700273 local_include_dirs: [
274 "dns/include",
275 "private",
276 "upstream-netbsd/lib/libc/include",
277 "upstream-netbsd/android/include",
278 ],
279
280 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700281}
282
283// ========================================================
284// libc_freebsd.a - upstream FreeBSD C library code
285// ========================================================
286//
287// These files are built with the freebsd-compat.h header file
288// automatically included.
289
290cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700291 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700292 srcs: [
293 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700294 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700295 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
296 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
297 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
298 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700299 "upstream-freebsd/lib/libc/stdlib/qsort.c",
300 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700301 "upstream-freebsd/lib/libc/string/wcpcpy.c",
302 "upstream-freebsd/lib/libc/string/wcpncpy.c",
303 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700304 "upstream-freebsd/lib/libc/string/wcscat.c",
305 "upstream-freebsd/lib/libc/string/wcschr.c",
306 "upstream-freebsd/lib/libc/string/wcscmp.c",
307 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700308 "upstream-freebsd/lib/libc/string/wcscspn.c",
309 "upstream-freebsd/lib/libc/string/wcsdup.c",
310 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700311 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700312 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
313 "upstream-freebsd/lib/libc/string/wcsncat.c",
314 "upstream-freebsd/lib/libc/string/wcsncmp.c",
315 "upstream-freebsd/lib/libc/string/wcsncpy.c",
316 "upstream-freebsd/lib/libc/string/wcsnlen.c",
317 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700318 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700319 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700320 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700321 "upstream-freebsd/lib/libc/string/wcstok.c",
322 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700323 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700324 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700325 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800326 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700327 ],
328 arch: {
329 arm64: {
330 exclude_srcs: [
331 "upstream-freebsd/lib/libc/string/wmemmove.c",
332 ],
333 },
334 x86: {
335 exclude_srcs: [
336 "upstream-freebsd/lib/libc/string/wcschr.c",
337 "upstream-freebsd/lib/libc/string/wcscmp.c",
338 "upstream-freebsd/lib/libc/string/wcslen.c",
339 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700340 "upstream-freebsd/lib/libc/string/wmemcmp.c",
341 "upstream-freebsd/lib/libc/string/wcscat.c",
342 "upstream-freebsd/lib/libc/string/wcscpy.c",
343 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530344 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700345 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700346 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700347 },
348
Colin Cross50c21ab2015-10-31 23:03:05 -0700349 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700350 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700351 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700352 "-include freebsd-compat.h",
353 ],
354
Dan Willemsen208ae172015-09-16 16:33:27 -0700355 local_include_dirs: [
356 "upstream-freebsd/android/include",
357 ],
358
359 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700360}
361
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700362cc_library_static {
363 defaults: ["libc_defaults"],
364 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700365 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700366 ],
367
368 cflags: [
369 "-Wno-sign-compare",
370 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700371 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700372 ],
373
374 local_include_dirs: [
375 "upstream-freebsd/android/include",
376 ],
377
378 name: "libc_freebsd_large_stack",
379}
380
Dan Willemsen208ae172015-09-16 16:33:27 -0700381// ========================================================
382// libc_netbsd.a - upstream NetBSD C library code
383// ========================================================
384//
385// These files are built with the netbsd-compat.h header file
386// automatically included.
387
388cc_library_static {
389
Colin Cross50c21ab2015-10-31 23:03:05 -0700390 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700391 srcs: [
392 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700393 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700394 "upstream-netbsd/lib/libc/gen/psignal.c",
395 "upstream-netbsd/lib/libc/gen/utime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700396 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
397 "upstream-netbsd/lib/libc/regex/regcomp.c",
398 "upstream-netbsd/lib/libc/regex/regerror.c",
399 "upstream-netbsd/lib/libc/regex/regexec.c",
400 "upstream-netbsd/lib/libc/regex/regfree.c",
401 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700402 "upstream-netbsd/lib/libc/stdlib/drand48.c",
403 "upstream-netbsd/lib/libc/stdlib/erand48.c",
404 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
405 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700406 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
407 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
408 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
409 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
410 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
411 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
412 "upstream-netbsd/lib/libc/stdlib/seed48.c",
413 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700414 ],
415 multilib: {
416 lib32: {
417 // LP32 cruft
418 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
419 },
420 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700421 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700422 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800423 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700424 "-DPOSIX_MISTAKE",
425 "-include netbsd-compat.h",
426 ],
427
Dan Willemsen208ae172015-09-16 16:33:27 -0700428 local_include_dirs: [
429 "upstream-netbsd/android/include",
430 "upstream-netbsd/lib/libc/include",
431 ],
432
433 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700434}
435
436// ========================================================
437// libc_openbsd_ndk.a - upstream OpenBSD C library code
438// that can be safely included in the libc_ndk.a (doesn't
439// contain any troublesome global data or constructors).
440// ========================================================
441//
442// These files are built with the openbsd-compat.h header file
443// automatically included.
444
445cc_library_static {
446 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700447 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700448 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700449 "upstream-openbsd/lib/libc/gen/alarm.c",
450 "upstream-openbsd/lib/libc/gen/ctype_.c",
451 "upstream-openbsd/lib/libc/gen/daemon.c",
452 "upstream-openbsd/lib/libc/gen/err.c",
453 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700454 "upstream-openbsd/lib/libc/gen/fnmatch.c",
455 "upstream-openbsd/lib/libc/gen/ftok.c",
456 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700457 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700458 "upstream-openbsd/lib/libc/gen/verr.c",
459 "upstream-openbsd/lib/libc/gen/verrx.c",
460 "upstream-openbsd/lib/libc/gen/vwarn.c",
461 "upstream-openbsd/lib/libc/gen/vwarnx.c",
462 "upstream-openbsd/lib/libc/gen/warn.c",
463 "upstream-openbsd/lib/libc/gen/warnx.c",
464 "upstream-openbsd/lib/libc/locale/btowc.c",
465 "upstream-openbsd/lib/libc/locale/mbrlen.c",
466 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
467 "upstream-openbsd/lib/libc/locale/mbtowc.c",
468 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700469 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
470 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700471 "upstream-openbsd/lib/libc/locale/wcstoll.c",
472 "upstream-openbsd/lib/libc/locale/wcstombs.c",
473 "upstream-openbsd/lib/libc/locale/wcstoul.c",
474 "upstream-openbsd/lib/libc/locale/wcstoull.c",
475 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
476 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
477 "upstream-openbsd/lib/libc/locale/wctob.c",
478 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700479 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700480 "upstream-openbsd/lib/libc/net/htonl.c",
481 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700482 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
483 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
484 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700485 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
486 "upstream-openbsd/lib/libc/net/inet_ntop.c",
487 "upstream-openbsd/lib/libc/net/inet_pton.c",
488 "upstream-openbsd/lib/libc/net/ntohl.c",
489 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800490 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700491 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700492 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
493 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700494 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700495 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700496 "upstream-openbsd/lib/libc/stdio/fputwc.c",
497 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700498 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700500 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700501 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700502 "upstream-openbsd/lib/libc/stdio/makebuf.c",
503 "upstream-openbsd/lib/libc/stdio/mktemp.c",
504 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
505 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700506 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700507 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700508 "upstream-openbsd/lib/libc/stdio/ungetc.c",
509 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
510 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
511 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700512 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
513 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
514 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700515 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700516 "upstream-openbsd/lib/libc/stdio/wsetup.c",
517 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800518 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700519 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700520 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700521 "upstream-openbsd/lib/libc/stdlib/insque.c",
522 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
523 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
524 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800525 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700526 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800527 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700528 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughes26b06072020-07-31 11:00:10 -0700529 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700530 "upstream-openbsd/lib/libc/stdlib/remque.c",
531 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700532 "upstream-openbsd/lib/libc/stdlib/tfind.c",
533 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800534 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700535 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800536 "upstream-openbsd/lib/libc/string/strcasestr.c",
537 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700538 "upstream-openbsd/lib/libc/string/strcspn.c",
539 "upstream-openbsd/lib/libc/string/strdup.c",
540 "upstream-openbsd/lib/libc/string/strndup.c",
541 "upstream-openbsd/lib/libc/string/strpbrk.c",
542 "upstream-openbsd/lib/libc/string/strsep.c",
543 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700544 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800545 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700546 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700547 "upstream-openbsd/lib/libc/string/wcswidth.c",
548 ],
549
Colin Cross50c21ab2015-10-31 23:03:05 -0700550 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700551 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700552 "-Wno-unused-parameter",
553 "-include openbsd-compat.h",
554 ],
555
Dan Willemsen208ae172015-09-16 16:33:27 -0700556 local_include_dirs: [
557 "private",
558 "stdio",
559 "upstream-openbsd/android/include",
560 "upstream-openbsd/lib/libc/include",
561 "upstream-openbsd/lib/libc/gdtoa/",
562 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700563}
564
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700565cc_library_static {
566 name: "libc_openbsd_large_stack",
567 defaults: ["libc_defaults"],
568 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700569 "stdio/vfprintf.cpp",
570 "stdio/vfwprintf.cpp",
Elliott Hughes5633caa2020-08-06 14:32:43 -0700571 "upstream-openbsd/lib/libc/string/memmem.c",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800572 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700573 ],
574 cflags: [
575 "-include openbsd-compat.h",
576 "-Wno-sign-compare",
577 "-Wframe-larger-than=5000",
578 ],
579
580 local_include_dirs: [
Elliott Hughese1dc4f62021-01-11 11:51:29 -0800581 "private",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700582 "upstream-openbsd/android/include/",
583 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700584 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700585 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700586 ],
587}
588
Dan Willemsen208ae172015-09-16 16:33:27 -0700589// ========================================================
590// libc_openbsd.a - upstream OpenBSD C library code
591// ========================================================
592//
593// These files are built with the openbsd-compat.h header file
594// automatically included.
595cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700596 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700597 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800598 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700599 "upstream-openbsd/lib/libc/crypt/arc4random.c",
600 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
601
602 // May be overriden by per-arch optimized versions
603 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700604 "upstream-openbsd/lib/libc/string/memrchr.c",
605 "upstream-openbsd/lib/libc/string/stpcpy.c",
606 "upstream-openbsd/lib/libc/string/stpncpy.c",
607 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700608 "upstream-openbsd/lib/libc/string/strcpy.c",
609 "upstream-openbsd/lib/libc/string/strlcat.c",
610 "upstream-openbsd/lib/libc/string/strlcpy.c",
611 "upstream-openbsd/lib/libc/string/strncat.c",
612 "upstream-openbsd/lib/libc/string/strncmp.c",
613 "upstream-openbsd/lib/libc/string/strncpy.c",
614 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700615
616 arch: {
617 arm: {
618 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700619 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800620 "upstream-openbsd/lib/libc/string/stpcpy.c",
621 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700622 ],
623 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700624 arm64: {
625 exclude_srcs: [
626 "upstream-openbsd/lib/libc/string/memchr.c",
Peter Collingbourne2361d4e2020-06-03 16:55:37 -0700627 "upstream-openbsd/lib/libc/string/memrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700628 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700629 "upstream-openbsd/lib/libc/string/strcpy.c",
630 "upstream-openbsd/lib/libc/string/strncmp.c",
631 ],
632 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700633 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800634 exclude_srcs: [
635 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800636 "upstream-openbsd/lib/libc/string/memrchr.c",
637 "upstream-openbsd/lib/libc/string/stpcpy.c",
638 "upstream-openbsd/lib/libc/string/stpncpy.c",
639 "upstream-openbsd/lib/libc/string/strcat.c",
640 "upstream-openbsd/lib/libc/string/strcpy.c",
641 "upstream-openbsd/lib/libc/string/strncmp.c",
642 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700643 "upstream-openbsd/lib/libc/string/strlcat.c",
644 "upstream-openbsd/lib/libc/string/strlcpy.c",
645 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800646 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700647 },
648
649 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800650 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800651 "upstream-openbsd/lib/libc/string/stpcpy.c",
652 "upstream-openbsd/lib/libc/string/stpncpy.c",
653 "upstream-openbsd/lib/libc/string/strcat.c",
654 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800655 "upstream-openbsd/lib/libc/string/strncat.c",
656 "upstream-openbsd/lib/libc/string/strncmp.c",
657 "upstream-openbsd/lib/libc/string/strncpy.c",
658 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700659 },
660 },
661
Colin Cross50c21ab2015-10-31 23:03:05 -0700662 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700663 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700664 "-Wno-unused-parameter",
665 "-include openbsd-compat.h",
666 ],
667
Dan Willemsen208ae172015-09-16 16:33:27 -0700668 local_include_dirs: [
669 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700670 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700671 ],
672
673 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700674}
675
676// ========================================================
677// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
678// ========================================================
679//
680// These files are built with the openbsd-compat.h header file
681// automatically included.
682
683cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700684 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700685 srcs: [
686 "upstream-openbsd/android/gdtoa_support.cpp",
687 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
688 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
689 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
690 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
691 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
692 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
693 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
694 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
695 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
696 "upstream-openbsd/lib/libc/gdtoa/misc.c",
697 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
698 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
699 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
700 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
701 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
702 "upstream-openbsd/lib/libc/gdtoa/sum.c",
703 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
704 ],
705 multilib: {
706 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800707 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700708 },
709 },
710
Colin Cross50c21ab2015-10-31 23:03:05 -0700711 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700712 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700713 "-include openbsd-compat.h",
714 ],
715
Dan Willemsen208ae172015-09-16 16:33:27 -0700716 local_include_dirs: [
717 "private",
718 "upstream-openbsd/android/include",
719 "upstream-openbsd/lib/libc/include",
720 ],
721
722 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700723}
724
725// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700726// libc_fortify.a - container for our FORITFY
727// implementation details
728// ========================================================
729cc_library_static {
730 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700731 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700732
733 name: "libc_fortify",
734
735 // Disable FORTIFY for the compilation of these, so we don't end up having
736 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800737 cflags: [
738 "-U_FORTIFY_SOURCE",
739 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
740 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700741
742 arch: {
743 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800744 cflags: [
745 "-DNO___MEMCPY_CHK",
746 "-DRENAME___STRCAT_CHK",
747 "-DRENAME___STRCPY_CHK",
748 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700749 srcs: [
750 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800751
752 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
753 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
754
755 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
756 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
757
758 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
759 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
760
761 "arch-arm/krait/bionic/__strcat_chk.S",
762 "arch-arm/krait/bionic/__strcpy_chk.S",
763
764 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
765 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
766
Haibo Huang01bfd892018-12-03 15:05:16 -0800767 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
768 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700769 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700770 },
771 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700772 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700773 srcs: [
774 "arch-arm64/generic/bionic/__memcpy_chk.S",
775 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700776 },
777 },
778}
779
780// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700781// libc_bionic.a - home-grown C library code
782// ========================================================
783
784cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700785 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700786 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800787 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700788 "bionic/sysconf.cpp",
789 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700790 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700791
Josh Gao10ec9282017-04-03 15:13:29 -0700792 // The following must not be statically linked into libc_ndk.a, because
793 // debuggerd will look for the abort message in libc.so's copy.
794 "bionic/android_set_abort_message.cpp",
795
Dan Willemsen208ae172015-09-16 16:33:27 -0700796 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800797 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700798 "bionic/strnlen.c",
799 "bionic/strrchr.cpp",
800 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700801
802 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700803 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700804 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700805 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800806 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700807 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800808 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800809 "arch-arm/generic/bionic/stpcpy.c",
810 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800811 "arch-arm/generic/bionic/strcmp.S",
812 "arch-arm/generic/bionic/strcpy.S",
813 "arch-arm/generic/bionic/strlen.c",
814
Ryan Prichard45024fe2018-12-30 21:10:26 -0800815 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700816 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700817 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700818 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700819 "arch-arm/bionic/atomics_arm.c",
820 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800821 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700822 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700823 "arch-arm/bionic/setjmp.S",
824 "arch-arm/bionic/syscall.S",
825 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800826
827 "arch-arm/cortex-a15/bionic/memcpy.S",
828 "arch-arm/cortex-a15/bionic/memmove.S",
829 "arch-arm/cortex-a15/bionic/memset.S",
830 "arch-arm/cortex-a15/bionic/stpcpy.S",
831 "arch-arm/cortex-a15/bionic/strcat.S",
832 "arch-arm/cortex-a15/bionic/strcmp.S",
833 "arch-arm/cortex-a15/bionic/strcpy.S",
834 "arch-arm/cortex-a15/bionic/strlen.S",
835
836 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800837 "arch-arm/cortex-a7/bionic/memset.S",
838
839 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800840 "arch-arm/cortex-a9/bionic/memset.S",
841 "arch-arm/cortex-a9/bionic/stpcpy.S",
842 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800843 "arch-arm/cortex-a9/bionic/strcpy.S",
844 "arch-arm/cortex-a9/bionic/strlen.S",
845
846 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800847 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800848
849 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800850
Haibo Huang01bfd892018-12-03 15:05:16 -0800851 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800852
853 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700854 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700855 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700856 arm64: {
857 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700858 "arch-arm64/generic/bionic/memcpy.S",
859 "arch-arm64/generic/bionic/memmove.S",
860 "arch-arm64/generic/bionic/memset.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700861 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800862
863 "arch-arm64/bionic/__bionic_clone.S",
864 "arch-arm64/bionic/_exit_with_stack_teardown.S",
865 "arch-arm64/bionic/setjmp.S",
866 "arch-arm64/bionic/syscall.S",
867 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700868 ],
869 exclude_srcs: [
870 "bionic/__memcpy_chk.cpp",
871 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800872 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700873 "bionic/strnlen.c",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800874 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700875 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700876 },
877
Dan Willemsen208ae172015-09-16 16:33:27 -0700878 x86: {
879 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700880 "arch-x86/generic/string/memcmp.S",
881 "arch-x86/generic/string/strcmp.S",
882 "arch-x86/generic/string/strncmp.S",
883 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700884
885 "arch-x86/generic/string/strlcat.c",
886 "arch-x86/generic/string/strlcpy.c",
887 "arch-x86/generic/string/strncat.c",
888 "arch-x86/generic/string/wcscat.c",
889 "arch-x86/generic/string/wcscpy.c",
890 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530891 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700892
Dan Willemsen208ae172015-09-16 16:33:27 -0700893 "arch-x86/atom/string/sse2-memchr-atom.S",
894 "arch-x86/atom/string/sse2-memrchr-atom.S",
895 "arch-x86/atom/string/sse2-strchr-atom.S",
896 "arch-x86/atom/string/sse2-strnlen-atom.S",
897 "arch-x86/atom/string/sse2-strrchr-atom.S",
898 "arch-x86/atom/string/sse2-wcschr-atom.S",
899 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
900 "arch-x86/atom/string/sse2-wcslen-atom.S",
901 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700902 "arch-x86/silvermont/string/sse2-memmove-slm.S",
903 "arch-x86/silvermont/string/sse2-memset-slm.S",
904 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
905 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
906 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
907 "arch-x86/silvermont/string/sse2-strlen-slm.S",
908 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800909
910 "arch-x86/bionic/__bionic_clone.S",
911 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800912 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800913 "arch-x86/bionic/__restore.S",
914 "arch-x86/bionic/setjmp.S",
915 "arch-x86/bionic/syscall.S",
916 "arch-x86/bionic/vfork.S",
Ryan Pricharda992a062020-04-18 02:59:24 -0700917 "arch-x86/bionic/__x86.get_pc_thunk.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700918
919 // ssse3 functions
920 "arch-x86/atom/string/ssse3-strcat-atom.S",
921 "arch-x86/atom/string/ssse3-strcmp-atom.S",
922 "arch-x86/atom/string/ssse3-strlcat-atom.S",
923 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
924 "arch-x86/atom/string/ssse3-strncat-atom.S",
925 "arch-x86/atom/string/ssse3-strncmp-atom.S",
926 "arch-x86/atom/string/ssse3-wcscat-atom.S",
927 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
928
929 // sse4 functions
930 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
931 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
932
933 // atom functions
934 "arch-x86/atom/string/sse2-memset-atom.S",
935 "arch-x86/atom/string/sse2-strlen-atom.S",
936 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800937 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700938 "arch-x86/atom/string/ssse3-strcpy-atom.S",
939 "arch-x86/atom/string/ssse3-strncpy-atom.S",
940 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530941
942 // avx2 functions
943 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700944 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700945
946 exclude_srcs: [
947 "bionic/strchr.cpp",
948 "bionic/strnlen.c",
949 "bionic/strrchr.cpp",
950 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700951 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700952 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700953 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700954 "arch-x86_64/string/sse2-memmove-slm.S",
955 "arch-x86_64/string/sse2-memset-slm.S",
956 "arch-x86_64/string/sse2-stpcpy-slm.S",
957 "arch-x86_64/string/sse2-stpncpy-slm.S",
958 "arch-x86_64/string/sse2-strcat-slm.S",
959 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700960 "arch-x86_64/string/sse2-strlen-slm.S",
961 "arch-x86_64/string/sse2-strncat-slm.S",
962 "arch-x86_64/string/sse2-strncpy-slm.S",
963 "arch-x86_64/string/sse4-memcmp-slm.S",
964 "arch-x86_64/string/ssse3-strcmp-slm.S",
965 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530966 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800967
968 "arch-x86_64/bionic/__bionic_clone.S",
969 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
970 "arch-x86_64/bionic/__restore_rt.S",
971 "arch-x86_64/bionic/setjmp.S",
972 "arch-x86_64/bionic/syscall.S",
973 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700974 ],
975 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700976 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700977
Colin Cross50c21ab2015-10-31 23:03:05 -0700978 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700979 include_dirs: ["bionic/libstdc++/include"],
980 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700981}
982
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000983genrule {
984 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -0800985 out: ["generated_android_ids.h"],
986 srcs: [":android_filesystem_config_header"],
987 tool_files: ["fs_config_generator.py"],
988 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000989}
990
Dan Willemsen268a6732015-10-15 14:49:45 -0700991// ========================================================
992// libc_bionic_ndk.a- The portions of libc_bionic that can
993// be safely used in libc_ndk.a (no troublesome global data
994// or constructors).
995// ========================================================
996cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700997 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700998 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -0700999 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001000 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001001 "bionic/__cmsg_nxthdr.cpp",
1002 "bionic/__errno.cpp",
1003 "bionic/__gnu_basename.cpp",
1004 "bionic/__libc_current_sigrtmax.cpp",
1005 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001006 "bionic/abort.cpp",
1007 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001008 "bionic/access.cpp",
1009 "bionic/arpa_inet.cpp",
1010 "bionic/assert.cpp",
1011 "bionic/atof.cpp",
Bram Bonné95ca52a2020-12-03 19:03:55 +01001012 "bionic/bind.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001013 "bionic/bionic_allocator.cpp",
Bram Bonné95ca52a2020-12-03 19:03:55 +01001014 "bionic/bionic_appcompat.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001015 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001016 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001017 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001018 "bionic/bionic_time_conversions.cpp",
1019 "bionic/brk.cpp",
1020 "bionic/c16rtomb.cpp",
1021 "bionic/c32rtomb.cpp",
1022 "bionic/chmod.cpp",
1023 "bionic/chown.cpp",
1024 "bionic/clearenv.cpp",
1025 "bionic/clock.cpp",
1026 "bionic/clock_getcpuclockid.cpp",
1027 "bionic/clock_nanosleep.cpp",
1028 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001029 "bionic/ctype.cpp",
1030 "bionic/dirent.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001031 "bionic/dup.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001032 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001033 "bionic/error.cpp",
Josh Gao7de41242020-04-29 17:08:46 -07001034 "bionic/eventfd.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001035 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001036 "bionic/faccessat.cpp",
1037 "bionic/fchmod.cpp",
1038 "bionic/fchmodat.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001039 "bionic/fcntl.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001040 "bionic/fdsan.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001041 "bionic/fdtrack.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001042 "bionic/ffs.cpp",
1043 "bionic/fgetxattr.cpp",
1044 "bionic/flistxattr.cpp",
1045 "bionic/flockfile.cpp",
1046 "bionic/fpclassify.cpp",
1047 "bionic/fsetxattr.cpp",
1048 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001049 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001050 "bionic/futimens.cpp",
1051 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001052 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001053 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001054 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001055 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001056 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001057 "bionic/getpgrp.cpp",
1058 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001059 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001060 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001061 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001062 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001063 "bionic/grp_pwd_file.cpp",
Mitch Phillips9cad8422021-01-20 16:03:27 -08001064 "bionic/heap_zero_init.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001065 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001066 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001067 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001068 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001069 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001070 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001071 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001072 "bionic/lchown.cpp",
1073 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001074 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001075 "bionic/libgen.cpp",
1076 "bionic/link.cpp",
1077 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001078 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001079 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001080 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001081 "bionic/mbrtoc16.cpp",
1082 "bionic/mbrtoc32.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001083 "bionic/mempcpy.cpp",
1084 "bionic/mkdir.cpp",
1085 "bionic/mkfifo.cpp",
1086 "bionic/mknod.cpp",
1087 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001088 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001089 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001090 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001091 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001092 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001093 "bionic/open.cpp",
1094 "bionic/pathconf.cpp",
1095 "bionic/pause.cpp",
1096 "bionic/pipe.cpp",
1097 "bionic/poll.cpp",
1098 "bionic/posix_fadvise.cpp",
1099 "bionic/posix_fallocate.cpp",
1100 "bionic/posix_madvise.cpp",
1101 "bionic/posix_timers.cpp",
1102 "bionic/ptrace.cpp",
1103 "bionic/pty.cpp",
1104 "bionic/raise.cpp",
1105 "bionic/rand.cpp",
1106 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001107 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001108 "bionic/reboot.cpp",
1109 "bionic/recv.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001110 "bionic/recvmsg.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001111 "bionic/rename.cpp",
1112 "bionic/rmdir.cpp",
1113 "bionic/scandir.cpp",
1114 "bionic/sched_getaffinity.cpp",
1115 "bionic/sched_getcpu.cpp",
1116 "bionic/semaphore.cpp",
1117 "bionic/send.cpp",
1118 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001119 "bionic/seteuid.cpp",
1120 "bionic/setpgrp.cpp",
1121 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001122 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001123 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001124 "bionic/sleep.cpp",
Josh Gaob107eab2020-04-29 17:17:56 -07001125 "bionic/socketpair.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001126 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001127 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001128 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001129 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001130 "bionic/string_l.cpp",
1131 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001132 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001133 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001134 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001135 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001136 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001137 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001138 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001139 "bionic/sys_msg.cpp",
1140 "bionic/sys_sem.cpp",
1141 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001142 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001143 "bionic/sys_statfs.cpp",
1144 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001145 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001146 "bionic/sysinfo.cpp",
1147 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001148 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001149 "bionic/system_property_api.cpp",
1150 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001151 "bionic/tdestroy.cpp",
1152 "bionic/termios.cpp",
1153 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001154 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001155 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001156 "bionic/tmpfile.cpp",
1157 "bionic/umount.cpp",
1158 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001159 "bionic/usleep.cpp",
Elliott Hughes9a1d3972020-08-07 15:55:02 -07001160 "bionic/utmp.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001161 "bionic/wait.cpp",
1162 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001163 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001164 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001165 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001166 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001167 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001168
1169 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1170 // which will be overridden by the actual one in libc.so.
1171 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001172 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001173
Dan Willemsen208ae172015-09-16 16:33:27 -07001174 multilib: {
1175 lib32: {
1176 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001177 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001178 },
1179 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001180 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001181 treble_linker_namespaces: {
1182 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001183 },
1184 },
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001185 whole_static_libs: [
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001186 "libsystemproperties",
1187 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001188 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001189 local_include_dirs: ["stdio"],
1190 include_dirs: ["bionic/libstdc++/include"],
1191 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001192 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001193}
1194
Dan Willemsen208ae172015-09-16 16:33:27 -07001195// ========================================================
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001196// libc_bionic_systrace.a
1197// ========================================================
1198
1199cc_library_static {
1200 name: "libc_bionic_systrace",
1201 defaults: ["libc_defaults"],
1202 srcs: [
1203 "bionic/bionic_systrace.cpp",
1204 ],
1205 apex_available: [
1206 "com.android.runtime",
1207 ],
1208}
1209
1210// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001211// libc_pthread.a - pthreads parts that previously lived in
1212// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001213// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001214// pthread_t has changed over the years and has ABI
1215// compatibility issues).
1216// ========================================================
1217
1218cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001219 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001220 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001221 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001222 "bionic/pthread_atfork.cpp",
1223 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001224 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001225 "bionic/pthread_cond.cpp",
1226 "bionic/pthread_create.cpp",
1227 "bionic/pthread_detach.cpp",
1228 "bionic/pthread_equal.cpp",
1229 "bionic/pthread_exit.cpp",
1230 "bionic/pthread_getcpuclockid.cpp",
1231 "bionic/pthread_getschedparam.cpp",
1232 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001233 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001234 "bionic/pthread_join.cpp",
1235 "bionic/pthread_key.cpp",
1236 "bionic/pthread_kill.cpp",
1237 "bionic/pthread_mutex.cpp",
1238 "bionic/pthread_once.cpp",
1239 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001240 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001241 "bionic/pthread_self.cpp",
1242 "bionic/pthread_setname_np.cpp",
1243 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001244 "bionic/pthread_spinlock.cpp",
Vy Nguyend5007512020-07-14 17:37:04 -04001245 "bionic/sys_thread_properties.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001246
1247 // The following implementations depend on pthread data or implementation,
1248 // so we can't include them in libc_ndk.a.
1249 "bionic/__cxa_thread_atexit_impl.cpp",
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001250 "bionic/android_unsafe_frame_pointer_chase.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -08001251 "bionic/atexit.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001252 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001253 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001254
Colin Cross50c21ab2015-10-31 23:03:05 -07001255 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001256 include_dirs: ["bionic/libstdc++/include"],
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001257 header_libs: ["bionic_libc_platform_headers"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001258 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001259}
1260
1261// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001262// libc_syscalls.a
1263// ========================================================
1264
Elliott Hughes782c4852019-04-16 12:31:00 -07001265genrule {
1266 name: "syscalls-arm.S",
1267 out: ["syscalls-arm.S"],
1268 srcs: ["SYSCALLS.TXT"],
1269 tool_files: [":bionic-gensyscalls"],
1270 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
Chris Parsons8b768d32020-09-29 02:44:25 -04001271 bazel_module: { label: "//bionic/libc:syscalls-arm" }
Elliott Hughes782c4852019-04-16 12:31:00 -07001272}
1273
1274genrule {
1275 name: "syscalls-arm64.S",
1276 out: ["syscalls-arm64.S"],
1277 srcs: ["SYSCALLS.TXT"],
1278 tool_files: [":bionic-gensyscalls"],
1279 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
Chris Parsons8b768d32020-09-29 02:44:25 -04001280 bazel_module: { label: "//bionic/libc:syscalls-arm64" },
Elliott Hughes782c4852019-04-16 12:31:00 -07001281}
1282
1283genrule {
1284 name: "syscalls-x86.S",
1285 out: ["syscalls-x86.S"],
1286 srcs: ["SYSCALLS.TXT"],
1287 tool_files: [":bionic-gensyscalls"],
1288 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
Chris Parsons8b768d32020-09-29 02:44:25 -04001289 bazel_module: { label: "//bionic/libc:syscalls-x86" },
Elliott Hughes782c4852019-04-16 12:31:00 -07001290}
1291
1292genrule {
1293 name: "syscalls-x86_64.S",
1294 out: ["syscalls-x86_64.S"],
1295 srcs: ["SYSCALLS.TXT"],
1296 tool_files: [":bionic-gensyscalls"],
1297 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
Chris Parsons8b768d32020-09-29 02:44:25 -04001298 bazel_module: { label: "//bionic/libc:syscalls-x86_64" },
Elliott Hughes782c4852019-04-16 12:31:00 -07001299}
1300
Dan Willemsen208ae172015-09-16 16:33:27 -07001301cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001302 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001303 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001304 arch: {
1305 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001306 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001307 },
1308 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001309 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001310 },
1311 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001312 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001313 },
1314 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001315 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001316 },
1317 },
1318 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001319}
1320
1321// ========================================================
1322// libc_aeabi.a
1323// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1324// to avoid infinite recursion. For the other architectures we just build an
1325// empty library to keep this makefile simple.
1326// ========================================================
1327
1328cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001329 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001330 arch: {
1331 arm: {
1332 srcs: ["arch-arm/bionic/__aeabi.c"],
1333 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001334 },
1335 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001336 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001337}
1338
1339// ========================================================
1340// libc_ndk.a
1341// Compatibility library for the NDK. This library contains
1342// all the parts of libc that are safe to statically link.
1343// We can't safely statically link things that can only run
1344// on a certain version of the OS. Examples include
1345// anything that talks to netd (a large portion of the DNS
1346// code) and anything that is dependent on the layout of a
1347// data structure that has changed across releases (such as
1348// pthread_t).
1349// ========================================================
1350
1351cc_library_static {
1352 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001353 defaults: [
1354 "libc_defaults",
1355 "libc_native_allocator_defaults",
1356 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -08001357 ramdisk_available: false,
Yifan Hongb04490d2020-10-21 18:36:36 -07001358 vendor_ramdisk_available: false,
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001359 srcs: libc_common_src_files + [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001360 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001361 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001362 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001363 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001364 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001365 multilib: {
1366 lib32: {
1367 srcs: libc_common_src_files_32,
1368 },
1369 },
1370 arch: {
1371 arm: {
1372 srcs: [
1373 "arch-arm/bionic/exidx_dynamic.c",
1374 "arch-common/bionic/crtbegin_so.c",
1375 "arch-arm/bionic/atexit_legacy.c",
1376 "arch-common/bionic/crtend_so.S",
1377 ],
1378 whole_static_libs: ["libc_aeabi"],
1379 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001380 },
1381
Colin Cross50c21ab2015-10-31 23:03:05 -07001382 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001383 "-fvisibility=hidden",
1384 "-DLIBC_STATIC",
1385 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001386
1387 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001388 "gwp_asan",
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001389 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001390 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001391 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001392 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001393 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001394 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001395 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001396 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001397 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001398 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001399 "libc_syscalls",
1400 "libc_tzcode",
1401 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001402 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001403 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001404}
1405
1406// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001407// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001408// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001409cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001410 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001411 srcs: libc_common_src_files,
1412 multilib: {
1413 lib32: {
1414 srcs: libc_common_src_files_32,
1415 },
1416 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001417 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001418
1419 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001420 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001421 "libc_bionic",
1422 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001423 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001424 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001425 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001426 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001427 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001428 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001429 "libc_netbsd",
1430 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001431 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001432 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001433 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001434 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001435 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001436 ],
1437
1438 arch: {
1439 arm: {
1440 whole_static_libs: ["libc_aeabi"],
1441 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001442 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001443}
1444
1445// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001446// libc_common.a
1447// ========================================================
1448
1449cc_library_static {
1450 defaults: ["libc_defaults"],
1451 name: "libc_common",
1452
1453 whole_static_libs: [
1454 "libc_nopthread",
1455 "libc_pthread",
1456 ],
1457}
1458
1459// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001460// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001461// ========================================================
1462cc_library_static {
1463 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001464 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001465
Haibo Huangb9244ff2018-08-11 10:12:13 -07001466 arch: {
1467 x86: {
1468 srcs: ["arch-x86/static_function_dispatch.S"],
1469 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001470 arm: {
1471 srcs: ["arch-arm/static_function_dispatch.S"],
1472 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001473 arm64: {
1474 srcs: ["arch-arm64/static_function_dispatch.S"],
1475 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001476 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001477}
1478
1479// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001480// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001481// ========================================================
1482cc_library_static {
1483 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001484 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001485
Haibo Huangb9244ff2018-08-11 10:12:13 -07001486 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001487 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001488 "-fno-stack-protector",
1489 "-fno-jump-tables",
1490 ],
1491 arch: {
1492 x86: {
1493 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1494 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001495 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001496 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001497 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001498 arm64: {
1499 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1500 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001501 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001502}
1503
1504// ========================================================
1505// libc_common_static.a For static binaries.
1506// ========================================================
1507cc_library_static {
1508 defaults: ["libc_defaults"],
1509 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001510
Haibo Huangf71edfa2018-11-12 10:06:56 -08001511 whole_static_libs: [
1512 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001513 "libc_static_dispatch",
1514 ],
1515}
1516
1517// ========================================================
1518// libc_common_shared.a For shared libraries.
1519// ========================================================
1520cc_library_static {
1521 defaults: ["libc_defaults"],
1522 name: "libc_common_shared",
1523
1524 whole_static_libs: [
1525 "libc_common",
1526 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001527 ],
1528}
1529
Ryan Prichard22a6a052019-10-10 23:59:30 -07001530// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1531// executable.
1532cc_library_static {
1533 name: "libc_unwind_static",
1534 defaults: ["libc_defaults"],
1535 cflags: ["-DLIBC_STATIC"],
1536
1537 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1538 arch: {
1539 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1540 arm: {
1541 srcs: ["arch-arm/bionic/exidx_static.c"],
1542 },
1543 },
1544}
1545
Haibo Huangf71edfa2018-11-12 10:06:56 -08001546// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001547// libc_nomalloc.a
1548// ========================================================
1549//
Ryan Prichard249757b2019-11-01 17:18:28 -07001550// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1551// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1552// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001553
1554cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001555 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001556 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001557
Colin Crossa3f9fca2016-01-11 13:20:55 -08001558 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001559 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001560 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001561 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001562 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001563}
1564
dimitryc0c0ef62018-12-05 16:33:52 +01001565filegroup {
1566 name: "libc_sources_shared",
1567 srcs: [
1568 "arch-common/bionic/crtbegin_so.c",
1569 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001570 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001571 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001572 "bionic/icu.cpp",
1573 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001574 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001575 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001576 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001577 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001578 "bionic/ndk_cruft.cpp",
1579 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001580 "bionic/NetdClient.cpp",
1581 "arch-common/bionic/crtend_so.S",
1582 ],
Jingwen Chend6a3b782021-02-05 10:05:29 -05001583 bazel_module: { bp2build_available: true },
dimitryc0c0ef62018-12-05 16:33:52 +01001584}
1585
1586filegroup {
1587 name: "libc_sources_static",
1588 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001589 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001590 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001591 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001592 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001593 ],
Jingwen Chend6a3b782021-02-05 10:05:29 -05001594 bazel_module: { bp2build_available: true },
dimitryc0c0ef62018-12-05 16:33:52 +01001595}
1596
1597filegroup {
1598 name: "libc_sources_shared_arm",
1599 srcs: [
1600 "arch-arm/bionic/exidx_dynamic.c",
1601 "arch-arm/bionic/atexit_legacy.c",
1602 ],
Jingwen Chend6a3b782021-02-05 10:05:29 -05001603 bazel_module: { bp2build_available: true },
dimitryc0c0ef62018-12-05 16:33:52 +01001604}
1605
Dan Willemsen208ae172015-09-16 16:33:27 -07001606// ========================================================
1607// libc.a + libc.so
1608// ========================================================
1609cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001610 defaults: [
1611 "libc_defaults",
1612 "libc_native_allocator_defaults",
1613 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001614 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001615 static_ndk_lib: true,
Colin Cross8393a8b2020-10-19 13:37:49 -07001616 llndk_stubs: "libc.llndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001617 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001618 platform_sdk_version: {
1619 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1620 },
1621 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001622 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001623 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001624 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001625 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001626 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001627 "libc_init_static",
1628 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001629 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001630 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001631 },
1632 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001633 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001634 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001635 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001636 "libc_init_dynamic",
1637 "libc_common_shared",
Ryan Prichardcdf71752020-12-16 03:37:22 -08001638 "libunwind-exported",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001639 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001640 },
1641
Neil Fullera7db90f2019-04-25 09:28:27 +01001642 required: [
1643 "tzdata",
1644 "tz_version", // Version metadata for tzdata to help debugging.
1645 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001646
Colin Cross4ce94d22016-11-15 13:15:43 -08001647 // Do not pack libc.so relocations; see http://b/20645321 for details.
1648 pack_relocations: false,
1649
dimitry06016f22018-01-05 11:39:28 +01001650 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1651 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1652 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1653 // those new libraries from libgcc.a are not declared external; if that were the case,
1654 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1655 // on the external symbols from the dependent libraries. That would create a "cloaked"
1656 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001657
dimitry06016f22018-01-05 11:39:28 +01001658 shared_libs: [
1659 "ld-android",
1660 "libdl",
1661 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001662 static_libs: [
1663 "libdl_android",
1664 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001665
1666 nocrt: true,
1667
Dan Willemsen208ae172015-09-16 16:33:27 -07001668 arch: {
1669 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001670 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001671 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001672 ldflags: ["-Wl,--hash-style=both"],
1673
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001674 version_script: ":libc.arm.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001675 no_libcrt: true,
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001676
Dan Willemsen208ae172015-09-16 16:33:27 -07001677 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001678 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001679 // special for arm
1680 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichardc22562c2021-01-27 17:27:31 -08001681 // For backwards-compatibility, some arm32 builtins are exported from libc.so.
1682 static_libs: ["libclang_rt.builtins-arm-android-exported"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001683 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001684
1685 // Arm 32 bit does not produce complete exidx unwind information
1686 // so keep the .debug_frame which is relatively small and does
1687 // include needed unwind information.
1688 // See b/132992102 for details.
1689 strip: {
1690 keep_symbols_and_debug_frame: true,
1691 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001692 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001693 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001694 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001695
1696 // Leave the symbols in the shared library so that stack unwinders can produce
1697 // meaningful name resolution.
1698 strip: {
1699 keep_symbols: true,
1700 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001701 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001702 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001703 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001704 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001705 ldflags: ["-Wl,--hash-style=both"],
1706
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001707 version_script: ":libc.x86.map",
Ryan Prichardc22562c2021-01-27 17:27:31 -08001708 no_libcrt: true,
1709
1710 shared: {
1711 // For backwards-compatibility, some x86 builtins are exported from libc.so.
1712 static_libs: ["libclang_rt.builtins-i686-android-exported"],
1713 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001714
1715 // Leave the symbols in the shared library so that stack unwinders can produce
1716 // meaningful name resolution.
1717 strip: {
1718 keep_symbols: true,
1719 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001720 },
1721 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001722 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001723
1724 // Leave the symbols in the shared library so that stack unwinders can produce
1725 // meaningful name resolution.
1726 strip: {
1727 keep_symbols: true,
1728 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001729 },
1730 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001731
1732 stubs: {
1733 symbol_file: "libc.map.txt",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001734 versions: [
1735 "29",
Jooyung Handbfa0742020-03-30 13:18:44 +09001736 "R",
Dan Albert48943b22020-07-27 13:28:56 -07001737 "current",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001738 ],
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001739 },
Vic Yang6903fb82019-01-14 11:34:39 -08001740
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001741 apex_available: [
1742 "//apex_available:platform",
1743 "com.android.runtime",
1744 ],
1745
Vic Yang03ff4362019-06-24 16:11:37 -07001746 // Sorting bss symbols by size usually results in less dirty pages at run
1747 // time, because small symbols are grouped together.
1748 sort_bss_symbols_by_size: true,
Yi Kong15a05a72020-09-22 00:56:13 +08001749
1750 lto: {
1751 never: true,
1752 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001753}
1754
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001755genrule {
1756 name: "libc.arm.map",
1757 out: ["libc.arm.map"],
1758 srcs: ["libc.map.txt"],
1759 tool_files: [":bionic-generate-version-script"],
1760 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
Jingwen Chend6a3b782021-02-05 10:05:29 -05001761 bazel_module: { bp2build_available: true },
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001762}
1763
1764genrule {
1765 name: "libc.arm64.map",
1766 out: ["libc.arm64.map"],
1767 srcs: ["libc.map.txt"],
1768 tool_files: [":bionic-generate-version-script"],
1769 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
Jingwen Chend6a3b782021-02-05 10:05:29 -05001770 bazel_module: { bp2build_available: true },
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001771}
1772
1773genrule {
1774 name: "libc.x86.map",
1775 out: ["libc.x86.map"],
1776 srcs: ["libc.map.txt"],
1777 tool_files: [":bionic-generate-version-script"],
1778 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
Jingwen Chend6a3b782021-02-05 10:05:29 -05001779 bazel_module: { bp2build_available: true },
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001780}
1781
1782genrule {
1783 name: "libc.x86_64.map",
1784 out: ["libc.x86_64.map"],
1785 srcs: ["libc.map.txt"],
1786 tool_files: [":bionic-generate-version-script"],
1787 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
Jingwen Chend6a3b782021-02-05 10:05:29 -05001788 bazel_module: { bp2build_available: true },
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001789}
1790
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001791// Headers that only other parts of the platform can include.
1792cc_library_headers {
1793 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001794 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001795 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001796 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001797 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001798 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001799 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001800 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001801 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001802 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001803 "//system/core/debuggerd:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001804 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001805 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001806 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001807 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001808 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001809 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001810 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001811 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001812 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001813 recovery_available: true,
1814 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001815 export_include_dirs: [
1816 "platform",
1817 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001818 system_shared_libs: [],
1819 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001820 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001821
Steven Moreland0cdf1322020-10-05 21:55:26 +00001822 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001823 apex_available: [
1824 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001825 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001826 ],
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001827 bazel_module: { bp2build_available: true },
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001828}
1829
Logan Chien17af91b2019-01-15 21:19:56 +08001830cc_library_headers {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001831 // Internal lib for use in libc_headers. Since we cannot intersect arch{}
1832 // and target{} in the same module, this one specifies the arch-dependent
1833 // include paths, and then libc_headers filters by target so that the
1834 // headers only are included for Bionic targets.
1835 name: "libc_headers_arch",
1836 visibility: ["//visibility:private"],
Logan Chien17af91b2019-01-15 21:19:56 +08001837
1838 host_supported: true,
1839 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001840 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001841 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001842 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001843 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001844 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001845 apex_available: [
1846 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001847 "//apex_available:anyapex",
1848 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001849 // used by most APEXes indirectly via libunwind_llvm
1850 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001851
1852 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001853 stl: "none",
1854 system_shared_libs: [],
1855
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001856 // The build system generally requires that any dependencies of a target
1857 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1858 // to 1 we let targets with an sdk_version that need to depend on the libc
1859 // headers but cannot depend on libc itself due to circular dependencies
1860 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1861 // is correct because the headers can support any sdk_version.
1862 sdk_version: "1",
1863
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001864 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001865 "include",
1866 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001867 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001868 "kernel/android/uapi",
1869 ],
1870
1871 arch: {
1872 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001873 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001874 },
1875 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001876 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001877 },
Logan Chien17af91b2019-01-15 21:19:56 +08001878 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001879 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001880 },
1881 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001882 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001883 },
1884 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001885 bazel_module: { bp2build_available: true },
Logan Chien17af91b2019-01-15 21:19:56 +08001886}
1887
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001888cc_library_headers {
1889 name: "libc_headers",
1890 host_supported: true,
1891 native_bridge_supported: true,
1892 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001893 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001894 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001895 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001896 recovery_available: true,
1897 sdk_version: "1",
1898
1899 apex_available: [
1900 "//apex_available:platform",
1901 "//apex_available:anyapex",
1902 ],
1903 // used by most APEXes indirectly via libunwind_llvm
1904 min_sdk_version: "apex_inherit",
1905 visibility: [
1906 "//bionic:__subpackages__", // visible to bionic
1907 // ... and only to these places (b/152668052)
1908 "//external/arm-optimized-routines",
1909 "//external/gwp_asan",
1910 "//external/jemalloc_new",
1911 "//external/libunwind_llvm",
1912 "//external/scudo",
1913 "//system/core/property_service/libpropertyinfoparser",
1914 "//system/extras/toolchain-extras",
1915 // TODO(b/153662223): Clean up these users that needed visibility when
1916 // the implicit addition of system Bionic paths was removed.
1917 "//art/tools/cpp-define-generator",
1918 "//external/boringssl",
1919 "//external/minijail",
1920 ],
1921
1922 stl: "none",
1923 no_libcrt: true,
1924 system_shared_libs: [],
1925
1926 target: {
1927 android: {
1928 header_libs: ["libc_headers_arch"],
1929 export_header_lib_headers: ["libc_headers_arch"],
1930 },
1931 linux_bionic: {
1932 header_libs: ["libc_headers_arch"],
1933 export_header_lib_headers: ["libc_headers_arch"],
1934 },
Rupert Shuttleworthfd648682021-02-16 03:27:05 +00001935 },
1936 bazel_module: { bp2build_available: true },
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001937}
1938
Dan Willemsen208ae172015-09-16 16:33:27 -07001939// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001940// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001941// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001942
Dan Willemsen208ae172015-09-16 16:33:27 -07001943cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001944 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001945 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001946 srcs: [
1947 "bionic/__cxa_guard.cpp",
1948 "bionic/__cxa_pure_virtual.cpp",
1949 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001950 ],
1951 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001952 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001953 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001954
Dan Willemsen6b3be172018-12-03 13:57:20 -08001955 static: {
1956 system_shared_libs: [],
1957 },
1958 shared: {
1959 system_shared_libs: ["libc"],
1960 },
1961
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001962 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001963 arch: {
1964 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001965 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001966 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001967 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001968 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001969 },
1970 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001971 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001972 },
1973 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001974 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001975 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001976 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001977 },
1978 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001979 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001980 },
1981 },
1982}
1983
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001984genrule {
1985 name: "libstdc++.arm.map",
1986 out: ["libstdc++.arm.map"],
1987 srcs: ["libstdc++.map.txt"],
1988 tool_files: [":bionic-generate-version-script"],
1989 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1990}
1991
1992genrule {
1993 name: "libstdc++.arm64.map",
1994 out: ["libstdc++.arm64.map"],
1995 srcs: ["libstdc++.map.txt"],
1996 tool_files: [":bionic-generate-version-script"],
1997 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1998}
1999
2000genrule {
2001 name: "libstdc++.x86.map",
2002 out: ["libstdc++.x86.map"],
2003 srcs: ["libstdc++.map.txt"],
2004 tool_files: [":bionic-generate-version-script"],
2005 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
2006}
2007
2008genrule {
2009 name: "libstdc++.x86_64.map",
2010 out: ["libstdc++.x86_64.map"],
2011 srcs: ["libstdc++.map.txt"],
2012 tool_files: [":bionic-generate-version-script"],
2013 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
2014}
2015
2016// ========================================================
2017// crt object files.
2018// ========================================================
2019
Colin Cross50c21ab2015-10-31 23:03:05 -07002020cc_defaults {
2021 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002022 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002023 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002024 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002025 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002026 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002027 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002028 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002029 apex_available: [
2030 "//apex_available:platform",
2031 "//apex_available:anyapex",
2032 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002033 // Generate NDK variants of the CRT objects for every supported API level.
2034 min_sdk_version: "16",
2035 stl: "none",
2036 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002037 cflags: [
2038 "-Wno-gcc-compat",
2039 "-Wall",
2040 "-Werror",
2041 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002042 sanitize: {
2043 never: true,
2044 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002045}
2046
Colin Cross50c21ab2015-10-31 23:03:05 -07002047cc_defaults {
2048 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002049 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002050
2051 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002052 x86: {
2053 cflags: ["-fPIC"],
2054 },
2055 x86_64: {
2056 cflags: ["-fPIC"],
2057 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002058 },
Colin Crossab179442018-09-27 11:03:22 -07002059 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002060}
2061
Dan Willemsen208ae172015-09-16 16:33:27 -07002062cc_object {
2063 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002064 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002065 local_include_dirs: ["include"],
2066 product_variables: {
2067 platform_sdk_version: {
2068 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2069 },
2070 },
2071 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002072
Colin Cross7d7b3682017-11-03 13:38:40 -07002073 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002074}
2075
Dan Willemsen208ae172015-09-16 16:33:27 -07002076cc_object {
2077 name: "crtbegin_so1",
2078 local_include_dirs: ["include"],
2079 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002080
Colin Cross7d7b3682017-11-03 13:38:40 -07002081 defaults: ["crt_so_defaults"],
Jingwen Chen5daf8f92021-02-09 05:18:20 -05002082 bazel_module: { bp2build_available: true },
Dan Willemsen208ae172015-09-16 16:33:27 -07002083}
2084
Dan Willemsen208ae172015-09-16 16:33:27 -07002085cc_object {
2086 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002087
Colin Cross7d7b3682017-11-03 13:38:40 -07002088 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002089 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002090 "crtbegin_so1",
2091 "crtbrand",
2092 ],
2093}
2094
Dan Willemsen208ae172015-09-16 16:33:27 -07002095cc_object {
2096 name: "crtend_so",
2097 local_include_dirs: ["include"],
2098 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002099
Colin Cross7d7b3682017-11-03 13:38:40 -07002100 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002101}
2102
Dan Willemsen208ae172015-09-16 16:33:27 -07002103cc_object {
2104 name: "crtbegin_static1",
2105 local_include_dirs: ["include"],
2106 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002107 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002108 // When using libc.a, we're using the latest library regardless of target API level.
2109 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002110}
2111
Dan Willemsen208ae172015-09-16 16:33:27 -07002112cc_object {
2113 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002114
Colin Cross77d57bf2016-04-11 14:34:18 -07002115 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002116 "crtbegin_static1",
2117 "crtbrand",
2118 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002119 defaults: ["crt_defaults"],
Jiyong Park268a6002021-01-12 23:14:37 +09002120 // When using libc.a, we're using the latest library regardless of target API level.
2121 min_sdk_version: "current",
Dan Willemsen208ae172015-09-16 16:33:27 -07002122}
2123
Dan Willemsen208ae172015-09-16 16:33:27 -07002124cc_object {
2125 name: "crtbegin_dynamic1",
2126 local_include_dirs: ["include"],
2127 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002128 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002129}
2130
Dan Willemsen208ae172015-09-16 16:33:27 -07002131cc_object {
2132 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002133
Colin Cross77d57bf2016-04-11 14:34:18 -07002134 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002135 "crtbegin_dynamic1",
2136 "crtbrand",
2137 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002138 target: {
2139 linux_bionic: {
2140 generated_sources: ["host_bionic_linker_asm"],
2141 objs: [
2142 "linker_wrapper",
2143 ],
2144 },
2145 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002146 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002147}
2148
Dan Willemsen208ae172015-09-16 16:33:27 -07002149cc_object {
2150 // We rename crtend.o to crtend_android.o to avoid a
2151 // name clash between gcc and bionic.
2152 name: "crtend_android",
2153 local_include_dirs: ["include"],
2154 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002155
Colin Cross50c21ab2015-10-31 23:03:05 -07002156 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002157}
Colin Crossbaa48992016-07-13 11:15:21 -07002158
Evgenii Stepanov8564b8d2020-12-15 13:55:32 -08002159cc_library_static {
2160 name: "note_memtag_heap_async",
2161 arch: {
2162 arm64: {
2163 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"],
2164 }
2165 },
2166
2167 defaults: ["crt_defaults"],
2168}
2169
2170cc_library_static {
2171 name: "note_memtag_heap_sync",
2172 arch: {
2173 arm64: {
2174 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"],
2175 }
2176 },
2177
2178 defaults: ["crt_defaults"],
2179}
2180
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002181// ========================================================
2182// NDK headers.
2183// ========================================================
2184
Dan Albert26e1c412018-05-24 14:56:46 -07002185versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002186 name: "common_libc",
2187 from: "include",
2188 to: "",
2189 license: "NOTICE",
2190}
Dan Albert4238a352016-06-28 11:18:05 -07002191
2192ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002193 name: "libc_uapi",
2194 from: "kernel/uapi",
2195 to: "",
2196 srcs: [
2197 "kernel/uapi/asm-generic/**/*.h",
2198 "kernel/uapi/drm/**/*.h",
2199 "kernel/uapi/linux/**/*.h",
2200 "kernel/uapi/misc/**/*.h",
2201 "kernel/uapi/mtd/**/*.h",
2202 "kernel/uapi/rdma/**/*.h",
2203 "kernel/uapi/scsi/**/*.h",
2204 "kernel/uapi/sound/**/*.h",
2205 "kernel/uapi/video/**/*.h",
2206 "kernel/uapi/xen/**/*.h",
2207 ],
Dan Albert92592652016-10-20 01:42:54 -07002208 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002209}
2210
2211ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002212 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002213 from: "kernel/android/uapi/linux",
2214 to: "linux",
2215 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002216 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002217}
2218
2219ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002220 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002221 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002222 to: "scsi",
2223 srcs: ["kernel/android/scsi/**/*.h"],
2224 license: "NOTICE",
2225}
2226
2227ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002228 name: "libc_asm_arm",
2229 from: "kernel/uapi/asm-arm",
2230 to: "arm-linux-androideabi",
2231 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002232 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002233}
2234
2235ndk_headers {
2236 name: "libc_asm_arm64",
2237 from: "kernel/uapi/asm-arm64",
2238 to: "aarch64-linux-android",
2239 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002240 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002241}
2242
Lazar Trsic790d2f72017-11-27 11:54:11 +01002243ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002244 name: "libc_asm_x86",
2245 from: "kernel/uapi/asm-x86",
2246 to: "i686-linux-android",
2247 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002248 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002249}
2250
2251ndk_headers {
2252 name: "libc_asm_x86_64",
2253 from: "kernel/uapi/asm-x86",
2254 to: "x86_64-linux-android",
2255 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002256 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002257}
2258
Dan Albert4238a352016-06-28 11:18:05 -07002259ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002260 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002261 symbol_file: "libc.map.txt",
2262 first_version: "9",
2263}
2264
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002265llndk_library {
Colin Cross8393a8b2020-10-19 13:37:49 -07002266 name: "libc.llndk",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002267 symbol_file: "libc.map.txt",
2268 export_headers_as_system: true,
2269 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002270 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002271 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002272 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002273 "kernel/android/uapi",
2274 "kernel/uapi",
2275 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002276 arch: {
2277 arm: {
2278 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002279 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002280 ],
2281 },
2282 arm64: {
2283 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002284 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002285 ],
2286 },
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002287 x86: {
2288 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002289 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002290 ],
2291 },
2292 x86_64: {
2293 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002294 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002295 ],
2296 },
2297 },
2298}
2299
Dan Albertdf31aff2016-10-06 15:50:41 -07002300ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002301 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002302 symbol_file: "libstdc++.map.txt",
2303 first_version: "9",
2304}
2305
Dan Willemsenca056d72018-01-08 14:00:24 -08002306// Export these headers for toolbox to process
2307filegroup {
2308 name: "kernel_input_headers",
2309 srcs: [
2310 "kernel/uapi/linux/input.h",
2311 "kernel/uapi/linux/input-event-codes.h",
2312 ],
2313}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002314
2315// Generate a syscall name / number mapping. These objects are text files
2316// (thanks to the -dD -E flags) and not binary files. They will then be
2317// consumed by the genseccomp.py script and converted into C++ code.
2318cc_defaults {
2319 name: "libseccomp_gen_syscall_nrs_defaults",
2320 recovery_available: true,
2321 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2322 cflags: [
2323 "-dD",
2324 "-E",
2325 "-Wall",
2326 "-Werror",
2327 "-nostdinc",
2328 ],
2329}
2330
2331cc_object {
2332 name: "libseccomp_gen_syscall_nrs_arm",
2333 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2334 local_include_dirs: [
2335 "kernel/uapi/asm-arm",
2336 "kernel/uapi",
2337 ],
2338}
2339
2340cc_object {
2341 name: "libseccomp_gen_syscall_nrs_arm64",
2342 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2343 local_include_dirs: [
2344 "kernel/uapi/asm-arm64",
2345 "kernel/uapi",
2346 ],
2347}
2348
2349cc_object {
2350 name: "libseccomp_gen_syscall_nrs_x86",
2351 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2352 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2353 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2354 local_include_dirs: [
2355 "kernel/uapi/asm-x86",
2356 "kernel/uapi",
2357 ],
2358}
2359
2360cc_object {
2361 name: "libseccomp_gen_syscall_nrs_x86_64",
2362 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2363 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2364 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2365 local_include_dirs: [
2366 "kernel/uapi/asm-x86",
2367 "kernel/uapi",
2368 ],
2369}
2370
Jingwen Chenca366332021-01-29 05:16:32 -05002371filegroup {
2372 name: "all_kernel_uapi_headers",
2373 srcs: ["kernel/uapi/**/*.h"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002374}
2375
Martijn Coenen0c6de752019-01-02 12:52:51 +01002376
2377cc_genrule {
2378 name: "func_to_syscall_nrs",
2379 recovery_available: true,
2380 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2381
2382 tools: [ "genfunctosyscallnrs" ],
2383
2384 srcs: [
2385 "SYSCALLS.TXT",
2386 ":libseccomp_gen_syscall_nrs_arm",
2387 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002388 ":libseccomp_gen_syscall_nrs_x86",
2389 ":libseccomp_gen_syscall_nrs_x86_64",
2390 ],
2391
2392 out: [
2393 "func_to_syscall_nrs.h",
2394 ],
2395}
2396
Victor Hsiehdbb86702020-06-15 09:29:07 -07002397// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002398genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002399 name: "generate_app_zygote_blocklist",
2400 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2401 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002402 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2403}
2404
2405cc_genrule {
2406 name: "libseccomp_policy_app_zygote_sources",
2407 recovery_available: true,
2408 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2409
2410 tools: [ "genseccomp" ],
2411
2412 srcs: [
2413 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002414 "SECCOMP_ALLOWLIST_COMMON.TXT",
2415 "SECCOMP_ALLOWLIST_APP.TXT",
2416 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002417 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002418 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002419 ":libseccomp_gen_syscall_nrs_arm",
2420 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002421 ":libseccomp_gen_syscall_nrs_x86",
2422 ":libseccomp_gen_syscall_nrs_x86_64",
2423 ],
2424
2425 out: [
2426 "arm64_app_zygote_policy.cpp",
2427 "arm_app_zygote_policy.cpp",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002428 "x86_64_app_zygote_policy.cpp",
2429 "x86_app_zygote_policy.cpp",
2430 ],
2431}
2432
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002433cc_genrule {
2434 name: "libseccomp_policy_app_sources",
2435 recovery_available: true,
2436 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2437
2438 tools: [ "genseccomp" ],
2439
2440 srcs: [
2441 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002442 "SECCOMP_ALLOWLIST_COMMON.TXT",
2443 "SECCOMP_ALLOWLIST_APP.TXT",
2444 "SECCOMP_BLOCKLIST_COMMON.TXT",
2445 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002446 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002447 ":libseccomp_gen_syscall_nrs_arm",
2448 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002449 ":libseccomp_gen_syscall_nrs_x86",
2450 ":libseccomp_gen_syscall_nrs_x86_64",
2451 ],
2452
2453 out: [
2454 "arm64_app_policy.cpp",
2455 "arm_app_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002456 "x86_64_app_policy.cpp",
2457 "x86_app_policy.cpp",
2458 ],
2459}
2460
2461cc_genrule {
2462 name: "libseccomp_policy_system_sources",
2463 recovery_available: true,
2464 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2465
2466 tools: [ "genseccomp" ],
2467
2468 srcs: [
2469 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002470 "SECCOMP_ALLOWLIST_COMMON.TXT",
2471 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2472 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002473 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002474 ":libseccomp_gen_syscall_nrs_arm",
2475 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002476 ":libseccomp_gen_syscall_nrs_x86",
2477 ":libseccomp_gen_syscall_nrs_x86_64",
2478 ],
2479
2480 out: [
2481 "arm64_system_policy.cpp",
2482 "arm_system_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002483 "x86_64_system_policy.cpp",
2484 "x86_system_policy.cpp",
2485 ],
2486}
2487
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002488cc_library {
2489 name: "libseccomp_policy",
2490 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002491 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002492 generated_sources: [
2493 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002494 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002495 "libseccomp_policy_system_sources",
2496 ],
2497
2498 srcs: [
2499 "seccomp/seccomp_policy.cpp",
2500 ],
2501
2502 export_include_dirs: ["seccomp/include"],
2503 cflags: [
2504 "-Wall",
2505 "-Werror",
2506 ],
2507 shared: {
2508 shared_libs: ["libbase"],
2509 },
2510 static: {
2511 static_libs: ["libbase"],
2512 },
2513}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002514
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002515subdirs = [
2516 "bionic/scudo",
2517]