blob: 0c7ab49469caf6c180acead12740b2cb96dd7700 [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001// Define the common source files for all the libc instances
2// =========================================================
3libc_common_src_files = [
Christopher Ferris7a3681e2017-04-24 17:48:32 -07004 "async_safe/async_safe_log.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07005 "bionic/ether_aton.c",
6 "bionic/ether_ntoa.c",
7 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/pututline.c",
11 "bionic/sched_cpualloc.c",
12 "bionic/sched_cpucount.c",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070013 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070014 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070015 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080016 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070017 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080018 "stdio/vfscanf.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070019 "stdio/vfwscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070020 "stdlib/exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070021]
22
Peter Collingbourne570de332019-12-11 10:00:58 -080023// off64_t/time64_t support on LP32.
Dan Willemsen208ae172015-09-16 16:33:27 -070024// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -070025libc_common_src_files_32 = [
26 "bionic/legacy_32_bit_support.cpp",
27 "bionic/time64.c",
28]
29
Elliott Hughes53cf3482016-08-09 13:06:41 -070030libc_common_flags = [
31 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080032 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070033 "-Wall",
34 "-Wextra",
35 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080036 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070037 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070038 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070039 "-Wframe-larger-than=2048",
Elliott Hughes53cf3482016-08-09 13:06:41 -070040
41 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
42 "-Werror=pointer-to-int-cast",
43 "-Werror=int-to-pointer-cast",
44 "-Werror=type-limits",
45 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080046
47 // Clang's exit-time destructor registration hides __dso_handle, but
48 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
49 "-Wexit-time-destructors",
Elliott Hughes53cf3482016-08-09 13:06:41 -070050]
51
Dan Willemsen208ae172015-09-16 16:33:27 -070052// Define some common cflags
53// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070054cc_defaults {
55 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080056 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070057 cflags: libc_common_flags,
58 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070059 conlyflags: ["-std=gnu99"],
60 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070061 include_dirs: [
62 "bionic/libc/async_safe/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070063 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070064
Colin Cross50c21ab2015-10-31 23:03:05 -070065 stl: "none",
66 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070067 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070068 address: false,
69 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070070 // TODO(b/132640749): Fix broken fuzzer support.
71 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070072 },
Colin Cross50c21ab2015-10-31 23:03:05 -070073 native_coverage: false,
Yifan Hong5a39cee2020-01-21 16:43:56 -080074 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090075 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020076 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080077
Yi Konge3d90de2019-02-20 14:28:56 -080078 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
79 // warning since this is intended right now.
80 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070081
82 product_variables: {
83 experimental_mte: {
84 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
85 },
86 },
Dan Willemsen208ae172015-09-16 16:33:27 -070087}
88
Christopher Ferrise55e5ee2019-10-01 17:54:42 -070089// Defaults for native allocator libs/includes to make it
90// easier to change.
91// To enable scudo, change the below to libc_scudo_defaults
92// and comment out the defaults line in libc_scudo shared
93// library.
94// ========================================================
95cc_defaults {
96 name: "libc_native_allocator_defaults",
97
Anna Trostanetski9981a1d2020-01-20 20:16:29 +000098 defaults: ["libc_jemalloc5_defaults"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -070099}
100
101cc_defaults {
102 name: "libc_jemalloc5_defaults",
103
104 include_dirs: [
105 "external/jemalloc_new/include",
106 ],
107
108 whole_static_libs: [
109 "libjemalloc5",
110 "libc_jemalloc_wrapper",
111 ],
112}
113
114// Functions not implemented by jemalloc directly, or that need to
115// be modified for Android.
116cc_library_static {
117 name: "libc_jemalloc_wrapper",
118 defaults: ["libc_defaults"],
119 srcs: ["bionic/jemalloc_wrapper.cpp"],
120 cflags: ["-fvisibility=hidden"],
121
122 include_dirs: [
123 "external/jemalloc_new/include",
124 ],
125}
126
127cc_defaults {
128 name: "libc_scudo_defaults",
129
130 cflags: [
Christopher Ferrise1fd4092019-12-16 16:22:55 -0800131 "-DUSE_SCUDO_SVELTE",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700132 ],
133
Christopher Ferrise1fd4092019-12-16 16:22:55 -0800134 product_variables: {
135 malloc_not_svelte: {
136 cflags: [
137 "-UUSE_SCUDO_SVELTE",
138 "-DUSE_SCUDO",
139 ],
140 },
141 },
142
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700143 whole_static_libs: [
144 "libscudo",
145 ],
146}
147
Dan Willemsen208ae172015-09-16 16:33:27 -0700148// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700149// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700150// ========================================================
151//
Ryan Prichard249757b2019-11-01 17:18:28 -0700152// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
153// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
154// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
155// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700156
157cc_library_static {
158
Colin Crossa3f9fca2016-01-11 13:20:55 -0800159 srcs: [
160 "bionic/__libc_init_main_thread.cpp",
161 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700162 "bionic/bionic_call_ifunc_resolver.cpp",
163 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800164 ],
165 arch: {
166 arm64: {
167 srcs: ["arch-arm64/bionic/__set_tls.c"],
168 },
169 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700170 srcs: [
171 "arch-x86/bionic/__libc_init_sysinfo.cpp",
172 "arch-x86/bionic/__set_tls.cpp",
173 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800174 },
175 x86_64: {
176 srcs: ["arch-x86_64/bionic/__set_tls.c"],
177 },
178 },
179
Colin Cross50c21ab2015-10-31 23:03:05 -0700180 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700181 cflags: ["-fno-stack-protector", "-ffreestanding"],
182 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700183}
184
Ryan Prichard249757b2019-11-01 17:18:28 -0700185// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
186// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
187// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800188
189cc_library_static {
190 name: "libc_init_static",
191 defaults: ["libc_defaults"],
192 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700193 cflags: [
194 "-fno-stack-protector",
195
196 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
197 // from the linker before ifunc resolvers have made string.h functions available.
198 "-ffreestanding",
199 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800200}
201
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700202cc_library_static {
203 name: "libc_init_dynamic",
204 defaults: ["libc_defaults"],
205 srcs: ["bionic/libc_init_dynamic.cpp"],
206 cflags: ["-fno-stack-protector"],
207}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800208
Dan Willemsen208ae172015-09-16 16:33:27 -0700209// ========================================================
210// libc_tzcode.a - upstream 'tzcode' code
211// ========================================================
212
213cc_library_static {
214
Colin Cross50c21ab2015-10-31 23:03:05 -0700215 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700216 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800217 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700218 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700219 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
220 ],
221
Colin Cross50c21ab2015-10-31 23:03:05 -0700222 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700223 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700224 // Don't use ridiculous amounts of stack.
225 "-DALL_STATE",
226 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
227 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800228 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700229 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700230 // The name of the tm_gmtoff field in our struct tm.
231 "-DTM_GMTOFF=tm_gmtoff",
232 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700233 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700234 // Include `tzname`, `timezone`, and `daylight` globals.
235 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700236 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800237 // Use the empty string (instead of " ") as the timezone abbreviation
238 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700239 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700240 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
241 "-Dlint",
242 ],
243
Dan Willemsen208ae172015-09-16 16:33:27 -0700244 local_include_dirs: ["tzcode/"],
245 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700246}
247
248// ========================================================
249// libc_dns.a - modified NetBSD DNS code
250// ========================================================
251
252cc_library_static {
253
Colin Cross50c21ab2015-10-31 23:03:05 -0700254 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700255 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800256 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700257
258 "upstream-netbsd/lib/libc/isc/ev_streams.c",
259 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700260 ],
261
Colin Cross50c21ab2015-10-31 23:03:05 -0700262 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700263 "-DANDROID_CHANGES",
264 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700265 "-Wno-unused-parameter",
266 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700267 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700268 ],
269
Dan Willemsen208ae172015-09-16 16:33:27 -0700270 local_include_dirs: [
271 "dns/include",
272 "private",
273 "upstream-netbsd/lib/libc/include",
274 "upstream-netbsd/android/include",
275 ],
276
277 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700278}
279
280// ========================================================
281// libc_freebsd.a - upstream FreeBSD C library code
282// ========================================================
283//
284// These files are built with the freebsd-compat.h header file
285// automatically included.
286
287cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700288 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700289 srcs: [
290 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700291 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700292 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
293 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
294 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
295 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700296 "upstream-freebsd/lib/libc/stdlib/qsort.c",
297 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700298 "upstream-freebsd/lib/libc/string/wcpcpy.c",
299 "upstream-freebsd/lib/libc/string/wcpncpy.c",
300 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700301 "upstream-freebsd/lib/libc/string/wcscat.c",
302 "upstream-freebsd/lib/libc/string/wcschr.c",
303 "upstream-freebsd/lib/libc/string/wcscmp.c",
304 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700305 "upstream-freebsd/lib/libc/string/wcscspn.c",
306 "upstream-freebsd/lib/libc/string/wcsdup.c",
307 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700308 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700309 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
310 "upstream-freebsd/lib/libc/string/wcsncat.c",
311 "upstream-freebsd/lib/libc/string/wcsncmp.c",
312 "upstream-freebsd/lib/libc/string/wcsncpy.c",
313 "upstream-freebsd/lib/libc/string/wcsnlen.c",
314 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700315 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700316 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700317 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700318 "upstream-freebsd/lib/libc/string/wcstok.c",
319 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700320 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700321 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700322 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800323 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700324 ],
325 arch: {
326 arm64: {
327 exclude_srcs: [
328 "upstream-freebsd/lib/libc/string/wmemmove.c",
329 ],
330 },
331 x86: {
332 exclude_srcs: [
333 "upstream-freebsd/lib/libc/string/wcschr.c",
334 "upstream-freebsd/lib/libc/string/wcscmp.c",
335 "upstream-freebsd/lib/libc/string/wcslen.c",
336 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700337 "upstream-freebsd/lib/libc/string/wmemcmp.c",
338 "upstream-freebsd/lib/libc/string/wcscat.c",
339 "upstream-freebsd/lib/libc/string/wcscpy.c",
340 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530341 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700342 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700343 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700344 },
345
Colin Cross50c21ab2015-10-31 23:03:05 -0700346 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700347 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700348 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700349 "-include freebsd-compat.h",
350 ],
351
Dan Willemsen208ae172015-09-16 16:33:27 -0700352 local_include_dirs: [
353 "upstream-freebsd/android/include",
354 ],
355
356 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700357}
358
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700359cc_library_static {
360 defaults: ["libc_defaults"],
361 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700362 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700363 "upstream-freebsd/lib/libc/stdlib/realpath.c",
364 ],
365
366 cflags: [
367 "-Wno-sign-compare",
368 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700369 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700370 ],
371
372 local_include_dirs: [
373 "upstream-freebsd/android/include",
374 ],
375
376 name: "libc_freebsd_large_stack",
377}
378
Dan Willemsen208ae172015-09-16 16:33:27 -0700379// ========================================================
380// libc_netbsd.a - upstream NetBSD C library code
381// ========================================================
382//
383// These files are built with the netbsd-compat.h header file
384// automatically included.
385
386cc_library_static {
387
Colin Cross50c21ab2015-10-31 23:03:05 -0700388 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700389 srcs: [
390 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700391 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700392 "upstream-netbsd/lib/libc/gen/psignal.c",
393 "upstream-netbsd/lib/libc/gen/utime.c",
394 "upstream-netbsd/lib/libc/gen/utmp.c",
395 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
396 "upstream-netbsd/lib/libc/regex/regcomp.c",
397 "upstream-netbsd/lib/libc/regex/regerror.c",
398 "upstream-netbsd/lib/libc/regex/regexec.c",
399 "upstream-netbsd/lib/libc/regex/regfree.c",
400 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700401 "upstream-netbsd/lib/libc/stdlib/drand48.c",
402 "upstream-netbsd/lib/libc/stdlib/erand48.c",
403 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
404 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700405 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
406 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
407 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
408 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
409 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
410 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
411 "upstream-netbsd/lib/libc/stdlib/seed48.c",
412 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700413 ],
414 multilib: {
415 lib32: {
416 // LP32 cruft
417 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
418 },
419 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700420 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700421 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800422 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700423 "-DPOSIX_MISTAKE",
424 "-include netbsd-compat.h",
425 ],
426
Dan Willemsen208ae172015-09-16 16:33:27 -0700427 local_include_dirs: [
428 "upstream-netbsd/android/include",
429 "upstream-netbsd/lib/libc/include",
430 ],
431
432 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700433}
434
435// ========================================================
436// libc_openbsd_ndk.a - upstream OpenBSD C library code
437// that can be safely included in the libc_ndk.a (doesn't
438// contain any troublesome global data or constructors).
439// ========================================================
440//
441// These files are built with the openbsd-compat.h header file
442// automatically included.
443
444cc_library_static {
445 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700446 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700447 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700448 "upstream-openbsd/lib/libc/gen/alarm.c",
449 "upstream-openbsd/lib/libc/gen/ctype_.c",
450 "upstream-openbsd/lib/libc/gen/daemon.c",
451 "upstream-openbsd/lib/libc/gen/err.c",
452 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700453 "upstream-openbsd/lib/libc/gen/fnmatch.c",
454 "upstream-openbsd/lib/libc/gen/ftok.c",
455 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700456 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700457 "upstream-openbsd/lib/libc/gen/verr.c",
458 "upstream-openbsd/lib/libc/gen/verrx.c",
459 "upstream-openbsd/lib/libc/gen/vwarn.c",
460 "upstream-openbsd/lib/libc/gen/vwarnx.c",
461 "upstream-openbsd/lib/libc/gen/warn.c",
462 "upstream-openbsd/lib/libc/gen/warnx.c",
463 "upstream-openbsd/lib/libc/locale/btowc.c",
464 "upstream-openbsd/lib/libc/locale/mbrlen.c",
465 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
466 "upstream-openbsd/lib/libc/locale/mbtowc.c",
467 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700468 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
469 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700470 "upstream-openbsd/lib/libc/locale/wcstoll.c",
471 "upstream-openbsd/lib/libc/locale/wcstombs.c",
472 "upstream-openbsd/lib/libc/locale/wcstoul.c",
473 "upstream-openbsd/lib/libc/locale/wcstoull.c",
474 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
475 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
476 "upstream-openbsd/lib/libc/locale/wctob.c",
477 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700478 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700479 "upstream-openbsd/lib/libc/net/htonl.c",
480 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700481 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
482 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
483 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700484 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
485 "upstream-openbsd/lib/libc/net/inet_ntop.c",
486 "upstream-openbsd/lib/libc/net/inet_pton.c",
487 "upstream-openbsd/lib/libc/net/ntohl.c",
488 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800489 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700490 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700491 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
492 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700493 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700494 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700495 "upstream-openbsd/lib/libc/stdio/fputwc.c",
496 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700497 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700498 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700500 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700501 "upstream-openbsd/lib/libc/stdio/makebuf.c",
502 "upstream-openbsd/lib/libc/stdio/mktemp.c",
503 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
504 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700505 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700506 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700507 "upstream-openbsd/lib/libc/stdio/tempnam.c",
508 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
509 "upstream-openbsd/lib/libc/stdio/ungetc.c",
510 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
511 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
512 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700513 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
514 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
515 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700516 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700517 "upstream-openbsd/lib/libc/stdio/wsetup.c",
518 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800519 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700520 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700521 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700522 "upstream-openbsd/lib/libc/stdlib/insque.c",
523 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
524 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
525 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800526 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700527 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800528 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700529 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700530 "upstream-openbsd/lib/libc/stdlib/remque.c",
531 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700532 "upstream-openbsd/lib/libc/stdlib/tfind.c",
533 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800534 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700535 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800536 "upstream-openbsd/lib/libc/string/strcasestr.c",
537 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700538 "upstream-openbsd/lib/libc/string/strcspn.c",
539 "upstream-openbsd/lib/libc/string/strdup.c",
540 "upstream-openbsd/lib/libc/string/strndup.c",
541 "upstream-openbsd/lib/libc/string/strpbrk.c",
542 "upstream-openbsd/lib/libc/string/strsep.c",
543 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700544 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800545 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700546 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700547 "upstream-openbsd/lib/libc/string/wcswidth.c",
548 ],
549
Colin Cross50c21ab2015-10-31 23:03:05 -0700550 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700551 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700552 "-Wno-unused-parameter",
553 "-include openbsd-compat.h",
554 ],
555
Dan Willemsen208ae172015-09-16 16:33:27 -0700556 local_include_dirs: [
557 "private",
558 "stdio",
559 "upstream-openbsd/android/include",
560 "upstream-openbsd/lib/libc/include",
561 "upstream-openbsd/lib/libc/gdtoa/",
562 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700563}
564
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700565cc_library_static {
566 name: "libc_openbsd_large_stack",
567 defaults: ["libc_defaults"],
568 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700569 "stdio/vfprintf.cpp",
570 "stdio/vfwprintf.cpp",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800571 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700572 ],
573 cflags: [
574 "-include openbsd-compat.h",
575 "-Wno-sign-compare",
576 "-Wframe-larger-than=5000",
577 ],
578
579 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700580 "upstream-openbsd/android/include/",
581 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700582 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700583 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700584 ],
585}
586
Dan Willemsen208ae172015-09-16 16:33:27 -0700587// ========================================================
588// libc_openbsd.a - upstream OpenBSD C library code
589// ========================================================
590//
591// These files are built with the openbsd-compat.h header file
592// automatically included.
593cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700594 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700595 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800596 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700597 "upstream-openbsd/lib/libc/crypt/arc4random.c",
598 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
599
600 // May be overriden by per-arch optimized versions
601 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700602 "upstream-openbsd/lib/libc/string/memrchr.c",
603 "upstream-openbsd/lib/libc/string/stpcpy.c",
604 "upstream-openbsd/lib/libc/string/stpncpy.c",
605 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700606 "upstream-openbsd/lib/libc/string/strcpy.c",
607 "upstream-openbsd/lib/libc/string/strlcat.c",
608 "upstream-openbsd/lib/libc/string/strlcpy.c",
609 "upstream-openbsd/lib/libc/string/strncat.c",
610 "upstream-openbsd/lib/libc/string/strncmp.c",
611 "upstream-openbsd/lib/libc/string/strncpy.c",
612 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700613
614 arch: {
615 arm: {
616 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700617 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800618 "upstream-openbsd/lib/libc/string/stpcpy.c",
619 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700620 ],
621 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700622 arm64: {
623 exclude_srcs: [
624 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700625 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700626 "upstream-openbsd/lib/libc/string/strcpy.c",
627 "upstream-openbsd/lib/libc/string/strncmp.c",
628 ],
629 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530630 mips: {
631 exclude_srcs: [
632 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530633 "upstream-openbsd/lib/libc/string/strcpy.c",
634 "upstream-openbsd/lib/libc/string/strncmp.c",
635 ],
636 },
637 mips64: {
638 exclude_srcs: [
639 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530640 "upstream-openbsd/lib/libc/string/strcpy.c",
641 "upstream-openbsd/lib/libc/string/strncmp.c",
642 ],
643 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700644 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800645 exclude_srcs: [
646 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800647 "upstream-openbsd/lib/libc/string/memrchr.c",
648 "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",
652 "upstream-openbsd/lib/libc/string/strncmp.c",
653 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700654 "upstream-openbsd/lib/libc/string/strlcat.c",
655 "upstream-openbsd/lib/libc/string/strlcpy.c",
656 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800657 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700658 },
659
660 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800661 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800662 "upstream-openbsd/lib/libc/string/stpcpy.c",
663 "upstream-openbsd/lib/libc/string/stpncpy.c",
664 "upstream-openbsd/lib/libc/string/strcat.c",
665 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800666 "upstream-openbsd/lib/libc/string/strncat.c",
667 "upstream-openbsd/lib/libc/string/strncmp.c",
668 "upstream-openbsd/lib/libc/string/strncpy.c",
669 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700670 },
671 },
672
Colin Cross50c21ab2015-10-31 23:03:05 -0700673 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700674 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700675 "-Wno-unused-parameter",
676 "-include openbsd-compat.h",
677 ],
678
Dan Willemsen208ae172015-09-16 16:33:27 -0700679 local_include_dirs: [
680 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700681 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700682 ],
683
684 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700685}
686
687// ========================================================
688// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
689// ========================================================
690//
691// These files are built with the openbsd-compat.h header file
692// automatically included.
693
694cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700695 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700696 srcs: [
697 "upstream-openbsd/android/gdtoa_support.cpp",
698 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
699 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
700 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
701 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
702 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
703 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
704 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
705 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
706 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
707 "upstream-openbsd/lib/libc/gdtoa/misc.c",
708 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
709 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
710 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
711 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
712 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
713 "upstream-openbsd/lib/libc/gdtoa/sum.c",
714 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
715 ],
716 multilib: {
717 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800718 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700719 },
720 },
721
Colin Cross50c21ab2015-10-31 23:03:05 -0700722 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700723 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700724 "-include openbsd-compat.h",
725 ],
726
Dan Willemsen208ae172015-09-16 16:33:27 -0700727 local_include_dirs: [
728 "private",
729 "upstream-openbsd/android/include",
730 "upstream-openbsd/lib/libc/include",
731 ],
732
733 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700734}
735
736// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700737// libc_fortify.a - container for our FORITFY
738// implementation details
739// ========================================================
740cc_library_static {
741 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700742 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700743
744 name: "libc_fortify",
745
746 // Disable FORTIFY for the compilation of these, so we don't end up having
747 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800748 cflags: [
749 "-U_FORTIFY_SOURCE",
750 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
751 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700752
753 arch: {
754 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800755 cflags: [
756 "-DNO___MEMCPY_CHK",
757 "-DRENAME___STRCAT_CHK",
758 "-DRENAME___STRCPY_CHK",
759 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700760 srcs: [
761 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800762
763 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
764 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
765
766 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
767 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
768
769 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
770 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
771
772 "arch-arm/krait/bionic/__strcat_chk.S",
773 "arch-arm/krait/bionic/__strcpy_chk.S",
774
775 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
776 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
777
Haibo Huang01bfd892018-12-03 15:05:16 -0800778 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
779 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700780 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700781 },
782 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700783 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700784 srcs: [
785 "arch-arm64/generic/bionic/__memcpy_chk.S",
786 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700787 },
788 },
789}
790
791// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700792// libc_bionic.a - home-grown C library code
793// ========================================================
794
795cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700796 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700797 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800798 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700799 "bionic/sysconf.cpp",
800 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700801 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700802
Josh Gao10ec9282017-04-03 15:13:29 -0700803 // The following must not be statically linked into libc_ndk.a, because
804 // debuggerd will look for the abort message in libc.so's copy.
805 "bionic/android_set_abort_message.cpp",
806
Dan Willemsen208ae172015-09-16 16:33:27 -0700807 "bionic/strchr.cpp",
808 "bionic/strnlen.c",
809 "bionic/strrchr.cpp",
810 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700811
812 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700813 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700814 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700815 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800816 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700817 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800818 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800819 "arch-arm/generic/bionic/stpcpy.c",
820 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800821 "arch-arm/generic/bionic/strcmp.S",
822 "arch-arm/generic/bionic/strcpy.S",
823 "arch-arm/generic/bionic/strlen.c",
824
Ryan Prichard45024fe2018-12-30 21:10:26 -0800825 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700826 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700827 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700828 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700829 "arch-arm/bionic/atomics_arm.c",
830 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800831 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700832 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700833 "arch-arm/bionic/setjmp.S",
834 "arch-arm/bionic/syscall.S",
835 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800836
837 "arch-arm/cortex-a15/bionic/memcpy.S",
838 "arch-arm/cortex-a15/bionic/memmove.S",
839 "arch-arm/cortex-a15/bionic/memset.S",
840 "arch-arm/cortex-a15/bionic/stpcpy.S",
841 "arch-arm/cortex-a15/bionic/strcat.S",
842 "arch-arm/cortex-a15/bionic/strcmp.S",
843 "arch-arm/cortex-a15/bionic/strcpy.S",
844 "arch-arm/cortex-a15/bionic/strlen.S",
845
846 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800847 "arch-arm/cortex-a7/bionic/memset.S",
848
849 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800850 "arch-arm/cortex-a9/bionic/memset.S",
851 "arch-arm/cortex-a9/bionic/stpcpy.S",
852 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800853 "arch-arm/cortex-a9/bionic/strcpy.S",
854 "arch-arm/cortex-a9/bionic/strlen.S",
855
856 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800857 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800858
859 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800860
Haibo Huang01bfd892018-12-03 15:05:16 -0800861 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800862
863 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700864 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700865 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700866 arm64: {
867 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700868 "arch-arm64/generic/bionic/memcmp.S",
869 "arch-arm64/generic/bionic/memcpy.S",
870 "arch-arm64/generic/bionic/memmove.S",
871 "arch-arm64/generic/bionic/memset.S",
872 "arch-arm64/generic/bionic/stpcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700873 "arch-arm64/generic/bionic/strcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700874 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800875
Peter Collingbourne900d07d2019-10-28 13:11:00 -0700876 "arch-arm64/default/bionic/memchr.S",
877 "arch-arm64/default/bionic/strchr.S",
878 "arch-arm64/default/bionic/strcmp.S",
879 "arch-arm64/default/bionic/strlen.S",
880 "arch-arm64/default/bionic/strncmp.S",
881 "arch-arm64/default/bionic/strnlen.S",
882
883 "arch-arm64/mte/bionic/memchr.c",
884 "arch-arm64/mte/bionic/strchr.cpp",
885 "arch-arm64/mte/bionic/strcmp.c",
886 "arch-arm64/mte/bionic/strlen.c",
887 "arch-arm64/mte/bionic/strncmp.c",
888 "arch-arm64/mte/bionic/strnlen.c",
889
Dan Willemsen3e621712016-02-03 21:48:08 -0800890 "arch-arm64/bionic/__bionic_clone.S",
891 "arch-arm64/bionic/_exit_with_stack_teardown.S",
892 "arch-arm64/bionic/setjmp.S",
893 "arch-arm64/bionic/syscall.S",
894 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700895 ],
896 exclude_srcs: [
897 "bionic/__memcpy_chk.cpp",
898 "bionic/strchr.cpp",
899 "bionic/strnlen.c",
900 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700901 },
902
903 mips: {
904 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800905 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530906 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800907 "arch-mips/string/memset.S",
908 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530909 "arch-mips/string/strncmp.S",
910 "arch-mips/string/strlen.c",
911 "arch-mips/string/strnlen.c",
912 "arch-mips/string/strchr.c",
913 "arch-mips/string/strcpy.c",
914 "arch-mips/string/memchr.c",
915 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800916
Dan Willemsen208ae172015-09-16 16:33:27 -0700917 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700918 "arch-mips/bionic/cacheflush.cpp",
919 "arch-mips/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800920 "arch-mips/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700921 "arch-mips/bionic/setjmp.S",
922 "arch-mips/bionic/syscall.S",
923 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700924 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530925 exclude_srcs: [
926 "bionic/strchr.cpp",
927 "bionic/strnlen.c",
928 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700929 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700930 mips64: {
931 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800932 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530933 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800934 "arch-mips/string/memset.S",
935 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530936 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800937 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530938 "arch-mips/string/strnlen.c",
939 "arch-mips/string/strchr.c",
940 "arch-mips/string/strcpy.c",
941 "arch-mips/string/memchr.c",
942 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800943
Dan Willemsen208ae172015-09-16 16:33:27 -0700944 "arch-mips64/bionic/__bionic_clone.S",
945 "arch-mips64/bionic/_exit_with_stack_teardown.S",
946 "arch-mips64/bionic/setjmp.S",
947 "arch-mips64/bionic/syscall.S",
948 "arch-mips64/bionic/vfork.S",
949 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700950 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530951 exclude_srcs: [
952 "bionic/strchr.cpp",
953 "bionic/strnlen.c",
954 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700955 },
956
957 x86: {
958 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700959 "arch-x86/generic/string/memcmp.S",
960 "arch-x86/generic/string/strcmp.S",
961 "arch-x86/generic/string/strncmp.S",
962 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700963
964 "arch-x86/generic/string/strlcat.c",
965 "arch-x86/generic/string/strlcpy.c",
966 "arch-x86/generic/string/strncat.c",
967 "arch-x86/generic/string/wcscat.c",
968 "arch-x86/generic/string/wcscpy.c",
969 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530970 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700971
Dan Willemsen208ae172015-09-16 16:33:27 -0700972 "arch-x86/atom/string/sse2-memchr-atom.S",
973 "arch-x86/atom/string/sse2-memrchr-atom.S",
974 "arch-x86/atom/string/sse2-strchr-atom.S",
975 "arch-x86/atom/string/sse2-strnlen-atom.S",
976 "arch-x86/atom/string/sse2-strrchr-atom.S",
977 "arch-x86/atom/string/sse2-wcschr-atom.S",
978 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
979 "arch-x86/atom/string/sse2-wcslen-atom.S",
980 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700981 "arch-x86/silvermont/string/sse2-memmove-slm.S",
982 "arch-x86/silvermont/string/sse2-memset-slm.S",
983 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
984 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
985 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
986 "arch-x86/silvermont/string/sse2-strlen-slm.S",
987 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800988
989 "arch-x86/bionic/__bionic_clone.S",
990 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800991 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800992 "arch-x86/bionic/__restore.S",
993 "arch-x86/bionic/setjmp.S",
994 "arch-x86/bionic/syscall.S",
995 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700996
997 // ssse3 functions
998 "arch-x86/atom/string/ssse3-strcat-atom.S",
999 "arch-x86/atom/string/ssse3-strcmp-atom.S",
1000 "arch-x86/atom/string/ssse3-strlcat-atom.S",
1001 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
1002 "arch-x86/atom/string/ssse3-strncat-atom.S",
1003 "arch-x86/atom/string/ssse3-strncmp-atom.S",
1004 "arch-x86/atom/string/ssse3-wcscat-atom.S",
1005 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
1006
1007 // sse4 functions
1008 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
1009 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
1010
1011 // atom functions
1012 "arch-x86/atom/string/sse2-memset-atom.S",
1013 "arch-x86/atom/string/sse2-strlen-atom.S",
1014 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -08001015 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001016 "arch-x86/atom/string/ssse3-strcpy-atom.S",
1017 "arch-x86/atom/string/ssse3-strncpy-atom.S",
1018 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +05301019
1020 // avx2 functions
1021 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001022 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001023
1024 exclude_srcs: [
1025 "bionic/strchr.cpp",
1026 "bionic/strnlen.c",
1027 "bionic/strrchr.cpp",
1028 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001029 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001030 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001031 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001032 "arch-x86_64/string/sse2-memmove-slm.S",
1033 "arch-x86_64/string/sse2-memset-slm.S",
1034 "arch-x86_64/string/sse2-stpcpy-slm.S",
1035 "arch-x86_64/string/sse2-stpncpy-slm.S",
1036 "arch-x86_64/string/sse2-strcat-slm.S",
1037 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001038 "arch-x86_64/string/sse2-strlen-slm.S",
1039 "arch-x86_64/string/sse2-strncat-slm.S",
1040 "arch-x86_64/string/sse2-strncpy-slm.S",
1041 "arch-x86_64/string/sse4-memcmp-slm.S",
1042 "arch-x86_64/string/ssse3-strcmp-slm.S",
1043 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +05301044 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001045
1046 "arch-x86_64/bionic/__bionic_clone.S",
1047 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1048 "arch-x86_64/bionic/__restore_rt.S",
1049 "arch-x86_64/bionic/setjmp.S",
1050 "arch-x86_64/bionic/syscall.S",
1051 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001052 ],
1053 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001054 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001055
Colin Cross50c21ab2015-10-31 23:03:05 -07001056 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001057 include_dirs: ["bionic/libstdc++/include"],
1058 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001059}
1060
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001061genrule {
1062 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001063 out: ["generated_android_ids.h"],
1064 srcs: [":android_filesystem_config_header"],
1065 tool_files: ["fs_config_generator.py"],
1066 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001067}
1068
Dan Willemsen268a6732015-10-15 14:49:45 -07001069// ========================================================
1070// libc_bionic_ndk.a- The portions of libc_bionic that can
1071// be safely used in libc_ndk.a (no troublesome global data
1072// or constructors).
1073// ========================================================
1074cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001075 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001076 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001077 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001078 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001079 "bionic/__cmsg_nxthdr.cpp",
1080 "bionic/__errno.cpp",
1081 "bionic/__gnu_basename.cpp",
1082 "bionic/__libc_current_sigrtmax.cpp",
1083 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001084 "bionic/abort.cpp",
1085 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001086 "bionic/access.cpp",
1087 "bionic/arpa_inet.cpp",
1088 "bionic/assert.cpp",
1089 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001090 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001091 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001092 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001093 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001094 "bionic/bionic_systrace.cpp",
1095 "bionic/bionic_time_conversions.cpp",
1096 "bionic/brk.cpp",
1097 "bionic/c16rtomb.cpp",
1098 "bionic/c32rtomb.cpp",
1099 "bionic/chmod.cpp",
1100 "bionic/chown.cpp",
1101 "bionic/clearenv.cpp",
1102 "bionic/clock.cpp",
1103 "bionic/clock_getcpuclockid.cpp",
1104 "bionic/clock_nanosleep.cpp",
1105 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001106 "bionic/ctype.cpp",
1107 "bionic/dirent.cpp",
1108 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001109 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001110 "bionic/error.cpp",
1111 "bionic/eventfd_read.cpp",
1112 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001113 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001114 "bionic/faccessat.cpp",
1115 "bionic/fchmod.cpp",
1116 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001117 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001118 "bionic/ffs.cpp",
1119 "bionic/fgetxattr.cpp",
1120 "bionic/flistxattr.cpp",
1121 "bionic/flockfile.cpp",
1122 "bionic/fpclassify.cpp",
1123 "bionic/fsetxattr.cpp",
1124 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001125 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001126 "bionic/futimens.cpp",
1127 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001128 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001129 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001130 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001131 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001132 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001133 "bionic/getpgrp.cpp",
1134 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001135 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001136 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001137 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001138 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001139 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001140 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001141 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001142 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001143 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001144 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001145 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001146 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001147 "bionic/lchown.cpp",
1148 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001149 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001150 "bionic/libgen.cpp",
1151 "bionic/link.cpp",
1152 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001153 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001154 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001155 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001156 "bionic/mbrtoc16.cpp",
1157 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001158 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001159 "bionic/mempcpy.cpp",
1160 "bionic/mkdir.cpp",
1161 "bionic/mkfifo.cpp",
1162 "bionic/mknod.cpp",
1163 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001164 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001165 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001166 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001167 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001168 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001169 "bionic/open.cpp",
1170 "bionic/pathconf.cpp",
1171 "bionic/pause.cpp",
1172 "bionic/pipe.cpp",
1173 "bionic/poll.cpp",
1174 "bionic/posix_fadvise.cpp",
1175 "bionic/posix_fallocate.cpp",
1176 "bionic/posix_madvise.cpp",
1177 "bionic/posix_timers.cpp",
1178 "bionic/ptrace.cpp",
1179 "bionic/pty.cpp",
1180 "bionic/raise.cpp",
1181 "bionic/rand.cpp",
1182 "bionic/readlink.cpp",
1183 "bionic/reboot.cpp",
1184 "bionic/recv.cpp",
1185 "bionic/rename.cpp",
1186 "bionic/rmdir.cpp",
1187 "bionic/scandir.cpp",
1188 "bionic/sched_getaffinity.cpp",
1189 "bionic/sched_getcpu.cpp",
1190 "bionic/semaphore.cpp",
1191 "bionic/send.cpp",
1192 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001193 "bionic/seteuid.cpp",
1194 "bionic/setpgrp.cpp",
1195 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001196 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001197 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001198 "bionic/sleep.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001199 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001200 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001201 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001202 "bionic/strchrnul.cpp",
1203 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001204 "bionic/string_l.cpp",
1205 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001206 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001207 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001208 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001209 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001210 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001211 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001212 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001213 "bionic/sys_msg.cpp",
1214 "bionic/sys_sem.cpp",
1215 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001216 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001217 "bionic/sys_statfs.cpp",
1218 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001219 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001220 "bionic/sysinfo.cpp",
1221 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001222 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001223 "bionic/system_property_api.cpp",
1224 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001225 "bionic/tdestroy.cpp",
1226 "bionic/termios.cpp",
1227 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001228 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001229 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001230 "bionic/tmpfile.cpp",
1231 "bionic/umount.cpp",
1232 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001233 "bionic/usleep.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001234 "bionic/wait.cpp",
1235 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001236 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001237 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001238 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001239 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001240 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001241
1242 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1243 // which will be overridden by the actual one in libc.so.
1244 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001245 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001246
Dan Willemsen208ae172015-09-16 16:33:27 -07001247 multilib: {
1248 lib32: {
1249 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001250 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001251 },
1252 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001253 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001254 treble_linker_namespaces: {
1255 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001256 },
1257 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001258 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001259 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001260 local_include_dirs: ["stdio"],
1261 include_dirs: ["bionic/libstdc++/include"],
1262 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001263 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001264}
1265
Dan Willemsen208ae172015-09-16 16:33:27 -07001266// ========================================================
1267// libc_pthread.a - pthreads parts that previously lived in
1268// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001269// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001270// pthread_t has changed over the years and has ABI
1271// compatibility issues).
1272// ========================================================
1273
1274cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001275 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001276 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001277 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001278 "bionic/pthread_atfork.cpp",
1279 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001280 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001281 "bionic/pthread_cond.cpp",
1282 "bionic/pthread_create.cpp",
1283 "bionic/pthread_detach.cpp",
1284 "bionic/pthread_equal.cpp",
1285 "bionic/pthread_exit.cpp",
1286 "bionic/pthread_getcpuclockid.cpp",
1287 "bionic/pthread_getschedparam.cpp",
1288 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001289 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001290 "bionic/pthread_join.cpp",
1291 "bionic/pthread_key.cpp",
1292 "bionic/pthread_kill.cpp",
1293 "bionic/pthread_mutex.cpp",
1294 "bionic/pthread_once.cpp",
1295 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001296 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001297 "bionic/pthread_self.cpp",
1298 "bionic/pthread_setname_np.cpp",
1299 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001300 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001301
1302 // The following implementations depend on pthread data or implementation,
1303 // so we can't include them in libc_ndk.a.
1304 "bionic/__cxa_thread_atexit_impl.cpp",
1305 "stdlib/atexit.c",
1306 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001307 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001308
Colin Cross50c21ab2015-10-31 23:03:05 -07001309 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001310 include_dirs: ["bionic/libstdc++/include"],
1311 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001312}
1313
1314// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001315// libc_syscalls.a
1316// ========================================================
1317
Elliott Hughes782c4852019-04-16 12:31:00 -07001318genrule {
1319 name: "syscalls-arm.S",
1320 out: ["syscalls-arm.S"],
1321 srcs: ["SYSCALLS.TXT"],
1322 tool_files: [":bionic-gensyscalls"],
1323 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1324}
1325
1326genrule {
1327 name: "syscalls-arm64.S",
1328 out: ["syscalls-arm64.S"],
1329 srcs: ["SYSCALLS.TXT"],
1330 tool_files: [":bionic-gensyscalls"],
1331 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1332}
1333
1334genrule {
1335 name: "syscalls-x86.S",
1336 out: ["syscalls-x86.S"],
1337 srcs: ["SYSCALLS.TXT"],
1338 tool_files: [":bionic-gensyscalls"],
1339 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1340}
1341
1342genrule {
1343 name: "syscalls-x86_64.S",
1344 out: ["syscalls-x86_64.S"],
1345 srcs: ["SYSCALLS.TXT"],
1346 tool_files: [":bionic-gensyscalls"],
1347 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1348}
1349
Dan Willemsen208ae172015-09-16 16:33:27 -07001350cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001351 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001352 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001353 arch: {
1354 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001355 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001356 },
1357 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001358 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001359 },
1360 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001361 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001362 },
1363 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001364 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001365 },
1366 },
1367 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001368}
1369
1370// ========================================================
1371// libc_aeabi.a
1372// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1373// to avoid infinite recursion. For the other architectures we just build an
1374// empty library to keep this makefile simple.
1375// ========================================================
1376
1377cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001378 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001379 arch: {
1380 arm: {
1381 srcs: ["arch-arm/bionic/__aeabi.c"],
1382 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001383 },
1384 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001385 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001386}
1387
1388// ========================================================
1389// libc_ndk.a
1390// Compatibility library for the NDK. This library contains
1391// all the parts of libc that are safe to statically link.
1392// We can't safely statically link things that can only run
1393// on a certain version of the OS. Examples include
1394// anything that talks to netd (a large portion of the DNS
1395// code) and anything that is dependent on the layout of a
1396// data structure that has changed across releases (such as
1397// pthread_t).
1398// ========================================================
1399
1400cc_library_static {
1401 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001402 defaults: [
1403 "libc_defaults",
1404 "libc_native_allocator_defaults",
1405 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -08001406 ramdisk_available: false,
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001407 srcs: libc_common_src_files + [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001408 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001409 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001410 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001411 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001412 multilib: {
1413 lib32: {
1414 srcs: libc_common_src_files_32,
1415 },
1416 },
1417 arch: {
1418 arm: {
1419 srcs: [
1420 "arch-arm/bionic/exidx_dynamic.c",
1421 "arch-common/bionic/crtbegin_so.c",
1422 "arch-arm/bionic/atexit_legacy.c",
1423 "arch-common/bionic/crtend_so.S",
1424 ],
1425 whole_static_libs: ["libc_aeabi"],
1426 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001427 },
1428
Colin Cross50c21ab2015-10-31 23:03:05 -07001429 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001430 "-fvisibility=hidden",
1431 "-DLIBC_STATIC",
1432 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001433
1434 whole_static_libs: [
1435 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001436 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001437 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001438 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001439 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001440 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001441 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001442 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001443 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001444 "libc_syscalls",
1445 "libc_tzcode",
1446 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001447 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001448 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001449}
1450
1451// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001452// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001453// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001454cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001455 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001456 srcs: libc_common_src_files,
1457 multilib: {
1458 lib32: {
1459 srcs: libc_common_src_files_32,
1460 },
1461 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001462 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001463
1464 whole_static_libs: [
1465 "libc_bionic",
1466 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001467 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001468 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001469 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001470 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001471 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001472 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001473 "libc_netbsd",
1474 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001475 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001476 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001477 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001478 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001479 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001480 ],
1481
1482 arch: {
1483 arm: {
1484 whole_static_libs: ["libc_aeabi"],
1485 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001486 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001487}
1488
1489// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001490// libc_common.a
1491// ========================================================
1492
1493cc_library_static {
1494 defaults: ["libc_defaults"],
1495 name: "libc_common",
1496
1497 whole_static_libs: [
1498 "libc_nopthread",
1499 "libc_pthread",
1500 ],
1501}
1502
1503// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001504// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001505// ========================================================
1506cc_library_static {
1507 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001508 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001509
Haibo Huangb9244ff2018-08-11 10:12:13 -07001510 arch: {
1511 x86: {
1512 srcs: ["arch-x86/static_function_dispatch.S"],
1513 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001514 arm: {
1515 srcs: ["arch-arm/static_function_dispatch.S"],
1516 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001517 arm64: {
1518 srcs: ["arch-arm64/static_function_dispatch.S"],
1519 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001520 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001521}
1522
1523// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001524// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001525// ========================================================
1526cc_library_static {
1527 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001528 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001529
Haibo Huangb9244ff2018-08-11 10:12:13 -07001530 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001531 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001532 "-fno-stack-protector",
1533 "-fno-jump-tables",
1534 ],
1535 arch: {
1536 x86: {
1537 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1538 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001539 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001540 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001541 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001542 arm64: {
1543 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1544 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001545 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001546}
1547
1548// ========================================================
1549// libc_common_static.a For static binaries.
1550// ========================================================
1551cc_library_static {
1552 defaults: ["libc_defaults"],
1553 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001554
Haibo Huangf71edfa2018-11-12 10:06:56 -08001555 whole_static_libs: [
1556 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001557 "libc_static_dispatch",
1558 ],
1559}
1560
1561// ========================================================
1562// libc_common_shared.a For shared libraries.
1563// ========================================================
1564cc_library_static {
1565 defaults: ["libc_defaults"],
1566 name: "libc_common_shared",
1567
1568 whole_static_libs: [
1569 "libc_common",
1570 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001571 ],
1572}
1573
Ryan Prichard22a6a052019-10-10 23:59:30 -07001574// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1575// executable.
1576cc_library_static {
1577 name: "libc_unwind_static",
1578 defaults: ["libc_defaults"],
1579 cflags: ["-DLIBC_STATIC"],
1580
1581 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1582 arch: {
1583 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1584 arm: {
1585 srcs: ["arch-arm/bionic/exidx_static.c"],
1586 },
1587 },
1588}
1589
Haibo Huangf71edfa2018-11-12 10:06:56 -08001590// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001591// libc_nomalloc.a
1592// ========================================================
1593//
Ryan Prichard249757b2019-11-01 17:18:28 -07001594// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1595// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1596// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001597
1598cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001599 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001600 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001601
Colin Crossa3f9fca2016-01-11 13:20:55 -08001602 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001603 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001604 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001605 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001606 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001607}
1608
dimitryc0c0ef62018-12-05 16:33:52 +01001609filegroup {
1610 name: "libc_sources_shared",
1611 srcs: [
1612 "arch-common/bionic/crtbegin_so.c",
1613 "arch-common/bionic/crtbrand.S",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001614 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001615 "bionic/icu.cpp",
1616 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001617 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001618 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001619 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001620 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001621 "bionic/ndk_cruft.cpp",
1622 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001623 "bionic/NetdClient.cpp",
1624 "arch-common/bionic/crtend_so.S",
1625 ],
1626}
1627
1628filegroup {
1629 name: "libc_sources_static",
1630 srcs: [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001631 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001632 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001633 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001634 ],
1635}
1636
1637filegroup {
1638 name: "libc_sources_shared_arm",
1639 srcs: [
1640 "arch-arm/bionic/exidx_dynamic.c",
1641 "arch-arm/bionic/atexit_legacy.c",
1642 ],
1643}
1644
Dan Willemsen208ae172015-09-16 16:33:27 -07001645// ========================================================
1646// libc.a + libc.so
1647// ========================================================
1648cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001649 defaults: [
1650 "libc_defaults",
1651 "libc_native_allocator_defaults",
1652 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001653 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001654 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001655 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001656 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001657 platform_sdk_version: {
1658 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1659 },
1660 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001661 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001662 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001663 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001664 whole_static_libs: [
1665 "libc_init_static",
1666 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001667 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001668 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001669 },
1670 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001671 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001672 whole_static_libs: [
1673 "libc_init_dynamic",
1674 "libc_common_shared",
1675 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001676 },
1677
Neil Fullera7db90f2019-04-25 09:28:27 +01001678 required: [
1679 "tzdata",
1680 "tz_version", // Version metadata for tzdata to help debugging.
1681 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001682
Colin Cross4ce94d22016-11-15 13:15:43 -08001683 // Do not pack libc.so relocations; see http://b/20645321 for details.
1684 pack_relocations: false,
1685
dimitry06016f22018-01-05 11:39:28 +01001686 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1687 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1688 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1689 // those new libraries from libgcc.a are not declared external; if that were the case,
1690 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1691 // on the external symbols from the dependent libraries. That would create a "cloaked"
1692 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001693
dimitry06016f22018-01-05 11:39:28 +01001694 shared_libs: [
1695 "ld-android",
1696 "libdl",
1697 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001698 static_libs: [
1699 "libdl_android",
1700 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001701
1702 nocrt: true,
1703
Dan Willemsen208ae172015-09-16 16:33:27 -07001704 arch: {
1705 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001706 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001707 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001708 ldflags: ["-Wl,--hash-style=both"],
1709
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001710 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001711
Dan Willemsen208ae172015-09-16 16:33:27 -07001712 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001713 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001714 // special for arm
1715 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001716 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001717
1718 // Arm 32 bit does not produce complete exidx unwind information
1719 // so keep the .debug_frame which is relatively small and does
1720 // include needed unwind information.
1721 // See b/132992102 for details.
1722 strip: {
1723 keep_symbols_and_debug_frame: true,
1724 },
Peter Collingbourneb061e772019-11-12 14:26:21 -08001725
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001726 whole_static_libs: [ "libunwind_llvm" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001727 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001728 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001729 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001730
1731 // Leave the symbols in the shared library so that stack unwinders can produce
1732 // meaningful name resolution.
1733 strip: {
1734 keep_symbols: true,
1735 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001736
1737 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001738 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001739 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001740 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001741 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001742 ldflags: ["-Wl,--hash-style=both"],
1743
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001744 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001745
1746 // Leave the symbols in the shared library so that stack unwinders can produce
1747 // meaningful name resolution.
1748 strip: {
1749 keep_symbols: true,
1750 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001751
1752 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001753 },
1754 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001755 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001756
1757 // Leave the symbols in the shared library so that stack unwinders can produce
1758 // meaningful name resolution.
1759 strip: {
1760 keep_symbols: true,
1761 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001762
1763 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001764 },
1765 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001766
1767 stubs: {
1768 symbol_file: "libc.map.txt",
1769 versions: ["10000"],
1770 },
Vic Yang6903fb82019-01-14 11:34:39 -08001771
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001772 apex_available: [
1773 "//apex_available:platform",
1774 "com.android.runtime",
1775 ],
1776
Vic Yang03ff4362019-06-24 16:11:37 -07001777 // Sorting bss symbols by size usually results in less dirty pages at run
1778 // time, because small symbols are grouped together.
1779 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001780}
1781
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001782genrule {
1783 name: "libc.arm.map",
1784 out: ["libc.arm.map"],
1785 srcs: ["libc.map.txt"],
1786 tool_files: [":bionic-generate-version-script"],
1787 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1788}
1789
1790genrule {
1791 name: "libc.arm64.map",
1792 out: ["libc.arm64.map"],
1793 srcs: ["libc.map.txt"],
1794 tool_files: [":bionic-generate-version-script"],
1795 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1796}
1797
1798genrule {
1799 name: "libc.x86.map",
1800 out: ["libc.x86.map"],
1801 srcs: ["libc.map.txt"],
1802 tool_files: [":bionic-generate-version-script"],
1803 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1804}
1805
1806genrule {
1807 name: "libc.x86_64.map",
1808 out: ["libc.x86_64.map"],
1809 srcs: ["libc.map.txt"],
1810 tool_files: [":bionic-generate-version-script"],
1811 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1812}
1813
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001814// Headers that only other parts of the platform can include.
1815cc_library_headers {
1816 name: "bionic_libc_platform_headers",
1817 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001818 "//art:__subpackages__",
1819 "//bionic/libc:__subpackages__",
1820 "//frameworks:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001821 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001822 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001823 "//system/core/debuggerd:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001824 "//system/memory/libmemunreachable:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001825 ],
1826 host_supported: true,
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001827 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001828 ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001829 recovery_available: true,
1830 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001831 export_include_dirs: [
1832 "platform",
1833 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001834 system_shared_libs: [],
1835 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001836 sdk_version: "current",
1837}
1838
Logan Chien17af91b2019-01-15 21:19:56 +08001839// libc_headers for libasync_safe and libpropertyinfoparser
1840cc_library_headers {
1841 name: "libc_headers",
1842
1843 host_supported: true,
1844 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001845 ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001846 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001847 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001848
1849 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001850 stl: "none",
1851 system_shared_libs: [],
1852
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001853 // The build system generally requires that any dependencies of a target
1854 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1855 // to 1 we let targets with an sdk_version that need to depend on the libc
1856 // headers but cannot depend on libc itself due to circular dependencies
1857 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1858 // is correct because the headers can support any sdk_version.
1859 sdk_version: "1",
1860
Logan Chien17af91b2019-01-15 21:19:56 +08001861 export_include_dirs: [
1862 "include",
1863 "kernel/uapi",
1864 "kernel/android/uapi",
1865 ],
1866
1867 arch: {
1868 arm: {
1869 export_include_dirs: [
1870 "kernel/uapi/asm-arm",
1871 ],
1872 },
1873 arm64: {
1874 export_include_dirs: [
1875 "kernel/uapi/asm-arm64",
1876 ],
1877 },
1878 mips: {
1879 export_include_dirs: [
1880 "kernel/uapi/asm-mips",
1881 ],
1882 },
1883 mips64: {
1884 export_include_dirs: [
1885 "kernel/uapi/asm-mips",
1886 ],
1887 },
1888 x86: {
1889 export_include_dirs: [
1890 "kernel/uapi/asm-x86",
1891 ],
1892 },
1893 x86_64: {
1894 export_include_dirs: [
1895 "kernel/uapi/asm-x86",
1896 ],
1897 },
1898 },
1899}
1900
Dan Willemsen208ae172015-09-16 16:33:27 -07001901// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001902// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001903// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001904
Dan Willemsen208ae172015-09-16 16:33:27 -07001905cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001906 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001907 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001908 srcs: [
1909 "bionic/__cxa_guard.cpp",
1910 "bionic/__cxa_pure_virtual.cpp",
1911 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001912 ],
1913 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001914 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001915 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001916
Dan Willemsen6b3be172018-12-03 13:57:20 -08001917 static: {
1918 system_shared_libs: [],
1919 },
1920 shared: {
1921 system_shared_libs: ["libc"],
1922 },
1923
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001924 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001925 arch: {
1926 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001927 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001928 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001929 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001930 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001931 },
1932 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001933 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001934 },
1935 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001936 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001937 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001938 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001939 },
1940 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001941 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001942 },
1943 },
1944}
1945
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001946genrule {
1947 name: "libstdc++.arm.map",
1948 out: ["libstdc++.arm.map"],
1949 srcs: ["libstdc++.map.txt"],
1950 tool_files: [":bionic-generate-version-script"],
1951 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1952}
1953
1954genrule {
1955 name: "libstdc++.arm64.map",
1956 out: ["libstdc++.arm64.map"],
1957 srcs: ["libstdc++.map.txt"],
1958 tool_files: [":bionic-generate-version-script"],
1959 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1960}
1961
1962genrule {
1963 name: "libstdc++.x86.map",
1964 out: ["libstdc++.x86.map"],
1965 srcs: ["libstdc++.map.txt"],
1966 tool_files: [":bionic-generate-version-script"],
1967 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1968}
1969
1970genrule {
1971 name: "libstdc++.x86_64.map",
1972 out: ["libstdc++.x86_64.map"],
1973 srcs: ["libstdc++.map.txt"],
1974 tool_files: [":bionic-generate-version-script"],
1975 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1976}
1977
1978// ========================================================
1979// crt object files.
1980// ========================================================
1981
Colin Cross50c21ab2015-10-31 23:03:05 -07001982cc_defaults {
1983 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001984 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001985 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001986 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001987 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001988 native_bridge_supported: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001989
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001990 cflags: [
1991 "-Wno-gcc-compat",
1992 "-Wall",
1993 "-Werror",
1994 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07001995 sanitize: {
1996 never: true,
1997 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001998}
1999
Colin Cross50c21ab2015-10-31 23:03:05 -07002000cc_defaults {
2001 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002002 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002003
2004 arch: {
2005 mips: {
2006 cflags: ["-fPIC"],
2007 },
2008 mips64: {
2009 cflags: ["-fPIC"],
2010 },
2011 x86: {
2012 cflags: ["-fPIC"],
2013 },
2014 x86_64: {
2015 cflags: ["-fPIC"],
2016 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002017 },
Colin Crossab179442018-09-27 11:03:22 -07002018 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002019}
2020
Dan Willemsen208ae172015-09-16 16:33:27 -07002021cc_object {
2022 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002023 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002024 local_include_dirs: ["include"],
2025 product_variables: {
2026 platform_sdk_version: {
2027 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2028 },
2029 },
2030 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002031
Colin Cross7d7b3682017-11-03 13:38:40 -07002032 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002033}
2034
Dan Willemsen208ae172015-09-16 16:33:27 -07002035cc_object {
2036 name: "crtbegin_so1",
2037 local_include_dirs: ["include"],
2038 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002039
Colin Cross7d7b3682017-11-03 13:38:40 -07002040 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002041}
2042
Dan Willemsen208ae172015-09-16 16:33:27 -07002043cc_object {
2044 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002045
Colin Cross7d7b3682017-11-03 13:38:40 -07002046 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002047 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002048 "crtbegin_so1",
2049 "crtbrand",
2050 ],
2051}
2052
Dan Willemsen208ae172015-09-16 16:33:27 -07002053cc_object {
2054 name: "crtend_so",
2055 local_include_dirs: ["include"],
2056 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002057
Colin Cross7d7b3682017-11-03 13:38:40 -07002058 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002059}
2060
Dan Willemsen208ae172015-09-16 16:33:27 -07002061cc_object {
2062 name: "crtbegin_static1",
2063 local_include_dirs: ["include"],
2064 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002065
Colin Cross50c21ab2015-10-31 23:03:05 -07002066 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002067 mips: {
2068 srcs: [
2069 "arch-mips/bionic/crtbegin.c",
2070 ],
2071 exclude_srcs: [
2072 "arch-common/bionic/crtbegin.c",
2073 ],
2074 },
2075 mips64: {
2076 srcs: [
2077 "arch-mips64/bionic/crtbegin.c",
2078 ],
2079 exclude_srcs: [
2080 "arch-common/bionic/crtbegin.c",
2081 ],
2082 },
2083 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002084
2085 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002086}
2087
Dan Willemsen208ae172015-09-16 16:33:27 -07002088cc_object {
2089 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002090
Colin Cross77d57bf2016-04-11 14:34:18 -07002091 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002092 "crtbegin_static1",
2093 "crtbrand",
2094 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002095 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002096}
2097
Dan Willemsen208ae172015-09-16 16:33:27 -07002098cc_object {
2099 name: "crtbegin_dynamic1",
2100 local_include_dirs: ["include"],
2101 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002102
Colin Cross50c21ab2015-10-31 23:03:05 -07002103 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002104 mips: {
2105 srcs: [
2106 "arch-mips/bionic/crtbegin.c",
2107 ],
2108 exclude_srcs: [
2109 "arch-common/bionic/crtbegin.c",
2110 ],
2111 },
2112 mips64: {
2113 srcs: [
2114 "arch-mips64/bionic/crtbegin.c",
2115 ],
2116 exclude_srcs: [
2117 "arch-common/bionic/crtbegin.c",
2118 ],
2119 },
2120 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002121 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002122}
2123
Dan Willemsen208ae172015-09-16 16:33:27 -07002124cc_object {
2125 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002126
Colin Cross77d57bf2016-04-11 14:34:18 -07002127 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002128 "crtbegin_dynamic1",
2129 "crtbrand",
2130 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002131 target: {
2132 linux_bionic: {
2133 generated_sources: ["host_bionic_linker_asm"],
2134 objs: [
2135 "linker_wrapper",
2136 ],
2137 },
2138 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002139 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002140}
2141
Dan Willemsen208ae172015-09-16 16:33:27 -07002142cc_object {
2143 // We rename crtend.o to crtend_android.o to avoid a
2144 // name clash between gcc and bionic.
2145 name: "crtend_android",
2146 local_include_dirs: ["include"],
2147 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002148
Colin Cross50c21ab2015-10-31 23:03:05 -07002149 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002150}
Colin Crossbaa48992016-07-13 11:15:21 -07002151
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002152// ========================================================
2153// NDK headers.
2154// ========================================================
2155
Dan Albert26e1c412018-05-24 14:56:46 -07002156versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002157 name: "common_libc",
2158 from: "include",
2159 to: "",
2160 license: "NOTICE",
2161}
Dan Albert4238a352016-06-28 11:18:05 -07002162
2163ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002164 name: "libc_uapi",
2165 from: "kernel/uapi",
2166 to: "",
2167 srcs: [
2168 "kernel/uapi/asm-generic/**/*.h",
2169 "kernel/uapi/drm/**/*.h",
2170 "kernel/uapi/linux/**/*.h",
2171 "kernel/uapi/misc/**/*.h",
2172 "kernel/uapi/mtd/**/*.h",
2173 "kernel/uapi/rdma/**/*.h",
2174 "kernel/uapi/scsi/**/*.h",
2175 "kernel/uapi/sound/**/*.h",
2176 "kernel/uapi/video/**/*.h",
2177 "kernel/uapi/xen/**/*.h",
2178 ],
Dan Albert92592652016-10-20 01:42:54 -07002179 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002180}
2181
2182ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002183 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002184 from: "kernel/android/uapi/linux",
2185 to: "linux",
2186 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002187 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002188}
2189
2190ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002191 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002192 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002193 to: "scsi",
2194 srcs: ["kernel/android/scsi/**/*.h"],
2195 license: "NOTICE",
2196}
2197
2198ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002199 name: "libc_asm_arm",
2200 from: "kernel/uapi/asm-arm",
2201 to: "arm-linux-androideabi",
2202 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002203 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002204}
2205
2206ndk_headers {
2207 name: "libc_asm_arm64",
2208 from: "kernel/uapi/asm-arm64",
2209 to: "aarch64-linux-android",
2210 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002211 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002212}
2213
Elliott Hughesee291c02017-12-11 11:32:34 -08002214// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002215ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002216 name: "libc_asm_mips",
2217 from: "kernel/uapi/asm-mips",
2218 to: "mipsel-linux-android",
2219 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2220 license: "NOTICE",
2221}
2222
Elliott Hughesee291c02017-12-11 11:32:34 -08002223// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002224ndk_headers {
2225 name: "libc_asm_mips64",
2226 from: "kernel/uapi/asm-mips",
2227 to: "mips64el-linux-android",
2228 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2229 license: "NOTICE",
2230}
2231
2232ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002233 name: "libc_asm_x86",
2234 from: "kernel/uapi/asm-x86",
2235 to: "i686-linux-android",
2236 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002237 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002238}
2239
2240ndk_headers {
2241 name: "libc_asm_x86_64",
2242 from: "kernel/uapi/asm-x86",
2243 to: "x86_64-linux-android",
2244 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002245 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002246}
2247
Dan Albert4238a352016-06-28 11:18:05 -07002248ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002249 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002250 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002251 symbol_file: "libc.map.txt",
2252 first_version: "9",
2253}
2254
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002255llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002256 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002257 symbol_file: "libc.map.txt",
2258 export_headers_as_system: true,
2259 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002260 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002261 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002262 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002263 "kernel/android/uapi",
2264 "kernel/uapi",
2265 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002266 arch: {
2267 arm: {
2268 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002269 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002270 ],
2271 },
2272 arm64: {
2273 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002274 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002275 ],
2276 },
2277 mips: {
2278 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002279 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002280 ],
2281 },
2282 mips64: {
2283 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002284 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002285 ],
2286 },
2287 x86: {
2288 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002289 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002290 ],
2291 },
2292 x86_64: {
2293 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002294 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002295 ],
2296 },
2297 },
2298}
2299
Dan Albertdf31aff2016-10-06 15:50:41 -07002300ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002301 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002302 symbol_file: "libstdc++.map.txt",
2303 first_version: "9",
2304}
2305
Dan Willemsenca056d72018-01-08 14:00:24 -08002306// Export these headers for toolbox to process
2307filegroup {
2308 name: "kernel_input_headers",
2309 srcs: [
2310 "kernel/uapi/linux/input.h",
2311 "kernel/uapi/linux/input-event-codes.h",
2312 ],
2313}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002314
2315// Generate a syscall name / number mapping. These objects are text files
2316// (thanks to the -dD -E flags) and not binary files. They will then be
2317// consumed by the genseccomp.py script and converted into C++ code.
2318cc_defaults {
2319 name: "libseccomp_gen_syscall_nrs_defaults",
2320 recovery_available: true,
2321 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2322 cflags: [
2323 "-dD",
2324 "-E",
2325 "-Wall",
2326 "-Werror",
2327 "-nostdinc",
2328 ],
2329}
2330
2331cc_object {
2332 name: "libseccomp_gen_syscall_nrs_arm",
2333 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2334 local_include_dirs: [
2335 "kernel/uapi/asm-arm",
2336 "kernel/uapi",
2337 ],
2338}
2339
2340cc_object {
2341 name: "libseccomp_gen_syscall_nrs_arm64",
2342 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2343 local_include_dirs: [
2344 "kernel/uapi/asm-arm64",
2345 "kernel/uapi",
2346 ],
2347}
2348
2349cc_object {
2350 name: "libseccomp_gen_syscall_nrs_x86",
2351 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2352 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2353 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2354 local_include_dirs: [
2355 "kernel/uapi/asm-x86",
2356 "kernel/uapi",
2357 ],
2358}
2359
2360cc_object {
2361 name: "libseccomp_gen_syscall_nrs_x86_64",
2362 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2363 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2364 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2365 local_include_dirs: [
2366 "kernel/uapi/asm-x86",
2367 "kernel/uapi",
2368 ],
2369}
2370
2371cc_object {
2372 name: "libseccomp_gen_syscall_nrs_mips",
2373 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2374 cflags: [
2375 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2376 ],
2377 local_include_dirs: [
2378 "kernel/uapi/asm-mips",
2379 "kernel/uapi",
2380 ],
2381}
2382
2383cc_object {
2384 name: "libseccomp_gen_syscall_nrs_mips64",
2385 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2386 cflags: [
2387 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2388 ],
2389 local_include_dirs: [
2390 "kernel/uapi/asm-mips",
2391 "kernel/uapi",
2392 ],
2393}
2394
Elliott Hughesae03b122019-09-17 16:37:05 -07002395// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002396python_binary_host {
2397 name: "genseccomp",
2398 main: "tools/genseccomp.py",
2399
2400 srcs: [
2401 "tools/genseccomp.py",
2402 "tools/gensyscalls.py",
2403 ],
2404
2405 data: [
2406 "kernel/uapi/**/*.h",
2407 ],
2408
2409 version: {
2410 py2: {
2411 enabled: true,
2412 },
2413 py3: {
2414 enabled: false,
2415 },
2416 },
2417}
2418
Martijn Coenen0c6de752019-01-02 12:52:51 +01002419python_binary_host {
2420 name: "genfunctosyscallnrs",
2421 main: "tools/genfunctosyscallnrs.py",
2422
2423 srcs: [
2424 "tools/genseccomp.py",
2425 "tools/genfunctosyscallnrs.py",
2426 "tools/gensyscalls.py",
2427 ],
2428
2429 data: [
2430 "kernel/uapi/**/*.h",
2431 ],
2432
2433 version: {
2434 py2: {
2435 enabled: true,
2436 },
2437 py3: {
2438 enabled: false,
2439 },
2440 },
2441}
2442
2443cc_genrule {
2444 name: "func_to_syscall_nrs",
2445 recovery_available: true,
2446 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2447
2448 tools: [ "genfunctosyscallnrs" ],
2449
2450 srcs: [
2451 "SYSCALLS.TXT",
2452 ":libseccomp_gen_syscall_nrs_arm",
2453 ":libseccomp_gen_syscall_nrs_arm64",
2454 ":libseccomp_gen_syscall_nrs_mips",
2455 ":libseccomp_gen_syscall_nrs_mips64",
2456 ":libseccomp_gen_syscall_nrs_x86",
2457 ":libseccomp_gen_syscall_nrs_x86_64",
2458 ],
2459
2460 out: [
2461 "func_to_syscall_nrs.h",
2462 ],
2463}
2464
Martijn Coenenc3752be2019-01-09 16:19:57 +01002465// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2466genrule {
2467 name: "generate_app_zygote_blacklist",
2468 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2469 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2470 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2471}
2472
2473cc_genrule {
2474 name: "libseccomp_policy_app_zygote_sources",
2475 recovery_available: true,
2476 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2477
2478 tools: [ "genseccomp" ],
2479
2480 srcs: [
2481 "SYSCALLS.TXT",
2482 "SECCOMP_WHITELIST_COMMON.TXT",
2483 "SECCOMP_WHITELIST_APP.TXT",
2484 "SECCOMP_BLACKLIST_COMMON.TXT",
2485 ":generate_app_zygote_blacklist",
2486 ":libseccomp_gen_syscall_nrs_arm",
2487 ":libseccomp_gen_syscall_nrs_arm64",
2488 ":libseccomp_gen_syscall_nrs_mips",
2489 ":libseccomp_gen_syscall_nrs_mips64",
2490 ":libseccomp_gen_syscall_nrs_x86",
2491 ":libseccomp_gen_syscall_nrs_x86_64",
2492 ],
2493
2494 out: [
2495 "arm64_app_zygote_policy.cpp",
2496 "arm_app_zygote_policy.cpp",
2497 "mips64_app_zygote_policy.cpp",
2498 "mips_app_zygote_policy.cpp",
2499 "x86_64_app_zygote_policy.cpp",
2500 "x86_app_zygote_policy.cpp",
2501 ],
2502}
2503
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002504cc_genrule {
2505 name: "libseccomp_policy_app_sources",
2506 recovery_available: true,
2507 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2508
2509 tools: [ "genseccomp" ],
2510
2511 srcs: [
2512 "SYSCALLS.TXT",
2513 "SECCOMP_WHITELIST_COMMON.TXT",
2514 "SECCOMP_WHITELIST_APP.TXT",
2515 "SECCOMP_BLACKLIST_COMMON.TXT",
2516 "SECCOMP_BLACKLIST_APP.TXT",
2517 ":libseccomp_gen_syscall_nrs_arm",
2518 ":libseccomp_gen_syscall_nrs_arm64",
2519 ":libseccomp_gen_syscall_nrs_mips",
2520 ":libseccomp_gen_syscall_nrs_mips64",
2521 ":libseccomp_gen_syscall_nrs_x86",
2522 ":libseccomp_gen_syscall_nrs_x86_64",
2523 ],
2524
2525 out: [
2526 "arm64_app_policy.cpp",
2527 "arm_app_policy.cpp",
2528 "mips64_app_policy.cpp",
2529 "mips_app_policy.cpp",
2530 "x86_64_app_policy.cpp",
2531 "x86_app_policy.cpp",
2532 ],
2533}
2534
2535cc_genrule {
2536 name: "libseccomp_policy_system_sources",
2537 recovery_available: true,
2538 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2539
2540 tools: [ "genseccomp" ],
2541
2542 srcs: [
2543 "SYSCALLS.TXT",
2544 "SECCOMP_WHITELIST_COMMON.TXT",
2545 "SECCOMP_WHITELIST_SYSTEM.TXT",
2546 "SECCOMP_BLACKLIST_COMMON.TXT",
2547 ":libseccomp_gen_syscall_nrs_arm",
2548 ":libseccomp_gen_syscall_nrs_arm64",
2549 ":libseccomp_gen_syscall_nrs_mips",
2550 ":libseccomp_gen_syscall_nrs_mips64",
2551 ":libseccomp_gen_syscall_nrs_x86",
2552 ":libseccomp_gen_syscall_nrs_x86_64",
2553 ],
2554
2555 out: [
2556 "arm64_system_policy.cpp",
2557 "arm_system_policy.cpp",
2558 "mips64_system_policy.cpp",
2559 "mips_system_policy.cpp",
2560 "x86_64_system_policy.cpp",
2561 "x86_system_policy.cpp",
2562 ],
2563}
2564
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002565cc_library {
2566 name: "libseccomp_policy",
2567 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002568 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002569 generated_sources: [
2570 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002571 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002572 "libseccomp_policy_system_sources",
2573 ],
2574
2575 srcs: [
2576 "seccomp/seccomp_policy.cpp",
2577 ],
2578
2579 export_include_dirs: ["seccomp/include"],
2580 cflags: [
2581 "-Wall",
2582 "-Werror",
2583 ],
2584 shared: {
2585 shared_libs: ["libbase"],
2586 },
2587 static: {
2588 static_libs: ["libbase"],
2589 },
2590}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002591
2592// This is a temporary library that will use scudo as the native memory
2593// allocator. To use it, add it as the first shared library.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002594cc_defaults {
2595 name: "libc_scudo_wrapper_defaults",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002596 srcs: [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08002597 "bionic/heap_tagging.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002598 "bionic/malloc_common.cpp",
2599 "bionic/malloc_common_dynamic.cpp",
2600 "bionic/malloc_heapprofd.cpp",
2601 "bionic/malloc_limit.cpp",
2602 "bionic/scudo_wrapper.cpp",
2603 "bionic/__set_errno.cpp",
2604 ],
2605 cflags: ["-DUSE_SCUDO"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002606 shared_libs: ["libscudo_wrapper"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002607
2608 header_libs: ["libc_headers"],
2609
2610 static_libs: ["libasync_safe"],
2611
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002612 arch: {
2613 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002614 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002615 },
2616 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002617 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002618 },
2619 x86: {
2620 srcs: [
2621 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002622 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002623 ],
2624 },
2625 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002626 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002627 },
2628 },
2629
2630 // Mark this library as global so it overrides all the allocation
2631 // definitions properly.
2632 ldflags: ["-Wl,-z,global"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002633}
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002634
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002635cc_library_shared {
2636 name: "libc_scudo",
Anna Trostanetski9981a1d2020-01-20 20:16:29 +00002637 defaults: ["libc_scudo_wrapper_defaults"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002638 vendor_available: true,
2639 stl: "none",
2640 system_shared_libs: [],
2641
2642 allow_undefined_symbols: true,
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002643 // Like libc, disable native coverage for libc_scudo.
2644 native_coverage: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002645}
2646
2647subdirs = [
2648 "bionic/scudo",
2649]