blob: ce714054a71e372a448b2e13e47621767d9c000f [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",
7 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/pututline.c",
11 "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 "stdlib/exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070021]
22
Peter Collingbourne570de332019-12-11 10:00:58 -080023// off64_t/time64_t support on LP32.
Dan Willemsen208ae172015-09-16 16:33:27 -070024// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -070025libc_common_src_files_32 = [
26 "bionic/legacy_32_bit_support.cpp",
27 "bionic/time64.c",
28]
29
Elliott Hughes53cf3482016-08-09 13:06:41 -070030libc_common_flags = [
31 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080032 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070033 "-Wall",
34 "-Wextra",
35 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080036 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070037 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070038 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070039 "-Wframe-larger-than=2048",
Elliott Hughes53cf3482016-08-09 13:06:41 -070040
41 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
42 "-Werror=pointer-to-int-cast",
43 "-Werror=int-to-pointer-cast",
44 "-Werror=type-limits",
45 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080046
47 // Clang's exit-time destructor registration hides __dso_handle, but
48 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
49 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080050
51 // GWP-ASan requires platform TLS.
52 "-fno-emulated-tls",
Elliott Hughes53cf3482016-08-09 13:06:41 -070053]
54
Dan Willemsen208ae172015-09-16 16:33:27 -070055// Define some common cflags
56// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070057cc_defaults {
58 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080059 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070060 cflags: libc_common_flags,
61 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070062 conlyflags: ["-std=gnu99"],
63 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070064 include_dirs: [
65 "bionic/libc/async_safe/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070066 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070067
Mitch Phillipsf3968e82020-01-31 19:57:04 -080068 header_libs: ["gwp_asan_headers"],
69
Colin Cross50c21ab2015-10-31 23:03:05 -070070 stl: "none",
71 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070072 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070073 address: false,
74 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070075 // TODO(b/132640749): Fix broken fuzzer support.
76 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070077 },
Colin Cross50c21ab2015-10-31 23:03:05 -070078 native_coverage: false,
Yifan Hong5a39cee2020-01-21 16:43:56 -080079 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090080 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020081 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080082
Yi Konge3d90de2019-02-20 14:28:56 -080083 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
84 // warning since this is intended right now.
85 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070086
87 product_variables: {
88 experimental_mte: {
89 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
90 },
91 },
Dan Willemsen208ae172015-09-16 16:33:27 -070092}
93
Christopher Ferris4df29ed2020-01-24 18:06:42 -080094libc_scudo_product_variables = {
95 malloc_not_svelte: {
96 cflags: ["-DUSE_SCUDO"],
97 whole_static_libs: ["libscudo"],
98 exclude_static_libs: [
99 "libjemalloc5",
100 "libc_jemalloc_wrapper",
101 ],
102 },
103}
104
Quallenauge8d733f22020-10-20 21:19:01 +0200105libc32_scudo_product_variables = {
106 malloc_not_svelte_libc32: {
107 cflags: ["-DUSE_SCUDO"],
108 whole_static_libs: ["libscudo"],
109 exclude_static_libs: [
110 "libjemalloc5",
111 "libc_jemalloc_wrapper",
112 ],
113 },
114}
115
116
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700117// Defaults for native allocator libs/includes to make it
118// easier to change.
Christopher Ferris062eba22020-01-31 22:40:45 -0800119// To disable scudo for the non-svelte config remove the line:
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800120// product_variables: libc_scudo_product_variables,
Christopher Ferris062eba22020-01-31 22:40:45 -0800121// in the cc_defaults below.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700122// ========================================================
123cc_defaults {
124 name: "libc_native_allocator_defaults",
125
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700126 whole_static_libs: [
127 "libjemalloc5",
128 "libc_jemalloc_wrapper",
129 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800130 header_libs: ["gwp_asan_headers"],
Quallenauge8d733f22020-10-20 21:19:01 +0200131 multilib: {
132 lib64: {
133 product_variables: libc_scudo_product_variables,
134 },
135 lib32: {
136 product_variables: libc32_scudo_product_variables,
137 }
138 },
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700139}
140
141// Functions not implemented by jemalloc directly, or that need to
142// be modified for Android.
143cc_library_static {
144 name: "libc_jemalloc_wrapper",
145 defaults: ["libc_defaults"],
146 srcs: ["bionic/jemalloc_wrapper.cpp"],
147 cflags: ["-fvisibility=hidden"],
148
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800149 // Used to pull in the jemalloc include directory so that if the
150 // library is removed, the include directory is also removed.
151 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700152}
153
Dan Willemsen208ae172015-09-16 16:33:27 -0700154// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700155// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700156// ========================================================
157//
Ryan Prichard249757b2019-11-01 17:18:28 -0700158// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
159// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
160// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
161// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700162
163cc_library_static {
164
Colin Crossa3f9fca2016-01-11 13:20:55 -0800165 srcs: [
166 "bionic/__libc_init_main_thread.cpp",
167 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700168 "bionic/bionic_call_ifunc_resolver.cpp",
169 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800170 ],
171 arch: {
172 arm64: {
173 srcs: ["arch-arm64/bionic/__set_tls.c"],
174 },
175 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700176 srcs: [
177 "arch-x86/bionic/__libc_init_sysinfo.cpp",
178 "arch-x86/bionic/__set_tls.cpp",
179 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800180 },
181 x86_64: {
182 srcs: ["arch-x86_64/bionic/__set_tls.c"],
183 },
184 },
185
Colin Cross50c21ab2015-10-31 23:03:05 -0700186 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700187 cflags: ["-fno-stack-protector", "-ffreestanding"],
188 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700189}
190
Ryan Prichard249757b2019-11-01 17:18:28 -0700191// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
192// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
193// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800194
195cc_library_static {
196 name: "libc_init_static",
197 defaults: ["libc_defaults"],
198 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700199 cflags: [
200 "-fno-stack-protector",
201
202 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
203 // from the linker before ifunc resolvers have made string.h functions available.
204 "-ffreestanding",
205 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800206}
207
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700208cc_library_static {
209 name: "libc_init_dynamic",
210 defaults: ["libc_defaults"],
211 srcs: ["bionic/libc_init_dynamic.cpp"],
212 cflags: ["-fno-stack-protector"],
213}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800214
Dan Willemsen208ae172015-09-16 16:33:27 -0700215// ========================================================
216// libc_tzcode.a - upstream 'tzcode' code
217// ========================================================
218
219cc_library_static {
220
Colin Cross50c21ab2015-10-31 23:03:05 -0700221 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700222 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800223 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700224 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700225 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
226 ],
227
Colin Cross50c21ab2015-10-31 23:03:05 -0700228 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700229 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700230 // Don't use ridiculous amounts of stack.
231 "-DALL_STATE",
232 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
233 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800234 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700235 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700236 // The name of the tm_gmtoff field in our struct tm.
237 "-DTM_GMTOFF=tm_gmtoff",
238 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700239 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700240 // Include `tzname`, `timezone`, and `daylight` globals.
241 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700242 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800243 // Use the empty string (instead of " ") as the timezone abbreviation
244 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700245 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700246 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
247 "-Dlint",
248 ],
249
Dan Willemsen208ae172015-09-16 16:33:27 -0700250 local_include_dirs: ["tzcode/"],
251 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700252}
253
254// ========================================================
255// libc_dns.a - modified NetBSD DNS code
256// ========================================================
257
258cc_library_static {
259
Colin Cross50c21ab2015-10-31 23:03:05 -0700260 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700261 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800262 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700263
264 "upstream-netbsd/lib/libc/isc/ev_streams.c",
265 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700266 ],
267
Colin Cross50c21ab2015-10-31 23:03:05 -0700268 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700269 "-DANDROID_CHANGES",
270 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700271 "-Wno-unused-parameter",
272 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700273 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700274 ],
275
Dan Willemsen208ae172015-09-16 16:33:27 -0700276 local_include_dirs: [
277 "dns/include",
278 "private",
279 "upstream-netbsd/lib/libc/include",
280 "upstream-netbsd/android/include",
281 ],
282
283 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700284}
285
286// ========================================================
287// libc_freebsd.a - upstream FreeBSD C library code
288// ========================================================
289//
290// These files are built with the freebsd-compat.h header file
291// automatically included.
292
293cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700294 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700295 srcs: [
296 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700297 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700298 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
299 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
300 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
301 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700302 "upstream-freebsd/lib/libc/stdlib/qsort.c",
303 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700304 "upstream-freebsd/lib/libc/string/wcpcpy.c",
305 "upstream-freebsd/lib/libc/string/wcpncpy.c",
306 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700307 "upstream-freebsd/lib/libc/string/wcscat.c",
308 "upstream-freebsd/lib/libc/string/wcschr.c",
309 "upstream-freebsd/lib/libc/string/wcscmp.c",
310 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700311 "upstream-freebsd/lib/libc/string/wcscspn.c",
312 "upstream-freebsd/lib/libc/string/wcsdup.c",
313 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700314 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700315 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
316 "upstream-freebsd/lib/libc/string/wcsncat.c",
317 "upstream-freebsd/lib/libc/string/wcsncmp.c",
318 "upstream-freebsd/lib/libc/string/wcsncpy.c",
319 "upstream-freebsd/lib/libc/string/wcsnlen.c",
320 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700321 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700322 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700323 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700324 "upstream-freebsd/lib/libc/string/wcstok.c",
325 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700326 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700327 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700328 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800329 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700330 ],
331 arch: {
332 arm64: {
333 exclude_srcs: [
334 "upstream-freebsd/lib/libc/string/wmemmove.c",
335 ],
336 },
337 x86: {
338 exclude_srcs: [
339 "upstream-freebsd/lib/libc/string/wcschr.c",
340 "upstream-freebsd/lib/libc/string/wcscmp.c",
341 "upstream-freebsd/lib/libc/string/wcslen.c",
342 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700343 "upstream-freebsd/lib/libc/string/wmemcmp.c",
344 "upstream-freebsd/lib/libc/string/wcscat.c",
345 "upstream-freebsd/lib/libc/string/wcscpy.c",
346 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530347 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700348 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700349 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700350 },
351
Colin Cross50c21ab2015-10-31 23:03:05 -0700352 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700353 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700354 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700355 "-include freebsd-compat.h",
356 ],
357
Dan Willemsen208ae172015-09-16 16:33:27 -0700358 local_include_dirs: [
359 "upstream-freebsd/android/include",
360 ],
361
362 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700363}
364
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700365cc_library_static {
366 defaults: ["libc_defaults"],
367 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700368 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700369 ],
370
371 cflags: [
372 "-Wno-sign-compare",
373 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700374 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700375 ],
376
377 local_include_dirs: [
378 "upstream-freebsd/android/include",
379 ],
380
381 name: "libc_freebsd_large_stack",
382}
383
Dan Willemsen208ae172015-09-16 16:33:27 -0700384// ========================================================
385// libc_netbsd.a - upstream NetBSD C library code
386// ========================================================
387//
388// These files are built with the netbsd-compat.h header file
389// automatically included.
390
391cc_library_static {
392
Colin Cross50c21ab2015-10-31 23:03:05 -0700393 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700394 srcs: [
395 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700396 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700397 "upstream-netbsd/lib/libc/gen/psignal.c",
398 "upstream-netbsd/lib/libc/gen/utime.c",
399 "upstream-netbsd/lib/libc/gen/utmp.c",
400 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
401 "upstream-netbsd/lib/libc/regex/regcomp.c",
402 "upstream-netbsd/lib/libc/regex/regerror.c",
403 "upstream-netbsd/lib/libc/regex/regexec.c",
404 "upstream-netbsd/lib/libc/regex/regfree.c",
405 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700406 "upstream-netbsd/lib/libc/stdlib/drand48.c",
407 "upstream-netbsd/lib/libc/stdlib/erand48.c",
408 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
409 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700410 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
411 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
412 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
413 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
414 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
415 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
416 "upstream-netbsd/lib/libc/stdlib/seed48.c",
417 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700418 ],
419 multilib: {
420 lib32: {
421 // LP32 cruft
422 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
423 },
424 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700425 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700426 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800427 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700428 "-DPOSIX_MISTAKE",
429 "-include netbsd-compat.h",
430 ],
431
Dan Willemsen208ae172015-09-16 16:33:27 -0700432 local_include_dirs: [
433 "upstream-netbsd/android/include",
434 "upstream-netbsd/lib/libc/include",
435 ],
436
437 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700438}
439
440// ========================================================
441// libc_openbsd_ndk.a - upstream OpenBSD C library code
442// that can be safely included in the libc_ndk.a (doesn't
443// contain any troublesome global data or constructors).
444// ========================================================
445//
446// These files are built with the openbsd-compat.h header file
447// automatically included.
448
449cc_library_static {
450 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700451 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700452 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700453 "upstream-openbsd/lib/libc/gen/alarm.c",
454 "upstream-openbsd/lib/libc/gen/ctype_.c",
455 "upstream-openbsd/lib/libc/gen/daemon.c",
456 "upstream-openbsd/lib/libc/gen/err.c",
457 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700458 "upstream-openbsd/lib/libc/gen/fnmatch.c",
459 "upstream-openbsd/lib/libc/gen/ftok.c",
460 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700461 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700462 "upstream-openbsd/lib/libc/gen/verr.c",
463 "upstream-openbsd/lib/libc/gen/verrx.c",
464 "upstream-openbsd/lib/libc/gen/vwarn.c",
465 "upstream-openbsd/lib/libc/gen/vwarnx.c",
466 "upstream-openbsd/lib/libc/gen/warn.c",
467 "upstream-openbsd/lib/libc/gen/warnx.c",
468 "upstream-openbsd/lib/libc/locale/btowc.c",
469 "upstream-openbsd/lib/libc/locale/mbrlen.c",
470 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
471 "upstream-openbsd/lib/libc/locale/mbtowc.c",
472 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700473 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
474 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700475 "upstream-openbsd/lib/libc/locale/wcstoll.c",
476 "upstream-openbsd/lib/libc/locale/wcstombs.c",
477 "upstream-openbsd/lib/libc/locale/wcstoul.c",
478 "upstream-openbsd/lib/libc/locale/wcstoull.c",
479 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
480 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
481 "upstream-openbsd/lib/libc/locale/wctob.c",
482 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700483 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700484 "upstream-openbsd/lib/libc/net/htonl.c",
485 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700486 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
487 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
488 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700489 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
490 "upstream-openbsd/lib/libc/net/inet_ntop.c",
491 "upstream-openbsd/lib/libc/net/inet_pton.c",
492 "upstream-openbsd/lib/libc/net/ntohl.c",
493 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800494 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700495 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700496 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
497 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700498 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700500 "upstream-openbsd/lib/libc/stdio/fputwc.c",
501 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700502 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700503 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700504 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700505 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700506 "upstream-openbsd/lib/libc/stdio/makebuf.c",
507 "upstream-openbsd/lib/libc/stdio/mktemp.c",
508 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
509 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700510 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700511 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700512 "upstream-openbsd/lib/libc/stdio/tempnam.c",
513 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
514 "upstream-openbsd/lib/libc/stdio/ungetc.c",
515 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
516 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
517 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700518 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
519 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
520 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700521 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700522 "upstream-openbsd/lib/libc/stdio/wsetup.c",
523 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800524 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700525 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700526 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700527 "upstream-openbsd/lib/libc/stdlib/insque.c",
528 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
529 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
530 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800531 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700532 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800533 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700534 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700535 "upstream-openbsd/lib/libc/stdlib/remque.c",
536 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700537 "upstream-openbsd/lib/libc/stdlib/tfind.c",
538 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800539 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700540 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800541 "upstream-openbsd/lib/libc/string/strcasestr.c",
542 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700543 "upstream-openbsd/lib/libc/string/strcspn.c",
544 "upstream-openbsd/lib/libc/string/strdup.c",
545 "upstream-openbsd/lib/libc/string/strndup.c",
546 "upstream-openbsd/lib/libc/string/strpbrk.c",
547 "upstream-openbsd/lib/libc/string/strsep.c",
548 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700549 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800550 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700551 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700552 "upstream-openbsd/lib/libc/string/wcswidth.c",
553 ],
554
Colin Cross50c21ab2015-10-31 23:03:05 -0700555 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700556 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700557 "-Wno-unused-parameter",
558 "-include openbsd-compat.h",
559 ],
560
Dan Willemsen208ae172015-09-16 16:33:27 -0700561 local_include_dirs: [
562 "private",
563 "stdio",
564 "upstream-openbsd/android/include",
565 "upstream-openbsd/lib/libc/include",
566 "upstream-openbsd/lib/libc/gdtoa/",
567 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700568}
569
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700570cc_library_static {
571 name: "libc_openbsd_large_stack",
572 defaults: ["libc_defaults"],
573 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700574 "stdio/vfprintf.cpp",
575 "stdio/vfwprintf.cpp",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800576 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700577 ],
578 cflags: [
579 "-include openbsd-compat.h",
580 "-Wno-sign-compare",
581 "-Wframe-larger-than=5000",
582 ],
583
584 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700585 "upstream-openbsd/android/include/",
586 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700587 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700588 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700589 ],
590}
591
Dan Willemsen208ae172015-09-16 16:33:27 -0700592// ========================================================
593// libc_openbsd.a - upstream OpenBSD C library code
594// ========================================================
595//
596// These files are built with the openbsd-compat.h header file
597// automatically included.
598cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700599 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700600 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800601 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700602 "upstream-openbsd/lib/libc/crypt/arc4random.c",
603 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
604
605 // May be overriden by per-arch optimized versions
606 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700607 "upstream-openbsd/lib/libc/string/memrchr.c",
608 "upstream-openbsd/lib/libc/string/stpcpy.c",
609 "upstream-openbsd/lib/libc/string/stpncpy.c",
610 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700611 "upstream-openbsd/lib/libc/string/strcpy.c",
612 "upstream-openbsd/lib/libc/string/strlcat.c",
613 "upstream-openbsd/lib/libc/string/strlcpy.c",
614 "upstream-openbsd/lib/libc/string/strncat.c",
615 "upstream-openbsd/lib/libc/string/strncmp.c",
616 "upstream-openbsd/lib/libc/string/strncpy.c",
617 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700618
619 arch: {
620 arm: {
621 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700622 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800623 "upstream-openbsd/lib/libc/string/stpcpy.c",
624 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700625 ],
626 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700627 arm64: {
628 exclude_srcs: [
629 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700630 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700631 "upstream-openbsd/lib/libc/string/strcpy.c",
632 "upstream-openbsd/lib/libc/string/strncmp.c",
633 ],
634 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700635 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800636 exclude_srcs: [
637 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800638 "upstream-openbsd/lib/libc/string/memrchr.c",
639 "upstream-openbsd/lib/libc/string/stpcpy.c",
640 "upstream-openbsd/lib/libc/string/stpncpy.c",
641 "upstream-openbsd/lib/libc/string/strcat.c",
642 "upstream-openbsd/lib/libc/string/strcpy.c",
643 "upstream-openbsd/lib/libc/string/strncmp.c",
644 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700645 "upstream-openbsd/lib/libc/string/strlcat.c",
646 "upstream-openbsd/lib/libc/string/strlcpy.c",
647 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800648 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700649 },
650
651 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800652 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800653 "upstream-openbsd/lib/libc/string/stpcpy.c",
654 "upstream-openbsd/lib/libc/string/stpncpy.c",
655 "upstream-openbsd/lib/libc/string/strcat.c",
656 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800657 "upstream-openbsd/lib/libc/string/strncat.c",
658 "upstream-openbsd/lib/libc/string/strncmp.c",
659 "upstream-openbsd/lib/libc/string/strncpy.c",
660 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700661 },
662 },
663
Colin Cross50c21ab2015-10-31 23:03:05 -0700664 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700665 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700666 "-Wno-unused-parameter",
667 "-include openbsd-compat.h",
668 ],
669
Dan Willemsen208ae172015-09-16 16:33:27 -0700670 local_include_dirs: [
671 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700672 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700673 ],
674
675 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700676}
677
678// ========================================================
679// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
680// ========================================================
681//
682// These files are built with the openbsd-compat.h header file
683// automatically included.
684
685cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700686 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700687 srcs: [
688 "upstream-openbsd/android/gdtoa_support.cpp",
689 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
690 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
691 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
692 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
693 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
694 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
695 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
696 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
697 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
698 "upstream-openbsd/lib/libc/gdtoa/misc.c",
699 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
700 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
701 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
702 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
703 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
704 "upstream-openbsd/lib/libc/gdtoa/sum.c",
705 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
706 ],
707 multilib: {
708 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800709 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700710 },
711 },
712
Colin Cross50c21ab2015-10-31 23:03:05 -0700713 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700714 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700715 "-include openbsd-compat.h",
716 ],
717
Dan Willemsen208ae172015-09-16 16:33:27 -0700718 local_include_dirs: [
719 "private",
720 "upstream-openbsd/android/include",
721 "upstream-openbsd/lib/libc/include",
722 ],
723
724 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700725}
726
727// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700728// libc_fortify.a - container for our FORITFY
729// implementation details
730// ========================================================
731cc_library_static {
732 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700733 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700734
735 name: "libc_fortify",
736
737 // Disable FORTIFY for the compilation of these, so we don't end up having
738 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800739 cflags: [
740 "-U_FORTIFY_SOURCE",
741 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
742 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700743
744 arch: {
745 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800746 cflags: [
747 "-DNO___MEMCPY_CHK",
748 "-DRENAME___STRCAT_CHK",
749 "-DRENAME___STRCPY_CHK",
750 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700751 srcs: [
752 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800753
754 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
755 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
756
757 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
758 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
759
760 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
761 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
762
763 "arch-arm/krait/bionic/__strcat_chk.S",
764 "arch-arm/krait/bionic/__strcpy_chk.S",
765
766 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
767 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
768
Haibo Huang01bfd892018-12-03 15:05:16 -0800769 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
770 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700771 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700772 },
773 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700774 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700775 srcs: [
776 "arch-arm64/generic/bionic/__memcpy_chk.S",
777 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700778 },
779 },
780}
781
782// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700783// libc_bionic.a - home-grown C library code
784// ========================================================
785
786cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700787 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700788 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800789 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700790 "bionic/sysconf.cpp",
791 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700792 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700793
Josh Gao10ec9282017-04-03 15:13:29 -0700794 // The following must not be statically linked into libc_ndk.a, because
795 // debuggerd will look for the abort message in libc.so's copy.
796 "bionic/android_set_abort_message.cpp",
797
Dan Willemsen208ae172015-09-16 16:33:27 -0700798 "bionic/strchr.cpp",
799 "bionic/strnlen.c",
800 "bionic/strrchr.cpp",
801 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700802
803 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700804 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700805 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700806 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800807 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700808 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800809 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800810 "arch-arm/generic/bionic/stpcpy.c",
811 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800812 "arch-arm/generic/bionic/strcmp.S",
813 "arch-arm/generic/bionic/strcpy.S",
814 "arch-arm/generic/bionic/strlen.c",
815
Ryan Prichard45024fe2018-12-30 21:10:26 -0800816 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700817 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700818 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700819 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700820 "arch-arm/bionic/atomics_arm.c",
821 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800822 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700823 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700824 "arch-arm/bionic/setjmp.S",
825 "arch-arm/bionic/syscall.S",
826 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800827
828 "arch-arm/cortex-a15/bionic/memcpy.S",
829 "arch-arm/cortex-a15/bionic/memmove.S",
830 "arch-arm/cortex-a15/bionic/memset.S",
831 "arch-arm/cortex-a15/bionic/stpcpy.S",
832 "arch-arm/cortex-a15/bionic/strcat.S",
833 "arch-arm/cortex-a15/bionic/strcmp.S",
834 "arch-arm/cortex-a15/bionic/strcpy.S",
835 "arch-arm/cortex-a15/bionic/strlen.S",
836
837 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800838 "arch-arm/cortex-a7/bionic/memset.S",
839
840 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800841 "arch-arm/cortex-a9/bionic/memset.S",
842 "arch-arm/cortex-a9/bionic/stpcpy.S",
843 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800844 "arch-arm/cortex-a9/bionic/strcpy.S",
845 "arch-arm/cortex-a9/bionic/strlen.S",
846
847 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800848 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800849
850 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800851
Haibo Huang01bfd892018-12-03 15:05:16 -0800852 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800853
854 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700855 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700856 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700857 arm64: {
858 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700859 "arch-arm64/generic/bionic/memcmp.S",
860 "arch-arm64/generic/bionic/memcpy.S",
861 "arch-arm64/generic/bionic/memmove.S",
862 "arch-arm64/generic/bionic/memset.S",
863 "arch-arm64/generic/bionic/stpcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700864 "arch-arm64/generic/bionic/strcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700865 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800866
Peter Collingbourne900d07d2019-10-28 13:11:00 -0700867 "arch-arm64/default/bionic/memchr.S",
868 "arch-arm64/default/bionic/strchr.S",
869 "arch-arm64/default/bionic/strcmp.S",
870 "arch-arm64/default/bionic/strlen.S",
871 "arch-arm64/default/bionic/strncmp.S",
872 "arch-arm64/default/bionic/strnlen.S",
873
874 "arch-arm64/mte/bionic/memchr.c",
875 "arch-arm64/mte/bionic/strchr.cpp",
876 "arch-arm64/mte/bionic/strcmp.c",
877 "arch-arm64/mte/bionic/strlen.c",
878 "arch-arm64/mte/bionic/strncmp.c",
879 "arch-arm64/mte/bionic/strnlen.c",
880
Dan Willemsen3e621712016-02-03 21:48:08 -0800881 "arch-arm64/bionic/__bionic_clone.S",
882 "arch-arm64/bionic/_exit_with_stack_teardown.S",
883 "arch-arm64/bionic/setjmp.S",
884 "arch-arm64/bionic/syscall.S",
885 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700886 ],
887 exclude_srcs: [
888 "bionic/__memcpy_chk.cpp",
889 "bionic/strchr.cpp",
890 "bionic/strnlen.c",
891 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700892 },
893
Dan Willemsen208ae172015-09-16 16:33:27 -0700894 x86: {
895 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700896 "arch-x86/generic/string/memcmp.S",
897 "arch-x86/generic/string/strcmp.S",
898 "arch-x86/generic/string/strncmp.S",
899 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700900
901 "arch-x86/generic/string/strlcat.c",
902 "arch-x86/generic/string/strlcpy.c",
903 "arch-x86/generic/string/strncat.c",
904 "arch-x86/generic/string/wcscat.c",
905 "arch-x86/generic/string/wcscpy.c",
906 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530907 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700908
Dan Willemsen208ae172015-09-16 16:33:27 -0700909 "arch-x86/atom/string/sse2-memchr-atom.S",
910 "arch-x86/atom/string/sse2-memrchr-atom.S",
911 "arch-x86/atom/string/sse2-strchr-atom.S",
912 "arch-x86/atom/string/sse2-strnlen-atom.S",
913 "arch-x86/atom/string/sse2-strrchr-atom.S",
914 "arch-x86/atom/string/sse2-wcschr-atom.S",
915 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
916 "arch-x86/atom/string/sse2-wcslen-atom.S",
917 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700918 "arch-x86/silvermont/string/sse2-memmove-slm.S",
919 "arch-x86/silvermont/string/sse2-memset-slm.S",
920 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
921 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
922 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
923 "arch-x86/silvermont/string/sse2-strlen-slm.S",
924 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800925
926 "arch-x86/bionic/__bionic_clone.S",
927 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800928 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800929 "arch-x86/bionic/__restore.S",
930 "arch-x86/bionic/setjmp.S",
931 "arch-x86/bionic/syscall.S",
932 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700933
934 // ssse3 functions
935 "arch-x86/atom/string/ssse3-strcat-atom.S",
936 "arch-x86/atom/string/ssse3-strcmp-atom.S",
937 "arch-x86/atom/string/ssse3-strlcat-atom.S",
938 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
939 "arch-x86/atom/string/ssse3-strncat-atom.S",
940 "arch-x86/atom/string/ssse3-strncmp-atom.S",
941 "arch-x86/atom/string/ssse3-wcscat-atom.S",
942 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
943
944 // sse4 functions
945 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
946 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
947
948 // atom functions
949 "arch-x86/atom/string/sse2-memset-atom.S",
950 "arch-x86/atom/string/sse2-strlen-atom.S",
951 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800952 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700953 "arch-x86/atom/string/ssse3-strcpy-atom.S",
954 "arch-x86/atom/string/ssse3-strncpy-atom.S",
955 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530956
957 // avx2 functions
958 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700959 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700960
961 exclude_srcs: [
962 "bionic/strchr.cpp",
963 "bionic/strnlen.c",
964 "bionic/strrchr.cpp",
965 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700966 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700967 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700968 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700969 "arch-x86_64/string/sse2-memmove-slm.S",
970 "arch-x86_64/string/sse2-memset-slm.S",
971 "arch-x86_64/string/sse2-stpcpy-slm.S",
972 "arch-x86_64/string/sse2-stpncpy-slm.S",
973 "arch-x86_64/string/sse2-strcat-slm.S",
974 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700975 "arch-x86_64/string/sse2-strlen-slm.S",
976 "arch-x86_64/string/sse2-strncat-slm.S",
977 "arch-x86_64/string/sse2-strncpy-slm.S",
978 "arch-x86_64/string/sse4-memcmp-slm.S",
979 "arch-x86_64/string/ssse3-strcmp-slm.S",
980 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530981 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800982
983 "arch-x86_64/bionic/__bionic_clone.S",
984 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
985 "arch-x86_64/bionic/__restore_rt.S",
986 "arch-x86_64/bionic/setjmp.S",
987 "arch-x86_64/bionic/syscall.S",
988 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700989 ],
990 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700991 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700992
Colin Cross50c21ab2015-10-31 23:03:05 -0700993 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700994 include_dirs: ["bionic/libstdc++/include"],
995 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700996}
997
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000998genrule {
999 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001000 out: ["generated_android_ids.h"],
1001 srcs: [":android_filesystem_config_header"],
1002 tool_files: ["fs_config_generator.py"],
1003 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001004}
1005
Dan Willemsen268a6732015-10-15 14:49:45 -07001006// ========================================================
1007// libc_bionic_ndk.a- The portions of libc_bionic that can
1008// be safely used in libc_ndk.a (no troublesome global data
1009// or constructors).
1010// ========================================================
1011cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001012 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001013 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001014 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001015 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001016 "bionic/__cmsg_nxthdr.cpp",
1017 "bionic/__errno.cpp",
1018 "bionic/__gnu_basename.cpp",
1019 "bionic/__libc_current_sigrtmax.cpp",
1020 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001021 "bionic/abort.cpp",
1022 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001023 "bionic/access.cpp",
1024 "bionic/arpa_inet.cpp",
1025 "bionic/assert.cpp",
1026 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001027 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001028 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001029 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001030 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001031 "bionic/bionic_systrace.cpp",
1032 "bionic/bionic_time_conversions.cpp",
1033 "bionic/brk.cpp",
1034 "bionic/c16rtomb.cpp",
1035 "bionic/c32rtomb.cpp",
1036 "bionic/chmod.cpp",
1037 "bionic/chown.cpp",
1038 "bionic/clearenv.cpp",
1039 "bionic/clock.cpp",
1040 "bionic/clock_getcpuclockid.cpp",
1041 "bionic/clock_nanosleep.cpp",
1042 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001043 "bionic/ctype.cpp",
1044 "bionic/dirent.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001045 "bionic/dup.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001046 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001047 "bionic/error.cpp",
Josh Gaobc796382020-04-29 17:08:46 -07001048 "bionic/eventfd.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001049 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001050 "bionic/faccessat.cpp",
1051 "bionic/fchmod.cpp",
1052 "bionic/fchmodat.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001053 "bionic/fcntl.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001054 "bionic/fdsan.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001055 "bionic/fdtrack.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001056 "bionic/ffs.cpp",
1057 "bionic/fgetxattr.cpp",
1058 "bionic/flistxattr.cpp",
1059 "bionic/flockfile.cpp",
1060 "bionic/fpclassify.cpp",
1061 "bionic/fsetxattr.cpp",
1062 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001063 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001064 "bionic/futimens.cpp",
1065 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001066 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001067 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001068 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001069 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001070 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001071 "bionic/getpgrp.cpp",
1072 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001073 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001074 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001075 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001076 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001077 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001078 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001079 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001080 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001081 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001082 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001083 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001084 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001085 "bionic/lchown.cpp",
1086 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001087 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001088 "bionic/libgen.cpp",
1089 "bionic/link.cpp",
1090 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001091 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001092 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001093 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001094 "bionic/mbrtoc16.cpp",
1095 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001096 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001097 "bionic/mempcpy.cpp",
1098 "bionic/mkdir.cpp",
1099 "bionic/mkfifo.cpp",
1100 "bionic/mknod.cpp",
1101 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001102 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001103 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001104 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001105 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001106 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001107 "bionic/open.cpp",
1108 "bionic/pathconf.cpp",
1109 "bionic/pause.cpp",
1110 "bionic/pipe.cpp",
1111 "bionic/poll.cpp",
1112 "bionic/posix_fadvise.cpp",
1113 "bionic/posix_fallocate.cpp",
1114 "bionic/posix_madvise.cpp",
1115 "bionic/posix_timers.cpp",
1116 "bionic/ptrace.cpp",
1117 "bionic/pty.cpp",
1118 "bionic/raise.cpp",
1119 "bionic/rand.cpp",
1120 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001121 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001122 "bionic/reboot.cpp",
1123 "bionic/recv.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001124 "bionic/recvmsg.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001125 "bionic/rename.cpp",
1126 "bionic/rmdir.cpp",
1127 "bionic/scandir.cpp",
1128 "bionic/sched_getaffinity.cpp",
1129 "bionic/sched_getcpu.cpp",
1130 "bionic/semaphore.cpp",
1131 "bionic/send.cpp",
1132 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001133 "bionic/seteuid.cpp",
1134 "bionic/setpgrp.cpp",
1135 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001136 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001137 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001138 "bionic/sleep.cpp",
Josh Gaoc984b2c2020-04-29 17:17:56 -07001139 "bionic/socketpair.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001140 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001141 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001142 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001143 "bionic/strchrnul.cpp",
1144 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001145 "bionic/string_l.cpp",
1146 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001147 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001148 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001149 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001150 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001151 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001152 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001153 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001154 "bionic/sys_msg.cpp",
1155 "bionic/sys_sem.cpp",
1156 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001157 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001158 "bionic/sys_statfs.cpp",
1159 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001160 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001161 "bionic/sysinfo.cpp",
1162 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001163 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001164 "bionic/system_property_api.cpp",
1165 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001166 "bionic/tdestroy.cpp",
1167 "bionic/termios.cpp",
1168 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001169 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001170 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001171 "bionic/tmpfile.cpp",
1172 "bionic/umount.cpp",
1173 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001174 "bionic/usleep.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001175 "bionic/wait.cpp",
1176 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001177 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001178 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001179 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001180 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001181 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001182
1183 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1184 // which will be overridden by the actual one in libc.so.
1185 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001186 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001187
Dan Willemsen208ae172015-09-16 16:33:27 -07001188 multilib: {
1189 lib32: {
1190 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001191 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001192 },
1193 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001194 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001195 treble_linker_namespaces: {
1196 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001197 },
1198 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001199 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001200 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001201 local_include_dirs: ["stdio"],
1202 include_dirs: ["bionic/libstdc++/include"],
1203 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001204 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001205}
1206
Dan Willemsen208ae172015-09-16 16:33:27 -07001207// ========================================================
1208// libc_pthread.a - pthreads parts that previously lived in
1209// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001210// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001211// pthread_t has changed over the years and has ABI
1212// compatibility issues).
1213// ========================================================
1214
1215cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001216 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001217 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001218 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001219 "bionic/pthread_atfork.cpp",
1220 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001221 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001222 "bionic/pthread_cond.cpp",
1223 "bionic/pthread_create.cpp",
1224 "bionic/pthread_detach.cpp",
1225 "bionic/pthread_equal.cpp",
1226 "bionic/pthread_exit.cpp",
1227 "bionic/pthread_getcpuclockid.cpp",
1228 "bionic/pthread_getschedparam.cpp",
1229 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001230 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001231 "bionic/pthread_join.cpp",
1232 "bionic/pthread_key.cpp",
1233 "bionic/pthread_kill.cpp",
1234 "bionic/pthread_mutex.cpp",
1235 "bionic/pthread_once.cpp",
1236 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001237 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001238 "bionic/pthread_self.cpp",
1239 "bionic/pthread_setname_np.cpp",
1240 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001241 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001242
1243 // The following implementations depend on pthread data or implementation,
1244 // so we can't include them in libc_ndk.a.
1245 "bionic/__cxa_thread_atexit_impl.cpp",
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001246 "bionic/android_unsafe_frame_pointer_chase.cpp",
Ryan Prichard58cbfd92020-02-04 15:46:15 -08001247 "bionic/atexit.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001248 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001249 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001250
Colin Cross50c21ab2015-10-31 23:03:05 -07001251 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001252 include_dirs: ["bionic/libstdc++/include"],
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001253 header_libs: ["bionic_libc_platform_headers"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001254 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001255}
1256
1257// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001258// libc_syscalls.a
1259// ========================================================
1260
Elliott Hughes782c4852019-04-16 12:31:00 -07001261genrule {
1262 name: "syscalls-arm.S",
1263 out: ["syscalls-arm.S"],
1264 srcs: ["SYSCALLS.TXT"],
1265 tool_files: [":bionic-gensyscalls"],
1266 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1267}
1268
1269genrule {
1270 name: "syscalls-arm64.S",
1271 out: ["syscalls-arm64.S"],
1272 srcs: ["SYSCALLS.TXT"],
1273 tool_files: [":bionic-gensyscalls"],
1274 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1275}
1276
1277genrule {
1278 name: "syscalls-x86.S",
1279 out: ["syscalls-x86.S"],
1280 srcs: ["SYSCALLS.TXT"],
1281 tool_files: [":bionic-gensyscalls"],
1282 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1283}
1284
1285genrule {
1286 name: "syscalls-x86_64.S",
1287 out: ["syscalls-x86_64.S"],
1288 srcs: ["SYSCALLS.TXT"],
1289 tool_files: [":bionic-gensyscalls"],
1290 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1291}
1292
Dan Willemsen208ae172015-09-16 16:33:27 -07001293cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001294 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001295 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001296 arch: {
1297 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001298 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001299 },
1300 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001301 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001302 },
1303 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001304 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001305 },
1306 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001307 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001308 },
1309 },
1310 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001311}
1312
1313// ========================================================
1314// libc_aeabi.a
1315// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1316// to avoid infinite recursion. For the other architectures we just build an
1317// empty library to keep this makefile simple.
1318// ========================================================
1319
1320cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001321 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001322 arch: {
1323 arm: {
1324 srcs: ["arch-arm/bionic/__aeabi.c"],
1325 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001326 },
1327 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001328 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001329}
1330
1331// ========================================================
1332// libc_ndk.a
1333// Compatibility library for the NDK. This library contains
1334// all the parts of libc that are safe to statically link.
1335// We can't safely statically link things that can only run
1336// on a certain version of the OS. Examples include
1337// anything that talks to netd (a large portion of the DNS
1338// code) and anything that is dependent on the layout of a
1339// data structure that has changed across releases (such as
1340// pthread_t).
1341// ========================================================
1342
1343cc_library_static {
1344 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001345 defaults: [
1346 "libc_defaults",
1347 "libc_native_allocator_defaults",
1348 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -08001349 ramdisk_available: false,
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001350 srcs: libc_common_src_files + [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001351 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001352 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001353 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001354 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001355 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001356 multilib: {
1357 lib32: {
1358 srcs: libc_common_src_files_32,
1359 },
1360 },
1361 arch: {
1362 arm: {
1363 srcs: [
1364 "arch-arm/bionic/exidx_dynamic.c",
1365 "arch-common/bionic/crtbegin_so.c",
1366 "arch-arm/bionic/atexit_legacy.c",
1367 "arch-common/bionic/crtend_so.S",
1368 ],
1369 whole_static_libs: ["libc_aeabi"],
1370 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001371 },
1372
Colin Cross50c21ab2015-10-31 23:03:05 -07001373 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001374 "-fvisibility=hidden",
1375 "-DLIBC_STATIC",
1376 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001377
1378 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001379 "gwp_asan",
Dan Willemsen208ae172015-09-16 16:33:27 -07001380 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001381 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001382 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001383 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001384 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001385 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001386 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001387 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001388 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001389 "libc_syscalls",
1390 "libc_tzcode",
1391 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001392 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001393 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001394}
1395
1396// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001397// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001398// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001399cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001400 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001401 srcs: libc_common_src_files,
1402 multilib: {
1403 lib32: {
1404 srcs: libc_common_src_files_32,
1405 },
1406 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001407 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001408
1409 whole_static_libs: [
1410 "libc_bionic",
1411 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001412 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001413 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001414 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001415 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001416 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001417 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001418 "libc_netbsd",
1419 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001420 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001421 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001422 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001423 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001424 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001425 ],
1426
1427 arch: {
1428 arm: {
1429 whole_static_libs: ["libc_aeabi"],
1430 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001431 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001432}
1433
1434// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001435// libc_common.a
1436// ========================================================
1437
1438cc_library_static {
1439 defaults: ["libc_defaults"],
1440 name: "libc_common",
1441
1442 whole_static_libs: [
1443 "libc_nopthread",
1444 "libc_pthread",
1445 ],
1446}
1447
1448// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001449// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001450// ========================================================
1451cc_library_static {
1452 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001453 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001454
Haibo Huangb9244ff2018-08-11 10:12:13 -07001455 arch: {
1456 x86: {
1457 srcs: ["arch-x86/static_function_dispatch.S"],
1458 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001459 arm: {
1460 srcs: ["arch-arm/static_function_dispatch.S"],
1461 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001462 arm64: {
1463 srcs: ["arch-arm64/static_function_dispatch.S"],
1464 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001465 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001466}
1467
1468// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001469// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001470// ========================================================
1471cc_library_static {
1472 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001473 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001474
Haibo Huangb9244ff2018-08-11 10:12:13 -07001475 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001476 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001477 "-fno-stack-protector",
1478 "-fno-jump-tables",
1479 ],
1480 arch: {
1481 x86: {
1482 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1483 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001484 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001485 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001486 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001487 arm64: {
1488 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1489 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001490 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001491}
1492
1493// ========================================================
1494// libc_common_static.a For static binaries.
1495// ========================================================
1496cc_library_static {
1497 defaults: ["libc_defaults"],
1498 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001499
Haibo Huangf71edfa2018-11-12 10:06:56 -08001500 whole_static_libs: [
1501 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001502 "libc_static_dispatch",
1503 ],
1504}
1505
1506// ========================================================
1507// libc_common_shared.a For shared libraries.
1508// ========================================================
1509cc_library_static {
1510 defaults: ["libc_defaults"],
1511 name: "libc_common_shared",
1512
1513 whole_static_libs: [
1514 "libc_common",
1515 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001516 ],
1517}
1518
Ryan Prichard22a6a052019-10-10 23:59:30 -07001519// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1520// executable.
1521cc_library_static {
1522 name: "libc_unwind_static",
1523 defaults: ["libc_defaults"],
1524 cflags: ["-DLIBC_STATIC"],
1525
1526 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1527 arch: {
1528 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1529 arm: {
1530 srcs: ["arch-arm/bionic/exidx_static.c"],
1531 },
1532 },
1533}
1534
Haibo Huangf71edfa2018-11-12 10:06:56 -08001535// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001536// libc_nomalloc.a
1537// ========================================================
1538//
Ryan Prichard249757b2019-11-01 17:18:28 -07001539// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1540// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1541// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001542
1543cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001544 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001545 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001546
Colin Crossa3f9fca2016-01-11 13:20:55 -08001547 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001548 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001549 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001550 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001551 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001552}
1553
dimitryc0c0ef62018-12-05 16:33:52 +01001554filegroup {
1555 name: "libc_sources_shared",
1556 srcs: [
1557 "arch-common/bionic/crtbegin_so.c",
1558 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001559 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001560 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001561 "bionic/icu.cpp",
1562 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001563 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001564 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001565 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001566 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001567 "bionic/ndk_cruft.cpp",
1568 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001569 "bionic/NetdClient.cpp",
1570 "arch-common/bionic/crtend_so.S",
1571 ],
1572}
1573
1574filegroup {
1575 name: "libc_sources_static",
1576 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001577 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001578 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001579 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001580 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001581 ],
1582}
1583
1584filegroup {
1585 name: "libc_sources_shared_arm",
1586 srcs: [
1587 "arch-arm/bionic/exidx_dynamic.c",
1588 "arch-arm/bionic/atexit_legacy.c",
1589 ],
1590}
1591
Dan Willemsen208ae172015-09-16 16:33:27 -07001592// ========================================================
1593// libc.a + libc.so
1594// ========================================================
1595cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001596 defaults: [
1597 "libc_defaults",
1598 "libc_native_allocator_defaults",
1599 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001600 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001601 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001602 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001603 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001604 platform_sdk_version: {
1605 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1606 },
1607 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001608 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001609 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001610 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001611 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001612 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001613 "libc_init_static",
1614 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001615 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001616 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001617 },
1618 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001619 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001620 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001621 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001622 "libc_init_dynamic",
1623 "libc_common_shared",
1624 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001625 },
1626
Neil Fullera7db90f2019-04-25 09:28:27 +01001627 required: [
1628 "tzdata",
1629 "tz_version", // Version metadata for tzdata to help debugging.
1630 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001631
Colin Cross4ce94d22016-11-15 13:15:43 -08001632 // Do not pack libc.so relocations; see http://b/20645321 for details.
1633 pack_relocations: false,
1634
dimitry06016f22018-01-05 11:39:28 +01001635 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1636 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1637 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1638 // those new libraries from libgcc.a are not declared external; if that were the case,
1639 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1640 // on the external symbols from the dependent libraries. That would create a "cloaked"
1641 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001642
dimitry06016f22018-01-05 11:39:28 +01001643 shared_libs: [
1644 "ld-android",
1645 "libdl",
1646 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001647 static_libs: [
1648 "libdl_android",
1649 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001650
1651 nocrt: true,
1652
Dan Willemsen208ae172015-09-16 16:33:27 -07001653 arch: {
1654 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001655 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001656 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001657 ldflags: ["-Wl,--hash-style=both"],
1658
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001659 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001660
Dan Willemsen208ae172015-09-16 16:33:27 -07001661 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001662 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001663 // special for arm
1664 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001665 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001666
1667 // Arm 32 bit does not produce complete exidx unwind information
1668 // so keep the .debug_frame which is relatively small and does
1669 // include needed unwind information.
1670 // See b/132992102 for details.
1671 strip: {
1672 keep_symbols_and_debug_frame: true,
1673 },
Peter Collingbourneb061e772019-11-12 14:26:21 -08001674
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001675 whole_static_libs: [ "libunwind_llvm" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001676 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001677 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001678 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001679
1680 // Leave the symbols in the shared library so that stack unwinders can produce
1681 // meaningful name resolution.
1682 strip: {
1683 keep_symbols: true,
1684 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001685
1686 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001687 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001688 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001689 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001690 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001691 ldflags: ["-Wl,--hash-style=both"],
1692
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001693 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001694
1695 // Leave the symbols in the shared library so that stack unwinders can produce
1696 // meaningful name resolution.
1697 strip: {
1698 keep_symbols: true,
1699 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001700
1701 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001702 },
1703 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001704 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001705
1706 // Leave the symbols in the shared library so that stack unwinders can produce
1707 // meaningful name resolution.
1708 strip: {
1709 keep_symbols: true,
1710 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001711
1712 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001713 },
1714 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001715
1716 stubs: {
1717 symbol_file: "libc.map.txt",
Jooyung Han71289232020-02-27 18:33:25 +09001718 versions: [
1719 "29",
Jooyung Han75e79c92020-03-30 13:18:44 +09001720 "R",
Jooyung Han71289232020-02-27 18:33:25 +09001721 "10000",
1722 ],
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001723 },
Vic Yang6903fb82019-01-14 11:34:39 -08001724
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001725 apex_available: [
1726 "//apex_available:platform",
1727 "com.android.runtime",
1728 ],
1729
Vic Yang03ff4362019-06-24 16:11:37 -07001730 // Sorting bss symbols by size usually results in less dirty pages at run
1731 // time, because small symbols are grouped together.
1732 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001733}
1734
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001735genrule {
1736 name: "libc.arm.map",
1737 out: ["libc.arm.map"],
1738 srcs: ["libc.map.txt"],
1739 tool_files: [":bionic-generate-version-script"],
1740 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1741}
1742
1743genrule {
1744 name: "libc.arm64.map",
1745 out: ["libc.arm64.map"],
1746 srcs: ["libc.map.txt"],
1747 tool_files: [":bionic-generate-version-script"],
1748 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1749}
1750
1751genrule {
1752 name: "libc.x86.map",
1753 out: ["libc.x86.map"],
1754 srcs: ["libc.map.txt"],
1755 tool_files: [":bionic-generate-version-script"],
1756 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1757}
1758
1759genrule {
1760 name: "libc.x86_64.map",
1761 out: ["libc.x86_64.map"],
1762 srcs: ["libc.map.txt"],
1763 tool_files: [":bionic-generate-version-script"],
1764 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1765}
1766
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001767// Headers that only other parts of the platform can include.
1768cc_library_headers {
1769 name: "bionic_libc_platform_headers",
1770 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001771 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001772 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001773 "//frameworks:__subpackages__",
Roman Kiryanovb47eeab2020-05-07 14:58:30 -07001774 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips4b8a17d2020-03-25 15:05:48 -07001775 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001776 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001777 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001778 "//system/core/debuggerd:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001779 "//system/memory/libmemunreachable:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001780 ],
1781 host_supported: true,
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001782 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001783 ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001784 recovery_available: true,
1785 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001786 export_include_dirs: [
1787 "platform",
1788 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001789 system_shared_libs: [],
1790 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001791 sdk_version: "current",
Jiyong Park693a7212020-04-28 18:21:08 +09001792
1793 apex_available: [
1794 "//apex_available:platform",
1795 "com.android.runtime",
1796 "com.android.art.release", // from libdexfile_external
1797 "com.android.art.debug", // from libdexfile_external
1798 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001799}
1800
Logan Chien17af91b2019-01-15 21:19:56 +08001801// libc_headers for libasync_safe and libpropertyinfoparser
1802cc_library_headers {
1803 name: "libc_headers",
1804
1805 host_supported: true,
1806 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001807 ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001808 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001809 native_bridge_supported: true,
Jiyong Park8481da42020-03-07 17:35:02 +09001810 apex_available: [
1811 "//apex_available:platform",
Jiyong Park71950622020-03-30 18:36:07 +09001812 "//apex_available:anyapex",
1813 ],
Jooyung Han01e19d22020-04-16 18:26:45 +09001814 // used by most APEXes indirectly via libunwind_llvm
1815 min_sdk_version: "apex_inherit",
Jiyong Park71950622020-03-30 18:36:07 +09001816 visibility: [
1817 ":__subpackages__", // visible to bionic
1818 // ... and only to these places (b/152668052)
1819 "//external/gwp_asan",
1820 "//external/libunwind_llvm",
1821 "//system/core/property_service/libpropertyinfoparser",
1822 "//system/extras/toolchain-extras",
Jiyong Park8481da42020-03-07 17:35:02 +09001823 ],
Logan Chien17af91b2019-01-15 21:19:56 +08001824
1825 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001826 stl: "none",
1827 system_shared_libs: [],
1828
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001829 // The build system generally requires that any dependencies of a target
1830 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1831 // to 1 we let targets with an sdk_version that need to depend on the libc
1832 // headers but cannot depend on libc itself due to circular dependencies
1833 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1834 // is correct because the headers can support any sdk_version.
1835 sdk_version: "1",
1836
Logan Chien17af91b2019-01-15 21:19:56 +08001837 export_include_dirs: [
1838 "include",
1839 "kernel/uapi",
1840 "kernel/android/uapi",
1841 ],
1842
1843 arch: {
1844 arm: {
1845 export_include_dirs: [
1846 "kernel/uapi/asm-arm",
1847 ],
1848 },
1849 arm64: {
1850 export_include_dirs: [
1851 "kernel/uapi/asm-arm64",
1852 ],
1853 },
Logan Chien17af91b2019-01-15 21:19:56 +08001854 x86: {
1855 export_include_dirs: [
1856 "kernel/uapi/asm-x86",
1857 ],
1858 },
1859 x86_64: {
1860 export_include_dirs: [
1861 "kernel/uapi/asm-x86",
1862 ],
1863 },
1864 },
1865}
1866
Dan Willemsen208ae172015-09-16 16:33:27 -07001867// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001868// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001869// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001870
Dan Willemsen208ae172015-09-16 16:33:27 -07001871cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001872 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001873 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001874 srcs: [
1875 "bionic/__cxa_guard.cpp",
1876 "bionic/__cxa_pure_virtual.cpp",
1877 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001878 ],
1879 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001880 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001881 static_libs: ["libasync_safe"],
Rashed Abdel-Tawab19bd98f2018-04-15 10:18:26 -07001882 vendor_available: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001883
Dan Willemsen6b3be172018-12-03 13:57:20 -08001884 static: {
1885 system_shared_libs: [],
1886 },
1887 shared: {
1888 system_shared_libs: ["libc"],
1889 },
1890
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001891 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001892 arch: {
1893 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001894 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001895 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001896 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001897 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001898 },
1899 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001900 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001901 },
1902 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001903 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001904 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001905 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001906 },
1907 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001908 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001909 },
1910 },
1911}
1912
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001913genrule {
1914 name: "libstdc++.arm.map",
1915 out: ["libstdc++.arm.map"],
1916 srcs: ["libstdc++.map.txt"],
1917 tool_files: [":bionic-generate-version-script"],
1918 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1919}
1920
1921genrule {
1922 name: "libstdc++.arm64.map",
1923 out: ["libstdc++.arm64.map"],
1924 srcs: ["libstdc++.map.txt"],
1925 tool_files: [":bionic-generate-version-script"],
1926 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1927}
1928
1929genrule {
1930 name: "libstdc++.x86.map",
1931 out: ["libstdc++.x86.map"],
1932 srcs: ["libstdc++.map.txt"],
1933 tool_files: [":bionic-generate-version-script"],
1934 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1935}
1936
1937genrule {
1938 name: "libstdc++.x86_64.map",
1939 out: ["libstdc++.x86_64.map"],
1940 srcs: ["libstdc++.map.txt"],
1941 tool_files: [":bionic-generate-version-script"],
1942 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1943}
1944
1945// ========================================================
1946// crt object files.
1947// ========================================================
1948
Colin Cross50c21ab2015-10-31 23:03:05 -07001949cc_defaults {
1950 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001951 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001952 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001953 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001954 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001955 native_bridge_supported: true,
Jiyong Park8481da42020-03-07 17:35:02 +09001956 apex_available: [
1957 "//apex_available:platform",
1958 "//apex_available:anyapex",
1959 ],
Jooyung Han01e19d22020-04-16 18:26:45 +09001960 // crt* objects are used by most cc_binary/cc_library in "anyapex"
1961 min_sdk_version: "apex_inherit",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001962 cflags: [
1963 "-Wno-gcc-compat",
1964 "-Wall",
1965 "-Werror",
1966 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07001967 sanitize: {
1968 never: true,
1969 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001970}
1971
Colin Cross50c21ab2015-10-31 23:03:05 -07001972cc_defaults {
1973 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001974 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001975
1976 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07001977 x86: {
1978 cflags: ["-fPIC"],
1979 },
1980 x86_64: {
1981 cflags: ["-fPIC"],
1982 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001983 },
Colin Crossab179442018-09-27 11:03:22 -07001984 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001985}
1986
Dan Willemsen208ae172015-09-16 16:33:27 -07001987cc_object {
1988 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001989 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001990 local_include_dirs: ["include"],
1991 product_variables: {
1992 platform_sdk_version: {
1993 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1994 },
1995 },
1996 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001997
Colin Cross7d7b3682017-11-03 13:38:40 -07001998 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001999}
2000
Dan Willemsen208ae172015-09-16 16:33:27 -07002001cc_object {
2002 name: "crtbegin_so1",
2003 local_include_dirs: ["include"],
2004 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002005
Colin Cross7d7b3682017-11-03 13:38:40 -07002006 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002007}
2008
Dan Willemsen208ae172015-09-16 16:33:27 -07002009cc_object {
2010 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002011
Colin Cross7d7b3682017-11-03 13:38:40 -07002012 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002013 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002014 "crtbegin_so1",
2015 "crtbrand",
2016 ],
2017}
2018
Dan Willemsen208ae172015-09-16 16:33:27 -07002019cc_object {
2020 name: "crtend_so",
2021 local_include_dirs: ["include"],
2022 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002023
Colin Cross7d7b3682017-11-03 13:38:40 -07002024 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002025}
2026
Dan Willemsen208ae172015-09-16 16:33:27 -07002027cc_object {
2028 name: "crtbegin_static1",
2029 local_include_dirs: ["include"],
2030 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002031 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002032}
2033
Dan Willemsen208ae172015-09-16 16:33:27 -07002034cc_object {
2035 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002036
Colin Cross77d57bf2016-04-11 14:34:18 -07002037 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002038 "crtbegin_static1",
2039 "crtbrand",
2040 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002041 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002042}
2043
Dan Willemsen208ae172015-09-16 16:33:27 -07002044cc_object {
2045 name: "crtbegin_dynamic1",
2046 local_include_dirs: ["include"],
2047 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002048 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002049}
2050
Dan Willemsen208ae172015-09-16 16:33:27 -07002051cc_object {
2052 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002053
Colin Cross77d57bf2016-04-11 14:34:18 -07002054 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002055 "crtbegin_dynamic1",
2056 "crtbrand",
2057 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002058 target: {
2059 linux_bionic: {
2060 generated_sources: ["host_bionic_linker_asm"],
2061 objs: [
2062 "linker_wrapper",
2063 ],
2064 },
2065 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002066 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002067}
2068
Dan Willemsen208ae172015-09-16 16:33:27 -07002069cc_object {
2070 // We rename crtend.o to crtend_android.o to avoid a
2071 // name clash between gcc and bionic.
2072 name: "crtend_android",
2073 local_include_dirs: ["include"],
2074 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002075
Colin Cross50c21ab2015-10-31 23:03:05 -07002076 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002077}
Colin Crossbaa48992016-07-13 11:15:21 -07002078
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002079// ========================================================
2080// NDK headers.
2081// ========================================================
2082
Dan Albert26e1c412018-05-24 14:56:46 -07002083versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002084 name: "common_libc",
2085 from: "include",
2086 to: "",
2087 license: "NOTICE",
2088}
Dan Albert4238a352016-06-28 11:18:05 -07002089
2090ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002091 name: "libc_uapi",
2092 from: "kernel/uapi",
2093 to: "",
2094 srcs: [
2095 "kernel/uapi/asm-generic/**/*.h",
2096 "kernel/uapi/drm/**/*.h",
2097 "kernel/uapi/linux/**/*.h",
2098 "kernel/uapi/misc/**/*.h",
2099 "kernel/uapi/mtd/**/*.h",
2100 "kernel/uapi/rdma/**/*.h",
2101 "kernel/uapi/scsi/**/*.h",
2102 "kernel/uapi/sound/**/*.h",
2103 "kernel/uapi/video/**/*.h",
2104 "kernel/uapi/xen/**/*.h",
2105 ],
Dan Albert92592652016-10-20 01:42:54 -07002106 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002107}
2108
2109ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002110 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002111 from: "kernel/android/uapi/linux",
2112 to: "linux",
2113 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002114 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002115}
2116
2117ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002118 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002119 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002120 to: "scsi",
2121 srcs: ["kernel/android/scsi/**/*.h"],
2122 license: "NOTICE",
2123}
2124
2125ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002126 name: "libc_asm_arm",
2127 from: "kernel/uapi/asm-arm",
2128 to: "arm-linux-androideabi",
2129 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002130 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002131}
2132
2133ndk_headers {
2134 name: "libc_asm_arm64",
2135 from: "kernel/uapi/asm-arm64",
2136 to: "aarch64-linux-android",
2137 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002138 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002139}
2140
Lazar Trsic790d2f72017-11-27 11:54:11 +01002141ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002142 name: "libc_asm_x86",
2143 from: "kernel/uapi/asm-x86",
2144 to: "i686-linux-android",
2145 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002146 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002147}
2148
2149ndk_headers {
2150 name: "libc_asm_x86_64",
2151 from: "kernel/uapi/asm-x86",
2152 to: "x86_64-linux-android",
2153 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002154 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002155}
2156
Dan Albert4238a352016-06-28 11:18:05 -07002157ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002158 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002159 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002160 symbol_file: "libc.map.txt",
2161 first_version: "9",
2162}
2163
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002164llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002165 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002166 symbol_file: "libc.map.txt",
2167 export_headers_as_system: true,
2168 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002169 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002170 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002171 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002172 "kernel/android/uapi",
2173 "kernel/uapi",
2174 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002175 arch: {
2176 arm: {
2177 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002178 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002179 ],
2180 },
2181 arm64: {
2182 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002183 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002184 ],
2185 },
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002186 x86: {
2187 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002188 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002189 ],
2190 },
2191 x86_64: {
2192 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002193 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002194 ],
2195 },
2196 },
2197}
2198
Dan Albertdf31aff2016-10-06 15:50:41 -07002199ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002200 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002201 symbol_file: "libstdc++.map.txt",
2202 first_version: "9",
2203}
2204
Dan Willemsenca056d72018-01-08 14:00:24 -08002205// Export these headers for toolbox to process
2206filegroup {
2207 name: "kernel_input_headers",
2208 srcs: [
2209 "kernel/uapi/linux/input.h",
2210 "kernel/uapi/linux/input-event-codes.h",
2211 ],
2212}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002213
2214// Generate a syscall name / number mapping. These objects are text files
2215// (thanks to the -dD -E flags) and not binary files. They will then be
2216// consumed by the genseccomp.py script and converted into C++ code.
2217cc_defaults {
2218 name: "libseccomp_gen_syscall_nrs_defaults",
2219 recovery_available: true,
2220 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2221 cflags: [
2222 "-dD",
2223 "-E",
2224 "-Wall",
2225 "-Werror",
2226 "-nostdinc",
2227 ],
2228}
2229
2230cc_object {
2231 name: "libseccomp_gen_syscall_nrs_arm",
2232 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2233 local_include_dirs: [
2234 "kernel/uapi/asm-arm",
2235 "kernel/uapi",
2236 ],
2237}
2238
2239cc_object {
2240 name: "libseccomp_gen_syscall_nrs_arm64",
2241 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2242 local_include_dirs: [
2243 "kernel/uapi/asm-arm64",
2244 "kernel/uapi",
2245 ],
2246}
2247
2248cc_object {
2249 name: "libseccomp_gen_syscall_nrs_x86",
2250 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2251 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2252 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2253 local_include_dirs: [
2254 "kernel/uapi/asm-x86",
2255 "kernel/uapi",
2256 ],
2257}
2258
2259cc_object {
2260 name: "libseccomp_gen_syscall_nrs_x86_64",
2261 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2262 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2263 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2264 local_include_dirs: [
2265 "kernel/uapi/asm-x86",
2266 "kernel/uapi",
2267 ],
2268}
2269
Elliott Hughesae03b122019-09-17 16:37:05 -07002270// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002271python_binary_host {
2272 name: "genseccomp",
2273 main: "tools/genseccomp.py",
2274
2275 srcs: [
2276 "tools/genseccomp.py",
2277 "tools/gensyscalls.py",
2278 ],
2279
2280 data: [
2281 "kernel/uapi/**/*.h",
2282 ],
2283
2284 version: {
2285 py2: {
2286 enabled: true,
2287 },
2288 py3: {
2289 enabled: false,
2290 },
2291 },
2292}
2293
Martijn Coenen0c6de752019-01-02 12:52:51 +01002294python_binary_host {
2295 name: "genfunctosyscallnrs",
2296 main: "tools/genfunctosyscallnrs.py",
2297
2298 srcs: [
2299 "tools/genseccomp.py",
2300 "tools/genfunctosyscallnrs.py",
2301 "tools/gensyscalls.py",
2302 ],
2303
2304 data: [
2305 "kernel/uapi/**/*.h",
2306 ],
2307
2308 version: {
2309 py2: {
2310 enabled: true,
2311 },
2312 py3: {
2313 enabled: false,
2314 },
2315 },
2316}
2317
2318cc_genrule {
2319 name: "func_to_syscall_nrs",
2320 recovery_available: true,
2321 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2322
2323 tools: [ "genfunctosyscallnrs" ],
2324
2325 srcs: [
2326 "SYSCALLS.TXT",
2327 ":libseccomp_gen_syscall_nrs_arm",
2328 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002329 ":libseccomp_gen_syscall_nrs_x86",
2330 ":libseccomp_gen_syscall_nrs_x86_64",
2331 ],
2332
2333 out: [
2334 "func_to_syscall_nrs.h",
2335 ],
2336}
2337
Martijn Coenenc3752be2019-01-09 16:19:57 +01002338// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2339genrule {
2340 name: "generate_app_zygote_blacklist",
2341 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2342 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2343 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2344}
2345
2346cc_genrule {
2347 name: "libseccomp_policy_app_zygote_sources",
2348 recovery_available: true,
2349 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2350
2351 tools: [ "genseccomp" ],
2352
2353 srcs: [
2354 "SYSCALLS.TXT",
2355 "SECCOMP_WHITELIST_COMMON.TXT",
2356 "SECCOMP_WHITELIST_APP.TXT",
2357 "SECCOMP_BLACKLIST_COMMON.TXT",
Bram Bonnéce846772020-05-06 13:49:55 +02002358 "SECCOMP_PRIORITY.TXT",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002359 ":generate_app_zygote_blacklist",
2360 ":libseccomp_gen_syscall_nrs_arm",
2361 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002362 ":libseccomp_gen_syscall_nrs_x86",
2363 ":libseccomp_gen_syscall_nrs_x86_64",
2364 ],
2365
2366 out: [
2367 "arm64_app_zygote_policy.cpp",
2368 "arm_app_zygote_policy.cpp",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002369 "x86_64_app_zygote_policy.cpp",
2370 "x86_app_zygote_policy.cpp",
2371 ],
2372}
2373
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002374cc_genrule {
2375 name: "libseccomp_policy_app_sources",
2376 recovery_available: true,
2377 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2378
2379 tools: [ "genseccomp" ],
2380
2381 srcs: [
2382 "SYSCALLS.TXT",
2383 "SECCOMP_WHITELIST_COMMON.TXT",
2384 "SECCOMP_WHITELIST_APP.TXT",
2385 "SECCOMP_BLACKLIST_COMMON.TXT",
2386 "SECCOMP_BLACKLIST_APP.TXT",
Bram Bonnéce846772020-05-06 13:49:55 +02002387 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002388 ":libseccomp_gen_syscall_nrs_arm",
2389 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002390 ":libseccomp_gen_syscall_nrs_x86",
2391 ":libseccomp_gen_syscall_nrs_x86_64",
2392 ],
2393
2394 out: [
2395 "arm64_app_policy.cpp",
2396 "arm_app_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002397 "x86_64_app_policy.cpp",
2398 "x86_app_policy.cpp",
2399 ],
2400}
2401
2402cc_genrule {
2403 name: "libseccomp_policy_system_sources",
2404 recovery_available: true,
2405 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2406
2407 tools: [ "genseccomp" ],
2408
2409 srcs: [
2410 "SYSCALLS.TXT",
2411 "SECCOMP_WHITELIST_COMMON.TXT",
2412 "SECCOMP_WHITELIST_SYSTEM.TXT",
2413 "SECCOMP_BLACKLIST_COMMON.TXT",
Bram Bonnéce846772020-05-06 13:49:55 +02002414 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002415 ":libseccomp_gen_syscall_nrs_arm",
2416 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002417 ":libseccomp_gen_syscall_nrs_x86",
2418 ":libseccomp_gen_syscall_nrs_x86_64",
2419 ],
2420
2421 out: [
2422 "arm64_system_policy.cpp",
2423 "arm_system_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002424 "x86_64_system_policy.cpp",
2425 "x86_system_policy.cpp",
2426 ],
2427}
2428
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002429cc_library {
2430 name: "libseccomp_policy",
2431 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002432 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002433 generated_sources: [
2434 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002435 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002436 "libseccomp_policy_system_sources",
2437 ],
2438
2439 srcs: [
2440 "seccomp/seccomp_policy.cpp",
2441 ],
2442
2443 export_include_dirs: ["seccomp/include"],
2444 cflags: [
2445 "-Wall",
2446 "-Werror",
2447 ],
2448 shared: {
2449 shared_libs: ["libbase"],
2450 },
2451 static: {
2452 static_libs: ["libbase"],
2453 },
2454}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002455
2456// This is a temporary library that will use scudo as the native memory
2457// allocator. To use it, add it as the first shared library.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002458cc_defaults {
2459 name: "libc_scudo_wrapper_defaults",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002460 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002461 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08002462 "bionic/heap_tagging.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002463 "bionic/malloc_common.cpp",
2464 "bionic/malloc_common_dynamic.cpp",
2465 "bionic/malloc_heapprofd.cpp",
2466 "bionic/malloc_limit.cpp",
2467 "bionic/scudo_wrapper.cpp",
2468 "bionic/__set_errno.cpp",
2469 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002470 cflags: [
2471 "-DUSE_SCUDO",
2472 "-fno-emulated-tls", // Required for GWP-ASan.
2473 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002474 shared_libs: ["libscudo_wrapper"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002475
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002476 header_libs: [
2477 "libc_headers",
2478 "gwp_asan_headers",
2479 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002480
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002481 static_libs: [
2482 "libasync_safe",
2483 "gwp_asan",
2484 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002485
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002486 arch: {
2487 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002488 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002489 },
2490 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002491 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002492 },
2493 x86: {
2494 srcs: [
2495 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002496 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002497 ],
2498 },
2499 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002500 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002501 },
2502 },
2503
2504 // Mark this library as global so it overrides all the allocation
2505 // definitions properly.
2506 ldflags: ["-Wl,-z,global"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002507}
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002508
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002509cc_library_shared {
2510 name: "libc_scudo",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002511 vendor_available: true,
2512 stl: "none",
2513 system_shared_libs: [],
2514
2515 allow_undefined_symbols: true,
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002516 // Like libc, disable native coverage for libc_scudo.
2517 native_coverage: false,
Jooyung Han01e19d22020-04-16 18:26:45 +09002518 apex_available: [
2519 "//apex_available:platform",
2520 "com.android.media.swcodec",
2521 ],
2522 min_sdk_version: "apex_inherit",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002523}
2524
2525subdirs = [
2526 "bionic/scudo",
2527]