blob: ba5ef11174fa8ccb13f29070fcfa0a979cf9db20 [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",
Victor Khimenko8e0707d2020-06-09 21:57:05 +02007 "bionic/exit.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070011 "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]
21
Peter Collingbourne570de332019-12-11 10:00:58 -080022// off64_t/time64_t support on LP32.
Dan Willemsen208ae172015-09-16 16:33:27 -070023// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -070024libc_common_src_files_32 = [
25 "bionic/legacy_32_bit_support.cpp",
26 "bionic/time64.c",
27]
28
Elliott Hughes53cf3482016-08-09 13:06:41 -070029libc_common_flags = [
30 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080031 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070032 "-Wall",
33 "-Wextra",
34 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080035 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070036 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070037 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070038 "-Wframe-larger-than=2048",
Elliott Hughes53cf3482016-08-09 13:06:41 -070039
40 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
41 "-Werror=pointer-to-int-cast",
42 "-Werror=int-to-pointer-cast",
43 "-Werror=type-limits",
44 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080045
46 // Clang's exit-time destructor registration hides __dso_handle, but
47 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
48 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080049
50 // GWP-ASan requires platform TLS.
51 "-fno-emulated-tls",
Elliott Hughes53cf3482016-08-09 13:06:41 -070052]
53
Dan Willemsen208ae172015-09-16 16:33:27 -070054// Define some common cflags
55// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070056cc_defaults {
57 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080058 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070059 cflags: libc_common_flags,
60 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070061 conlyflags: ["-std=gnu99"],
62 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070063 include_dirs: [
64 "bionic/libc/async_safe/include",
Peter Collingbourne5d3aa862020-09-11 15:05:17 -070065 "bionic/libc/platform",
Tom Cherry379ed1e2020-09-17 09:36:25 -070066 // For android_filesystem_config.h.
67 "system/core/libcutils/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070068 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070069
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010070 header_libs: [
71 "libc_headers",
72 "gwp_asan_headers",
73 ],
74 export_header_lib_headers: [
75 "libc_headers",
76 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -080077
Colin Cross50c21ab2015-10-31 23:03:05 -070078 stl: "none",
79 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070080 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070081 address: false,
82 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070083 // TODO(b/132640749): Fix broken fuzzer support.
84 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070085 },
Yifan Hong5a39cee2020-01-21 16:43:56 -080086 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090087 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020088 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080089
Yi Konge3d90de2019-02-20 14:28:56 -080090 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
91 // warning since this is intended right now.
92 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070093
94 product_variables: {
95 experimental_mte: {
96 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
97 },
Evgenii Stepanov5a73e032020-04-29 14:59:44 -070098 malloc_zero_contents: {
99 cflags: ["-DSCUDO_ZERO_CONTENTS"],
100 },
101 malloc_pattern_fill_contents: {
102 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
103 },
Steven Morelandfb65ee42020-07-31 00:18:38 +0000104 malloc_not_svelte: {
105 cflags: ["-DUSE_SCUDO"],
106 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700107 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700108}
109
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800110libc_scudo_product_variables = {
111 malloc_not_svelte: {
112 cflags: ["-DUSE_SCUDO"],
113 whole_static_libs: ["libscudo"],
114 exclude_static_libs: [
115 "libjemalloc5",
116 "libc_jemalloc_wrapper",
117 ],
118 },
119}
120
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700121// Defaults for native allocator libs/includes to make it
122// easier to change.
Christopher Ferris062eba22020-01-31 22:40:45 -0800123// To disable scudo for the non-svelte config remove the line:
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800124// product_variables: libc_scudo_product_variables,
Christopher Ferris062eba22020-01-31 22:40:45 -0800125// in the cc_defaults below.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700126// ========================================================
127cc_defaults {
128 name: "libc_native_allocator_defaults",
129
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700130 whole_static_libs: [
131 "libjemalloc5",
132 "libc_jemalloc_wrapper",
133 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800134 header_libs: ["gwp_asan_headers"],
Christopher Ferris062eba22020-01-31 22:40:45 -0800135 product_variables: libc_scudo_product_variables,
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700136}
137
138// Functions not implemented by jemalloc directly, or that need to
139// be modified for Android.
140cc_library_static {
141 name: "libc_jemalloc_wrapper",
142 defaults: ["libc_defaults"],
143 srcs: ["bionic/jemalloc_wrapper.cpp"],
144 cflags: ["-fvisibility=hidden"],
145
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800146 // Used to pull in the jemalloc include directory so that if the
147 // library is removed, the include directory is also removed.
148 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700149}
150
Dan Willemsen208ae172015-09-16 16:33:27 -0700151// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700152// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700153// ========================================================
154//
Ryan Prichard249757b2019-11-01 17:18:28 -0700155// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
156// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
157// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
158// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700159
160cc_library_static {
161
Colin Crossa3f9fca2016-01-11 13:20:55 -0800162 srcs: [
163 "bionic/__libc_init_main_thread.cpp",
164 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700165 "bionic/bionic_call_ifunc_resolver.cpp",
166 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800167 ],
168 arch: {
169 arm64: {
170 srcs: ["arch-arm64/bionic/__set_tls.c"],
171 },
172 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700173 srcs: [
174 "arch-x86/bionic/__libc_init_sysinfo.cpp",
175 "arch-x86/bionic/__set_tls.cpp",
176 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800177 },
178 x86_64: {
179 srcs: ["arch-x86_64/bionic/__set_tls.c"],
180 },
181 },
182
Colin Cross50c21ab2015-10-31 23:03:05 -0700183 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700184 cflags: ["-fno-stack-protector", "-ffreestanding"],
185 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700186}
187
Ryan Prichard249757b2019-11-01 17:18:28 -0700188// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
189// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
190// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800191
192cc_library_static {
193 name: "libc_init_static",
194 defaults: ["libc_defaults"],
195 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700196 cflags: [
197 "-fno-stack-protector",
198
199 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
200 // from the linker before ifunc resolvers have made string.h functions available.
201 "-ffreestanding",
202 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800203}
204
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700205cc_library_static {
206 name: "libc_init_dynamic",
207 defaults: ["libc_defaults"],
208 srcs: ["bionic/libc_init_dynamic.cpp"],
209 cflags: ["-fno-stack-protector"],
210}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800211
Dan Willemsen208ae172015-09-16 16:33:27 -0700212// ========================================================
213// libc_tzcode.a - upstream 'tzcode' code
214// ========================================================
215
216cc_library_static {
217
Colin Cross50c21ab2015-10-31 23:03:05 -0700218 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700219 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800220 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700221 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700222 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
223 ],
224
Colin Cross50c21ab2015-10-31 23:03:05 -0700225 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700226 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700227 // Don't use ridiculous amounts of stack.
228 "-DALL_STATE",
229 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
230 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800231 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700232 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700233 // The name of the tm_gmtoff field in our struct tm.
234 "-DTM_GMTOFF=tm_gmtoff",
235 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700236 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700237 // Include `tzname`, `timezone`, and `daylight` globals.
238 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700239 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800240 // Use the empty string (instead of " ") as the timezone abbreviation
241 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700242 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700243 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
244 "-Dlint",
245 ],
246
Dan Willemsen208ae172015-09-16 16:33:27 -0700247 local_include_dirs: ["tzcode/"],
248 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700249}
250
251// ========================================================
252// libc_dns.a - modified NetBSD DNS code
253// ========================================================
254
255cc_library_static {
256
Colin Cross50c21ab2015-10-31 23:03:05 -0700257 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700258 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800259 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700260
261 "upstream-netbsd/lib/libc/isc/ev_streams.c",
262 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700263 ],
264
Colin Cross50c21ab2015-10-31 23:03:05 -0700265 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700266 "-DANDROID_CHANGES",
267 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700268 "-Wno-unused-parameter",
269 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700270 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700271 ],
272
Dan Willemsen208ae172015-09-16 16:33:27 -0700273 local_include_dirs: [
274 "dns/include",
275 "private",
276 "upstream-netbsd/lib/libc/include",
277 "upstream-netbsd/android/include",
278 ],
279
280 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700281}
282
283// ========================================================
284// libc_freebsd.a - upstream FreeBSD C library code
285// ========================================================
286//
287// These files are built with the freebsd-compat.h header file
288// automatically included.
289
290cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700291 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700292 srcs: [
293 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700294 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700295 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
296 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
297 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
298 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700299 "upstream-freebsd/lib/libc/stdlib/qsort.c",
300 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700301 "upstream-freebsd/lib/libc/string/wcpcpy.c",
302 "upstream-freebsd/lib/libc/string/wcpncpy.c",
303 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700304 "upstream-freebsd/lib/libc/string/wcscat.c",
305 "upstream-freebsd/lib/libc/string/wcschr.c",
306 "upstream-freebsd/lib/libc/string/wcscmp.c",
307 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700308 "upstream-freebsd/lib/libc/string/wcscspn.c",
309 "upstream-freebsd/lib/libc/string/wcsdup.c",
310 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700311 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700312 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
313 "upstream-freebsd/lib/libc/string/wcsncat.c",
314 "upstream-freebsd/lib/libc/string/wcsncmp.c",
315 "upstream-freebsd/lib/libc/string/wcsncpy.c",
316 "upstream-freebsd/lib/libc/string/wcsnlen.c",
317 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700318 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700319 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700320 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700321 "upstream-freebsd/lib/libc/string/wcstok.c",
322 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700323 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700324 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700325 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800326 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700327 ],
328 arch: {
329 arm64: {
330 exclude_srcs: [
331 "upstream-freebsd/lib/libc/string/wmemmove.c",
332 ],
333 },
334 x86: {
335 exclude_srcs: [
336 "upstream-freebsd/lib/libc/string/wcschr.c",
337 "upstream-freebsd/lib/libc/string/wcscmp.c",
338 "upstream-freebsd/lib/libc/string/wcslen.c",
339 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700340 "upstream-freebsd/lib/libc/string/wmemcmp.c",
341 "upstream-freebsd/lib/libc/string/wcscat.c",
342 "upstream-freebsd/lib/libc/string/wcscpy.c",
343 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530344 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700345 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700346 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700347 },
348
Colin Cross50c21ab2015-10-31 23:03:05 -0700349 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700350 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700351 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700352 "-include freebsd-compat.h",
353 ],
354
Dan Willemsen208ae172015-09-16 16:33:27 -0700355 local_include_dirs: [
356 "upstream-freebsd/android/include",
357 ],
358
359 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700360}
361
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700362cc_library_static {
363 defaults: ["libc_defaults"],
364 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700365 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700366 ],
367
368 cflags: [
369 "-Wno-sign-compare",
370 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700371 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700372 ],
373
374 local_include_dirs: [
375 "upstream-freebsd/android/include",
376 ],
377
378 name: "libc_freebsd_large_stack",
379}
380
Dan Willemsen208ae172015-09-16 16:33:27 -0700381// ========================================================
382// libc_netbsd.a - upstream NetBSD C library code
383// ========================================================
384//
385// These files are built with the netbsd-compat.h header file
386// automatically included.
387
388cc_library_static {
389
Colin Cross50c21ab2015-10-31 23:03:05 -0700390 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700391 srcs: [
392 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700393 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700394 "upstream-netbsd/lib/libc/gen/psignal.c",
395 "upstream-netbsd/lib/libc/gen/utime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700396 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
397 "upstream-netbsd/lib/libc/regex/regcomp.c",
398 "upstream-netbsd/lib/libc/regex/regerror.c",
399 "upstream-netbsd/lib/libc/regex/regexec.c",
400 "upstream-netbsd/lib/libc/regex/regfree.c",
401 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700402 "upstream-netbsd/lib/libc/stdlib/drand48.c",
403 "upstream-netbsd/lib/libc/stdlib/erand48.c",
404 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
405 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700406 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
407 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
408 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
409 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
410 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
411 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
412 "upstream-netbsd/lib/libc/stdlib/seed48.c",
413 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700414 ],
415 multilib: {
416 lib32: {
417 // LP32 cruft
418 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
419 },
420 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700421 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700422 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800423 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700424 "-DPOSIX_MISTAKE",
425 "-include netbsd-compat.h",
426 ],
427
Dan Willemsen208ae172015-09-16 16:33:27 -0700428 local_include_dirs: [
429 "upstream-netbsd/android/include",
430 "upstream-netbsd/lib/libc/include",
431 ],
432
433 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700434}
435
436// ========================================================
437// libc_openbsd_ndk.a - upstream OpenBSD C library code
438// that can be safely included in the libc_ndk.a (doesn't
439// contain any troublesome global data or constructors).
440// ========================================================
441//
442// These files are built with the openbsd-compat.h header file
443// automatically included.
444
445cc_library_static {
446 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700447 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700448 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700449 "upstream-openbsd/lib/libc/gen/alarm.c",
450 "upstream-openbsd/lib/libc/gen/ctype_.c",
451 "upstream-openbsd/lib/libc/gen/daemon.c",
452 "upstream-openbsd/lib/libc/gen/err.c",
453 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700454 "upstream-openbsd/lib/libc/gen/fnmatch.c",
455 "upstream-openbsd/lib/libc/gen/ftok.c",
456 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700457 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700458 "upstream-openbsd/lib/libc/gen/verr.c",
459 "upstream-openbsd/lib/libc/gen/verrx.c",
460 "upstream-openbsd/lib/libc/gen/vwarn.c",
461 "upstream-openbsd/lib/libc/gen/vwarnx.c",
462 "upstream-openbsd/lib/libc/gen/warn.c",
463 "upstream-openbsd/lib/libc/gen/warnx.c",
464 "upstream-openbsd/lib/libc/locale/btowc.c",
465 "upstream-openbsd/lib/libc/locale/mbrlen.c",
466 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
467 "upstream-openbsd/lib/libc/locale/mbtowc.c",
468 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700469 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
470 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700471 "upstream-openbsd/lib/libc/locale/wcstoll.c",
472 "upstream-openbsd/lib/libc/locale/wcstombs.c",
473 "upstream-openbsd/lib/libc/locale/wcstoul.c",
474 "upstream-openbsd/lib/libc/locale/wcstoull.c",
475 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
476 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
477 "upstream-openbsd/lib/libc/locale/wctob.c",
478 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700479 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700480 "upstream-openbsd/lib/libc/net/htonl.c",
481 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700482 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
483 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
484 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700485 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
486 "upstream-openbsd/lib/libc/net/inet_ntop.c",
487 "upstream-openbsd/lib/libc/net/inet_pton.c",
488 "upstream-openbsd/lib/libc/net/ntohl.c",
489 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800490 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700491 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700492 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
493 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700494 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700495 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700496 "upstream-openbsd/lib/libc/stdio/fputwc.c",
497 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700498 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700500 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700501 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700502 "upstream-openbsd/lib/libc/stdio/makebuf.c",
503 "upstream-openbsd/lib/libc/stdio/mktemp.c",
504 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
505 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700506 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700507 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700508 "upstream-openbsd/lib/libc/stdio/tempnam.c",
509 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
510 "upstream-openbsd/lib/libc/stdio/ungetc.c",
511 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
512 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
513 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700514 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
515 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
516 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700517 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700518 "upstream-openbsd/lib/libc/stdio/wsetup.c",
519 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800520 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700521 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700522 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700523 "upstream-openbsd/lib/libc/stdlib/insque.c",
524 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
525 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
526 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800527 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700528 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800529 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700530 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughes26b06072020-07-31 11:00:10 -0700531 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700532 "upstream-openbsd/lib/libc/stdlib/remque.c",
533 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700534 "upstream-openbsd/lib/libc/stdlib/tfind.c",
535 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800536 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700537 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800538 "upstream-openbsd/lib/libc/string/strcasestr.c",
539 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700540 "upstream-openbsd/lib/libc/string/strcspn.c",
541 "upstream-openbsd/lib/libc/string/strdup.c",
542 "upstream-openbsd/lib/libc/string/strndup.c",
543 "upstream-openbsd/lib/libc/string/strpbrk.c",
544 "upstream-openbsd/lib/libc/string/strsep.c",
545 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700546 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800547 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700548 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700549 "upstream-openbsd/lib/libc/string/wcswidth.c",
550 ],
551
Colin Cross50c21ab2015-10-31 23:03:05 -0700552 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700553 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700554 "-Wno-unused-parameter",
555 "-include openbsd-compat.h",
556 ],
557
Dan Willemsen208ae172015-09-16 16:33:27 -0700558 local_include_dirs: [
559 "private",
560 "stdio",
561 "upstream-openbsd/android/include",
562 "upstream-openbsd/lib/libc/include",
563 "upstream-openbsd/lib/libc/gdtoa/",
564 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700565}
566
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700567cc_library_static {
568 name: "libc_openbsd_large_stack",
569 defaults: ["libc_defaults"],
570 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700571 "stdio/vfprintf.cpp",
572 "stdio/vfwprintf.cpp",
Elliott Hughes5633caa2020-08-06 14:32:43 -0700573 "upstream-openbsd/lib/libc/string/memmem.c",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800574 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700575 ],
576 cflags: [
577 "-include openbsd-compat.h",
578 "-Wno-sign-compare",
579 "-Wframe-larger-than=5000",
580 ],
581
582 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700583 "upstream-openbsd/android/include/",
584 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700585 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700586 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700587 ],
588}
589
Dan Willemsen208ae172015-09-16 16:33:27 -0700590// ========================================================
591// libc_openbsd.a - upstream OpenBSD C library code
592// ========================================================
593//
594// These files are built with the openbsd-compat.h header file
595// automatically included.
596cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700597 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700598 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800599 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700600 "upstream-openbsd/lib/libc/crypt/arc4random.c",
601 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
602
603 // May be overriden by per-arch optimized versions
604 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700605 "upstream-openbsd/lib/libc/string/memrchr.c",
606 "upstream-openbsd/lib/libc/string/stpcpy.c",
607 "upstream-openbsd/lib/libc/string/stpncpy.c",
608 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700609 "upstream-openbsd/lib/libc/string/strcpy.c",
610 "upstream-openbsd/lib/libc/string/strlcat.c",
611 "upstream-openbsd/lib/libc/string/strlcpy.c",
612 "upstream-openbsd/lib/libc/string/strncat.c",
613 "upstream-openbsd/lib/libc/string/strncmp.c",
614 "upstream-openbsd/lib/libc/string/strncpy.c",
615 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700616
617 arch: {
618 arm: {
619 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700620 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800621 "upstream-openbsd/lib/libc/string/stpcpy.c",
622 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700623 ],
624 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700625 arm64: {
626 exclude_srcs: [
627 "upstream-openbsd/lib/libc/string/memchr.c",
Peter Collingbourne2361d4e2020-06-03 16:55:37 -0700628 "upstream-openbsd/lib/libc/string/memrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700629 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700630 "upstream-openbsd/lib/libc/string/strcpy.c",
631 "upstream-openbsd/lib/libc/string/strncmp.c",
632 ],
633 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700634 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800635 exclude_srcs: [
636 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800637 "upstream-openbsd/lib/libc/string/memrchr.c",
638 "upstream-openbsd/lib/libc/string/stpcpy.c",
639 "upstream-openbsd/lib/libc/string/stpncpy.c",
640 "upstream-openbsd/lib/libc/string/strcat.c",
641 "upstream-openbsd/lib/libc/string/strcpy.c",
642 "upstream-openbsd/lib/libc/string/strncmp.c",
643 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700644 "upstream-openbsd/lib/libc/string/strlcat.c",
645 "upstream-openbsd/lib/libc/string/strlcpy.c",
646 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800647 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700648 },
649
650 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800651 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800652 "upstream-openbsd/lib/libc/string/stpcpy.c",
653 "upstream-openbsd/lib/libc/string/stpncpy.c",
654 "upstream-openbsd/lib/libc/string/strcat.c",
655 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800656 "upstream-openbsd/lib/libc/string/strncat.c",
657 "upstream-openbsd/lib/libc/string/strncmp.c",
658 "upstream-openbsd/lib/libc/string/strncpy.c",
659 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700660 },
661 },
662
Colin Cross50c21ab2015-10-31 23:03:05 -0700663 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700664 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700665 "-Wno-unused-parameter",
666 "-include openbsd-compat.h",
667 ],
668
Dan Willemsen208ae172015-09-16 16:33:27 -0700669 local_include_dirs: [
670 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700671 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700672 ],
673
674 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700675}
676
677// ========================================================
678// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
679// ========================================================
680//
681// These files are built with the openbsd-compat.h header file
682// automatically included.
683
684cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700685 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700686 srcs: [
687 "upstream-openbsd/android/gdtoa_support.cpp",
688 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
689 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
690 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
691 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
692 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
693 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
694 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
695 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
696 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
697 "upstream-openbsd/lib/libc/gdtoa/misc.c",
698 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
699 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
700 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
701 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
702 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
703 "upstream-openbsd/lib/libc/gdtoa/sum.c",
704 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
705 ],
706 multilib: {
707 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800708 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700709 },
710 },
711
Colin Cross50c21ab2015-10-31 23:03:05 -0700712 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700713 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700714 "-include openbsd-compat.h",
715 ],
716
Dan Willemsen208ae172015-09-16 16:33:27 -0700717 local_include_dirs: [
718 "private",
719 "upstream-openbsd/android/include",
720 "upstream-openbsd/lib/libc/include",
721 ],
722
723 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700724}
725
726// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700727// libc_fortify.a - container for our FORITFY
728// implementation details
729// ========================================================
730cc_library_static {
731 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700732 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700733
734 name: "libc_fortify",
735
736 // Disable FORTIFY for the compilation of these, so we don't end up having
737 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800738 cflags: [
739 "-U_FORTIFY_SOURCE",
740 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
741 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700742
743 arch: {
744 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800745 cflags: [
746 "-DNO___MEMCPY_CHK",
747 "-DRENAME___STRCAT_CHK",
748 "-DRENAME___STRCPY_CHK",
749 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700750 srcs: [
751 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800752
753 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
754 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
755
756 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
757 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
758
759 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
760 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
761
762 "arch-arm/krait/bionic/__strcat_chk.S",
763 "arch-arm/krait/bionic/__strcpy_chk.S",
764
765 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
766 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
767
Haibo Huang01bfd892018-12-03 15:05:16 -0800768 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
769 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700770 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700771 },
772 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700773 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700774 srcs: [
775 "arch-arm64/generic/bionic/__memcpy_chk.S",
776 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700777 },
778 },
779}
780
781// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700782// libc_bionic.a - home-grown C library code
783// ========================================================
784
785cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700786 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700787 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800788 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700789 "bionic/sysconf.cpp",
790 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700791 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700792
Josh Gao10ec9282017-04-03 15:13:29 -0700793 // The following must not be statically linked into libc_ndk.a, because
794 // debuggerd will look for the abort message in libc.so's copy.
795 "bionic/android_set_abort_message.cpp",
796
Dan Willemsen208ae172015-09-16 16:33:27 -0700797 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800798 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700799 "bionic/strnlen.c",
800 "bionic/strrchr.cpp",
801 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700802
803 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700804 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700805 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700806 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800807 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700808 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800809 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800810 "arch-arm/generic/bionic/stpcpy.c",
811 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800812 "arch-arm/generic/bionic/strcmp.S",
813 "arch-arm/generic/bionic/strcpy.S",
814 "arch-arm/generic/bionic/strlen.c",
815
Ryan Prichard45024fe2018-12-30 21:10:26 -0800816 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700817 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700818 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700819 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700820 "arch-arm/bionic/atomics_arm.c",
821 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800822 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700823 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700824 "arch-arm/bionic/setjmp.S",
825 "arch-arm/bionic/syscall.S",
826 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800827
828 "arch-arm/cortex-a15/bionic/memcpy.S",
829 "arch-arm/cortex-a15/bionic/memmove.S",
830 "arch-arm/cortex-a15/bionic/memset.S",
831 "arch-arm/cortex-a15/bionic/stpcpy.S",
832 "arch-arm/cortex-a15/bionic/strcat.S",
833 "arch-arm/cortex-a15/bionic/strcmp.S",
834 "arch-arm/cortex-a15/bionic/strcpy.S",
835 "arch-arm/cortex-a15/bionic/strlen.S",
836
837 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800838 "arch-arm/cortex-a7/bionic/memset.S",
839
840 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800841 "arch-arm/cortex-a9/bionic/memset.S",
842 "arch-arm/cortex-a9/bionic/stpcpy.S",
843 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800844 "arch-arm/cortex-a9/bionic/strcpy.S",
845 "arch-arm/cortex-a9/bionic/strlen.S",
846
847 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800848 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800849
850 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800851
Haibo Huang01bfd892018-12-03 15:05:16 -0800852 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800853
854 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700855 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700856 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700857 arm64: {
858 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700859 "arch-arm64/generic/bionic/memcpy.S",
860 "arch-arm64/generic/bionic/memmove.S",
861 "arch-arm64/generic/bionic/memset.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700862 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800863
864 "arch-arm64/bionic/__bionic_clone.S",
865 "arch-arm64/bionic/_exit_with_stack_teardown.S",
866 "arch-arm64/bionic/setjmp.S",
867 "arch-arm64/bionic/syscall.S",
868 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700869 ],
870 exclude_srcs: [
871 "bionic/__memcpy_chk.cpp",
872 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800873 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700874 "bionic/strnlen.c",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800875 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700876 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700877 },
878
Dan Willemsen208ae172015-09-16 16:33:27 -0700879 x86: {
880 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700881 "arch-x86/generic/string/memcmp.S",
882 "arch-x86/generic/string/strcmp.S",
883 "arch-x86/generic/string/strncmp.S",
884 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700885
886 "arch-x86/generic/string/strlcat.c",
887 "arch-x86/generic/string/strlcpy.c",
888 "arch-x86/generic/string/strncat.c",
889 "arch-x86/generic/string/wcscat.c",
890 "arch-x86/generic/string/wcscpy.c",
891 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530892 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700893
Dan Willemsen208ae172015-09-16 16:33:27 -0700894 "arch-x86/atom/string/sse2-memchr-atom.S",
895 "arch-x86/atom/string/sse2-memrchr-atom.S",
896 "arch-x86/atom/string/sse2-strchr-atom.S",
897 "arch-x86/atom/string/sse2-strnlen-atom.S",
898 "arch-x86/atom/string/sse2-strrchr-atom.S",
899 "arch-x86/atom/string/sse2-wcschr-atom.S",
900 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
901 "arch-x86/atom/string/sse2-wcslen-atom.S",
902 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700903 "arch-x86/silvermont/string/sse2-memmove-slm.S",
904 "arch-x86/silvermont/string/sse2-memset-slm.S",
905 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
906 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
907 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
908 "arch-x86/silvermont/string/sse2-strlen-slm.S",
909 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800910
911 "arch-x86/bionic/__bionic_clone.S",
912 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800913 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800914 "arch-x86/bionic/__restore.S",
915 "arch-x86/bionic/setjmp.S",
916 "arch-x86/bionic/syscall.S",
917 "arch-x86/bionic/vfork.S",
Ryan Pricharda992a062020-04-18 02:59:24 -0700918 "arch-x86/bionic/__x86.get_pc_thunk.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700919
920 // ssse3 functions
921 "arch-x86/atom/string/ssse3-strcat-atom.S",
922 "arch-x86/atom/string/ssse3-strcmp-atom.S",
923 "arch-x86/atom/string/ssse3-strlcat-atom.S",
924 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
925 "arch-x86/atom/string/ssse3-strncat-atom.S",
926 "arch-x86/atom/string/ssse3-strncmp-atom.S",
927 "arch-x86/atom/string/ssse3-wcscat-atom.S",
928 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
929
930 // sse4 functions
931 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
932 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
933
934 // atom functions
935 "arch-x86/atom/string/sse2-memset-atom.S",
936 "arch-x86/atom/string/sse2-strlen-atom.S",
937 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800938 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700939 "arch-x86/atom/string/ssse3-strcpy-atom.S",
940 "arch-x86/atom/string/ssse3-strncpy-atom.S",
941 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530942
943 // avx2 functions
944 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700945 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700946
947 exclude_srcs: [
948 "bionic/strchr.cpp",
949 "bionic/strnlen.c",
950 "bionic/strrchr.cpp",
951 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700952 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700953 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700954 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700955 "arch-x86_64/string/sse2-memmove-slm.S",
956 "arch-x86_64/string/sse2-memset-slm.S",
957 "arch-x86_64/string/sse2-stpcpy-slm.S",
958 "arch-x86_64/string/sse2-stpncpy-slm.S",
959 "arch-x86_64/string/sse2-strcat-slm.S",
960 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700961 "arch-x86_64/string/sse2-strlen-slm.S",
962 "arch-x86_64/string/sse2-strncat-slm.S",
963 "arch-x86_64/string/sse2-strncpy-slm.S",
964 "arch-x86_64/string/sse4-memcmp-slm.S",
965 "arch-x86_64/string/ssse3-strcmp-slm.S",
966 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530967 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800968
969 "arch-x86_64/bionic/__bionic_clone.S",
970 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
971 "arch-x86_64/bionic/__restore_rt.S",
972 "arch-x86_64/bionic/setjmp.S",
973 "arch-x86_64/bionic/syscall.S",
974 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700975 ],
976 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700977 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700978
Colin Cross50c21ab2015-10-31 23:03:05 -0700979 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700980 include_dirs: ["bionic/libstdc++/include"],
981 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700982}
983
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000984genrule {
985 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -0800986 out: ["generated_android_ids.h"],
987 srcs: [":android_filesystem_config_header"],
988 tool_files: ["fs_config_generator.py"],
989 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000990}
991
Dan Willemsen268a6732015-10-15 14:49:45 -0700992// ========================================================
993// libc_bionic_ndk.a- The portions of libc_bionic that can
994// be safely used in libc_ndk.a (no troublesome global data
995// or constructors).
996// ========================================================
997cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700998 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700999 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001000 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001001 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001002 "bionic/__cmsg_nxthdr.cpp",
1003 "bionic/__errno.cpp",
1004 "bionic/__gnu_basename.cpp",
1005 "bionic/__libc_current_sigrtmax.cpp",
1006 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001007 "bionic/abort.cpp",
1008 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001009 "bionic/access.cpp",
1010 "bionic/arpa_inet.cpp",
1011 "bionic/assert.cpp",
1012 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001013 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001014 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001015 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001016 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001017 "bionic/bionic_time_conversions.cpp",
1018 "bionic/brk.cpp",
1019 "bionic/c16rtomb.cpp",
1020 "bionic/c32rtomb.cpp",
1021 "bionic/chmod.cpp",
1022 "bionic/chown.cpp",
1023 "bionic/clearenv.cpp",
1024 "bionic/clock.cpp",
1025 "bionic/clock_getcpuclockid.cpp",
1026 "bionic/clock_nanosleep.cpp",
1027 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001028 "bionic/ctype.cpp",
1029 "bionic/dirent.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001030 "bionic/dup.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001031 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001032 "bionic/error.cpp",
Josh Gao7de41242020-04-29 17:08:46 -07001033 "bionic/eventfd.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001034 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001035 "bionic/faccessat.cpp",
1036 "bionic/fchmod.cpp",
1037 "bionic/fchmodat.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001038 "bionic/fcntl.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001039 "bionic/fdsan.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001040 "bionic/fdtrack.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001041 "bionic/ffs.cpp",
1042 "bionic/fgetxattr.cpp",
1043 "bionic/flistxattr.cpp",
1044 "bionic/flockfile.cpp",
1045 "bionic/fpclassify.cpp",
1046 "bionic/fsetxattr.cpp",
1047 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001048 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001049 "bionic/futimens.cpp",
1050 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001051 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001052 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001053 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001054 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001055 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001056 "bionic/getpgrp.cpp",
1057 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001058 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001059 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001060 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001061 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001062 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001063 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001064 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001065 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001066 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001067 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001068 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001069 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001070 "bionic/lchown.cpp",
1071 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001072 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001073 "bionic/libgen.cpp",
1074 "bionic/link.cpp",
1075 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001076 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001077 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001078 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001079 "bionic/mbrtoc16.cpp",
1080 "bionic/mbrtoc32.cpp",
Peter Collingbourne5d3aa862020-09-11 15:05:17 -07001081 "bionic/memory_mitigation_state.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001082 "bionic/mempcpy.cpp",
1083 "bionic/mkdir.cpp",
1084 "bionic/mkfifo.cpp",
1085 "bionic/mknod.cpp",
1086 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001087 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001088 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001089 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001090 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001091 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001092 "bionic/open.cpp",
1093 "bionic/pathconf.cpp",
1094 "bionic/pause.cpp",
1095 "bionic/pipe.cpp",
1096 "bionic/poll.cpp",
1097 "bionic/posix_fadvise.cpp",
1098 "bionic/posix_fallocate.cpp",
1099 "bionic/posix_madvise.cpp",
1100 "bionic/posix_timers.cpp",
1101 "bionic/ptrace.cpp",
1102 "bionic/pty.cpp",
1103 "bionic/raise.cpp",
1104 "bionic/rand.cpp",
1105 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001106 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001107 "bionic/reboot.cpp",
1108 "bionic/recv.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001109 "bionic/recvmsg.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001110 "bionic/rename.cpp",
1111 "bionic/rmdir.cpp",
1112 "bionic/scandir.cpp",
1113 "bionic/sched_getaffinity.cpp",
1114 "bionic/sched_getcpu.cpp",
1115 "bionic/semaphore.cpp",
1116 "bionic/send.cpp",
1117 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001118 "bionic/seteuid.cpp",
1119 "bionic/setpgrp.cpp",
1120 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001121 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001122 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001123 "bionic/sleep.cpp",
Josh Gaob107eab2020-04-29 17:17:56 -07001124 "bionic/socketpair.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001125 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001126 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001127 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001128 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001129 "bionic/string_l.cpp",
1130 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001131 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001132 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001133 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001134 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001135 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001136 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001137 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001138 "bionic/sys_msg.cpp",
1139 "bionic/sys_sem.cpp",
1140 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001141 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001142 "bionic/sys_statfs.cpp",
1143 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001144 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001145 "bionic/sysinfo.cpp",
1146 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001147 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001148 "bionic/system_property_api.cpp",
1149 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001150 "bionic/tdestroy.cpp",
1151 "bionic/termios.cpp",
1152 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001153 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001154 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001155 "bionic/tmpfile.cpp",
1156 "bionic/umount.cpp",
1157 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001158 "bionic/usleep.cpp",
Elliott Hughes9a1d3972020-08-07 15:55:02 -07001159 "bionic/utmp.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001160 "bionic/wait.cpp",
1161 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001162 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001163 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001164 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001165 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001166 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001167
1168 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1169 // which will be overridden by the actual one in libc.so.
1170 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001171 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001172
Dan Willemsen208ae172015-09-16 16:33:27 -07001173 multilib: {
1174 lib32: {
1175 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001176 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001177 },
1178 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001179 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001180 treble_linker_namespaces: {
1181 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001182 },
1183 },
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001184 whole_static_libs: [
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001185 "libsystemproperties",
1186 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001187 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001188 local_include_dirs: ["stdio"],
1189 include_dirs: ["bionic/libstdc++/include"],
1190 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001191 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001192}
1193
Dan Willemsen208ae172015-09-16 16:33:27 -07001194// ========================================================
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001195// libc_bionic_systrace.a
1196// ========================================================
1197
1198cc_library_static {
1199 name: "libc_bionic_systrace",
1200 defaults: ["libc_defaults"],
1201 srcs: [
1202 "bionic/bionic_systrace.cpp",
1203 ],
1204 apex_available: [
1205 "com.android.runtime",
1206 ],
1207}
1208
1209// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001210// libc_pthread.a - pthreads parts that previously lived in
1211// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001212// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001213// pthread_t has changed over the years and has ABI
1214// compatibility issues).
1215// ========================================================
1216
1217cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001218 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001219 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001220 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001221 "bionic/pthread_atfork.cpp",
1222 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001223 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001224 "bionic/pthread_cond.cpp",
1225 "bionic/pthread_create.cpp",
1226 "bionic/pthread_detach.cpp",
1227 "bionic/pthread_equal.cpp",
1228 "bionic/pthread_exit.cpp",
1229 "bionic/pthread_getcpuclockid.cpp",
1230 "bionic/pthread_getschedparam.cpp",
1231 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001232 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001233 "bionic/pthread_join.cpp",
1234 "bionic/pthread_key.cpp",
1235 "bionic/pthread_kill.cpp",
1236 "bionic/pthread_mutex.cpp",
1237 "bionic/pthread_once.cpp",
1238 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001239 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001240 "bionic/pthread_self.cpp",
1241 "bionic/pthread_setname_np.cpp",
1242 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001243 "bionic/pthread_spinlock.cpp",
Vy Nguyend5007512020-07-14 17:37:04 -04001244 "bionic/sys_thread_properties.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001245
1246 // The following implementations depend on pthread data or implementation,
1247 // so we can't include them in libc_ndk.a.
1248 "bionic/__cxa_thread_atexit_impl.cpp",
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001249 "bionic/android_unsafe_frame_pointer_chase.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -08001250 "bionic/atexit.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001251 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001252 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001253
Colin Cross50c21ab2015-10-31 23:03:05 -07001254 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001255 include_dirs: ["bionic/libstdc++/include"],
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001256 header_libs: ["bionic_libc_platform_headers"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001257 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001258}
1259
1260// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001261// libc_syscalls.a
1262// ========================================================
1263
Elliott Hughes782c4852019-04-16 12:31:00 -07001264genrule {
1265 name: "syscalls-arm.S",
1266 out: ["syscalls-arm.S"],
1267 srcs: ["SYSCALLS.TXT"],
1268 tool_files: [":bionic-gensyscalls"],
1269 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1270}
1271
1272genrule {
1273 name: "syscalls-arm64.S",
1274 out: ["syscalls-arm64.S"],
1275 srcs: ["SYSCALLS.TXT"],
1276 tool_files: [":bionic-gensyscalls"],
1277 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1278}
1279
1280genrule {
1281 name: "syscalls-x86.S",
1282 out: ["syscalls-x86.S"],
1283 srcs: ["SYSCALLS.TXT"],
1284 tool_files: [":bionic-gensyscalls"],
1285 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1286}
1287
1288genrule {
1289 name: "syscalls-x86_64.S",
1290 out: ["syscalls-x86_64.S"],
1291 srcs: ["SYSCALLS.TXT"],
1292 tool_files: [":bionic-gensyscalls"],
1293 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1294}
1295
Dan Willemsen208ae172015-09-16 16:33:27 -07001296cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001297 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001298 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001299 arch: {
1300 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001301 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001302 },
1303 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001304 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001305 },
1306 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001307 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001308 },
1309 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001310 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001311 },
1312 },
1313 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001314}
1315
1316// ========================================================
1317// libc_aeabi.a
1318// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1319// to avoid infinite recursion. For the other architectures we just build an
1320// empty library to keep this makefile simple.
1321// ========================================================
1322
1323cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001324 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001325 arch: {
1326 arm: {
1327 srcs: ["arch-arm/bionic/__aeabi.c"],
1328 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001329 },
1330 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001331 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001332}
1333
1334// ========================================================
1335// libc_ndk.a
1336// Compatibility library for the NDK. This library contains
1337// all the parts of libc that are safe to statically link.
1338// We can't safely statically link things that can only run
1339// on a certain version of the OS. Examples include
1340// anything that talks to netd (a large portion of the DNS
1341// code) and anything that is dependent on the layout of a
1342// data structure that has changed across releases (such as
1343// pthread_t).
1344// ========================================================
1345
1346cc_library_static {
1347 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001348 defaults: [
1349 "libc_defaults",
1350 "libc_native_allocator_defaults",
1351 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -08001352 ramdisk_available: false,
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001353 srcs: libc_common_src_files + [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001354 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001355 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001356 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001357 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001358 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001359 multilib: {
1360 lib32: {
1361 srcs: libc_common_src_files_32,
1362 },
1363 },
1364 arch: {
1365 arm: {
1366 srcs: [
1367 "arch-arm/bionic/exidx_dynamic.c",
1368 "arch-common/bionic/crtbegin_so.c",
1369 "arch-arm/bionic/atexit_legacy.c",
1370 "arch-common/bionic/crtend_so.S",
1371 ],
1372 whole_static_libs: ["libc_aeabi"],
1373 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001374 },
1375
Colin Cross50c21ab2015-10-31 23:03:05 -07001376 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001377 "-fvisibility=hidden",
1378 "-DLIBC_STATIC",
1379 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001380
1381 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001382 "gwp_asan",
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001383 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001384 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001385 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001386 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001387 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001388 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001389 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001390 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001391 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001392 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001393 "libc_syscalls",
1394 "libc_tzcode",
1395 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001396 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001397 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001398}
1399
1400// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001401// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001402// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001403cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001404 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001405 srcs: libc_common_src_files,
1406 multilib: {
1407 lib32: {
1408 srcs: libc_common_src_files_32,
1409 },
1410 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001411 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001412
1413 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001414 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001415 "libc_bionic",
1416 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001417 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001418 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001419 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001420 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001421 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001422 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001423 "libc_netbsd",
1424 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001425 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001426 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001427 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001428 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001429 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001430 ],
1431
1432 arch: {
1433 arm: {
1434 whole_static_libs: ["libc_aeabi"],
1435 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001436 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001437}
1438
1439// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001440// libc_common.a
1441// ========================================================
1442
1443cc_library_static {
1444 defaults: ["libc_defaults"],
1445 name: "libc_common",
1446
1447 whole_static_libs: [
1448 "libc_nopthread",
1449 "libc_pthread",
1450 ],
1451}
1452
1453// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001454// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001455// ========================================================
1456cc_library_static {
1457 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001458 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001459
Haibo Huangb9244ff2018-08-11 10:12:13 -07001460 arch: {
1461 x86: {
1462 srcs: ["arch-x86/static_function_dispatch.S"],
1463 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001464 arm: {
1465 srcs: ["arch-arm/static_function_dispatch.S"],
1466 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001467 arm64: {
1468 srcs: ["arch-arm64/static_function_dispatch.S"],
1469 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001470 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001471}
1472
1473// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001474// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001475// ========================================================
1476cc_library_static {
1477 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001478 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001479
Haibo Huangb9244ff2018-08-11 10:12:13 -07001480 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001481 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001482 "-fno-stack-protector",
1483 "-fno-jump-tables",
1484 ],
1485 arch: {
1486 x86: {
1487 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1488 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001489 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001490 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001491 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001492 arm64: {
1493 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1494 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001495 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001496}
1497
1498// ========================================================
1499// libc_common_static.a For static binaries.
1500// ========================================================
1501cc_library_static {
1502 defaults: ["libc_defaults"],
1503 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001504
Haibo Huangf71edfa2018-11-12 10:06:56 -08001505 whole_static_libs: [
1506 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001507 "libc_static_dispatch",
1508 ],
1509}
1510
1511// ========================================================
1512// libc_common_shared.a For shared libraries.
1513// ========================================================
1514cc_library_static {
1515 defaults: ["libc_defaults"],
1516 name: "libc_common_shared",
1517
1518 whole_static_libs: [
1519 "libc_common",
1520 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001521 ],
1522}
1523
Ryan Prichard22a6a052019-10-10 23:59:30 -07001524// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1525// executable.
1526cc_library_static {
1527 name: "libc_unwind_static",
1528 defaults: ["libc_defaults"],
1529 cflags: ["-DLIBC_STATIC"],
1530
1531 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1532 arch: {
1533 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1534 arm: {
1535 srcs: ["arch-arm/bionic/exidx_static.c"],
1536 },
1537 },
1538}
1539
Haibo Huangf71edfa2018-11-12 10:06:56 -08001540// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001541// libc_nomalloc.a
1542// ========================================================
1543//
Ryan Prichard249757b2019-11-01 17:18:28 -07001544// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1545// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1546// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001547
1548cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001549 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001550 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001551
Colin Crossa3f9fca2016-01-11 13:20:55 -08001552 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001553 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001554 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001555 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001556 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001557}
1558
dimitryc0c0ef62018-12-05 16:33:52 +01001559filegroup {
1560 name: "libc_sources_shared",
1561 srcs: [
1562 "arch-common/bionic/crtbegin_so.c",
1563 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001564 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001565 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001566 "bionic/icu.cpp",
1567 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001568 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001569 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001570 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001571 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001572 "bionic/ndk_cruft.cpp",
1573 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001574 "bionic/NetdClient.cpp",
1575 "arch-common/bionic/crtend_so.S",
1576 ],
1577}
1578
1579filegroup {
1580 name: "libc_sources_static",
1581 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001582 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001583 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001584 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001585 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001586 ],
1587}
1588
1589filegroup {
1590 name: "libc_sources_shared_arm",
1591 srcs: [
1592 "arch-arm/bionic/exidx_dynamic.c",
1593 "arch-arm/bionic/atexit_legacy.c",
1594 ],
1595}
1596
Dan Willemsen208ae172015-09-16 16:33:27 -07001597// ========================================================
1598// libc.a + libc.so
1599// ========================================================
1600cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001601 defaults: [
1602 "libc_defaults",
1603 "libc_native_allocator_defaults",
1604 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001605 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001606 static_ndk_lib: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001607 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001608 platform_sdk_version: {
1609 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1610 },
1611 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001612 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001613 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001614 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001615 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001616 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001617 "libc_init_static",
1618 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001619 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001620 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001621 },
1622 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001623 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001624 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001625 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001626 "libc_init_dynamic",
1627 "libc_common_shared",
1628 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001629 },
1630
Neil Fullera7db90f2019-04-25 09:28:27 +01001631 required: [
1632 "tzdata",
1633 "tz_version", // Version metadata for tzdata to help debugging.
1634 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001635
Colin Cross4ce94d22016-11-15 13:15:43 -08001636 // Do not pack libc.so relocations; see http://b/20645321 for details.
1637 pack_relocations: false,
1638
dimitry06016f22018-01-05 11:39:28 +01001639 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1640 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1641 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1642 // those new libraries from libgcc.a are not declared external; if that were the case,
1643 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1644 // on the external symbols from the dependent libraries. That would create a "cloaked"
1645 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001646
dimitry06016f22018-01-05 11:39:28 +01001647 shared_libs: [
1648 "ld-android",
1649 "libdl",
1650 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001651 static_libs: [
1652 "libdl_android",
1653 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001654
1655 nocrt: true,
1656
Dan Willemsen208ae172015-09-16 16:33:27 -07001657 arch: {
1658 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001659 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001660 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001661 ldflags: ["-Wl,--hash-style=both"],
1662
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001663 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001664
Dan Willemsen208ae172015-09-16 16:33:27 -07001665 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001666 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001667 // special for arm
1668 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichard379e05f2020-04-01 20:10:07 -07001669
1670 whole_static_libs: [ "libunwind_llvm" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001671 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001672
1673 // Arm 32 bit does not produce complete exidx unwind information
1674 // so keep the .debug_frame which is relatively small and does
1675 // include needed unwind information.
1676 // See b/132992102 for details.
1677 strip: {
1678 keep_symbols_and_debug_frame: true,
1679 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001680 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001681 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001682 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001683
1684 // Leave the symbols in the shared library so that stack unwinders can produce
1685 // meaningful name resolution.
1686 strip: {
1687 keep_symbols: true,
1688 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001689
Ryan Prichard379e05f2020-04-01 20:10:07 -07001690 shared: {
1691 whole_static_libs: [ "libgcc_stripped" ],
1692 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001693 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001694 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001695 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001696 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001697 ldflags: ["-Wl,--hash-style=both"],
1698
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001699 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001700
1701 // Leave the symbols in the shared library so that stack unwinders can produce
1702 // meaningful name resolution.
1703 strip: {
1704 keep_symbols: true,
1705 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001706
Ryan Prichard379e05f2020-04-01 20:10:07 -07001707 shared: {
1708 whole_static_libs: [ "libgcc_stripped" ],
1709 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001710 },
1711 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001712 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001713
1714 // Leave the symbols in the shared library so that stack unwinders can produce
1715 // meaningful name resolution.
1716 strip: {
1717 keep_symbols: true,
1718 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001719
Ryan Prichard379e05f2020-04-01 20:10:07 -07001720 shared: {
1721 whole_static_libs: [ "libgcc_stripped" ],
1722 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001723 },
1724 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001725
1726 stubs: {
1727 symbol_file: "libc.map.txt",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001728 versions: [
1729 "29",
Jooyung Handbfa0742020-03-30 13:18:44 +09001730 "R",
Dan Albert48943b22020-07-27 13:28:56 -07001731 "current",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001732 ],
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001733 },
Vic Yang6903fb82019-01-14 11:34:39 -08001734
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001735 apex_available: [
1736 "//apex_available:platform",
1737 "com.android.runtime",
1738 ],
1739
Vic Yang03ff4362019-06-24 16:11:37 -07001740 // Sorting bss symbols by size usually results in less dirty pages at run
1741 // time, because small symbols are grouped together.
1742 sort_bss_symbols_by_size: true,
Yi Kong15a05a72020-09-22 00:56:13 +08001743
1744 lto: {
1745 never: true,
1746 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001747}
1748
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001749genrule {
1750 name: "libc.arm.map",
1751 out: ["libc.arm.map"],
1752 srcs: ["libc.map.txt"],
1753 tool_files: [":bionic-generate-version-script"],
1754 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1755}
1756
1757genrule {
1758 name: "libc.arm64.map",
1759 out: ["libc.arm64.map"],
1760 srcs: ["libc.map.txt"],
1761 tool_files: [":bionic-generate-version-script"],
1762 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1763}
1764
1765genrule {
1766 name: "libc.x86.map",
1767 out: ["libc.x86.map"],
1768 srcs: ["libc.map.txt"],
1769 tool_files: [":bionic-generate-version-script"],
1770 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1771}
1772
1773genrule {
1774 name: "libc.x86_64.map",
1775 out: ["libc.x86_64.map"],
1776 srcs: ["libc.map.txt"],
1777 tool_files: [":bionic-generate-version-script"],
1778 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1779}
1780
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001781// Headers that only other parts of the platform can include.
1782cc_library_headers {
1783 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001784 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001785 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001786 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001787 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001788 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001789 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001790 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001791 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001792 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001793 "//system/core/debuggerd:__subpackages__",
Peter Collingbourne6e316e62020-04-07 14:09:52 -07001794 "//system/core/libunwindstack:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001795 "//system/memory/libmemunreachable:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001796 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001797 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001798 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001799 ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001800 recovery_available: true,
1801 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001802 export_include_dirs: [
1803 "platform",
1804 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001805 system_shared_libs: [],
1806 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001807 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001808
1809 apex_available: [
1810 "//apex_available:platform",
1811 "com.android.runtime",
1812 "com.android.art.release", // from libdexfile_external
1813 "com.android.art.debug", // from libdexfile_external
1814 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001815}
1816
Logan Chien17af91b2019-01-15 21:19:56 +08001817cc_library_headers {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001818 // Internal lib for use in libc_headers. Since we cannot intersect arch{}
1819 // and target{} in the same module, this one specifies the arch-dependent
1820 // include paths, and then libc_headers filters by target so that the
1821 // headers only are included for Bionic targets.
1822 name: "libc_headers_arch",
1823 visibility: ["//visibility:private"],
Logan Chien17af91b2019-01-15 21:19:56 +08001824
1825 host_supported: true,
1826 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001827 ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001828 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001829 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001830 apex_available: [
1831 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001832 "//apex_available:anyapex",
1833 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001834 // used by most APEXes indirectly via libunwind_llvm
1835 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001836
1837 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001838 stl: "none",
1839 system_shared_libs: [],
1840
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001841 // The build system generally requires that any dependencies of a target
1842 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1843 // to 1 we let targets with an sdk_version that need to depend on the libc
1844 // headers but cannot depend on libc itself due to circular dependencies
1845 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1846 // is correct because the headers can support any sdk_version.
1847 sdk_version: "1",
1848
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001849 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001850 "include",
1851 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001852 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001853 "kernel/android/uapi",
1854 ],
1855
1856 arch: {
1857 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001858 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001859 },
1860 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001861 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001862 },
Logan Chien17af91b2019-01-15 21:19:56 +08001863 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001864 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001865 },
1866 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001867 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001868 },
1869 },
1870}
1871
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001872cc_library_headers {
1873 name: "libc_headers",
1874 host_supported: true,
1875 native_bridge_supported: true,
1876 vendor_available: true,
1877 ramdisk_available: true,
1878 recovery_available: true,
1879 sdk_version: "1",
1880
1881 apex_available: [
1882 "//apex_available:platform",
1883 "//apex_available:anyapex",
1884 ],
1885 // used by most APEXes indirectly via libunwind_llvm
1886 min_sdk_version: "apex_inherit",
1887 visibility: [
1888 "//bionic:__subpackages__", // visible to bionic
1889 // ... and only to these places (b/152668052)
1890 "//external/arm-optimized-routines",
1891 "//external/gwp_asan",
1892 "//external/jemalloc_new",
1893 "//external/libunwind_llvm",
1894 "//external/scudo",
1895 "//system/core/property_service/libpropertyinfoparser",
1896 "//system/extras/toolchain-extras",
1897 // TODO(b/153662223): Clean up these users that needed visibility when
1898 // the implicit addition of system Bionic paths was removed.
1899 "//art/tools/cpp-define-generator",
1900 "//external/boringssl",
1901 "//external/minijail",
1902 ],
1903
1904 stl: "none",
1905 no_libcrt: true,
1906 system_shared_libs: [],
1907
1908 target: {
1909 android: {
1910 header_libs: ["libc_headers_arch"],
1911 export_header_lib_headers: ["libc_headers_arch"],
1912 },
1913 linux_bionic: {
1914 header_libs: ["libc_headers_arch"],
1915 export_header_lib_headers: ["libc_headers_arch"],
1916 },
1917 }
1918}
1919
Dan Willemsen208ae172015-09-16 16:33:27 -07001920// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001921// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001922// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001923
Dan Willemsen208ae172015-09-16 16:33:27 -07001924cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001925 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001926 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001927 srcs: [
1928 "bionic/__cxa_guard.cpp",
1929 "bionic/__cxa_pure_virtual.cpp",
1930 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001931 ],
1932 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001933 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001934 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001935
Dan Willemsen6b3be172018-12-03 13:57:20 -08001936 static: {
1937 system_shared_libs: [],
1938 },
1939 shared: {
1940 system_shared_libs: ["libc"],
1941 },
1942
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001943 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001944 arch: {
1945 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001946 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001947 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001948 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001949 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001950 },
1951 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001952 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001953 },
1954 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001955 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001956 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001957 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001958 },
1959 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001960 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001961 },
1962 },
1963}
1964
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001965genrule {
1966 name: "libstdc++.arm.map",
1967 out: ["libstdc++.arm.map"],
1968 srcs: ["libstdc++.map.txt"],
1969 tool_files: [":bionic-generate-version-script"],
1970 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1971}
1972
1973genrule {
1974 name: "libstdc++.arm64.map",
1975 out: ["libstdc++.arm64.map"],
1976 srcs: ["libstdc++.map.txt"],
1977 tool_files: [":bionic-generate-version-script"],
1978 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1979}
1980
1981genrule {
1982 name: "libstdc++.x86.map",
1983 out: ["libstdc++.x86.map"],
1984 srcs: ["libstdc++.map.txt"],
1985 tool_files: [":bionic-generate-version-script"],
1986 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1987}
1988
1989genrule {
1990 name: "libstdc++.x86_64.map",
1991 out: ["libstdc++.x86_64.map"],
1992 srcs: ["libstdc++.map.txt"],
1993 tool_files: [":bionic-generate-version-script"],
1994 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1995}
1996
1997// ========================================================
1998// crt object files.
1999// ========================================================
2000
Colin Cross50c21ab2015-10-31 23:03:05 -07002001cc_defaults {
2002 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002003 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002004 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002005 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002006 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002007 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002008 apex_available: [
2009 "//apex_available:platform",
2010 "//apex_available:anyapex",
2011 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002012 // Generate NDK variants of the CRT objects for every supported API level.
2013 min_sdk_version: "16",
2014 stl: "none",
2015 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002016 cflags: [
2017 "-Wno-gcc-compat",
2018 "-Wall",
2019 "-Werror",
2020 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002021 sanitize: {
2022 never: true,
2023 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002024}
2025
Colin Cross50c21ab2015-10-31 23:03:05 -07002026cc_defaults {
2027 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002028 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002029
2030 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002031 x86: {
2032 cflags: ["-fPIC"],
2033 },
2034 x86_64: {
2035 cflags: ["-fPIC"],
2036 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002037 },
Colin Crossab179442018-09-27 11:03:22 -07002038 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002039}
2040
Dan Willemsen208ae172015-09-16 16:33:27 -07002041cc_object {
2042 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002043 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002044 local_include_dirs: ["include"],
2045 product_variables: {
2046 platform_sdk_version: {
2047 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2048 },
2049 },
2050 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002051
Colin Cross7d7b3682017-11-03 13:38:40 -07002052 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002053}
2054
Dan Willemsen208ae172015-09-16 16:33:27 -07002055cc_object {
2056 name: "crtbegin_so1",
2057 local_include_dirs: ["include"],
2058 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002059
Colin Cross7d7b3682017-11-03 13:38:40 -07002060 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002061}
2062
Dan Willemsen208ae172015-09-16 16:33:27 -07002063cc_object {
2064 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002065
Colin Cross7d7b3682017-11-03 13:38:40 -07002066 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002067 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002068 "crtbegin_so1",
2069 "crtbrand",
2070 ],
2071}
2072
Dan Willemsen208ae172015-09-16 16:33:27 -07002073cc_object {
2074 name: "crtend_so",
2075 local_include_dirs: ["include"],
2076 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002077
Colin Cross7d7b3682017-11-03 13:38:40 -07002078 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002079}
2080
Dan Willemsen208ae172015-09-16 16:33:27 -07002081cc_object {
2082 name: "crtbegin_static1",
2083 local_include_dirs: ["include"],
2084 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002085 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002086}
2087
Dan Willemsen208ae172015-09-16 16:33:27 -07002088cc_object {
2089 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002090
Colin Cross77d57bf2016-04-11 14:34:18 -07002091 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002092 "crtbegin_static1",
2093 "crtbrand",
2094 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002095 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002096}
2097
Dan Willemsen208ae172015-09-16 16:33:27 -07002098cc_object {
2099 name: "crtbegin_dynamic1",
2100 local_include_dirs: ["include"],
2101 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002102 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002103}
2104
Dan Willemsen208ae172015-09-16 16:33:27 -07002105cc_object {
2106 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002107
Colin Cross77d57bf2016-04-11 14:34:18 -07002108 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002109 "crtbegin_dynamic1",
2110 "crtbrand",
2111 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002112 target: {
2113 linux_bionic: {
2114 generated_sources: ["host_bionic_linker_asm"],
2115 objs: [
2116 "linker_wrapper",
2117 ],
2118 },
2119 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002120 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002121}
2122
Dan Willemsen208ae172015-09-16 16:33:27 -07002123cc_object {
2124 // We rename crtend.o to crtend_android.o to avoid a
2125 // name clash between gcc and bionic.
2126 name: "crtend_android",
2127 local_include_dirs: ["include"],
2128 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002129
Colin Cross50c21ab2015-10-31 23:03:05 -07002130 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002131}
Colin Crossbaa48992016-07-13 11:15:21 -07002132
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002133// ========================================================
2134// NDK headers.
2135// ========================================================
2136
Dan Albert26e1c412018-05-24 14:56:46 -07002137versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002138 name: "common_libc",
2139 from: "include",
2140 to: "",
2141 license: "NOTICE",
2142}
Dan Albert4238a352016-06-28 11:18:05 -07002143
2144ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002145 name: "libc_uapi",
2146 from: "kernel/uapi",
2147 to: "",
2148 srcs: [
2149 "kernel/uapi/asm-generic/**/*.h",
2150 "kernel/uapi/drm/**/*.h",
2151 "kernel/uapi/linux/**/*.h",
2152 "kernel/uapi/misc/**/*.h",
2153 "kernel/uapi/mtd/**/*.h",
2154 "kernel/uapi/rdma/**/*.h",
2155 "kernel/uapi/scsi/**/*.h",
2156 "kernel/uapi/sound/**/*.h",
2157 "kernel/uapi/video/**/*.h",
2158 "kernel/uapi/xen/**/*.h",
2159 ],
Dan Albert92592652016-10-20 01:42:54 -07002160 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002161}
2162
2163ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002164 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002165 from: "kernel/android/uapi/linux",
2166 to: "linux",
2167 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002168 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002169}
2170
2171ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002172 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002173 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002174 to: "scsi",
2175 srcs: ["kernel/android/scsi/**/*.h"],
2176 license: "NOTICE",
2177}
2178
2179ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002180 name: "libc_asm_arm",
2181 from: "kernel/uapi/asm-arm",
2182 to: "arm-linux-androideabi",
2183 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002184 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002185}
2186
2187ndk_headers {
2188 name: "libc_asm_arm64",
2189 from: "kernel/uapi/asm-arm64",
2190 to: "aarch64-linux-android",
2191 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002192 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002193}
2194
Lazar Trsic790d2f72017-11-27 11:54:11 +01002195ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002196 name: "libc_asm_x86",
2197 from: "kernel/uapi/asm-x86",
2198 to: "i686-linux-android",
2199 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002200 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002201}
2202
2203ndk_headers {
2204 name: "libc_asm_x86_64",
2205 from: "kernel/uapi/asm-x86",
2206 to: "x86_64-linux-android",
2207 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002208 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002209}
2210
Dan Albert4238a352016-06-28 11:18:05 -07002211ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002212 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002213 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002214 symbol_file: "libc.map.txt",
2215 first_version: "9",
2216}
2217
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002218llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002219 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002220 symbol_file: "libc.map.txt",
2221 export_headers_as_system: true,
2222 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002223 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002224 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002225 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002226 "kernel/android/uapi",
2227 "kernel/uapi",
2228 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002229 arch: {
2230 arm: {
2231 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002232 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002233 ],
2234 },
2235 arm64: {
2236 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002237 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002238 ],
2239 },
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002240 x86: {
2241 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002242 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002243 ],
2244 },
2245 x86_64: {
2246 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002247 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002248 ],
2249 },
2250 },
2251}
2252
Dan Albertdf31aff2016-10-06 15:50:41 -07002253ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002254 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002255 symbol_file: "libstdc++.map.txt",
2256 first_version: "9",
2257}
2258
Dan Willemsenca056d72018-01-08 14:00:24 -08002259// Export these headers for toolbox to process
2260filegroup {
2261 name: "kernel_input_headers",
2262 srcs: [
2263 "kernel/uapi/linux/input.h",
2264 "kernel/uapi/linux/input-event-codes.h",
2265 ],
2266}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002267
2268// Generate a syscall name / number mapping. These objects are text files
2269// (thanks to the -dD -E flags) and not binary files. They will then be
2270// consumed by the genseccomp.py script and converted into C++ code.
2271cc_defaults {
2272 name: "libseccomp_gen_syscall_nrs_defaults",
2273 recovery_available: true,
2274 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2275 cflags: [
2276 "-dD",
2277 "-E",
2278 "-Wall",
2279 "-Werror",
2280 "-nostdinc",
2281 ],
2282}
2283
2284cc_object {
2285 name: "libseccomp_gen_syscall_nrs_arm",
2286 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2287 local_include_dirs: [
2288 "kernel/uapi/asm-arm",
2289 "kernel/uapi",
2290 ],
2291}
2292
2293cc_object {
2294 name: "libseccomp_gen_syscall_nrs_arm64",
2295 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2296 local_include_dirs: [
2297 "kernel/uapi/asm-arm64",
2298 "kernel/uapi",
2299 ],
2300}
2301
2302cc_object {
2303 name: "libseccomp_gen_syscall_nrs_x86",
2304 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2305 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2306 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2307 local_include_dirs: [
2308 "kernel/uapi/asm-x86",
2309 "kernel/uapi",
2310 ],
2311}
2312
2313cc_object {
2314 name: "libseccomp_gen_syscall_nrs_x86_64",
2315 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2316 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2317 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2318 local_include_dirs: [
2319 "kernel/uapi/asm-x86",
2320 "kernel/uapi",
2321 ],
2322}
2323
Elliott Hughesae03b122019-09-17 16:37:05 -07002324// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002325python_binary_host {
2326 name: "genseccomp",
2327 main: "tools/genseccomp.py",
2328
2329 srcs: [
2330 "tools/genseccomp.py",
2331 "tools/gensyscalls.py",
2332 ],
2333
2334 data: [
2335 "kernel/uapi/**/*.h",
2336 ],
2337
2338 version: {
2339 py2: {
2340 enabled: true,
2341 },
2342 py3: {
2343 enabled: false,
2344 },
2345 },
2346}
2347
Martijn Coenen0c6de752019-01-02 12:52:51 +01002348python_binary_host {
2349 name: "genfunctosyscallnrs",
2350 main: "tools/genfunctosyscallnrs.py",
2351
2352 srcs: [
2353 "tools/genseccomp.py",
2354 "tools/genfunctosyscallnrs.py",
2355 "tools/gensyscalls.py",
2356 ],
2357
2358 data: [
2359 "kernel/uapi/**/*.h",
2360 ],
2361
2362 version: {
2363 py2: {
2364 enabled: true,
2365 },
2366 py3: {
2367 enabled: false,
2368 },
2369 },
2370}
2371
2372cc_genrule {
2373 name: "func_to_syscall_nrs",
2374 recovery_available: true,
2375 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2376
2377 tools: [ "genfunctosyscallnrs" ],
2378
2379 srcs: [
2380 "SYSCALLS.TXT",
2381 ":libseccomp_gen_syscall_nrs_arm",
2382 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002383 ":libseccomp_gen_syscall_nrs_x86",
2384 ":libseccomp_gen_syscall_nrs_x86_64",
2385 ],
2386
2387 out: [
2388 "func_to_syscall_nrs.h",
2389 ],
2390}
2391
Victor Hsiehdbb86702020-06-15 09:29:07 -07002392// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002393genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002394 name: "generate_app_zygote_blocklist",
2395 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2396 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002397 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2398}
2399
2400cc_genrule {
2401 name: "libseccomp_policy_app_zygote_sources",
2402 recovery_available: true,
2403 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2404
2405 tools: [ "genseccomp" ],
2406
2407 srcs: [
2408 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002409 "SECCOMP_ALLOWLIST_COMMON.TXT",
2410 "SECCOMP_ALLOWLIST_APP.TXT",
2411 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002412 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002413 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002414 ":libseccomp_gen_syscall_nrs_arm",
2415 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002416 ":libseccomp_gen_syscall_nrs_x86",
2417 ":libseccomp_gen_syscall_nrs_x86_64",
2418 ],
2419
2420 out: [
2421 "arm64_app_zygote_policy.cpp",
2422 "arm_app_zygote_policy.cpp",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002423 "x86_64_app_zygote_policy.cpp",
2424 "x86_app_zygote_policy.cpp",
2425 ],
2426}
2427
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002428cc_genrule {
2429 name: "libseccomp_policy_app_sources",
2430 recovery_available: true,
2431 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2432
2433 tools: [ "genseccomp" ],
2434
2435 srcs: [
2436 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002437 "SECCOMP_ALLOWLIST_COMMON.TXT",
2438 "SECCOMP_ALLOWLIST_APP.TXT",
2439 "SECCOMP_BLOCKLIST_COMMON.TXT",
2440 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002441 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002442 ":libseccomp_gen_syscall_nrs_arm",
2443 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002444 ":libseccomp_gen_syscall_nrs_x86",
2445 ":libseccomp_gen_syscall_nrs_x86_64",
2446 ],
2447
2448 out: [
2449 "arm64_app_policy.cpp",
2450 "arm_app_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002451 "x86_64_app_policy.cpp",
2452 "x86_app_policy.cpp",
2453 ],
2454}
2455
2456cc_genrule {
2457 name: "libseccomp_policy_system_sources",
2458 recovery_available: true,
2459 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2460
2461 tools: [ "genseccomp" ],
2462
2463 srcs: [
2464 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002465 "SECCOMP_ALLOWLIST_COMMON.TXT",
2466 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2467 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002468 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002469 ":libseccomp_gen_syscall_nrs_arm",
2470 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002471 ":libseccomp_gen_syscall_nrs_x86",
2472 ":libseccomp_gen_syscall_nrs_x86_64",
2473 ],
2474
2475 out: [
2476 "arm64_system_policy.cpp",
2477 "arm_system_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002478 "x86_64_system_policy.cpp",
2479 "x86_system_policy.cpp",
2480 ],
2481}
2482
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002483cc_library {
2484 name: "libseccomp_policy",
2485 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002486 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002487 generated_sources: [
2488 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002489 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002490 "libseccomp_policy_system_sources",
2491 ],
2492
2493 srcs: [
2494 "seccomp/seccomp_policy.cpp",
2495 ],
2496
2497 export_include_dirs: ["seccomp/include"],
2498 cflags: [
2499 "-Wall",
2500 "-Werror",
2501 ],
2502 shared: {
2503 shared_libs: ["libbase"],
2504 },
2505 static: {
2506 static_libs: ["libbase"],
2507 },
2508}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002509
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002510subdirs = [
2511 "bionic/scudo",
2512]