blob: c3afa3a536411067448a09bfb17a07d66483346f [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001// Define the common source files for all the libc instances
2// =========================================================
3libc_common_src_files = [
Christopher Ferris7a3681e2017-04-24 17:48:32 -07004 "async_safe/async_safe_log.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07005 "bionic/ether_aton.c",
6 "bionic/ether_ntoa.c",
Victor Khimenko8e0707d2020-06-09 21:57:05 +02007 "bionic/exit.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070011 "bionic/pututline.c",
12 "bionic/sched_cpualloc.c",
13 "bionic/sched_cpucount.c",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070014 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070015 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070016 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080017 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070018 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080019 "stdio/vfscanf.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070020 "stdio/vfwscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070021]
22
Peter Collingbourne570de332019-12-11 10:00:58 -080023// off64_t/time64_t support on LP32.
Dan Willemsen208ae172015-09-16 16:33:27 -070024// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -070025libc_common_src_files_32 = [
26 "bionic/legacy_32_bit_support.cpp",
27 "bionic/time64.c",
28]
29
Elliott Hughes53cf3482016-08-09 13:06:41 -070030libc_common_flags = [
31 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080032 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070033 "-Wall",
34 "-Wextra",
35 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080036 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070037 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070038 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070039 "-Wframe-larger-than=2048",
Elliott Hughes53cf3482016-08-09 13:06:41 -070040
41 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
42 "-Werror=pointer-to-int-cast",
43 "-Werror=int-to-pointer-cast",
44 "-Werror=type-limits",
45 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080046
47 // Clang's exit-time destructor registration hides __dso_handle, but
48 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
49 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080050
51 // GWP-ASan requires platform TLS.
52 "-fno-emulated-tls",
Elliott Hughes53cf3482016-08-09 13:06:41 -070053]
54
Dan Willemsen208ae172015-09-16 16:33:27 -070055// Define some common cflags
56// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070057cc_defaults {
58 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080059 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070060 cflags: libc_common_flags,
61 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070062 conlyflags: ["-std=gnu99"],
63 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070064 include_dirs: [
65 "bionic/libc/async_safe/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070066 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070067
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010068 header_libs: [
69 "libc_headers",
70 "gwp_asan_headers",
71 ],
72 export_header_lib_headers: [
73 "libc_headers",
74 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -080075
Colin Cross50c21ab2015-10-31 23:03:05 -070076 stl: "none",
77 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070078 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070079 address: false,
80 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070081 // TODO(b/132640749): Fix broken fuzzer support.
82 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070083 },
Colin Cross50c21ab2015-10-31 23:03:05 -070084 native_coverage: false,
Yifan Hong5a39cee2020-01-21 16:43:56 -080085 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090086 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020087 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080088
Yi Konge3d90de2019-02-20 14:28:56 -080089 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
90 // warning since this is intended right now.
91 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070092
93 product_variables: {
94 experimental_mte: {
95 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
96 },
Evgenii Stepanov5a73e032020-04-29 14:59:44 -070097 malloc_zero_contents: {
98 cflags: ["-DSCUDO_ZERO_CONTENTS"],
99 },
100 malloc_pattern_fill_contents: {
101 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
102 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700103 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700104}
105
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800106libc_scudo_product_variables = {
107 malloc_not_svelte: {
108 cflags: ["-DUSE_SCUDO"],
109 whole_static_libs: ["libscudo"],
110 exclude_static_libs: [
111 "libjemalloc5",
112 "libc_jemalloc_wrapper",
113 ],
114 },
115}
116
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700117// Defaults for native allocator libs/includes to make it
118// easier to change.
Christopher Ferris062eba22020-01-31 22:40:45 -0800119// To disable scudo for the non-svelte config remove the line:
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800120// product_variables: libc_scudo_product_variables,
Christopher Ferris062eba22020-01-31 22:40:45 -0800121// in the cc_defaults below.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700122// ========================================================
123cc_defaults {
124 name: "libc_native_allocator_defaults",
125
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700126 whole_static_libs: [
127 "libjemalloc5",
128 "libc_jemalloc_wrapper",
129 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800130 header_libs: ["gwp_asan_headers"],
Christopher Ferris062eba22020-01-31 22:40:45 -0800131 product_variables: libc_scudo_product_variables,
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700132}
133
134// Functions not implemented by jemalloc directly, or that need to
135// be modified for Android.
136cc_library_static {
137 name: "libc_jemalloc_wrapper",
138 defaults: ["libc_defaults"],
139 srcs: ["bionic/jemalloc_wrapper.cpp"],
140 cflags: ["-fvisibility=hidden"],
141
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800142 // Used to pull in the jemalloc include directory so that if the
143 // library is removed, the include directory is also removed.
144 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700145}
146
Dan Willemsen208ae172015-09-16 16:33:27 -0700147// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700148// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700149// ========================================================
150//
Ryan Prichard249757b2019-11-01 17:18:28 -0700151// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
152// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
153// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
154// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700155
156cc_library_static {
157
Colin Crossa3f9fca2016-01-11 13:20:55 -0800158 srcs: [
159 "bionic/__libc_init_main_thread.cpp",
160 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700161 "bionic/bionic_call_ifunc_resolver.cpp",
162 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800163 ],
164 arch: {
165 arm64: {
166 srcs: ["arch-arm64/bionic/__set_tls.c"],
167 },
168 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700169 srcs: [
170 "arch-x86/bionic/__libc_init_sysinfo.cpp",
171 "arch-x86/bionic/__set_tls.cpp",
172 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800173 },
174 x86_64: {
175 srcs: ["arch-x86_64/bionic/__set_tls.c"],
176 },
177 },
178
Colin Cross50c21ab2015-10-31 23:03:05 -0700179 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700180 cflags: ["-fno-stack-protector", "-ffreestanding"],
181 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700182}
183
Ryan Prichard249757b2019-11-01 17:18:28 -0700184// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
185// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
186// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800187
188cc_library_static {
189 name: "libc_init_static",
190 defaults: ["libc_defaults"],
191 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700192 cflags: [
193 "-fno-stack-protector",
194
195 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
196 // from the linker before ifunc resolvers have made string.h functions available.
197 "-ffreestanding",
198 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800199}
200
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700201cc_library_static {
202 name: "libc_init_dynamic",
203 defaults: ["libc_defaults"],
204 srcs: ["bionic/libc_init_dynamic.cpp"],
205 cflags: ["-fno-stack-protector"],
206}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800207
Dan Willemsen208ae172015-09-16 16:33:27 -0700208// ========================================================
209// libc_tzcode.a - upstream 'tzcode' code
210// ========================================================
211
212cc_library_static {
213
Colin Cross50c21ab2015-10-31 23:03:05 -0700214 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700215 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800216 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700217 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700218 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
219 ],
220
Colin Cross50c21ab2015-10-31 23:03:05 -0700221 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700222 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700223 // Don't use ridiculous amounts of stack.
224 "-DALL_STATE",
225 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
226 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800227 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700228 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700229 // The name of the tm_gmtoff field in our struct tm.
230 "-DTM_GMTOFF=tm_gmtoff",
231 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700232 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700233 // Include `tzname`, `timezone`, and `daylight` globals.
234 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700235 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800236 // Use the empty string (instead of " ") as the timezone abbreviation
237 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700238 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700239 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
240 "-Dlint",
241 ],
242
Dan Willemsen208ae172015-09-16 16:33:27 -0700243 local_include_dirs: ["tzcode/"],
244 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700245}
246
247// ========================================================
248// libc_dns.a - modified NetBSD DNS code
249// ========================================================
250
251cc_library_static {
252
Colin Cross50c21ab2015-10-31 23:03:05 -0700253 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700254 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800255 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700256
257 "upstream-netbsd/lib/libc/isc/ev_streams.c",
258 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700259 ],
260
Colin Cross50c21ab2015-10-31 23:03:05 -0700261 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700262 "-DANDROID_CHANGES",
263 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700264 "-Wno-unused-parameter",
265 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700266 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700267 ],
268
Dan Willemsen208ae172015-09-16 16:33:27 -0700269 local_include_dirs: [
270 "dns/include",
271 "private",
272 "upstream-netbsd/lib/libc/include",
273 "upstream-netbsd/android/include",
274 ],
275
276 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700277}
278
279// ========================================================
280// libc_freebsd.a - upstream FreeBSD C library code
281// ========================================================
282//
283// These files are built with the freebsd-compat.h header file
284// automatically included.
285
286cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700287 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700288 srcs: [
289 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700290 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700291 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
292 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
293 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
294 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700295 "upstream-freebsd/lib/libc/stdlib/qsort.c",
296 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700297 "upstream-freebsd/lib/libc/string/wcpcpy.c",
298 "upstream-freebsd/lib/libc/string/wcpncpy.c",
299 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700300 "upstream-freebsd/lib/libc/string/wcscat.c",
301 "upstream-freebsd/lib/libc/string/wcschr.c",
302 "upstream-freebsd/lib/libc/string/wcscmp.c",
303 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700304 "upstream-freebsd/lib/libc/string/wcscspn.c",
305 "upstream-freebsd/lib/libc/string/wcsdup.c",
306 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700307 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700308 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
309 "upstream-freebsd/lib/libc/string/wcsncat.c",
310 "upstream-freebsd/lib/libc/string/wcsncmp.c",
311 "upstream-freebsd/lib/libc/string/wcsncpy.c",
312 "upstream-freebsd/lib/libc/string/wcsnlen.c",
313 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700314 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700315 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700316 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700317 "upstream-freebsd/lib/libc/string/wcstok.c",
318 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700319 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700320 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700321 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800322 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700323 ],
324 arch: {
325 arm64: {
326 exclude_srcs: [
327 "upstream-freebsd/lib/libc/string/wmemmove.c",
328 ],
329 },
330 x86: {
331 exclude_srcs: [
332 "upstream-freebsd/lib/libc/string/wcschr.c",
333 "upstream-freebsd/lib/libc/string/wcscmp.c",
334 "upstream-freebsd/lib/libc/string/wcslen.c",
335 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700336 "upstream-freebsd/lib/libc/string/wmemcmp.c",
337 "upstream-freebsd/lib/libc/string/wcscat.c",
338 "upstream-freebsd/lib/libc/string/wcscpy.c",
339 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530340 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700341 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700342 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700343 },
344
Colin Cross50c21ab2015-10-31 23:03:05 -0700345 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700346 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700347 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700348 "-include freebsd-compat.h",
349 ],
350
Dan Willemsen208ae172015-09-16 16:33:27 -0700351 local_include_dirs: [
352 "upstream-freebsd/android/include",
353 ],
354
355 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700356}
357
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700358cc_library_static {
359 defaults: ["libc_defaults"],
360 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700361 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700362 ],
363
364 cflags: [
365 "-Wno-sign-compare",
366 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700367 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700368 ],
369
370 local_include_dirs: [
371 "upstream-freebsd/android/include",
372 ],
373
374 name: "libc_freebsd_large_stack",
375}
376
Dan Willemsen208ae172015-09-16 16:33:27 -0700377// ========================================================
378// libc_netbsd.a - upstream NetBSD C library code
379// ========================================================
380//
381// These files are built with the netbsd-compat.h header file
382// automatically included.
383
384cc_library_static {
385
Colin Cross50c21ab2015-10-31 23:03:05 -0700386 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700387 srcs: [
388 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700389 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700390 "upstream-netbsd/lib/libc/gen/psignal.c",
391 "upstream-netbsd/lib/libc/gen/utime.c",
392 "upstream-netbsd/lib/libc/gen/utmp.c",
393 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
394 "upstream-netbsd/lib/libc/regex/regcomp.c",
395 "upstream-netbsd/lib/libc/regex/regerror.c",
396 "upstream-netbsd/lib/libc/regex/regexec.c",
397 "upstream-netbsd/lib/libc/regex/regfree.c",
398 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700399 "upstream-netbsd/lib/libc/stdlib/drand48.c",
400 "upstream-netbsd/lib/libc/stdlib/erand48.c",
401 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
402 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700403 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
404 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
405 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
406 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
407 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
408 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
409 "upstream-netbsd/lib/libc/stdlib/seed48.c",
410 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700411 ],
412 multilib: {
413 lib32: {
414 // LP32 cruft
415 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
416 },
417 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700418 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700419 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800420 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700421 "-DPOSIX_MISTAKE",
422 "-include netbsd-compat.h",
423 ],
424
Dan Willemsen208ae172015-09-16 16:33:27 -0700425 local_include_dirs: [
426 "upstream-netbsd/android/include",
427 "upstream-netbsd/lib/libc/include",
428 ],
429
430 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700431}
432
433// ========================================================
434// libc_openbsd_ndk.a - upstream OpenBSD C library code
435// that can be safely included in the libc_ndk.a (doesn't
436// contain any troublesome global data or constructors).
437// ========================================================
438//
439// These files are built with the openbsd-compat.h header file
440// automatically included.
441
442cc_library_static {
443 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700444 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700445 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700446 "upstream-openbsd/lib/libc/gen/alarm.c",
447 "upstream-openbsd/lib/libc/gen/ctype_.c",
448 "upstream-openbsd/lib/libc/gen/daemon.c",
449 "upstream-openbsd/lib/libc/gen/err.c",
450 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700451 "upstream-openbsd/lib/libc/gen/fnmatch.c",
452 "upstream-openbsd/lib/libc/gen/ftok.c",
453 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700454 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700455 "upstream-openbsd/lib/libc/gen/verr.c",
456 "upstream-openbsd/lib/libc/gen/verrx.c",
457 "upstream-openbsd/lib/libc/gen/vwarn.c",
458 "upstream-openbsd/lib/libc/gen/vwarnx.c",
459 "upstream-openbsd/lib/libc/gen/warn.c",
460 "upstream-openbsd/lib/libc/gen/warnx.c",
461 "upstream-openbsd/lib/libc/locale/btowc.c",
462 "upstream-openbsd/lib/libc/locale/mbrlen.c",
463 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
464 "upstream-openbsd/lib/libc/locale/mbtowc.c",
465 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700466 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
467 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700468 "upstream-openbsd/lib/libc/locale/wcstoll.c",
469 "upstream-openbsd/lib/libc/locale/wcstombs.c",
470 "upstream-openbsd/lib/libc/locale/wcstoul.c",
471 "upstream-openbsd/lib/libc/locale/wcstoull.c",
472 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
473 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
474 "upstream-openbsd/lib/libc/locale/wctob.c",
475 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700476 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700477 "upstream-openbsd/lib/libc/net/htonl.c",
478 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700479 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
480 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
481 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700482 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
483 "upstream-openbsd/lib/libc/net/inet_ntop.c",
484 "upstream-openbsd/lib/libc/net/inet_pton.c",
485 "upstream-openbsd/lib/libc/net/ntohl.c",
486 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800487 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700488 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700489 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
490 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700491 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700492 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700493 "upstream-openbsd/lib/libc/stdio/fputwc.c",
494 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700495 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700496 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700497 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700498 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 "upstream-openbsd/lib/libc/stdio/makebuf.c",
500 "upstream-openbsd/lib/libc/stdio/mktemp.c",
501 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
502 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700503 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700504 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700505 "upstream-openbsd/lib/libc/stdio/tempnam.c",
506 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
507 "upstream-openbsd/lib/libc/stdio/ungetc.c",
508 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
509 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
510 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700511 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
512 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
513 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700514 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700515 "upstream-openbsd/lib/libc/stdio/wsetup.c",
516 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800517 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700518 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700519 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700520 "upstream-openbsd/lib/libc/stdlib/insque.c",
521 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
522 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
523 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800524 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700525 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800526 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700527 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700528 "upstream-openbsd/lib/libc/stdlib/remque.c",
529 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700530 "upstream-openbsd/lib/libc/stdlib/tfind.c",
531 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800532 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700533 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800534 "upstream-openbsd/lib/libc/string/strcasestr.c",
535 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700536 "upstream-openbsd/lib/libc/string/strcspn.c",
537 "upstream-openbsd/lib/libc/string/strdup.c",
538 "upstream-openbsd/lib/libc/string/strndup.c",
539 "upstream-openbsd/lib/libc/string/strpbrk.c",
540 "upstream-openbsd/lib/libc/string/strsep.c",
541 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700542 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800543 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700544 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/string/wcswidth.c",
546 ],
547
Colin Cross50c21ab2015-10-31 23:03:05 -0700548 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700549 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700550 "-Wno-unused-parameter",
551 "-include openbsd-compat.h",
552 ],
553
Dan Willemsen208ae172015-09-16 16:33:27 -0700554 local_include_dirs: [
555 "private",
556 "stdio",
557 "upstream-openbsd/android/include",
558 "upstream-openbsd/lib/libc/include",
559 "upstream-openbsd/lib/libc/gdtoa/",
560 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700561}
562
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700563cc_library_static {
564 name: "libc_openbsd_large_stack",
565 defaults: ["libc_defaults"],
566 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700567 "stdio/vfprintf.cpp",
568 "stdio/vfwprintf.cpp",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800569 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700570 ],
571 cflags: [
572 "-include openbsd-compat.h",
573 "-Wno-sign-compare",
574 "-Wframe-larger-than=5000",
575 ],
576
577 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700578 "upstream-openbsd/android/include/",
579 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700580 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700581 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700582 ],
583}
584
Dan Willemsen208ae172015-09-16 16:33:27 -0700585// ========================================================
586// libc_openbsd.a - upstream OpenBSD C library code
587// ========================================================
588//
589// These files are built with the openbsd-compat.h header file
590// automatically included.
591cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700592 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700593 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800594 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700595 "upstream-openbsd/lib/libc/crypt/arc4random.c",
596 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
597
598 // May be overriden by per-arch optimized versions
599 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700600 "upstream-openbsd/lib/libc/string/memrchr.c",
601 "upstream-openbsd/lib/libc/string/stpcpy.c",
602 "upstream-openbsd/lib/libc/string/stpncpy.c",
603 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700604 "upstream-openbsd/lib/libc/string/strcpy.c",
605 "upstream-openbsd/lib/libc/string/strlcat.c",
606 "upstream-openbsd/lib/libc/string/strlcpy.c",
607 "upstream-openbsd/lib/libc/string/strncat.c",
608 "upstream-openbsd/lib/libc/string/strncmp.c",
609 "upstream-openbsd/lib/libc/string/strncpy.c",
610 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700611
612 arch: {
613 arm: {
614 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700615 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800616 "upstream-openbsd/lib/libc/string/stpcpy.c",
617 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700618 ],
619 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700620 arm64: {
621 exclude_srcs: [
622 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700623 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700624 "upstream-openbsd/lib/libc/string/strcpy.c",
625 "upstream-openbsd/lib/libc/string/strncmp.c",
626 ],
627 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700628 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800629 exclude_srcs: [
630 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800631 "upstream-openbsd/lib/libc/string/memrchr.c",
632 "upstream-openbsd/lib/libc/string/stpcpy.c",
633 "upstream-openbsd/lib/libc/string/stpncpy.c",
634 "upstream-openbsd/lib/libc/string/strcat.c",
635 "upstream-openbsd/lib/libc/string/strcpy.c",
636 "upstream-openbsd/lib/libc/string/strncmp.c",
637 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700638 "upstream-openbsd/lib/libc/string/strlcat.c",
639 "upstream-openbsd/lib/libc/string/strlcpy.c",
640 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800641 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700642 },
643
644 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800645 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800646 "upstream-openbsd/lib/libc/string/stpcpy.c",
647 "upstream-openbsd/lib/libc/string/stpncpy.c",
648 "upstream-openbsd/lib/libc/string/strcat.c",
649 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800650 "upstream-openbsd/lib/libc/string/strncat.c",
651 "upstream-openbsd/lib/libc/string/strncmp.c",
652 "upstream-openbsd/lib/libc/string/strncpy.c",
653 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700654 },
655 },
656
Colin Cross50c21ab2015-10-31 23:03:05 -0700657 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700658 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700659 "-Wno-unused-parameter",
660 "-include openbsd-compat.h",
661 ],
662
Dan Willemsen208ae172015-09-16 16:33:27 -0700663 local_include_dirs: [
664 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700665 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700666 ],
667
668 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700669}
670
671// ========================================================
672// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
673// ========================================================
674//
675// These files are built with the openbsd-compat.h header file
676// automatically included.
677
678cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700679 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700680 srcs: [
681 "upstream-openbsd/android/gdtoa_support.cpp",
682 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
683 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
684 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
685 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
686 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
687 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
688 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
689 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
690 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
691 "upstream-openbsd/lib/libc/gdtoa/misc.c",
692 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
693 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
694 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
695 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
696 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
697 "upstream-openbsd/lib/libc/gdtoa/sum.c",
698 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
699 ],
700 multilib: {
701 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800702 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700703 },
704 },
705
Colin Cross50c21ab2015-10-31 23:03:05 -0700706 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700707 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700708 "-include openbsd-compat.h",
709 ],
710
Dan Willemsen208ae172015-09-16 16:33:27 -0700711 local_include_dirs: [
712 "private",
713 "upstream-openbsd/android/include",
714 "upstream-openbsd/lib/libc/include",
715 ],
716
717 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700718}
719
720// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700721// libc_fortify.a - container for our FORITFY
722// implementation details
723// ========================================================
724cc_library_static {
725 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700726 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700727
728 name: "libc_fortify",
729
730 // Disable FORTIFY for the compilation of these, so we don't end up having
731 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800732 cflags: [
733 "-U_FORTIFY_SOURCE",
734 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
735 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700736
737 arch: {
738 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800739 cflags: [
740 "-DNO___MEMCPY_CHK",
741 "-DRENAME___STRCAT_CHK",
742 "-DRENAME___STRCPY_CHK",
743 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700744 srcs: [
745 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800746
747 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
748 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
749
750 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
751 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
752
753 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
754 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
755
756 "arch-arm/krait/bionic/__strcat_chk.S",
757 "arch-arm/krait/bionic/__strcpy_chk.S",
758
759 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
760 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
761
Haibo Huang01bfd892018-12-03 15:05:16 -0800762 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
763 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700764 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700765 },
766 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700767 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700768 srcs: [
769 "arch-arm64/generic/bionic/__memcpy_chk.S",
770 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700771 },
772 },
773}
774
775// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700776// libc_bionic.a - home-grown C library code
777// ========================================================
778
779cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700780 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700781 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800782 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700783 "bionic/sysconf.cpp",
784 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700785 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700786
Josh Gao10ec9282017-04-03 15:13:29 -0700787 // The following must not be statically linked into libc_ndk.a, because
788 // debuggerd will look for the abort message in libc.so's copy.
789 "bionic/android_set_abort_message.cpp",
790
Dan Willemsen208ae172015-09-16 16:33:27 -0700791 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800792 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700793 "bionic/strnlen.c",
794 "bionic/strrchr.cpp",
795 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700796
797 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700798 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700799 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700800 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800801 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700802 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800803 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800804 "arch-arm/generic/bionic/stpcpy.c",
805 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800806 "arch-arm/generic/bionic/strcmp.S",
807 "arch-arm/generic/bionic/strcpy.S",
808 "arch-arm/generic/bionic/strlen.c",
809
Ryan Prichard45024fe2018-12-30 21:10:26 -0800810 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700811 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700812 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700813 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700814 "arch-arm/bionic/atomics_arm.c",
815 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800816 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700817 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700818 "arch-arm/bionic/setjmp.S",
819 "arch-arm/bionic/syscall.S",
820 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800821
822 "arch-arm/cortex-a15/bionic/memcpy.S",
823 "arch-arm/cortex-a15/bionic/memmove.S",
824 "arch-arm/cortex-a15/bionic/memset.S",
825 "arch-arm/cortex-a15/bionic/stpcpy.S",
826 "arch-arm/cortex-a15/bionic/strcat.S",
827 "arch-arm/cortex-a15/bionic/strcmp.S",
828 "arch-arm/cortex-a15/bionic/strcpy.S",
829 "arch-arm/cortex-a15/bionic/strlen.S",
830
831 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800832 "arch-arm/cortex-a7/bionic/memset.S",
833
834 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800835 "arch-arm/cortex-a9/bionic/memset.S",
836 "arch-arm/cortex-a9/bionic/stpcpy.S",
837 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800838 "arch-arm/cortex-a9/bionic/strcpy.S",
839 "arch-arm/cortex-a9/bionic/strlen.S",
840
841 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800842 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800843
844 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800845
Haibo Huang01bfd892018-12-03 15:05:16 -0800846 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800847
848 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700849 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700850 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700851 arm64: {
852 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700853 "arch-arm64/generic/bionic/memcpy.S",
854 "arch-arm64/generic/bionic/memmove.S",
855 "arch-arm64/generic/bionic/memset.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700856 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800857
Peter Collingbourne900d07d2019-10-28 13:11:00 -0700858 "arch-arm64/mte/bionic/memchr.c",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800859 "arch-arm64/mte/bionic/stpcpy.S",
860 "arch-arm64/mte/bionic/strchrnul.cpp",
861 "arch-arm64/mte/bionic/strrchr.cpp",
Peter Collingbourne900d07d2019-10-28 13:11:00 -0700862 "arch-arm64/mte/bionic/strcmp.c",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800863 "arch-arm64/mte/bionic/strcpy.S",
Peter Collingbourne900d07d2019-10-28 13:11:00 -0700864 "arch-arm64/mte/bionic/strncmp.c",
865 "arch-arm64/mte/bionic/strnlen.c",
866
Dan Willemsen3e621712016-02-03 21:48:08 -0800867 "arch-arm64/bionic/__bionic_clone.S",
868 "arch-arm64/bionic/_exit_with_stack_teardown.S",
869 "arch-arm64/bionic/setjmp.S",
870 "arch-arm64/bionic/syscall.S",
871 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700872 ],
873 exclude_srcs: [
874 "bionic/__memcpy_chk.cpp",
875 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800876 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700877 "bionic/strnlen.c",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800878 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700879 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700880 },
881
Dan Willemsen208ae172015-09-16 16:33:27 -0700882 x86: {
883 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700884 "arch-x86/generic/string/memcmp.S",
885 "arch-x86/generic/string/strcmp.S",
886 "arch-x86/generic/string/strncmp.S",
887 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700888
889 "arch-x86/generic/string/strlcat.c",
890 "arch-x86/generic/string/strlcpy.c",
891 "arch-x86/generic/string/strncat.c",
892 "arch-x86/generic/string/wcscat.c",
893 "arch-x86/generic/string/wcscpy.c",
894 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530895 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700896
Dan Willemsen208ae172015-09-16 16:33:27 -0700897 "arch-x86/atom/string/sse2-memchr-atom.S",
898 "arch-x86/atom/string/sse2-memrchr-atom.S",
899 "arch-x86/atom/string/sse2-strchr-atom.S",
900 "arch-x86/atom/string/sse2-strnlen-atom.S",
901 "arch-x86/atom/string/sse2-strrchr-atom.S",
902 "arch-x86/atom/string/sse2-wcschr-atom.S",
903 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
904 "arch-x86/atom/string/sse2-wcslen-atom.S",
905 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700906 "arch-x86/silvermont/string/sse2-memmove-slm.S",
907 "arch-x86/silvermont/string/sse2-memset-slm.S",
908 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
909 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
910 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
911 "arch-x86/silvermont/string/sse2-strlen-slm.S",
912 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800913
914 "arch-x86/bionic/__bionic_clone.S",
915 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800916 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800917 "arch-x86/bionic/__restore.S",
918 "arch-x86/bionic/setjmp.S",
919 "arch-x86/bionic/syscall.S",
920 "arch-x86/bionic/vfork.S",
Ryan Pricharda992a062020-04-18 02:59:24 -0700921 "arch-x86/bionic/__x86.get_pc_thunk.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700922
923 // ssse3 functions
924 "arch-x86/atom/string/ssse3-strcat-atom.S",
925 "arch-x86/atom/string/ssse3-strcmp-atom.S",
926 "arch-x86/atom/string/ssse3-strlcat-atom.S",
927 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
928 "arch-x86/atom/string/ssse3-strncat-atom.S",
929 "arch-x86/atom/string/ssse3-strncmp-atom.S",
930 "arch-x86/atom/string/ssse3-wcscat-atom.S",
931 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
932
933 // sse4 functions
934 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
935 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
936
937 // atom functions
938 "arch-x86/atom/string/sse2-memset-atom.S",
939 "arch-x86/atom/string/sse2-strlen-atom.S",
940 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800941 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700942 "arch-x86/atom/string/ssse3-strcpy-atom.S",
943 "arch-x86/atom/string/ssse3-strncpy-atom.S",
944 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530945
946 // avx2 functions
947 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700948 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700949
950 exclude_srcs: [
951 "bionic/strchr.cpp",
952 "bionic/strnlen.c",
953 "bionic/strrchr.cpp",
954 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700955 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700956 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700957 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700958 "arch-x86_64/string/sse2-memmove-slm.S",
959 "arch-x86_64/string/sse2-memset-slm.S",
960 "arch-x86_64/string/sse2-stpcpy-slm.S",
961 "arch-x86_64/string/sse2-stpncpy-slm.S",
962 "arch-x86_64/string/sse2-strcat-slm.S",
963 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700964 "arch-x86_64/string/sse2-strlen-slm.S",
965 "arch-x86_64/string/sse2-strncat-slm.S",
966 "arch-x86_64/string/sse2-strncpy-slm.S",
967 "arch-x86_64/string/sse4-memcmp-slm.S",
968 "arch-x86_64/string/ssse3-strcmp-slm.S",
969 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530970 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800971
972 "arch-x86_64/bionic/__bionic_clone.S",
973 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
974 "arch-x86_64/bionic/__restore_rt.S",
975 "arch-x86_64/bionic/setjmp.S",
976 "arch-x86_64/bionic/syscall.S",
977 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700978 ],
979 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700980 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700981
Colin Cross50c21ab2015-10-31 23:03:05 -0700982 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700983 include_dirs: ["bionic/libstdc++/include"],
984 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700985}
986
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000987genrule {
988 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -0800989 out: ["generated_android_ids.h"],
990 srcs: [":android_filesystem_config_header"],
991 tool_files: ["fs_config_generator.py"],
992 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000993}
994
Dan Willemsen268a6732015-10-15 14:49:45 -0700995// ========================================================
996// libc_bionic_ndk.a- The portions of libc_bionic that can
997// be safely used in libc_ndk.a (no troublesome global data
998// or constructors).
999// ========================================================
1000cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001001 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001002 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001003 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001004 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001005 "bionic/__cmsg_nxthdr.cpp",
1006 "bionic/__errno.cpp",
1007 "bionic/__gnu_basename.cpp",
1008 "bionic/__libc_current_sigrtmax.cpp",
1009 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001010 "bionic/abort.cpp",
1011 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001012 "bionic/access.cpp",
1013 "bionic/arpa_inet.cpp",
1014 "bionic/assert.cpp",
1015 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001016 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001017 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001018 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001019 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001020 "bionic/bionic_systrace.cpp",
1021 "bionic/bionic_time_conversions.cpp",
1022 "bionic/brk.cpp",
1023 "bionic/c16rtomb.cpp",
1024 "bionic/c32rtomb.cpp",
1025 "bionic/chmod.cpp",
1026 "bionic/chown.cpp",
1027 "bionic/clearenv.cpp",
1028 "bionic/clock.cpp",
1029 "bionic/clock_getcpuclockid.cpp",
1030 "bionic/clock_nanosleep.cpp",
1031 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001032 "bionic/ctype.cpp",
1033 "bionic/dirent.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001034 "bionic/dup.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001035 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001036 "bionic/error.cpp",
Josh Gao7de41242020-04-29 17:08:46 -07001037 "bionic/eventfd.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001038 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001039 "bionic/faccessat.cpp",
1040 "bionic/fchmod.cpp",
1041 "bionic/fchmodat.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001042 "bionic/fcntl.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001043 "bionic/fdsan.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001044 "bionic/fdtrack.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001045 "bionic/ffs.cpp",
1046 "bionic/fgetxattr.cpp",
1047 "bionic/flistxattr.cpp",
1048 "bionic/flockfile.cpp",
1049 "bionic/fpclassify.cpp",
1050 "bionic/fsetxattr.cpp",
1051 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001052 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001053 "bionic/futimens.cpp",
1054 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001055 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001056 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001057 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001058 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001059 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001060 "bionic/getpgrp.cpp",
1061 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001062 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001063 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001064 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001065 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001066 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001067 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001068 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001069 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001070 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001071 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001072 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001073 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001074 "bionic/lchown.cpp",
1075 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001076 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001077 "bionic/libgen.cpp",
1078 "bionic/link.cpp",
1079 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001080 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001081 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001082 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001083 "bionic/mbrtoc16.cpp",
1084 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001085 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001086 "bionic/mempcpy.cpp",
1087 "bionic/mkdir.cpp",
1088 "bionic/mkfifo.cpp",
1089 "bionic/mknod.cpp",
1090 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001091 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001092 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001093 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001094 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001095 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001096 "bionic/open.cpp",
1097 "bionic/pathconf.cpp",
1098 "bionic/pause.cpp",
1099 "bionic/pipe.cpp",
1100 "bionic/poll.cpp",
1101 "bionic/posix_fadvise.cpp",
1102 "bionic/posix_fallocate.cpp",
1103 "bionic/posix_madvise.cpp",
1104 "bionic/posix_timers.cpp",
1105 "bionic/ptrace.cpp",
1106 "bionic/pty.cpp",
1107 "bionic/raise.cpp",
1108 "bionic/rand.cpp",
1109 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001110 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001111 "bionic/reboot.cpp",
1112 "bionic/recv.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001113 "bionic/recvmsg.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001114 "bionic/rename.cpp",
1115 "bionic/rmdir.cpp",
1116 "bionic/scandir.cpp",
1117 "bionic/sched_getaffinity.cpp",
1118 "bionic/sched_getcpu.cpp",
1119 "bionic/semaphore.cpp",
1120 "bionic/send.cpp",
1121 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001122 "bionic/seteuid.cpp",
1123 "bionic/setpgrp.cpp",
1124 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001125 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001126 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001127 "bionic/sleep.cpp",
Josh Gaob107eab2020-04-29 17:17:56 -07001128 "bionic/socketpair.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001129 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001130 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001131 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001132 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001133 "bionic/string_l.cpp",
1134 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001135 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001136 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001137 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001138 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001139 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001140 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001141 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001142 "bionic/sys_msg.cpp",
1143 "bionic/sys_sem.cpp",
1144 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001145 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001146 "bionic/sys_statfs.cpp",
1147 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001148 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001149 "bionic/sysinfo.cpp",
1150 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001151 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001152 "bionic/system_property_api.cpp",
1153 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001154 "bionic/tdestroy.cpp",
1155 "bionic/termios.cpp",
1156 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001157 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001158 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001159 "bionic/tmpfile.cpp",
1160 "bionic/umount.cpp",
1161 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001162 "bionic/usleep.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001163 "bionic/wait.cpp",
1164 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001165 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001166 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001167 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001168 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001169 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001170
1171 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1172 // which will be overridden by the actual one in libc.so.
1173 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001174 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001175
Dan Willemsen208ae172015-09-16 16:33:27 -07001176 multilib: {
1177 lib32: {
1178 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001179 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001180 },
1181 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001182 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001183 treble_linker_namespaces: {
1184 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001185 },
1186 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001187 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001188 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001189 local_include_dirs: ["stdio"],
1190 include_dirs: ["bionic/libstdc++/include"],
1191 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001192 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001193}
1194
Dan Willemsen208ae172015-09-16 16:33:27 -07001195// ========================================================
1196// libc_pthread.a - pthreads parts that previously lived in
1197// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001198// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001199// pthread_t has changed over the years and has ABI
1200// compatibility issues).
1201// ========================================================
1202
1203cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001204 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001205 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001206 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001207 "bionic/pthread_atfork.cpp",
1208 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001209 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001210 "bionic/pthread_cond.cpp",
1211 "bionic/pthread_create.cpp",
1212 "bionic/pthread_detach.cpp",
1213 "bionic/pthread_equal.cpp",
1214 "bionic/pthread_exit.cpp",
1215 "bionic/pthread_getcpuclockid.cpp",
1216 "bionic/pthread_getschedparam.cpp",
1217 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001218 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001219 "bionic/pthread_join.cpp",
1220 "bionic/pthread_key.cpp",
1221 "bionic/pthread_kill.cpp",
1222 "bionic/pthread_mutex.cpp",
1223 "bionic/pthread_once.cpp",
1224 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001225 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001226 "bionic/pthread_self.cpp",
1227 "bionic/pthread_setname_np.cpp",
1228 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001229 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001230
1231 // The following implementations depend on pthread data or implementation,
1232 // so we can't include them in libc_ndk.a.
1233 "bionic/__cxa_thread_atexit_impl.cpp",
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001234 "bionic/android_unsafe_frame_pointer_chase.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -08001235 "bionic/atexit.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001236 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001237 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001238
Colin Cross50c21ab2015-10-31 23:03:05 -07001239 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001240 include_dirs: ["bionic/libstdc++/include"],
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001241 header_libs: ["bionic_libc_platform_headers"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001242 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001243}
1244
1245// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001246// libc_syscalls.a
1247// ========================================================
1248
Elliott Hughes782c4852019-04-16 12:31:00 -07001249genrule {
1250 name: "syscalls-arm.S",
1251 out: ["syscalls-arm.S"],
1252 srcs: ["SYSCALLS.TXT"],
1253 tool_files: [":bionic-gensyscalls"],
1254 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1255}
1256
1257genrule {
1258 name: "syscalls-arm64.S",
1259 out: ["syscalls-arm64.S"],
1260 srcs: ["SYSCALLS.TXT"],
1261 tool_files: [":bionic-gensyscalls"],
1262 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1263}
1264
1265genrule {
1266 name: "syscalls-x86.S",
1267 out: ["syscalls-x86.S"],
1268 srcs: ["SYSCALLS.TXT"],
1269 tool_files: [":bionic-gensyscalls"],
1270 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1271}
1272
1273genrule {
1274 name: "syscalls-x86_64.S",
1275 out: ["syscalls-x86_64.S"],
1276 srcs: ["SYSCALLS.TXT"],
1277 tool_files: [":bionic-gensyscalls"],
1278 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1279}
1280
Dan Willemsen208ae172015-09-16 16:33:27 -07001281cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001282 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001283 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001284 arch: {
1285 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001286 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001287 },
1288 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001289 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001290 },
1291 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001292 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001293 },
1294 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001295 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001296 },
1297 },
1298 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001299}
1300
1301// ========================================================
1302// libc_aeabi.a
1303// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1304// to avoid infinite recursion. For the other architectures we just build an
1305// empty library to keep this makefile simple.
1306// ========================================================
1307
1308cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001309 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001310 arch: {
1311 arm: {
1312 srcs: ["arch-arm/bionic/__aeabi.c"],
1313 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001314 },
1315 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001316 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001317}
1318
1319// ========================================================
1320// libc_ndk.a
1321// Compatibility library for the NDK. This library contains
1322// all the parts of libc that are safe to statically link.
1323// We can't safely statically link things that can only run
1324// on a certain version of the OS. Examples include
1325// anything that talks to netd (a large portion of the DNS
1326// code) and anything that is dependent on the layout of a
1327// data structure that has changed across releases (such as
1328// pthread_t).
1329// ========================================================
1330
1331cc_library_static {
1332 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001333 defaults: [
1334 "libc_defaults",
1335 "libc_native_allocator_defaults",
1336 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -08001337 ramdisk_available: false,
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001338 srcs: libc_common_src_files + [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001339 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001340 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001341 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001342 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001343 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001344 multilib: {
1345 lib32: {
1346 srcs: libc_common_src_files_32,
1347 },
1348 },
1349 arch: {
1350 arm: {
1351 srcs: [
1352 "arch-arm/bionic/exidx_dynamic.c",
1353 "arch-common/bionic/crtbegin_so.c",
1354 "arch-arm/bionic/atexit_legacy.c",
1355 "arch-common/bionic/crtend_so.S",
1356 ],
1357 whole_static_libs: ["libc_aeabi"],
1358 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001359 },
1360
Colin Cross50c21ab2015-10-31 23:03:05 -07001361 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001362 "-fvisibility=hidden",
1363 "-DLIBC_STATIC",
1364 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001365
1366 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001367 "gwp_asan",
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001368 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001369 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001370 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001371 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001372 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001373 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001374 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001375 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001376 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001377 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001378 "libc_syscalls",
1379 "libc_tzcode",
1380 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001381 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001382 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001383}
1384
1385// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001386// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001387// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001388cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001389 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001390 srcs: libc_common_src_files,
1391 multilib: {
1392 lib32: {
1393 srcs: libc_common_src_files_32,
1394 },
1395 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001396 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001397
1398 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001399 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001400 "libc_bionic",
1401 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001402 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001403 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001404 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001405 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001406 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001407 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001408 "libc_netbsd",
1409 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001410 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001411 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001412 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001413 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001414 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001415 ],
1416
1417 arch: {
1418 arm: {
1419 whole_static_libs: ["libc_aeabi"],
1420 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001421 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001422}
1423
1424// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001425// libc_common.a
1426// ========================================================
1427
1428cc_library_static {
1429 defaults: ["libc_defaults"],
1430 name: "libc_common",
1431
1432 whole_static_libs: [
1433 "libc_nopthread",
1434 "libc_pthread",
1435 ],
1436}
1437
1438// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001439// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001440// ========================================================
1441cc_library_static {
1442 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001443 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001444
Haibo Huangb9244ff2018-08-11 10:12:13 -07001445 arch: {
1446 x86: {
1447 srcs: ["arch-x86/static_function_dispatch.S"],
1448 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001449 arm: {
1450 srcs: ["arch-arm/static_function_dispatch.S"],
1451 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001452 arm64: {
1453 srcs: ["arch-arm64/static_function_dispatch.S"],
1454 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001455 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001456}
1457
1458// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001459// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001460// ========================================================
1461cc_library_static {
1462 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001463 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001464
Haibo Huangb9244ff2018-08-11 10:12:13 -07001465 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001466 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001467 "-fno-stack-protector",
1468 "-fno-jump-tables",
1469 ],
1470 arch: {
1471 x86: {
1472 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1473 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001474 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001475 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001476 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001477 arm64: {
1478 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1479 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001480 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001481}
1482
1483// ========================================================
1484// libc_common_static.a For static binaries.
1485// ========================================================
1486cc_library_static {
1487 defaults: ["libc_defaults"],
1488 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001489
Haibo Huangf71edfa2018-11-12 10:06:56 -08001490 whole_static_libs: [
1491 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001492 "libc_static_dispatch",
1493 ],
1494}
1495
1496// ========================================================
1497// libc_common_shared.a For shared libraries.
1498// ========================================================
1499cc_library_static {
1500 defaults: ["libc_defaults"],
1501 name: "libc_common_shared",
1502
1503 whole_static_libs: [
1504 "libc_common",
1505 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001506 ],
1507}
1508
Ryan Prichard22a6a052019-10-10 23:59:30 -07001509// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1510// executable.
1511cc_library_static {
1512 name: "libc_unwind_static",
1513 defaults: ["libc_defaults"],
1514 cflags: ["-DLIBC_STATIC"],
1515
1516 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1517 arch: {
1518 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1519 arm: {
1520 srcs: ["arch-arm/bionic/exidx_static.c"],
1521 },
1522 },
1523}
1524
Haibo Huangf71edfa2018-11-12 10:06:56 -08001525// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001526// libc_nomalloc.a
1527// ========================================================
1528//
Ryan Prichard249757b2019-11-01 17:18:28 -07001529// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1530// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1531// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001532
1533cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001534 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001535 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001536
Colin Crossa3f9fca2016-01-11 13:20:55 -08001537 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001538 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001539 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001540 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001541 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001542}
1543
dimitryc0c0ef62018-12-05 16:33:52 +01001544filegroup {
1545 name: "libc_sources_shared",
1546 srcs: [
1547 "arch-common/bionic/crtbegin_so.c",
1548 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001549 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001550 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001551 "bionic/icu.cpp",
1552 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001553 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001554 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001555 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001556 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001557 "bionic/ndk_cruft.cpp",
1558 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001559 "bionic/NetdClient.cpp",
1560 "arch-common/bionic/crtend_so.S",
1561 ],
1562}
1563
1564filegroup {
1565 name: "libc_sources_static",
1566 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001567 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001568 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001569 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001570 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001571 ],
1572}
1573
1574filegroup {
1575 name: "libc_sources_shared_arm",
1576 srcs: [
1577 "arch-arm/bionic/exidx_dynamic.c",
1578 "arch-arm/bionic/atexit_legacy.c",
1579 ],
1580}
1581
Dan Willemsen208ae172015-09-16 16:33:27 -07001582// ========================================================
1583// libc.a + libc.so
1584// ========================================================
1585cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001586 defaults: [
1587 "libc_defaults",
1588 "libc_native_allocator_defaults",
1589 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001590 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001591 static_ndk_lib: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001592 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001593 platform_sdk_version: {
1594 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1595 },
1596 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001597 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001598 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001599 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001600 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001601 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001602 "libc_init_static",
1603 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001604 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001605 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001606 },
1607 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001608 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001609 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001610 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001611 "libc_init_dynamic",
1612 "libc_common_shared",
1613 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001614 },
1615
Neil Fullera7db90f2019-04-25 09:28:27 +01001616 required: [
1617 "tzdata",
1618 "tz_version", // Version metadata for tzdata to help debugging.
1619 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001620
Colin Cross4ce94d22016-11-15 13:15:43 -08001621 // Do not pack libc.so relocations; see http://b/20645321 for details.
1622 pack_relocations: false,
1623
dimitry06016f22018-01-05 11:39:28 +01001624 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1625 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1626 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1627 // those new libraries from libgcc.a are not declared external; if that were the case,
1628 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1629 // on the external symbols from the dependent libraries. That would create a "cloaked"
1630 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001631
dimitry06016f22018-01-05 11:39:28 +01001632 shared_libs: [
1633 "ld-android",
1634 "libdl",
1635 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001636 static_libs: [
1637 "libdl_android",
1638 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001639
1640 nocrt: true,
1641
Dan Willemsen208ae172015-09-16 16:33:27 -07001642 arch: {
1643 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001644 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001645 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001646 ldflags: ["-Wl,--hash-style=both"],
1647
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001648 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001649
Dan Willemsen208ae172015-09-16 16:33:27 -07001650 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001651 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001652 // special for arm
1653 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichard379e05f2020-04-01 20:10:07 -07001654
1655 whole_static_libs: [ "libunwind_llvm" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001656 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001657
1658 // Arm 32 bit does not produce complete exidx unwind information
1659 // so keep the .debug_frame which is relatively small and does
1660 // include needed unwind information.
1661 // See b/132992102 for details.
1662 strip: {
1663 keep_symbols_and_debug_frame: true,
1664 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001665 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001666 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001667 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001668
1669 // Leave the symbols in the shared library so that stack unwinders can produce
1670 // meaningful name resolution.
1671 strip: {
1672 keep_symbols: true,
1673 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001674
Ryan Prichard379e05f2020-04-01 20:10:07 -07001675 shared: {
1676 whole_static_libs: [ "libgcc_stripped" ],
1677 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001678 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001679 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001680 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001681 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001682 ldflags: ["-Wl,--hash-style=both"],
1683
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001684 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001685
1686 // Leave the symbols in the shared library so that stack unwinders can produce
1687 // meaningful name resolution.
1688 strip: {
1689 keep_symbols: true,
1690 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001691
Ryan Prichard379e05f2020-04-01 20:10:07 -07001692 shared: {
1693 whole_static_libs: [ "libgcc_stripped" ],
1694 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001695 },
1696 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001697 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001698
1699 // Leave the symbols in the shared library so that stack unwinders can produce
1700 // meaningful name resolution.
1701 strip: {
1702 keep_symbols: true,
1703 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001704
Ryan Prichard379e05f2020-04-01 20:10:07 -07001705 shared: {
1706 whole_static_libs: [ "libgcc_stripped" ],
1707 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001708 },
1709 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001710
1711 stubs: {
1712 symbol_file: "libc.map.txt",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001713 versions: [
1714 "29",
Jooyung Handbfa0742020-03-30 13:18:44 +09001715 "R",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001716 "10000",
1717 ],
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001718 },
Vic Yang6903fb82019-01-14 11:34:39 -08001719
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001720 apex_available: [
1721 "//apex_available:platform",
1722 "com.android.runtime",
1723 ],
1724
Vic Yang03ff4362019-06-24 16:11:37 -07001725 // Sorting bss symbols by size usually results in less dirty pages at run
1726 // time, because small symbols are grouped together.
1727 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001728}
1729
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001730genrule {
1731 name: "libc.arm.map",
1732 out: ["libc.arm.map"],
1733 srcs: ["libc.map.txt"],
1734 tool_files: [":bionic-generate-version-script"],
1735 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1736}
1737
1738genrule {
1739 name: "libc.arm64.map",
1740 out: ["libc.arm64.map"],
1741 srcs: ["libc.map.txt"],
1742 tool_files: [":bionic-generate-version-script"],
1743 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1744}
1745
1746genrule {
1747 name: "libc.x86.map",
1748 out: ["libc.x86.map"],
1749 srcs: ["libc.map.txt"],
1750 tool_files: [":bionic-generate-version-script"],
1751 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1752}
1753
1754genrule {
1755 name: "libc.x86_64.map",
1756 out: ["libc.x86_64.map"],
1757 srcs: ["libc.map.txt"],
1758 tool_files: [":bionic-generate-version-script"],
1759 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1760}
1761
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001762// Headers that only other parts of the platform can include.
1763cc_library_headers {
1764 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001765 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001766 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001767 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001768 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001769 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001770 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001771 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001772 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001773 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001774 "//system/core/debuggerd:__subpackages__",
Peter Collingbourne6e316e62020-04-07 14:09:52 -07001775 "//system/core/libunwindstack:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001776 "//system/memory/libmemunreachable:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001777 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001778 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001779 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001780 ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001781 recovery_available: true,
1782 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001783 export_include_dirs: [
1784 "platform",
1785 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001786 system_shared_libs: [],
1787 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001788 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001789
1790 apex_available: [
1791 "//apex_available:platform",
1792 "com.android.runtime",
1793 "com.android.art.release", // from libdexfile_external
1794 "com.android.art.debug", // from libdexfile_external
1795 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001796}
1797
Logan Chien17af91b2019-01-15 21:19:56 +08001798cc_library_headers {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001799 // Internal lib for use in libc_headers. Since we cannot intersect arch{}
1800 // and target{} in the same module, this one specifies the arch-dependent
1801 // include paths, and then libc_headers filters by target so that the
1802 // headers only are included for Bionic targets.
1803 name: "libc_headers_arch",
1804 visibility: ["//visibility:private"],
Logan Chien17af91b2019-01-15 21:19:56 +08001805
1806 host_supported: true,
1807 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001808 ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001809 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001810 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001811 apex_available: [
1812 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001813 "//apex_available:anyapex",
1814 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001815 // used by most APEXes indirectly via libunwind_llvm
1816 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001817
1818 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001819 stl: "none",
1820 system_shared_libs: [],
1821
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001822 // The build system generally requires that any dependencies of a target
1823 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1824 // to 1 we let targets with an sdk_version that need to depend on the libc
1825 // headers but cannot depend on libc itself due to circular dependencies
1826 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1827 // is correct because the headers can support any sdk_version.
1828 sdk_version: "1",
1829
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001830 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001831 "include",
1832 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001833 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001834 "kernel/android/uapi",
1835 ],
1836
1837 arch: {
1838 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001839 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001840 },
1841 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001842 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001843 },
Logan Chien17af91b2019-01-15 21:19:56 +08001844 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001845 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001846 },
1847 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001848 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001849 },
1850 },
1851}
1852
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001853cc_library_headers {
1854 name: "libc_headers",
1855 host_supported: true,
1856 native_bridge_supported: true,
1857 vendor_available: true,
1858 ramdisk_available: true,
1859 recovery_available: true,
1860 sdk_version: "1",
1861
1862 apex_available: [
1863 "//apex_available:platform",
1864 "//apex_available:anyapex",
1865 ],
1866 // used by most APEXes indirectly via libunwind_llvm
1867 min_sdk_version: "apex_inherit",
1868 visibility: [
1869 "//bionic:__subpackages__", // visible to bionic
1870 // ... and only to these places (b/152668052)
1871 "//external/arm-optimized-routines",
1872 "//external/gwp_asan",
1873 "//external/jemalloc_new",
1874 "//external/libunwind_llvm",
1875 "//external/scudo",
1876 "//system/core/property_service/libpropertyinfoparser",
1877 "//system/extras/toolchain-extras",
1878 // TODO(b/153662223): Clean up these users that needed visibility when
1879 // the implicit addition of system Bionic paths was removed.
1880 "//art/tools/cpp-define-generator",
1881 "//external/boringssl",
1882 "//external/minijail",
1883 ],
1884
1885 stl: "none",
1886 no_libcrt: true,
1887 system_shared_libs: [],
1888
1889 target: {
1890 android: {
1891 header_libs: ["libc_headers_arch"],
1892 export_header_lib_headers: ["libc_headers_arch"],
1893 },
1894 linux_bionic: {
1895 header_libs: ["libc_headers_arch"],
1896 export_header_lib_headers: ["libc_headers_arch"],
1897 },
1898 }
1899}
1900
Dan Willemsen208ae172015-09-16 16:33:27 -07001901// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001902// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001903// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001904
Dan Willemsen208ae172015-09-16 16:33:27 -07001905cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001906 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001907 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001908 srcs: [
1909 "bionic/__cxa_guard.cpp",
1910 "bionic/__cxa_pure_virtual.cpp",
1911 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001912 ],
1913 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001914 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001915 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001916
Dan Willemsen6b3be172018-12-03 13:57:20 -08001917 static: {
1918 system_shared_libs: [],
1919 },
1920 shared: {
1921 system_shared_libs: ["libc"],
1922 },
1923
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001924 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001925 arch: {
1926 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001927 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001928 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001929 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001930 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001931 },
1932 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001933 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001934 },
1935 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001936 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001937 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001938 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001939 },
1940 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001941 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001942 },
1943 },
1944}
1945
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001946genrule {
1947 name: "libstdc++.arm.map",
1948 out: ["libstdc++.arm.map"],
1949 srcs: ["libstdc++.map.txt"],
1950 tool_files: [":bionic-generate-version-script"],
1951 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1952}
1953
1954genrule {
1955 name: "libstdc++.arm64.map",
1956 out: ["libstdc++.arm64.map"],
1957 srcs: ["libstdc++.map.txt"],
1958 tool_files: [":bionic-generate-version-script"],
1959 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1960}
1961
1962genrule {
1963 name: "libstdc++.x86.map",
1964 out: ["libstdc++.x86.map"],
1965 srcs: ["libstdc++.map.txt"],
1966 tool_files: [":bionic-generate-version-script"],
1967 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1968}
1969
1970genrule {
1971 name: "libstdc++.x86_64.map",
1972 out: ["libstdc++.x86_64.map"],
1973 srcs: ["libstdc++.map.txt"],
1974 tool_files: [":bionic-generate-version-script"],
1975 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1976}
1977
1978// ========================================================
1979// crt object files.
1980// ========================================================
1981
Colin Cross50c21ab2015-10-31 23:03:05 -07001982cc_defaults {
1983 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001984 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001985 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001986 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001987 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001988 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001989 apex_available: [
1990 "//apex_available:platform",
1991 "//apex_available:anyapex",
1992 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001993 // crt* objects are used by most cc_binary/cc_library in "anyapex"
1994 min_sdk_version: "apex_inherit",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001995 cflags: [
1996 "-Wno-gcc-compat",
1997 "-Wall",
1998 "-Werror",
1999 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002000 sanitize: {
2001 never: true,
2002 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002003}
2004
Colin Cross50c21ab2015-10-31 23:03:05 -07002005cc_defaults {
2006 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002007 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002008
2009 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002010 x86: {
2011 cflags: ["-fPIC"],
2012 },
2013 x86_64: {
2014 cflags: ["-fPIC"],
2015 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002016 },
Colin Crossab179442018-09-27 11:03:22 -07002017 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002018}
2019
Dan Willemsen208ae172015-09-16 16:33:27 -07002020cc_object {
2021 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002022 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002023 local_include_dirs: ["include"],
2024 product_variables: {
2025 platform_sdk_version: {
2026 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2027 },
2028 },
2029 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002030
Colin Cross7d7b3682017-11-03 13:38:40 -07002031 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002032}
2033
Dan Willemsen208ae172015-09-16 16:33:27 -07002034cc_object {
2035 name: "crtbegin_so1",
2036 local_include_dirs: ["include"],
2037 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002038
Colin Cross7d7b3682017-11-03 13:38:40 -07002039 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002040}
2041
Dan Willemsen208ae172015-09-16 16:33:27 -07002042cc_object {
2043 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002044
Colin Cross7d7b3682017-11-03 13:38:40 -07002045 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002046 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002047 "crtbegin_so1",
2048 "crtbrand",
2049 ],
2050}
2051
Dan Willemsen208ae172015-09-16 16:33:27 -07002052cc_object {
2053 name: "crtend_so",
2054 local_include_dirs: ["include"],
2055 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002056
Colin Cross7d7b3682017-11-03 13:38:40 -07002057 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002058}
2059
Dan Willemsen208ae172015-09-16 16:33:27 -07002060cc_object {
2061 name: "crtbegin_static1",
2062 local_include_dirs: ["include"],
2063 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002064 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002065}
2066
Dan Willemsen208ae172015-09-16 16:33:27 -07002067cc_object {
2068 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002069
Colin Cross77d57bf2016-04-11 14:34:18 -07002070 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002071 "crtbegin_static1",
2072 "crtbrand",
2073 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002074 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002075}
2076
Dan Willemsen208ae172015-09-16 16:33:27 -07002077cc_object {
2078 name: "crtbegin_dynamic1",
2079 local_include_dirs: ["include"],
2080 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002081 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002082}
2083
Dan Willemsen208ae172015-09-16 16:33:27 -07002084cc_object {
2085 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002086
Colin Cross77d57bf2016-04-11 14:34:18 -07002087 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002088 "crtbegin_dynamic1",
2089 "crtbrand",
2090 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002091 target: {
2092 linux_bionic: {
2093 generated_sources: ["host_bionic_linker_asm"],
2094 objs: [
2095 "linker_wrapper",
2096 ],
2097 },
2098 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002099 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002100}
2101
Dan Willemsen208ae172015-09-16 16:33:27 -07002102cc_object {
2103 // We rename crtend.o to crtend_android.o to avoid a
2104 // name clash between gcc and bionic.
2105 name: "crtend_android",
2106 local_include_dirs: ["include"],
2107 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002108
Colin Cross50c21ab2015-10-31 23:03:05 -07002109 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002110}
Colin Crossbaa48992016-07-13 11:15:21 -07002111
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002112// ========================================================
2113// NDK headers.
2114// ========================================================
2115
Dan Albert26e1c412018-05-24 14:56:46 -07002116versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002117 name: "common_libc",
2118 from: "include",
2119 to: "",
2120 license: "NOTICE",
2121}
Dan Albert4238a352016-06-28 11:18:05 -07002122
2123ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002124 name: "libc_uapi",
2125 from: "kernel/uapi",
2126 to: "",
2127 srcs: [
2128 "kernel/uapi/asm-generic/**/*.h",
2129 "kernel/uapi/drm/**/*.h",
2130 "kernel/uapi/linux/**/*.h",
2131 "kernel/uapi/misc/**/*.h",
2132 "kernel/uapi/mtd/**/*.h",
2133 "kernel/uapi/rdma/**/*.h",
2134 "kernel/uapi/scsi/**/*.h",
2135 "kernel/uapi/sound/**/*.h",
2136 "kernel/uapi/video/**/*.h",
2137 "kernel/uapi/xen/**/*.h",
2138 ],
Dan Albert92592652016-10-20 01:42:54 -07002139 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002140}
2141
2142ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002143 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002144 from: "kernel/android/uapi/linux",
2145 to: "linux",
2146 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002147 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002148}
2149
2150ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002151 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002152 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002153 to: "scsi",
2154 srcs: ["kernel/android/scsi/**/*.h"],
2155 license: "NOTICE",
2156}
2157
2158ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002159 name: "libc_asm_arm",
2160 from: "kernel/uapi/asm-arm",
2161 to: "arm-linux-androideabi",
2162 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002163 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002164}
2165
2166ndk_headers {
2167 name: "libc_asm_arm64",
2168 from: "kernel/uapi/asm-arm64",
2169 to: "aarch64-linux-android",
2170 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002171 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002172}
2173
Lazar Trsic790d2f72017-11-27 11:54:11 +01002174ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002175 name: "libc_asm_x86",
2176 from: "kernel/uapi/asm-x86",
2177 to: "i686-linux-android",
2178 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002179 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002180}
2181
2182ndk_headers {
2183 name: "libc_asm_x86_64",
2184 from: "kernel/uapi/asm-x86",
2185 to: "x86_64-linux-android",
2186 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002187 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002188}
2189
Dan Albert4238a352016-06-28 11:18:05 -07002190ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002191 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002192 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002193 symbol_file: "libc.map.txt",
2194 first_version: "9",
2195}
2196
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002197llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002198 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002199 symbol_file: "libc.map.txt",
2200 export_headers_as_system: true,
2201 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002202 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002203 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002204 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002205 "kernel/android/uapi",
2206 "kernel/uapi",
2207 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002208 arch: {
2209 arm: {
2210 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002211 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002212 ],
2213 },
2214 arm64: {
2215 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002216 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002217 ],
2218 },
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002219 x86: {
2220 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002221 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002222 ],
2223 },
2224 x86_64: {
2225 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002226 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002227 ],
2228 },
2229 },
2230}
2231
Dan Albertdf31aff2016-10-06 15:50:41 -07002232ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002233 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002234 symbol_file: "libstdc++.map.txt",
2235 first_version: "9",
2236}
2237
Dan Willemsenca056d72018-01-08 14:00:24 -08002238// Export these headers for toolbox to process
2239filegroup {
2240 name: "kernel_input_headers",
2241 srcs: [
2242 "kernel/uapi/linux/input.h",
2243 "kernel/uapi/linux/input-event-codes.h",
2244 ],
2245}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002246
2247// Generate a syscall name / number mapping. These objects are text files
2248// (thanks to the -dD -E flags) and not binary files. They will then be
2249// consumed by the genseccomp.py script and converted into C++ code.
2250cc_defaults {
2251 name: "libseccomp_gen_syscall_nrs_defaults",
2252 recovery_available: true,
2253 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2254 cflags: [
2255 "-dD",
2256 "-E",
2257 "-Wall",
2258 "-Werror",
2259 "-nostdinc",
2260 ],
2261}
2262
2263cc_object {
2264 name: "libseccomp_gen_syscall_nrs_arm",
2265 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2266 local_include_dirs: [
2267 "kernel/uapi/asm-arm",
2268 "kernel/uapi",
2269 ],
2270}
2271
2272cc_object {
2273 name: "libseccomp_gen_syscall_nrs_arm64",
2274 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2275 local_include_dirs: [
2276 "kernel/uapi/asm-arm64",
2277 "kernel/uapi",
2278 ],
2279}
2280
2281cc_object {
2282 name: "libseccomp_gen_syscall_nrs_x86",
2283 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2284 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2285 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2286 local_include_dirs: [
2287 "kernel/uapi/asm-x86",
2288 "kernel/uapi",
2289 ],
2290}
2291
2292cc_object {
2293 name: "libseccomp_gen_syscall_nrs_x86_64",
2294 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2295 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2296 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2297 local_include_dirs: [
2298 "kernel/uapi/asm-x86",
2299 "kernel/uapi",
2300 ],
2301}
2302
Elliott Hughesae03b122019-09-17 16:37:05 -07002303// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002304python_binary_host {
2305 name: "genseccomp",
2306 main: "tools/genseccomp.py",
2307
2308 srcs: [
2309 "tools/genseccomp.py",
2310 "tools/gensyscalls.py",
2311 ],
2312
2313 data: [
2314 "kernel/uapi/**/*.h",
2315 ],
2316
2317 version: {
2318 py2: {
2319 enabled: true,
2320 },
2321 py3: {
2322 enabled: false,
2323 },
2324 },
2325}
2326
Martijn Coenen0c6de752019-01-02 12:52:51 +01002327python_binary_host {
2328 name: "genfunctosyscallnrs",
2329 main: "tools/genfunctosyscallnrs.py",
2330
2331 srcs: [
2332 "tools/genseccomp.py",
2333 "tools/genfunctosyscallnrs.py",
2334 "tools/gensyscalls.py",
2335 ],
2336
2337 data: [
2338 "kernel/uapi/**/*.h",
2339 ],
2340
2341 version: {
2342 py2: {
2343 enabled: true,
2344 },
2345 py3: {
2346 enabled: false,
2347 },
2348 },
2349}
2350
2351cc_genrule {
2352 name: "func_to_syscall_nrs",
2353 recovery_available: true,
2354 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2355
2356 tools: [ "genfunctosyscallnrs" ],
2357
2358 srcs: [
2359 "SYSCALLS.TXT",
2360 ":libseccomp_gen_syscall_nrs_arm",
2361 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002362 ":libseccomp_gen_syscall_nrs_x86",
2363 ":libseccomp_gen_syscall_nrs_x86_64",
2364 ],
2365
2366 out: [
2367 "func_to_syscall_nrs.h",
2368 ],
2369}
2370
Martijn Coenenc3752be2019-01-09 16:19:57 +01002371// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2372genrule {
2373 name: "generate_app_zygote_blacklist",
2374 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2375 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2376 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2377}
2378
2379cc_genrule {
2380 name: "libseccomp_policy_app_zygote_sources",
2381 recovery_available: true,
2382 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2383
2384 tools: [ "genseccomp" ],
2385
2386 srcs: [
2387 "SYSCALLS.TXT",
2388 "SECCOMP_WHITELIST_COMMON.TXT",
2389 "SECCOMP_WHITELIST_APP.TXT",
2390 "SECCOMP_BLACKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002391 "SECCOMP_PRIORITY.TXT",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002392 ":generate_app_zygote_blacklist",
2393 ":libseccomp_gen_syscall_nrs_arm",
2394 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002395 ":libseccomp_gen_syscall_nrs_x86",
2396 ":libseccomp_gen_syscall_nrs_x86_64",
2397 ],
2398
2399 out: [
2400 "arm64_app_zygote_policy.cpp",
2401 "arm_app_zygote_policy.cpp",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002402 "x86_64_app_zygote_policy.cpp",
2403 "x86_app_zygote_policy.cpp",
2404 ],
2405}
2406
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002407cc_genrule {
2408 name: "libseccomp_policy_app_sources",
2409 recovery_available: true,
2410 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2411
2412 tools: [ "genseccomp" ],
2413
2414 srcs: [
2415 "SYSCALLS.TXT",
2416 "SECCOMP_WHITELIST_COMMON.TXT",
2417 "SECCOMP_WHITELIST_APP.TXT",
2418 "SECCOMP_BLACKLIST_COMMON.TXT",
2419 "SECCOMP_BLACKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002420 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002421 ":libseccomp_gen_syscall_nrs_arm",
2422 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002423 ":libseccomp_gen_syscall_nrs_x86",
2424 ":libseccomp_gen_syscall_nrs_x86_64",
2425 ],
2426
2427 out: [
2428 "arm64_app_policy.cpp",
2429 "arm_app_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002430 "x86_64_app_policy.cpp",
2431 "x86_app_policy.cpp",
2432 ],
2433}
2434
2435cc_genrule {
2436 name: "libseccomp_policy_system_sources",
2437 recovery_available: true,
2438 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2439
2440 tools: [ "genseccomp" ],
2441
2442 srcs: [
2443 "SYSCALLS.TXT",
2444 "SECCOMP_WHITELIST_COMMON.TXT",
2445 "SECCOMP_WHITELIST_SYSTEM.TXT",
2446 "SECCOMP_BLACKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002447 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002448 ":libseccomp_gen_syscall_nrs_arm",
2449 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002450 ":libseccomp_gen_syscall_nrs_x86",
2451 ":libseccomp_gen_syscall_nrs_x86_64",
2452 ],
2453
2454 out: [
2455 "arm64_system_policy.cpp",
2456 "arm_system_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002457 "x86_64_system_policy.cpp",
2458 "x86_system_policy.cpp",
2459 ],
2460}
2461
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002462cc_library {
2463 name: "libseccomp_policy",
2464 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002465 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002466 generated_sources: [
2467 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002468 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002469 "libseccomp_policy_system_sources",
2470 ],
2471
2472 srcs: [
2473 "seccomp/seccomp_policy.cpp",
2474 ],
2475
2476 export_include_dirs: ["seccomp/include"],
2477 cflags: [
2478 "-Wall",
2479 "-Werror",
2480 ],
2481 shared: {
2482 shared_libs: ["libbase"],
2483 },
2484 static: {
2485 static_libs: ["libbase"],
2486 },
2487}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002488
2489// This is a temporary library that will use scudo as the native memory
2490// allocator. To use it, add it as the first shared library.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002491cc_defaults {
2492 name: "libc_scudo_wrapper_defaults",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002493 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002494 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08002495 "bionic/heap_tagging.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002496 "bionic/malloc_common.cpp",
2497 "bionic/malloc_common_dynamic.cpp",
2498 "bionic/malloc_heapprofd.cpp",
2499 "bionic/malloc_limit.cpp",
2500 "bionic/scudo_wrapper.cpp",
2501 "bionic/__set_errno.cpp",
2502 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002503 cflags: [
2504 "-DUSE_SCUDO",
2505 "-fno-emulated-tls", // Required for GWP-ASan.
2506 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002507 shared_libs: ["libscudo_wrapper"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002508
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002509 header_libs: [
2510 "libc_headers",
2511 "gwp_asan_headers",
2512 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002513
Mitch Phillipsf3968e82020-01-31 19:57:04 -08002514 static_libs: [
2515 "libasync_safe",
2516 "gwp_asan",
2517 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002518
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002519 arch: {
2520 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002521 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002522 },
2523 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002524 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002525 },
2526 x86: {
2527 srcs: [
2528 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002529 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002530 ],
2531 },
2532 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002533 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002534 },
2535 },
2536
2537 // Mark this library as global so it overrides all the allocation
2538 // definitions properly.
2539 ldflags: ["-Wl,-z,global"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002540}
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002541
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002542cc_library_shared {
2543 name: "libc_scudo",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002544 vendor_available: true,
2545 stl: "none",
2546 system_shared_libs: [],
2547
2548 allow_undefined_symbols: true,
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002549 // Like libc, disable native coverage for libc_scudo.
2550 native_coverage: false,
Jooyung Han15c32a82020-04-16 18:26:45 +09002551 apex_available: [
2552 "//apex_available:platform",
2553 "com.android.media.swcodec",
2554 ],
Jooyung Han1beacd42020-05-13 16:55:10 +09002555 min_sdk_version: "apex_inherit",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002556}
2557
2558subdirs = [
2559 "bionic/scudo",
2560]