blob: 92951f7697a079b0e0350b43d50d845a6f3574b5 [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001// Define the common source files for all the libc instances
2// =========================================================
3libc_common_src_files = [
Christopher Ferris7a3681e2017-04-24 17:48:32 -07004 "async_safe/async_safe_log.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07005 "bionic/ether_aton.c",
6 "bionic/ether_ntoa.c",
7 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/pututline.c",
11 "bionic/sched_cpualloc.c",
12 "bionic/sched_cpucount.c",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070013 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070014 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070015 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080016 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070017 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080018 "stdio/vfscanf.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070019 "stdio/vfwscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070020 "stdlib/exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070021]
22
Peter Collingbourne570de332019-12-11 10:00:58 -080023// off64_t/time64_t support on LP32.
Dan Willemsen208ae172015-09-16 16:33:27 -070024// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -070025libc_common_src_files_32 = [
26 "bionic/legacy_32_bit_support.cpp",
27 "bionic/time64.c",
28]
29
Elliott Hughes53cf3482016-08-09 13:06:41 -070030libc_common_flags = [
31 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080032 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070033 "-Wall",
34 "-Wextra",
35 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080036 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070037 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070038 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070039 "-Wframe-larger-than=2048",
Elliott Hughes53cf3482016-08-09 13:06:41 -070040
41 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
42 "-Werror=pointer-to-int-cast",
43 "-Werror=int-to-pointer-cast",
44 "-Werror=type-limits",
45 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080046
47 // Clang's exit-time destructor registration hides __dso_handle, but
48 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
49 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080050
51 // GWP-ASan requires platform TLS.
52 "-fno-emulated-tls",
Elliott Hughes53cf3482016-08-09 13:06:41 -070053]
54
Dan Willemsen208ae172015-09-16 16:33:27 -070055// Define some common cflags
56// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070057cc_defaults {
58 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080059 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070060 cflags: libc_common_flags,
61 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070062 conlyflags: ["-std=gnu99"],
63 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070064 include_dirs: [
65 "bionic/libc/async_safe/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070066 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070067
Mitch Phillipsf3968e82020-01-31 19:57:04 -080068 header_libs: ["gwp_asan_headers"],
69
Colin Cross50c21ab2015-10-31 23:03:05 -070070 stl: "none",
71 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070072 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070073 address: false,
74 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070075 // TODO(b/132640749): Fix broken fuzzer support.
76 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070077 },
Colin Cross50c21ab2015-10-31 23:03:05 -070078 native_coverage: false,
Yifan Hong5a39cee2020-01-21 16:43:56 -080079 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090080 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020081 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080082
Yi Konge3d90de2019-02-20 14:28:56 -080083 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
84 // warning since this is intended right now.
85 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070086
87 product_variables: {
88 experimental_mte: {
89 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
90 },
91 },
Dan Willemsen208ae172015-09-16 16:33:27 -070092}
93
Christopher Ferris4df29ed2020-01-24 18:06:42 -080094libc_scudo_product_variables = {
95 malloc_not_svelte: {
96 cflags: ["-DUSE_SCUDO"],
97 whole_static_libs: ["libscudo"],
98 exclude_static_libs: [
99 "libjemalloc5",
100 "libc_jemalloc_wrapper",
101 ],
102 },
103}
104
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700105// Defaults for native allocator libs/includes to make it
106// easier to change.
Christopher Ferris062eba22020-01-31 22:40:45 -0800107// To disable scudo for the non-svelte config remove the line:
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800108// product_variables: libc_scudo_product_variables,
Christopher Ferris062eba22020-01-31 22:40:45 -0800109// in the cc_defaults below.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700110// ========================================================
111cc_defaults {
112 name: "libc_native_allocator_defaults",
113
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700114 whole_static_libs: [
115 "libjemalloc5",
116 "libc_jemalloc_wrapper",
117 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800118 header_libs: ["gwp_asan_headers"],
Christopher Ferris062eba22020-01-31 22:40:45 -0800119 product_variables: libc_scudo_product_variables,
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700120}
121
122// Functions not implemented by jemalloc directly, or that need to
123// be modified for Android.
124cc_library_static {
125 name: "libc_jemalloc_wrapper",
126 defaults: ["libc_defaults"],
127 srcs: ["bionic/jemalloc_wrapper.cpp"],
128 cflags: ["-fvisibility=hidden"],
129
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800130 // Used to pull in the jemalloc include directory so that if the
131 // library is removed, the include directory is also removed.
132 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700133}
134
Dan Willemsen208ae172015-09-16 16:33:27 -0700135// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700136// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700137// ========================================================
138//
Ryan Prichard249757b2019-11-01 17:18:28 -0700139// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
140// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
141// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
142// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700143
144cc_library_static {
145
Colin Crossa3f9fca2016-01-11 13:20:55 -0800146 srcs: [
147 "bionic/__libc_init_main_thread.cpp",
148 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700149 "bionic/bionic_call_ifunc_resolver.cpp",
150 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800151 ],
152 arch: {
153 arm64: {
154 srcs: ["arch-arm64/bionic/__set_tls.c"],
155 },
156 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700157 srcs: [
158 "arch-x86/bionic/__libc_init_sysinfo.cpp",
159 "arch-x86/bionic/__set_tls.cpp",
160 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800161 },
162 x86_64: {
163 srcs: ["arch-x86_64/bionic/__set_tls.c"],
164 },
165 },
166
Colin Cross50c21ab2015-10-31 23:03:05 -0700167 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700168 cflags: ["-fno-stack-protector", "-ffreestanding"],
169 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700170}
171
Ryan Prichard249757b2019-11-01 17:18:28 -0700172// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
173// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
174// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800175
176cc_library_static {
177 name: "libc_init_static",
178 defaults: ["libc_defaults"],
179 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700180 cflags: [
181 "-fno-stack-protector",
182
183 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
184 // from the linker before ifunc resolvers have made string.h functions available.
185 "-ffreestanding",
186 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800187}
188
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700189cc_library_static {
190 name: "libc_init_dynamic",
191 defaults: ["libc_defaults"],
192 srcs: ["bionic/libc_init_dynamic.cpp"],
193 cflags: ["-fno-stack-protector"],
194}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800195
Dan Willemsen208ae172015-09-16 16:33:27 -0700196// ========================================================
197// libc_tzcode.a - upstream 'tzcode' code
198// ========================================================
199
200cc_library_static {
201
Colin Cross50c21ab2015-10-31 23:03:05 -0700202 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700203 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800204 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700205 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700206 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
207 ],
208
Colin Cross50c21ab2015-10-31 23:03:05 -0700209 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700210 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700211 // Don't use ridiculous amounts of stack.
212 "-DALL_STATE",
213 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
214 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800215 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700216 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700217 // The name of the tm_gmtoff field in our struct tm.
218 "-DTM_GMTOFF=tm_gmtoff",
219 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700220 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700221 // Include `tzname`, `timezone`, and `daylight` globals.
222 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700223 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800224 // Use the empty string (instead of " ") as the timezone abbreviation
225 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700226 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700227 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
228 "-Dlint",
229 ],
230
Dan Willemsen208ae172015-09-16 16:33:27 -0700231 local_include_dirs: ["tzcode/"],
232 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700233}
234
235// ========================================================
236// libc_dns.a - modified NetBSD DNS code
237// ========================================================
238
239cc_library_static {
240
Colin Cross50c21ab2015-10-31 23:03:05 -0700241 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700242 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800243 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700244
245 "upstream-netbsd/lib/libc/isc/ev_streams.c",
246 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700247 ],
248
Colin Cross50c21ab2015-10-31 23:03:05 -0700249 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700250 "-DANDROID_CHANGES",
251 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700252 "-Wno-unused-parameter",
253 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700254 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700255 ],
256
Dan Willemsen208ae172015-09-16 16:33:27 -0700257 local_include_dirs: [
258 "dns/include",
259 "private",
260 "upstream-netbsd/lib/libc/include",
261 "upstream-netbsd/android/include",
262 ],
263
264 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700265}
266
267// ========================================================
268// libc_freebsd.a - upstream FreeBSD C library code
269// ========================================================
270//
271// These files are built with the freebsd-compat.h header file
272// automatically included.
273
274cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700275 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700276 srcs: [
277 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700278 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700279 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
280 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
281 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
282 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700283 "upstream-freebsd/lib/libc/stdlib/qsort.c",
284 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700285 "upstream-freebsd/lib/libc/string/wcpcpy.c",
286 "upstream-freebsd/lib/libc/string/wcpncpy.c",
287 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700288 "upstream-freebsd/lib/libc/string/wcscat.c",
289 "upstream-freebsd/lib/libc/string/wcschr.c",
290 "upstream-freebsd/lib/libc/string/wcscmp.c",
291 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700292 "upstream-freebsd/lib/libc/string/wcscspn.c",
293 "upstream-freebsd/lib/libc/string/wcsdup.c",
294 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700295 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700296 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
297 "upstream-freebsd/lib/libc/string/wcsncat.c",
298 "upstream-freebsd/lib/libc/string/wcsncmp.c",
299 "upstream-freebsd/lib/libc/string/wcsncpy.c",
300 "upstream-freebsd/lib/libc/string/wcsnlen.c",
301 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700302 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700303 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700304 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700305 "upstream-freebsd/lib/libc/string/wcstok.c",
306 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700307 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700308 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700309 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800310 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700311 ],
312 arch: {
313 arm64: {
314 exclude_srcs: [
315 "upstream-freebsd/lib/libc/string/wmemmove.c",
316 ],
317 },
318 x86: {
319 exclude_srcs: [
320 "upstream-freebsd/lib/libc/string/wcschr.c",
321 "upstream-freebsd/lib/libc/string/wcscmp.c",
322 "upstream-freebsd/lib/libc/string/wcslen.c",
323 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700324 "upstream-freebsd/lib/libc/string/wmemcmp.c",
325 "upstream-freebsd/lib/libc/string/wcscat.c",
326 "upstream-freebsd/lib/libc/string/wcscpy.c",
327 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530328 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700329 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700330 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700331 },
332
Colin Cross50c21ab2015-10-31 23:03:05 -0700333 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700334 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700335 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700336 "-include freebsd-compat.h",
337 ],
338
Dan Willemsen208ae172015-09-16 16:33:27 -0700339 local_include_dirs: [
340 "upstream-freebsd/android/include",
341 ],
342
343 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700344}
345
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700346cc_library_static {
347 defaults: ["libc_defaults"],
348 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700349 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700350 ],
351
352 cflags: [
353 "-Wno-sign-compare",
354 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700355 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700356 ],
357
358 local_include_dirs: [
359 "upstream-freebsd/android/include",
360 ],
361
362 name: "libc_freebsd_large_stack",
363}
364
Dan Willemsen208ae172015-09-16 16:33:27 -0700365// ========================================================
366// libc_netbsd.a - upstream NetBSD C library code
367// ========================================================
368//
369// These files are built with the netbsd-compat.h header file
370// automatically included.
371
372cc_library_static {
373
Colin Cross50c21ab2015-10-31 23:03:05 -0700374 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700375 srcs: [
376 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700377 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700378 "upstream-netbsd/lib/libc/gen/psignal.c",
379 "upstream-netbsd/lib/libc/gen/utime.c",
380 "upstream-netbsd/lib/libc/gen/utmp.c",
381 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
382 "upstream-netbsd/lib/libc/regex/regcomp.c",
383 "upstream-netbsd/lib/libc/regex/regerror.c",
384 "upstream-netbsd/lib/libc/regex/regexec.c",
385 "upstream-netbsd/lib/libc/regex/regfree.c",
386 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700387 "upstream-netbsd/lib/libc/stdlib/drand48.c",
388 "upstream-netbsd/lib/libc/stdlib/erand48.c",
389 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
390 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700391 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
392 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
393 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
394 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
395 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
396 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
397 "upstream-netbsd/lib/libc/stdlib/seed48.c",
398 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700399 ],
400 multilib: {
401 lib32: {
402 // LP32 cruft
403 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
404 },
405 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700406 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700407 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800408 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700409 "-DPOSIX_MISTAKE",
410 "-include netbsd-compat.h",
411 ],
412
Dan Willemsen208ae172015-09-16 16:33:27 -0700413 local_include_dirs: [
414 "upstream-netbsd/android/include",
415 "upstream-netbsd/lib/libc/include",
416 ],
417
418 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700419}
420
421// ========================================================
422// libc_openbsd_ndk.a - upstream OpenBSD C library code
423// that can be safely included in the libc_ndk.a (doesn't
424// contain any troublesome global data or constructors).
425// ========================================================
426//
427// These files are built with the openbsd-compat.h header file
428// automatically included.
429
430cc_library_static {
431 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700432 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700433 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700434 "upstream-openbsd/lib/libc/gen/alarm.c",
435 "upstream-openbsd/lib/libc/gen/ctype_.c",
436 "upstream-openbsd/lib/libc/gen/daemon.c",
437 "upstream-openbsd/lib/libc/gen/err.c",
438 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700439 "upstream-openbsd/lib/libc/gen/fnmatch.c",
440 "upstream-openbsd/lib/libc/gen/ftok.c",
441 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700442 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700443 "upstream-openbsd/lib/libc/gen/verr.c",
444 "upstream-openbsd/lib/libc/gen/verrx.c",
445 "upstream-openbsd/lib/libc/gen/vwarn.c",
446 "upstream-openbsd/lib/libc/gen/vwarnx.c",
447 "upstream-openbsd/lib/libc/gen/warn.c",
448 "upstream-openbsd/lib/libc/gen/warnx.c",
449 "upstream-openbsd/lib/libc/locale/btowc.c",
450 "upstream-openbsd/lib/libc/locale/mbrlen.c",
451 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
452 "upstream-openbsd/lib/libc/locale/mbtowc.c",
453 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700454 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
455 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700456 "upstream-openbsd/lib/libc/locale/wcstoll.c",
457 "upstream-openbsd/lib/libc/locale/wcstombs.c",
458 "upstream-openbsd/lib/libc/locale/wcstoul.c",
459 "upstream-openbsd/lib/libc/locale/wcstoull.c",
460 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
461 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
462 "upstream-openbsd/lib/libc/locale/wctob.c",
463 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700464 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700465 "upstream-openbsd/lib/libc/net/htonl.c",
466 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700467 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
468 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
469 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700470 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
471 "upstream-openbsd/lib/libc/net/inet_ntop.c",
472 "upstream-openbsd/lib/libc/net/inet_pton.c",
473 "upstream-openbsd/lib/libc/net/ntohl.c",
474 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800475 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700476 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700477 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
478 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700479 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700480 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700481 "upstream-openbsd/lib/libc/stdio/fputwc.c",
482 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700483 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700484 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700485 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700486 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700487 "upstream-openbsd/lib/libc/stdio/makebuf.c",
488 "upstream-openbsd/lib/libc/stdio/mktemp.c",
489 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
490 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700491 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700492 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700493 "upstream-openbsd/lib/libc/stdio/tempnam.c",
494 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
495 "upstream-openbsd/lib/libc/stdio/ungetc.c",
496 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
497 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
498 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
500 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
501 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700502 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700503 "upstream-openbsd/lib/libc/stdio/wsetup.c",
504 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800505 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700506 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700507 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700508 "upstream-openbsd/lib/libc/stdlib/insque.c",
509 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
510 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
511 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800512 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700513 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800514 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700515 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700516 "upstream-openbsd/lib/libc/stdlib/remque.c",
517 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700518 "upstream-openbsd/lib/libc/stdlib/tfind.c",
519 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800520 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700521 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800522 "upstream-openbsd/lib/libc/string/strcasestr.c",
523 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700524 "upstream-openbsd/lib/libc/string/strcspn.c",
525 "upstream-openbsd/lib/libc/string/strdup.c",
526 "upstream-openbsd/lib/libc/string/strndup.c",
527 "upstream-openbsd/lib/libc/string/strpbrk.c",
528 "upstream-openbsd/lib/libc/string/strsep.c",
529 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700530 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800531 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700532 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700533 "upstream-openbsd/lib/libc/string/wcswidth.c",
534 ],
535
Colin Cross50c21ab2015-10-31 23:03:05 -0700536 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700537 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700538 "-Wno-unused-parameter",
539 "-include openbsd-compat.h",
540 ],
541
Dan Willemsen208ae172015-09-16 16:33:27 -0700542 local_include_dirs: [
543 "private",
544 "stdio",
545 "upstream-openbsd/android/include",
546 "upstream-openbsd/lib/libc/include",
547 "upstream-openbsd/lib/libc/gdtoa/",
548 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700549}
550
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700551cc_library_static {
552 name: "libc_openbsd_large_stack",
553 defaults: ["libc_defaults"],
554 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700555 "stdio/vfprintf.cpp",
556 "stdio/vfwprintf.cpp",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800557 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700558 ],
559 cflags: [
560 "-include openbsd-compat.h",
561 "-Wno-sign-compare",
562 "-Wframe-larger-than=5000",
563 ],
564
565 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700566 "upstream-openbsd/android/include/",
567 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700568 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700569 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700570 ],
571}
572
Dan Willemsen208ae172015-09-16 16:33:27 -0700573// ========================================================
574// libc_openbsd.a - upstream OpenBSD C library code
575// ========================================================
576//
577// These files are built with the openbsd-compat.h header file
578// automatically included.
579cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700580 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700581 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800582 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700583 "upstream-openbsd/lib/libc/crypt/arc4random.c",
584 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
585
586 // May be overriden by per-arch optimized versions
587 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700588 "upstream-openbsd/lib/libc/string/memrchr.c",
589 "upstream-openbsd/lib/libc/string/stpcpy.c",
590 "upstream-openbsd/lib/libc/string/stpncpy.c",
591 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700592 "upstream-openbsd/lib/libc/string/strcpy.c",
593 "upstream-openbsd/lib/libc/string/strlcat.c",
594 "upstream-openbsd/lib/libc/string/strlcpy.c",
595 "upstream-openbsd/lib/libc/string/strncat.c",
596 "upstream-openbsd/lib/libc/string/strncmp.c",
597 "upstream-openbsd/lib/libc/string/strncpy.c",
598 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700599
600 arch: {
601 arm: {
602 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700603 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800604 "upstream-openbsd/lib/libc/string/stpcpy.c",
605 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700606 ],
607 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700608 arm64: {
609 exclude_srcs: [
610 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700611 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700612 "upstream-openbsd/lib/libc/string/strcpy.c",
613 "upstream-openbsd/lib/libc/string/strncmp.c",
614 ],
615 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530616 mips: {
617 exclude_srcs: [
618 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530619 "upstream-openbsd/lib/libc/string/strcpy.c",
620 "upstream-openbsd/lib/libc/string/strncmp.c",
621 ],
622 },
623 mips64: {
624 exclude_srcs: [
625 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530626 "upstream-openbsd/lib/libc/string/strcpy.c",
627 "upstream-openbsd/lib/libc/string/strncmp.c",
628 ],
629 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700630 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800631 exclude_srcs: [
632 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800633 "upstream-openbsd/lib/libc/string/memrchr.c",
634 "upstream-openbsd/lib/libc/string/stpcpy.c",
635 "upstream-openbsd/lib/libc/string/stpncpy.c",
636 "upstream-openbsd/lib/libc/string/strcat.c",
637 "upstream-openbsd/lib/libc/string/strcpy.c",
638 "upstream-openbsd/lib/libc/string/strncmp.c",
639 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700640 "upstream-openbsd/lib/libc/string/strlcat.c",
641 "upstream-openbsd/lib/libc/string/strlcpy.c",
642 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800643 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700644 },
645
646 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800647 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800648 "upstream-openbsd/lib/libc/string/stpcpy.c",
649 "upstream-openbsd/lib/libc/string/stpncpy.c",
650 "upstream-openbsd/lib/libc/string/strcat.c",
651 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800652 "upstream-openbsd/lib/libc/string/strncat.c",
653 "upstream-openbsd/lib/libc/string/strncmp.c",
654 "upstream-openbsd/lib/libc/string/strncpy.c",
655 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700656 },
657 },
658
Colin Cross50c21ab2015-10-31 23:03:05 -0700659 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700660 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700661 "-Wno-unused-parameter",
662 "-include openbsd-compat.h",
663 ],
664
Dan Willemsen208ae172015-09-16 16:33:27 -0700665 local_include_dirs: [
666 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700667 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700668 ],
669
670 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700671}
672
673// ========================================================
674// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
675// ========================================================
676//
677// These files are built with the openbsd-compat.h header file
678// automatically included.
679
680cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700681 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700682 srcs: [
683 "upstream-openbsd/android/gdtoa_support.cpp",
684 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
685 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
686 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
687 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
688 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
689 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
690 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
691 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
692 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
693 "upstream-openbsd/lib/libc/gdtoa/misc.c",
694 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
695 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
696 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
697 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
698 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
699 "upstream-openbsd/lib/libc/gdtoa/sum.c",
700 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
701 ],
702 multilib: {
703 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800704 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700705 },
706 },
707
Colin Cross50c21ab2015-10-31 23:03:05 -0700708 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700709 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700710 "-include openbsd-compat.h",
711 ],
712
Dan Willemsen208ae172015-09-16 16:33:27 -0700713 local_include_dirs: [
714 "private",
715 "upstream-openbsd/android/include",
716 "upstream-openbsd/lib/libc/include",
717 ],
718
719 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700720}
721
722// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700723// libc_fortify.a - container for our FORITFY
724// implementation details
725// ========================================================
726cc_library_static {
727 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700728 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700729
730 name: "libc_fortify",
731
732 // Disable FORTIFY for the compilation of these, so we don't end up having
733 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800734 cflags: [
735 "-U_FORTIFY_SOURCE",
736 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
737 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700738
739 arch: {
740 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800741 cflags: [
742 "-DNO___MEMCPY_CHK",
743 "-DRENAME___STRCAT_CHK",
744 "-DRENAME___STRCPY_CHK",
745 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700746 srcs: [
747 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800748
749 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
750 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
751
752 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
753 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
754
755 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
756 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
757
758 "arch-arm/krait/bionic/__strcat_chk.S",
759 "arch-arm/krait/bionic/__strcpy_chk.S",
760
761 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
762 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
763
Haibo Huang01bfd892018-12-03 15:05:16 -0800764 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
765 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700766 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700767 },
768 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700769 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700770 srcs: [
771 "arch-arm64/generic/bionic/__memcpy_chk.S",
772 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700773 },
774 },
775}
776
777// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700778// libc_bionic.a - home-grown C library code
779// ========================================================
780
781cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700782 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700783 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800784 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700785 "bionic/sysconf.cpp",
786 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700787 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700788
Josh Gao10ec9282017-04-03 15:13:29 -0700789 // The following must not be statically linked into libc_ndk.a, because
790 // debuggerd will look for the abort message in libc.so's copy.
791 "bionic/android_set_abort_message.cpp",
792
Dan Willemsen208ae172015-09-16 16:33:27 -0700793 "bionic/strchr.cpp",
794 "bionic/strnlen.c",
795 "bionic/strrchr.cpp",
796 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700797
798 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700799 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700800 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700801 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800802 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700803 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800804 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800805 "arch-arm/generic/bionic/stpcpy.c",
806 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800807 "arch-arm/generic/bionic/strcmp.S",
808 "arch-arm/generic/bionic/strcpy.S",
809 "arch-arm/generic/bionic/strlen.c",
810
Ryan Prichard45024fe2018-12-30 21:10:26 -0800811 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700812 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700813 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700814 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700815 "arch-arm/bionic/atomics_arm.c",
816 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800817 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700818 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700819 "arch-arm/bionic/setjmp.S",
820 "arch-arm/bionic/syscall.S",
821 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800822
823 "arch-arm/cortex-a15/bionic/memcpy.S",
824 "arch-arm/cortex-a15/bionic/memmove.S",
825 "arch-arm/cortex-a15/bionic/memset.S",
826 "arch-arm/cortex-a15/bionic/stpcpy.S",
827 "arch-arm/cortex-a15/bionic/strcat.S",
828 "arch-arm/cortex-a15/bionic/strcmp.S",
829 "arch-arm/cortex-a15/bionic/strcpy.S",
830 "arch-arm/cortex-a15/bionic/strlen.S",
831
832 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800833 "arch-arm/cortex-a7/bionic/memset.S",
834
835 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800836 "arch-arm/cortex-a9/bionic/memset.S",
837 "arch-arm/cortex-a9/bionic/stpcpy.S",
838 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800839 "arch-arm/cortex-a9/bionic/strcpy.S",
840 "arch-arm/cortex-a9/bionic/strlen.S",
841
842 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800843 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800844
845 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800846
Haibo Huang01bfd892018-12-03 15:05:16 -0800847 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800848
849 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700850 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700851 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700852 arm64: {
853 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700854 "arch-arm64/generic/bionic/memcmp.S",
855 "arch-arm64/generic/bionic/memcpy.S",
856 "arch-arm64/generic/bionic/memmove.S",
857 "arch-arm64/generic/bionic/memset.S",
858 "arch-arm64/generic/bionic/stpcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700859 "arch-arm64/generic/bionic/strcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700860 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800861
Peter Collingbourne900d07d2019-10-28 13:11:00 -0700862 "arch-arm64/default/bionic/memchr.S",
863 "arch-arm64/default/bionic/strchr.S",
864 "arch-arm64/default/bionic/strcmp.S",
865 "arch-arm64/default/bionic/strlen.S",
866 "arch-arm64/default/bionic/strncmp.S",
867 "arch-arm64/default/bionic/strnlen.S",
868
869 "arch-arm64/mte/bionic/memchr.c",
870 "arch-arm64/mte/bionic/strchr.cpp",
871 "arch-arm64/mte/bionic/strcmp.c",
872 "arch-arm64/mte/bionic/strlen.c",
873 "arch-arm64/mte/bionic/strncmp.c",
874 "arch-arm64/mte/bionic/strnlen.c",
875
Dan Willemsen3e621712016-02-03 21:48:08 -0800876 "arch-arm64/bionic/__bionic_clone.S",
877 "arch-arm64/bionic/_exit_with_stack_teardown.S",
878 "arch-arm64/bionic/setjmp.S",
879 "arch-arm64/bionic/syscall.S",
880 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700881 ],
882 exclude_srcs: [
883 "bionic/__memcpy_chk.cpp",
884 "bionic/strchr.cpp",
885 "bionic/strnlen.c",
886 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700887 },
888
889 mips: {
890 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800891 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530892 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800893 "arch-mips/string/memset.S",
894 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530895 "arch-mips/string/strncmp.S",
896 "arch-mips/string/strlen.c",
897 "arch-mips/string/strnlen.c",
898 "arch-mips/string/strchr.c",
899 "arch-mips/string/strcpy.c",
900 "arch-mips/string/memchr.c",
901 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800902
Dan Willemsen208ae172015-09-16 16:33:27 -0700903 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700904 "arch-mips/bionic/cacheflush.cpp",
905 "arch-mips/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800906 "arch-mips/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700907 "arch-mips/bionic/setjmp.S",
908 "arch-mips/bionic/syscall.S",
909 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700910 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530911 exclude_srcs: [
912 "bionic/strchr.cpp",
913 "bionic/strnlen.c",
914 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700915 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700916 mips64: {
917 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800918 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530919 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800920 "arch-mips/string/memset.S",
921 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530922 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800923 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530924 "arch-mips/string/strnlen.c",
925 "arch-mips/string/strchr.c",
926 "arch-mips/string/strcpy.c",
927 "arch-mips/string/memchr.c",
928 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800929
Dan Willemsen208ae172015-09-16 16:33:27 -0700930 "arch-mips64/bionic/__bionic_clone.S",
931 "arch-mips64/bionic/_exit_with_stack_teardown.S",
932 "arch-mips64/bionic/setjmp.S",
933 "arch-mips64/bionic/syscall.S",
934 "arch-mips64/bionic/vfork.S",
935 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700936 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530937 exclude_srcs: [
938 "bionic/strchr.cpp",
939 "bionic/strnlen.c",
940 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700941 },
942
943 x86: {
944 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700945 "arch-x86/generic/string/memcmp.S",
946 "arch-x86/generic/string/strcmp.S",
947 "arch-x86/generic/string/strncmp.S",
948 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700949
950 "arch-x86/generic/string/strlcat.c",
951 "arch-x86/generic/string/strlcpy.c",
952 "arch-x86/generic/string/strncat.c",
953 "arch-x86/generic/string/wcscat.c",
954 "arch-x86/generic/string/wcscpy.c",
955 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530956 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700957
Dan Willemsen208ae172015-09-16 16:33:27 -0700958 "arch-x86/atom/string/sse2-memchr-atom.S",
959 "arch-x86/atom/string/sse2-memrchr-atom.S",
960 "arch-x86/atom/string/sse2-strchr-atom.S",
961 "arch-x86/atom/string/sse2-strnlen-atom.S",
962 "arch-x86/atom/string/sse2-strrchr-atom.S",
963 "arch-x86/atom/string/sse2-wcschr-atom.S",
964 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
965 "arch-x86/atom/string/sse2-wcslen-atom.S",
966 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700967 "arch-x86/silvermont/string/sse2-memmove-slm.S",
968 "arch-x86/silvermont/string/sse2-memset-slm.S",
969 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
970 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
971 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
972 "arch-x86/silvermont/string/sse2-strlen-slm.S",
973 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800974
975 "arch-x86/bionic/__bionic_clone.S",
976 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800977 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800978 "arch-x86/bionic/__restore.S",
979 "arch-x86/bionic/setjmp.S",
980 "arch-x86/bionic/syscall.S",
981 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700982
983 // ssse3 functions
984 "arch-x86/atom/string/ssse3-strcat-atom.S",
985 "arch-x86/atom/string/ssse3-strcmp-atom.S",
986 "arch-x86/atom/string/ssse3-strlcat-atom.S",
987 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
988 "arch-x86/atom/string/ssse3-strncat-atom.S",
989 "arch-x86/atom/string/ssse3-strncmp-atom.S",
990 "arch-x86/atom/string/ssse3-wcscat-atom.S",
991 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
992
993 // sse4 functions
994 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
995 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
996
997 // atom functions
998 "arch-x86/atom/string/sse2-memset-atom.S",
999 "arch-x86/atom/string/sse2-strlen-atom.S",
1000 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -08001001 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001002 "arch-x86/atom/string/ssse3-strcpy-atom.S",
1003 "arch-x86/atom/string/ssse3-strncpy-atom.S",
1004 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +05301005
1006 // avx2 functions
1007 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001008 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001009
1010 exclude_srcs: [
1011 "bionic/strchr.cpp",
1012 "bionic/strnlen.c",
1013 "bionic/strrchr.cpp",
1014 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001015 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001016 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001017 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001018 "arch-x86_64/string/sse2-memmove-slm.S",
1019 "arch-x86_64/string/sse2-memset-slm.S",
1020 "arch-x86_64/string/sse2-stpcpy-slm.S",
1021 "arch-x86_64/string/sse2-stpncpy-slm.S",
1022 "arch-x86_64/string/sse2-strcat-slm.S",
1023 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001024 "arch-x86_64/string/sse2-strlen-slm.S",
1025 "arch-x86_64/string/sse2-strncat-slm.S",
1026 "arch-x86_64/string/sse2-strncpy-slm.S",
1027 "arch-x86_64/string/sse4-memcmp-slm.S",
1028 "arch-x86_64/string/ssse3-strcmp-slm.S",
1029 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +05301030 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001031
1032 "arch-x86_64/bionic/__bionic_clone.S",
1033 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1034 "arch-x86_64/bionic/__restore_rt.S",
1035 "arch-x86_64/bionic/setjmp.S",
1036 "arch-x86_64/bionic/syscall.S",
1037 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001038 ],
1039 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001040 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001041
Colin Cross50c21ab2015-10-31 23:03:05 -07001042 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001043 include_dirs: ["bionic/libstdc++/include"],
1044 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001045}
1046
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001047genrule {
1048 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001049 out: ["generated_android_ids.h"],
1050 srcs: [":android_filesystem_config_header"],
1051 tool_files: ["fs_config_generator.py"],
1052 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001053}
1054
Dan Willemsen268a6732015-10-15 14:49:45 -07001055// ========================================================
1056// libc_bionic_ndk.a- The portions of libc_bionic that can
1057// be safely used in libc_ndk.a (no troublesome global data
1058// or constructors).
1059// ========================================================
1060cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001061 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001062 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001063 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001064 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001065 "bionic/__cmsg_nxthdr.cpp",
1066 "bionic/__errno.cpp",
1067 "bionic/__gnu_basename.cpp",
1068 "bionic/__libc_current_sigrtmax.cpp",
1069 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001070 "bionic/abort.cpp",
1071 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001072 "bionic/access.cpp",
1073 "bionic/arpa_inet.cpp",
1074 "bionic/assert.cpp",
1075 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001076 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001077 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001078 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001079 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001080 "bionic/bionic_systrace.cpp",
1081 "bionic/bionic_time_conversions.cpp",
1082 "bionic/brk.cpp",
1083 "bionic/c16rtomb.cpp",
1084 "bionic/c32rtomb.cpp",
1085 "bionic/chmod.cpp",
1086 "bionic/chown.cpp",
1087 "bionic/clearenv.cpp",
1088 "bionic/clock.cpp",
1089 "bionic/clock_getcpuclockid.cpp",
1090 "bionic/clock_nanosleep.cpp",
1091 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001092 "bionic/ctype.cpp",
1093 "bionic/dirent.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001094 "bionic/dup.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001095 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001096 "bionic/error.cpp",
1097 "bionic/eventfd_read.cpp",
1098 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001099 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001100 "bionic/faccessat.cpp",
1101 "bionic/fchmod.cpp",
1102 "bionic/fchmodat.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001103 "bionic/fcntl.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001104 "bionic/fdsan.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001105 "bionic/fdtrack.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001106 "bionic/ffs.cpp",
1107 "bionic/fgetxattr.cpp",
1108 "bionic/flistxattr.cpp",
1109 "bionic/flockfile.cpp",
1110 "bionic/fpclassify.cpp",
1111 "bionic/fsetxattr.cpp",
1112 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001113 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001114 "bionic/futimens.cpp",
1115 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001116 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001117 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001118 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001119 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001120 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001121 "bionic/getpgrp.cpp",
1122 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001123 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001124 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001125 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001126 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001127 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001128 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001129 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001130 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001131 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001132 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001133 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001134 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001135 "bionic/lchown.cpp",
1136 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001137 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001138 "bionic/libgen.cpp",
1139 "bionic/link.cpp",
1140 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001141 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001142 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001143 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001144 "bionic/mbrtoc16.cpp",
1145 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001146 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001147 "bionic/mempcpy.cpp",
1148 "bionic/mkdir.cpp",
1149 "bionic/mkfifo.cpp",
1150 "bionic/mknod.cpp",
1151 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001152 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001153 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001154 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001155 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001156 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001157 "bionic/open.cpp",
1158 "bionic/pathconf.cpp",
1159 "bionic/pause.cpp",
1160 "bionic/pipe.cpp",
1161 "bionic/poll.cpp",
1162 "bionic/posix_fadvise.cpp",
1163 "bionic/posix_fallocate.cpp",
1164 "bionic/posix_madvise.cpp",
1165 "bionic/posix_timers.cpp",
1166 "bionic/ptrace.cpp",
1167 "bionic/pty.cpp",
1168 "bionic/raise.cpp",
1169 "bionic/rand.cpp",
1170 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001171 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001172 "bionic/reboot.cpp",
1173 "bionic/recv.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001174 "bionic/recvmsg.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001175 "bionic/rename.cpp",
1176 "bionic/rmdir.cpp",
1177 "bionic/scandir.cpp",
1178 "bionic/sched_getaffinity.cpp",
1179 "bionic/sched_getcpu.cpp",
1180 "bionic/semaphore.cpp",
1181 "bionic/send.cpp",
1182 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001183 "bionic/seteuid.cpp",
1184 "bionic/setpgrp.cpp",
1185 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001186 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001187 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001188 "bionic/sleep.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001189 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001190 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001191 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001192 "bionic/strchrnul.cpp",
1193 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001194 "bionic/string_l.cpp",
1195 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001196 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001197 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001198 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001199 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001200 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001201 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001202 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001203 "bionic/sys_msg.cpp",
1204 "bionic/sys_sem.cpp",
1205 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001206 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001207 "bionic/sys_statfs.cpp",
1208 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001209 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001210 "bionic/sysinfo.cpp",
1211 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001212 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001213 "bionic/system_property_api.cpp",
1214 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001215 "bionic/tdestroy.cpp",
1216 "bionic/termios.cpp",
1217 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001218 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001219 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001220 "bionic/tmpfile.cpp",
1221 "bionic/umount.cpp",
1222 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001223 "bionic/usleep.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001224 "bionic/wait.cpp",
1225 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001226 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001227 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001228 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001229 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001230 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001231
1232 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1233 // which will be overridden by the actual one in libc.so.
1234 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001235 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001236
Dan Willemsen208ae172015-09-16 16:33:27 -07001237 multilib: {
1238 lib32: {
1239 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001240 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001241 },
1242 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001243 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001244 treble_linker_namespaces: {
1245 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001246 },
1247 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001248 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001249 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001250 local_include_dirs: ["stdio"],
1251 include_dirs: ["bionic/libstdc++/include"],
1252 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001253 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001254}
1255
Dan Willemsen208ae172015-09-16 16:33:27 -07001256// ========================================================
1257// libc_pthread.a - pthreads parts that previously lived in
1258// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001259// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001260// pthread_t has changed over the years and has ABI
1261// compatibility issues).
1262// ========================================================
1263
1264cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001265 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001266 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001267 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001268 "bionic/pthread_atfork.cpp",
1269 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001270 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001271 "bionic/pthread_cond.cpp",
1272 "bionic/pthread_create.cpp",
1273 "bionic/pthread_detach.cpp",
1274 "bionic/pthread_equal.cpp",
1275 "bionic/pthread_exit.cpp",
1276 "bionic/pthread_getcpuclockid.cpp",
1277 "bionic/pthread_getschedparam.cpp",
1278 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001279 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001280 "bionic/pthread_join.cpp",
1281 "bionic/pthread_key.cpp",
1282 "bionic/pthread_kill.cpp",
1283 "bionic/pthread_mutex.cpp",
1284 "bionic/pthread_once.cpp",
1285 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001286 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001287 "bionic/pthread_self.cpp",
1288 "bionic/pthread_setname_np.cpp",
1289 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001290 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001291
1292 // The following implementations depend on pthread data or implementation,
1293 // so we can't include them in libc_ndk.a.
1294 "bionic/__cxa_thread_atexit_impl.cpp",
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001295 "bionic/android_unsafe_frame_pointer_chase.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001296 "stdlib/atexit.c",
1297 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001298 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001299
Colin Cross50c21ab2015-10-31 23:03:05 -07001300 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001301 include_dirs: ["bionic/libstdc++/include"],
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001302 header_libs: ["bionic_libc_platform_headers"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001303 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001304}
1305
1306// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001307// libc_syscalls.a
1308// ========================================================
1309
Elliott Hughes782c4852019-04-16 12:31:00 -07001310genrule {
1311 name: "syscalls-arm.S",
1312 out: ["syscalls-arm.S"],
1313 srcs: ["SYSCALLS.TXT"],
1314 tool_files: [":bionic-gensyscalls"],
1315 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1316}
1317
1318genrule {
1319 name: "syscalls-arm64.S",
1320 out: ["syscalls-arm64.S"],
1321 srcs: ["SYSCALLS.TXT"],
1322 tool_files: [":bionic-gensyscalls"],
1323 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1324}
1325
1326genrule {
1327 name: "syscalls-x86.S",
1328 out: ["syscalls-x86.S"],
1329 srcs: ["SYSCALLS.TXT"],
1330 tool_files: [":bionic-gensyscalls"],
1331 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1332}
1333
1334genrule {
1335 name: "syscalls-x86_64.S",
1336 out: ["syscalls-x86_64.S"],
1337 srcs: ["SYSCALLS.TXT"],
1338 tool_files: [":bionic-gensyscalls"],
1339 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1340}
1341
Dan Willemsen208ae172015-09-16 16:33:27 -07001342cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001343 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001344 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001345 arch: {
1346 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001347 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001348 },
1349 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001350 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001351 },
1352 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001353 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001354 },
1355 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001356 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001357 },
1358 },
1359 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001360}
1361
1362// ========================================================
1363// libc_aeabi.a
1364// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1365// to avoid infinite recursion. For the other architectures we just build an
1366// empty library to keep this makefile simple.
1367// ========================================================
1368
1369cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001370 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001371 arch: {
1372 arm: {
1373 srcs: ["arch-arm/bionic/__aeabi.c"],
1374 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001375 },
1376 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001377 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001378}
1379
1380// ========================================================
1381// libc_ndk.a
1382// Compatibility library for the NDK. This library contains
1383// all the parts of libc that are safe to statically link.
1384// We can't safely statically link things that can only run
1385// on a certain version of the OS. Examples include
1386// anything that talks to netd (a large portion of the DNS
1387// code) and anything that is dependent on the layout of a
1388// data structure that has changed across releases (such as
1389// pthread_t).
1390// ========================================================
1391
1392cc_library_static {
1393 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001394 defaults: [
1395 "libc_defaults",
1396 "libc_native_allocator_defaults",
1397 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -08001398 ramdisk_available: false,
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001399 srcs: libc_common_src_files + [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001400 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001401 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001402 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001403 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001404 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001405 multilib: {
1406 lib32: {
1407 srcs: libc_common_src_files_32,
1408 },
1409 },
1410 arch: {
1411 arm: {
1412 srcs: [
1413 "arch-arm/bionic/exidx_dynamic.c",
1414 "arch-common/bionic/crtbegin_so.c",
1415 "arch-arm/bionic/atexit_legacy.c",
1416 "arch-common/bionic/crtend_so.S",
1417 ],
1418 whole_static_libs: ["libc_aeabi"],
1419 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001420 },
1421
Colin Cross50c21ab2015-10-31 23:03:05 -07001422 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001423 "-fvisibility=hidden",
1424 "-DLIBC_STATIC",
1425 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001426
1427 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001428 "gwp_asan",
Dan Willemsen208ae172015-09-16 16:33:27 -07001429 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001430 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001431 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001432 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001433 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001434 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001435 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001436 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001437 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001438 "libc_syscalls",
1439 "libc_tzcode",
1440 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001441 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001442 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001443}
1444
1445// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001446// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001447// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001448cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001449 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001450 srcs: libc_common_src_files,
1451 multilib: {
1452 lib32: {
1453 srcs: libc_common_src_files_32,
1454 },
1455 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001456 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001457
1458 whole_static_libs: [
1459 "libc_bionic",
1460 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001461 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001462 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001463 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001464 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001465 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001466 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001467 "libc_netbsd",
1468 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001469 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001470 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001471 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001472 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001473 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001474 ],
1475
1476 arch: {
1477 arm: {
1478 whole_static_libs: ["libc_aeabi"],
1479 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001480 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001481}
1482
1483// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001484// libc_common.a
1485// ========================================================
1486
1487cc_library_static {
1488 defaults: ["libc_defaults"],
1489 name: "libc_common",
1490
1491 whole_static_libs: [
1492 "libc_nopthread",
1493 "libc_pthread",
1494 ],
1495}
1496
1497// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001498// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001499// ========================================================
1500cc_library_static {
1501 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001502 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001503
Haibo Huangb9244ff2018-08-11 10:12:13 -07001504 arch: {
1505 x86: {
1506 srcs: ["arch-x86/static_function_dispatch.S"],
1507 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001508 arm: {
1509 srcs: ["arch-arm/static_function_dispatch.S"],
1510 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001511 arm64: {
1512 srcs: ["arch-arm64/static_function_dispatch.S"],
1513 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001514 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001515}
1516
1517// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001518// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001519// ========================================================
1520cc_library_static {
1521 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001522 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001523
Haibo Huangb9244ff2018-08-11 10:12:13 -07001524 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001525 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001526 "-fno-stack-protector",
1527 "-fno-jump-tables",
1528 ],
1529 arch: {
1530 x86: {
1531 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1532 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001533 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001534 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001535 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001536 arm64: {
1537 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1538 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001539 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001540}
1541
1542// ========================================================
1543// libc_common_static.a For static binaries.
1544// ========================================================
1545cc_library_static {
1546 defaults: ["libc_defaults"],
1547 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001548
Haibo Huangf71edfa2018-11-12 10:06:56 -08001549 whole_static_libs: [
1550 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001551 "libc_static_dispatch",
1552 ],
1553}
1554
1555// ========================================================
1556// libc_common_shared.a For shared libraries.
1557// ========================================================
1558cc_library_static {
1559 defaults: ["libc_defaults"],
1560 name: "libc_common_shared",
1561
1562 whole_static_libs: [
1563 "libc_common",
1564 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001565 ],
1566}
1567
Ryan Prichard22a6a052019-10-10 23:59:30 -07001568// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1569// executable.
1570cc_library_static {
1571 name: "libc_unwind_static",
1572 defaults: ["libc_defaults"],
1573 cflags: ["-DLIBC_STATIC"],
1574
1575 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1576 arch: {
1577 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1578 arm: {
1579 srcs: ["arch-arm/bionic/exidx_static.c"],
1580 },
1581 },
1582}
1583
Haibo Huangf71edfa2018-11-12 10:06:56 -08001584// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001585// libc_nomalloc.a
1586// ========================================================
1587//
Ryan Prichard249757b2019-11-01 17:18:28 -07001588// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1589// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1590// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001591
1592cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001593 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001594 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001595
Colin Crossa3f9fca2016-01-11 13:20:55 -08001596 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001597 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001598 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001599 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001600 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001601}
1602
dimitryc0c0ef62018-12-05 16:33:52 +01001603filegroup {
1604 name: "libc_sources_shared",
1605 srcs: [
1606 "arch-common/bionic/crtbegin_so.c",
1607 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001608 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001609 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001610 "bionic/icu.cpp",
1611 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001612 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001613 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001614 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001615 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001616 "bionic/ndk_cruft.cpp",
1617 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001618 "bionic/NetdClient.cpp",
1619 "arch-common/bionic/crtend_so.S",
1620 ],
1621}
1622
1623filegroup {
1624 name: "libc_sources_static",
1625 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001626 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001627 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001628 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001629 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001630 ],
1631}
1632
1633filegroup {
1634 name: "libc_sources_shared_arm",
1635 srcs: [
1636 "arch-arm/bionic/exidx_dynamic.c",
1637 "arch-arm/bionic/atexit_legacy.c",
1638 ],
1639}
1640
Dan Willemsen208ae172015-09-16 16:33:27 -07001641// ========================================================
1642// libc.a + libc.so
1643// ========================================================
1644cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001645 defaults: [
1646 "libc_defaults",
1647 "libc_native_allocator_defaults",
1648 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001649 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001650 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001651 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001652 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001653 platform_sdk_version: {
1654 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1655 },
1656 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001657 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001658 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001659 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001660 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001661 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001662 "libc_init_static",
1663 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001664 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001665 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001666 },
1667 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001668 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001669 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001670 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001671 "libc_init_dynamic",
1672 "libc_common_shared",
1673 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001674 },
1675
Neil Fullera7db90f2019-04-25 09:28:27 +01001676 required: [
1677 "tzdata",
1678 "tz_version", // Version metadata for tzdata to help debugging.
1679 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001680
Colin Cross4ce94d22016-11-15 13:15:43 -08001681 // Do not pack libc.so relocations; see http://b/20645321 for details.
1682 pack_relocations: false,
1683
dimitry06016f22018-01-05 11:39:28 +01001684 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1685 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1686 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1687 // those new libraries from libgcc.a are not declared external; if that were the case,
1688 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1689 // on the external symbols from the dependent libraries. That would create a "cloaked"
1690 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001691
dimitry06016f22018-01-05 11:39:28 +01001692 shared_libs: [
1693 "ld-android",
1694 "libdl",
1695 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001696 static_libs: [
1697 "libdl_android",
1698 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001699
1700 nocrt: true,
1701
Dan Willemsen208ae172015-09-16 16:33:27 -07001702 arch: {
1703 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001704 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001705 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001706 ldflags: ["-Wl,--hash-style=both"],
1707
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001708 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001709
Dan Willemsen208ae172015-09-16 16:33:27 -07001710 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001711 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001712 // special for arm
1713 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001714 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001715
1716 // Arm 32 bit does not produce complete exidx unwind information
1717 // so keep the .debug_frame which is relatively small and does
1718 // include needed unwind information.
1719 // See b/132992102 for details.
1720 strip: {
1721 keep_symbols_and_debug_frame: true,
1722 },
Peter Collingbourneb061e772019-11-12 14:26:21 -08001723
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001724 whole_static_libs: [ "libunwind_llvm" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001725 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001726 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001727 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001728
1729 // Leave the symbols in the shared library so that stack unwinders can produce
1730 // meaningful name resolution.
1731 strip: {
1732 keep_symbols: true,
1733 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001734
1735 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001736 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001737 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001738 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001739 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001740 ldflags: ["-Wl,--hash-style=both"],
1741
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001742 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001743
1744 // Leave the symbols in the shared library so that stack unwinders can produce
1745 // meaningful name resolution.
1746 strip: {
1747 keep_symbols: true,
1748 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001749
1750 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001751 },
1752 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001753 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001754
1755 // Leave the symbols in the shared library so that stack unwinders can produce
1756 // meaningful name resolution.
1757 strip: {
1758 keep_symbols: true,
1759 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001760
1761 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001762 },
1763 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001764
1765 stubs: {
1766 symbol_file: "libc.map.txt",
1767 versions: ["10000"],
1768 },
Vic Yang6903fb82019-01-14 11:34:39 -08001769
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001770 apex_available: [
1771 "//apex_available:platform",
1772 "com.android.runtime",
1773 ],
1774
Vic Yang03ff4362019-06-24 16:11:37 -07001775 // Sorting bss symbols by size usually results in less dirty pages at run
1776 // time, because small symbols are grouped together.
1777 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001778}
1779
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001780genrule {
1781 name: "libc.arm.map",
1782 out: ["libc.arm.map"],
1783 srcs: ["libc.map.txt"],
1784 tool_files: [":bionic-generate-version-script"],
1785 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1786}
1787
1788genrule {
1789 name: "libc.arm64.map",
1790 out: ["libc.arm64.map"],
1791 srcs: ["libc.map.txt"],
1792 tool_files: [":bionic-generate-version-script"],
1793 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1794}
1795
1796genrule {
1797 name: "libc.x86.map",
1798 out: ["libc.x86.map"],
1799 srcs: ["libc.map.txt"],
1800 tool_files: [":bionic-generate-version-script"],
1801 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1802}
1803
1804genrule {
1805 name: "libc.x86_64.map",
1806 out: ["libc.x86_64.map"],
1807 srcs: ["libc.map.txt"],
1808 tool_files: [":bionic-generate-version-script"],
1809 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1810}
1811
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001812// Headers that only other parts of the platform can include.
1813cc_library_headers {
1814 name: "bionic_libc_platform_headers",
1815 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001816 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001817 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001818 "//frameworks:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001819 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001820 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001821 "//system/core/debuggerd:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001822 "//system/memory/libmemunreachable:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001823 ],
1824 host_supported: true,
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001825 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001826 ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001827 recovery_available: true,
1828 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001829 export_include_dirs: [
1830 "platform",
1831 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001832 system_shared_libs: [],
1833 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001834 sdk_version: "current",
1835}
1836
Logan Chien17af91b2019-01-15 21:19:56 +08001837// libc_headers for libasync_safe and libpropertyinfoparser
1838cc_library_headers {
1839 name: "libc_headers",
1840
1841 host_supported: true,
1842 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001843 ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001844 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001845 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001846
1847 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001848 stl: "none",
1849 system_shared_libs: [],
1850
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001851 // The build system generally requires that any dependencies of a target
1852 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1853 // to 1 we let targets with an sdk_version that need to depend on the libc
1854 // headers but cannot depend on libc itself due to circular dependencies
1855 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1856 // is correct because the headers can support any sdk_version.
1857 sdk_version: "1",
1858
Logan Chien17af91b2019-01-15 21:19:56 +08001859 export_include_dirs: [
1860 "include",
1861 "kernel/uapi",
1862 "kernel/android/uapi",
1863 ],
1864
1865 arch: {
1866 arm: {
1867 export_include_dirs: [
1868 "kernel/uapi/asm-arm",
1869 ],
1870 },
1871 arm64: {
1872 export_include_dirs: [
1873 "kernel/uapi/asm-arm64",
1874 ],
1875 },
Logan Chien17af91b2019-01-15 21:19:56 +08001876 x86: {
1877 export_include_dirs: [
1878 "kernel/uapi/asm-x86",
1879 ],
1880 },
1881 x86_64: {
1882 export_include_dirs: [
1883 "kernel/uapi/asm-x86",
1884 ],
1885 },
1886 },
1887}
1888
Dan Willemsen208ae172015-09-16 16:33:27 -07001889// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001890// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001891// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001892
Dan Willemsen208ae172015-09-16 16:33:27 -07001893cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001894 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001895 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001896 srcs: [
1897 "bionic/__cxa_guard.cpp",
1898 "bionic/__cxa_pure_virtual.cpp",
1899 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001900 ],
1901 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001902 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001903 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001904
Dan Willemsen6b3be172018-12-03 13:57:20 -08001905 static: {
1906 system_shared_libs: [],
1907 },
1908 shared: {
1909 system_shared_libs: ["libc"],
1910 },
1911
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001912 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001913 arch: {
1914 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001915 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001916 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001917 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001918 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001919 },
1920 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001921 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001922 },
1923 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001924 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001925 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001926 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001927 },
1928 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001929 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001930 },
1931 },
1932}
1933
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001934genrule {
1935 name: "libstdc++.arm.map",
1936 out: ["libstdc++.arm.map"],
1937 srcs: ["libstdc++.map.txt"],
1938 tool_files: [":bionic-generate-version-script"],
1939 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1940}
1941
1942genrule {
1943 name: "libstdc++.arm64.map",
1944 out: ["libstdc++.arm64.map"],
1945 srcs: ["libstdc++.map.txt"],
1946 tool_files: [":bionic-generate-version-script"],
1947 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1948}
1949
1950genrule {
1951 name: "libstdc++.x86.map",
1952 out: ["libstdc++.x86.map"],
1953 srcs: ["libstdc++.map.txt"],
1954 tool_files: [":bionic-generate-version-script"],
1955 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1956}
1957
1958genrule {
1959 name: "libstdc++.x86_64.map",
1960 out: ["libstdc++.x86_64.map"],
1961 srcs: ["libstdc++.map.txt"],
1962 tool_files: [":bionic-generate-version-script"],
1963 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1964}
1965
1966// ========================================================
1967// crt object files.
1968// ========================================================
1969
Colin Cross50c21ab2015-10-31 23:03:05 -07001970cc_defaults {
1971 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001972 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001973 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001974 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001975 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001976 native_bridge_supported: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001977
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001978 cflags: [
1979 "-Wno-gcc-compat",
1980 "-Wall",
1981 "-Werror",
1982 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07001983 sanitize: {
1984 never: true,
1985 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001986}
1987
Colin Cross50c21ab2015-10-31 23:03:05 -07001988cc_defaults {
1989 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001990 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001991
1992 arch: {
1993 mips: {
1994 cflags: ["-fPIC"],
1995 },
1996 mips64: {
1997 cflags: ["-fPIC"],
1998 },
1999 x86: {
2000 cflags: ["-fPIC"],
2001 },
2002 x86_64: {
2003 cflags: ["-fPIC"],
2004 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002005 },
Colin Crossab179442018-09-27 11:03:22 -07002006 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002007}
2008
Dan Willemsen208ae172015-09-16 16:33:27 -07002009cc_object {
2010 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002011 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002012 local_include_dirs: ["include"],
2013 product_variables: {
2014 platform_sdk_version: {
2015 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2016 },
2017 },
2018 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002019
Colin Cross7d7b3682017-11-03 13:38:40 -07002020 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002021}
2022
Dan Willemsen208ae172015-09-16 16:33:27 -07002023cc_object {
2024 name: "crtbegin_so1",
2025 local_include_dirs: ["include"],
2026 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002027
Colin Cross7d7b3682017-11-03 13:38:40 -07002028 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002029}
2030
Dan Willemsen208ae172015-09-16 16:33:27 -07002031cc_object {
2032 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002033
Colin Cross7d7b3682017-11-03 13:38:40 -07002034 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002035 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002036 "crtbegin_so1",
2037 "crtbrand",
2038 ],
2039}
2040
Dan Willemsen208ae172015-09-16 16:33:27 -07002041cc_object {
2042 name: "crtend_so",
2043 local_include_dirs: ["include"],
2044 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002045
Colin Cross7d7b3682017-11-03 13:38:40 -07002046 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002047}
2048
Dan Willemsen208ae172015-09-16 16:33:27 -07002049cc_object {
2050 name: "crtbegin_static1",
2051 local_include_dirs: ["include"],
2052 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002053
Colin Cross50c21ab2015-10-31 23:03:05 -07002054 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002055 mips: {
2056 srcs: [
2057 "arch-mips/bionic/crtbegin.c",
2058 ],
2059 exclude_srcs: [
2060 "arch-common/bionic/crtbegin.c",
2061 ],
2062 },
2063 mips64: {
2064 srcs: [
2065 "arch-mips64/bionic/crtbegin.c",
2066 ],
2067 exclude_srcs: [
2068 "arch-common/bionic/crtbegin.c",
2069 ],
2070 },
2071 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002072
2073 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002074}
2075
Dan Willemsen208ae172015-09-16 16:33:27 -07002076cc_object {
2077 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002078
Colin Cross77d57bf2016-04-11 14:34:18 -07002079 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002080 "crtbegin_static1",
2081 "crtbrand",
2082 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002083 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002084}
2085
Dan Willemsen208ae172015-09-16 16:33:27 -07002086cc_object {
2087 name: "crtbegin_dynamic1",
2088 local_include_dirs: ["include"],
2089 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002090
Colin Cross50c21ab2015-10-31 23:03:05 -07002091 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002092 mips: {
2093 srcs: [
2094 "arch-mips/bionic/crtbegin.c",
2095 ],
2096 exclude_srcs: [
2097 "arch-common/bionic/crtbegin.c",
2098 ],
2099 },
2100 mips64: {
2101 srcs: [
2102 "arch-mips64/bionic/crtbegin.c",
2103 ],
2104 exclude_srcs: [
2105 "arch-common/bionic/crtbegin.c",
2106 ],
2107 },
2108 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002109 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002110}
2111
Dan Willemsen208ae172015-09-16 16:33:27 -07002112cc_object {
2113 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002114
Colin Cross77d57bf2016-04-11 14:34:18 -07002115 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002116 "crtbegin_dynamic1",
2117 "crtbrand",
2118 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002119 target: {
2120 linux_bionic: {
2121 generated_sources: ["host_bionic_linker_asm"],
2122 objs: [
2123 "linker_wrapper",
2124 ],
2125 },
2126 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002127 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002128}
2129
Dan Willemsen208ae172015-09-16 16:33:27 -07002130cc_object {
2131 // We rename crtend.o to crtend_android.o to avoid a
2132 // name clash between gcc and bionic.
2133 name: "crtend_android",
2134 local_include_dirs: ["include"],
2135 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002136
Colin Cross50c21ab2015-10-31 23:03:05 -07002137 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002138}
Colin Crossbaa48992016-07-13 11:15:21 -07002139
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002140// ========================================================
2141// NDK headers.
2142// ========================================================
2143
Dan Albert26e1c412018-05-24 14:56:46 -07002144versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002145 name: "common_libc",
2146 from: "include",
2147 to: "",
2148 license: "NOTICE",
2149}
Dan Albert4238a352016-06-28 11:18:05 -07002150
2151ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002152 name: "libc_uapi",
2153 from: "kernel/uapi",
2154 to: "",
2155 srcs: [
2156 "kernel/uapi/asm-generic/**/*.h",
2157 "kernel/uapi/drm/**/*.h",
2158 "kernel/uapi/linux/**/*.h",
2159 "kernel/uapi/misc/**/*.h",
2160 "kernel/uapi/mtd/**/*.h",
2161 "kernel/uapi/rdma/**/*.h",
2162 "kernel/uapi/scsi/**/*.h",
2163 "kernel/uapi/sound/**/*.h",
2164 "kernel/uapi/video/**/*.h",
2165 "kernel/uapi/xen/**/*.h",
2166 ],
Dan Albert92592652016-10-20 01:42:54 -07002167 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002168}
2169
2170ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002171 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002172 from: "kernel/android/uapi/linux",
2173 to: "linux",
2174 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002175 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002176}
2177
2178ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002179 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002180 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002181 to: "scsi",
2182 srcs: ["kernel/android/scsi/**/*.h"],
2183 license: "NOTICE",
2184}
2185
2186ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002187 name: "libc_asm_arm",
2188 from: "kernel/uapi/asm-arm",
2189 to: "arm-linux-androideabi",
2190 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002191 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002192}
2193
2194ndk_headers {
2195 name: "libc_asm_arm64",
2196 from: "kernel/uapi/asm-arm64",
2197 to: "aarch64-linux-android",
2198 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002199 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002200}
2201
Lazar Trsic790d2f72017-11-27 11:54:11 +01002202ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002203 name: "libc_asm_x86",
2204 from: "kernel/uapi/asm-x86",
2205 to: "i686-linux-android",
2206 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002207 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002208}
2209
2210ndk_headers {
2211 name: "libc_asm_x86_64",
2212 from: "kernel/uapi/asm-x86",
2213 to: "x86_64-linux-android",
2214 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002215 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002216}
2217
Dan Albert4238a352016-06-28 11:18:05 -07002218ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002219 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002220 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002221 symbol_file: "libc.map.txt",
2222 first_version: "9",
2223}
2224
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002225llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002226 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002227 symbol_file: "libc.map.txt",
2228 export_headers_as_system: true,
2229 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002230 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002231 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002232 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002233 "kernel/android/uapi",
2234 "kernel/uapi",
2235 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002236 arch: {
2237 arm: {
2238 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002239 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002240 ],
2241 },
2242 arm64: {
2243 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002244 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002245 ],
2246 },
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002247 x86: {
2248 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002249 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002250 ],
2251 },
2252 x86_64: {
2253 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002254 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002255 ],
2256 },
2257 },
2258}
2259
Dan Albertdf31aff2016-10-06 15:50:41 -07002260ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002261 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002262 symbol_file: "libstdc++.map.txt",
2263 first_version: "9",
2264}
2265
Dan Willemsenca056d72018-01-08 14:00:24 -08002266// Export these headers for toolbox to process
2267filegroup {
2268 name: "kernel_input_headers",
2269 srcs: [
2270 "kernel/uapi/linux/input.h",
2271 "kernel/uapi/linux/input-event-codes.h",
2272 ],
2273}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002274
2275// Generate a syscall name / number mapping. These objects are text files
2276// (thanks to the -dD -E flags) and not binary files. They will then be
2277// consumed by the genseccomp.py script and converted into C++ code.
2278cc_defaults {
2279 name: "libseccomp_gen_syscall_nrs_defaults",
2280 recovery_available: true,
2281 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2282 cflags: [
2283 "-dD",
2284 "-E",
2285 "-Wall",
2286 "-Werror",
2287 "-nostdinc",
2288 ],
2289}
2290
2291cc_object {
2292 name: "libseccomp_gen_syscall_nrs_arm",
2293 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2294 local_include_dirs: [
2295 "kernel/uapi/asm-arm",
2296 "kernel/uapi",
2297 ],
2298}
2299
2300cc_object {
2301 name: "libseccomp_gen_syscall_nrs_arm64",
2302 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2303 local_include_dirs: [
2304 "kernel/uapi/asm-arm64",
2305 "kernel/uapi",
2306 ],
2307}
2308
2309cc_object {
2310 name: "libseccomp_gen_syscall_nrs_x86",
2311 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2312 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2313 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2314 local_include_dirs: [
2315 "kernel/uapi/asm-x86",
2316 "kernel/uapi",
2317 ],
2318}
2319
2320cc_object {
2321 name: "libseccomp_gen_syscall_nrs_x86_64",
2322 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2323 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2324 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2325 local_include_dirs: [
2326 "kernel/uapi/asm-x86",
2327 "kernel/uapi",
2328 ],
2329}
2330
Elliott Hughesae03b122019-09-17 16:37:05 -07002331// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002332python_binary_host {
2333 name: "genseccomp",
2334 main: "tools/genseccomp.py",
2335
2336 srcs: [
2337 "tools/genseccomp.py",
2338 "tools/gensyscalls.py",
2339 ],
2340
2341 data: [
2342 "kernel/uapi/**/*.h",
2343 ],
2344
2345 version: {
2346 py2: {
2347 enabled: true,
2348 },
2349 py3: {
2350 enabled: false,
2351 },
2352 },
2353}
2354
Martijn Coenen0c6de752019-01-02 12:52:51 +01002355python_binary_host {
2356 name: "genfunctosyscallnrs",
2357 main: "tools/genfunctosyscallnrs.py",
2358
2359 srcs: [
2360 "tools/genseccomp.py",
2361 "tools/genfunctosyscallnrs.py",
2362 "tools/gensyscalls.py",
2363 ],
2364
2365 data: [
2366 "kernel/uapi/**/*.h",
2367 ],
2368
2369 version: {
2370 py2: {
2371 enabled: true,
2372 },
2373 py3: {
2374 enabled: false,
2375 },
2376 },
2377}
2378
2379cc_genrule {
2380 name: "func_to_syscall_nrs",
2381 recovery_available: true,
2382 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2383
2384 tools: [ "genfunctosyscallnrs" ],
2385
2386 srcs: [
2387 "SYSCALLS.TXT",
2388 ":libseccomp_gen_syscall_nrs_arm",
2389 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002390 ":libseccomp_gen_syscall_nrs_x86",
2391 ":libseccomp_gen_syscall_nrs_x86_64",
2392 ],
2393
2394 out: [
2395 "func_to_syscall_nrs.h",
2396 ],
2397}
2398
Martijn Coenenc3752be2019-01-09 16:19:57 +01002399// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2400genrule {
2401 name: "generate_app_zygote_blacklist",
2402 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2403 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2404 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2405}
2406
2407cc_genrule {
2408 name: "libseccomp_policy_app_zygote_sources",
2409 recovery_available: true,
2410 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2411
2412 tools: [ "genseccomp" ],
2413
2414 srcs: [
2415 "SYSCALLS.TXT",
2416 "SECCOMP_WHITELIST_COMMON.TXT",
2417 "SECCOMP_WHITELIST_APP.TXT",
2418 "SECCOMP_BLACKLIST_COMMON.TXT",
2419 ":generate_app_zygote_blacklist",
2420 ":libseccomp_gen_syscall_nrs_arm",
2421 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002422 ":libseccomp_gen_syscall_nrs_x86",
2423 ":libseccomp_gen_syscall_nrs_x86_64",
2424 ],
2425
2426 out: [
2427 "arm64_app_zygote_policy.cpp",
2428 "arm_app_zygote_policy.cpp",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002429 "x86_64_app_zygote_policy.cpp",
2430 "x86_app_zygote_policy.cpp",
2431 ],
2432}
2433
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002434cc_genrule {
2435 name: "libseccomp_policy_app_sources",
2436 recovery_available: true,
2437 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2438
2439 tools: [ "genseccomp" ],
2440
2441 srcs: [
2442 "SYSCALLS.TXT",
2443 "SECCOMP_WHITELIST_COMMON.TXT",
2444 "SECCOMP_WHITELIST_APP.TXT",
2445 "SECCOMP_BLACKLIST_COMMON.TXT",
2446 "SECCOMP_BLACKLIST_APP.TXT",
2447 ":libseccomp_gen_syscall_nrs_arm",
2448 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002449 ":libseccomp_gen_syscall_nrs_x86",
2450 ":libseccomp_gen_syscall_nrs_x86_64",
2451 ],
2452
2453 out: [
2454 "arm64_app_policy.cpp",
2455 "arm_app_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002456 "x86_64_app_policy.cpp",
2457 "x86_app_policy.cpp",
2458 ],
2459}
2460
2461cc_genrule {
2462 name: "libseccomp_policy_system_sources",
2463 recovery_available: true,
2464 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2465
2466 tools: [ "genseccomp" ],
2467
2468 srcs: [
2469 "SYSCALLS.TXT",
2470 "SECCOMP_WHITELIST_COMMON.TXT",
2471 "SECCOMP_WHITELIST_SYSTEM.TXT",
2472 "SECCOMP_BLACKLIST_COMMON.TXT",
2473 ":libseccomp_gen_syscall_nrs_arm",
2474 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002475 ":libseccomp_gen_syscall_nrs_x86",
2476 ":libseccomp_gen_syscall_nrs_x86_64",
2477 ],
2478
2479 out: [
2480 "arm64_system_policy.cpp",
2481 "arm_system_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002482 "x86_64_system_policy.cpp",
2483 "x86_system_policy.cpp",
2484 ],
2485}
2486
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002487cc_library {
2488 name: "libseccomp_policy",
2489 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002490 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002491 generated_sources: [
2492 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002493 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002494 "libseccomp_policy_system_sources",
2495 ],
2496
2497 srcs: [
2498 "seccomp/seccomp_policy.cpp",
2499 ],
2500
2501 export_include_dirs: ["seccomp/include"],
2502 cflags: [
2503 "-Wall",
2504 "-Werror",
2505 ],
2506 shared: {
2507 shared_libs: ["libbase"],
2508 },
2509 static: {
2510 static_libs: ["libbase"],
2511 },
2512}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002513
2514// This is a temporary library that will use scudo as the native memory
2515// allocator. To use it, add it as the first shared library.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002516cc_defaults {
2517 name: "libc_scudo_wrapper_defaults",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002518 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002519 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08002520 "bionic/heap_tagging.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002521 "bionic/malloc_common.cpp",
2522 "bionic/malloc_common_dynamic.cpp",
2523 "bionic/malloc_heapprofd.cpp",
2524 "bionic/malloc_limit.cpp",
2525 "bionic/scudo_wrapper.cpp",
2526 "bionic/__set_errno.cpp",
2527 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002528 cflags: [
2529 "-DUSE_SCUDO",
2530 "-fno-emulated-tls", // Required for GWP-ASan.
2531 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002532 shared_libs: ["libscudo_wrapper"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002533
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002534 header_libs: [
2535 "libc_headers",
2536 "gwp_asan_headers",
2537 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002538
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002539 static_libs: [
2540 "libasync_safe",
2541 "gwp_asan",
2542 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002543
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002544 arch: {
2545 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002546 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002547 },
2548 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002549 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002550 },
2551 x86: {
2552 srcs: [
2553 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002554 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002555 ],
2556 },
2557 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002558 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002559 },
2560 },
2561
2562 // Mark this library as global so it overrides all the allocation
2563 // definitions properly.
2564 ldflags: ["-Wl,-z,global"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002565}
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002566
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002567cc_library_shared {
2568 name: "libc_scudo",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002569 vendor_available: true,
2570 stl: "none",
2571 system_shared_libs: [],
2572
2573 allow_undefined_symbols: true,
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002574 // Like libc, disable native coverage for libc_scudo.
2575 native_coverage: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002576}
2577
2578subdirs = [
2579 "bionic/scudo",
2580]