blob: 5bd00c8de2afb3d2fbf7396ca5ce9fb0da3e2a02 [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 },
Yifan Hong5a39cee2020-01-21 16:43:56 -080084 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090085 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020086 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080087
Yi Konge3d90de2019-02-20 14:28:56 -080088 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
89 // warning since this is intended right now.
90 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070091
92 product_variables: {
93 experimental_mte: {
94 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
95 },
Evgenii Stepanov5a73e032020-04-29 14:59:44 -070096 malloc_zero_contents: {
97 cflags: ["-DSCUDO_ZERO_CONTENTS"],
98 },
99 malloc_pattern_fill_contents: {
100 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
101 },
Steven Morelandfb65ee42020-07-31 00:18:38 +0000102 malloc_not_svelte: {
103 cflags: ["-DUSE_SCUDO"],
104 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700105 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700106}
107
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800108libc_scudo_product_variables = {
109 malloc_not_svelte: {
110 cflags: ["-DUSE_SCUDO"],
111 whole_static_libs: ["libscudo"],
112 exclude_static_libs: [
113 "libjemalloc5",
114 "libc_jemalloc_wrapper",
115 ],
116 },
117}
118
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700119// Defaults for native allocator libs/includes to make it
120// easier to change.
Christopher Ferris062eba22020-01-31 22:40:45 -0800121// To disable scudo for the non-svelte config remove the line:
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800122// product_variables: libc_scudo_product_variables,
Christopher Ferris062eba22020-01-31 22:40:45 -0800123// in the cc_defaults below.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700124// ========================================================
125cc_defaults {
126 name: "libc_native_allocator_defaults",
127
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700128 whole_static_libs: [
129 "libjemalloc5",
130 "libc_jemalloc_wrapper",
131 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800132 header_libs: ["gwp_asan_headers"],
Christopher Ferris062eba22020-01-31 22:40:45 -0800133 product_variables: libc_scudo_product_variables,
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700134}
135
136// Functions not implemented by jemalloc directly, or that need to
137// be modified for Android.
138cc_library_static {
139 name: "libc_jemalloc_wrapper",
140 defaults: ["libc_defaults"],
141 srcs: ["bionic/jemalloc_wrapper.cpp"],
142 cflags: ["-fvisibility=hidden"],
143
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800144 // Used to pull in the jemalloc include directory so that if the
145 // library is removed, the include directory is also removed.
146 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700147}
148
Dan Willemsen208ae172015-09-16 16:33:27 -0700149// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700150// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700151// ========================================================
152//
Ryan Prichard249757b2019-11-01 17:18:28 -0700153// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
154// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
155// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
156// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700157
158cc_library_static {
159
Colin Crossa3f9fca2016-01-11 13:20:55 -0800160 srcs: [
161 "bionic/__libc_init_main_thread.cpp",
162 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700163 "bionic/bionic_call_ifunc_resolver.cpp",
164 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800165 ],
166 arch: {
167 arm64: {
168 srcs: ["arch-arm64/bionic/__set_tls.c"],
169 },
170 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700171 srcs: [
172 "arch-x86/bionic/__libc_init_sysinfo.cpp",
173 "arch-x86/bionic/__set_tls.cpp",
174 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800175 },
176 x86_64: {
177 srcs: ["arch-x86_64/bionic/__set_tls.c"],
178 },
179 },
180
Colin Cross50c21ab2015-10-31 23:03:05 -0700181 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700182 cflags: ["-fno-stack-protector", "-ffreestanding"],
183 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700184}
185
Ryan Prichard249757b2019-11-01 17:18:28 -0700186// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
187// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
188// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800189
190cc_library_static {
191 name: "libc_init_static",
192 defaults: ["libc_defaults"],
193 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700194 cflags: [
195 "-fno-stack-protector",
196
197 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
198 // from the linker before ifunc resolvers have made string.h functions available.
199 "-ffreestanding",
200 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800201}
202
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700203cc_library_static {
204 name: "libc_init_dynamic",
205 defaults: ["libc_defaults"],
206 srcs: ["bionic/libc_init_dynamic.cpp"],
207 cflags: ["-fno-stack-protector"],
208}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800209
Dan Willemsen208ae172015-09-16 16:33:27 -0700210// ========================================================
211// libc_tzcode.a - upstream 'tzcode' code
212// ========================================================
213
214cc_library_static {
215
Colin Cross50c21ab2015-10-31 23:03:05 -0700216 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700217 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800218 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700219 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700220 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
221 ],
222
Colin Cross50c21ab2015-10-31 23:03:05 -0700223 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700224 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700225 // Don't use ridiculous amounts of stack.
226 "-DALL_STATE",
227 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
228 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800229 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700230 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700231 // The name of the tm_gmtoff field in our struct tm.
232 "-DTM_GMTOFF=tm_gmtoff",
233 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700234 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700235 // Include `tzname`, `timezone`, and `daylight` globals.
236 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700237 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800238 // Use the empty string (instead of " ") as the timezone abbreviation
239 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700240 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700241 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
242 "-Dlint",
243 ],
244
Dan Willemsen208ae172015-09-16 16:33:27 -0700245 local_include_dirs: ["tzcode/"],
246 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700247}
248
249// ========================================================
250// libc_dns.a - modified NetBSD DNS code
251// ========================================================
252
253cc_library_static {
254
Colin Cross50c21ab2015-10-31 23:03:05 -0700255 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700256 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800257 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700258
259 "upstream-netbsd/lib/libc/isc/ev_streams.c",
260 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700261 ],
262
Colin Cross50c21ab2015-10-31 23:03:05 -0700263 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700264 "-DANDROID_CHANGES",
265 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700266 "-Wno-unused-parameter",
267 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700268 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700269 ],
270
Dan Willemsen208ae172015-09-16 16:33:27 -0700271 local_include_dirs: [
272 "dns/include",
273 "private",
274 "upstream-netbsd/lib/libc/include",
275 "upstream-netbsd/android/include",
276 ],
277
278 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700279}
280
281// ========================================================
282// libc_freebsd.a - upstream FreeBSD C library code
283// ========================================================
284//
285// These files are built with the freebsd-compat.h header file
286// automatically included.
287
288cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700289 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700290 srcs: [
291 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700292 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700293 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
294 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
295 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
296 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700297 "upstream-freebsd/lib/libc/stdlib/qsort.c",
298 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700299 "upstream-freebsd/lib/libc/string/wcpcpy.c",
300 "upstream-freebsd/lib/libc/string/wcpncpy.c",
301 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700302 "upstream-freebsd/lib/libc/string/wcscat.c",
303 "upstream-freebsd/lib/libc/string/wcschr.c",
304 "upstream-freebsd/lib/libc/string/wcscmp.c",
305 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700306 "upstream-freebsd/lib/libc/string/wcscspn.c",
307 "upstream-freebsd/lib/libc/string/wcsdup.c",
308 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700309 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700310 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
311 "upstream-freebsd/lib/libc/string/wcsncat.c",
312 "upstream-freebsd/lib/libc/string/wcsncmp.c",
313 "upstream-freebsd/lib/libc/string/wcsncpy.c",
314 "upstream-freebsd/lib/libc/string/wcsnlen.c",
315 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700316 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700317 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700318 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700319 "upstream-freebsd/lib/libc/string/wcstok.c",
320 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700321 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700322 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700323 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800324 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700325 ],
326 arch: {
327 arm64: {
328 exclude_srcs: [
329 "upstream-freebsd/lib/libc/string/wmemmove.c",
330 ],
331 },
332 x86: {
333 exclude_srcs: [
334 "upstream-freebsd/lib/libc/string/wcschr.c",
335 "upstream-freebsd/lib/libc/string/wcscmp.c",
336 "upstream-freebsd/lib/libc/string/wcslen.c",
337 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700338 "upstream-freebsd/lib/libc/string/wmemcmp.c",
339 "upstream-freebsd/lib/libc/string/wcscat.c",
340 "upstream-freebsd/lib/libc/string/wcscpy.c",
341 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530342 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700343 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700344 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700345 },
346
Colin Cross50c21ab2015-10-31 23:03:05 -0700347 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700348 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700349 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700350 "-include freebsd-compat.h",
351 ],
352
Dan Willemsen208ae172015-09-16 16:33:27 -0700353 local_include_dirs: [
354 "upstream-freebsd/android/include",
355 ],
356
357 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700358}
359
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700360cc_library_static {
361 defaults: ["libc_defaults"],
362 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700363 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700364 ],
365
366 cflags: [
367 "-Wno-sign-compare",
368 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700369 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700370 ],
371
372 local_include_dirs: [
373 "upstream-freebsd/android/include",
374 ],
375
376 name: "libc_freebsd_large_stack",
377}
378
Dan Willemsen208ae172015-09-16 16:33:27 -0700379// ========================================================
380// libc_netbsd.a - upstream NetBSD C library code
381// ========================================================
382//
383// These files are built with the netbsd-compat.h header file
384// automatically included.
385
386cc_library_static {
387
Colin Cross50c21ab2015-10-31 23:03:05 -0700388 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700389 srcs: [
390 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700391 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700392 "upstream-netbsd/lib/libc/gen/psignal.c",
393 "upstream-netbsd/lib/libc/gen/utime.c",
394 "upstream-netbsd/lib/libc/gen/utmp.c",
395 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
396 "upstream-netbsd/lib/libc/regex/regcomp.c",
397 "upstream-netbsd/lib/libc/regex/regerror.c",
398 "upstream-netbsd/lib/libc/regex/regexec.c",
399 "upstream-netbsd/lib/libc/regex/regfree.c",
400 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700401 "upstream-netbsd/lib/libc/stdlib/drand48.c",
402 "upstream-netbsd/lib/libc/stdlib/erand48.c",
403 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
404 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700405 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
406 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
407 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
408 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
409 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
410 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
411 "upstream-netbsd/lib/libc/stdlib/seed48.c",
412 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700413 ],
414 multilib: {
415 lib32: {
416 // LP32 cruft
417 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
418 },
419 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700420 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700421 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800422 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700423 "-DPOSIX_MISTAKE",
424 "-include netbsd-compat.h",
425 ],
426
Dan Willemsen208ae172015-09-16 16:33:27 -0700427 local_include_dirs: [
428 "upstream-netbsd/android/include",
429 "upstream-netbsd/lib/libc/include",
430 ],
431
432 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700433}
434
435// ========================================================
436// libc_openbsd_ndk.a - upstream OpenBSD C library code
437// that can be safely included in the libc_ndk.a (doesn't
438// contain any troublesome global data or constructors).
439// ========================================================
440//
441// These files are built with the openbsd-compat.h header file
442// automatically included.
443
444cc_library_static {
445 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700446 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700447 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700448 "upstream-openbsd/lib/libc/gen/alarm.c",
449 "upstream-openbsd/lib/libc/gen/ctype_.c",
450 "upstream-openbsd/lib/libc/gen/daemon.c",
451 "upstream-openbsd/lib/libc/gen/err.c",
452 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700453 "upstream-openbsd/lib/libc/gen/fnmatch.c",
454 "upstream-openbsd/lib/libc/gen/ftok.c",
455 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700456 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700457 "upstream-openbsd/lib/libc/gen/verr.c",
458 "upstream-openbsd/lib/libc/gen/verrx.c",
459 "upstream-openbsd/lib/libc/gen/vwarn.c",
460 "upstream-openbsd/lib/libc/gen/vwarnx.c",
461 "upstream-openbsd/lib/libc/gen/warn.c",
462 "upstream-openbsd/lib/libc/gen/warnx.c",
463 "upstream-openbsd/lib/libc/locale/btowc.c",
464 "upstream-openbsd/lib/libc/locale/mbrlen.c",
465 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
466 "upstream-openbsd/lib/libc/locale/mbtowc.c",
467 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700468 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
469 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700470 "upstream-openbsd/lib/libc/locale/wcstoll.c",
471 "upstream-openbsd/lib/libc/locale/wcstombs.c",
472 "upstream-openbsd/lib/libc/locale/wcstoul.c",
473 "upstream-openbsd/lib/libc/locale/wcstoull.c",
474 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
475 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
476 "upstream-openbsd/lib/libc/locale/wctob.c",
477 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700478 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700479 "upstream-openbsd/lib/libc/net/htonl.c",
480 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700481 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
482 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
483 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700484 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
485 "upstream-openbsd/lib/libc/net/inet_ntop.c",
486 "upstream-openbsd/lib/libc/net/inet_pton.c",
487 "upstream-openbsd/lib/libc/net/ntohl.c",
488 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800489 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700490 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700491 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
492 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700493 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700494 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700495 "upstream-openbsd/lib/libc/stdio/fputwc.c",
496 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700497 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700498 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700500 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700501 "upstream-openbsd/lib/libc/stdio/makebuf.c",
502 "upstream-openbsd/lib/libc/stdio/mktemp.c",
503 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
504 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700505 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700506 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700507 "upstream-openbsd/lib/libc/stdio/tempnam.c",
508 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
509 "upstream-openbsd/lib/libc/stdio/ungetc.c",
510 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
511 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
512 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700513 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
514 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
515 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700516 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700517 "upstream-openbsd/lib/libc/stdio/wsetup.c",
518 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800519 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700520 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700521 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700522 "upstream-openbsd/lib/libc/stdlib/insque.c",
523 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
524 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
525 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800526 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700527 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800528 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700529 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughes26b06072020-07-31 11:00:10 -0700530 "upstream-openbsd/lib/libc/stdlib/recallocarray.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_time_conversions.cpp",
1016 "bionic/brk.cpp",
1017 "bionic/c16rtomb.cpp",
1018 "bionic/c32rtomb.cpp",
1019 "bionic/chmod.cpp",
1020 "bionic/chown.cpp",
1021 "bionic/clearenv.cpp",
1022 "bionic/clock.cpp",
1023 "bionic/clock_getcpuclockid.cpp",
1024 "bionic/clock_nanosleep.cpp",
1025 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001026 "bionic/ctype.cpp",
1027 "bionic/dirent.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001028 "bionic/dup.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001029 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001030 "bionic/error.cpp",
Josh Gao7de41242020-04-29 17:08:46 -07001031 "bionic/eventfd.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001032 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001033 "bionic/faccessat.cpp",
1034 "bionic/fchmod.cpp",
1035 "bionic/fchmodat.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001036 "bionic/fcntl.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001037 "bionic/fdsan.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001038 "bionic/fdtrack.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001039 "bionic/ffs.cpp",
1040 "bionic/fgetxattr.cpp",
1041 "bionic/flistxattr.cpp",
1042 "bionic/flockfile.cpp",
1043 "bionic/fpclassify.cpp",
1044 "bionic/fsetxattr.cpp",
1045 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001046 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001047 "bionic/futimens.cpp",
1048 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001049 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001050 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001051 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001052 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001053 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001054 "bionic/getpgrp.cpp",
1055 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001056 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001057 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001058 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001059 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001060 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001061 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001062 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001063 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001064 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001065 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001066 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001067 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001068 "bionic/lchown.cpp",
1069 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001070 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001071 "bionic/libgen.cpp",
1072 "bionic/link.cpp",
1073 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001074 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001075 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001076 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001077 "bionic/mbrtoc16.cpp",
1078 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001079 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001080 "bionic/mempcpy.cpp",
1081 "bionic/mkdir.cpp",
1082 "bionic/mkfifo.cpp",
1083 "bionic/mknod.cpp",
1084 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001085 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001086 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001087 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001088 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001089 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001090 "bionic/open.cpp",
1091 "bionic/pathconf.cpp",
1092 "bionic/pause.cpp",
1093 "bionic/pipe.cpp",
1094 "bionic/poll.cpp",
1095 "bionic/posix_fadvise.cpp",
1096 "bionic/posix_fallocate.cpp",
1097 "bionic/posix_madvise.cpp",
1098 "bionic/posix_timers.cpp",
1099 "bionic/ptrace.cpp",
1100 "bionic/pty.cpp",
1101 "bionic/raise.cpp",
1102 "bionic/rand.cpp",
1103 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001104 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001105 "bionic/reboot.cpp",
1106 "bionic/recv.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001107 "bionic/recvmsg.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001108 "bionic/rename.cpp",
1109 "bionic/rmdir.cpp",
1110 "bionic/scandir.cpp",
1111 "bionic/sched_getaffinity.cpp",
1112 "bionic/sched_getcpu.cpp",
1113 "bionic/semaphore.cpp",
1114 "bionic/send.cpp",
1115 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001116 "bionic/seteuid.cpp",
1117 "bionic/setpgrp.cpp",
1118 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001119 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001120 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001121 "bionic/sleep.cpp",
Josh Gaob107eab2020-04-29 17:17:56 -07001122 "bionic/socketpair.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001123 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001124 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001125 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001126 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001127 "bionic/string_l.cpp",
1128 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001129 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001130 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001131 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001132 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001133 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001134 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001135 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001136 "bionic/sys_msg.cpp",
1137 "bionic/sys_sem.cpp",
1138 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001139 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001140 "bionic/sys_statfs.cpp",
1141 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001142 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001143 "bionic/sysinfo.cpp",
1144 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001145 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001146 "bionic/system_property_api.cpp",
1147 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001148 "bionic/tdestroy.cpp",
1149 "bionic/termios.cpp",
1150 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001151 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001152 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001153 "bionic/tmpfile.cpp",
1154 "bionic/umount.cpp",
1155 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001156 "bionic/usleep.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001157 "bionic/wait.cpp",
1158 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001159 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001160 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001161 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001162 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001163 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001164
1165 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1166 // which will be overridden by the actual one in libc.so.
1167 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001168 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001169
Dan Willemsen208ae172015-09-16 16:33:27 -07001170 multilib: {
1171 lib32: {
1172 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001173 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001174 },
1175 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001176 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001177 treble_linker_namespaces: {
1178 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001179 },
1180 },
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001181 whole_static_libs: [
1182 "libc_bionic_systrace",
1183 "libsystemproperties",
1184 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001185 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001186 local_include_dirs: ["stdio"],
1187 include_dirs: ["bionic/libstdc++/include"],
1188 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001189 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001190}
1191
Dan Willemsen208ae172015-09-16 16:33:27 -07001192// ========================================================
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001193// libc_bionic_systrace.a
1194// ========================================================
1195
1196cc_library_static {
1197 name: "libc_bionic_systrace",
1198 defaults: ["libc_defaults"],
1199 srcs: [
1200 "bionic/bionic_systrace.cpp",
1201 ],
1202 apex_available: [
1203 "com.android.runtime",
1204 ],
1205}
1206
1207// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001208// libc_pthread.a - pthreads parts that previously lived in
1209// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001210// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001211// pthread_t has changed over the years and has ABI
1212// compatibility issues).
1213// ========================================================
1214
1215cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001216 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001217 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001218 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001219 "bionic/pthread_atfork.cpp",
1220 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001221 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001222 "bionic/pthread_cond.cpp",
1223 "bionic/pthread_create.cpp",
1224 "bionic/pthread_detach.cpp",
1225 "bionic/pthread_equal.cpp",
1226 "bionic/pthread_exit.cpp",
1227 "bionic/pthread_getcpuclockid.cpp",
1228 "bionic/pthread_getschedparam.cpp",
1229 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001230 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001231 "bionic/pthread_join.cpp",
1232 "bionic/pthread_key.cpp",
1233 "bionic/pthread_kill.cpp",
1234 "bionic/pthread_mutex.cpp",
1235 "bionic/pthread_once.cpp",
1236 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001237 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001238 "bionic/pthread_self.cpp",
1239 "bionic/pthread_setname_np.cpp",
1240 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001241 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001242
1243 // The following implementations depend on pthread data or implementation,
1244 // so we can't include them in libc_ndk.a.
1245 "bionic/__cxa_thread_atexit_impl.cpp",
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001246 "bionic/android_unsafe_frame_pointer_chase.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -08001247 "bionic/atexit.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001248 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001249 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001250
Colin Cross50c21ab2015-10-31 23:03:05 -07001251 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001252 include_dirs: ["bionic/libstdc++/include"],
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001253 header_libs: ["bionic_libc_platform_headers"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001254 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001255}
1256
1257// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001258// libc_syscalls.a
1259// ========================================================
1260
Elliott Hughes782c4852019-04-16 12:31:00 -07001261genrule {
1262 name: "syscalls-arm.S",
1263 out: ["syscalls-arm.S"],
1264 srcs: ["SYSCALLS.TXT"],
1265 tool_files: [":bionic-gensyscalls"],
1266 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1267}
1268
1269genrule {
1270 name: "syscalls-arm64.S",
1271 out: ["syscalls-arm64.S"],
1272 srcs: ["SYSCALLS.TXT"],
1273 tool_files: [":bionic-gensyscalls"],
1274 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1275}
1276
1277genrule {
1278 name: "syscalls-x86.S",
1279 out: ["syscalls-x86.S"],
1280 srcs: ["SYSCALLS.TXT"],
1281 tool_files: [":bionic-gensyscalls"],
1282 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1283}
1284
1285genrule {
1286 name: "syscalls-x86_64.S",
1287 out: ["syscalls-x86_64.S"],
1288 srcs: ["SYSCALLS.TXT"],
1289 tool_files: [":bionic-gensyscalls"],
1290 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1291}
1292
Dan Willemsen208ae172015-09-16 16:33:27 -07001293cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001294 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001295 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001296 arch: {
1297 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001298 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001299 },
1300 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001301 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001302 },
1303 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001304 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001305 },
1306 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001307 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001308 },
1309 },
1310 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001311}
1312
1313// ========================================================
1314// libc_aeabi.a
1315// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1316// to avoid infinite recursion. For the other architectures we just build an
1317// empty library to keep this makefile simple.
1318// ========================================================
1319
1320cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001321 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001322 arch: {
1323 arm: {
1324 srcs: ["arch-arm/bionic/__aeabi.c"],
1325 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001326 },
1327 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001328 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001329}
1330
1331// ========================================================
1332// libc_ndk.a
1333// Compatibility library for the NDK. This library contains
1334// all the parts of libc that are safe to statically link.
1335// We can't safely statically link things that can only run
1336// on a certain version of the OS. Examples include
1337// anything that talks to netd (a large portion of the DNS
1338// code) and anything that is dependent on the layout of a
1339// data structure that has changed across releases (such as
1340// pthread_t).
1341// ========================================================
1342
1343cc_library_static {
1344 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001345 defaults: [
1346 "libc_defaults",
1347 "libc_native_allocator_defaults",
1348 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -08001349 ramdisk_available: false,
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001350 srcs: libc_common_src_files + [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001351 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001352 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001353 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001354 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001355 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001356 multilib: {
1357 lib32: {
1358 srcs: libc_common_src_files_32,
1359 },
1360 },
1361 arch: {
1362 arm: {
1363 srcs: [
1364 "arch-arm/bionic/exidx_dynamic.c",
1365 "arch-common/bionic/crtbegin_so.c",
1366 "arch-arm/bionic/atexit_legacy.c",
1367 "arch-common/bionic/crtend_so.S",
1368 ],
1369 whole_static_libs: ["libc_aeabi"],
1370 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001371 },
1372
Colin Cross50c21ab2015-10-31 23:03:05 -07001373 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001374 "-fvisibility=hidden",
1375 "-DLIBC_STATIC",
1376 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001377
1378 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001379 "gwp_asan",
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001380 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001381 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001382 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001383 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001384 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001385 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001386 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001387 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001388 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001389 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001390 "libc_syscalls",
1391 "libc_tzcode",
1392 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001393 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001394 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001395}
1396
1397// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001398// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001399// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001400cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001401 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001402 srcs: libc_common_src_files,
1403 multilib: {
1404 lib32: {
1405 srcs: libc_common_src_files_32,
1406 },
1407 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001408 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001409
1410 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001411 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001412 "libc_bionic",
1413 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001414 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001415 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001416 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001417 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001418 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001419 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001420 "libc_netbsd",
1421 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001422 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001423 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001424 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001425 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001426 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001427 ],
1428
1429 arch: {
1430 arm: {
1431 whole_static_libs: ["libc_aeabi"],
1432 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001433 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001434}
1435
1436// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001437// libc_common.a
1438// ========================================================
1439
1440cc_library_static {
1441 defaults: ["libc_defaults"],
1442 name: "libc_common",
1443
1444 whole_static_libs: [
1445 "libc_nopthread",
1446 "libc_pthread",
1447 ],
1448}
1449
1450// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001451// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001452// ========================================================
1453cc_library_static {
1454 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001455 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001456
Haibo Huangb9244ff2018-08-11 10:12:13 -07001457 arch: {
1458 x86: {
1459 srcs: ["arch-x86/static_function_dispatch.S"],
1460 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001461 arm: {
1462 srcs: ["arch-arm/static_function_dispatch.S"],
1463 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001464 arm64: {
1465 srcs: ["arch-arm64/static_function_dispatch.S"],
1466 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001467 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001468}
1469
1470// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001471// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001472// ========================================================
1473cc_library_static {
1474 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001475 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001476
Haibo Huangb9244ff2018-08-11 10:12:13 -07001477 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001478 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001479 "-fno-stack-protector",
1480 "-fno-jump-tables",
1481 ],
1482 arch: {
1483 x86: {
1484 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1485 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001486 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001487 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001488 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001489 arm64: {
1490 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1491 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001492 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001493}
1494
1495// ========================================================
1496// libc_common_static.a For static binaries.
1497// ========================================================
1498cc_library_static {
1499 defaults: ["libc_defaults"],
1500 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001501
Haibo Huangf71edfa2018-11-12 10:06:56 -08001502 whole_static_libs: [
1503 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001504 "libc_static_dispatch",
1505 ],
1506}
1507
1508// ========================================================
1509// libc_common_shared.a For shared libraries.
1510// ========================================================
1511cc_library_static {
1512 defaults: ["libc_defaults"],
1513 name: "libc_common_shared",
1514
1515 whole_static_libs: [
1516 "libc_common",
1517 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001518 ],
1519}
1520
Ryan Prichard22a6a052019-10-10 23:59:30 -07001521// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1522// executable.
1523cc_library_static {
1524 name: "libc_unwind_static",
1525 defaults: ["libc_defaults"],
1526 cflags: ["-DLIBC_STATIC"],
1527
1528 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1529 arch: {
1530 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1531 arm: {
1532 srcs: ["arch-arm/bionic/exidx_static.c"],
1533 },
1534 },
1535}
1536
Haibo Huangf71edfa2018-11-12 10:06:56 -08001537// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001538// libc_nomalloc.a
1539// ========================================================
1540//
Ryan Prichard249757b2019-11-01 17:18:28 -07001541// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1542// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1543// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001544
1545cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001546 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001547 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001548
Colin Crossa3f9fca2016-01-11 13:20:55 -08001549 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001550 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001551 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001552 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001553 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001554}
1555
dimitryc0c0ef62018-12-05 16:33:52 +01001556filegroup {
1557 name: "libc_sources_shared",
1558 srcs: [
1559 "arch-common/bionic/crtbegin_so.c",
1560 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001561 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001562 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001563 "bionic/icu.cpp",
1564 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001565 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001566 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001567 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001568 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001569 "bionic/ndk_cruft.cpp",
1570 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001571 "bionic/NetdClient.cpp",
1572 "arch-common/bionic/crtend_so.S",
1573 ],
1574}
1575
1576filegroup {
1577 name: "libc_sources_static",
1578 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001579 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001580 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001581 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001582 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001583 ],
1584}
1585
1586filegroup {
1587 name: "libc_sources_shared_arm",
1588 srcs: [
1589 "arch-arm/bionic/exidx_dynamic.c",
1590 "arch-arm/bionic/atexit_legacy.c",
1591 ],
1592}
1593
Dan Willemsen208ae172015-09-16 16:33:27 -07001594// ========================================================
1595// libc.a + libc.so
1596// ========================================================
1597cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001598 defaults: [
1599 "libc_defaults",
1600 "libc_native_allocator_defaults",
1601 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001602 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001603 static_ndk_lib: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001604 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001605 platform_sdk_version: {
1606 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1607 },
1608 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001609 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001610 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001611 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001612 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001613 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001614 "libc_init_static",
1615 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001616 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001617 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001618 },
1619 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001620 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001621 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001622 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001623 "libc_init_dynamic",
1624 "libc_common_shared",
1625 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001626 },
1627
Neil Fullera7db90f2019-04-25 09:28:27 +01001628 required: [
1629 "tzdata",
1630 "tz_version", // Version metadata for tzdata to help debugging.
1631 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001632
Colin Cross4ce94d22016-11-15 13:15:43 -08001633 // Do not pack libc.so relocations; see http://b/20645321 for details.
1634 pack_relocations: false,
1635
dimitry06016f22018-01-05 11:39:28 +01001636 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1637 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1638 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1639 // those new libraries from libgcc.a are not declared external; if that were the case,
1640 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1641 // on the external symbols from the dependent libraries. That would create a "cloaked"
1642 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001643
dimitry06016f22018-01-05 11:39:28 +01001644 shared_libs: [
1645 "ld-android",
1646 "libdl",
1647 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001648 static_libs: [
1649 "libdl_android",
1650 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001651
1652 nocrt: true,
1653
Dan Willemsen208ae172015-09-16 16:33:27 -07001654 arch: {
1655 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001656 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001657 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001658 ldflags: ["-Wl,--hash-style=both"],
1659
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001660 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001661
Dan Willemsen208ae172015-09-16 16:33:27 -07001662 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001663 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001664 // special for arm
1665 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichard379e05f2020-04-01 20:10:07 -07001666
1667 whole_static_libs: [ "libunwind_llvm" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001668 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001669
1670 // Arm 32 bit does not produce complete exidx unwind information
1671 // so keep the .debug_frame which is relatively small and does
1672 // include needed unwind information.
1673 // See b/132992102 for details.
1674 strip: {
1675 keep_symbols_and_debug_frame: true,
1676 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001677 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001678 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001679 version_script: ":libc.arm64.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 Willemsen9e6f98f2015-11-03 14:30:57 -08001690 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001691 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001692 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001693 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001694 ldflags: ["-Wl,--hash-style=both"],
1695
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001696 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001697
1698 // Leave the symbols in the shared library so that stack unwinders can produce
1699 // meaningful name resolution.
1700 strip: {
1701 keep_symbols: true,
1702 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001703
Ryan Prichard379e05f2020-04-01 20:10:07 -07001704 shared: {
1705 whole_static_libs: [ "libgcc_stripped" ],
1706 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001707 },
1708 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001709 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001710
1711 // Leave the symbols in the shared library so that stack unwinders can produce
1712 // meaningful name resolution.
1713 strip: {
1714 keep_symbols: true,
1715 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001716
Ryan Prichard379e05f2020-04-01 20:10:07 -07001717 shared: {
1718 whole_static_libs: [ "libgcc_stripped" ],
1719 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001720 },
1721 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001722
1723 stubs: {
1724 symbol_file: "libc.map.txt",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001725 versions: [
1726 "29",
Jooyung Handbfa0742020-03-30 13:18:44 +09001727 "R",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001728 "10000",
1729 ],
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001730 },
Vic Yang6903fb82019-01-14 11:34:39 -08001731
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001732 apex_available: [
1733 "//apex_available:platform",
1734 "com.android.runtime",
1735 ],
1736
Vic Yang03ff4362019-06-24 16:11:37 -07001737 // Sorting bss symbols by size usually results in less dirty pages at run
1738 // time, because small symbols are grouped together.
1739 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001740}
1741
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001742genrule {
1743 name: "libc.arm.map",
1744 out: ["libc.arm.map"],
1745 srcs: ["libc.map.txt"],
1746 tool_files: [":bionic-generate-version-script"],
1747 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1748}
1749
1750genrule {
1751 name: "libc.arm64.map",
1752 out: ["libc.arm64.map"],
1753 srcs: ["libc.map.txt"],
1754 tool_files: [":bionic-generate-version-script"],
1755 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1756}
1757
1758genrule {
1759 name: "libc.x86.map",
1760 out: ["libc.x86.map"],
1761 srcs: ["libc.map.txt"],
1762 tool_files: [":bionic-generate-version-script"],
1763 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1764}
1765
1766genrule {
1767 name: "libc.x86_64.map",
1768 out: ["libc.x86_64.map"],
1769 srcs: ["libc.map.txt"],
1770 tool_files: [":bionic-generate-version-script"],
1771 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1772}
1773
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001774// Headers that only other parts of the platform can include.
1775cc_library_headers {
1776 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001777 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001778 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001779 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001780 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001781 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001782 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001783 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001784 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001785 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001786 "//system/core/debuggerd:__subpackages__",
Peter Collingbourne6e316e62020-04-07 14:09:52 -07001787 "//system/core/libunwindstack:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001788 "//system/memory/libmemunreachable:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001789 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001790 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001791 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001792 ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001793 recovery_available: true,
1794 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001795 export_include_dirs: [
1796 "platform",
1797 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001798 system_shared_libs: [],
1799 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001800 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001801
1802 apex_available: [
1803 "//apex_available:platform",
1804 "com.android.runtime",
1805 "com.android.art.release", // from libdexfile_external
1806 "com.android.art.debug", // from libdexfile_external
1807 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001808}
1809
Logan Chien17af91b2019-01-15 21:19:56 +08001810cc_library_headers {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001811 // Internal lib for use in libc_headers. Since we cannot intersect arch{}
1812 // and target{} in the same module, this one specifies the arch-dependent
1813 // include paths, and then libc_headers filters by target so that the
1814 // headers only are included for Bionic targets.
1815 name: "libc_headers_arch",
1816 visibility: ["//visibility:private"],
Logan Chien17af91b2019-01-15 21:19:56 +08001817
1818 host_supported: true,
1819 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001820 ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001821 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001822 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001823 apex_available: [
1824 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001825 "//apex_available:anyapex",
1826 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001827 // used by most APEXes indirectly via libunwind_llvm
1828 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001829
1830 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001831 stl: "none",
1832 system_shared_libs: [],
1833
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001834 // The build system generally requires that any dependencies of a target
1835 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1836 // to 1 we let targets with an sdk_version that need to depend on the libc
1837 // headers but cannot depend on libc itself due to circular dependencies
1838 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1839 // is correct because the headers can support any sdk_version.
1840 sdk_version: "1",
1841
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001842 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001843 "include",
1844 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001845 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001846 "kernel/android/uapi",
1847 ],
1848
1849 arch: {
1850 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001851 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001852 },
1853 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001854 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001855 },
Logan Chien17af91b2019-01-15 21:19:56 +08001856 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001857 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001858 },
1859 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001860 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001861 },
1862 },
1863}
1864
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001865cc_library_headers {
1866 name: "libc_headers",
1867 host_supported: true,
1868 native_bridge_supported: true,
1869 vendor_available: true,
1870 ramdisk_available: true,
1871 recovery_available: true,
1872 sdk_version: "1",
1873
1874 apex_available: [
1875 "//apex_available:platform",
1876 "//apex_available:anyapex",
1877 ],
1878 // used by most APEXes indirectly via libunwind_llvm
1879 min_sdk_version: "apex_inherit",
1880 visibility: [
1881 "//bionic:__subpackages__", // visible to bionic
1882 // ... and only to these places (b/152668052)
1883 "//external/arm-optimized-routines",
1884 "//external/gwp_asan",
1885 "//external/jemalloc_new",
1886 "//external/libunwind_llvm",
1887 "//external/scudo",
1888 "//system/core/property_service/libpropertyinfoparser",
1889 "//system/extras/toolchain-extras",
1890 // TODO(b/153662223): Clean up these users that needed visibility when
1891 // the implicit addition of system Bionic paths was removed.
1892 "//art/tools/cpp-define-generator",
1893 "//external/boringssl",
1894 "//external/minijail",
1895 ],
1896
1897 stl: "none",
1898 no_libcrt: true,
1899 system_shared_libs: [],
1900
1901 target: {
1902 android: {
1903 header_libs: ["libc_headers_arch"],
1904 export_header_lib_headers: ["libc_headers_arch"],
1905 },
1906 linux_bionic: {
1907 header_libs: ["libc_headers_arch"],
1908 export_header_lib_headers: ["libc_headers_arch"],
1909 },
1910 }
1911}
1912
Dan Willemsen208ae172015-09-16 16:33:27 -07001913// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001914// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001915// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001916
Dan Willemsen208ae172015-09-16 16:33:27 -07001917cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001918 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001919 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001920 srcs: [
1921 "bionic/__cxa_guard.cpp",
1922 "bionic/__cxa_pure_virtual.cpp",
1923 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001924 ],
1925 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001926 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001927 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001928
Dan Willemsen6b3be172018-12-03 13:57:20 -08001929 static: {
1930 system_shared_libs: [],
1931 },
1932 shared: {
1933 system_shared_libs: ["libc"],
1934 },
1935
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001936 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001937 arch: {
1938 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001939 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001940 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001941 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001942 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001943 },
1944 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001945 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001946 },
1947 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001948 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001949 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001950 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001951 },
1952 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001953 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001954 },
1955 },
1956}
1957
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001958genrule {
1959 name: "libstdc++.arm.map",
1960 out: ["libstdc++.arm.map"],
1961 srcs: ["libstdc++.map.txt"],
1962 tool_files: [":bionic-generate-version-script"],
1963 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1964}
1965
1966genrule {
1967 name: "libstdc++.arm64.map",
1968 out: ["libstdc++.arm64.map"],
1969 srcs: ["libstdc++.map.txt"],
1970 tool_files: [":bionic-generate-version-script"],
1971 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1972}
1973
1974genrule {
1975 name: "libstdc++.x86.map",
1976 out: ["libstdc++.x86.map"],
1977 srcs: ["libstdc++.map.txt"],
1978 tool_files: [":bionic-generate-version-script"],
1979 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1980}
1981
1982genrule {
1983 name: "libstdc++.x86_64.map",
1984 out: ["libstdc++.x86_64.map"],
1985 srcs: ["libstdc++.map.txt"],
1986 tool_files: [":bionic-generate-version-script"],
1987 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1988}
1989
1990// ========================================================
1991// crt object files.
1992// ========================================================
1993
Colin Cross50c21ab2015-10-31 23:03:05 -07001994cc_defaults {
1995 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001996 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001997 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001998 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001999 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002000 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002001 apex_available: [
2002 "//apex_available:platform",
2003 "//apex_available:anyapex",
2004 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09002005 // crt* objects are used by most cc_binary/cc_library in "anyapex"
2006 min_sdk_version: "apex_inherit",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002007 cflags: [
2008 "-Wno-gcc-compat",
2009 "-Wall",
2010 "-Werror",
2011 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002012 sanitize: {
2013 never: true,
2014 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002015}
2016
Colin Cross50c21ab2015-10-31 23:03:05 -07002017cc_defaults {
2018 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002019 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002020
2021 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002022 x86: {
2023 cflags: ["-fPIC"],
2024 },
2025 x86_64: {
2026 cflags: ["-fPIC"],
2027 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002028 },
Colin Crossab179442018-09-27 11:03:22 -07002029 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002030}
2031
Dan Willemsen208ae172015-09-16 16:33:27 -07002032cc_object {
2033 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002034 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002035 local_include_dirs: ["include"],
2036 product_variables: {
2037 platform_sdk_version: {
2038 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2039 },
2040 },
2041 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002042
Colin Cross7d7b3682017-11-03 13:38:40 -07002043 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002044}
2045
Dan Willemsen208ae172015-09-16 16:33:27 -07002046cc_object {
2047 name: "crtbegin_so1",
2048 local_include_dirs: ["include"],
2049 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002050
Colin Cross7d7b3682017-11-03 13:38:40 -07002051 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002052}
2053
Dan Willemsen208ae172015-09-16 16:33:27 -07002054cc_object {
2055 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002056
Colin Cross7d7b3682017-11-03 13:38:40 -07002057 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002058 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002059 "crtbegin_so1",
2060 "crtbrand",
2061 ],
2062}
2063
Dan Willemsen208ae172015-09-16 16:33:27 -07002064cc_object {
2065 name: "crtend_so",
2066 local_include_dirs: ["include"],
2067 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002068
Colin Cross7d7b3682017-11-03 13:38:40 -07002069 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002070}
2071
Dan Willemsen208ae172015-09-16 16:33:27 -07002072cc_object {
2073 name: "crtbegin_static1",
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_static",
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_static1",
2084 "crtbrand",
2085 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002086 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002087}
2088
Dan Willemsen208ae172015-09-16 16:33:27 -07002089cc_object {
2090 name: "crtbegin_dynamic1",
2091 local_include_dirs: ["include"],
2092 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002093 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002094}
2095
Dan Willemsen208ae172015-09-16 16:33:27 -07002096cc_object {
2097 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002098
Colin Cross77d57bf2016-04-11 14:34:18 -07002099 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002100 "crtbegin_dynamic1",
2101 "crtbrand",
2102 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002103 target: {
2104 linux_bionic: {
2105 generated_sources: ["host_bionic_linker_asm"],
2106 objs: [
2107 "linker_wrapper",
2108 ],
2109 },
2110 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002111 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002112}
2113
Dan Willemsen208ae172015-09-16 16:33:27 -07002114cc_object {
2115 // We rename crtend.o to crtend_android.o to avoid a
2116 // name clash between gcc and bionic.
2117 name: "crtend_android",
2118 local_include_dirs: ["include"],
2119 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002120
Colin Cross50c21ab2015-10-31 23:03:05 -07002121 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002122}
Colin Crossbaa48992016-07-13 11:15:21 -07002123
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002124// ========================================================
2125// NDK headers.
2126// ========================================================
2127
Dan Albert26e1c412018-05-24 14:56:46 -07002128versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002129 name: "common_libc",
2130 from: "include",
2131 to: "",
2132 license: "NOTICE",
2133}
Dan Albert4238a352016-06-28 11:18:05 -07002134
2135ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002136 name: "libc_uapi",
2137 from: "kernel/uapi",
2138 to: "",
2139 srcs: [
2140 "kernel/uapi/asm-generic/**/*.h",
2141 "kernel/uapi/drm/**/*.h",
2142 "kernel/uapi/linux/**/*.h",
2143 "kernel/uapi/misc/**/*.h",
2144 "kernel/uapi/mtd/**/*.h",
2145 "kernel/uapi/rdma/**/*.h",
2146 "kernel/uapi/scsi/**/*.h",
2147 "kernel/uapi/sound/**/*.h",
2148 "kernel/uapi/video/**/*.h",
2149 "kernel/uapi/xen/**/*.h",
2150 ],
Dan Albert92592652016-10-20 01:42:54 -07002151 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002152}
2153
2154ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002155 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002156 from: "kernel/android/uapi/linux",
2157 to: "linux",
2158 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002159 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002160}
2161
2162ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002163 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002164 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002165 to: "scsi",
2166 srcs: ["kernel/android/scsi/**/*.h"],
2167 license: "NOTICE",
2168}
2169
2170ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002171 name: "libc_asm_arm",
2172 from: "kernel/uapi/asm-arm",
2173 to: "arm-linux-androideabi",
2174 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002175 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002176}
2177
2178ndk_headers {
2179 name: "libc_asm_arm64",
2180 from: "kernel/uapi/asm-arm64",
2181 to: "aarch64-linux-android",
2182 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002183 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002184}
2185
Lazar Trsic790d2f72017-11-27 11:54:11 +01002186ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002187 name: "libc_asm_x86",
2188 from: "kernel/uapi/asm-x86",
2189 to: "i686-linux-android",
2190 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002191 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002192}
2193
2194ndk_headers {
2195 name: "libc_asm_x86_64",
2196 from: "kernel/uapi/asm-x86",
2197 to: "x86_64-linux-android",
2198 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002199 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002200}
2201
Dan Albert4238a352016-06-28 11:18:05 -07002202ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002203 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002204 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002205 symbol_file: "libc.map.txt",
2206 first_version: "9",
2207}
2208
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002209llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002210 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002211 symbol_file: "libc.map.txt",
2212 export_headers_as_system: true,
2213 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002214 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002215 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002216 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002217 "kernel/android/uapi",
2218 "kernel/uapi",
2219 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002220 arch: {
2221 arm: {
2222 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002223 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002224 ],
2225 },
2226 arm64: {
2227 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002228 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002229 ],
2230 },
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002231 x86: {
2232 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002233 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002234 ],
2235 },
2236 x86_64: {
2237 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002238 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002239 ],
2240 },
2241 },
2242}
2243
Dan Albertdf31aff2016-10-06 15:50:41 -07002244ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002245 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002246 symbol_file: "libstdc++.map.txt",
2247 first_version: "9",
2248}
2249
Dan Willemsenca056d72018-01-08 14:00:24 -08002250// Export these headers for toolbox to process
2251filegroup {
2252 name: "kernel_input_headers",
2253 srcs: [
2254 "kernel/uapi/linux/input.h",
2255 "kernel/uapi/linux/input-event-codes.h",
2256 ],
2257}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002258
2259// Generate a syscall name / number mapping. These objects are text files
2260// (thanks to the -dD -E flags) and not binary files. They will then be
2261// consumed by the genseccomp.py script and converted into C++ code.
2262cc_defaults {
2263 name: "libseccomp_gen_syscall_nrs_defaults",
2264 recovery_available: true,
2265 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2266 cflags: [
2267 "-dD",
2268 "-E",
2269 "-Wall",
2270 "-Werror",
2271 "-nostdinc",
2272 ],
2273}
2274
2275cc_object {
2276 name: "libseccomp_gen_syscall_nrs_arm",
2277 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2278 local_include_dirs: [
2279 "kernel/uapi/asm-arm",
2280 "kernel/uapi",
2281 ],
2282}
2283
2284cc_object {
2285 name: "libseccomp_gen_syscall_nrs_arm64",
2286 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2287 local_include_dirs: [
2288 "kernel/uapi/asm-arm64",
2289 "kernel/uapi",
2290 ],
2291}
2292
2293cc_object {
2294 name: "libseccomp_gen_syscall_nrs_x86",
2295 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2296 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2297 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2298 local_include_dirs: [
2299 "kernel/uapi/asm-x86",
2300 "kernel/uapi",
2301 ],
2302}
2303
2304cc_object {
2305 name: "libseccomp_gen_syscall_nrs_x86_64",
2306 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2307 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2308 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2309 local_include_dirs: [
2310 "kernel/uapi/asm-x86",
2311 "kernel/uapi",
2312 ],
2313}
2314
Elliott Hughesae03b122019-09-17 16:37:05 -07002315// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002316python_binary_host {
2317 name: "genseccomp",
2318 main: "tools/genseccomp.py",
2319
2320 srcs: [
2321 "tools/genseccomp.py",
2322 "tools/gensyscalls.py",
2323 ],
2324
2325 data: [
2326 "kernel/uapi/**/*.h",
2327 ],
2328
2329 version: {
2330 py2: {
2331 enabled: true,
2332 },
2333 py3: {
2334 enabled: false,
2335 },
2336 },
2337}
2338
Martijn Coenen0c6de752019-01-02 12:52:51 +01002339python_binary_host {
2340 name: "genfunctosyscallnrs",
2341 main: "tools/genfunctosyscallnrs.py",
2342
2343 srcs: [
2344 "tools/genseccomp.py",
2345 "tools/genfunctosyscallnrs.py",
2346 "tools/gensyscalls.py",
2347 ],
2348
2349 data: [
2350 "kernel/uapi/**/*.h",
2351 ],
2352
2353 version: {
2354 py2: {
2355 enabled: true,
2356 },
2357 py3: {
2358 enabled: false,
2359 },
2360 },
2361}
2362
2363cc_genrule {
2364 name: "func_to_syscall_nrs",
2365 recovery_available: true,
2366 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2367
2368 tools: [ "genfunctosyscallnrs" ],
2369
2370 srcs: [
2371 "SYSCALLS.TXT",
2372 ":libseccomp_gen_syscall_nrs_arm",
2373 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002374 ":libseccomp_gen_syscall_nrs_x86",
2375 ":libseccomp_gen_syscall_nrs_x86_64",
2376 ],
2377
2378 out: [
2379 "func_to_syscall_nrs.h",
2380 ],
2381}
2382
Victor Hsiehdbb86702020-06-15 09:29:07 -07002383// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002384genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002385 name: "generate_app_zygote_blocklist",
2386 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2387 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002388 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2389}
2390
2391cc_genrule {
2392 name: "libseccomp_policy_app_zygote_sources",
2393 recovery_available: true,
2394 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2395
2396 tools: [ "genseccomp" ],
2397
2398 srcs: [
2399 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002400 "SECCOMP_ALLOWLIST_COMMON.TXT",
2401 "SECCOMP_ALLOWLIST_APP.TXT",
2402 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002403 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002404 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002405 ":libseccomp_gen_syscall_nrs_arm",
2406 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002407 ":libseccomp_gen_syscall_nrs_x86",
2408 ":libseccomp_gen_syscall_nrs_x86_64",
2409 ],
2410
2411 out: [
2412 "arm64_app_zygote_policy.cpp",
2413 "arm_app_zygote_policy.cpp",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002414 "x86_64_app_zygote_policy.cpp",
2415 "x86_app_zygote_policy.cpp",
2416 ],
2417}
2418
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002419cc_genrule {
2420 name: "libseccomp_policy_app_sources",
2421 recovery_available: true,
2422 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2423
2424 tools: [ "genseccomp" ],
2425
2426 srcs: [
2427 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002428 "SECCOMP_ALLOWLIST_COMMON.TXT",
2429 "SECCOMP_ALLOWLIST_APP.TXT",
2430 "SECCOMP_BLOCKLIST_COMMON.TXT",
2431 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002432 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002433 ":libseccomp_gen_syscall_nrs_arm",
2434 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002435 ":libseccomp_gen_syscall_nrs_x86",
2436 ":libseccomp_gen_syscall_nrs_x86_64",
2437 ],
2438
2439 out: [
2440 "arm64_app_policy.cpp",
2441 "arm_app_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002442 "x86_64_app_policy.cpp",
2443 "x86_app_policy.cpp",
2444 ],
2445}
2446
2447cc_genrule {
2448 name: "libseccomp_policy_system_sources",
2449 recovery_available: true,
2450 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2451
2452 tools: [ "genseccomp" ],
2453
2454 srcs: [
2455 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002456 "SECCOMP_ALLOWLIST_COMMON.TXT",
2457 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2458 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002459 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002460 ":libseccomp_gen_syscall_nrs_arm",
2461 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002462 ":libseccomp_gen_syscall_nrs_x86",
2463 ":libseccomp_gen_syscall_nrs_x86_64",
2464 ],
2465
2466 out: [
2467 "arm64_system_policy.cpp",
2468 "arm_system_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002469 "x86_64_system_policy.cpp",
2470 "x86_system_policy.cpp",
2471 ],
2472}
2473
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002474cc_library {
2475 name: "libseccomp_policy",
2476 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002477 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002478 generated_sources: [
2479 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002480 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002481 "libseccomp_policy_system_sources",
2482 ],
2483
2484 srcs: [
2485 "seccomp/seccomp_policy.cpp",
2486 ],
2487
2488 export_include_dirs: ["seccomp/include"],
2489 cflags: [
2490 "-Wall",
2491 "-Werror",
2492 ],
2493 shared: {
2494 shared_libs: ["libbase"],
2495 },
2496 static: {
2497 static_libs: ["libbase"],
2498 },
2499}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002500
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002501subdirs = [
2502 "bionic/scudo",
2503]