blob: 0f8ed3e59a7df1a5dbf236a04c3e22ca42da5c0f [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",
Elliott Hughes53cf3482016-08-09 13:06:41 -070050]
51
Dan Willemsen208ae172015-09-16 16:33:27 -070052// Define some common cflags
53// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070054cc_defaults {
55 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080056 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070057 cflags: libc_common_flags,
58 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070059 conlyflags: ["-std=gnu99"],
60 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070061 include_dirs: [
62 "bionic/libc/async_safe/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070063 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070064
Colin Cross50c21ab2015-10-31 23:03:05 -070065 stl: "none",
66 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070067 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070068 address: false,
69 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070070 // TODO(b/132640749): Fix broken fuzzer support.
71 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070072 },
Colin Cross50c21ab2015-10-31 23:03:05 -070073 native_coverage: false,
Yifan Hong5a39cee2020-01-21 16:43:56 -080074 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090075 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020076 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080077
Yi Konge3d90de2019-02-20 14:28:56 -080078 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
79 // warning since this is intended right now.
80 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070081
82 product_variables: {
83 experimental_mte: {
84 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
85 },
86 },
Dan Willemsen208ae172015-09-16 16:33:27 -070087}
88
Christopher Ferris4df29ed2020-01-24 18:06:42 -080089libc_scudo_product_variables = {
90 malloc_not_svelte: {
91 cflags: ["-DUSE_SCUDO"],
92 whole_static_libs: ["libscudo"],
93 exclude_static_libs: [
94 "libjemalloc5",
95 "libc_jemalloc_wrapper",
96 ],
97 },
98}
99
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700100// Defaults for native allocator libs/includes to make it
101// easier to change.
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800102// Enable scudo for non-svelte config by adding the line:
103// product_variables: libc_scudo_product_variables,
104// to the cc_defaults below. And remove the defaults line
105// in the libc_scudo library.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700106// ========================================================
107cc_defaults {
108 name: "libc_native_allocator_defaults",
109
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700110 whole_static_libs: [
111 "libjemalloc5",
112 "libc_jemalloc_wrapper",
113 ],
114}
115
116// Functions not implemented by jemalloc directly, or that need to
117// be modified for Android.
118cc_library_static {
119 name: "libc_jemalloc_wrapper",
120 defaults: ["libc_defaults"],
121 srcs: ["bionic/jemalloc_wrapper.cpp"],
122 cflags: ["-fvisibility=hidden"],
123
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800124 // Used to pull in the jemalloc include directory so that if the
125 // library is removed, the include directory is also removed.
126 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700127}
128
Dan Willemsen208ae172015-09-16 16:33:27 -0700129// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700130// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700131// ========================================================
132//
Ryan Prichard249757b2019-11-01 17:18:28 -0700133// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
134// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
135// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
136// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700137
138cc_library_static {
139
Colin Crossa3f9fca2016-01-11 13:20:55 -0800140 srcs: [
141 "bionic/__libc_init_main_thread.cpp",
142 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700143 "bionic/bionic_call_ifunc_resolver.cpp",
144 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800145 ],
146 arch: {
147 arm64: {
148 srcs: ["arch-arm64/bionic/__set_tls.c"],
149 },
150 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700151 srcs: [
152 "arch-x86/bionic/__libc_init_sysinfo.cpp",
153 "arch-x86/bionic/__set_tls.cpp",
154 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800155 },
156 x86_64: {
157 srcs: ["arch-x86_64/bionic/__set_tls.c"],
158 },
159 },
160
Colin Cross50c21ab2015-10-31 23:03:05 -0700161 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700162 cflags: ["-fno-stack-protector", "-ffreestanding"],
163 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700164}
165
Ryan Prichard249757b2019-11-01 17:18:28 -0700166// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
167// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
168// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800169
170cc_library_static {
171 name: "libc_init_static",
172 defaults: ["libc_defaults"],
173 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700174 cflags: [
175 "-fno-stack-protector",
176
177 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
178 // from the linker before ifunc resolvers have made string.h functions available.
179 "-ffreestanding",
180 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800181}
182
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700183cc_library_static {
184 name: "libc_init_dynamic",
185 defaults: ["libc_defaults"],
186 srcs: ["bionic/libc_init_dynamic.cpp"],
187 cflags: ["-fno-stack-protector"],
188}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800189
Dan Willemsen208ae172015-09-16 16:33:27 -0700190// ========================================================
191// libc_tzcode.a - upstream 'tzcode' code
192// ========================================================
193
194cc_library_static {
195
Colin Cross50c21ab2015-10-31 23:03:05 -0700196 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700197 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800198 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700199 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700200 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
201 ],
202
Colin Cross50c21ab2015-10-31 23:03:05 -0700203 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700204 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700205 // Don't use ridiculous amounts of stack.
206 "-DALL_STATE",
207 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
208 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800209 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700210 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700211 // The name of the tm_gmtoff field in our struct tm.
212 "-DTM_GMTOFF=tm_gmtoff",
213 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700214 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700215 // Include `tzname`, `timezone`, and `daylight` globals.
216 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700217 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800218 // Use the empty string (instead of " ") as the timezone abbreviation
219 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700220 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700221 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
222 "-Dlint",
223 ],
224
Dan Willemsen208ae172015-09-16 16:33:27 -0700225 local_include_dirs: ["tzcode/"],
226 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700227}
228
229// ========================================================
230// libc_dns.a - modified NetBSD DNS code
231// ========================================================
232
233cc_library_static {
234
Colin Cross50c21ab2015-10-31 23:03:05 -0700235 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700236 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800237 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700238
239 "upstream-netbsd/lib/libc/isc/ev_streams.c",
240 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700241 ],
242
Colin Cross50c21ab2015-10-31 23:03:05 -0700243 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700244 "-DANDROID_CHANGES",
245 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700246 "-Wno-unused-parameter",
247 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700248 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700249 ],
250
Dan Willemsen208ae172015-09-16 16:33:27 -0700251 local_include_dirs: [
252 "dns/include",
253 "private",
254 "upstream-netbsd/lib/libc/include",
255 "upstream-netbsd/android/include",
256 ],
257
258 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700259}
260
261// ========================================================
262// libc_freebsd.a - upstream FreeBSD C library code
263// ========================================================
264//
265// These files are built with the freebsd-compat.h header file
266// automatically included.
267
268cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700269 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700270 srcs: [
271 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700272 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700273 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
274 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
275 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
276 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700277 "upstream-freebsd/lib/libc/stdlib/qsort.c",
278 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700279 "upstream-freebsd/lib/libc/string/wcpcpy.c",
280 "upstream-freebsd/lib/libc/string/wcpncpy.c",
281 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700282 "upstream-freebsd/lib/libc/string/wcscat.c",
283 "upstream-freebsd/lib/libc/string/wcschr.c",
284 "upstream-freebsd/lib/libc/string/wcscmp.c",
285 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700286 "upstream-freebsd/lib/libc/string/wcscspn.c",
287 "upstream-freebsd/lib/libc/string/wcsdup.c",
288 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700289 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700290 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
291 "upstream-freebsd/lib/libc/string/wcsncat.c",
292 "upstream-freebsd/lib/libc/string/wcsncmp.c",
293 "upstream-freebsd/lib/libc/string/wcsncpy.c",
294 "upstream-freebsd/lib/libc/string/wcsnlen.c",
295 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700296 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700297 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700298 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700299 "upstream-freebsd/lib/libc/string/wcstok.c",
300 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700301 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700302 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700303 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800304 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700305 ],
306 arch: {
307 arm64: {
308 exclude_srcs: [
309 "upstream-freebsd/lib/libc/string/wmemmove.c",
310 ],
311 },
312 x86: {
313 exclude_srcs: [
314 "upstream-freebsd/lib/libc/string/wcschr.c",
315 "upstream-freebsd/lib/libc/string/wcscmp.c",
316 "upstream-freebsd/lib/libc/string/wcslen.c",
317 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700318 "upstream-freebsd/lib/libc/string/wmemcmp.c",
319 "upstream-freebsd/lib/libc/string/wcscat.c",
320 "upstream-freebsd/lib/libc/string/wcscpy.c",
321 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530322 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700323 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700324 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700325 },
326
Colin Cross50c21ab2015-10-31 23:03:05 -0700327 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700328 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700329 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700330 "-include freebsd-compat.h",
331 ],
332
Dan Willemsen208ae172015-09-16 16:33:27 -0700333 local_include_dirs: [
334 "upstream-freebsd/android/include",
335 ],
336
337 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700338}
339
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700340cc_library_static {
341 defaults: ["libc_defaults"],
342 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700343 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700344 ],
345
346 cflags: [
347 "-Wno-sign-compare",
348 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700349 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700350 ],
351
352 local_include_dirs: [
353 "upstream-freebsd/android/include",
354 ],
355
356 name: "libc_freebsd_large_stack",
357}
358
Dan Willemsen208ae172015-09-16 16:33:27 -0700359// ========================================================
360// libc_netbsd.a - upstream NetBSD C library code
361// ========================================================
362//
363// These files are built with the netbsd-compat.h header file
364// automatically included.
365
366cc_library_static {
367
Colin Cross50c21ab2015-10-31 23:03:05 -0700368 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700369 srcs: [
370 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700371 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700372 "upstream-netbsd/lib/libc/gen/psignal.c",
373 "upstream-netbsd/lib/libc/gen/utime.c",
374 "upstream-netbsd/lib/libc/gen/utmp.c",
375 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
376 "upstream-netbsd/lib/libc/regex/regcomp.c",
377 "upstream-netbsd/lib/libc/regex/regerror.c",
378 "upstream-netbsd/lib/libc/regex/regexec.c",
379 "upstream-netbsd/lib/libc/regex/regfree.c",
380 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700381 "upstream-netbsd/lib/libc/stdlib/drand48.c",
382 "upstream-netbsd/lib/libc/stdlib/erand48.c",
383 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
384 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700385 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
386 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
387 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
388 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
389 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
390 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
391 "upstream-netbsd/lib/libc/stdlib/seed48.c",
392 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700393 ],
394 multilib: {
395 lib32: {
396 // LP32 cruft
397 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
398 },
399 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700400 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700401 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800402 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700403 "-DPOSIX_MISTAKE",
404 "-include netbsd-compat.h",
405 ],
406
Dan Willemsen208ae172015-09-16 16:33:27 -0700407 local_include_dirs: [
408 "upstream-netbsd/android/include",
409 "upstream-netbsd/lib/libc/include",
410 ],
411
412 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700413}
414
415// ========================================================
416// libc_openbsd_ndk.a - upstream OpenBSD C library code
417// that can be safely included in the libc_ndk.a (doesn't
418// contain any troublesome global data or constructors).
419// ========================================================
420//
421// These files are built with the openbsd-compat.h header file
422// automatically included.
423
424cc_library_static {
425 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700426 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700427 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700428 "upstream-openbsd/lib/libc/gen/alarm.c",
429 "upstream-openbsd/lib/libc/gen/ctype_.c",
430 "upstream-openbsd/lib/libc/gen/daemon.c",
431 "upstream-openbsd/lib/libc/gen/err.c",
432 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700433 "upstream-openbsd/lib/libc/gen/fnmatch.c",
434 "upstream-openbsd/lib/libc/gen/ftok.c",
435 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700436 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700437 "upstream-openbsd/lib/libc/gen/verr.c",
438 "upstream-openbsd/lib/libc/gen/verrx.c",
439 "upstream-openbsd/lib/libc/gen/vwarn.c",
440 "upstream-openbsd/lib/libc/gen/vwarnx.c",
441 "upstream-openbsd/lib/libc/gen/warn.c",
442 "upstream-openbsd/lib/libc/gen/warnx.c",
443 "upstream-openbsd/lib/libc/locale/btowc.c",
444 "upstream-openbsd/lib/libc/locale/mbrlen.c",
445 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
446 "upstream-openbsd/lib/libc/locale/mbtowc.c",
447 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700448 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
449 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700450 "upstream-openbsd/lib/libc/locale/wcstoll.c",
451 "upstream-openbsd/lib/libc/locale/wcstombs.c",
452 "upstream-openbsd/lib/libc/locale/wcstoul.c",
453 "upstream-openbsd/lib/libc/locale/wcstoull.c",
454 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
455 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
456 "upstream-openbsd/lib/libc/locale/wctob.c",
457 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700458 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700459 "upstream-openbsd/lib/libc/net/htonl.c",
460 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700461 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
462 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
463 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700464 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
465 "upstream-openbsd/lib/libc/net/inet_ntop.c",
466 "upstream-openbsd/lib/libc/net/inet_pton.c",
467 "upstream-openbsd/lib/libc/net/ntohl.c",
468 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800469 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700470 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700471 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
472 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700473 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700474 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700475 "upstream-openbsd/lib/libc/stdio/fputwc.c",
476 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700477 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700478 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700479 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700480 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700481 "upstream-openbsd/lib/libc/stdio/makebuf.c",
482 "upstream-openbsd/lib/libc/stdio/mktemp.c",
483 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
484 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700485 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700486 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700487 "upstream-openbsd/lib/libc/stdio/tempnam.c",
488 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
489 "upstream-openbsd/lib/libc/stdio/ungetc.c",
490 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
491 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
492 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700493 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
494 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
495 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700496 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700497 "upstream-openbsd/lib/libc/stdio/wsetup.c",
498 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800499 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700500 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700501 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700502 "upstream-openbsd/lib/libc/stdlib/insque.c",
503 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
504 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
505 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800506 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700507 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800508 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700509 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700510 "upstream-openbsd/lib/libc/stdlib/remque.c",
511 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700512 "upstream-openbsd/lib/libc/stdlib/tfind.c",
513 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800514 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700515 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800516 "upstream-openbsd/lib/libc/string/strcasestr.c",
517 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700518 "upstream-openbsd/lib/libc/string/strcspn.c",
519 "upstream-openbsd/lib/libc/string/strdup.c",
520 "upstream-openbsd/lib/libc/string/strndup.c",
521 "upstream-openbsd/lib/libc/string/strpbrk.c",
522 "upstream-openbsd/lib/libc/string/strsep.c",
523 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700524 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800525 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700526 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700527 "upstream-openbsd/lib/libc/string/wcswidth.c",
528 ],
529
Colin Cross50c21ab2015-10-31 23:03:05 -0700530 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700531 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700532 "-Wno-unused-parameter",
533 "-include openbsd-compat.h",
534 ],
535
Dan Willemsen208ae172015-09-16 16:33:27 -0700536 local_include_dirs: [
537 "private",
538 "stdio",
539 "upstream-openbsd/android/include",
540 "upstream-openbsd/lib/libc/include",
541 "upstream-openbsd/lib/libc/gdtoa/",
542 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700543}
544
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700545cc_library_static {
546 name: "libc_openbsd_large_stack",
547 defaults: ["libc_defaults"],
548 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700549 "stdio/vfprintf.cpp",
550 "stdio/vfwprintf.cpp",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800551 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700552 ],
553 cflags: [
554 "-include openbsd-compat.h",
555 "-Wno-sign-compare",
556 "-Wframe-larger-than=5000",
557 ],
558
559 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700560 "upstream-openbsd/android/include/",
561 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700562 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700563 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700564 ],
565}
566
Dan Willemsen208ae172015-09-16 16:33:27 -0700567// ========================================================
568// libc_openbsd.a - upstream OpenBSD C library code
569// ========================================================
570//
571// These files are built with the openbsd-compat.h header file
572// automatically included.
573cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700574 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700575 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800576 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700577 "upstream-openbsd/lib/libc/crypt/arc4random.c",
578 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
579
580 // May be overriden by per-arch optimized versions
581 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700582 "upstream-openbsd/lib/libc/string/memrchr.c",
583 "upstream-openbsd/lib/libc/string/stpcpy.c",
584 "upstream-openbsd/lib/libc/string/stpncpy.c",
585 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700586 "upstream-openbsd/lib/libc/string/strcpy.c",
587 "upstream-openbsd/lib/libc/string/strlcat.c",
588 "upstream-openbsd/lib/libc/string/strlcpy.c",
589 "upstream-openbsd/lib/libc/string/strncat.c",
590 "upstream-openbsd/lib/libc/string/strncmp.c",
591 "upstream-openbsd/lib/libc/string/strncpy.c",
592 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700593
594 arch: {
595 arm: {
596 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700597 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800598 "upstream-openbsd/lib/libc/string/stpcpy.c",
599 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700600 ],
601 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700602 arm64: {
603 exclude_srcs: [
604 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700605 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700606 "upstream-openbsd/lib/libc/string/strcpy.c",
607 "upstream-openbsd/lib/libc/string/strncmp.c",
608 ],
609 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530610 mips: {
611 exclude_srcs: [
612 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530613 "upstream-openbsd/lib/libc/string/strcpy.c",
614 "upstream-openbsd/lib/libc/string/strncmp.c",
615 ],
616 },
617 mips64: {
618 exclude_srcs: [
619 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530620 "upstream-openbsd/lib/libc/string/strcpy.c",
621 "upstream-openbsd/lib/libc/string/strncmp.c",
622 ],
623 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700624 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800625 exclude_srcs: [
626 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800627 "upstream-openbsd/lib/libc/string/memrchr.c",
628 "upstream-openbsd/lib/libc/string/stpcpy.c",
629 "upstream-openbsd/lib/libc/string/stpncpy.c",
630 "upstream-openbsd/lib/libc/string/strcat.c",
631 "upstream-openbsd/lib/libc/string/strcpy.c",
632 "upstream-openbsd/lib/libc/string/strncmp.c",
633 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700634 "upstream-openbsd/lib/libc/string/strlcat.c",
635 "upstream-openbsd/lib/libc/string/strlcpy.c",
636 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800637 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700638 },
639
640 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800641 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800642 "upstream-openbsd/lib/libc/string/stpcpy.c",
643 "upstream-openbsd/lib/libc/string/stpncpy.c",
644 "upstream-openbsd/lib/libc/string/strcat.c",
645 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800646 "upstream-openbsd/lib/libc/string/strncat.c",
647 "upstream-openbsd/lib/libc/string/strncmp.c",
648 "upstream-openbsd/lib/libc/string/strncpy.c",
649 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700650 },
651 },
652
Colin Cross50c21ab2015-10-31 23:03:05 -0700653 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700654 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700655 "-Wno-unused-parameter",
656 "-include openbsd-compat.h",
657 ],
658
Dan Willemsen208ae172015-09-16 16:33:27 -0700659 local_include_dirs: [
660 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700661 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700662 ],
663
664 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700665}
666
667// ========================================================
668// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
669// ========================================================
670//
671// These files are built with the openbsd-compat.h header file
672// automatically included.
673
674cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700675 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700676 srcs: [
677 "upstream-openbsd/android/gdtoa_support.cpp",
678 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
679 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
680 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
681 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
682 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
683 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
684 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
685 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
686 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
687 "upstream-openbsd/lib/libc/gdtoa/misc.c",
688 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
689 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
690 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
691 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
692 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
693 "upstream-openbsd/lib/libc/gdtoa/sum.c",
694 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
695 ],
696 multilib: {
697 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800698 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700699 },
700 },
701
Colin Cross50c21ab2015-10-31 23:03:05 -0700702 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700703 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700704 "-include openbsd-compat.h",
705 ],
706
Dan Willemsen208ae172015-09-16 16:33:27 -0700707 local_include_dirs: [
708 "private",
709 "upstream-openbsd/android/include",
710 "upstream-openbsd/lib/libc/include",
711 ],
712
713 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700714}
715
716// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700717// libc_fortify.a - container for our FORITFY
718// implementation details
719// ========================================================
720cc_library_static {
721 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700722 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700723
724 name: "libc_fortify",
725
726 // Disable FORTIFY for the compilation of these, so we don't end up having
727 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800728 cflags: [
729 "-U_FORTIFY_SOURCE",
730 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
731 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700732
733 arch: {
734 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800735 cflags: [
736 "-DNO___MEMCPY_CHK",
737 "-DRENAME___STRCAT_CHK",
738 "-DRENAME___STRCPY_CHK",
739 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700740 srcs: [
741 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800742
743 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
744 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
745
746 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
747 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
748
749 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
750 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
751
752 "arch-arm/krait/bionic/__strcat_chk.S",
753 "arch-arm/krait/bionic/__strcpy_chk.S",
754
755 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
756 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
757
Haibo Huang01bfd892018-12-03 15:05:16 -0800758 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
759 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700760 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700761 },
762 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700763 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700764 srcs: [
765 "arch-arm64/generic/bionic/__memcpy_chk.S",
766 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700767 },
768 },
769}
770
771// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700772// libc_bionic.a - home-grown C library code
773// ========================================================
774
775cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700776 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700777 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800778 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700779 "bionic/sysconf.cpp",
780 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700781 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700782
Josh Gao10ec9282017-04-03 15:13:29 -0700783 // The following must not be statically linked into libc_ndk.a, because
784 // debuggerd will look for the abort message in libc.so's copy.
785 "bionic/android_set_abort_message.cpp",
786
Dan Willemsen208ae172015-09-16 16:33:27 -0700787 "bionic/strchr.cpp",
788 "bionic/strnlen.c",
789 "bionic/strrchr.cpp",
790 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700791
792 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700793 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700794 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700795 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800796 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700797 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800798 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800799 "arch-arm/generic/bionic/stpcpy.c",
800 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800801 "arch-arm/generic/bionic/strcmp.S",
802 "arch-arm/generic/bionic/strcpy.S",
803 "arch-arm/generic/bionic/strlen.c",
804
Ryan Prichard45024fe2018-12-30 21:10:26 -0800805 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700806 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700807 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700808 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700809 "arch-arm/bionic/atomics_arm.c",
810 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800811 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700812 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700813 "arch-arm/bionic/setjmp.S",
814 "arch-arm/bionic/syscall.S",
815 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800816
817 "arch-arm/cortex-a15/bionic/memcpy.S",
818 "arch-arm/cortex-a15/bionic/memmove.S",
819 "arch-arm/cortex-a15/bionic/memset.S",
820 "arch-arm/cortex-a15/bionic/stpcpy.S",
821 "arch-arm/cortex-a15/bionic/strcat.S",
822 "arch-arm/cortex-a15/bionic/strcmp.S",
823 "arch-arm/cortex-a15/bionic/strcpy.S",
824 "arch-arm/cortex-a15/bionic/strlen.S",
825
826 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800827 "arch-arm/cortex-a7/bionic/memset.S",
828
829 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800830 "arch-arm/cortex-a9/bionic/memset.S",
831 "arch-arm/cortex-a9/bionic/stpcpy.S",
832 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800833 "arch-arm/cortex-a9/bionic/strcpy.S",
834 "arch-arm/cortex-a9/bionic/strlen.S",
835
836 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800837 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800838
839 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800840
Haibo Huang01bfd892018-12-03 15:05:16 -0800841 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800842
843 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700844 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700845 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700846 arm64: {
847 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700848 "arch-arm64/generic/bionic/memcmp.S",
849 "arch-arm64/generic/bionic/memcpy.S",
850 "arch-arm64/generic/bionic/memmove.S",
851 "arch-arm64/generic/bionic/memset.S",
852 "arch-arm64/generic/bionic/stpcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700853 "arch-arm64/generic/bionic/strcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700854 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800855
Peter Collingbourne900d07d2019-10-28 13:11:00 -0700856 "arch-arm64/default/bionic/memchr.S",
857 "arch-arm64/default/bionic/strchr.S",
858 "arch-arm64/default/bionic/strcmp.S",
859 "arch-arm64/default/bionic/strlen.S",
860 "arch-arm64/default/bionic/strncmp.S",
861 "arch-arm64/default/bionic/strnlen.S",
862
863 "arch-arm64/mte/bionic/memchr.c",
864 "arch-arm64/mte/bionic/strchr.cpp",
865 "arch-arm64/mte/bionic/strcmp.c",
866 "arch-arm64/mte/bionic/strlen.c",
867 "arch-arm64/mte/bionic/strncmp.c",
868 "arch-arm64/mte/bionic/strnlen.c",
869
Dan Willemsen3e621712016-02-03 21:48:08 -0800870 "arch-arm64/bionic/__bionic_clone.S",
871 "arch-arm64/bionic/_exit_with_stack_teardown.S",
872 "arch-arm64/bionic/setjmp.S",
873 "arch-arm64/bionic/syscall.S",
874 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700875 ],
876 exclude_srcs: [
877 "bionic/__memcpy_chk.cpp",
878 "bionic/strchr.cpp",
879 "bionic/strnlen.c",
880 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700881 },
882
883 mips: {
884 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800885 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530886 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800887 "arch-mips/string/memset.S",
888 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530889 "arch-mips/string/strncmp.S",
890 "arch-mips/string/strlen.c",
891 "arch-mips/string/strnlen.c",
892 "arch-mips/string/strchr.c",
893 "arch-mips/string/strcpy.c",
894 "arch-mips/string/memchr.c",
895 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800896
Dan Willemsen208ae172015-09-16 16:33:27 -0700897 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700898 "arch-mips/bionic/cacheflush.cpp",
899 "arch-mips/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800900 "arch-mips/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700901 "arch-mips/bionic/setjmp.S",
902 "arch-mips/bionic/syscall.S",
903 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700904 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530905 exclude_srcs: [
906 "bionic/strchr.cpp",
907 "bionic/strnlen.c",
908 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700909 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700910 mips64: {
911 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800912 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530913 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800914 "arch-mips/string/memset.S",
915 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530916 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800917 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530918 "arch-mips/string/strnlen.c",
919 "arch-mips/string/strchr.c",
920 "arch-mips/string/strcpy.c",
921 "arch-mips/string/memchr.c",
922 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800923
Dan Willemsen208ae172015-09-16 16:33:27 -0700924 "arch-mips64/bionic/__bionic_clone.S",
925 "arch-mips64/bionic/_exit_with_stack_teardown.S",
926 "arch-mips64/bionic/setjmp.S",
927 "arch-mips64/bionic/syscall.S",
928 "arch-mips64/bionic/vfork.S",
929 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700930 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530931 exclude_srcs: [
932 "bionic/strchr.cpp",
933 "bionic/strnlen.c",
934 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700935 },
936
937 x86: {
938 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700939 "arch-x86/generic/string/memcmp.S",
940 "arch-x86/generic/string/strcmp.S",
941 "arch-x86/generic/string/strncmp.S",
942 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700943
944 "arch-x86/generic/string/strlcat.c",
945 "arch-x86/generic/string/strlcpy.c",
946 "arch-x86/generic/string/strncat.c",
947 "arch-x86/generic/string/wcscat.c",
948 "arch-x86/generic/string/wcscpy.c",
949 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530950 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700951
Dan Willemsen208ae172015-09-16 16:33:27 -0700952 "arch-x86/atom/string/sse2-memchr-atom.S",
953 "arch-x86/atom/string/sse2-memrchr-atom.S",
954 "arch-x86/atom/string/sse2-strchr-atom.S",
955 "arch-x86/atom/string/sse2-strnlen-atom.S",
956 "arch-x86/atom/string/sse2-strrchr-atom.S",
957 "arch-x86/atom/string/sse2-wcschr-atom.S",
958 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
959 "arch-x86/atom/string/sse2-wcslen-atom.S",
960 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700961 "arch-x86/silvermont/string/sse2-memmove-slm.S",
962 "arch-x86/silvermont/string/sse2-memset-slm.S",
963 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
964 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
965 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
966 "arch-x86/silvermont/string/sse2-strlen-slm.S",
967 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800968
969 "arch-x86/bionic/__bionic_clone.S",
970 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800971 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800972 "arch-x86/bionic/__restore.S",
973 "arch-x86/bionic/setjmp.S",
974 "arch-x86/bionic/syscall.S",
975 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700976
977 // ssse3 functions
978 "arch-x86/atom/string/ssse3-strcat-atom.S",
979 "arch-x86/atom/string/ssse3-strcmp-atom.S",
980 "arch-x86/atom/string/ssse3-strlcat-atom.S",
981 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
982 "arch-x86/atom/string/ssse3-strncat-atom.S",
983 "arch-x86/atom/string/ssse3-strncmp-atom.S",
984 "arch-x86/atom/string/ssse3-wcscat-atom.S",
985 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
986
987 // sse4 functions
988 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
989 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
990
991 // atom functions
992 "arch-x86/atom/string/sse2-memset-atom.S",
993 "arch-x86/atom/string/sse2-strlen-atom.S",
994 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800995 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700996 "arch-x86/atom/string/ssse3-strcpy-atom.S",
997 "arch-x86/atom/string/ssse3-strncpy-atom.S",
998 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530999
1000 // avx2 functions
1001 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001002 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001003
1004 exclude_srcs: [
1005 "bionic/strchr.cpp",
1006 "bionic/strnlen.c",
1007 "bionic/strrchr.cpp",
1008 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001009 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001010 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001011 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001012 "arch-x86_64/string/sse2-memmove-slm.S",
1013 "arch-x86_64/string/sse2-memset-slm.S",
1014 "arch-x86_64/string/sse2-stpcpy-slm.S",
1015 "arch-x86_64/string/sse2-stpncpy-slm.S",
1016 "arch-x86_64/string/sse2-strcat-slm.S",
1017 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001018 "arch-x86_64/string/sse2-strlen-slm.S",
1019 "arch-x86_64/string/sse2-strncat-slm.S",
1020 "arch-x86_64/string/sse2-strncpy-slm.S",
1021 "arch-x86_64/string/sse4-memcmp-slm.S",
1022 "arch-x86_64/string/ssse3-strcmp-slm.S",
1023 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +05301024 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001025
1026 "arch-x86_64/bionic/__bionic_clone.S",
1027 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1028 "arch-x86_64/bionic/__restore_rt.S",
1029 "arch-x86_64/bionic/setjmp.S",
1030 "arch-x86_64/bionic/syscall.S",
1031 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001032 ],
1033 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001034 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001035
Colin Cross50c21ab2015-10-31 23:03:05 -07001036 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001037 include_dirs: ["bionic/libstdc++/include"],
1038 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001039}
1040
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001041genrule {
1042 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001043 out: ["generated_android_ids.h"],
1044 srcs: [":android_filesystem_config_header"],
1045 tool_files: ["fs_config_generator.py"],
1046 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001047}
1048
Dan Willemsen268a6732015-10-15 14:49:45 -07001049// ========================================================
1050// libc_bionic_ndk.a- The portions of libc_bionic that can
1051// be safely used in libc_ndk.a (no troublesome global data
1052// or constructors).
1053// ========================================================
1054cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001055 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001056 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001057 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001058 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001059 "bionic/__cmsg_nxthdr.cpp",
1060 "bionic/__errno.cpp",
1061 "bionic/__gnu_basename.cpp",
1062 "bionic/__libc_current_sigrtmax.cpp",
1063 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001064 "bionic/abort.cpp",
1065 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001066 "bionic/access.cpp",
1067 "bionic/arpa_inet.cpp",
1068 "bionic/assert.cpp",
1069 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001070 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001071 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001072 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001073 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001074 "bionic/bionic_systrace.cpp",
1075 "bionic/bionic_time_conversions.cpp",
1076 "bionic/brk.cpp",
1077 "bionic/c16rtomb.cpp",
1078 "bionic/c32rtomb.cpp",
1079 "bionic/chmod.cpp",
1080 "bionic/chown.cpp",
1081 "bionic/clearenv.cpp",
1082 "bionic/clock.cpp",
1083 "bionic/clock_getcpuclockid.cpp",
1084 "bionic/clock_nanosleep.cpp",
1085 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001086 "bionic/ctype.cpp",
1087 "bionic/dirent.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001088 "bionic/dup.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001089 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001090 "bionic/error.cpp",
1091 "bionic/eventfd_read.cpp",
1092 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001093 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001094 "bionic/faccessat.cpp",
1095 "bionic/fchmod.cpp",
1096 "bionic/fchmodat.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001097 "bionic/fcntl.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001098 "bionic/fdsan.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001099 "bionic/fdtrack.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001100 "bionic/ffs.cpp",
1101 "bionic/fgetxattr.cpp",
1102 "bionic/flistxattr.cpp",
1103 "bionic/flockfile.cpp",
1104 "bionic/fpclassify.cpp",
1105 "bionic/fsetxattr.cpp",
1106 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001107 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001108 "bionic/futimens.cpp",
1109 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001110 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001111 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001112 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001113 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001114 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001115 "bionic/getpgrp.cpp",
1116 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001117 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001118 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001119 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001120 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001121 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001122 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001123 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001124 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001125 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001126 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001127 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001128 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001129 "bionic/lchown.cpp",
1130 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001131 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001132 "bionic/libgen.cpp",
1133 "bionic/link.cpp",
1134 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001135 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001136 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001137 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001138 "bionic/mbrtoc16.cpp",
1139 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001140 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001141 "bionic/mempcpy.cpp",
1142 "bionic/mkdir.cpp",
1143 "bionic/mkfifo.cpp",
1144 "bionic/mknod.cpp",
1145 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001146 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001147 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001148 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001149 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001150 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001151 "bionic/open.cpp",
1152 "bionic/pathconf.cpp",
1153 "bionic/pause.cpp",
1154 "bionic/pipe.cpp",
1155 "bionic/poll.cpp",
1156 "bionic/posix_fadvise.cpp",
1157 "bionic/posix_fallocate.cpp",
1158 "bionic/posix_madvise.cpp",
1159 "bionic/posix_timers.cpp",
1160 "bionic/ptrace.cpp",
1161 "bionic/pty.cpp",
1162 "bionic/raise.cpp",
1163 "bionic/rand.cpp",
1164 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001165 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001166 "bionic/reboot.cpp",
1167 "bionic/recv.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001168 "bionic/recvmsg.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001169 "bionic/rename.cpp",
1170 "bionic/rmdir.cpp",
1171 "bionic/scandir.cpp",
1172 "bionic/sched_getaffinity.cpp",
1173 "bionic/sched_getcpu.cpp",
1174 "bionic/semaphore.cpp",
1175 "bionic/send.cpp",
1176 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001177 "bionic/seteuid.cpp",
1178 "bionic/setpgrp.cpp",
1179 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001180 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001181 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001182 "bionic/sleep.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001183 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001184 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001185 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001186 "bionic/strchrnul.cpp",
1187 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001188 "bionic/string_l.cpp",
1189 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001190 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001191 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001192 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001193 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001194 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001195 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001196 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001197 "bionic/sys_msg.cpp",
1198 "bionic/sys_sem.cpp",
1199 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001200 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001201 "bionic/sys_statfs.cpp",
1202 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001203 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001204 "bionic/sysinfo.cpp",
1205 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001206 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001207 "bionic/system_property_api.cpp",
1208 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001209 "bionic/tdestroy.cpp",
1210 "bionic/termios.cpp",
1211 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001212 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001213 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001214 "bionic/tmpfile.cpp",
1215 "bionic/umount.cpp",
1216 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001217 "bionic/usleep.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001218 "bionic/wait.cpp",
1219 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001220 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001221 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001222 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001223 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001224 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001225
1226 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1227 // which will be overridden by the actual one in libc.so.
1228 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001229 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001230
Dan Willemsen208ae172015-09-16 16:33:27 -07001231 multilib: {
1232 lib32: {
1233 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001234 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001235 },
1236 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001237 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001238 treble_linker_namespaces: {
1239 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001240 },
1241 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001242 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001243 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001244 local_include_dirs: ["stdio"],
1245 include_dirs: ["bionic/libstdc++/include"],
1246 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001247 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001248}
1249
Dan Willemsen208ae172015-09-16 16:33:27 -07001250// ========================================================
1251// libc_pthread.a - pthreads parts that previously lived in
1252// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001253// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001254// pthread_t has changed over the years and has ABI
1255// compatibility issues).
1256// ========================================================
1257
1258cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001259 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001260 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001261 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001262 "bionic/pthread_atfork.cpp",
1263 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001264 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001265 "bionic/pthread_cond.cpp",
1266 "bionic/pthread_create.cpp",
1267 "bionic/pthread_detach.cpp",
1268 "bionic/pthread_equal.cpp",
1269 "bionic/pthread_exit.cpp",
1270 "bionic/pthread_getcpuclockid.cpp",
1271 "bionic/pthread_getschedparam.cpp",
1272 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001273 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001274 "bionic/pthread_join.cpp",
1275 "bionic/pthread_key.cpp",
1276 "bionic/pthread_kill.cpp",
1277 "bionic/pthread_mutex.cpp",
1278 "bionic/pthread_once.cpp",
1279 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001280 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001281 "bionic/pthread_self.cpp",
1282 "bionic/pthread_setname_np.cpp",
1283 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001284 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001285
1286 // The following implementations depend on pthread data or implementation,
1287 // so we can't include them in libc_ndk.a.
1288 "bionic/__cxa_thread_atexit_impl.cpp",
1289 "stdlib/atexit.c",
1290 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001291 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001292
Colin Cross50c21ab2015-10-31 23:03:05 -07001293 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001294 include_dirs: ["bionic/libstdc++/include"],
1295 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001296}
1297
1298// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001299// libc_syscalls.a
1300// ========================================================
1301
Elliott Hughes782c4852019-04-16 12:31:00 -07001302genrule {
1303 name: "syscalls-arm.S",
1304 out: ["syscalls-arm.S"],
1305 srcs: ["SYSCALLS.TXT"],
1306 tool_files: [":bionic-gensyscalls"],
1307 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1308}
1309
1310genrule {
1311 name: "syscalls-arm64.S",
1312 out: ["syscalls-arm64.S"],
1313 srcs: ["SYSCALLS.TXT"],
1314 tool_files: [":bionic-gensyscalls"],
1315 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1316}
1317
1318genrule {
1319 name: "syscalls-x86.S",
1320 out: ["syscalls-x86.S"],
1321 srcs: ["SYSCALLS.TXT"],
1322 tool_files: [":bionic-gensyscalls"],
1323 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1324}
1325
1326genrule {
1327 name: "syscalls-x86_64.S",
1328 out: ["syscalls-x86_64.S"],
1329 srcs: ["SYSCALLS.TXT"],
1330 tool_files: [":bionic-gensyscalls"],
1331 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1332}
1333
Dan Willemsen208ae172015-09-16 16:33:27 -07001334cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001335 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001336 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001337 arch: {
1338 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001339 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001340 },
1341 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001342 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001343 },
1344 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001345 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001346 },
1347 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001348 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001349 },
1350 },
1351 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001352}
1353
1354// ========================================================
1355// libc_aeabi.a
1356// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1357// to avoid infinite recursion. For the other architectures we just build an
1358// empty library to keep this makefile simple.
1359// ========================================================
1360
1361cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001362 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001363 arch: {
1364 arm: {
1365 srcs: ["arch-arm/bionic/__aeabi.c"],
1366 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001367 },
1368 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001369 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001370}
1371
1372// ========================================================
1373// libc_ndk.a
1374// Compatibility library for the NDK. This library contains
1375// all the parts of libc that are safe to statically link.
1376// We can't safely statically link things that can only run
1377// on a certain version of the OS. Examples include
1378// anything that talks to netd (a large portion of the DNS
1379// code) and anything that is dependent on the layout of a
1380// data structure that has changed across releases (such as
1381// pthread_t).
1382// ========================================================
1383
1384cc_library_static {
1385 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001386 defaults: [
1387 "libc_defaults",
1388 "libc_native_allocator_defaults",
1389 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -08001390 ramdisk_available: false,
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001391 srcs: libc_common_src_files + [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001392 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001393 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001394 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001395 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001396 multilib: {
1397 lib32: {
1398 srcs: libc_common_src_files_32,
1399 },
1400 },
1401 arch: {
1402 arm: {
1403 srcs: [
1404 "arch-arm/bionic/exidx_dynamic.c",
1405 "arch-common/bionic/crtbegin_so.c",
1406 "arch-arm/bionic/atexit_legacy.c",
1407 "arch-common/bionic/crtend_so.S",
1408 ],
1409 whole_static_libs: ["libc_aeabi"],
1410 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001411 },
1412
Colin Cross50c21ab2015-10-31 23:03:05 -07001413 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001414 "-fvisibility=hidden",
1415 "-DLIBC_STATIC",
1416 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001417
1418 whole_static_libs: [
1419 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001420 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001421 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001422 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001423 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001424 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001425 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001426 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001427 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001428 "libc_syscalls",
1429 "libc_tzcode",
1430 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001431 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001432 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001433}
1434
1435// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001436// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001437// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001438cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001439 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001440 srcs: libc_common_src_files,
1441 multilib: {
1442 lib32: {
1443 srcs: libc_common_src_files_32,
1444 },
1445 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001446 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001447
1448 whole_static_libs: [
1449 "libc_bionic",
1450 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001451 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001452 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001453 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001454 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001455 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001456 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001457 "libc_netbsd",
1458 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001459 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001460 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001461 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001462 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001463 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001464 ],
1465
1466 arch: {
1467 arm: {
1468 whole_static_libs: ["libc_aeabi"],
1469 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001470 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001471}
1472
1473// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001474// libc_common.a
1475// ========================================================
1476
1477cc_library_static {
1478 defaults: ["libc_defaults"],
1479 name: "libc_common",
1480
1481 whole_static_libs: [
1482 "libc_nopthread",
1483 "libc_pthread",
1484 ],
1485}
1486
1487// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001488// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001489// ========================================================
1490cc_library_static {
1491 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001492 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001493
Haibo Huangb9244ff2018-08-11 10:12:13 -07001494 arch: {
1495 x86: {
1496 srcs: ["arch-x86/static_function_dispatch.S"],
1497 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001498 arm: {
1499 srcs: ["arch-arm/static_function_dispatch.S"],
1500 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001501 arm64: {
1502 srcs: ["arch-arm64/static_function_dispatch.S"],
1503 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001504 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001505}
1506
1507// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001508// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001509// ========================================================
1510cc_library_static {
1511 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001512 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001513
Haibo Huangb9244ff2018-08-11 10:12:13 -07001514 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001515 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001516 "-fno-stack-protector",
1517 "-fno-jump-tables",
1518 ],
1519 arch: {
1520 x86: {
1521 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1522 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001523 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001524 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001525 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001526 arm64: {
1527 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1528 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001529 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001530}
1531
1532// ========================================================
1533// libc_common_static.a For static binaries.
1534// ========================================================
1535cc_library_static {
1536 defaults: ["libc_defaults"],
1537 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001538
Haibo Huangf71edfa2018-11-12 10:06:56 -08001539 whole_static_libs: [
1540 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001541 "libc_static_dispatch",
1542 ],
1543}
1544
1545// ========================================================
1546// libc_common_shared.a For shared libraries.
1547// ========================================================
1548cc_library_static {
1549 defaults: ["libc_defaults"],
1550 name: "libc_common_shared",
1551
1552 whole_static_libs: [
1553 "libc_common",
1554 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001555 ],
1556}
1557
Ryan Prichard22a6a052019-10-10 23:59:30 -07001558// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1559// executable.
1560cc_library_static {
1561 name: "libc_unwind_static",
1562 defaults: ["libc_defaults"],
1563 cflags: ["-DLIBC_STATIC"],
1564
1565 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1566 arch: {
1567 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1568 arm: {
1569 srcs: ["arch-arm/bionic/exidx_static.c"],
1570 },
1571 },
1572}
1573
Haibo Huangf71edfa2018-11-12 10:06:56 -08001574// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001575// libc_nomalloc.a
1576// ========================================================
1577//
Ryan Prichard249757b2019-11-01 17:18:28 -07001578// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1579// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1580// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001581
1582cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001583 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001584 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001585
Colin Crossa3f9fca2016-01-11 13:20:55 -08001586 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001587 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001588 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001589 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001590 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001591}
1592
dimitryc0c0ef62018-12-05 16:33:52 +01001593filegroup {
1594 name: "libc_sources_shared",
1595 srcs: [
1596 "arch-common/bionic/crtbegin_so.c",
1597 "arch-common/bionic/crtbrand.S",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001598 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001599 "bionic/icu.cpp",
1600 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001601 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001602 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001603 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001604 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001605 "bionic/ndk_cruft.cpp",
1606 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001607 "bionic/NetdClient.cpp",
1608 "arch-common/bionic/crtend_so.S",
1609 ],
1610}
1611
1612filegroup {
1613 name: "libc_sources_static",
1614 srcs: [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001615 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001616 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001617 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001618 ],
1619}
1620
1621filegroup {
1622 name: "libc_sources_shared_arm",
1623 srcs: [
1624 "arch-arm/bionic/exidx_dynamic.c",
1625 "arch-arm/bionic/atexit_legacy.c",
1626 ],
1627}
1628
Dan Willemsen208ae172015-09-16 16:33:27 -07001629// ========================================================
1630// libc.a + libc.so
1631// ========================================================
1632cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001633 defaults: [
1634 "libc_defaults",
1635 "libc_native_allocator_defaults",
1636 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001637 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001638 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001639 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001640 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001641 platform_sdk_version: {
1642 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1643 },
1644 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001645 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001646 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001647 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001648 whole_static_libs: [
1649 "libc_init_static",
1650 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001651 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001652 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001653 },
1654 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001655 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001656 whole_static_libs: [
1657 "libc_init_dynamic",
1658 "libc_common_shared",
1659 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001660 },
1661
Neil Fullera7db90f2019-04-25 09:28:27 +01001662 required: [
1663 "tzdata",
1664 "tz_version", // Version metadata for tzdata to help debugging.
1665 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001666
Colin Cross4ce94d22016-11-15 13:15:43 -08001667 // Do not pack libc.so relocations; see http://b/20645321 for details.
1668 pack_relocations: false,
1669
dimitry06016f22018-01-05 11:39:28 +01001670 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1671 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1672 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1673 // those new libraries from libgcc.a are not declared external; if that were the case,
1674 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1675 // on the external symbols from the dependent libraries. That would create a "cloaked"
1676 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001677
dimitry06016f22018-01-05 11:39:28 +01001678 shared_libs: [
1679 "ld-android",
1680 "libdl",
1681 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001682 static_libs: [
1683 "libdl_android",
1684 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001685
1686 nocrt: true,
1687
Dan Willemsen208ae172015-09-16 16:33:27 -07001688 arch: {
1689 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001690 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001691 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001692 ldflags: ["-Wl,--hash-style=both"],
1693
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001694 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001695
Dan Willemsen208ae172015-09-16 16:33:27 -07001696 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001697 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001698 // special for arm
1699 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001700 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001701
1702 // Arm 32 bit does not produce complete exidx unwind information
1703 // so keep the .debug_frame which is relatively small and does
1704 // include needed unwind information.
1705 // See b/132992102 for details.
1706 strip: {
1707 keep_symbols_and_debug_frame: true,
1708 },
Peter Collingbourneb061e772019-11-12 14:26:21 -08001709
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001710 whole_static_libs: [ "libunwind_llvm" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001711 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001712 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001713 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001714
1715 // Leave the symbols in the shared library so that stack unwinders can produce
1716 // meaningful name resolution.
1717 strip: {
1718 keep_symbols: true,
1719 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001720
1721 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001722 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001723 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001724 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001725 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001726 ldflags: ["-Wl,--hash-style=both"],
1727
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001728 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001729
1730 // Leave the symbols in the shared library so that stack unwinders can produce
1731 // meaningful name resolution.
1732 strip: {
1733 keep_symbols: true,
1734 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001735
1736 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001737 },
1738 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001739 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001740
1741 // Leave the symbols in the shared library so that stack unwinders can produce
1742 // meaningful name resolution.
1743 strip: {
1744 keep_symbols: true,
1745 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001746
1747 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001748 },
1749 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001750
1751 stubs: {
1752 symbol_file: "libc.map.txt",
1753 versions: ["10000"],
1754 },
Vic Yang6903fb82019-01-14 11:34:39 -08001755
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001756 apex_available: [
1757 "//apex_available:platform",
1758 "com.android.runtime",
1759 ],
1760
Vic Yang03ff4362019-06-24 16:11:37 -07001761 // Sorting bss symbols by size usually results in less dirty pages at run
1762 // time, because small symbols are grouped together.
1763 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001764}
1765
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001766genrule {
1767 name: "libc.arm.map",
1768 out: ["libc.arm.map"],
1769 srcs: ["libc.map.txt"],
1770 tool_files: [":bionic-generate-version-script"],
1771 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1772}
1773
1774genrule {
1775 name: "libc.arm64.map",
1776 out: ["libc.arm64.map"],
1777 srcs: ["libc.map.txt"],
1778 tool_files: [":bionic-generate-version-script"],
1779 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1780}
1781
1782genrule {
1783 name: "libc.x86.map",
1784 out: ["libc.x86.map"],
1785 srcs: ["libc.map.txt"],
1786 tool_files: [":bionic-generate-version-script"],
1787 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1788}
1789
1790genrule {
1791 name: "libc.x86_64.map",
1792 out: ["libc.x86_64.map"],
1793 srcs: ["libc.map.txt"],
1794 tool_files: [":bionic-generate-version-script"],
1795 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1796}
1797
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001798// Headers that only other parts of the platform can include.
1799cc_library_headers {
1800 name: "bionic_libc_platform_headers",
1801 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001802 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001803 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001804 "//frameworks:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001805 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001806 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001807 "//system/core/debuggerd:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001808 "//system/memory/libmemunreachable:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001809 ],
1810 host_supported: true,
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001811 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001812 ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001813 recovery_available: true,
1814 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001815 export_include_dirs: [
1816 "platform",
1817 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001818 system_shared_libs: [],
1819 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001820 sdk_version: "current",
1821}
1822
Logan Chien17af91b2019-01-15 21:19:56 +08001823// libc_headers for libasync_safe and libpropertyinfoparser
1824cc_library_headers {
1825 name: "libc_headers",
1826
1827 host_supported: true,
1828 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001829 ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001830 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001831 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001832
1833 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001834 stl: "none",
1835 system_shared_libs: [],
1836
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001837 // The build system generally requires that any dependencies of a target
1838 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1839 // to 1 we let targets with an sdk_version that need to depend on the libc
1840 // headers but cannot depend on libc itself due to circular dependencies
1841 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1842 // is correct because the headers can support any sdk_version.
1843 sdk_version: "1",
1844
Logan Chien17af91b2019-01-15 21:19:56 +08001845 export_include_dirs: [
1846 "include",
1847 "kernel/uapi",
1848 "kernel/android/uapi",
1849 ],
1850
1851 arch: {
1852 arm: {
1853 export_include_dirs: [
1854 "kernel/uapi/asm-arm",
1855 ],
1856 },
1857 arm64: {
1858 export_include_dirs: [
1859 "kernel/uapi/asm-arm64",
1860 ],
1861 },
1862 mips: {
1863 export_include_dirs: [
1864 "kernel/uapi/asm-mips",
1865 ],
1866 },
1867 mips64: {
1868 export_include_dirs: [
1869 "kernel/uapi/asm-mips",
1870 ],
1871 },
1872 x86: {
1873 export_include_dirs: [
1874 "kernel/uapi/asm-x86",
1875 ],
1876 },
1877 x86_64: {
1878 export_include_dirs: [
1879 "kernel/uapi/asm-x86",
1880 ],
1881 },
1882 },
1883}
1884
Dan Willemsen208ae172015-09-16 16:33:27 -07001885// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001886// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001887// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001888
Dan Willemsen208ae172015-09-16 16:33:27 -07001889cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001890 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001891 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001892 srcs: [
1893 "bionic/__cxa_guard.cpp",
1894 "bionic/__cxa_pure_virtual.cpp",
1895 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001896 ],
1897 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001898 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001899 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001900
Dan Willemsen6b3be172018-12-03 13:57:20 -08001901 static: {
1902 system_shared_libs: [],
1903 },
1904 shared: {
1905 system_shared_libs: ["libc"],
1906 },
1907
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001908 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001909 arch: {
1910 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001911 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001912 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001913 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001914 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001915 },
1916 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001917 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001918 },
1919 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001920 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001921 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001922 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001923 },
1924 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001925 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001926 },
1927 },
1928}
1929
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001930genrule {
1931 name: "libstdc++.arm.map",
1932 out: ["libstdc++.arm.map"],
1933 srcs: ["libstdc++.map.txt"],
1934 tool_files: [":bionic-generate-version-script"],
1935 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1936}
1937
1938genrule {
1939 name: "libstdc++.arm64.map",
1940 out: ["libstdc++.arm64.map"],
1941 srcs: ["libstdc++.map.txt"],
1942 tool_files: [":bionic-generate-version-script"],
1943 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1944}
1945
1946genrule {
1947 name: "libstdc++.x86.map",
1948 out: ["libstdc++.x86.map"],
1949 srcs: ["libstdc++.map.txt"],
1950 tool_files: [":bionic-generate-version-script"],
1951 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1952}
1953
1954genrule {
1955 name: "libstdc++.x86_64.map",
1956 out: ["libstdc++.x86_64.map"],
1957 srcs: ["libstdc++.map.txt"],
1958 tool_files: [":bionic-generate-version-script"],
1959 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1960}
1961
1962// ========================================================
1963// crt object files.
1964// ========================================================
1965
Colin Cross50c21ab2015-10-31 23:03:05 -07001966cc_defaults {
1967 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001968 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001969 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001970 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001971 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001972 native_bridge_supported: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001973
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001974 cflags: [
1975 "-Wno-gcc-compat",
1976 "-Wall",
1977 "-Werror",
1978 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07001979 sanitize: {
1980 never: true,
1981 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001982}
1983
Colin Cross50c21ab2015-10-31 23:03:05 -07001984cc_defaults {
1985 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001986 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001987
1988 arch: {
1989 mips: {
1990 cflags: ["-fPIC"],
1991 },
1992 mips64: {
1993 cflags: ["-fPIC"],
1994 },
1995 x86: {
1996 cflags: ["-fPIC"],
1997 },
1998 x86_64: {
1999 cflags: ["-fPIC"],
2000 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002001 },
Colin Crossab179442018-09-27 11:03:22 -07002002 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002003}
2004
Dan Willemsen208ae172015-09-16 16:33:27 -07002005cc_object {
2006 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002007 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002008 local_include_dirs: ["include"],
2009 product_variables: {
2010 platform_sdk_version: {
2011 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2012 },
2013 },
2014 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002015
Colin Cross7d7b3682017-11-03 13:38:40 -07002016 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002017}
2018
Dan Willemsen208ae172015-09-16 16:33:27 -07002019cc_object {
2020 name: "crtbegin_so1",
2021 local_include_dirs: ["include"],
2022 srcs: ["arch-common/bionic/crtbegin_so.c"],
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_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002029
Colin Cross7d7b3682017-11-03 13:38:40 -07002030 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002031 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002032 "crtbegin_so1",
2033 "crtbrand",
2034 ],
2035}
2036
Dan Willemsen208ae172015-09-16 16:33:27 -07002037cc_object {
2038 name: "crtend_so",
2039 local_include_dirs: ["include"],
2040 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002041
Colin Cross7d7b3682017-11-03 13:38:40 -07002042 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002043}
2044
Dan Willemsen208ae172015-09-16 16:33:27 -07002045cc_object {
2046 name: "crtbegin_static1",
2047 local_include_dirs: ["include"],
2048 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002049
Colin Cross50c21ab2015-10-31 23:03:05 -07002050 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002051 mips: {
2052 srcs: [
2053 "arch-mips/bionic/crtbegin.c",
2054 ],
2055 exclude_srcs: [
2056 "arch-common/bionic/crtbegin.c",
2057 ],
2058 },
2059 mips64: {
2060 srcs: [
2061 "arch-mips64/bionic/crtbegin.c",
2062 ],
2063 exclude_srcs: [
2064 "arch-common/bionic/crtbegin.c",
2065 ],
2066 },
2067 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002068
2069 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002070}
2071
Dan Willemsen208ae172015-09-16 16:33:27 -07002072cc_object {
2073 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002074
Colin Cross77d57bf2016-04-11 14:34:18 -07002075 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002076 "crtbegin_static1",
2077 "crtbrand",
2078 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002079 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002080}
2081
Dan Willemsen208ae172015-09-16 16:33:27 -07002082cc_object {
2083 name: "crtbegin_dynamic1",
2084 local_include_dirs: ["include"],
2085 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002086
Colin Cross50c21ab2015-10-31 23:03:05 -07002087 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002088 mips: {
2089 srcs: [
2090 "arch-mips/bionic/crtbegin.c",
2091 ],
2092 exclude_srcs: [
2093 "arch-common/bionic/crtbegin.c",
2094 ],
2095 },
2096 mips64: {
2097 srcs: [
2098 "arch-mips64/bionic/crtbegin.c",
2099 ],
2100 exclude_srcs: [
2101 "arch-common/bionic/crtbegin.c",
2102 ],
2103 },
2104 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002105 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002106}
2107
Dan Willemsen208ae172015-09-16 16:33:27 -07002108cc_object {
2109 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002110
Colin Cross77d57bf2016-04-11 14:34:18 -07002111 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002112 "crtbegin_dynamic1",
2113 "crtbrand",
2114 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002115 target: {
2116 linux_bionic: {
2117 generated_sources: ["host_bionic_linker_asm"],
2118 objs: [
2119 "linker_wrapper",
2120 ],
2121 },
2122 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002123 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002124}
2125
Dan Willemsen208ae172015-09-16 16:33:27 -07002126cc_object {
2127 // We rename crtend.o to crtend_android.o to avoid a
2128 // name clash between gcc and bionic.
2129 name: "crtend_android",
2130 local_include_dirs: ["include"],
2131 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002132
Colin Cross50c21ab2015-10-31 23:03:05 -07002133 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002134}
Colin Crossbaa48992016-07-13 11:15:21 -07002135
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002136// ========================================================
2137// NDK headers.
2138// ========================================================
2139
Dan Albert26e1c412018-05-24 14:56:46 -07002140versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002141 name: "common_libc",
2142 from: "include",
2143 to: "",
2144 license: "NOTICE",
2145}
Dan Albert4238a352016-06-28 11:18:05 -07002146
2147ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002148 name: "libc_uapi",
2149 from: "kernel/uapi",
2150 to: "",
2151 srcs: [
2152 "kernel/uapi/asm-generic/**/*.h",
2153 "kernel/uapi/drm/**/*.h",
2154 "kernel/uapi/linux/**/*.h",
2155 "kernel/uapi/misc/**/*.h",
2156 "kernel/uapi/mtd/**/*.h",
2157 "kernel/uapi/rdma/**/*.h",
2158 "kernel/uapi/scsi/**/*.h",
2159 "kernel/uapi/sound/**/*.h",
2160 "kernel/uapi/video/**/*.h",
2161 "kernel/uapi/xen/**/*.h",
2162 ],
Dan Albert92592652016-10-20 01:42:54 -07002163 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002164}
2165
2166ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002167 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002168 from: "kernel/android/uapi/linux",
2169 to: "linux",
2170 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002171 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002172}
2173
2174ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002175 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002176 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002177 to: "scsi",
2178 srcs: ["kernel/android/scsi/**/*.h"],
2179 license: "NOTICE",
2180}
2181
2182ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002183 name: "libc_asm_arm",
2184 from: "kernel/uapi/asm-arm",
2185 to: "arm-linux-androideabi",
2186 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002187 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002188}
2189
2190ndk_headers {
2191 name: "libc_asm_arm64",
2192 from: "kernel/uapi/asm-arm64",
2193 to: "aarch64-linux-android",
2194 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002195 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002196}
2197
Elliott Hughesee291c02017-12-11 11:32:34 -08002198// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002199ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002200 name: "libc_asm_mips",
2201 from: "kernel/uapi/asm-mips",
2202 to: "mipsel-linux-android",
2203 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2204 license: "NOTICE",
2205}
2206
Elliott Hughesee291c02017-12-11 11:32:34 -08002207// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002208ndk_headers {
2209 name: "libc_asm_mips64",
2210 from: "kernel/uapi/asm-mips",
2211 to: "mips64el-linux-android",
2212 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2213 license: "NOTICE",
2214}
2215
2216ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002217 name: "libc_asm_x86",
2218 from: "kernel/uapi/asm-x86",
2219 to: "i686-linux-android",
2220 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002221 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002222}
2223
2224ndk_headers {
2225 name: "libc_asm_x86_64",
2226 from: "kernel/uapi/asm-x86",
2227 to: "x86_64-linux-android",
2228 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002229 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002230}
2231
Dan Albert4238a352016-06-28 11:18:05 -07002232ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002233 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002234 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002235 symbol_file: "libc.map.txt",
2236 first_version: "9",
2237}
2238
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002239llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002240 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002241 symbol_file: "libc.map.txt",
2242 export_headers_as_system: true,
2243 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002244 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002245 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002246 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002247 "kernel/android/uapi",
2248 "kernel/uapi",
2249 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002250 arch: {
2251 arm: {
2252 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002253 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002254 ],
2255 },
2256 arm64: {
2257 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002258 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002259 ],
2260 },
2261 mips: {
2262 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002263 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002264 ],
2265 },
2266 mips64: {
2267 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002268 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002269 ],
2270 },
2271 x86: {
2272 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002273 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002274 ],
2275 },
2276 x86_64: {
2277 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002278 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002279 ],
2280 },
2281 },
2282}
2283
Dan Albertdf31aff2016-10-06 15:50:41 -07002284ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002285 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002286 symbol_file: "libstdc++.map.txt",
2287 first_version: "9",
2288}
2289
Dan Willemsenca056d72018-01-08 14:00:24 -08002290// Export these headers for toolbox to process
2291filegroup {
2292 name: "kernel_input_headers",
2293 srcs: [
2294 "kernel/uapi/linux/input.h",
2295 "kernel/uapi/linux/input-event-codes.h",
2296 ],
2297}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002298
2299// Generate a syscall name / number mapping. These objects are text files
2300// (thanks to the -dD -E flags) and not binary files. They will then be
2301// consumed by the genseccomp.py script and converted into C++ code.
2302cc_defaults {
2303 name: "libseccomp_gen_syscall_nrs_defaults",
2304 recovery_available: true,
2305 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2306 cflags: [
2307 "-dD",
2308 "-E",
2309 "-Wall",
2310 "-Werror",
2311 "-nostdinc",
2312 ],
2313}
2314
2315cc_object {
2316 name: "libseccomp_gen_syscall_nrs_arm",
2317 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2318 local_include_dirs: [
2319 "kernel/uapi/asm-arm",
2320 "kernel/uapi",
2321 ],
2322}
2323
2324cc_object {
2325 name: "libseccomp_gen_syscall_nrs_arm64",
2326 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2327 local_include_dirs: [
2328 "kernel/uapi/asm-arm64",
2329 "kernel/uapi",
2330 ],
2331}
2332
2333cc_object {
2334 name: "libseccomp_gen_syscall_nrs_x86",
2335 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2336 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2337 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2338 local_include_dirs: [
2339 "kernel/uapi/asm-x86",
2340 "kernel/uapi",
2341 ],
2342}
2343
2344cc_object {
2345 name: "libseccomp_gen_syscall_nrs_x86_64",
2346 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2347 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2348 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2349 local_include_dirs: [
2350 "kernel/uapi/asm-x86",
2351 "kernel/uapi",
2352 ],
2353}
2354
2355cc_object {
2356 name: "libseccomp_gen_syscall_nrs_mips",
2357 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2358 cflags: [
2359 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2360 ],
2361 local_include_dirs: [
2362 "kernel/uapi/asm-mips",
2363 "kernel/uapi",
2364 ],
2365}
2366
2367cc_object {
2368 name: "libseccomp_gen_syscall_nrs_mips64",
2369 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2370 cflags: [
2371 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2372 ],
2373 local_include_dirs: [
2374 "kernel/uapi/asm-mips",
2375 "kernel/uapi",
2376 ],
2377}
2378
Elliott Hughesae03b122019-09-17 16:37:05 -07002379// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002380python_binary_host {
2381 name: "genseccomp",
2382 main: "tools/genseccomp.py",
2383
2384 srcs: [
2385 "tools/genseccomp.py",
2386 "tools/gensyscalls.py",
2387 ],
2388
2389 data: [
2390 "kernel/uapi/**/*.h",
2391 ],
2392
2393 version: {
2394 py2: {
2395 enabled: true,
2396 },
2397 py3: {
2398 enabled: false,
2399 },
2400 },
2401}
2402
Martijn Coenen0c6de752019-01-02 12:52:51 +01002403python_binary_host {
2404 name: "genfunctosyscallnrs",
2405 main: "tools/genfunctosyscallnrs.py",
2406
2407 srcs: [
2408 "tools/genseccomp.py",
2409 "tools/genfunctosyscallnrs.py",
2410 "tools/gensyscalls.py",
2411 ],
2412
2413 data: [
2414 "kernel/uapi/**/*.h",
2415 ],
2416
2417 version: {
2418 py2: {
2419 enabled: true,
2420 },
2421 py3: {
2422 enabled: false,
2423 },
2424 },
2425}
2426
2427cc_genrule {
2428 name: "func_to_syscall_nrs",
2429 recovery_available: true,
2430 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2431
2432 tools: [ "genfunctosyscallnrs" ],
2433
2434 srcs: [
2435 "SYSCALLS.TXT",
2436 ":libseccomp_gen_syscall_nrs_arm",
2437 ":libseccomp_gen_syscall_nrs_arm64",
2438 ":libseccomp_gen_syscall_nrs_mips",
2439 ":libseccomp_gen_syscall_nrs_mips64",
2440 ":libseccomp_gen_syscall_nrs_x86",
2441 ":libseccomp_gen_syscall_nrs_x86_64",
2442 ],
2443
2444 out: [
2445 "func_to_syscall_nrs.h",
2446 ],
2447}
2448
Martijn Coenenc3752be2019-01-09 16:19:57 +01002449// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2450genrule {
2451 name: "generate_app_zygote_blacklist",
2452 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2453 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2454 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2455}
2456
2457cc_genrule {
2458 name: "libseccomp_policy_app_zygote_sources",
2459 recovery_available: true,
2460 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2461
2462 tools: [ "genseccomp" ],
2463
2464 srcs: [
2465 "SYSCALLS.TXT",
2466 "SECCOMP_WHITELIST_COMMON.TXT",
2467 "SECCOMP_WHITELIST_APP.TXT",
2468 "SECCOMP_BLACKLIST_COMMON.TXT",
2469 ":generate_app_zygote_blacklist",
2470 ":libseccomp_gen_syscall_nrs_arm",
2471 ":libseccomp_gen_syscall_nrs_arm64",
2472 ":libseccomp_gen_syscall_nrs_mips",
2473 ":libseccomp_gen_syscall_nrs_mips64",
2474 ":libseccomp_gen_syscall_nrs_x86",
2475 ":libseccomp_gen_syscall_nrs_x86_64",
2476 ],
2477
2478 out: [
2479 "arm64_app_zygote_policy.cpp",
2480 "arm_app_zygote_policy.cpp",
2481 "mips64_app_zygote_policy.cpp",
2482 "mips_app_zygote_policy.cpp",
2483 "x86_64_app_zygote_policy.cpp",
2484 "x86_app_zygote_policy.cpp",
2485 ],
2486}
2487
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002488cc_genrule {
2489 name: "libseccomp_policy_app_sources",
2490 recovery_available: true,
2491 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2492
2493 tools: [ "genseccomp" ],
2494
2495 srcs: [
2496 "SYSCALLS.TXT",
2497 "SECCOMP_WHITELIST_COMMON.TXT",
2498 "SECCOMP_WHITELIST_APP.TXT",
2499 "SECCOMP_BLACKLIST_COMMON.TXT",
2500 "SECCOMP_BLACKLIST_APP.TXT",
2501 ":libseccomp_gen_syscall_nrs_arm",
2502 ":libseccomp_gen_syscall_nrs_arm64",
2503 ":libseccomp_gen_syscall_nrs_mips",
2504 ":libseccomp_gen_syscall_nrs_mips64",
2505 ":libseccomp_gen_syscall_nrs_x86",
2506 ":libseccomp_gen_syscall_nrs_x86_64",
2507 ],
2508
2509 out: [
2510 "arm64_app_policy.cpp",
2511 "arm_app_policy.cpp",
2512 "mips64_app_policy.cpp",
2513 "mips_app_policy.cpp",
2514 "x86_64_app_policy.cpp",
2515 "x86_app_policy.cpp",
2516 ],
2517}
2518
2519cc_genrule {
2520 name: "libseccomp_policy_system_sources",
2521 recovery_available: true,
2522 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2523
2524 tools: [ "genseccomp" ],
2525
2526 srcs: [
2527 "SYSCALLS.TXT",
2528 "SECCOMP_WHITELIST_COMMON.TXT",
2529 "SECCOMP_WHITELIST_SYSTEM.TXT",
2530 "SECCOMP_BLACKLIST_COMMON.TXT",
2531 ":libseccomp_gen_syscall_nrs_arm",
2532 ":libseccomp_gen_syscall_nrs_arm64",
2533 ":libseccomp_gen_syscall_nrs_mips",
2534 ":libseccomp_gen_syscall_nrs_mips64",
2535 ":libseccomp_gen_syscall_nrs_x86",
2536 ":libseccomp_gen_syscall_nrs_x86_64",
2537 ],
2538
2539 out: [
2540 "arm64_system_policy.cpp",
2541 "arm_system_policy.cpp",
2542 "mips64_system_policy.cpp",
2543 "mips_system_policy.cpp",
2544 "x86_64_system_policy.cpp",
2545 "x86_system_policy.cpp",
2546 ],
2547}
2548
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002549cc_library {
2550 name: "libseccomp_policy",
2551 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002552 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002553 generated_sources: [
2554 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002555 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002556 "libseccomp_policy_system_sources",
2557 ],
2558
2559 srcs: [
2560 "seccomp/seccomp_policy.cpp",
2561 ],
2562
2563 export_include_dirs: ["seccomp/include"],
2564 cflags: [
2565 "-Wall",
2566 "-Werror",
2567 ],
2568 shared: {
2569 shared_libs: ["libbase"],
2570 },
2571 static: {
2572 static_libs: ["libbase"],
2573 },
2574}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002575
2576// This is a temporary library that will use scudo as the native memory
2577// allocator. To use it, add it as the first shared library.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002578cc_defaults {
2579 name: "libc_scudo_wrapper_defaults",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002580 srcs: [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08002581 "bionic/heap_tagging.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002582 "bionic/malloc_common.cpp",
2583 "bionic/malloc_common_dynamic.cpp",
2584 "bionic/malloc_heapprofd.cpp",
2585 "bionic/malloc_limit.cpp",
2586 "bionic/scudo_wrapper.cpp",
2587 "bionic/__set_errno.cpp",
2588 ],
2589 cflags: ["-DUSE_SCUDO"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002590 shared_libs: ["libscudo_wrapper"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002591
2592 header_libs: ["libc_headers"],
2593
2594 static_libs: ["libasync_safe"],
2595
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002596 arch: {
2597 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002598 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002599 },
2600 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002601 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002602 },
2603 x86: {
2604 srcs: [
2605 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002606 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002607 ],
2608 },
2609 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002610 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002611 },
2612 },
2613
2614 // Mark this library as global so it overrides all the allocation
2615 // definitions properly.
2616 ldflags: ["-Wl,-z,global"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002617}
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002618
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002619cc_library_shared {
2620 name: "libc_scudo",
Anna Trostanetski9981a1d2020-01-20 20:16:29 +00002621 defaults: ["libc_scudo_wrapper_defaults"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002622 vendor_available: true,
2623 stl: "none",
2624 system_shared_libs: [],
2625
2626 allow_undefined_symbols: true,
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002627 // Like libc, disable native coverage for libc_scudo.
2628 native_coverage: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002629}
2630
2631subdirs = [
2632 "bionic/scudo",
2633]