blob: f366ddbd87933033694ed13a436fa49a2d0f5b67 [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001// Define the common source files for all the libc instances
2// =========================================================
3libc_common_src_files = [
Christopher Ferris7a3681e2017-04-24 17:48:32 -07004 "async_safe/async_safe_log.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07005 "bionic/ether_aton.c",
6 "bionic/ether_ntoa.c",
7 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/pututline.c",
11 "bionic/sched_cpualloc.c",
12 "bionic/sched_cpucount.c",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070013 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070014 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070015 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080016 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070017 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080018 "stdio/vfscanf.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070019 "stdio/vfwscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070020 "stdlib/exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070021]
22
Peter Collingbourne570de332019-12-11 10:00:58 -080023// off64_t/time64_t support on LP32.
Dan Willemsen208ae172015-09-16 16:33:27 -070024// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -070025libc_common_src_files_32 = [
26 "bionic/legacy_32_bit_support.cpp",
27 "bionic/time64.c",
28]
29
Elliott Hughes53cf3482016-08-09 13:06:41 -070030libc_common_flags = [
31 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080032 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070033 "-Wall",
34 "-Wextra",
35 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080036 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070037 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070038 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070039 "-Wframe-larger-than=2048",
Elliott Hughes53cf3482016-08-09 13:06:41 -070040
41 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
42 "-Werror=pointer-to-int-cast",
43 "-Werror=int-to-pointer-cast",
44 "-Werror=type-limits",
45 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080046
47 // Clang's exit-time destructor registration hides __dso_handle, but
48 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
49 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080050
51 // GWP-ASan requires platform TLS.
52 "-fno-emulated-tls",
Elliott Hughes53cf3482016-08-09 13:06:41 -070053]
54
Dan Willemsen208ae172015-09-16 16:33:27 -070055// Define some common cflags
56// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070057cc_defaults {
58 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080059 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070060 cflags: libc_common_flags,
61 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070062 conlyflags: ["-std=gnu99"],
63 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070064 include_dirs: [
65 "bionic/libc/async_safe/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070066 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070067
Mitch Phillipsf3968e82020-01-31 19:57:04 -080068 header_libs: ["gwp_asan_headers"],
69
Colin Cross50c21ab2015-10-31 23:03:05 -070070 stl: "none",
71 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070072 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070073 address: false,
74 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070075 // TODO(b/132640749): Fix broken fuzzer support.
76 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070077 },
Colin Cross50c21ab2015-10-31 23:03:05 -070078 native_coverage: false,
Yifan Hong5a39cee2020-01-21 16:43:56 -080079 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090080 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020081 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080082
Yi Konge3d90de2019-02-20 14:28:56 -080083 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
84 // warning since this is intended right now.
85 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070086
87 product_variables: {
88 experimental_mte: {
89 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
90 },
Evgenii Stepanov5a73e032020-04-29 14:59:44 -070091 malloc_zero_contents: {
92 cflags: ["-DSCUDO_ZERO_CONTENTS"],
93 },
94 malloc_pattern_fill_contents: {
95 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
96 },
Peter Collingbournee99912f2019-11-01 15:37:00 -070097 },
Dan Willemsen208ae172015-09-16 16:33:27 -070098}
99
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800100libc_scudo_product_variables = {
101 malloc_not_svelte: {
102 cflags: ["-DUSE_SCUDO"],
103 whole_static_libs: ["libscudo"],
104 exclude_static_libs: [
105 "libjemalloc5",
106 "libc_jemalloc_wrapper",
107 ],
108 },
109}
110
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700111// Defaults for native allocator libs/includes to make it
112// easier to change.
Christopher Ferris062eba22020-01-31 22:40:45 -0800113// To disable scudo for the non-svelte config remove the line:
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800114// product_variables: libc_scudo_product_variables,
Christopher Ferris062eba22020-01-31 22:40:45 -0800115// in the cc_defaults below.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700116// ========================================================
117cc_defaults {
118 name: "libc_native_allocator_defaults",
119
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700120 whole_static_libs: [
121 "libjemalloc5",
122 "libc_jemalloc_wrapper",
123 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800124 header_libs: ["gwp_asan_headers"],
Christopher Ferris062eba22020-01-31 22:40:45 -0800125 product_variables: libc_scudo_product_variables,
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700126}
127
128// Functions not implemented by jemalloc directly, or that need to
129// be modified for Android.
130cc_library_static {
131 name: "libc_jemalloc_wrapper",
132 defaults: ["libc_defaults"],
133 srcs: ["bionic/jemalloc_wrapper.cpp"],
134 cflags: ["-fvisibility=hidden"],
135
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800136 // Used to pull in the jemalloc include directory so that if the
137 // library is removed, the include directory is also removed.
138 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700139}
140
Dan Willemsen208ae172015-09-16 16:33:27 -0700141// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700142// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700143// ========================================================
144//
Ryan Prichard249757b2019-11-01 17:18:28 -0700145// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
146// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
147// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
148// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700149
150cc_library_static {
151
Colin Crossa3f9fca2016-01-11 13:20:55 -0800152 srcs: [
153 "bionic/__libc_init_main_thread.cpp",
154 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700155 "bionic/bionic_call_ifunc_resolver.cpp",
156 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800157 ],
158 arch: {
159 arm64: {
160 srcs: ["arch-arm64/bionic/__set_tls.c"],
161 },
162 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700163 srcs: [
164 "arch-x86/bionic/__libc_init_sysinfo.cpp",
165 "arch-x86/bionic/__set_tls.cpp",
166 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800167 },
168 x86_64: {
169 srcs: ["arch-x86_64/bionic/__set_tls.c"],
170 },
171 },
172
Colin Cross50c21ab2015-10-31 23:03:05 -0700173 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700174 cflags: ["-fno-stack-protector", "-ffreestanding"],
175 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700176}
177
Ryan Prichard249757b2019-11-01 17:18:28 -0700178// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
179// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
180// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800181
182cc_library_static {
183 name: "libc_init_static",
184 defaults: ["libc_defaults"],
185 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700186 cflags: [
187 "-fno-stack-protector",
188
189 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
190 // from the linker before ifunc resolvers have made string.h functions available.
191 "-ffreestanding",
192 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800193}
194
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700195cc_library_static {
196 name: "libc_init_dynamic",
197 defaults: ["libc_defaults"],
198 srcs: ["bionic/libc_init_dynamic.cpp"],
199 cflags: ["-fno-stack-protector"],
200}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800201
Dan Willemsen208ae172015-09-16 16:33:27 -0700202// ========================================================
203// libc_tzcode.a - upstream 'tzcode' code
204// ========================================================
205
206cc_library_static {
207
Colin Cross50c21ab2015-10-31 23:03:05 -0700208 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700209 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800210 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700211 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700212 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
213 ],
214
Colin Cross50c21ab2015-10-31 23:03:05 -0700215 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700216 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700217 // Don't use ridiculous amounts of stack.
218 "-DALL_STATE",
219 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
220 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800221 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700222 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700223 // The name of the tm_gmtoff field in our struct tm.
224 "-DTM_GMTOFF=tm_gmtoff",
225 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700226 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700227 // Include `tzname`, `timezone`, and `daylight` globals.
228 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700229 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800230 // Use the empty string (instead of " ") as the timezone abbreviation
231 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700232 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700233 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
234 "-Dlint",
235 ],
236
Dan Willemsen208ae172015-09-16 16:33:27 -0700237 local_include_dirs: ["tzcode/"],
238 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700239}
240
241// ========================================================
242// libc_dns.a - modified NetBSD DNS code
243// ========================================================
244
245cc_library_static {
246
Colin Cross50c21ab2015-10-31 23:03:05 -0700247 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700248 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800249 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700250
251 "upstream-netbsd/lib/libc/isc/ev_streams.c",
252 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700253 ],
254
Colin Cross50c21ab2015-10-31 23:03:05 -0700255 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700256 "-DANDROID_CHANGES",
257 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700258 "-Wno-unused-parameter",
259 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700260 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700261 ],
262
Dan Willemsen208ae172015-09-16 16:33:27 -0700263 local_include_dirs: [
264 "dns/include",
265 "private",
266 "upstream-netbsd/lib/libc/include",
267 "upstream-netbsd/android/include",
268 ],
269
270 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700271}
272
273// ========================================================
274// libc_freebsd.a - upstream FreeBSD C library code
275// ========================================================
276//
277// These files are built with the freebsd-compat.h header file
278// automatically included.
279
280cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700281 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700282 srcs: [
283 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700284 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700285 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
286 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
287 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
288 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700289 "upstream-freebsd/lib/libc/stdlib/qsort.c",
290 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700291 "upstream-freebsd/lib/libc/string/wcpcpy.c",
292 "upstream-freebsd/lib/libc/string/wcpncpy.c",
293 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700294 "upstream-freebsd/lib/libc/string/wcscat.c",
295 "upstream-freebsd/lib/libc/string/wcschr.c",
296 "upstream-freebsd/lib/libc/string/wcscmp.c",
297 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700298 "upstream-freebsd/lib/libc/string/wcscspn.c",
299 "upstream-freebsd/lib/libc/string/wcsdup.c",
300 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700301 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700302 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
303 "upstream-freebsd/lib/libc/string/wcsncat.c",
304 "upstream-freebsd/lib/libc/string/wcsncmp.c",
305 "upstream-freebsd/lib/libc/string/wcsncpy.c",
306 "upstream-freebsd/lib/libc/string/wcsnlen.c",
307 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700308 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700309 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700310 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700311 "upstream-freebsd/lib/libc/string/wcstok.c",
312 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700313 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700314 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700315 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800316 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700317 ],
318 arch: {
319 arm64: {
320 exclude_srcs: [
321 "upstream-freebsd/lib/libc/string/wmemmove.c",
322 ],
323 },
324 x86: {
325 exclude_srcs: [
326 "upstream-freebsd/lib/libc/string/wcschr.c",
327 "upstream-freebsd/lib/libc/string/wcscmp.c",
328 "upstream-freebsd/lib/libc/string/wcslen.c",
329 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700330 "upstream-freebsd/lib/libc/string/wmemcmp.c",
331 "upstream-freebsd/lib/libc/string/wcscat.c",
332 "upstream-freebsd/lib/libc/string/wcscpy.c",
333 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530334 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700335 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700336 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700337 },
338
Colin Cross50c21ab2015-10-31 23:03:05 -0700339 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700340 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700341 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700342 "-include freebsd-compat.h",
343 ],
344
Dan Willemsen208ae172015-09-16 16:33:27 -0700345 local_include_dirs: [
346 "upstream-freebsd/android/include",
347 ],
348
349 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700350}
351
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700352cc_library_static {
353 defaults: ["libc_defaults"],
354 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700355 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700356 ],
357
358 cflags: [
359 "-Wno-sign-compare",
360 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700361 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700362 ],
363
364 local_include_dirs: [
365 "upstream-freebsd/android/include",
366 ],
367
368 name: "libc_freebsd_large_stack",
369}
370
Dan Willemsen208ae172015-09-16 16:33:27 -0700371// ========================================================
372// libc_netbsd.a - upstream NetBSD C library code
373// ========================================================
374//
375// These files are built with the netbsd-compat.h header file
376// automatically included.
377
378cc_library_static {
379
Colin Cross50c21ab2015-10-31 23:03:05 -0700380 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700381 srcs: [
382 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700383 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700384 "upstream-netbsd/lib/libc/gen/psignal.c",
385 "upstream-netbsd/lib/libc/gen/utime.c",
386 "upstream-netbsd/lib/libc/gen/utmp.c",
387 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
388 "upstream-netbsd/lib/libc/regex/regcomp.c",
389 "upstream-netbsd/lib/libc/regex/regerror.c",
390 "upstream-netbsd/lib/libc/regex/regexec.c",
391 "upstream-netbsd/lib/libc/regex/regfree.c",
392 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700393 "upstream-netbsd/lib/libc/stdlib/drand48.c",
394 "upstream-netbsd/lib/libc/stdlib/erand48.c",
395 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
396 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700397 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
398 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
399 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
400 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
401 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
402 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
403 "upstream-netbsd/lib/libc/stdlib/seed48.c",
404 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700405 ],
406 multilib: {
407 lib32: {
408 // LP32 cruft
409 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
410 },
411 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700412 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700413 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800414 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700415 "-DPOSIX_MISTAKE",
416 "-include netbsd-compat.h",
417 ],
418
Dan Willemsen208ae172015-09-16 16:33:27 -0700419 local_include_dirs: [
420 "upstream-netbsd/android/include",
421 "upstream-netbsd/lib/libc/include",
422 ],
423
424 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700425}
426
427// ========================================================
428// libc_openbsd_ndk.a - upstream OpenBSD C library code
429// that can be safely included in the libc_ndk.a (doesn't
430// contain any troublesome global data or constructors).
431// ========================================================
432//
433// These files are built with the openbsd-compat.h header file
434// automatically included.
435
436cc_library_static {
437 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700438 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700439 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700440 "upstream-openbsd/lib/libc/gen/alarm.c",
441 "upstream-openbsd/lib/libc/gen/ctype_.c",
442 "upstream-openbsd/lib/libc/gen/daemon.c",
443 "upstream-openbsd/lib/libc/gen/err.c",
444 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700445 "upstream-openbsd/lib/libc/gen/fnmatch.c",
446 "upstream-openbsd/lib/libc/gen/ftok.c",
447 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700448 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700449 "upstream-openbsd/lib/libc/gen/verr.c",
450 "upstream-openbsd/lib/libc/gen/verrx.c",
451 "upstream-openbsd/lib/libc/gen/vwarn.c",
452 "upstream-openbsd/lib/libc/gen/vwarnx.c",
453 "upstream-openbsd/lib/libc/gen/warn.c",
454 "upstream-openbsd/lib/libc/gen/warnx.c",
455 "upstream-openbsd/lib/libc/locale/btowc.c",
456 "upstream-openbsd/lib/libc/locale/mbrlen.c",
457 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
458 "upstream-openbsd/lib/libc/locale/mbtowc.c",
459 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700460 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
461 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700462 "upstream-openbsd/lib/libc/locale/wcstoll.c",
463 "upstream-openbsd/lib/libc/locale/wcstombs.c",
464 "upstream-openbsd/lib/libc/locale/wcstoul.c",
465 "upstream-openbsd/lib/libc/locale/wcstoull.c",
466 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
467 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
468 "upstream-openbsd/lib/libc/locale/wctob.c",
469 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700470 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700471 "upstream-openbsd/lib/libc/net/htonl.c",
472 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700473 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
474 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
475 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700476 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
477 "upstream-openbsd/lib/libc/net/inet_ntop.c",
478 "upstream-openbsd/lib/libc/net/inet_pton.c",
479 "upstream-openbsd/lib/libc/net/ntohl.c",
480 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800481 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700482 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700483 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
484 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700485 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700486 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700487 "upstream-openbsd/lib/libc/stdio/fputwc.c",
488 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700489 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700490 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700491 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700492 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700493 "upstream-openbsd/lib/libc/stdio/makebuf.c",
494 "upstream-openbsd/lib/libc/stdio/mktemp.c",
495 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
496 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700497 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700498 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 "upstream-openbsd/lib/libc/stdio/tempnam.c",
500 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
501 "upstream-openbsd/lib/libc/stdio/ungetc.c",
502 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
503 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
504 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700505 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
506 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
507 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700508 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700509 "upstream-openbsd/lib/libc/stdio/wsetup.c",
510 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800511 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700512 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700513 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700514 "upstream-openbsd/lib/libc/stdlib/insque.c",
515 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
516 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
517 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800518 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700519 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800520 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700521 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700522 "upstream-openbsd/lib/libc/stdlib/remque.c",
523 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700524 "upstream-openbsd/lib/libc/stdlib/tfind.c",
525 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800526 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700527 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800528 "upstream-openbsd/lib/libc/string/strcasestr.c",
529 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700530 "upstream-openbsd/lib/libc/string/strcspn.c",
531 "upstream-openbsd/lib/libc/string/strdup.c",
532 "upstream-openbsd/lib/libc/string/strndup.c",
533 "upstream-openbsd/lib/libc/string/strpbrk.c",
534 "upstream-openbsd/lib/libc/string/strsep.c",
535 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700536 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800537 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700538 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700539 "upstream-openbsd/lib/libc/string/wcswidth.c",
540 ],
541
Colin Cross50c21ab2015-10-31 23:03:05 -0700542 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700543 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700544 "-Wno-unused-parameter",
545 "-include openbsd-compat.h",
546 ],
547
Dan Willemsen208ae172015-09-16 16:33:27 -0700548 local_include_dirs: [
549 "private",
550 "stdio",
551 "upstream-openbsd/android/include",
552 "upstream-openbsd/lib/libc/include",
553 "upstream-openbsd/lib/libc/gdtoa/",
554 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700555}
556
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700557cc_library_static {
558 name: "libc_openbsd_large_stack",
559 defaults: ["libc_defaults"],
560 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700561 "stdio/vfprintf.cpp",
562 "stdio/vfwprintf.cpp",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800563 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700564 ],
565 cflags: [
566 "-include openbsd-compat.h",
567 "-Wno-sign-compare",
568 "-Wframe-larger-than=5000",
569 ],
570
571 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700572 "upstream-openbsd/android/include/",
573 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700574 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700575 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700576 ],
577}
578
Dan Willemsen208ae172015-09-16 16:33:27 -0700579// ========================================================
580// libc_openbsd.a - upstream OpenBSD C library code
581// ========================================================
582//
583// These files are built with the openbsd-compat.h header file
584// automatically included.
585cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700586 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700587 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800588 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700589 "upstream-openbsd/lib/libc/crypt/arc4random.c",
590 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
591
592 // May be overriden by per-arch optimized versions
593 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700594 "upstream-openbsd/lib/libc/string/memrchr.c",
595 "upstream-openbsd/lib/libc/string/stpcpy.c",
596 "upstream-openbsd/lib/libc/string/stpncpy.c",
597 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700598 "upstream-openbsd/lib/libc/string/strcpy.c",
599 "upstream-openbsd/lib/libc/string/strlcat.c",
600 "upstream-openbsd/lib/libc/string/strlcpy.c",
601 "upstream-openbsd/lib/libc/string/strncat.c",
602 "upstream-openbsd/lib/libc/string/strncmp.c",
603 "upstream-openbsd/lib/libc/string/strncpy.c",
604 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700605
606 arch: {
607 arm: {
608 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700609 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800610 "upstream-openbsd/lib/libc/string/stpcpy.c",
611 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700612 ],
613 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700614 arm64: {
615 exclude_srcs: [
616 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700617 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700618 "upstream-openbsd/lib/libc/string/strcpy.c",
619 "upstream-openbsd/lib/libc/string/strncmp.c",
620 ],
621 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700622 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800623 exclude_srcs: [
624 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800625 "upstream-openbsd/lib/libc/string/memrchr.c",
626 "upstream-openbsd/lib/libc/string/stpcpy.c",
627 "upstream-openbsd/lib/libc/string/stpncpy.c",
628 "upstream-openbsd/lib/libc/string/strcat.c",
629 "upstream-openbsd/lib/libc/string/strcpy.c",
630 "upstream-openbsd/lib/libc/string/strncmp.c",
631 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700632 "upstream-openbsd/lib/libc/string/strlcat.c",
633 "upstream-openbsd/lib/libc/string/strlcpy.c",
634 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800635 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700636 },
637
638 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800639 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800640 "upstream-openbsd/lib/libc/string/stpcpy.c",
641 "upstream-openbsd/lib/libc/string/stpncpy.c",
642 "upstream-openbsd/lib/libc/string/strcat.c",
643 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800644 "upstream-openbsd/lib/libc/string/strncat.c",
645 "upstream-openbsd/lib/libc/string/strncmp.c",
646 "upstream-openbsd/lib/libc/string/strncpy.c",
647 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700648 },
649 },
650
Colin Cross50c21ab2015-10-31 23:03:05 -0700651 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700652 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700653 "-Wno-unused-parameter",
654 "-include openbsd-compat.h",
655 ],
656
Dan Willemsen208ae172015-09-16 16:33:27 -0700657 local_include_dirs: [
658 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700659 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700660 ],
661
662 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700663}
664
665// ========================================================
666// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
667// ========================================================
668//
669// These files are built with the openbsd-compat.h header file
670// automatically included.
671
672cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700673 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700674 srcs: [
675 "upstream-openbsd/android/gdtoa_support.cpp",
676 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
677 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
678 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
679 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
680 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
681 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
682 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
683 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
684 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
685 "upstream-openbsd/lib/libc/gdtoa/misc.c",
686 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
687 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
688 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
689 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
690 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
691 "upstream-openbsd/lib/libc/gdtoa/sum.c",
692 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
693 ],
694 multilib: {
695 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800696 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700697 },
698 },
699
Colin Cross50c21ab2015-10-31 23:03:05 -0700700 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700701 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700702 "-include openbsd-compat.h",
703 ],
704
Dan Willemsen208ae172015-09-16 16:33:27 -0700705 local_include_dirs: [
706 "private",
707 "upstream-openbsd/android/include",
708 "upstream-openbsd/lib/libc/include",
709 ],
710
711 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700712}
713
714// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700715// libc_fortify.a - container for our FORITFY
716// implementation details
717// ========================================================
718cc_library_static {
719 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700720 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700721
722 name: "libc_fortify",
723
724 // Disable FORTIFY for the compilation of these, so we don't end up having
725 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800726 cflags: [
727 "-U_FORTIFY_SOURCE",
728 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
729 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700730
731 arch: {
732 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800733 cflags: [
734 "-DNO___MEMCPY_CHK",
735 "-DRENAME___STRCAT_CHK",
736 "-DRENAME___STRCPY_CHK",
737 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700738 srcs: [
739 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800740
741 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
742 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
743
744 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
745 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
746
747 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
748 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
749
750 "arch-arm/krait/bionic/__strcat_chk.S",
751 "arch-arm/krait/bionic/__strcpy_chk.S",
752
753 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
754 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
755
Haibo Huang01bfd892018-12-03 15:05:16 -0800756 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
757 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700758 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700759 },
760 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700761 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700762 srcs: [
763 "arch-arm64/generic/bionic/__memcpy_chk.S",
764 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700765 },
766 },
767}
768
769// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700770// libc_bionic.a - home-grown C library code
771// ========================================================
772
773cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700774 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700775 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800776 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700777 "bionic/sysconf.cpp",
778 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700779 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700780
Josh Gao10ec9282017-04-03 15:13:29 -0700781 // The following must not be statically linked into libc_ndk.a, because
782 // debuggerd will look for the abort message in libc.so's copy.
783 "bionic/android_set_abort_message.cpp",
784
Dan Willemsen208ae172015-09-16 16:33:27 -0700785 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800786 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700787 "bionic/strnlen.c",
788 "bionic/strrchr.cpp",
789 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700790
791 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700792 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700793 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700794 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800795 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700796 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800797 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800798 "arch-arm/generic/bionic/stpcpy.c",
799 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800800 "arch-arm/generic/bionic/strcmp.S",
801 "arch-arm/generic/bionic/strcpy.S",
802 "arch-arm/generic/bionic/strlen.c",
803
Ryan Prichard45024fe2018-12-30 21:10:26 -0800804 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700805 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700806 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700807 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700808 "arch-arm/bionic/atomics_arm.c",
809 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800810 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700811 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700812 "arch-arm/bionic/setjmp.S",
813 "arch-arm/bionic/syscall.S",
814 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800815
816 "arch-arm/cortex-a15/bionic/memcpy.S",
817 "arch-arm/cortex-a15/bionic/memmove.S",
818 "arch-arm/cortex-a15/bionic/memset.S",
819 "arch-arm/cortex-a15/bionic/stpcpy.S",
820 "arch-arm/cortex-a15/bionic/strcat.S",
821 "arch-arm/cortex-a15/bionic/strcmp.S",
822 "arch-arm/cortex-a15/bionic/strcpy.S",
823 "arch-arm/cortex-a15/bionic/strlen.S",
824
825 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800826 "arch-arm/cortex-a7/bionic/memset.S",
827
828 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800829 "arch-arm/cortex-a9/bionic/memset.S",
830 "arch-arm/cortex-a9/bionic/stpcpy.S",
831 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800832 "arch-arm/cortex-a9/bionic/strcpy.S",
833 "arch-arm/cortex-a9/bionic/strlen.S",
834
835 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800836 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800837
838 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800839
Haibo Huang01bfd892018-12-03 15:05:16 -0800840 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800841
842 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700843 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700844 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700845 arm64: {
846 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700847 "arch-arm64/generic/bionic/memcpy.S",
848 "arch-arm64/generic/bionic/memmove.S",
849 "arch-arm64/generic/bionic/memset.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700850 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800851
Peter Collingbourne900d07d2019-10-28 13:11:00 -0700852 "arch-arm64/mte/bionic/memchr.c",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800853 "arch-arm64/mte/bionic/stpcpy.S",
854 "arch-arm64/mte/bionic/strchrnul.cpp",
855 "arch-arm64/mte/bionic/strrchr.cpp",
Peter Collingbourne900d07d2019-10-28 13:11:00 -0700856 "arch-arm64/mte/bionic/strcmp.c",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800857 "arch-arm64/mte/bionic/strcpy.S",
Peter Collingbourne900d07d2019-10-28 13:11:00 -0700858 "arch-arm64/mte/bionic/strncmp.c",
859 "arch-arm64/mte/bionic/strnlen.c",
860
Dan Willemsen3e621712016-02-03 21:48:08 -0800861 "arch-arm64/bionic/__bionic_clone.S",
862 "arch-arm64/bionic/_exit_with_stack_teardown.S",
863 "arch-arm64/bionic/setjmp.S",
864 "arch-arm64/bionic/syscall.S",
865 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700866 ],
867 exclude_srcs: [
868 "bionic/__memcpy_chk.cpp",
869 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800870 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700871 "bionic/strnlen.c",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800872 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700873 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700874 },
875
Dan Willemsen208ae172015-09-16 16:33:27 -0700876 x86: {
877 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700878 "arch-x86/generic/string/memcmp.S",
879 "arch-x86/generic/string/strcmp.S",
880 "arch-x86/generic/string/strncmp.S",
881 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700882
883 "arch-x86/generic/string/strlcat.c",
884 "arch-x86/generic/string/strlcpy.c",
885 "arch-x86/generic/string/strncat.c",
886 "arch-x86/generic/string/wcscat.c",
887 "arch-x86/generic/string/wcscpy.c",
888 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530889 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700890
Dan Willemsen208ae172015-09-16 16:33:27 -0700891 "arch-x86/atom/string/sse2-memchr-atom.S",
892 "arch-x86/atom/string/sse2-memrchr-atom.S",
893 "arch-x86/atom/string/sse2-strchr-atom.S",
894 "arch-x86/atom/string/sse2-strnlen-atom.S",
895 "arch-x86/atom/string/sse2-strrchr-atom.S",
896 "arch-x86/atom/string/sse2-wcschr-atom.S",
897 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
898 "arch-x86/atom/string/sse2-wcslen-atom.S",
899 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700900 "arch-x86/silvermont/string/sse2-memmove-slm.S",
901 "arch-x86/silvermont/string/sse2-memset-slm.S",
902 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
903 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
904 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
905 "arch-x86/silvermont/string/sse2-strlen-slm.S",
906 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800907
908 "arch-x86/bionic/__bionic_clone.S",
909 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800910 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800911 "arch-x86/bionic/__restore.S",
912 "arch-x86/bionic/setjmp.S",
913 "arch-x86/bionic/syscall.S",
914 "arch-x86/bionic/vfork.S",
Ryan Pricharda992a062020-04-18 02:59:24 -0700915 "arch-x86/bionic/__x86.get_pc_thunk.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700916
917 // ssse3 functions
918 "arch-x86/atom/string/ssse3-strcat-atom.S",
919 "arch-x86/atom/string/ssse3-strcmp-atom.S",
920 "arch-x86/atom/string/ssse3-strlcat-atom.S",
921 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
922 "arch-x86/atom/string/ssse3-strncat-atom.S",
923 "arch-x86/atom/string/ssse3-strncmp-atom.S",
924 "arch-x86/atom/string/ssse3-wcscat-atom.S",
925 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
926
927 // sse4 functions
928 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
929 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
930
931 // atom functions
932 "arch-x86/atom/string/sse2-memset-atom.S",
933 "arch-x86/atom/string/sse2-strlen-atom.S",
934 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800935 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700936 "arch-x86/atom/string/ssse3-strcpy-atom.S",
937 "arch-x86/atom/string/ssse3-strncpy-atom.S",
938 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530939
940 // avx2 functions
941 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700942 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700943
944 exclude_srcs: [
945 "bionic/strchr.cpp",
946 "bionic/strnlen.c",
947 "bionic/strrchr.cpp",
948 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700949 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700950 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700951 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700952 "arch-x86_64/string/sse2-memmove-slm.S",
953 "arch-x86_64/string/sse2-memset-slm.S",
954 "arch-x86_64/string/sse2-stpcpy-slm.S",
955 "arch-x86_64/string/sse2-stpncpy-slm.S",
956 "arch-x86_64/string/sse2-strcat-slm.S",
957 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700958 "arch-x86_64/string/sse2-strlen-slm.S",
959 "arch-x86_64/string/sse2-strncat-slm.S",
960 "arch-x86_64/string/sse2-strncpy-slm.S",
961 "arch-x86_64/string/sse4-memcmp-slm.S",
962 "arch-x86_64/string/ssse3-strcmp-slm.S",
963 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530964 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800965
966 "arch-x86_64/bionic/__bionic_clone.S",
967 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
968 "arch-x86_64/bionic/__restore_rt.S",
969 "arch-x86_64/bionic/setjmp.S",
970 "arch-x86_64/bionic/syscall.S",
971 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700972 ],
973 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700974 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700975
Colin Cross50c21ab2015-10-31 23:03:05 -0700976 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700977 include_dirs: ["bionic/libstdc++/include"],
978 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700979}
980
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000981genrule {
982 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -0800983 out: ["generated_android_ids.h"],
984 srcs: [":android_filesystem_config_header"],
985 tool_files: ["fs_config_generator.py"],
986 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000987}
988
Dan Willemsen268a6732015-10-15 14:49:45 -0700989// ========================================================
990// libc_bionic_ndk.a- The portions of libc_bionic that can
991// be safely used in libc_ndk.a (no troublesome global data
992// or constructors).
993// ========================================================
994cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700995 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700996 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -0700997 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -0700998 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -0700999 "bionic/__cmsg_nxthdr.cpp",
1000 "bionic/__errno.cpp",
1001 "bionic/__gnu_basename.cpp",
1002 "bionic/__libc_current_sigrtmax.cpp",
1003 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001004 "bionic/abort.cpp",
1005 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001006 "bionic/access.cpp",
1007 "bionic/arpa_inet.cpp",
1008 "bionic/assert.cpp",
1009 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001010 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001011 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001012 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001013 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001014 "bionic/bionic_systrace.cpp",
1015 "bionic/bionic_time_conversions.cpp",
1016 "bionic/brk.cpp",
1017 "bionic/c16rtomb.cpp",
1018 "bionic/c32rtomb.cpp",
1019 "bionic/chmod.cpp",
1020 "bionic/chown.cpp",
1021 "bionic/clearenv.cpp",
1022 "bionic/clock.cpp",
1023 "bionic/clock_getcpuclockid.cpp",
1024 "bionic/clock_nanosleep.cpp",
1025 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001026 "bionic/ctype.cpp",
1027 "bionic/dirent.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001028 "bionic/dup.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001029 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001030 "bionic/error.cpp",
Josh Gao7de41242020-04-29 17:08:46 -07001031 "bionic/eventfd.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001032 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001033 "bionic/faccessat.cpp",
1034 "bionic/fchmod.cpp",
1035 "bionic/fchmodat.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001036 "bionic/fcntl.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001037 "bionic/fdsan.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001038 "bionic/fdtrack.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001039 "bionic/ffs.cpp",
1040 "bionic/fgetxattr.cpp",
1041 "bionic/flistxattr.cpp",
1042 "bionic/flockfile.cpp",
1043 "bionic/fpclassify.cpp",
1044 "bionic/fsetxattr.cpp",
1045 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001046 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001047 "bionic/futimens.cpp",
1048 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001049 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001050 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001051 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001052 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001053 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001054 "bionic/getpgrp.cpp",
1055 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001056 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001057 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001058 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001059 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001060 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001061 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001062 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001063 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001064 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001065 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001066 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001067 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001068 "bionic/lchown.cpp",
1069 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001070 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001071 "bionic/libgen.cpp",
1072 "bionic/link.cpp",
1073 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001074 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001075 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001076 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001077 "bionic/mbrtoc16.cpp",
1078 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001079 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001080 "bionic/mempcpy.cpp",
1081 "bionic/mkdir.cpp",
1082 "bionic/mkfifo.cpp",
1083 "bionic/mknod.cpp",
1084 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001085 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001086 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001087 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001088 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001089 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001090 "bionic/open.cpp",
1091 "bionic/pathconf.cpp",
1092 "bionic/pause.cpp",
1093 "bionic/pipe.cpp",
1094 "bionic/poll.cpp",
1095 "bionic/posix_fadvise.cpp",
1096 "bionic/posix_fallocate.cpp",
1097 "bionic/posix_madvise.cpp",
1098 "bionic/posix_timers.cpp",
1099 "bionic/ptrace.cpp",
1100 "bionic/pty.cpp",
1101 "bionic/raise.cpp",
1102 "bionic/rand.cpp",
1103 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001104 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001105 "bionic/reboot.cpp",
1106 "bionic/recv.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001107 "bionic/recvmsg.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001108 "bionic/rename.cpp",
1109 "bionic/rmdir.cpp",
1110 "bionic/scandir.cpp",
1111 "bionic/sched_getaffinity.cpp",
1112 "bionic/sched_getcpu.cpp",
1113 "bionic/semaphore.cpp",
1114 "bionic/send.cpp",
1115 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001116 "bionic/seteuid.cpp",
1117 "bionic/setpgrp.cpp",
1118 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001119 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001120 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001121 "bionic/sleep.cpp",
Josh Gaob107eab2020-04-29 17:17:56 -07001122 "bionic/socketpair.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001123 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001124 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001125 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001126 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001127 "bionic/string_l.cpp",
1128 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001129 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001130 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001131 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001132 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001133 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001134 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001135 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001136 "bionic/sys_msg.cpp",
1137 "bionic/sys_sem.cpp",
1138 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001139 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001140 "bionic/sys_statfs.cpp",
1141 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001142 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001143 "bionic/sysinfo.cpp",
1144 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001145 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001146 "bionic/system_property_api.cpp",
1147 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001148 "bionic/tdestroy.cpp",
1149 "bionic/termios.cpp",
1150 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001151 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001152 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001153 "bionic/tmpfile.cpp",
1154 "bionic/umount.cpp",
1155 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001156 "bionic/usleep.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001157 "bionic/wait.cpp",
1158 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001159 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001160 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001161 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001162 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001163 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001164
1165 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1166 // which will be overridden by the actual one in libc.so.
1167 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001168 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001169
Dan Willemsen208ae172015-09-16 16:33:27 -07001170 multilib: {
1171 lib32: {
1172 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001173 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001174 },
1175 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001176 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001177 treble_linker_namespaces: {
1178 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001179 },
1180 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001181 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001182 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001183 local_include_dirs: ["stdio"],
1184 include_dirs: ["bionic/libstdc++/include"],
1185 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001186 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001187}
1188
Dan Willemsen208ae172015-09-16 16:33:27 -07001189// ========================================================
1190// libc_pthread.a - pthreads parts that previously lived in
1191// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001192// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001193// pthread_t has changed over the years and has ABI
1194// compatibility issues).
1195// ========================================================
1196
1197cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001198 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001199 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001200 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001201 "bionic/pthread_atfork.cpp",
1202 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001203 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001204 "bionic/pthread_cond.cpp",
1205 "bionic/pthread_create.cpp",
1206 "bionic/pthread_detach.cpp",
1207 "bionic/pthread_equal.cpp",
1208 "bionic/pthread_exit.cpp",
1209 "bionic/pthread_getcpuclockid.cpp",
1210 "bionic/pthread_getschedparam.cpp",
1211 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001212 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001213 "bionic/pthread_join.cpp",
1214 "bionic/pthread_key.cpp",
1215 "bionic/pthread_kill.cpp",
1216 "bionic/pthread_mutex.cpp",
1217 "bionic/pthread_once.cpp",
1218 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001219 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001220 "bionic/pthread_self.cpp",
1221 "bionic/pthread_setname_np.cpp",
1222 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001223 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001224
1225 // The following implementations depend on pthread data or implementation,
1226 // so we can't include them in libc_ndk.a.
1227 "bionic/__cxa_thread_atexit_impl.cpp",
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001228 "bionic/android_unsafe_frame_pointer_chase.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -08001229 "bionic/atexit.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001230 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001231 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001232
Colin Cross50c21ab2015-10-31 23:03:05 -07001233 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001234 include_dirs: ["bionic/libstdc++/include"],
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001235 header_libs: ["bionic_libc_platform_headers"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001236 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001237}
1238
1239// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001240// libc_syscalls.a
1241// ========================================================
1242
Elliott Hughes782c4852019-04-16 12:31:00 -07001243genrule {
1244 name: "syscalls-arm.S",
1245 out: ["syscalls-arm.S"],
1246 srcs: ["SYSCALLS.TXT"],
1247 tool_files: [":bionic-gensyscalls"],
1248 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1249}
1250
1251genrule {
1252 name: "syscalls-arm64.S",
1253 out: ["syscalls-arm64.S"],
1254 srcs: ["SYSCALLS.TXT"],
1255 tool_files: [":bionic-gensyscalls"],
1256 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1257}
1258
1259genrule {
1260 name: "syscalls-x86.S",
1261 out: ["syscalls-x86.S"],
1262 srcs: ["SYSCALLS.TXT"],
1263 tool_files: [":bionic-gensyscalls"],
1264 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1265}
1266
1267genrule {
1268 name: "syscalls-x86_64.S",
1269 out: ["syscalls-x86_64.S"],
1270 srcs: ["SYSCALLS.TXT"],
1271 tool_files: [":bionic-gensyscalls"],
1272 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1273}
1274
Dan Willemsen208ae172015-09-16 16:33:27 -07001275cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001276 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001277 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001278 arch: {
1279 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001280 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001281 },
1282 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001283 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001284 },
1285 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001286 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001287 },
1288 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001289 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001290 },
1291 },
1292 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001293}
1294
1295// ========================================================
1296// libc_aeabi.a
1297// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1298// to avoid infinite recursion. For the other architectures we just build an
1299// empty library to keep this makefile simple.
1300// ========================================================
1301
1302cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001303 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001304 arch: {
1305 arm: {
1306 srcs: ["arch-arm/bionic/__aeabi.c"],
1307 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001308 },
1309 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001310 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001311}
1312
1313// ========================================================
1314// libc_ndk.a
1315// Compatibility library for the NDK. This library contains
1316// all the parts of libc that are safe to statically link.
1317// We can't safely statically link things that can only run
1318// on a certain version of the OS. Examples include
1319// anything that talks to netd (a large portion of the DNS
1320// code) and anything that is dependent on the layout of a
1321// data structure that has changed across releases (such as
1322// pthread_t).
1323// ========================================================
1324
1325cc_library_static {
1326 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001327 defaults: [
1328 "libc_defaults",
1329 "libc_native_allocator_defaults",
1330 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -08001331 ramdisk_available: false,
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001332 srcs: libc_common_src_files + [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001333 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001334 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001335 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001336 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001337 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001338 multilib: {
1339 lib32: {
1340 srcs: libc_common_src_files_32,
1341 },
1342 },
1343 arch: {
1344 arm: {
1345 srcs: [
1346 "arch-arm/bionic/exidx_dynamic.c",
1347 "arch-common/bionic/crtbegin_so.c",
1348 "arch-arm/bionic/atexit_legacy.c",
1349 "arch-common/bionic/crtend_so.S",
1350 ],
1351 whole_static_libs: ["libc_aeabi"],
1352 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001353 },
1354
Colin Cross50c21ab2015-10-31 23:03:05 -07001355 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001356 "-fvisibility=hidden",
1357 "-DLIBC_STATIC",
1358 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001359
1360 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001361 "gwp_asan",
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001362 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001363 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001364 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001365 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001366 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001367 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001368 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001369 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001370 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001371 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001372 "libc_syscalls",
1373 "libc_tzcode",
1374 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001375 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001376 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001377}
1378
1379// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001380// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001381// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001382cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001383 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001384 srcs: libc_common_src_files,
1385 multilib: {
1386 lib32: {
1387 srcs: libc_common_src_files_32,
1388 },
1389 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001390 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001391
1392 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001393 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001394 "libc_bionic",
1395 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001396 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001397 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001398 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001399 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001400 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001401 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001402 "libc_netbsd",
1403 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001404 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001405 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001406 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001407 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001408 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001409 ],
1410
1411 arch: {
1412 arm: {
1413 whole_static_libs: ["libc_aeabi"],
1414 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001415 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001416}
1417
1418// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001419// libc_common.a
1420// ========================================================
1421
1422cc_library_static {
1423 defaults: ["libc_defaults"],
1424 name: "libc_common",
1425
1426 whole_static_libs: [
1427 "libc_nopthread",
1428 "libc_pthread",
1429 ],
1430}
1431
1432// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001433// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001434// ========================================================
1435cc_library_static {
1436 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001437 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001438
Haibo Huangb9244ff2018-08-11 10:12:13 -07001439 arch: {
1440 x86: {
1441 srcs: ["arch-x86/static_function_dispatch.S"],
1442 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001443 arm: {
1444 srcs: ["arch-arm/static_function_dispatch.S"],
1445 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001446 arm64: {
1447 srcs: ["arch-arm64/static_function_dispatch.S"],
1448 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001449 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001450}
1451
1452// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001453// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001454// ========================================================
1455cc_library_static {
1456 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001457 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001458
Haibo Huangb9244ff2018-08-11 10:12:13 -07001459 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001460 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001461 "-fno-stack-protector",
1462 "-fno-jump-tables",
1463 ],
1464 arch: {
1465 x86: {
1466 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1467 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001468 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001469 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001470 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001471 arm64: {
1472 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1473 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001474 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001475}
1476
1477// ========================================================
1478// libc_common_static.a For static binaries.
1479// ========================================================
1480cc_library_static {
1481 defaults: ["libc_defaults"],
1482 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001483
Haibo Huangf71edfa2018-11-12 10:06:56 -08001484 whole_static_libs: [
1485 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001486 "libc_static_dispatch",
1487 ],
1488}
1489
1490// ========================================================
1491// libc_common_shared.a For shared libraries.
1492// ========================================================
1493cc_library_static {
1494 defaults: ["libc_defaults"],
1495 name: "libc_common_shared",
1496
1497 whole_static_libs: [
1498 "libc_common",
1499 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001500 ],
1501}
1502
Ryan Prichard22a6a052019-10-10 23:59:30 -07001503// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1504// executable.
1505cc_library_static {
1506 name: "libc_unwind_static",
1507 defaults: ["libc_defaults"],
1508 cflags: ["-DLIBC_STATIC"],
1509
1510 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1511 arch: {
1512 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1513 arm: {
1514 srcs: ["arch-arm/bionic/exidx_static.c"],
1515 },
1516 },
1517}
1518
Haibo Huangf71edfa2018-11-12 10:06:56 -08001519// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001520// libc_nomalloc.a
1521// ========================================================
1522//
Ryan Prichard249757b2019-11-01 17:18:28 -07001523// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1524// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1525// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001526
1527cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001528 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001529 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001530
Colin Crossa3f9fca2016-01-11 13:20:55 -08001531 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001532 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001533 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001534 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001535 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001536}
1537
dimitryc0c0ef62018-12-05 16:33:52 +01001538filegroup {
1539 name: "libc_sources_shared",
1540 srcs: [
1541 "arch-common/bionic/crtbegin_so.c",
1542 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001543 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001544 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001545 "bionic/icu.cpp",
1546 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001547 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001548 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001549 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001550 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001551 "bionic/ndk_cruft.cpp",
1552 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001553 "bionic/NetdClient.cpp",
1554 "arch-common/bionic/crtend_so.S",
1555 ],
1556}
1557
1558filegroup {
1559 name: "libc_sources_static",
1560 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001561 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001562 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001563 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001564 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001565 ],
1566}
1567
1568filegroup {
1569 name: "libc_sources_shared_arm",
1570 srcs: [
1571 "arch-arm/bionic/exidx_dynamic.c",
1572 "arch-arm/bionic/atexit_legacy.c",
1573 ],
1574}
1575
Dan Willemsen208ae172015-09-16 16:33:27 -07001576// ========================================================
1577// libc.a + libc.so
1578// ========================================================
1579cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001580 defaults: [
1581 "libc_defaults",
1582 "libc_native_allocator_defaults",
1583 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001584 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001585 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001586 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001587 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001588 platform_sdk_version: {
1589 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1590 },
1591 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001592 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001593 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001594 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001595 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001596 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001597 "libc_init_static",
1598 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001599 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001600 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001601 },
1602 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001603 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001604 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001605 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001606 "libc_init_dynamic",
1607 "libc_common_shared",
1608 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001609 },
1610
Neil Fullera7db90f2019-04-25 09:28:27 +01001611 required: [
1612 "tzdata",
1613 "tz_version", // Version metadata for tzdata to help debugging.
1614 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001615
Colin Cross4ce94d22016-11-15 13:15:43 -08001616 // Do not pack libc.so relocations; see http://b/20645321 for details.
1617 pack_relocations: false,
1618
dimitry06016f22018-01-05 11:39:28 +01001619 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1620 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1621 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1622 // those new libraries from libgcc.a are not declared external; if that were the case,
1623 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1624 // on the external symbols from the dependent libraries. That would create a "cloaked"
1625 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001626
dimitry06016f22018-01-05 11:39:28 +01001627 shared_libs: [
1628 "ld-android",
1629 "libdl",
1630 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001631 static_libs: [
1632 "libdl_android",
1633 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001634
1635 nocrt: true,
1636
Dan Willemsen208ae172015-09-16 16:33:27 -07001637 arch: {
1638 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001639 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001640 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001641 ldflags: ["-Wl,--hash-style=both"],
1642
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001643 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001644
Dan Willemsen208ae172015-09-16 16:33:27 -07001645 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001646 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001647 // special for arm
1648 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichard379e05f2020-04-01 20:10:07 -07001649
1650 whole_static_libs: [ "libunwind_llvm" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001651 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001652
1653 // Arm 32 bit does not produce complete exidx unwind information
1654 // so keep the .debug_frame which is relatively small and does
1655 // include needed unwind information.
1656 // See b/132992102 for details.
1657 strip: {
1658 keep_symbols_and_debug_frame: true,
1659 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001660 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001661 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001662 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001663
1664 // Leave the symbols in the shared library so that stack unwinders can produce
1665 // meaningful name resolution.
1666 strip: {
1667 keep_symbols: true,
1668 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001669
Ryan Prichard379e05f2020-04-01 20:10:07 -07001670 shared: {
1671 whole_static_libs: [ "libgcc_stripped" ],
1672 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001673 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001674 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001675 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001676 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001677 ldflags: ["-Wl,--hash-style=both"],
1678
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001679 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001680
1681 // Leave the symbols in the shared library so that stack unwinders can produce
1682 // meaningful name resolution.
1683 strip: {
1684 keep_symbols: true,
1685 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001686
Ryan Prichard379e05f2020-04-01 20:10:07 -07001687 shared: {
1688 whole_static_libs: [ "libgcc_stripped" ],
1689 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001690 },
1691 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001692 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001693
1694 // Leave the symbols in the shared library so that stack unwinders can produce
1695 // meaningful name resolution.
1696 strip: {
1697 keep_symbols: true,
1698 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001699
Ryan Prichard379e05f2020-04-01 20:10:07 -07001700 shared: {
1701 whole_static_libs: [ "libgcc_stripped" ],
1702 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001703 },
1704 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001705
1706 stubs: {
1707 symbol_file: "libc.map.txt",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001708 versions: [
1709 "29",
Jooyung Handbfa0742020-03-30 13:18:44 +09001710 "R",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001711 "10000",
1712 ],
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001713 },
Vic Yang6903fb82019-01-14 11:34:39 -08001714
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001715 apex_available: [
1716 "//apex_available:platform",
1717 "com.android.runtime",
1718 ],
1719
Vic Yang03ff4362019-06-24 16:11:37 -07001720 // Sorting bss symbols by size usually results in less dirty pages at run
1721 // time, because small symbols are grouped together.
1722 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001723}
1724
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001725genrule {
1726 name: "libc.arm.map",
1727 out: ["libc.arm.map"],
1728 srcs: ["libc.map.txt"],
1729 tool_files: [":bionic-generate-version-script"],
1730 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1731}
1732
1733genrule {
1734 name: "libc.arm64.map",
1735 out: ["libc.arm64.map"],
1736 srcs: ["libc.map.txt"],
1737 tool_files: [":bionic-generate-version-script"],
1738 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1739}
1740
1741genrule {
1742 name: "libc.x86.map",
1743 out: ["libc.x86.map"],
1744 srcs: ["libc.map.txt"],
1745 tool_files: [":bionic-generate-version-script"],
1746 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1747}
1748
1749genrule {
1750 name: "libc.x86_64.map",
1751 out: ["libc.x86_64.map"],
1752 srcs: ["libc.map.txt"],
1753 tool_files: [":bionic-generate-version-script"],
1754 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1755}
1756
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001757// Headers that only other parts of the platform can include.
1758cc_library_headers {
1759 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001760 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001761 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001762 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001763 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001764 "//frameworks:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001765 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001766 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001767 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001768 "//system/core/debuggerd:__subpackages__",
Peter Collingbourne6e316e62020-04-07 14:09:52 -07001769 "//system/core/libunwindstack:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001770 "//system/memory/libmemunreachable:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001771 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001772 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001773 ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001774 recovery_available: true,
1775 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001776 export_include_dirs: [
1777 "platform",
1778 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001779 system_shared_libs: [],
1780 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001781 sdk_version: "current",
1782}
1783
Logan Chien17af91b2019-01-15 21:19:56 +08001784// libc_headers for libasync_safe and libpropertyinfoparser
1785cc_library_headers {
1786 name: "libc_headers",
1787
1788 host_supported: true,
1789 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001790 ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001791 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001792 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001793 apex_available: [
1794 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001795 "//apex_available:anyapex",
1796 ],
1797 visibility: [
1798 ":__subpackages__", // visible to bionic
1799 // ... and only to these places (b/152668052)
1800 "//external/gwp_asan",
1801 "//external/libunwind_llvm",
1802 "//system/core/property_service/libpropertyinfoparser",
1803 "//system/extras/toolchain-extras",
Jiyong Park922a5c72020-03-07 17:35:02 +09001804 ],
Logan Chien17af91b2019-01-15 21:19:56 +08001805
1806 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001807 stl: "none",
1808 system_shared_libs: [],
1809
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001810 // The build system generally requires that any dependencies of a target
1811 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1812 // to 1 we let targets with an sdk_version that need to depend on the libc
1813 // headers but cannot depend on libc itself due to circular dependencies
1814 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1815 // is correct because the headers can support any sdk_version.
1816 sdk_version: "1",
1817
Logan Chien17af91b2019-01-15 21:19:56 +08001818 export_include_dirs: [
1819 "include",
1820 "kernel/uapi",
1821 "kernel/android/uapi",
1822 ],
1823
1824 arch: {
1825 arm: {
1826 export_include_dirs: [
1827 "kernel/uapi/asm-arm",
1828 ],
1829 },
1830 arm64: {
1831 export_include_dirs: [
1832 "kernel/uapi/asm-arm64",
1833 ],
1834 },
Logan Chien17af91b2019-01-15 21:19:56 +08001835 x86: {
1836 export_include_dirs: [
1837 "kernel/uapi/asm-x86",
1838 ],
1839 },
1840 x86_64: {
1841 export_include_dirs: [
1842 "kernel/uapi/asm-x86",
1843 ],
1844 },
1845 },
1846}
1847
Dan Willemsen208ae172015-09-16 16:33:27 -07001848// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001849// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001850// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001851
Dan Willemsen208ae172015-09-16 16:33:27 -07001852cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001853 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001854 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001855 srcs: [
1856 "bionic/__cxa_guard.cpp",
1857 "bionic/__cxa_pure_virtual.cpp",
1858 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001859 ],
1860 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001861 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001862 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001863
Dan Willemsen6b3be172018-12-03 13:57:20 -08001864 static: {
1865 system_shared_libs: [],
1866 },
1867 shared: {
1868 system_shared_libs: ["libc"],
1869 },
1870
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001871 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001872 arch: {
1873 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001874 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001875 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001876 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001877 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001878 },
1879 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001880 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001881 },
1882 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001883 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001884 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001885 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001886 },
1887 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001888 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001889 },
1890 },
1891}
1892
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001893genrule {
1894 name: "libstdc++.arm.map",
1895 out: ["libstdc++.arm.map"],
1896 srcs: ["libstdc++.map.txt"],
1897 tool_files: [":bionic-generate-version-script"],
1898 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1899}
1900
1901genrule {
1902 name: "libstdc++.arm64.map",
1903 out: ["libstdc++.arm64.map"],
1904 srcs: ["libstdc++.map.txt"],
1905 tool_files: [":bionic-generate-version-script"],
1906 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1907}
1908
1909genrule {
1910 name: "libstdc++.x86.map",
1911 out: ["libstdc++.x86.map"],
1912 srcs: ["libstdc++.map.txt"],
1913 tool_files: [":bionic-generate-version-script"],
1914 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1915}
1916
1917genrule {
1918 name: "libstdc++.x86_64.map",
1919 out: ["libstdc++.x86_64.map"],
1920 srcs: ["libstdc++.map.txt"],
1921 tool_files: [":bionic-generate-version-script"],
1922 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1923}
1924
1925// ========================================================
1926// crt object files.
1927// ========================================================
1928
Colin Cross50c21ab2015-10-31 23:03:05 -07001929cc_defaults {
1930 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001931 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001932 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001933 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001934 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001935 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001936 apex_available: [
1937 "//apex_available:platform",
1938 "//apex_available:anyapex",
1939 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001940
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001941 cflags: [
1942 "-Wno-gcc-compat",
1943 "-Wall",
1944 "-Werror",
1945 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07001946 sanitize: {
1947 never: true,
1948 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001949}
1950
Colin Cross50c21ab2015-10-31 23:03:05 -07001951cc_defaults {
1952 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001953 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001954
1955 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07001956 x86: {
1957 cflags: ["-fPIC"],
1958 },
1959 x86_64: {
1960 cflags: ["-fPIC"],
1961 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001962 },
Colin Crossab179442018-09-27 11:03:22 -07001963 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001964}
1965
Dan Willemsen208ae172015-09-16 16:33:27 -07001966cc_object {
1967 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001968 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001969 local_include_dirs: ["include"],
1970 product_variables: {
1971 platform_sdk_version: {
1972 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1973 },
1974 },
1975 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001976
Colin Cross7d7b3682017-11-03 13:38:40 -07001977 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001978}
1979
Dan Willemsen208ae172015-09-16 16:33:27 -07001980cc_object {
1981 name: "crtbegin_so1",
1982 local_include_dirs: ["include"],
1983 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001984
Colin Cross7d7b3682017-11-03 13:38:40 -07001985 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001986}
1987
Dan Willemsen208ae172015-09-16 16:33:27 -07001988cc_object {
1989 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07001990
Colin Cross7d7b3682017-11-03 13:38:40 -07001991 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07001992 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001993 "crtbegin_so1",
1994 "crtbrand",
1995 ],
1996}
1997
Dan Willemsen208ae172015-09-16 16:33:27 -07001998cc_object {
1999 name: "crtend_so",
2000 local_include_dirs: ["include"],
2001 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002002
Colin Cross7d7b3682017-11-03 13:38:40 -07002003 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002004}
2005
Dan Willemsen208ae172015-09-16 16:33:27 -07002006cc_object {
2007 name: "crtbegin_static1",
2008 local_include_dirs: ["include"],
2009 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002010 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002011}
2012
Dan Willemsen208ae172015-09-16 16:33:27 -07002013cc_object {
2014 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002015
Colin Cross77d57bf2016-04-11 14:34:18 -07002016 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002017 "crtbegin_static1",
2018 "crtbrand",
2019 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002020 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002021}
2022
Dan Willemsen208ae172015-09-16 16:33:27 -07002023cc_object {
2024 name: "crtbegin_dynamic1",
2025 local_include_dirs: ["include"],
2026 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002027 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002028}
2029
Dan Willemsen208ae172015-09-16 16:33:27 -07002030cc_object {
2031 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002032
Colin Cross77d57bf2016-04-11 14:34:18 -07002033 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002034 "crtbegin_dynamic1",
2035 "crtbrand",
2036 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002037 target: {
2038 linux_bionic: {
2039 generated_sources: ["host_bionic_linker_asm"],
2040 objs: [
2041 "linker_wrapper",
2042 ],
2043 },
2044 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002045 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002046}
2047
Dan Willemsen208ae172015-09-16 16:33:27 -07002048cc_object {
2049 // We rename crtend.o to crtend_android.o to avoid a
2050 // name clash between gcc and bionic.
2051 name: "crtend_android",
2052 local_include_dirs: ["include"],
2053 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002054
Colin Cross50c21ab2015-10-31 23:03:05 -07002055 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002056}
Colin Crossbaa48992016-07-13 11:15:21 -07002057
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002058// ========================================================
2059// NDK headers.
2060// ========================================================
2061
Dan Albert26e1c412018-05-24 14:56:46 -07002062versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002063 name: "common_libc",
2064 from: "include",
2065 to: "",
2066 license: "NOTICE",
2067}
Dan Albert4238a352016-06-28 11:18:05 -07002068
2069ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002070 name: "libc_uapi",
2071 from: "kernel/uapi",
2072 to: "",
2073 srcs: [
2074 "kernel/uapi/asm-generic/**/*.h",
2075 "kernel/uapi/drm/**/*.h",
2076 "kernel/uapi/linux/**/*.h",
2077 "kernel/uapi/misc/**/*.h",
2078 "kernel/uapi/mtd/**/*.h",
2079 "kernel/uapi/rdma/**/*.h",
2080 "kernel/uapi/scsi/**/*.h",
2081 "kernel/uapi/sound/**/*.h",
2082 "kernel/uapi/video/**/*.h",
2083 "kernel/uapi/xen/**/*.h",
2084 ],
Dan Albert92592652016-10-20 01:42:54 -07002085 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002086}
2087
2088ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002089 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002090 from: "kernel/android/uapi/linux",
2091 to: "linux",
2092 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002093 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002094}
2095
2096ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002097 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002098 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002099 to: "scsi",
2100 srcs: ["kernel/android/scsi/**/*.h"],
2101 license: "NOTICE",
2102}
2103
2104ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002105 name: "libc_asm_arm",
2106 from: "kernel/uapi/asm-arm",
2107 to: "arm-linux-androideabi",
2108 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002109 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002110}
2111
2112ndk_headers {
2113 name: "libc_asm_arm64",
2114 from: "kernel/uapi/asm-arm64",
2115 to: "aarch64-linux-android",
2116 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002117 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002118}
2119
Lazar Trsic790d2f72017-11-27 11:54:11 +01002120ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002121 name: "libc_asm_x86",
2122 from: "kernel/uapi/asm-x86",
2123 to: "i686-linux-android",
2124 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002125 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002126}
2127
2128ndk_headers {
2129 name: "libc_asm_x86_64",
2130 from: "kernel/uapi/asm-x86",
2131 to: "x86_64-linux-android",
2132 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002133 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002134}
2135
Dan Albert4238a352016-06-28 11:18:05 -07002136ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002137 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002138 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002139 symbol_file: "libc.map.txt",
2140 first_version: "9",
2141}
2142
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002143llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002144 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002145 symbol_file: "libc.map.txt",
2146 export_headers_as_system: true,
2147 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002148 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002149 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002150 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002151 "kernel/android/uapi",
2152 "kernel/uapi",
2153 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002154 arch: {
2155 arm: {
2156 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002157 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002158 ],
2159 },
2160 arm64: {
2161 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002162 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002163 ],
2164 },
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002165 x86: {
2166 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002167 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002168 ],
2169 },
2170 x86_64: {
2171 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002172 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002173 ],
2174 },
2175 },
2176}
2177
Dan Albertdf31aff2016-10-06 15:50:41 -07002178ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002179 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002180 symbol_file: "libstdc++.map.txt",
2181 first_version: "9",
2182}
2183
Dan Willemsenca056d72018-01-08 14:00:24 -08002184// Export these headers for toolbox to process
2185filegroup {
2186 name: "kernel_input_headers",
2187 srcs: [
2188 "kernel/uapi/linux/input.h",
2189 "kernel/uapi/linux/input-event-codes.h",
2190 ],
2191}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002192
2193// Generate a syscall name / number mapping. These objects are text files
2194// (thanks to the -dD -E flags) and not binary files. They will then be
2195// consumed by the genseccomp.py script and converted into C++ code.
2196cc_defaults {
2197 name: "libseccomp_gen_syscall_nrs_defaults",
2198 recovery_available: true,
2199 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2200 cflags: [
2201 "-dD",
2202 "-E",
2203 "-Wall",
2204 "-Werror",
2205 "-nostdinc",
2206 ],
2207}
2208
2209cc_object {
2210 name: "libseccomp_gen_syscall_nrs_arm",
2211 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2212 local_include_dirs: [
2213 "kernel/uapi/asm-arm",
2214 "kernel/uapi",
2215 ],
2216}
2217
2218cc_object {
2219 name: "libseccomp_gen_syscall_nrs_arm64",
2220 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2221 local_include_dirs: [
2222 "kernel/uapi/asm-arm64",
2223 "kernel/uapi",
2224 ],
2225}
2226
2227cc_object {
2228 name: "libseccomp_gen_syscall_nrs_x86",
2229 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2230 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2231 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2232 local_include_dirs: [
2233 "kernel/uapi/asm-x86",
2234 "kernel/uapi",
2235 ],
2236}
2237
2238cc_object {
2239 name: "libseccomp_gen_syscall_nrs_x86_64",
2240 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2241 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2242 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2243 local_include_dirs: [
2244 "kernel/uapi/asm-x86",
2245 "kernel/uapi",
2246 ],
2247}
2248
Elliott Hughesae03b122019-09-17 16:37:05 -07002249// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002250python_binary_host {
2251 name: "genseccomp",
2252 main: "tools/genseccomp.py",
2253
2254 srcs: [
2255 "tools/genseccomp.py",
2256 "tools/gensyscalls.py",
2257 ],
2258
2259 data: [
2260 "kernel/uapi/**/*.h",
2261 ],
2262
2263 version: {
2264 py2: {
2265 enabled: true,
2266 },
2267 py3: {
2268 enabled: false,
2269 },
2270 },
2271}
2272
Martijn Coenen0c6de752019-01-02 12:52:51 +01002273python_binary_host {
2274 name: "genfunctosyscallnrs",
2275 main: "tools/genfunctosyscallnrs.py",
2276
2277 srcs: [
2278 "tools/genseccomp.py",
2279 "tools/genfunctosyscallnrs.py",
2280 "tools/gensyscalls.py",
2281 ],
2282
2283 data: [
2284 "kernel/uapi/**/*.h",
2285 ],
2286
2287 version: {
2288 py2: {
2289 enabled: true,
2290 },
2291 py3: {
2292 enabled: false,
2293 },
2294 },
2295}
2296
2297cc_genrule {
2298 name: "func_to_syscall_nrs",
2299 recovery_available: true,
2300 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2301
2302 tools: [ "genfunctosyscallnrs" ],
2303
2304 srcs: [
2305 "SYSCALLS.TXT",
2306 ":libseccomp_gen_syscall_nrs_arm",
2307 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002308 ":libseccomp_gen_syscall_nrs_x86",
2309 ":libseccomp_gen_syscall_nrs_x86_64",
2310 ],
2311
2312 out: [
2313 "func_to_syscall_nrs.h",
2314 ],
2315}
2316
Martijn Coenenc3752be2019-01-09 16:19:57 +01002317// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2318genrule {
2319 name: "generate_app_zygote_blacklist",
2320 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2321 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2322 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2323}
2324
2325cc_genrule {
2326 name: "libseccomp_policy_app_zygote_sources",
2327 recovery_available: true,
2328 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2329
2330 tools: [ "genseccomp" ],
2331
2332 srcs: [
2333 "SYSCALLS.TXT",
2334 "SECCOMP_WHITELIST_COMMON.TXT",
2335 "SECCOMP_WHITELIST_APP.TXT",
2336 "SECCOMP_BLACKLIST_COMMON.TXT",
2337 ":generate_app_zygote_blacklist",
2338 ":libseccomp_gen_syscall_nrs_arm",
2339 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002340 ":libseccomp_gen_syscall_nrs_x86",
2341 ":libseccomp_gen_syscall_nrs_x86_64",
2342 ],
2343
2344 out: [
2345 "arm64_app_zygote_policy.cpp",
2346 "arm_app_zygote_policy.cpp",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002347 "x86_64_app_zygote_policy.cpp",
2348 "x86_app_zygote_policy.cpp",
2349 ],
2350}
2351
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002352cc_genrule {
2353 name: "libseccomp_policy_app_sources",
2354 recovery_available: true,
2355 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2356
2357 tools: [ "genseccomp" ],
2358
2359 srcs: [
2360 "SYSCALLS.TXT",
2361 "SECCOMP_WHITELIST_COMMON.TXT",
2362 "SECCOMP_WHITELIST_APP.TXT",
2363 "SECCOMP_BLACKLIST_COMMON.TXT",
2364 "SECCOMP_BLACKLIST_APP.TXT",
2365 ":libseccomp_gen_syscall_nrs_arm",
2366 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002367 ":libseccomp_gen_syscall_nrs_x86",
2368 ":libseccomp_gen_syscall_nrs_x86_64",
2369 ],
2370
2371 out: [
2372 "arm64_app_policy.cpp",
2373 "arm_app_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002374 "x86_64_app_policy.cpp",
2375 "x86_app_policy.cpp",
2376 ],
2377}
2378
2379cc_genrule {
2380 name: "libseccomp_policy_system_sources",
2381 recovery_available: true,
2382 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2383
2384 tools: [ "genseccomp" ],
2385
2386 srcs: [
2387 "SYSCALLS.TXT",
2388 "SECCOMP_WHITELIST_COMMON.TXT",
2389 "SECCOMP_WHITELIST_SYSTEM.TXT",
2390 "SECCOMP_BLACKLIST_COMMON.TXT",
2391 ":libseccomp_gen_syscall_nrs_arm",
2392 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002393 ":libseccomp_gen_syscall_nrs_x86",
2394 ":libseccomp_gen_syscall_nrs_x86_64",
2395 ],
2396
2397 out: [
2398 "arm64_system_policy.cpp",
2399 "arm_system_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002400 "x86_64_system_policy.cpp",
2401 "x86_system_policy.cpp",
2402 ],
2403}
2404
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002405cc_library {
2406 name: "libseccomp_policy",
2407 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002408 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002409 generated_sources: [
2410 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002411 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002412 "libseccomp_policy_system_sources",
2413 ],
2414
2415 srcs: [
2416 "seccomp/seccomp_policy.cpp",
2417 ],
2418
2419 export_include_dirs: ["seccomp/include"],
2420 cflags: [
2421 "-Wall",
2422 "-Werror",
2423 ],
2424 shared: {
2425 shared_libs: ["libbase"],
2426 },
2427 static: {
2428 static_libs: ["libbase"],
2429 },
2430}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002431
2432// This is a temporary library that will use scudo as the native memory
2433// allocator. To use it, add it as the first shared library.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002434cc_defaults {
2435 name: "libc_scudo_wrapper_defaults",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002436 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002437 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08002438 "bionic/heap_tagging.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002439 "bionic/malloc_common.cpp",
2440 "bionic/malloc_common_dynamic.cpp",
2441 "bionic/malloc_heapprofd.cpp",
2442 "bionic/malloc_limit.cpp",
2443 "bionic/scudo_wrapper.cpp",
2444 "bionic/__set_errno.cpp",
2445 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002446 cflags: [
2447 "-DUSE_SCUDO",
2448 "-fno-emulated-tls", // Required for GWP-ASan.
2449 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002450 shared_libs: ["libscudo_wrapper"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002451
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002452 header_libs: [
2453 "libc_headers",
2454 "gwp_asan_headers",
2455 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002456
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002457 static_libs: [
2458 "libasync_safe",
2459 "gwp_asan",
2460 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002461
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002462 arch: {
2463 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002464 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002465 },
2466 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002467 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002468 },
2469 x86: {
2470 srcs: [
2471 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002472 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002473 ],
2474 },
2475 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002476 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002477 },
2478 },
2479
2480 // Mark this library as global so it overrides all the allocation
2481 // definitions properly.
2482 ldflags: ["-Wl,-z,global"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002483}
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002484
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002485cc_library_shared {
2486 name: "libc_scudo",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002487 vendor_available: true,
2488 stl: "none",
2489 system_shared_libs: [],
2490
2491 allow_undefined_symbols: true,
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002492 // Like libc, disable native coverage for libc_scudo.
2493 native_coverage: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002494}
2495
2496subdirs = [
2497 "bionic/scudo",
2498]