blob: 80e3b629f2cfa1dc40ae6bbab065e6a9dbc89196 [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/pututline.c",
12 "bionic/sched_cpualloc.c",
13 "bionic/sched_cpucount.c",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070014 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070015 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070016 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080017 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070018 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080019 "stdio/vfscanf.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070020 "stdio/vfwscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070021]
22
Peter Collingbourne570de332019-12-11 10:00:58 -080023// off64_t/time64_t support on LP32.
Dan Willemsen208ae172015-09-16 16:33:27 -070024// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -070025libc_common_src_files_32 = [
26 "bionic/legacy_32_bit_support.cpp",
27 "bionic/time64.c",
28]
29
Elliott Hughes53cf3482016-08-09 13:06:41 -070030libc_common_flags = [
31 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080032 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070033 "-Wall",
34 "-Wextra",
35 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080036 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070037 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070038 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070039 "-Wframe-larger-than=2048",
Elliott Hughes53cf3482016-08-09 13:06:41 -070040
41 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
42 "-Werror=pointer-to-int-cast",
43 "-Werror=int-to-pointer-cast",
44 "-Werror=type-limits",
45 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080046
47 // Clang's exit-time destructor registration hides __dso_handle, but
48 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
49 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080050
51 // GWP-ASan requires platform TLS.
52 "-fno-emulated-tls",
Elliott Hughes53cf3482016-08-09 13:06:41 -070053]
54
Dan Willemsen208ae172015-09-16 16:33:27 -070055// Define some common cflags
56// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070057cc_defaults {
58 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080059 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070060 cflags: libc_common_flags,
61 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070062 conlyflags: ["-std=gnu99"],
63 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070064 include_dirs: [
65 "bionic/libc/async_safe/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070066 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070067
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010068 header_libs: [
69 "libc_headers",
70 "gwp_asan_headers",
71 ],
72 export_header_lib_headers: [
73 "libc_headers",
74 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -080075
Colin Cross50c21ab2015-10-31 23:03:05 -070076 stl: "none",
77 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070078 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070079 address: false,
80 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070081 // TODO(b/132640749): Fix broken fuzzer support.
82 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070083 },
Colin Cross50c21ab2015-10-31 23:03:05 -070084 native_coverage: false,
Yifan Hong5a39cee2020-01-21 16:43:56 -080085 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090086 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020087 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080088
Yi Konge3d90de2019-02-20 14:28:56 -080089 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
90 // warning since this is intended right now.
91 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070092
93 product_variables: {
94 experimental_mte: {
95 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
96 },
Evgenii Stepanov5a73e032020-04-29 14:59:44 -070097 malloc_zero_contents: {
98 cflags: ["-DSCUDO_ZERO_CONTENTS"],
99 },
100 malloc_pattern_fill_contents: {
101 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
102 },
Steven Morelandfb65ee42020-07-31 00:18:38 +0000103 malloc_not_svelte: {
104 cflags: ["-DUSE_SCUDO"],
105 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700106 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700107}
108
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800109libc_scudo_product_variables = {
110 malloc_not_svelte: {
111 cflags: ["-DUSE_SCUDO"],
112 whole_static_libs: ["libscudo"],
113 exclude_static_libs: [
114 "libjemalloc5",
115 "libc_jemalloc_wrapper",
116 ],
117 },
118}
119
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700120// Defaults for native allocator libs/includes to make it
121// easier to change.
Christopher Ferris062eba22020-01-31 22:40:45 -0800122// To disable scudo for the non-svelte config remove the line:
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800123// product_variables: libc_scudo_product_variables,
Christopher Ferris062eba22020-01-31 22:40:45 -0800124// in the cc_defaults below.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700125// ========================================================
126cc_defaults {
127 name: "libc_native_allocator_defaults",
128
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700129 whole_static_libs: [
130 "libjemalloc5",
131 "libc_jemalloc_wrapper",
132 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800133 header_libs: ["gwp_asan_headers"],
Christopher Ferris062eba22020-01-31 22:40:45 -0800134 product_variables: libc_scudo_product_variables,
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700135}
136
137// Functions not implemented by jemalloc directly, or that need to
138// be modified for Android.
139cc_library_static {
140 name: "libc_jemalloc_wrapper",
141 defaults: ["libc_defaults"],
142 srcs: ["bionic/jemalloc_wrapper.cpp"],
143 cflags: ["-fvisibility=hidden"],
144
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800145 // Used to pull in the jemalloc include directory so that if the
146 // library is removed, the include directory is also removed.
147 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700148}
149
Dan Willemsen208ae172015-09-16 16:33:27 -0700150// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700151// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700152// ========================================================
153//
Ryan Prichard249757b2019-11-01 17:18:28 -0700154// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
155// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
156// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
157// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700158
159cc_library_static {
160
Colin Crossa3f9fca2016-01-11 13:20:55 -0800161 srcs: [
162 "bionic/__libc_init_main_thread.cpp",
163 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700164 "bionic/bionic_call_ifunc_resolver.cpp",
165 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800166 ],
167 arch: {
168 arm64: {
169 srcs: ["arch-arm64/bionic/__set_tls.c"],
170 },
171 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700172 srcs: [
173 "arch-x86/bionic/__libc_init_sysinfo.cpp",
174 "arch-x86/bionic/__set_tls.cpp",
175 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800176 },
177 x86_64: {
178 srcs: ["arch-x86_64/bionic/__set_tls.c"],
179 },
180 },
181
Colin Cross50c21ab2015-10-31 23:03:05 -0700182 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700183 cflags: ["-fno-stack-protector", "-ffreestanding"],
184 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700185}
186
Ryan Prichard249757b2019-11-01 17:18:28 -0700187// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
188// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
189// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800190
191cc_library_static {
192 name: "libc_init_static",
193 defaults: ["libc_defaults"],
194 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700195 cflags: [
196 "-fno-stack-protector",
197
198 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
199 // from the linker before ifunc resolvers have made string.h functions available.
200 "-ffreestanding",
201 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800202}
203
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700204cc_library_static {
205 name: "libc_init_dynamic",
206 defaults: ["libc_defaults"],
207 srcs: ["bionic/libc_init_dynamic.cpp"],
208 cflags: ["-fno-stack-protector"],
209}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800210
Dan Willemsen208ae172015-09-16 16:33:27 -0700211// ========================================================
212// libc_tzcode.a - upstream 'tzcode' code
213// ========================================================
214
215cc_library_static {
216
Colin Cross50c21ab2015-10-31 23:03:05 -0700217 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700218 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800219 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700220 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700221 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
222 ],
223
Colin Cross50c21ab2015-10-31 23:03:05 -0700224 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700225 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700226 // Don't use ridiculous amounts of stack.
227 "-DALL_STATE",
228 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
229 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800230 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700231 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700232 // The name of the tm_gmtoff field in our struct tm.
233 "-DTM_GMTOFF=tm_gmtoff",
234 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700235 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700236 // Include `tzname`, `timezone`, and `daylight` globals.
237 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700238 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800239 // Use the empty string (instead of " ") as the timezone abbreviation
240 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700241 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700242 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
243 "-Dlint",
244 ],
245
Dan Willemsen208ae172015-09-16 16:33:27 -0700246 local_include_dirs: ["tzcode/"],
247 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700248}
249
250// ========================================================
251// libc_dns.a - modified NetBSD DNS code
252// ========================================================
253
254cc_library_static {
255
Colin Cross50c21ab2015-10-31 23:03:05 -0700256 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700257 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800258 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700259
260 "upstream-netbsd/lib/libc/isc/ev_streams.c",
261 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700262 ],
263
Colin Cross50c21ab2015-10-31 23:03:05 -0700264 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700265 "-DANDROID_CHANGES",
266 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700267 "-Wno-unused-parameter",
268 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700269 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700270 ],
271
Dan Willemsen208ae172015-09-16 16:33:27 -0700272 local_include_dirs: [
273 "dns/include",
274 "private",
275 "upstream-netbsd/lib/libc/include",
276 "upstream-netbsd/android/include",
277 ],
278
279 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700280}
281
282// ========================================================
283// libc_freebsd.a - upstream FreeBSD C library code
284// ========================================================
285//
286// These files are built with the freebsd-compat.h header file
287// automatically included.
288
289cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700290 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700291 srcs: [
292 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700293 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700294 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
295 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
296 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
297 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700298 "upstream-freebsd/lib/libc/stdlib/qsort.c",
299 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700300 "upstream-freebsd/lib/libc/string/wcpcpy.c",
301 "upstream-freebsd/lib/libc/string/wcpncpy.c",
302 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700303 "upstream-freebsd/lib/libc/string/wcscat.c",
304 "upstream-freebsd/lib/libc/string/wcschr.c",
305 "upstream-freebsd/lib/libc/string/wcscmp.c",
306 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700307 "upstream-freebsd/lib/libc/string/wcscspn.c",
308 "upstream-freebsd/lib/libc/string/wcsdup.c",
309 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700310 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700311 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
312 "upstream-freebsd/lib/libc/string/wcsncat.c",
313 "upstream-freebsd/lib/libc/string/wcsncmp.c",
314 "upstream-freebsd/lib/libc/string/wcsncpy.c",
315 "upstream-freebsd/lib/libc/string/wcsnlen.c",
316 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700317 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700318 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700319 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700320 "upstream-freebsd/lib/libc/string/wcstok.c",
321 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700322 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700323 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700324 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800325 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700326 ],
327 arch: {
328 arm64: {
329 exclude_srcs: [
330 "upstream-freebsd/lib/libc/string/wmemmove.c",
331 ],
332 },
333 x86: {
334 exclude_srcs: [
335 "upstream-freebsd/lib/libc/string/wcschr.c",
336 "upstream-freebsd/lib/libc/string/wcscmp.c",
337 "upstream-freebsd/lib/libc/string/wcslen.c",
338 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700339 "upstream-freebsd/lib/libc/string/wmemcmp.c",
340 "upstream-freebsd/lib/libc/string/wcscat.c",
341 "upstream-freebsd/lib/libc/string/wcscpy.c",
342 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530343 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700344 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700345 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700346 },
347
Colin Cross50c21ab2015-10-31 23:03:05 -0700348 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700349 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700350 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700351 "-include freebsd-compat.h",
352 ],
353
Dan Willemsen208ae172015-09-16 16:33:27 -0700354 local_include_dirs: [
355 "upstream-freebsd/android/include",
356 ],
357
358 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700359}
360
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700361cc_library_static {
362 defaults: ["libc_defaults"],
363 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700364 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700365 ],
366
367 cflags: [
368 "-Wno-sign-compare",
369 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700370 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700371 ],
372
373 local_include_dirs: [
374 "upstream-freebsd/android/include",
375 ],
376
377 name: "libc_freebsd_large_stack",
378}
379
Dan Willemsen208ae172015-09-16 16:33:27 -0700380// ========================================================
381// libc_netbsd.a - upstream NetBSD C library code
382// ========================================================
383//
384// These files are built with the netbsd-compat.h header file
385// automatically included.
386
387cc_library_static {
388
Colin Cross50c21ab2015-10-31 23:03:05 -0700389 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700390 srcs: [
391 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700392 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700393 "upstream-netbsd/lib/libc/gen/psignal.c",
394 "upstream-netbsd/lib/libc/gen/utime.c",
395 "upstream-netbsd/lib/libc/gen/utmp.c",
396 "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",
Dan Willemsen208ae172015-09-16 16:33:27 -0700531 "upstream-openbsd/lib/libc/stdlib/remque.c",
532 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700533 "upstream-openbsd/lib/libc/stdlib/tfind.c",
534 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800535 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700536 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800537 "upstream-openbsd/lib/libc/string/strcasestr.c",
538 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700539 "upstream-openbsd/lib/libc/string/strcspn.c",
540 "upstream-openbsd/lib/libc/string/strdup.c",
541 "upstream-openbsd/lib/libc/string/strndup.c",
542 "upstream-openbsd/lib/libc/string/strpbrk.c",
543 "upstream-openbsd/lib/libc/string/strsep.c",
544 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800546 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700547 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700548 "upstream-openbsd/lib/libc/string/wcswidth.c",
549 ],
550
Colin Cross50c21ab2015-10-31 23:03:05 -0700551 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700552 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700553 "-Wno-unused-parameter",
554 "-include openbsd-compat.h",
555 ],
556
Dan Willemsen208ae172015-09-16 16:33:27 -0700557 local_include_dirs: [
558 "private",
559 "stdio",
560 "upstream-openbsd/android/include",
561 "upstream-openbsd/lib/libc/include",
562 "upstream-openbsd/lib/libc/gdtoa/",
563 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700564}
565
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700566cc_library_static {
567 name: "libc_openbsd_large_stack",
568 defaults: ["libc_defaults"],
569 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700570 "stdio/vfprintf.cpp",
571 "stdio/vfwprintf.cpp",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800572 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700573 ],
574 cflags: [
575 "-include openbsd-compat.h",
576 "-Wno-sign-compare",
577 "-Wframe-larger-than=5000",
578 ],
579
580 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700581 "upstream-openbsd/android/include/",
582 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700583 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700584 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700585 ],
586}
587
Dan Willemsen208ae172015-09-16 16:33:27 -0700588// ========================================================
589// libc_openbsd.a - upstream OpenBSD C library code
590// ========================================================
591//
592// These files are built with the openbsd-compat.h header file
593// automatically included.
594cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700595 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700596 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800597 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700598 "upstream-openbsd/lib/libc/crypt/arc4random.c",
599 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
600
601 // May be overriden by per-arch optimized versions
602 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700603 "upstream-openbsd/lib/libc/string/memrchr.c",
604 "upstream-openbsd/lib/libc/string/stpcpy.c",
605 "upstream-openbsd/lib/libc/string/stpncpy.c",
606 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700607 "upstream-openbsd/lib/libc/string/strcpy.c",
608 "upstream-openbsd/lib/libc/string/strlcat.c",
609 "upstream-openbsd/lib/libc/string/strlcpy.c",
610 "upstream-openbsd/lib/libc/string/strncat.c",
611 "upstream-openbsd/lib/libc/string/strncmp.c",
612 "upstream-openbsd/lib/libc/string/strncpy.c",
613 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700614
615 arch: {
616 arm: {
617 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700618 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800619 "upstream-openbsd/lib/libc/string/stpcpy.c",
620 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700621 ],
622 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700623 arm64: {
624 exclude_srcs: [
625 "upstream-openbsd/lib/libc/string/memchr.c",
Peter Collingbourne2361d4e2020-06-03 16:55:37 -0700626 "upstream-openbsd/lib/libc/string/memrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700627 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700628 "upstream-openbsd/lib/libc/string/strcpy.c",
629 "upstream-openbsd/lib/libc/string/strncmp.c",
630 ],
631 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700632 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800633 exclude_srcs: [
634 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800635 "upstream-openbsd/lib/libc/string/memrchr.c",
636 "upstream-openbsd/lib/libc/string/stpcpy.c",
637 "upstream-openbsd/lib/libc/string/stpncpy.c",
638 "upstream-openbsd/lib/libc/string/strcat.c",
639 "upstream-openbsd/lib/libc/string/strcpy.c",
640 "upstream-openbsd/lib/libc/string/strncmp.c",
641 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700642 "upstream-openbsd/lib/libc/string/strlcat.c",
643 "upstream-openbsd/lib/libc/string/strlcpy.c",
644 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800645 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700646 },
647
648 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800649 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800650 "upstream-openbsd/lib/libc/string/stpcpy.c",
651 "upstream-openbsd/lib/libc/string/stpncpy.c",
652 "upstream-openbsd/lib/libc/string/strcat.c",
653 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800654 "upstream-openbsd/lib/libc/string/strncat.c",
655 "upstream-openbsd/lib/libc/string/strncmp.c",
656 "upstream-openbsd/lib/libc/string/strncpy.c",
657 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700658 },
659 },
660
Colin Cross50c21ab2015-10-31 23:03:05 -0700661 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700662 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700663 "-Wno-unused-parameter",
664 "-include openbsd-compat.h",
665 ],
666
Dan Willemsen208ae172015-09-16 16:33:27 -0700667 local_include_dirs: [
668 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700669 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700670 ],
671
672 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700673}
674
675// ========================================================
676// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
677// ========================================================
678//
679// These files are built with the openbsd-compat.h header file
680// automatically included.
681
682cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700683 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700684 srcs: [
685 "upstream-openbsd/android/gdtoa_support.cpp",
686 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
687 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
688 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
689 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
690 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
691 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
692 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
693 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
694 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
695 "upstream-openbsd/lib/libc/gdtoa/misc.c",
696 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
697 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
698 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
699 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
700 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
701 "upstream-openbsd/lib/libc/gdtoa/sum.c",
702 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
703 ],
704 multilib: {
705 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800706 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700707 },
708 },
709
Colin Cross50c21ab2015-10-31 23:03:05 -0700710 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700711 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700712 "-include openbsd-compat.h",
713 ],
714
Dan Willemsen208ae172015-09-16 16:33:27 -0700715 local_include_dirs: [
716 "private",
717 "upstream-openbsd/android/include",
718 "upstream-openbsd/lib/libc/include",
719 ],
720
721 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700722}
723
724// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700725// libc_fortify.a - container for our FORITFY
726// implementation details
727// ========================================================
728cc_library_static {
729 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700730 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700731
732 name: "libc_fortify",
733
734 // Disable FORTIFY for the compilation of these, so we don't end up having
735 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800736 cflags: [
737 "-U_FORTIFY_SOURCE",
738 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
739 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700740
741 arch: {
742 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800743 cflags: [
744 "-DNO___MEMCPY_CHK",
745 "-DRENAME___STRCAT_CHK",
746 "-DRENAME___STRCPY_CHK",
747 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700748 srcs: [
749 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800750
751 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
752 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
753
754 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
755 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
756
757 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
758 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
759
760 "arch-arm/krait/bionic/__strcat_chk.S",
761 "arch-arm/krait/bionic/__strcpy_chk.S",
762
763 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
764 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
765
Haibo Huang01bfd892018-12-03 15:05:16 -0800766 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
767 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700768 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700769 },
770 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700771 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700772 srcs: [
773 "arch-arm64/generic/bionic/__memcpy_chk.S",
774 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700775 },
776 },
777}
778
779// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700780// libc_bionic.a - home-grown C library code
781// ========================================================
782
783cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700784 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700785 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800786 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700787 "bionic/sysconf.cpp",
788 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700789 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700790
Josh Gao10ec9282017-04-03 15:13:29 -0700791 // The following must not be statically linked into libc_ndk.a, because
792 // debuggerd will look for the abort message in libc.so's copy.
793 "bionic/android_set_abort_message.cpp",
794
Dan Willemsen208ae172015-09-16 16:33:27 -0700795 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800796 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700797 "bionic/strnlen.c",
798 "bionic/strrchr.cpp",
799 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700800
801 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700802 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700803 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700804 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800805 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700806 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800807 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800808 "arch-arm/generic/bionic/stpcpy.c",
809 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800810 "arch-arm/generic/bionic/strcmp.S",
811 "arch-arm/generic/bionic/strcpy.S",
812 "arch-arm/generic/bionic/strlen.c",
813
Ryan Prichard45024fe2018-12-30 21:10:26 -0800814 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700815 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700816 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700817 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700818 "arch-arm/bionic/atomics_arm.c",
819 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800820 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700821 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700822 "arch-arm/bionic/setjmp.S",
823 "arch-arm/bionic/syscall.S",
824 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800825
826 "arch-arm/cortex-a15/bionic/memcpy.S",
827 "arch-arm/cortex-a15/bionic/memmove.S",
828 "arch-arm/cortex-a15/bionic/memset.S",
829 "arch-arm/cortex-a15/bionic/stpcpy.S",
830 "arch-arm/cortex-a15/bionic/strcat.S",
831 "arch-arm/cortex-a15/bionic/strcmp.S",
832 "arch-arm/cortex-a15/bionic/strcpy.S",
833 "arch-arm/cortex-a15/bionic/strlen.S",
834
835 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800836 "arch-arm/cortex-a7/bionic/memset.S",
837
838 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800839 "arch-arm/cortex-a9/bionic/memset.S",
840 "arch-arm/cortex-a9/bionic/stpcpy.S",
841 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800842 "arch-arm/cortex-a9/bionic/strcpy.S",
843 "arch-arm/cortex-a9/bionic/strlen.S",
844
845 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800846 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800847
848 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800849
Haibo Huang01bfd892018-12-03 15:05:16 -0800850 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800851
852 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700853 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700854 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700855 arm64: {
856 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700857 "arch-arm64/generic/bionic/memcpy.S",
858 "arch-arm64/generic/bionic/memmove.S",
859 "arch-arm64/generic/bionic/memset.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700860 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800861
862 "arch-arm64/bionic/__bionic_clone.S",
863 "arch-arm64/bionic/_exit_with_stack_teardown.S",
864 "arch-arm64/bionic/setjmp.S",
865 "arch-arm64/bionic/syscall.S",
866 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700867 ],
868 exclude_srcs: [
869 "bionic/__memcpy_chk.cpp",
870 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800871 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700872 "bionic/strnlen.c",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800873 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700874 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700875 },
876
Dan Willemsen208ae172015-09-16 16:33:27 -0700877 x86: {
878 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700879 "arch-x86/generic/string/memcmp.S",
880 "arch-x86/generic/string/strcmp.S",
881 "arch-x86/generic/string/strncmp.S",
882 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700883
884 "arch-x86/generic/string/strlcat.c",
885 "arch-x86/generic/string/strlcpy.c",
886 "arch-x86/generic/string/strncat.c",
887 "arch-x86/generic/string/wcscat.c",
888 "arch-x86/generic/string/wcscpy.c",
889 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530890 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700891
Dan Willemsen208ae172015-09-16 16:33:27 -0700892 "arch-x86/atom/string/sse2-memchr-atom.S",
893 "arch-x86/atom/string/sse2-memrchr-atom.S",
894 "arch-x86/atom/string/sse2-strchr-atom.S",
895 "arch-x86/atom/string/sse2-strnlen-atom.S",
896 "arch-x86/atom/string/sse2-strrchr-atom.S",
897 "arch-x86/atom/string/sse2-wcschr-atom.S",
898 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
899 "arch-x86/atom/string/sse2-wcslen-atom.S",
900 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700901 "arch-x86/silvermont/string/sse2-memmove-slm.S",
902 "arch-x86/silvermont/string/sse2-memset-slm.S",
903 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
904 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
905 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
906 "arch-x86/silvermont/string/sse2-strlen-slm.S",
907 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800908
909 "arch-x86/bionic/__bionic_clone.S",
910 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800911 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800912 "arch-x86/bionic/__restore.S",
913 "arch-x86/bionic/setjmp.S",
914 "arch-x86/bionic/syscall.S",
915 "arch-x86/bionic/vfork.S",
Ryan Pricharda992a062020-04-18 02:59:24 -0700916 "arch-x86/bionic/__x86.get_pc_thunk.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700917
918 // ssse3 functions
919 "arch-x86/atom/string/ssse3-strcat-atom.S",
920 "arch-x86/atom/string/ssse3-strcmp-atom.S",
921 "arch-x86/atom/string/ssse3-strlcat-atom.S",
922 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
923 "arch-x86/atom/string/ssse3-strncat-atom.S",
924 "arch-x86/atom/string/ssse3-strncmp-atom.S",
925 "arch-x86/atom/string/ssse3-wcscat-atom.S",
926 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
927
928 // sse4 functions
929 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
930 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
931
932 // atom functions
933 "arch-x86/atom/string/sse2-memset-atom.S",
934 "arch-x86/atom/string/sse2-strlen-atom.S",
935 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800936 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700937 "arch-x86/atom/string/ssse3-strcpy-atom.S",
938 "arch-x86/atom/string/ssse3-strncpy-atom.S",
939 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530940
941 // avx2 functions
942 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700943 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700944
945 exclude_srcs: [
946 "bionic/strchr.cpp",
947 "bionic/strnlen.c",
948 "bionic/strrchr.cpp",
949 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700950 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700951 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700952 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700953 "arch-x86_64/string/sse2-memmove-slm.S",
954 "arch-x86_64/string/sse2-memset-slm.S",
955 "arch-x86_64/string/sse2-stpcpy-slm.S",
956 "arch-x86_64/string/sse2-stpncpy-slm.S",
957 "arch-x86_64/string/sse2-strcat-slm.S",
958 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700959 "arch-x86_64/string/sse2-strlen-slm.S",
960 "arch-x86_64/string/sse2-strncat-slm.S",
961 "arch-x86_64/string/sse2-strncpy-slm.S",
962 "arch-x86_64/string/sse4-memcmp-slm.S",
963 "arch-x86_64/string/ssse3-strcmp-slm.S",
964 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530965 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800966
967 "arch-x86_64/bionic/__bionic_clone.S",
968 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
969 "arch-x86_64/bionic/__restore_rt.S",
970 "arch-x86_64/bionic/setjmp.S",
971 "arch-x86_64/bionic/syscall.S",
972 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700973 ],
974 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700975 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700976
Colin Cross50c21ab2015-10-31 23:03:05 -0700977 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700978 include_dirs: ["bionic/libstdc++/include"],
979 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700980}
981
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000982genrule {
983 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -0800984 out: ["generated_android_ids.h"],
985 srcs: [":android_filesystem_config_header"],
986 tool_files: ["fs_config_generator.py"],
987 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000988}
989
Dan Willemsen268a6732015-10-15 14:49:45 -0700990// ========================================================
991// libc_bionic_ndk.a- The portions of libc_bionic that can
992// be safely used in libc_ndk.a (no troublesome global data
993// or constructors).
994// ========================================================
995cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700996 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700997 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -0700998 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -0700999 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001000 "bionic/__cmsg_nxthdr.cpp",
1001 "bionic/__errno.cpp",
1002 "bionic/__gnu_basename.cpp",
1003 "bionic/__libc_current_sigrtmax.cpp",
1004 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001005 "bionic/abort.cpp",
1006 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001007 "bionic/access.cpp",
1008 "bionic/arpa_inet.cpp",
1009 "bionic/assert.cpp",
1010 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001011 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001012 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001013 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001014 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001015 "bionic/bionic_systrace.cpp",
1016 "bionic/bionic_time_conversions.cpp",
1017 "bionic/brk.cpp",
1018 "bionic/c16rtomb.cpp",
1019 "bionic/c32rtomb.cpp",
1020 "bionic/chmod.cpp",
1021 "bionic/chown.cpp",
1022 "bionic/clearenv.cpp",
1023 "bionic/clock.cpp",
1024 "bionic/clock_getcpuclockid.cpp",
1025 "bionic/clock_nanosleep.cpp",
1026 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001027 "bionic/ctype.cpp",
1028 "bionic/dirent.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001029 "bionic/dup.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001030 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001031 "bionic/error.cpp",
Josh Gao7de41242020-04-29 17:08:46 -07001032 "bionic/eventfd.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001033 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001034 "bionic/faccessat.cpp",
1035 "bionic/fchmod.cpp",
1036 "bionic/fchmodat.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001037 "bionic/fcntl.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001038 "bionic/fdsan.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001039 "bionic/fdtrack.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001040 "bionic/ffs.cpp",
1041 "bionic/fgetxattr.cpp",
1042 "bionic/flistxattr.cpp",
1043 "bionic/flockfile.cpp",
1044 "bionic/fpclassify.cpp",
1045 "bionic/fsetxattr.cpp",
1046 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001047 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001048 "bionic/futimens.cpp",
1049 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001050 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001051 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001052 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001053 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001054 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001055 "bionic/getpgrp.cpp",
1056 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001057 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001058 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001059 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001060 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001061 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001062 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001063 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001064 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001065 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001066 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001067 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001068 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001069 "bionic/lchown.cpp",
1070 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001071 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001072 "bionic/libgen.cpp",
1073 "bionic/link.cpp",
1074 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001075 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001076 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001077 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001078 "bionic/mbrtoc16.cpp",
1079 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001080 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001081 "bionic/mempcpy.cpp",
1082 "bionic/mkdir.cpp",
1083 "bionic/mkfifo.cpp",
1084 "bionic/mknod.cpp",
1085 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001086 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001087 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001088 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001089 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001090 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001091 "bionic/open.cpp",
1092 "bionic/pathconf.cpp",
1093 "bionic/pause.cpp",
1094 "bionic/pipe.cpp",
1095 "bionic/poll.cpp",
1096 "bionic/posix_fadvise.cpp",
1097 "bionic/posix_fallocate.cpp",
1098 "bionic/posix_madvise.cpp",
1099 "bionic/posix_timers.cpp",
1100 "bionic/ptrace.cpp",
1101 "bionic/pty.cpp",
1102 "bionic/raise.cpp",
1103 "bionic/rand.cpp",
1104 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001105 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001106 "bionic/reboot.cpp",
1107 "bionic/recv.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001108 "bionic/recvmsg.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001109 "bionic/rename.cpp",
1110 "bionic/rmdir.cpp",
1111 "bionic/scandir.cpp",
1112 "bionic/sched_getaffinity.cpp",
1113 "bionic/sched_getcpu.cpp",
1114 "bionic/semaphore.cpp",
1115 "bionic/send.cpp",
1116 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001117 "bionic/seteuid.cpp",
1118 "bionic/setpgrp.cpp",
1119 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001120 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001121 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001122 "bionic/sleep.cpp",
Josh Gaob107eab2020-04-29 17:17:56 -07001123 "bionic/socketpair.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001124 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001125 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001126 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001127 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001128 "bionic/string_l.cpp",
1129 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001130 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001131 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001132 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001133 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001134 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001135 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001136 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001137 "bionic/sys_msg.cpp",
1138 "bionic/sys_sem.cpp",
1139 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001140 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001141 "bionic/sys_statfs.cpp",
1142 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001143 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001144 "bionic/sysinfo.cpp",
1145 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001146 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001147 "bionic/system_property_api.cpp",
1148 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001149 "bionic/tdestroy.cpp",
1150 "bionic/termios.cpp",
1151 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001152 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001153 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001154 "bionic/tmpfile.cpp",
1155 "bionic/umount.cpp",
1156 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001157 "bionic/usleep.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001158 "bionic/wait.cpp",
1159 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001160 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001161 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001162 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001163 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001164 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001165
1166 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1167 // which will be overridden by the actual one in libc.so.
1168 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001169 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001170
Dan Willemsen208ae172015-09-16 16:33:27 -07001171 multilib: {
1172 lib32: {
1173 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001174 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001175 },
1176 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001177 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001178 treble_linker_namespaces: {
1179 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001180 },
1181 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001182 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001183 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001184 local_include_dirs: ["stdio"],
1185 include_dirs: ["bionic/libstdc++/include"],
1186 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001187 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001188}
1189
Dan Willemsen208ae172015-09-16 16:33:27 -07001190// ========================================================
1191// libc_pthread.a - pthreads parts that previously lived in
1192// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001193// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001194// pthread_t has changed over the years and has ABI
1195// compatibility issues).
1196// ========================================================
1197
1198cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001199 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001200 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001201 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001202 "bionic/pthread_atfork.cpp",
1203 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001204 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001205 "bionic/pthread_cond.cpp",
1206 "bionic/pthread_create.cpp",
1207 "bionic/pthread_detach.cpp",
1208 "bionic/pthread_equal.cpp",
1209 "bionic/pthread_exit.cpp",
1210 "bionic/pthread_getcpuclockid.cpp",
1211 "bionic/pthread_getschedparam.cpp",
1212 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001213 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001214 "bionic/pthread_join.cpp",
1215 "bionic/pthread_key.cpp",
1216 "bionic/pthread_kill.cpp",
1217 "bionic/pthread_mutex.cpp",
1218 "bionic/pthread_once.cpp",
1219 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001220 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001221 "bionic/pthread_self.cpp",
1222 "bionic/pthread_setname_np.cpp",
1223 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001224 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001225
1226 // The following implementations depend on pthread data or implementation,
1227 // so we can't include them in libc_ndk.a.
1228 "bionic/__cxa_thread_atexit_impl.cpp",
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001229 "bionic/android_unsafe_frame_pointer_chase.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -08001230 "bionic/atexit.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001231 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001232 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001233
Colin Cross50c21ab2015-10-31 23:03:05 -07001234 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001235 include_dirs: ["bionic/libstdc++/include"],
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001236 header_libs: ["bionic_libc_platform_headers"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001237 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001238}
1239
1240// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001241// libc_syscalls.a
1242// ========================================================
1243
Elliott Hughes782c4852019-04-16 12:31:00 -07001244genrule {
1245 name: "syscalls-arm.S",
1246 out: ["syscalls-arm.S"],
1247 srcs: ["SYSCALLS.TXT"],
1248 tool_files: [":bionic-gensyscalls"],
1249 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1250}
1251
1252genrule {
1253 name: "syscalls-arm64.S",
1254 out: ["syscalls-arm64.S"],
1255 srcs: ["SYSCALLS.TXT"],
1256 tool_files: [":bionic-gensyscalls"],
1257 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1258}
1259
1260genrule {
1261 name: "syscalls-x86.S",
1262 out: ["syscalls-x86.S"],
1263 srcs: ["SYSCALLS.TXT"],
1264 tool_files: [":bionic-gensyscalls"],
1265 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1266}
1267
1268genrule {
1269 name: "syscalls-x86_64.S",
1270 out: ["syscalls-x86_64.S"],
1271 srcs: ["SYSCALLS.TXT"],
1272 tool_files: [":bionic-gensyscalls"],
1273 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1274}
1275
Dan Willemsen208ae172015-09-16 16:33:27 -07001276cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001277 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001278 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001279 arch: {
1280 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001281 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001282 },
1283 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001284 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001285 },
1286 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001287 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001288 },
1289 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001290 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001291 },
1292 },
1293 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001294}
1295
1296// ========================================================
1297// libc_aeabi.a
1298// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1299// to avoid infinite recursion. For the other architectures we just build an
1300// empty library to keep this makefile simple.
1301// ========================================================
1302
1303cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001304 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001305 arch: {
1306 arm: {
1307 srcs: ["arch-arm/bionic/__aeabi.c"],
1308 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001309 },
1310 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001311 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001312}
1313
1314// ========================================================
1315// libc_ndk.a
1316// Compatibility library for the NDK. This library contains
1317// all the parts of libc that are safe to statically link.
1318// We can't safely statically link things that can only run
1319// on a certain version of the OS. Examples include
1320// anything that talks to netd (a large portion of the DNS
1321// code) and anything that is dependent on the layout of a
1322// data structure that has changed across releases (such as
1323// pthread_t).
1324// ========================================================
1325
1326cc_library_static {
1327 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001328 defaults: [
1329 "libc_defaults",
1330 "libc_native_allocator_defaults",
1331 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -08001332 ramdisk_available: false,
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001333 srcs: libc_common_src_files + [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001334 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001335 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001336 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001337 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001338 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001339 multilib: {
1340 lib32: {
1341 srcs: libc_common_src_files_32,
1342 },
1343 },
1344 arch: {
1345 arm: {
1346 srcs: [
1347 "arch-arm/bionic/exidx_dynamic.c",
1348 "arch-common/bionic/crtbegin_so.c",
1349 "arch-arm/bionic/atexit_legacy.c",
1350 "arch-common/bionic/crtend_so.S",
1351 ],
1352 whole_static_libs: ["libc_aeabi"],
1353 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001354 },
1355
Colin Cross50c21ab2015-10-31 23:03:05 -07001356 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001357 "-fvisibility=hidden",
1358 "-DLIBC_STATIC",
1359 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001360
1361 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001362 "gwp_asan",
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001363 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001364 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001365 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001366 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001367 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001368 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001369 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001370 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001371 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001372 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001373 "libc_syscalls",
1374 "libc_tzcode",
1375 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001376 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001377 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001378}
1379
1380// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001381// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001382// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001383cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001384 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001385 srcs: libc_common_src_files,
1386 multilib: {
1387 lib32: {
1388 srcs: libc_common_src_files_32,
1389 },
1390 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001391 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001392
1393 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001394 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001395 "libc_bionic",
1396 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001397 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001398 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001399 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001400 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001401 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001402 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001403 "libc_netbsd",
1404 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001405 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001406 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001407 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001408 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001409 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001410 ],
1411
1412 arch: {
1413 arm: {
1414 whole_static_libs: ["libc_aeabi"],
1415 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001416 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001417}
1418
1419// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001420// libc_common.a
1421// ========================================================
1422
1423cc_library_static {
1424 defaults: ["libc_defaults"],
1425 name: "libc_common",
1426
1427 whole_static_libs: [
1428 "libc_nopthread",
1429 "libc_pthread",
1430 ],
1431}
1432
1433// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001434// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001435// ========================================================
1436cc_library_static {
1437 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001438 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001439
Haibo Huangb9244ff2018-08-11 10:12:13 -07001440 arch: {
1441 x86: {
1442 srcs: ["arch-x86/static_function_dispatch.S"],
1443 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001444 arm: {
1445 srcs: ["arch-arm/static_function_dispatch.S"],
1446 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001447 arm64: {
1448 srcs: ["arch-arm64/static_function_dispatch.S"],
1449 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001450 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001451}
1452
1453// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001454// libc_dynamic_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_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001459
Haibo Huangb9244ff2018-08-11 10:12:13 -07001460 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001461 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001462 "-fno-stack-protector",
1463 "-fno-jump-tables",
1464 ],
1465 arch: {
1466 x86: {
1467 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1468 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001469 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001470 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001471 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001472 arm64: {
1473 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1474 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001475 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001476}
1477
1478// ========================================================
1479// libc_common_static.a For static binaries.
1480// ========================================================
1481cc_library_static {
1482 defaults: ["libc_defaults"],
1483 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001484
Haibo Huangf71edfa2018-11-12 10:06:56 -08001485 whole_static_libs: [
1486 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001487 "libc_static_dispatch",
1488 ],
1489}
1490
1491// ========================================================
1492// libc_common_shared.a For shared libraries.
1493// ========================================================
1494cc_library_static {
1495 defaults: ["libc_defaults"],
1496 name: "libc_common_shared",
1497
1498 whole_static_libs: [
1499 "libc_common",
1500 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001501 ],
1502}
1503
Ryan Prichard22a6a052019-10-10 23:59:30 -07001504// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1505// executable.
1506cc_library_static {
1507 name: "libc_unwind_static",
1508 defaults: ["libc_defaults"],
1509 cflags: ["-DLIBC_STATIC"],
1510
1511 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1512 arch: {
1513 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1514 arm: {
1515 srcs: ["arch-arm/bionic/exidx_static.c"],
1516 },
1517 },
1518}
1519
Haibo Huangf71edfa2018-11-12 10:06:56 -08001520// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001521// libc_nomalloc.a
1522// ========================================================
1523//
Ryan Prichard249757b2019-11-01 17:18:28 -07001524// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1525// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1526// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001527
1528cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001529 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001530 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001531
Colin Crossa3f9fca2016-01-11 13:20:55 -08001532 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001533 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001534 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001535 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001536 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001537}
1538
dimitryc0c0ef62018-12-05 16:33:52 +01001539filegroup {
1540 name: "libc_sources_shared",
1541 srcs: [
1542 "arch-common/bionic/crtbegin_so.c",
1543 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001544 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001545 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001546 "bionic/icu.cpp",
1547 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001548 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001549 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001550 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001551 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001552 "bionic/ndk_cruft.cpp",
1553 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001554 "bionic/NetdClient.cpp",
1555 "arch-common/bionic/crtend_so.S",
1556 ],
1557}
1558
1559filegroup {
1560 name: "libc_sources_static",
1561 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001562 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001563 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001564 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001565 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001566 ],
1567}
1568
1569filegroup {
1570 name: "libc_sources_shared_arm",
1571 srcs: [
1572 "arch-arm/bionic/exidx_dynamic.c",
1573 "arch-arm/bionic/atexit_legacy.c",
1574 ],
1575}
1576
Dan Willemsen208ae172015-09-16 16:33:27 -07001577// ========================================================
1578// libc.a + libc.so
1579// ========================================================
1580cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001581 defaults: [
1582 "libc_defaults",
1583 "libc_native_allocator_defaults",
1584 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001585 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001586 static_ndk_lib: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001587 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001588 platform_sdk_version: {
1589 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1590 },
1591 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001592 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001593 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001594 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001595 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001596 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001597 "libc_init_static",
1598 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001599 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001600 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001601 },
1602 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001603 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001604 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001605 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001606 "libc_init_dynamic",
1607 "libc_common_shared",
1608 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001609 },
1610
Neil Fullera7db90f2019-04-25 09:28:27 +01001611 required: [
1612 "tzdata",
1613 "tz_version", // Version metadata for tzdata to help debugging.
1614 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001615
Colin Cross4ce94d22016-11-15 13:15:43 -08001616 // Do not pack libc.so relocations; see http://b/20645321 for details.
1617 pack_relocations: false,
1618
dimitry06016f22018-01-05 11:39:28 +01001619 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1620 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1621 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1622 // those new libraries from libgcc.a are not declared external; if that were the case,
1623 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1624 // on the external symbols from the dependent libraries. That would create a "cloaked"
1625 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001626
dimitry06016f22018-01-05 11:39:28 +01001627 shared_libs: [
1628 "ld-android",
1629 "libdl",
1630 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001631 static_libs: [
1632 "libdl_android",
1633 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001634
1635 nocrt: true,
1636
Dan Willemsen208ae172015-09-16 16:33:27 -07001637 arch: {
1638 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001639 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001640 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001641 ldflags: ["-Wl,--hash-style=both"],
1642
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001643 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001644
Dan Willemsen208ae172015-09-16 16:33:27 -07001645 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001646 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001647 // special for arm
1648 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichard379e05f2020-04-01 20:10:07 -07001649
1650 whole_static_libs: [ "libunwind_llvm" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001651 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001652
1653 // Arm 32 bit does not produce complete exidx unwind information
1654 // so keep the .debug_frame which is relatively small and does
1655 // include needed unwind information.
1656 // See b/132992102 for details.
1657 strip: {
1658 keep_symbols_and_debug_frame: true,
1659 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001660 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001661 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001662 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001663
1664 // Leave the symbols in the shared library so that stack unwinders can produce
1665 // meaningful name resolution.
1666 strip: {
1667 keep_symbols: true,
1668 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001669
Ryan Prichard379e05f2020-04-01 20:10:07 -07001670 shared: {
1671 whole_static_libs: [ "libgcc_stripped" ],
1672 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001673 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001674 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001675 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001676 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001677 ldflags: ["-Wl,--hash-style=both"],
1678
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001679 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001680
1681 // Leave the symbols in the shared library so that stack unwinders can produce
1682 // meaningful name resolution.
1683 strip: {
1684 keep_symbols: true,
1685 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001686
Ryan Prichard379e05f2020-04-01 20:10:07 -07001687 shared: {
1688 whole_static_libs: [ "libgcc_stripped" ],
1689 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001690 },
1691 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001692 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001693
1694 // Leave the symbols in the shared library so that stack unwinders can produce
1695 // meaningful name resolution.
1696 strip: {
1697 keep_symbols: true,
1698 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001699
Ryan Prichard379e05f2020-04-01 20:10:07 -07001700 shared: {
1701 whole_static_libs: [ "libgcc_stripped" ],
1702 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001703 },
1704 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001705
1706 stubs: {
1707 symbol_file: "libc.map.txt",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001708 versions: [
1709 "29",
Jooyung Handbfa0742020-03-30 13:18:44 +09001710 "R",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001711 "10000",
1712 ],
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001713 },
Vic Yang6903fb82019-01-14 11:34:39 -08001714
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001715 apex_available: [
1716 "//apex_available:platform",
1717 "com.android.runtime",
1718 ],
1719
Vic Yang03ff4362019-06-24 16:11:37 -07001720 // Sorting bss symbols by size usually results in less dirty pages at run
1721 // time, because small symbols are grouped together.
1722 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001723}
1724
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001725genrule {
1726 name: "libc.arm.map",
1727 out: ["libc.arm.map"],
1728 srcs: ["libc.map.txt"],
1729 tool_files: [":bionic-generate-version-script"],
1730 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1731}
1732
1733genrule {
1734 name: "libc.arm64.map",
1735 out: ["libc.arm64.map"],
1736 srcs: ["libc.map.txt"],
1737 tool_files: [":bionic-generate-version-script"],
1738 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1739}
1740
1741genrule {
1742 name: "libc.x86.map",
1743 out: ["libc.x86.map"],
1744 srcs: ["libc.map.txt"],
1745 tool_files: [":bionic-generate-version-script"],
1746 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1747}
1748
1749genrule {
1750 name: "libc.x86_64.map",
1751 out: ["libc.x86_64.map"],
1752 srcs: ["libc.map.txt"],
1753 tool_files: [":bionic-generate-version-script"],
1754 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1755}
1756
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001757// Headers that only other parts of the platform can include.
1758cc_library_headers {
1759 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001760 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001761 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001762 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001763 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001764 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001765 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001766 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001767 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001768 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001769 "//system/core/debuggerd:__subpackages__",
Peter Collingbourne6e316e62020-04-07 14:09:52 -07001770 "//system/core/libunwindstack:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001771 "//system/memory/libmemunreachable:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001772 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001773 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001774 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001775 ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001776 recovery_available: true,
1777 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001778 export_include_dirs: [
1779 "platform",
1780 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001781 system_shared_libs: [],
1782 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001783 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001784
1785 apex_available: [
1786 "//apex_available:platform",
1787 "com.android.runtime",
1788 "com.android.art.release", // from libdexfile_external
1789 "com.android.art.debug", // from libdexfile_external
1790 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001791}
1792
Logan Chien17af91b2019-01-15 21:19:56 +08001793cc_library_headers {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001794 // Internal lib for use in libc_headers. Since we cannot intersect arch{}
1795 // and target{} in the same module, this one specifies the arch-dependent
1796 // include paths, and then libc_headers filters by target so that the
1797 // headers only are included for Bionic targets.
1798 name: "libc_headers_arch",
1799 visibility: ["//visibility:private"],
Logan Chien17af91b2019-01-15 21:19:56 +08001800
1801 host_supported: true,
1802 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001803 ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001804 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001805 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001806 apex_available: [
1807 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001808 "//apex_available:anyapex",
1809 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001810 // used by most APEXes indirectly via libunwind_llvm
1811 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001812
1813 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001814 stl: "none",
1815 system_shared_libs: [],
1816
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001817 // The build system generally requires that any dependencies of a target
1818 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1819 // to 1 we let targets with an sdk_version that need to depend on the libc
1820 // headers but cannot depend on libc itself due to circular dependencies
1821 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1822 // is correct because the headers can support any sdk_version.
1823 sdk_version: "1",
1824
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001825 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001826 "include",
1827 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001828 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001829 "kernel/android/uapi",
1830 ],
1831
1832 arch: {
1833 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001834 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001835 },
1836 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001837 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001838 },
Logan Chien17af91b2019-01-15 21:19:56 +08001839 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001840 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001841 },
1842 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001843 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001844 },
1845 },
1846}
1847
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001848cc_library_headers {
1849 name: "libc_headers",
1850 host_supported: true,
1851 native_bridge_supported: true,
1852 vendor_available: true,
1853 ramdisk_available: true,
1854 recovery_available: true,
1855 sdk_version: "1",
1856
1857 apex_available: [
1858 "//apex_available:platform",
1859 "//apex_available:anyapex",
1860 ],
1861 // used by most APEXes indirectly via libunwind_llvm
1862 min_sdk_version: "apex_inherit",
1863 visibility: [
1864 "//bionic:__subpackages__", // visible to bionic
1865 // ... and only to these places (b/152668052)
1866 "//external/arm-optimized-routines",
1867 "//external/gwp_asan",
1868 "//external/jemalloc_new",
1869 "//external/libunwind_llvm",
1870 "//external/scudo",
1871 "//system/core/property_service/libpropertyinfoparser",
1872 "//system/extras/toolchain-extras",
1873 // TODO(b/153662223): Clean up these users that needed visibility when
1874 // the implicit addition of system Bionic paths was removed.
1875 "//art/tools/cpp-define-generator",
1876 "//external/boringssl",
1877 "//external/minijail",
1878 ],
1879
1880 stl: "none",
1881 no_libcrt: true,
1882 system_shared_libs: [],
1883
1884 target: {
1885 android: {
1886 header_libs: ["libc_headers_arch"],
1887 export_header_lib_headers: ["libc_headers_arch"],
1888 },
1889 linux_bionic: {
1890 header_libs: ["libc_headers_arch"],
1891 export_header_lib_headers: ["libc_headers_arch"],
1892 },
1893 }
1894}
1895
Dan Willemsen208ae172015-09-16 16:33:27 -07001896// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001897// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001898// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001899
Dan Willemsen208ae172015-09-16 16:33:27 -07001900cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001901 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001902 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001903 srcs: [
1904 "bionic/__cxa_guard.cpp",
1905 "bionic/__cxa_pure_virtual.cpp",
1906 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001907 ],
1908 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001909 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001910 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001911
Dan Willemsen6b3be172018-12-03 13:57:20 -08001912 static: {
1913 system_shared_libs: [],
1914 },
1915 shared: {
1916 system_shared_libs: ["libc"],
1917 },
1918
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001919 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001920 arch: {
1921 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001922 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001923 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001924 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001925 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001926 },
1927 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001928 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001929 },
1930 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001931 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001932 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001933 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001934 },
1935 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001936 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001937 },
1938 },
1939}
1940
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001941genrule {
1942 name: "libstdc++.arm.map",
1943 out: ["libstdc++.arm.map"],
1944 srcs: ["libstdc++.map.txt"],
1945 tool_files: [":bionic-generate-version-script"],
1946 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1947}
1948
1949genrule {
1950 name: "libstdc++.arm64.map",
1951 out: ["libstdc++.arm64.map"],
1952 srcs: ["libstdc++.map.txt"],
1953 tool_files: [":bionic-generate-version-script"],
1954 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1955}
1956
1957genrule {
1958 name: "libstdc++.x86.map",
1959 out: ["libstdc++.x86.map"],
1960 srcs: ["libstdc++.map.txt"],
1961 tool_files: [":bionic-generate-version-script"],
1962 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1963}
1964
1965genrule {
1966 name: "libstdc++.x86_64.map",
1967 out: ["libstdc++.x86_64.map"],
1968 srcs: ["libstdc++.map.txt"],
1969 tool_files: [":bionic-generate-version-script"],
1970 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1971}
1972
1973// ========================================================
1974// crt object files.
1975// ========================================================
1976
Colin Cross50c21ab2015-10-31 23:03:05 -07001977cc_defaults {
1978 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001979 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001980 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001981 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001982 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001983 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001984 apex_available: [
1985 "//apex_available:platform",
1986 "//apex_available:anyapex",
1987 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001988 // crt* objects are used by most cc_binary/cc_library in "anyapex"
1989 min_sdk_version: "apex_inherit",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001990 cflags: [
1991 "-Wno-gcc-compat",
1992 "-Wall",
1993 "-Werror",
1994 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07001995 sanitize: {
1996 never: true,
1997 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001998}
1999
Colin Cross50c21ab2015-10-31 23:03:05 -07002000cc_defaults {
2001 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002002 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002003
2004 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002005 x86: {
2006 cflags: ["-fPIC"],
2007 },
2008 x86_64: {
2009 cflags: ["-fPIC"],
2010 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002011 },
Colin Crossab179442018-09-27 11:03:22 -07002012 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002013}
2014
Dan Willemsen208ae172015-09-16 16:33:27 -07002015cc_object {
2016 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002017 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002018 local_include_dirs: ["include"],
2019 product_variables: {
2020 platform_sdk_version: {
2021 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2022 },
2023 },
2024 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002025
Colin Cross7d7b3682017-11-03 13:38:40 -07002026 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002027}
2028
Dan Willemsen208ae172015-09-16 16:33:27 -07002029cc_object {
2030 name: "crtbegin_so1",
2031 local_include_dirs: ["include"],
2032 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002033
Colin Cross7d7b3682017-11-03 13:38:40 -07002034 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002035}
2036
Dan Willemsen208ae172015-09-16 16:33:27 -07002037cc_object {
2038 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002039
Colin Cross7d7b3682017-11-03 13:38:40 -07002040 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002041 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002042 "crtbegin_so1",
2043 "crtbrand",
2044 ],
2045}
2046
Dan Willemsen208ae172015-09-16 16:33:27 -07002047cc_object {
2048 name: "crtend_so",
2049 local_include_dirs: ["include"],
2050 srcs: ["arch-common/bionic/crtend_so.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_static1",
2057 local_include_dirs: ["include"],
2058 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002059 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002060}
2061
Dan Willemsen208ae172015-09-16 16:33:27 -07002062cc_object {
2063 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002064
Colin Cross77d57bf2016-04-11 14:34:18 -07002065 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002066 "crtbegin_static1",
2067 "crtbrand",
2068 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002069 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002070}
2071
Dan Willemsen208ae172015-09-16 16:33:27 -07002072cc_object {
2073 name: "crtbegin_dynamic1",
2074 local_include_dirs: ["include"],
2075 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002076 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002077}
2078
Dan Willemsen208ae172015-09-16 16:33:27 -07002079cc_object {
2080 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002081
Colin Cross77d57bf2016-04-11 14:34:18 -07002082 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002083 "crtbegin_dynamic1",
2084 "crtbrand",
2085 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002086 target: {
2087 linux_bionic: {
2088 generated_sources: ["host_bionic_linker_asm"],
2089 objs: [
2090 "linker_wrapper",
2091 ],
2092 },
2093 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002094 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002095}
2096
Dan Willemsen208ae172015-09-16 16:33:27 -07002097cc_object {
2098 // We rename crtend.o to crtend_android.o to avoid a
2099 // name clash between gcc and bionic.
2100 name: "crtend_android",
2101 local_include_dirs: ["include"],
2102 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002103
Colin Cross50c21ab2015-10-31 23:03:05 -07002104 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002105}
Colin Crossbaa48992016-07-13 11:15:21 -07002106
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002107// ========================================================
2108// NDK headers.
2109// ========================================================
2110
Dan Albert26e1c412018-05-24 14:56:46 -07002111versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002112 name: "common_libc",
2113 from: "include",
2114 to: "",
2115 license: "NOTICE",
2116}
Dan Albert4238a352016-06-28 11:18:05 -07002117
2118ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002119 name: "libc_uapi",
2120 from: "kernel/uapi",
2121 to: "",
2122 srcs: [
2123 "kernel/uapi/asm-generic/**/*.h",
2124 "kernel/uapi/drm/**/*.h",
2125 "kernel/uapi/linux/**/*.h",
2126 "kernel/uapi/misc/**/*.h",
2127 "kernel/uapi/mtd/**/*.h",
2128 "kernel/uapi/rdma/**/*.h",
2129 "kernel/uapi/scsi/**/*.h",
2130 "kernel/uapi/sound/**/*.h",
2131 "kernel/uapi/video/**/*.h",
2132 "kernel/uapi/xen/**/*.h",
2133 ],
Dan Albert92592652016-10-20 01:42:54 -07002134 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002135}
2136
2137ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002138 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002139 from: "kernel/android/uapi/linux",
2140 to: "linux",
2141 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002142 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002143}
2144
2145ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002146 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002147 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002148 to: "scsi",
2149 srcs: ["kernel/android/scsi/**/*.h"],
2150 license: "NOTICE",
2151}
2152
2153ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002154 name: "libc_asm_arm",
2155 from: "kernel/uapi/asm-arm",
2156 to: "arm-linux-androideabi",
2157 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002158 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002159}
2160
2161ndk_headers {
2162 name: "libc_asm_arm64",
2163 from: "kernel/uapi/asm-arm64",
2164 to: "aarch64-linux-android",
2165 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002166 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002167}
2168
Lazar Trsic790d2f72017-11-27 11:54:11 +01002169ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002170 name: "libc_asm_x86",
2171 from: "kernel/uapi/asm-x86",
2172 to: "i686-linux-android",
2173 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002174 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002175}
2176
2177ndk_headers {
2178 name: "libc_asm_x86_64",
2179 from: "kernel/uapi/asm-x86",
2180 to: "x86_64-linux-android",
2181 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002182 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002183}
2184
Dan Albert4238a352016-06-28 11:18:05 -07002185ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002186 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002187 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002188 symbol_file: "libc.map.txt",
2189 first_version: "9",
2190}
2191
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002192llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002193 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002194 symbol_file: "libc.map.txt",
2195 export_headers_as_system: true,
2196 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002197 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002198 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002199 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002200 "kernel/android/uapi",
2201 "kernel/uapi",
2202 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002203 arch: {
2204 arm: {
2205 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002206 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002207 ],
2208 },
2209 arm64: {
2210 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002211 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002212 ],
2213 },
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002214 x86: {
2215 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002216 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002217 ],
2218 },
2219 x86_64: {
2220 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002221 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002222 ],
2223 },
2224 },
2225}
2226
Dan Albertdf31aff2016-10-06 15:50:41 -07002227ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002228 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002229 symbol_file: "libstdc++.map.txt",
2230 first_version: "9",
2231}
2232
Dan Willemsenca056d72018-01-08 14:00:24 -08002233// Export these headers for toolbox to process
2234filegroup {
2235 name: "kernel_input_headers",
2236 srcs: [
2237 "kernel/uapi/linux/input.h",
2238 "kernel/uapi/linux/input-event-codes.h",
2239 ],
2240}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002241
2242// Generate a syscall name / number mapping. These objects are text files
2243// (thanks to the -dD -E flags) and not binary files. They will then be
2244// consumed by the genseccomp.py script and converted into C++ code.
2245cc_defaults {
2246 name: "libseccomp_gen_syscall_nrs_defaults",
2247 recovery_available: true,
2248 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2249 cflags: [
2250 "-dD",
2251 "-E",
2252 "-Wall",
2253 "-Werror",
2254 "-nostdinc",
2255 ],
2256}
2257
2258cc_object {
2259 name: "libseccomp_gen_syscall_nrs_arm",
2260 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2261 local_include_dirs: [
2262 "kernel/uapi/asm-arm",
2263 "kernel/uapi",
2264 ],
2265}
2266
2267cc_object {
2268 name: "libseccomp_gen_syscall_nrs_arm64",
2269 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2270 local_include_dirs: [
2271 "kernel/uapi/asm-arm64",
2272 "kernel/uapi",
2273 ],
2274}
2275
2276cc_object {
2277 name: "libseccomp_gen_syscall_nrs_x86",
2278 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2279 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2280 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2281 local_include_dirs: [
2282 "kernel/uapi/asm-x86",
2283 "kernel/uapi",
2284 ],
2285}
2286
2287cc_object {
2288 name: "libseccomp_gen_syscall_nrs_x86_64",
2289 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2290 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2291 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2292 local_include_dirs: [
2293 "kernel/uapi/asm-x86",
2294 "kernel/uapi",
2295 ],
2296}
2297
Elliott Hughesae03b122019-09-17 16:37:05 -07002298// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002299python_binary_host {
2300 name: "genseccomp",
2301 main: "tools/genseccomp.py",
2302
2303 srcs: [
2304 "tools/genseccomp.py",
2305 "tools/gensyscalls.py",
2306 ],
2307
2308 data: [
2309 "kernel/uapi/**/*.h",
2310 ],
2311
2312 version: {
2313 py2: {
2314 enabled: true,
2315 },
2316 py3: {
2317 enabled: false,
2318 },
2319 },
2320}
2321
Martijn Coenen0c6de752019-01-02 12:52:51 +01002322python_binary_host {
2323 name: "genfunctosyscallnrs",
2324 main: "tools/genfunctosyscallnrs.py",
2325
2326 srcs: [
2327 "tools/genseccomp.py",
2328 "tools/genfunctosyscallnrs.py",
2329 "tools/gensyscalls.py",
2330 ],
2331
2332 data: [
2333 "kernel/uapi/**/*.h",
2334 ],
2335
2336 version: {
2337 py2: {
2338 enabled: true,
2339 },
2340 py3: {
2341 enabled: false,
2342 },
2343 },
2344}
2345
2346cc_genrule {
2347 name: "func_to_syscall_nrs",
2348 recovery_available: true,
2349 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2350
2351 tools: [ "genfunctosyscallnrs" ],
2352
2353 srcs: [
2354 "SYSCALLS.TXT",
2355 ":libseccomp_gen_syscall_nrs_arm",
2356 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002357 ":libseccomp_gen_syscall_nrs_x86",
2358 ":libseccomp_gen_syscall_nrs_x86_64",
2359 ],
2360
2361 out: [
2362 "func_to_syscall_nrs.h",
2363 ],
2364}
2365
Victor Hsiehdbb86702020-06-15 09:29:07 -07002366// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002367genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002368 name: "generate_app_zygote_blocklist",
2369 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2370 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002371 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2372}
2373
2374cc_genrule {
2375 name: "libseccomp_policy_app_zygote_sources",
2376 recovery_available: true,
2377 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2378
2379 tools: [ "genseccomp" ],
2380
2381 srcs: [
2382 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002383 "SECCOMP_ALLOWLIST_COMMON.TXT",
2384 "SECCOMP_ALLOWLIST_APP.TXT",
2385 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002386 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002387 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002388 ":libseccomp_gen_syscall_nrs_arm",
2389 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002390 ":libseccomp_gen_syscall_nrs_x86",
2391 ":libseccomp_gen_syscall_nrs_x86_64",
2392 ],
2393
2394 out: [
2395 "arm64_app_zygote_policy.cpp",
2396 "arm_app_zygote_policy.cpp",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002397 "x86_64_app_zygote_policy.cpp",
2398 "x86_app_zygote_policy.cpp",
2399 ],
2400}
2401
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002402cc_genrule {
2403 name: "libseccomp_policy_app_sources",
2404 recovery_available: true,
2405 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2406
2407 tools: [ "genseccomp" ],
2408
2409 srcs: [
2410 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002411 "SECCOMP_ALLOWLIST_COMMON.TXT",
2412 "SECCOMP_ALLOWLIST_APP.TXT",
2413 "SECCOMP_BLOCKLIST_COMMON.TXT",
2414 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002415 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002416 ":libseccomp_gen_syscall_nrs_arm",
2417 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002418 ":libseccomp_gen_syscall_nrs_x86",
2419 ":libseccomp_gen_syscall_nrs_x86_64",
2420 ],
2421
2422 out: [
2423 "arm64_app_policy.cpp",
2424 "arm_app_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002425 "x86_64_app_policy.cpp",
2426 "x86_app_policy.cpp",
2427 ],
2428}
2429
2430cc_genrule {
2431 name: "libseccomp_policy_system_sources",
2432 recovery_available: true,
2433 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2434
2435 tools: [ "genseccomp" ],
2436
2437 srcs: [
2438 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002439 "SECCOMP_ALLOWLIST_COMMON.TXT",
2440 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2441 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002442 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002443 ":libseccomp_gen_syscall_nrs_arm",
2444 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002445 ":libseccomp_gen_syscall_nrs_x86",
2446 ":libseccomp_gen_syscall_nrs_x86_64",
2447 ],
2448
2449 out: [
2450 "arm64_system_policy.cpp",
2451 "arm_system_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002452 "x86_64_system_policy.cpp",
2453 "x86_system_policy.cpp",
2454 ],
2455}
2456
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002457cc_library {
2458 name: "libseccomp_policy",
2459 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002460 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002461 generated_sources: [
2462 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002463 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002464 "libseccomp_policy_system_sources",
2465 ],
2466
2467 srcs: [
2468 "seccomp/seccomp_policy.cpp",
2469 ],
2470
2471 export_include_dirs: ["seccomp/include"],
2472 cflags: [
2473 "-Wall",
2474 "-Werror",
2475 ],
2476 shared: {
2477 shared_libs: ["libbase"],
2478 },
2479 static: {
2480 static_libs: ["libbase"],
2481 },
2482}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002483
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002484subdirs = [
2485 "bionic/scudo",
2486]