blob: 570e7856857eacc13e82dab8204aee53e67b5bd1 [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001// Define the common source files for all the libc instances
2// =========================================================
3libc_common_src_files = [
Christopher Ferris7a3681e2017-04-24 17:48:32 -07004 "async_safe/async_safe_log.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07005 "bionic/ether_aton.c",
6 "bionic/ether_ntoa.c",
7 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/pututline.c",
11 "bionic/sched_cpualloc.c",
12 "bionic/sched_cpucount.c",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070013 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070014 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070015 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080016 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070017 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080018 "stdio/vfscanf.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070019 "stdio/vfwscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070020 "stdlib/exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070021]
22
23// Various kinds of cruft.
24// ========================================================
25libc_common_src_files += [
26 "bionic/ndk_cruft.cpp",
27]
28
29libc_common_src_files_32 = [
30 "bionic/legacy_32_bit_support.cpp",
31 "bionic/time64.c",
32]
33
Elliott Hughes53cf3482016-08-09 13:06:41 -070034libc_common_flags = [
35 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080036 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070037 "-Wall",
38 "-Wextra",
39 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080040 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070041 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070042 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070043 "-Wframe-larger-than=2048",
George Burgess IVfa5410f2018-08-13 17:44:06 -070044 "-Wimplicit-fallthrough",
Elliott Hughes53cf3482016-08-09 13:06:41 -070045
46 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
47 "-Werror=pointer-to-int-cast",
48 "-Werror=int-to-pointer-cast",
49 "-Werror=type-limits",
50 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080051
52 // Clang's exit-time destructor registration hides __dso_handle, but
53 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
54 "-Wexit-time-destructors",
Elliott Hughes53cf3482016-08-09 13:06:41 -070055]
56
Dan Willemsen208ae172015-09-16 16:33:27 -070057// Define some common cflags
58// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070059cc_defaults {
60 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080061 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070062 cflags: libc_common_flags,
63 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070064 conlyflags: ["-std=gnu99"],
65 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070066 include_dirs: [
67 "bionic/libc/async_safe/include",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -070068 "external/jemalloc_new/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070069 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070070
Colin Cross50c21ab2015-10-31 23:03:05 -070071 stl: "none",
72 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070073 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070074 address: false,
75 integer_overflow: false,
Colin Cross27c43c52016-04-07 13:27:24 -070076 },
Colin Cross50c21ab2015-10-31 23:03:05 -070077 native_coverage: false,
Jiyong Park5603c6e2018-04-27 21:53:11 +090078 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020079 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080080
Yi Konge3d90de2019-02-20 14:28:56 -080081 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
82 // warning since this is intended right now.
83 ldflags: ["-Wl,-z,muldefs"],
Dan Willemsen208ae172015-09-16 16:33:27 -070084}
85
Dan Willemsen208ae172015-09-16 16:33:27 -070086// ========================================================
87// libc_stack_protector.a - stack protector code
88// ========================================================
89//
Colin Crossa3f9fca2016-01-11 13:20:55 -080090// Code that implements the stack protector (or that runs
91// before TLS has been set up) needs to be compiled with
92// -fno-stack-protector, since it accesses the stack canary
93// TLS slot.
Dan Willemsen208ae172015-09-16 16:33:27 -070094
95cc_library_static {
96
Colin Crossa3f9fca2016-01-11 13:20:55 -080097 srcs: [
98 "bionic/__libc_init_main_thread.cpp",
99 "bionic/__stack_chk_fail.cpp",
100 ],
101 arch: {
102 arm64: {
103 srcs: ["arch-arm64/bionic/__set_tls.c"],
104 },
105 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700106 srcs: [
107 "arch-x86/bionic/__libc_init_sysinfo.cpp",
108 "arch-x86/bionic/__set_tls.cpp",
109 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800110 },
111 x86_64: {
112 srcs: ["arch-x86_64/bionic/__set_tls.c"],
113 },
114 },
115
Colin Cross50c21ab2015-10-31 23:03:05 -0700116 defaults: ["libc_defaults"],
117 cflags: ["-fno-stack-protector"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700118 name: "libc_stack_protector",
Dan Willemsen208ae172015-09-16 16:33:27 -0700119}
120
Colin Crossa3f9fca2016-01-11 13:20:55 -0800121// libc_init_static.cpp also needs to be built without stack protector,
122// because it's responsible for setting up TLS for static executables.
123// This isn't the case for dynamic executables because the dynamic linker
124// has already set up the main thread's TLS.
125
126cc_library_static {
127 name: "libc_init_static",
128 defaults: ["libc_defaults"],
129 srcs: ["bionic/libc_init_static.cpp"],
130 cflags: ["-fno-stack-protector"],
131}
132
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700133cc_library_static {
134 name: "libc_init_dynamic",
135 defaults: ["libc_defaults"],
136 srcs: ["bionic/libc_init_dynamic.cpp"],
137 cflags: ["-fno-stack-protector"],
138}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800139
Dan Willemsen208ae172015-09-16 16:33:27 -0700140// ========================================================
141// libc_tzcode.a - upstream 'tzcode' code
142// ========================================================
143
144cc_library_static {
145
Colin Cross50c21ab2015-10-31 23:03:05 -0700146 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700147 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800148 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700149 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700150 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
151 ],
152
Colin Cross50c21ab2015-10-31 23:03:05 -0700153 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700154 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700155 // Don't use ridiculous amounts of stack.
156 "-DALL_STATE",
157 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
158 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800159 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700160 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700161 // The name of the tm_gmtoff field in our struct tm.
162 "-DTM_GMTOFF=tm_gmtoff",
163 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700164 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700165 // Include `tzname`, `timezone`, and `daylight` globals.
166 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700167 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800168 // Use the empty string (instead of " ") as the timezone abbreviation
169 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700170 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700171 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
172 "-Dlint",
173 ],
174
Dan Willemsen208ae172015-09-16 16:33:27 -0700175 local_include_dirs: ["tzcode/"],
176 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700177}
178
179// ========================================================
180// libc_dns.a - modified NetBSD DNS code
181// ========================================================
182
183cc_library_static {
184
Colin Cross50c21ab2015-10-31 23:03:05 -0700185 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700186 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800187 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700188
189 "upstream-netbsd/lib/libc/isc/ev_streams.c",
190 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700191 ],
192
Colin Cross50c21ab2015-10-31 23:03:05 -0700193 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700194 "-DANDROID_CHANGES",
195 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700196 "-Wno-unused-parameter",
197 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700198 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700199 ],
200
Dan Willemsen208ae172015-09-16 16:33:27 -0700201 local_include_dirs: [
202 "dns/include",
203 "private",
204 "upstream-netbsd/lib/libc/include",
205 "upstream-netbsd/android/include",
206 ],
207
208 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700209}
210
211// ========================================================
212// libc_freebsd.a - upstream FreeBSD C library code
213// ========================================================
214//
215// These files are built with the freebsd-compat.h header file
216// automatically included.
217
218cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700219 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700220 srcs: [
221 "upstream-freebsd/lib/libc/gen/ldexp.c",
222 "upstream-freebsd/lib/libc/gen/sleep.c",
223 "upstream-freebsd/lib/libc/gen/usleep.c",
224 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700225 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
226 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
227 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
228 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700229 "upstream-freebsd/lib/libc/stdlib/qsort.c",
230 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700231 "upstream-freebsd/lib/libc/string/wcpcpy.c",
232 "upstream-freebsd/lib/libc/string/wcpncpy.c",
233 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700234 "upstream-freebsd/lib/libc/string/wcscat.c",
235 "upstream-freebsd/lib/libc/string/wcschr.c",
236 "upstream-freebsd/lib/libc/string/wcscmp.c",
237 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700238 "upstream-freebsd/lib/libc/string/wcscspn.c",
239 "upstream-freebsd/lib/libc/string/wcsdup.c",
240 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700241 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700242 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
243 "upstream-freebsd/lib/libc/string/wcsncat.c",
244 "upstream-freebsd/lib/libc/string/wcsncmp.c",
245 "upstream-freebsd/lib/libc/string/wcsncpy.c",
246 "upstream-freebsd/lib/libc/string/wcsnlen.c",
247 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700248 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700249 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700250 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700251 "upstream-freebsd/lib/libc/string/wcstok.c",
252 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700253 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700254 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700255 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800256 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700257 ],
258 arch: {
259 arm64: {
260 exclude_srcs: [
261 "upstream-freebsd/lib/libc/string/wmemmove.c",
262 ],
263 },
264 x86: {
265 exclude_srcs: [
266 "upstream-freebsd/lib/libc/string/wcschr.c",
267 "upstream-freebsd/lib/libc/string/wcscmp.c",
268 "upstream-freebsd/lib/libc/string/wcslen.c",
269 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700270 "upstream-freebsd/lib/libc/string/wmemcmp.c",
271 "upstream-freebsd/lib/libc/string/wcscat.c",
272 "upstream-freebsd/lib/libc/string/wcscpy.c",
273 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700274 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700275 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700276 },
277
Colin Cross50c21ab2015-10-31 23:03:05 -0700278 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700279 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700280 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700281 "-include freebsd-compat.h",
282 ],
283
Dan Willemsen208ae172015-09-16 16:33:27 -0700284 local_include_dirs: [
285 "upstream-freebsd/android/include",
286 ],
287
288 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700289}
290
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700291cc_library_static {
292 defaults: ["libc_defaults"],
293 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700294 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700295 "upstream-freebsd/lib/libc/stdlib/realpath.c",
296 ],
297
298 cflags: [
299 "-Wno-sign-compare",
300 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700301 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700302 ],
303
304 local_include_dirs: [
305 "upstream-freebsd/android/include",
306 ],
307
308 name: "libc_freebsd_large_stack",
309}
310
Dan Willemsen208ae172015-09-16 16:33:27 -0700311// ========================================================
312// libc_netbsd.a - upstream NetBSD C library code
313// ========================================================
314//
315// These files are built with the netbsd-compat.h header file
316// automatically included.
317
318cc_library_static {
319
Colin Cross50c21ab2015-10-31 23:03:05 -0700320 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700321 srcs: [
322 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700323 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700324 "upstream-netbsd/lib/libc/gen/psignal.c",
325 "upstream-netbsd/lib/libc/gen/utime.c",
326 "upstream-netbsd/lib/libc/gen/utmp.c",
327 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
328 "upstream-netbsd/lib/libc/regex/regcomp.c",
329 "upstream-netbsd/lib/libc/regex/regerror.c",
330 "upstream-netbsd/lib/libc/regex/regexec.c",
331 "upstream-netbsd/lib/libc/regex/regfree.c",
332 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700333 "upstream-netbsd/lib/libc/stdlib/drand48.c",
334 "upstream-netbsd/lib/libc/stdlib/erand48.c",
335 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
336 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700337 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
338 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
339 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
340 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
341 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
342 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
343 "upstream-netbsd/lib/libc/stdlib/seed48.c",
344 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700345 ],
346 multilib: {
347 lib32: {
348 // LP32 cruft
349 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
350 },
351 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700352 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700353 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800354 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700355 "-DPOSIX_MISTAKE",
356 "-include netbsd-compat.h",
357 ],
358
Dan Willemsen208ae172015-09-16 16:33:27 -0700359 local_include_dirs: [
360 "upstream-netbsd/android/include",
361 "upstream-netbsd/lib/libc/include",
362 ],
363
364 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700365}
366
367// ========================================================
368// libc_openbsd_ndk.a - upstream OpenBSD C library code
369// that can be safely included in the libc_ndk.a (doesn't
370// contain any troublesome global data or constructors).
371// ========================================================
372//
373// These files are built with the openbsd-compat.h header file
374// automatically included.
375
376cc_library_static {
377 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700378 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700379 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700380 "upstream-openbsd/lib/libc/gen/alarm.c",
381 "upstream-openbsd/lib/libc/gen/ctype_.c",
382 "upstream-openbsd/lib/libc/gen/daemon.c",
383 "upstream-openbsd/lib/libc/gen/err.c",
384 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700385 "upstream-openbsd/lib/libc/gen/fnmatch.c",
386 "upstream-openbsd/lib/libc/gen/ftok.c",
387 "upstream-openbsd/lib/libc/gen/getprogname.c",
388 "upstream-openbsd/lib/libc/gen/isctype.c",
389 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700390 "upstream-openbsd/lib/libc/gen/tolower_.c",
391 "upstream-openbsd/lib/libc/gen/toupper_.c",
392 "upstream-openbsd/lib/libc/gen/verr.c",
393 "upstream-openbsd/lib/libc/gen/verrx.c",
394 "upstream-openbsd/lib/libc/gen/vwarn.c",
395 "upstream-openbsd/lib/libc/gen/vwarnx.c",
396 "upstream-openbsd/lib/libc/gen/warn.c",
397 "upstream-openbsd/lib/libc/gen/warnx.c",
398 "upstream-openbsd/lib/libc/locale/btowc.c",
399 "upstream-openbsd/lib/libc/locale/mbrlen.c",
400 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
401 "upstream-openbsd/lib/libc/locale/mbtowc.c",
402 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700403 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
404 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700405 "upstream-openbsd/lib/libc/locale/wcstoll.c",
406 "upstream-openbsd/lib/libc/locale/wcstombs.c",
407 "upstream-openbsd/lib/libc/locale/wcstoul.c",
408 "upstream-openbsd/lib/libc/locale/wcstoull.c",
409 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
410 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
411 "upstream-openbsd/lib/libc/locale/wctob.c",
412 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700413 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700414 "upstream-openbsd/lib/libc/net/htonl.c",
415 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700416 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
417 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
418 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700419 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
420 "upstream-openbsd/lib/libc/net/inet_ntop.c",
421 "upstream-openbsd/lib/libc/net/inet_pton.c",
422 "upstream-openbsd/lib/libc/net/ntohl.c",
423 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800424 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700425 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700426 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
427 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700428 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700429 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700430 "upstream-openbsd/lib/libc/stdio/fputwc.c",
431 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700432 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700433 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700434 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700435 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700436 "upstream-openbsd/lib/libc/stdio/makebuf.c",
437 "upstream-openbsd/lib/libc/stdio/mktemp.c",
438 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
439 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700440 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700441 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700442 "upstream-openbsd/lib/libc/stdio/tempnam.c",
443 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
444 "upstream-openbsd/lib/libc/stdio/ungetc.c",
445 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
446 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
447 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700448 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
449 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
450 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700451 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700452 "upstream-openbsd/lib/libc/stdio/wsetup.c",
453 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800454 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700455 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700456 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700457 "upstream-openbsd/lib/libc/stdlib/insque.c",
458 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
459 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
460 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800461 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700462 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800463 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700464 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700465 "upstream-openbsd/lib/libc/stdlib/remque.c",
466 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700467 "upstream-openbsd/lib/libc/stdlib/tfind.c",
468 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800469 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700470 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800471 "upstream-openbsd/lib/libc/string/strcasestr.c",
472 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700473 "upstream-openbsd/lib/libc/string/strcspn.c",
474 "upstream-openbsd/lib/libc/string/strdup.c",
475 "upstream-openbsd/lib/libc/string/strndup.c",
476 "upstream-openbsd/lib/libc/string/strpbrk.c",
477 "upstream-openbsd/lib/libc/string/strsep.c",
478 "upstream-openbsd/lib/libc/string/strspn.c",
479 "upstream-openbsd/lib/libc/string/strstr.c",
480 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800481 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700482 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700483 "upstream-openbsd/lib/libc/string/wcswidth.c",
484 ],
485
Colin Cross50c21ab2015-10-31 23:03:05 -0700486 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700487 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700488 "-Wno-unused-parameter",
489 "-include openbsd-compat.h",
490 ],
491
Dan Willemsen208ae172015-09-16 16:33:27 -0700492 local_include_dirs: [
493 "private",
494 "stdio",
495 "upstream-openbsd/android/include",
496 "upstream-openbsd/lib/libc/include",
497 "upstream-openbsd/lib/libc/gdtoa/",
498 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700499}
500
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700501cc_library_static {
502 name: "libc_openbsd_large_stack",
503 defaults: ["libc_defaults"],
504 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700505 "stdio/vfprintf.cpp",
506 "stdio/vfwprintf.cpp",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700507 ],
508 cflags: [
509 "-include openbsd-compat.h",
510 "-Wno-sign-compare",
511 "-Wframe-larger-than=5000",
512 ],
513
514 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700515 "upstream-openbsd/android/include/",
516 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700517 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700518 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700519 ],
520}
521
Dan Willemsen208ae172015-09-16 16:33:27 -0700522// ========================================================
523// libc_openbsd.a - upstream OpenBSD C library code
524// ========================================================
525//
526// These files are built with the openbsd-compat.h header file
527// automatically included.
528cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700529 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700530 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800531 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700532 "upstream-openbsd/lib/libc/crypt/arc4random.c",
533 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
534
535 // May be overriden by per-arch optimized versions
536 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700537 "upstream-openbsd/lib/libc/string/memrchr.c",
538 "upstream-openbsd/lib/libc/string/stpcpy.c",
539 "upstream-openbsd/lib/libc/string/stpncpy.c",
540 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700541 "upstream-openbsd/lib/libc/string/strcpy.c",
542 "upstream-openbsd/lib/libc/string/strlcat.c",
543 "upstream-openbsd/lib/libc/string/strlcpy.c",
544 "upstream-openbsd/lib/libc/string/strncat.c",
545 "upstream-openbsd/lib/libc/string/strncmp.c",
546 "upstream-openbsd/lib/libc/string/strncpy.c",
547 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700548
549 arch: {
550 arm: {
551 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700552 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800553 "upstream-openbsd/lib/libc/string/stpcpy.c",
554 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700555 ],
556 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700557 arm64: {
558 exclude_srcs: [
559 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700560 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700561 "upstream-openbsd/lib/libc/string/strcpy.c",
562 "upstream-openbsd/lib/libc/string/strncmp.c",
563 ],
564 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530565 mips: {
566 exclude_srcs: [
567 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530568 "upstream-openbsd/lib/libc/string/strcpy.c",
569 "upstream-openbsd/lib/libc/string/strncmp.c",
570 ],
571 },
572 mips64: {
573 exclude_srcs: [
574 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530575 "upstream-openbsd/lib/libc/string/strcpy.c",
576 "upstream-openbsd/lib/libc/string/strncmp.c",
577 ],
578 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700579 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800580 exclude_srcs: [
581 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800582 "upstream-openbsd/lib/libc/string/memrchr.c",
583 "upstream-openbsd/lib/libc/string/stpcpy.c",
584 "upstream-openbsd/lib/libc/string/stpncpy.c",
585 "upstream-openbsd/lib/libc/string/strcat.c",
586 "upstream-openbsd/lib/libc/string/strcpy.c",
587 "upstream-openbsd/lib/libc/string/strncmp.c",
588 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700589 "upstream-openbsd/lib/libc/string/strlcat.c",
590 "upstream-openbsd/lib/libc/string/strlcpy.c",
591 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800592 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700593 },
594
595 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800596 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800597 "upstream-openbsd/lib/libc/string/stpcpy.c",
598 "upstream-openbsd/lib/libc/string/stpncpy.c",
599 "upstream-openbsd/lib/libc/string/strcat.c",
600 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800601 "upstream-openbsd/lib/libc/string/strncat.c",
602 "upstream-openbsd/lib/libc/string/strncmp.c",
603 "upstream-openbsd/lib/libc/string/strncpy.c",
604 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700605 },
606 },
607
Colin Cross50c21ab2015-10-31 23:03:05 -0700608 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700609 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700610 "-Wno-unused-parameter",
611 "-include openbsd-compat.h",
612 ],
613
Dan Willemsen208ae172015-09-16 16:33:27 -0700614 local_include_dirs: [
615 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700616 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700617 ],
618
619 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700620}
621
622// ========================================================
623// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
624// ========================================================
625//
626// These files are built with the openbsd-compat.h header file
627// automatically included.
628
629cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700630 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700631 srcs: [
632 "upstream-openbsd/android/gdtoa_support.cpp",
633 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
634 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
635 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
636 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
637 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
638 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
639 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
640 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
641 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
642 "upstream-openbsd/lib/libc/gdtoa/misc.c",
643 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
644 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
645 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
646 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
647 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
648 "upstream-openbsd/lib/libc/gdtoa/sum.c",
649 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
650 ],
651 multilib: {
652 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800653 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
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 "-include openbsd-compat.h",
660 ],
661
Dan Willemsen208ae172015-09-16 16:33:27 -0700662 local_include_dirs: [
663 "private",
664 "upstream-openbsd/android/include",
665 "upstream-openbsd/lib/libc/include",
666 ],
667
668 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700669}
670
671// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700672// libc_fortify.a - container for our FORITFY
673// implementation details
674// ========================================================
675cc_library_static {
676 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700677 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700678
679 name: "libc_fortify",
680
681 // Disable FORTIFY for the compilation of these, so we don't end up having
682 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800683 cflags: [
684 "-U_FORTIFY_SOURCE",
685 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
686 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700687
688 arch: {
689 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800690 cflags: [
691 "-DNO___MEMCPY_CHK",
692 "-DRENAME___STRCAT_CHK",
693 "-DRENAME___STRCPY_CHK",
694 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700695 srcs: [
696 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800697
698 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
699 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
700
701 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
702 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
703
704 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
705 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
706
707 "arch-arm/krait/bionic/__strcat_chk.S",
708 "arch-arm/krait/bionic/__strcpy_chk.S",
709
710 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
711 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
712
Haibo Huang01bfd892018-12-03 15:05:16 -0800713 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
714 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700715 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700716 },
717 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700718 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700719 srcs: [
720 "arch-arm64/generic/bionic/__memcpy_chk.S",
721 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700722 },
723 },
724}
725
726// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700727// libc_bionic.a - home-grown C library code
728// ========================================================
729
730cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700731 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700732 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700733 // The data that backs getauxval is initialized in the libc init
734 // functions which are invoked by the linker. If this file is included
735 // in libc_ndk.a, only one of the copies of the global data will be
736 // initialized, resulting in nullptr dereferences.
737 "bionic/getauxval.cpp",
738
Elliott Hughes211c4d32018-02-02 15:10:32 -0800739 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700740 "bionic/sysconf.cpp",
741 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700742 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700743
Josh Gao10ec9282017-04-03 15:13:29 -0700744 // The following must not be statically linked into libc_ndk.a, because
745 // debuggerd will look for the abort message in libc.so's copy.
746 "bionic/android_set_abort_message.cpp",
747
Dan Willemsen208ae172015-09-16 16:33:27 -0700748 "bionic/strchr.cpp",
749 "bionic/strnlen.c",
750 "bionic/strrchr.cpp",
751 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700752
753 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700754 arm: {
755 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800756 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700757 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800758 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800759 "arch-arm/generic/bionic/stpcpy.c",
760 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800761 "arch-arm/generic/bionic/strcmp.S",
762 "arch-arm/generic/bionic/strcpy.S",
763 "arch-arm/generic/bionic/strlen.c",
764
Ryan Prichard45024fe2018-12-30 21:10:26 -0800765 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700766 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700767 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700768 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700769 "arch-arm/bionic/atomics_arm.c",
770 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800771 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700772 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700773 "arch-arm/bionic/setjmp.S",
774 "arch-arm/bionic/syscall.S",
775 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800776
777 "arch-arm/cortex-a15/bionic/memcpy.S",
778 "arch-arm/cortex-a15/bionic/memmove.S",
779 "arch-arm/cortex-a15/bionic/memset.S",
780 "arch-arm/cortex-a15/bionic/stpcpy.S",
781 "arch-arm/cortex-a15/bionic/strcat.S",
782 "arch-arm/cortex-a15/bionic/strcmp.S",
783 "arch-arm/cortex-a15/bionic/strcpy.S",
784 "arch-arm/cortex-a15/bionic/strlen.S",
785
786 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800787 "arch-arm/cortex-a7/bionic/memset.S",
788
789 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800790 "arch-arm/cortex-a9/bionic/memset.S",
791 "arch-arm/cortex-a9/bionic/stpcpy.S",
792 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800793 "arch-arm/cortex-a9/bionic/strcpy.S",
794 "arch-arm/cortex-a9/bionic/strlen.S",
795
796 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800797 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800798
799 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800800
Haibo Huang01bfd892018-12-03 15:05:16 -0800801 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800802
803 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700804 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700805 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700806 arm64: {
807 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700808 "arch-arm64/generic/bionic/memchr.S",
809 "arch-arm64/generic/bionic/memcmp.S",
810 "arch-arm64/generic/bionic/memcpy.S",
811 "arch-arm64/generic/bionic/memmove.S",
812 "arch-arm64/generic/bionic/memset.S",
813 "arch-arm64/generic/bionic/stpcpy.S",
814 "arch-arm64/generic/bionic/strchr.S",
815 "arch-arm64/generic/bionic/strcmp.S",
816 "arch-arm64/generic/bionic/strcpy.S",
817 "arch-arm64/generic/bionic/strlen.S",
818 "arch-arm64/generic/bionic/strncmp.S",
819 "arch-arm64/generic/bionic/strnlen.S",
820 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800821
822 "arch-arm64/bionic/__bionic_clone.S",
823 "arch-arm64/bionic/_exit_with_stack_teardown.S",
824 "arch-arm64/bionic/setjmp.S",
825 "arch-arm64/bionic/syscall.S",
826 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700827 ],
828 exclude_srcs: [
829 "bionic/__memcpy_chk.cpp",
830 "bionic/strchr.cpp",
831 "bionic/strnlen.c",
832 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700833 },
834
835 mips: {
836 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800837 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530838 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800839 "arch-mips/string/memset.S",
840 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530841 "arch-mips/string/strncmp.S",
842 "arch-mips/string/strlen.c",
843 "arch-mips/string/strnlen.c",
844 "arch-mips/string/strchr.c",
845 "arch-mips/string/strcpy.c",
846 "arch-mips/string/memchr.c",
847 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800848
Dan Willemsen208ae172015-09-16 16:33:27 -0700849 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700850 "arch-mips/bionic/cacheflush.cpp",
851 "arch-mips/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800852 "arch-mips/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700853 "arch-mips/bionic/setjmp.S",
854 "arch-mips/bionic/syscall.S",
855 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700856 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530857 exclude_srcs: [
858 "bionic/strchr.cpp",
859 "bionic/strnlen.c",
860 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700861 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700862 mips64: {
863 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800864 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530865 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800866 "arch-mips/string/memset.S",
867 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530868 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800869 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530870 "arch-mips/string/strnlen.c",
871 "arch-mips/string/strchr.c",
872 "arch-mips/string/strcpy.c",
873 "arch-mips/string/memchr.c",
874 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800875
Dan Willemsen208ae172015-09-16 16:33:27 -0700876 "arch-mips64/bionic/__bionic_clone.S",
877 "arch-mips64/bionic/_exit_with_stack_teardown.S",
878 "arch-mips64/bionic/setjmp.S",
879 "arch-mips64/bionic/syscall.S",
880 "arch-mips64/bionic/vfork.S",
881 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700882 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530883 exclude_srcs: [
884 "bionic/strchr.cpp",
885 "bionic/strnlen.c",
886 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700887 },
888
889 x86: {
890 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700891 "arch-x86/generic/string/memcmp.S",
892 "arch-x86/generic/string/strcmp.S",
893 "arch-x86/generic/string/strncmp.S",
894 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700895
896 "arch-x86/generic/string/strlcat.c",
897 "arch-x86/generic/string/strlcpy.c",
898 "arch-x86/generic/string/strncat.c",
899 "arch-x86/generic/string/wcscat.c",
900 "arch-x86/generic/string/wcscpy.c",
901 "arch-x86/generic/string/wmemcmp.c",
902
Dan Willemsen208ae172015-09-16 16:33:27 -0700903 "arch-x86/atom/string/sse2-memchr-atom.S",
904 "arch-x86/atom/string/sse2-memrchr-atom.S",
905 "arch-x86/atom/string/sse2-strchr-atom.S",
906 "arch-x86/atom/string/sse2-strnlen-atom.S",
907 "arch-x86/atom/string/sse2-strrchr-atom.S",
908 "arch-x86/atom/string/sse2-wcschr-atom.S",
909 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
910 "arch-x86/atom/string/sse2-wcslen-atom.S",
911 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700912 "arch-x86/silvermont/string/sse2-memmove-slm.S",
913 "arch-x86/silvermont/string/sse2-memset-slm.S",
914 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
915 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
916 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
917 "arch-x86/silvermont/string/sse2-strlen-slm.S",
918 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800919
920 "arch-x86/bionic/__bionic_clone.S",
921 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800922 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800923 "arch-x86/bionic/__restore.S",
924 "arch-x86/bionic/setjmp.S",
925 "arch-x86/bionic/syscall.S",
926 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700927
928 // ssse3 functions
929 "arch-x86/atom/string/ssse3-strcat-atom.S",
930 "arch-x86/atom/string/ssse3-strcmp-atom.S",
931 "arch-x86/atom/string/ssse3-strlcat-atom.S",
932 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
933 "arch-x86/atom/string/ssse3-strncat-atom.S",
934 "arch-x86/atom/string/ssse3-strncmp-atom.S",
935 "arch-x86/atom/string/ssse3-wcscat-atom.S",
936 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
937
938 // sse4 functions
939 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
940 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
941
942 // atom functions
943 "arch-x86/atom/string/sse2-memset-atom.S",
944 "arch-x86/atom/string/sse2-strlen-atom.S",
945 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800946 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700947 "arch-x86/atom/string/ssse3-strcpy-atom.S",
948 "arch-x86/atom/string/ssse3-strncpy-atom.S",
949 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700950 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700951
952 exclude_srcs: [
953 "bionic/strchr.cpp",
954 "bionic/strnlen.c",
955 "bionic/strrchr.cpp",
956 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700957 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700958 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700959 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700960 "arch-x86_64/string/sse2-memmove-slm.S",
961 "arch-x86_64/string/sse2-memset-slm.S",
962 "arch-x86_64/string/sse2-stpcpy-slm.S",
963 "arch-x86_64/string/sse2-stpncpy-slm.S",
964 "arch-x86_64/string/sse2-strcat-slm.S",
965 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700966 "arch-x86_64/string/sse2-strlen-slm.S",
967 "arch-x86_64/string/sse2-strncat-slm.S",
968 "arch-x86_64/string/sse2-strncpy-slm.S",
969 "arch-x86_64/string/sse4-memcmp-slm.S",
970 "arch-x86_64/string/ssse3-strcmp-slm.S",
971 "arch-x86_64/string/ssse3-strncmp-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800972
973 "arch-x86_64/bionic/__bionic_clone.S",
974 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
975 "arch-x86_64/bionic/__restore_rt.S",
976 "arch-x86_64/bionic/setjmp.S",
977 "arch-x86_64/bionic/syscall.S",
978 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700979 ],
980 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700981 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700982
Colin Cross50c21ab2015-10-31 23:03:05 -0700983 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700984 include_dirs: ["bionic/libstdc++/include"],
985 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700986}
987
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000988genrule {
989 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -0800990 out: ["generated_android_ids.h"],
991 srcs: [":android_filesystem_config_header"],
992 tool_files: ["fs_config_generator.py"],
993 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000994}
995
Dan Willemsen268a6732015-10-15 14:49:45 -0700996// ========================================================
997// libc_bionic_ndk.a- The portions of libc_bionic that can
998// be safely used in libc_ndk.a (no troublesome global data
999// or constructors).
1000// ========================================================
1001cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001002 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001003 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001004 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001005 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001006 "bionic/__cmsg_nxthdr.cpp",
1007 "bionic/__errno.cpp",
1008 "bionic/__gnu_basename.cpp",
1009 "bionic/__libc_current_sigrtmax.cpp",
1010 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001011 "bionic/abort.cpp",
1012 "bionic/accept.cpp",
1013 "bionic/accept4.cpp",
1014 "bionic/access.cpp",
1015 "bionic/arpa_inet.cpp",
1016 "bionic/assert.cpp",
1017 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001018 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001019 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001020 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001021 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001022 "bionic/bionic_systrace.cpp",
1023 "bionic/bionic_time_conversions.cpp",
1024 "bionic/brk.cpp",
1025 "bionic/c16rtomb.cpp",
1026 "bionic/c32rtomb.cpp",
1027 "bionic/chmod.cpp",
1028 "bionic/chown.cpp",
1029 "bionic/clearenv.cpp",
1030 "bionic/clock.cpp",
1031 "bionic/clock_getcpuclockid.cpp",
1032 "bionic/clock_nanosleep.cpp",
1033 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001034 "bionic/connect.cpp",
1035 "bionic/ctype.cpp",
1036 "bionic/dirent.cpp",
1037 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001038 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001039 "bionic/error.cpp",
1040 "bionic/eventfd_read.cpp",
1041 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001042 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001043 "bionic/faccessat.cpp",
1044 "bionic/fchmod.cpp",
1045 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001046 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001047 "bionic/ffs.cpp",
1048 "bionic/fgetxattr.cpp",
1049 "bionic/flistxattr.cpp",
1050 "bionic/flockfile.cpp",
1051 "bionic/fpclassify.cpp",
1052 "bionic/fsetxattr.cpp",
1053 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001054 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001055 "bionic/futimens.cpp",
1056 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001057 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001058 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001059 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001060 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001061 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001062 "bionic/getpgrp.cpp",
1063 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001064 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001065 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001066 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001067 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001068 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001069 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001070 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001071 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001072 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001073 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001074 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001075 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001076 "bionic/lchown.cpp",
1077 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001078 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001079 "bionic/libgen.cpp",
1080 "bionic/link.cpp",
1081 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001082 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001083 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001084 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001085 "bionic/mbrtoc16.cpp",
1086 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001087 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001088 "bionic/mempcpy.cpp",
1089 "bionic/mkdir.cpp",
1090 "bionic/mkfifo.cpp",
1091 "bionic/mknod.cpp",
1092 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001093 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001094 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001095 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001096 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001097 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001098 "bionic/open.cpp",
1099 "bionic/pathconf.cpp",
1100 "bionic/pause.cpp",
1101 "bionic/pipe.cpp",
1102 "bionic/poll.cpp",
1103 "bionic/posix_fadvise.cpp",
1104 "bionic/posix_fallocate.cpp",
1105 "bionic/posix_madvise.cpp",
1106 "bionic/posix_timers.cpp",
1107 "bionic/ptrace.cpp",
1108 "bionic/pty.cpp",
1109 "bionic/raise.cpp",
1110 "bionic/rand.cpp",
1111 "bionic/readlink.cpp",
1112 "bionic/reboot.cpp",
1113 "bionic/recv.cpp",
1114 "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",
Dan Willemsen268a6732015-10-15 14:49:45 -07001127 "bionic/socket.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001128 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001129 "bionic/stat.cpp",
1130 "bionic/statvfs.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001131 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001132 "bionic/strchrnul.cpp",
1133 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001134 "bionic/string_l.cpp",
1135 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001136 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001137 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001138 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001139 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001140 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001141 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001142 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001143 "bionic/sys_msg.cpp",
1144 "bionic/sys_sem.cpp",
1145 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001146 "bionic/sys_signalfd.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001147 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001148 "bionic/sysinfo.cpp",
1149 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001150 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001151 "bionic/system_property_api.cpp",
1152 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001153 "bionic/tdestroy.cpp",
1154 "bionic/termios.cpp",
1155 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001156 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001157 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001158 "bionic/tmpfile.cpp",
1159 "bionic/umount.cpp",
1160 "bionic/unlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001161 "bionic/wait.cpp",
1162 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001163 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001164 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001165 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001166 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001167 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001168
1169 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1170 // which will be overridden by the actual one in libc.so.
1171 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001172 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001173
Dan Willemsen208ae172015-09-16 16:33:27 -07001174 multilib: {
1175 lib32: {
1176 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001177 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001178 },
1179 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001180 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001181 treble_linker_namespaces: {
1182 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001183 },
1184 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001185 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001186 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001187 local_include_dirs: ["stdio"],
1188 include_dirs: ["bionic/libstdc++/include"],
1189 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001190 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001191}
1192
Dan Willemsen208ae172015-09-16 16:33:27 -07001193// ========================================================
1194// libc_pthread.a - pthreads parts that previously lived in
1195// libc_bionic.a. Relocated to their own library because
1196// they can't be included in libc_ndk.a (as they layout of
1197// pthread_t has changed over the years and has ABI
1198// compatibility issues).
1199// ========================================================
1200
1201cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001202 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001203 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001204 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001205 "bionic/pthread_atfork.cpp",
1206 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001207 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001208 "bionic/pthread_cond.cpp",
1209 "bionic/pthread_create.cpp",
1210 "bionic/pthread_detach.cpp",
1211 "bionic/pthread_equal.cpp",
1212 "bionic/pthread_exit.cpp",
1213 "bionic/pthread_getcpuclockid.cpp",
1214 "bionic/pthread_getschedparam.cpp",
1215 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001216 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001217 "bionic/pthread_join.cpp",
1218 "bionic/pthread_key.cpp",
1219 "bionic/pthread_kill.cpp",
1220 "bionic/pthread_mutex.cpp",
1221 "bionic/pthread_once.cpp",
1222 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001223 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001224 "bionic/pthread_self.cpp",
1225 "bionic/pthread_setname_np.cpp",
1226 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001227 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001228
1229 // The following implementations depend on pthread data or implementation,
1230 // so we can't include them in libc_ndk.a.
1231 "bionic/__cxa_thread_atexit_impl.cpp",
1232 "stdlib/atexit.c",
1233 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001234 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001235
Colin Cross50c21ab2015-10-31 23:03:05 -07001236 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001237 include_dirs: ["bionic/libstdc++/include"],
1238 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001239}
1240
1241// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001242// libc_syscalls.a
1243// ========================================================
1244
Elliott Hughes782c4852019-04-16 12:31:00 -07001245genrule {
1246 name: "syscalls-arm.S",
1247 out: ["syscalls-arm.S"],
1248 srcs: ["SYSCALLS.TXT"],
1249 tool_files: [":bionic-gensyscalls"],
1250 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1251}
1252
1253genrule {
1254 name: "syscalls-arm64.S",
1255 out: ["syscalls-arm64.S"],
1256 srcs: ["SYSCALLS.TXT"],
1257 tool_files: [":bionic-gensyscalls"],
1258 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1259}
1260
1261genrule {
1262 name: "syscalls-x86.S",
1263 out: ["syscalls-x86.S"],
1264 srcs: ["SYSCALLS.TXT"],
1265 tool_files: [":bionic-gensyscalls"],
1266 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1267}
1268
1269genrule {
1270 name: "syscalls-x86_64.S",
1271 out: ["syscalls-x86_64.S"],
1272 srcs: ["SYSCALLS.TXT"],
1273 tool_files: [":bionic-gensyscalls"],
1274 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1275}
1276
Dan Willemsen208ae172015-09-16 16:33:27 -07001277cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001278 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001279 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001280 arch: {
1281 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001282 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001283 },
1284 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001285 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001286 },
1287 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001288 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001289 },
1290 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001291 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001292 },
1293 },
1294 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001295}
1296
1297// ========================================================
1298// libc_aeabi.a
1299// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1300// to avoid infinite recursion. For the other architectures we just build an
1301// empty library to keep this makefile simple.
1302// ========================================================
1303
1304cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001305 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001306 arch: {
1307 arm: {
1308 srcs: ["arch-arm/bionic/__aeabi.c"],
1309 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001310 },
1311 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001312 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001313}
1314
1315// ========================================================
1316// libc_ndk.a
1317// Compatibility library for the NDK. This library contains
1318// all the parts of libc that are safe to statically link.
1319// We can't safely statically link things that can only run
1320// on a certain version of the OS. Examples include
1321// anything that talks to netd (a large portion of the DNS
1322// code) and anything that is dependent on the layout of a
1323// data structure that has changed across releases (such as
1324// pthread_t).
1325// ========================================================
1326
1327cc_library_static {
1328 name: "libc_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001329 defaults: ["libc_defaults"],
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001330 srcs: libc_common_src_files + [
1331 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001332 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001333 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001334 multilib: {
1335 lib32: {
1336 srcs: libc_common_src_files_32,
1337 },
1338 },
1339 arch: {
1340 arm: {
1341 srcs: [
1342 "arch-arm/bionic/exidx_dynamic.c",
1343 "arch-common/bionic/crtbegin_so.c",
1344 "arch-arm/bionic/atexit_legacy.c",
1345 "arch-common/bionic/crtend_so.S",
1346 ],
1347 whole_static_libs: ["libc_aeabi"],
1348 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001349 },
1350
Colin Cross50c21ab2015-10-31 23:03:05 -07001351 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001352 "-fvisibility=hidden",
1353 "-DLIBC_STATIC",
1354 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001355
1356 whole_static_libs: [
1357 "libc_bionic_ndk",
George Burgess IV6cb06872017-07-21 13:28:42 -07001358 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001359 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001360 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001361 "libc_gdtoa",
1362 "libc_malloc",
1363 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001364 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001365 "libc_openbsd_ndk",
1366 "libc_stack_protector",
1367 "libc_syscalls",
1368 "libc_tzcode",
1369 "libm",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001370 "libjemalloc5",
Elliott Hughes816fab92016-05-27 17:57:46 -07001371 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001372 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001373}
1374
1375// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001376// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001377// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001378cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001379 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001380 srcs: libc_common_src_files,
1381 multilib: {
1382 lib32: {
1383 srcs: libc_common_src_files_32,
1384 },
1385 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001386 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001387
1388 whole_static_libs: [
1389 "libc_bionic",
1390 "libc_bionic_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001391 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001392 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001393 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001394 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001395 "libc_gdtoa",
1396 "libc_malloc",
1397 "libc_netbsd",
1398 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001399 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001400 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001401 "libc_stack_protector",
1402 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001403 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001404 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001405 ],
1406
1407 arch: {
1408 arm: {
1409 whole_static_libs: ["libc_aeabi"],
1410 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001411 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001412}
1413
1414// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001415// libc_common.a
1416// ========================================================
1417
1418cc_library_static {
1419 defaults: ["libc_defaults"],
1420 name: "libc_common",
1421
1422 whole_static_libs: [
1423 "libc_nopthread",
1424 "libc_pthread",
1425 ],
1426}
1427
1428// ========================================================
Haibo Huangf71edfa2018-11-12 10:06:56 -08001429// libc_common_static.a For static binaries.
1430// ========================================================
1431cc_library_static {
1432 defaults: ["libc_defaults"],
1433 name: "libc_common_static",
1434
Haibo Huangb9244ff2018-08-11 10:12:13 -07001435 arch: {
1436 x86: {
1437 srcs: ["arch-x86/static_function_dispatch.S"],
1438 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001439 arm: {
1440 srcs: ["arch-arm/static_function_dispatch.S"],
1441 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001442 },
1443
Haibo Huangf71edfa2018-11-12 10:06:56 -08001444 whole_static_libs: [
1445 "libc_common",
1446 ],
1447}
1448
1449// ========================================================
1450// libc_common_shared.a For shared libraries.
1451// ========================================================
1452cc_library_static {
1453 defaults: ["libc_defaults"],
1454 name: "libc_common_shared",
1455
Haibo Huangb9244ff2018-08-11 10:12:13 -07001456 cflags: [
1457 "-fno-stack-protector",
1458 "-fno-jump-tables",
1459 ],
1460 arch: {
1461 x86: {
1462 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1463 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001464 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001465 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001466 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001467 },
1468
Haibo Huangf71edfa2018-11-12 10:06:56 -08001469 whole_static_libs: [
1470 "libc_common",
1471 ],
1472}
1473
1474// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001475// libc_nomalloc.a
1476// ========================================================
1477//
1478// This is a version of the static C library that does not
1479// include malloc. It's useful in situations when the user wants
1480// to provide their own malloc implementation, or wants to
1481// explicitly disallow the use of malloc, such as in the
1482// dynamic linker.
1483
1484cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001485 name: "libc_nomalloc",
1486
Colin Cross50c21ab2015-10-31 23:03:05 -07001487 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001488
1489 arch: {
1490 arm: {
1491 srcs: ["arch-arm/bionic/exidx_static.c"],
1492 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001493 },
1494
Colin Cross50c21ab2015-10-31 23:03:05 -07001495 cflags: ["-DLIBC_STATIC"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001496
Colin Crossa3f9fca2016-01-11 13:20:55 -08001497 whole_static_libs: [
Haibo Huangf71edfa2018-11-12 10:06:56 -08001498 "libc_common_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001499 "libc_init_static",
1500 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001501}
1502
1503// ========================================================
1504// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1505// ========================================================
1506cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001507 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001508 srcs: ["bionic/jemalloc_wrapper.cpp"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001509 cflags: ["-fvisibility=hidden"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001510
Dan Willemsen208ae172015-09-16 16:33:27 -07001511 name: "libc_malloc",
Dan Willemsen208ae172015-09-16 16:33:27 -07001512}
1513
dimitryc0c0ef62018-12-05 16:33:52 +01001514filegroup {
1515 name: "libc_sources_shared",
1516 srcs: [
1517 "arch-common/bionic/crtbegin_so.c",
1518 "arch-common/bionic/crtbrand.S",
1519 "bionic/icu.cpp",
1520 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001521 "bionic/malloc_common_dynamic.cpp",
1522 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001523 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001524 "bionic/NetdClient.cpp",
1525 "arch-common/bionic/crtend_so.S",
1526 ],
1527}
1528
1529filegroup {
1530 name: "libc_sources_static",
1531 srcs: [
1532 "bionic/dl_iterate_phdr_static.cpp",
1533 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001534 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001535 ],
1536}
1537
1538filegroup {
1539 name: "libc_sources_shared_arm",
1540 srcs: [
1541 "arch-arm/bionic/exidx_dynamic.c",
1542 "arch-arm/bionic/atexit_legacy.c",
1543 ],
1544}
1545
1546filegroup {
1547 name: "libc_sources_static_arm",
1548 srcs: [ "arch-arm/bionic/exidx_static.c" ],
1549}
1550
Dan Willemsen208ae172015-09-16 16:33:27 -07001551// ========================================================
1552// libc.a + libc.so
1553// ========================================================
1554cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001555 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001556 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001557 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001558 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001559 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001560 platform_sdk_version: {
1561 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1562 },
1563 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001564 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001565 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001566 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001567 whole_static_libs: [
1568 "libc_init_static",
1569 "libc_common_static",
1570 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001571 },
1572 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001573 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001574 whole_static_libs: [
1575 "libc_init_dynamic",
1576 "libc_common_shared",
1577 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001578 },
1579
Neil Fullera7db90f2019-04-25 09:28:27 +01001580 required: [
1581 "tzdata",
1582 "tz_version", // Version metadata for tzdata to help debugging.
1583 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001584
Colin Cross4ce94d22016-11-15 13:15:43 -08001585 // Do not pack libc.so relocations; see http://b/20645321 for details.
1586 pack_relocations: false,
1587
dimitry06016f22018-01-05 11:39:28 +01001588 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1589 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1590 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1591 // those new libraries from libgcc.a are not declared external; if that were the case,
1592 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1593 // on the external symbols from the dependent libraries. That would create a "cloaked"
1594 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001595
dimitry06016f22018-01-05 11:39:28 +01001596 shared_libs: [
1597 "ld-android",
1598 "libdl",
1599 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001600 static_libs: [
1601 "libdl_android",
1602 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001603 whole_static_libs: [
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001604 "libjemalloc5",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001605 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001606
1607 nocrt: true,
1608
Dan Willemsen208ae172015-09-16 16:33:27 -07001609 arch: {
1610 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001611 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001612 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001613 ldflags: ["-Wl,--hash-style=both"],
1614
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001615 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001616
Dan Willemsen208ae172015-09-16 16:33:27 -07001617 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001618 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001619 // special for arm
1620 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001621 },
1622 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001623 srcs: [":libc_sources_static_arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001624 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001625
1626 // Arm 32 bit does not produce complete exidx unwind information
1627 // so keep the .debug_frame which is relatively small and does
1628 // include needed unwind information.
1629 // See b/132992102 for details.
1630 strip: {
1631 keep_symbols_and_debug_frame: true,
1632 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001633 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001634 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001635 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001636
1637 // Leave the symbols in the shared library so that stack unwinders can produce
1638 // meaningful name resolution.
1639 strip: {
1640 keep_symbols: true,
1641 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001642 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001643 x86: {
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.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001649
1650 // Leave the symbols in the shared library so that stack unwinders can produce
1651 // meaningful name resolution.
1652 strip: {
1653 keep_symbols: true,
1654 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001655 },
1656 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001657 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001658
1659 // Leave the symbols in the shared library so that stack unwinders can produce
1660 // meaningful name resolution.
1661 strip: {
1662 keep_symbols: true,
1663 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001664 },
1665 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001666
1667 stubs: {
1668 symbol_file: "libc.map.txt",
1669 versions: ["10000"],
1670 },
Vic Yang6903fb82019-01-14 11:34:39 -08001671
1672 symbol_ordering_file: "symbol_ordering",
Dan Willemsen208ae172015-09-16 16:33:27 -07001673}
1674
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001675genrule {
1676 name: "libc.arm.map",
1677 out: ["libc.arm.map"],
1678 srcs: ["libc.map.txt"],
1679 tool_files: [":bionic-generate-version-script"],
1680 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1681}
1682
1683genrule {
1684 name: "libc.arm64.map",
1685 out: ["libc.arm64.map"],
1686 srcs: ["libc.map.txt"],
1687 tool_files: [":bionic-generate-version-script"],
1688 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1689}
1690
1691genrule {
1692 name: "libc.x86.map",
1693 out: ["libc.x86.map"],
1694 srcs: ["libc.map.txt"],
1695 tool_files: [":bionic-generate-version-script"],
1696 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1697}
1698
1699genrule {
1700 name: "libc.x86_64.map",
1701 out: ["libc.x86_64.map"],
1702 srcs: ["libc.map.txt"],
1703 tool_files: [":bionic-generate-version-script"],
1704 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1705}
1706
Logan Chien17af91b2019-01-15 21:19:56 +08001707// libc_headers for libasync_safe and libpropertyinfoparser
1708cc_library_headers {
1709 name: "libc_headers",
1710
1711 host_supported: true,
1712 vendor_available: true,
1713 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001714 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001715
1716 no_libcrt: true,
1717 no_libgcc: true,
1718 stl: "none",
1719 system_shared_libs: [],
1720
1721 export_include_dirs: [
1722 "include",
1723 "kernel/uapi",
1724 "kernel/android/uapi",
1725 ],
1726
1727 arch: {
1728 arm: {
1729 export_include_dirs: [
1730 "kernel/uapi/asm-arm",
1731 ],
1732 },
1733 arm64: {
1734 export_include_dirs: [
1735 "kernel/uapi/asm-arm64",
1736 ],
1737 },
1738 mips: {
1739 export_include_dirs: [
1740 "kernel/uapi/asm-mips",
1741 ],
1742 },
1743 mips64: {
1744 export_include_dirs: [
1745 "kernel/uapi/asm-mips",
1746 ],
1747 },
1748 x86: {
1749 export_include_dirs: [
1750 "kernel/uapi/asm-x86",
1751 ],
1752 },
1753 x86_64: {
1754 export_include_dirs: [
1755 "kernel/uapi/asm-x86",
1756 ],
1757 },
1758 },
1759}
1760
Dan Willemsen208ae172015-09-16 16:33:27 -07001761// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001762// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001763// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001764
Dan Willemsen208ae172015-09-16 16:33:27 -07001765cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001766 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001767 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001768 srcs: [
1769 "bionic/__cxa_guard.cpp",
1770 "bionic/__cxa_pure_virtual.cpp",
1771 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001772 ],
1773 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001774 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001775 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001776
Dan Willemsen6b3be172018-12-03 13:57:20 -08001777 static: {
1778 system_shared_libs: [],
1779 },
1780 shared: {
1781 system_shared_libs: ["libc"],
1782 },
1783
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001784 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001785 arch: {
1786 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001787 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001788 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001789 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001790 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001791 },
1792 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001793 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001794 },
1795 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001796 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001797 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001798 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001799 },
1800 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001801 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001802 },
1803 },
1804}
1805
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001806genrule {
1807 name: "libstdc++.arm.map",
1808 out: ["libstdc++.arm.map"],
1809 srcs: ["libstdc++.map.txt"],
1810 tool_files: [":bionic-generate-version-script"],
1811 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1812}
1813
1814genrule {
1815 name: "libstdc++.arm64.map",
1816 out: ["libstdc++.arm64.map"],
1817 srcs: ["libstdc++.map.txt"],
1818 tool_files: [":bionic-generate-version-script"],
1819 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1820}
1821
1822genrule {
1823 name: "libstdc++.x86.map",
1824 out: ["libstdc++.x86.map"],
1825 srcs: ["libstdc++.map.txt"],
1826 tool_files: [":bionic-generate-version-script"],
1827 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1828}
1829
1830genrule {
1831 name: "libstdc++.x86_64.map",
1832 out: ["libstdc++.x86_64.map"],
1833 srcs: ["libstdc++.map.txt"],
1834 tool_files: [":bionic-generate-version-script"],
1835 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1836}
1837
1838// ========================================================
1839// crt object files.
1840// ========================================================
1841
Colin Cross50c21ab2015-10-31 23:03:05 -07001842cc_defaults {
1843 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001844 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001845 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001846 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001847 native_bridge_supported: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001848
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001849 cflags: [
1850 "-Wno-gcc-compat",
1851 "-Wall",
1852 "-Werror",
1853 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001854}
1855
Colin Cross50c21ab2015-10-31 23:03:05 -07001856cc_defaults {
1857 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001858 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001859
1860 arch: {
1861 mips: {
1862 cflags: ["-fPIC"],
1863 },
1864 mips64: {
1865 cflags: ["-fPIC"],
1866 },
1867 x86: {
1868 cflags: ["-fPIC"],
1869 },
1870 x86_64: {
1871 cflags: ["-fPIC"],
1872 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001873 },
Colin Crossab179442018-09-27 11:03:22 -07001874 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001875}
1876
Dan Willemsen208ae172015-09-16 16:33:27 -07001877cc_object {
1878 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001879 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001880 local_include_dirs: ["include"],
1881 product_variables: {
1882 platform_sdk_version: {
1883 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1884 },
1885 },
1886 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001887
Colin Cross7d7b3682017-11-03 13:38:40 -07001888 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001889}
1890
Dan Willemsen208ae172015-09-16 16:33:27 -07001891cc_object {
1892 name: "crtbegin_so1",
1893 local_include_dirs: ["include"],
1894 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001895
Colin Cross7d7b3682017-11-03 13:38:40 -07001896 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001897}
1898
Dan Willemsen208ae172015-09-16 16:33:27 -07001899cc_object {
1900 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07001901
Colin Cross7d7b3682017-11-03 13:38:40 -07001902 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07001903 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001904 "crtbegin_so1",
1905 "crtbrand",
1906 ],
1907}
1908
Dan Willemsen208ae172015-09-16 16:33:27 -07001909cc_object {
1910 name: "crtend_so",
1911 local_include_dirs: ["include"],
1912 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001913
Colin Cross7d7b3682017-11-03 13:38:40 -07001914 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001915}
1916
Dan Willemsen208ae172015-09-16 16:33:27 -07001917cc_object {
1918 name: "crtbegin_static1",
1919 local_include_dirs: ["include"],
1920 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001921
Colin Cross50c21ab2015-10-31 23:03:05 -07001922 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001923 mips: {
1924 srcs: [
1925 "arch-mips/bionic/crtbegin.c",
1926 ],
1927 exclude_srcs: [
1928 "arch-common/bionic/crtbegin.c",
1929 ],
1930 },
1931 mips64: {
1932 srcs: [
1933 "arch-mips64/bionic/crtbegin.c",
1934 ],
1935 exclude_srcs: [
1936 "arch-common/bionic/crtbegin.c",
1937 ],
1938 },
1939 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001940
1941 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001942}
1943
Dan Willemsen208ae172015-09-16 16:33:27 -07001944cc_object {
1945 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07001946
Colin Cross77d57bf2016-04-11 14:34:18 -07001947 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001948 "crtbegin_static1",
1949 "crtbrand",
1950 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001951 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001952}
1953
Dan Willemsen208ae172015-09-16 16:33:27 -07001954cc_object {
1955 name: "crtbegin_dynamic1",
1956 local_include_dirs: ["include"],
1957 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001958
Colin Cross50c21ab2015-10-31 23:03:05 -07001959 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001960 mips: {
1961 srcs: [
1962 "arch-mips/bionic/crtbegin.c",
1963 ],
1964 exclude_srcs: [
1965 "arch-common/bionic/crtbegin.c",
1966 ],
1967 },
1968 mips64: {
1969 srcs: [
1970 "arch-mips64/bionic/crtbegin.c",
1971 ],
1972 exclude_srcs: [
1973 "arch-common/bionic/crtbegin.c",
1974 ],
1975 },
1976 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001977 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001978}
1979
Dan Willemsen208ae172015-09-16 16:33:27 -07001980cc_object {
1981 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07001982
Colin Cross77d57bf2016-04-11 14:34:18 -07001983 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001984 "crtbegin_dynamic1",
1985 "crtbrand",
1986 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07001987 target: {
1988 linux_bionic: {
1989 generated_sources: ["host_bionic_linker_asm"],
1990 objs: [
1991 "linker_wrapper",
1992 ],
1993 },
1994 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001995 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001996}
1997
Dan Willemsen208ae172015-09-16 16:33:27 -07001998cc_object {
1999 // We rename crtend.o to crtend_android.o to avoid a
2000 // name clash between gcc and bionic.
2001 name: "crtend_android",
2002 local_include_dirs: ["include"],
2003 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002004
Colin Cross50c21ab2015-10-31 23:03:05 -07002005 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002006}
Colin Crossbaa48992016-07-13 11:15:21 -07002007
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002008// ========================================================
2009// NDK headers.
2010// ========================================================
2011
Dan Albert26e1c412018-05-24 14:56:46 -07002012versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002013 name: "common_libc",
2014 from: "include",
2015 to: "",
2016 license: "NOTICE",
2017}
Dan Albert4238a352016-06-28 11:18:05 -07002018
2019ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002020 name: "libc_uapi",
2021 from: "kernel/uapi",
2022 to: "",
2023 srcs: [
2024 "kernel/uapi/asm-generic/**/*.h",
2025 "kernel/uapi/drm/**/*.h",
2026 "kernel/uapi/linux/**/*.h",
2027 "kernel/uapi/misc/**/*.h",
2028 "kernel/uapi/mtd/**/*.h",
2029 "kernel/uapi/rdma/**/*.h",
2030 "kernel/uapi/scsi/**/*.h",
2031 "kernel/uapi/sound/**/*.h",
2032 "kernel/uapi/video/**/*.h",
2033 "kernel/uapi/xen/**/*.h",
2034 ],
Dan Albert92592652016-10-20 01:42:54 -07002035 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002036}
2037
2038ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002039 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002040 from: "kernel/android/uapi/linux",
2041 to: "linux",
2042 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002043 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002044}
2045
2046ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002047 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002048 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002049 to: "scsi",
2050 srcs: ["kernel/android/scsi/**/*.h"],
2051 license: "NOTICE",
2052}
2053
2054ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002055 name: "libc_asm_arm",
2056 from: "kernel/uapi/asm-arm",
2057 to: "arm-linux-androideabi",
2058 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002059 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002060}
2061
2062ndk_headers {
2063 name: "libc_asm_arm64",
2064 from: "kernel/uapi/asm-arm64",
2065 to: "aarch64-linux-android",
2066 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002067 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002068}
2069
Elliott Hughesee291c02017-12-11 11:32:34 -08002070// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002071ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002072 name: "libc_asm_mips",
2073 from: "kernel/uapi/asm-mips",
2074 to: "mipsel-linux-android",
2075 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2076 license: "NOTICE",
2077}
2078
Elliott Hughesee291c02017-12-11 11:32:34 -08002079// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002080ndk_headers {
2081 name: "libc_asm_mips64",
2082 from: "kernel/uapi/asm-mips",
2083 to: "mips64el-linux-android",
2084 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2085 license: "NOTICE",
2086}
2087
2088ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002089 name: "libc_asm_x86",
2090 from: "kernel/uapi/asm-x86",
2091 to: "i686-linux-android",
2092 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002093 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002094}
2095
2096ndk_headers {
2097 name: "libc_asm_x86_64",
2098 from: "kernel/uapi/asm-x86",
2099 to: "x86_64-linux-android",
2100 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002101 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002102}
2103
Dan Albert4238a352016-06-28 11:18:05 -07002104ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002105 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002106 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002107 symbol_file: "libc.map.txt",
2108 first_version: "9",
2109}
2110
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002111llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002112 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002113 symbol_file: "libc.map.txt",
2114 export_headers_as_system: true,
2115 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002116 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002117 export_include_dirs: [
2118 "kernel/android/uapi",
2119 "kernel/uapi",
2120 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002121 arch: {
2122 arm: {
2123 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002124 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002125 ],
2126 },
2127 arm64: {
2128 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002129 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002130 ],
2131 },
2132 mips: {
2133 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002134 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002135 ],
2136 },
2137 mips64: {
2138 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002139 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002140 ],
2141 },
2142 x86: {
2143 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002144 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002145 ],
2146 },
2147 x86_64: {
2148 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002149 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002150 ],
2151 },
2152 },
2153}
2154
Dan Albertdf31aff2016-10-06 15:50:41 -07002155ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002156 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002157 symbol_file: "libstdc++.map.txt",
2158 first_version: "9",
2159}
2160
Dan Willemsenca056d72018-01-08 14:00:24 -08002161// Export these headers for toolbox to process
2162filegroup {
2163 name: "kernel_input_headers",
2164 srcs: [
2165 "kernel/uapi/linux/input.h",
2166 "kernel/uapi/linux/input-event-codes.h",
2167 ],
2168}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002169
2170// Generate a syscall name / number mapping. These objects are text files
2171// (thanks to the -dD -E flags) and not binary files. They will then be
2172// consumed by the genseccomp.py script and converted into C++ code.
2173cc_defaults {
2174 name: "libseccomp_gen_syscall_nrs_defaults",
2175 recovery_available: true,
2176 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2177 cflags: [
2178 "-dD",
2179 "-E",
2180 "-Wall",
2181 "-Werror",
2182 "-nostdinc",
2183 ],
2184}
2185
2186cc_object {
2187 name: "libseccomp_gen_syscall_nrs_arm",
2188 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2189 local_include_dirs: [
2190 "kernel/uapi/asm-arm",
2191 "kernel/uapi",
2192 ],
2193}
2194
2195cc_object {
2196 name: "libseccomp_gen_syscall_nrs_arm64",
2197 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2198 local_include_dirs: [
2199 "kernel/uapi/asm-arm64",
2200 "kernel/uapi",
2201 ],
2202}
2203
2204cc_object {
2205 name: "libseccomp_gen_syscall_nrs_x86",
2206 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2207 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2208 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2209 local_include_dirs: [
2210 "kernel/uapi/asm-x86",
2211 "kernel/uapi",
2212 ],
2213}
2214
2215cc_object {
2216 name: "libseccomp_gen_syscall_nrs_x86_64",
2217 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2218 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2219 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2220 local_include_dirs: [
2221 "kernel/uapi/asm-x86",
2222 "kernel/uapi",
2223 ],
2224}
2225
2226cc_object {
2227 name: "libseccomp_gen_syscall_nrs_mips",
2228 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2229 cflags: [
2230 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2231 ],
2232 local_include_dirs: [
2233 "kernel/uapi/asm-mips",
2234 "kernel/uapi",
2235 ],
2236}
2237
2238cc_object {
2239 name: "libseccomp_gen_syscall_nrs_mips64",
2240 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2241 cflags: [
2242 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2243 ],
2244 local_include_dirs: [
2245 "kernel/uapi/asm-mips",
2246 "kernel/uapi",
2247 ],
2248}
2249
2250// Generate the C++ policy sources for app, system, and global seccomp-bpf
2251// filters.
2252python_binary_host {
2253 name: "genseccomp",
2254 main: "tools/genseccomp.py",
2255
2256 srcs: [
2257 "tools/genseccomp.py",
2258 "tools/gensyscalls.py",
2259 ],
2260
2261 data: [
2262 "kernel/uapi/**/*.h",
2263 ],
2264
2265 version: {
2266 py2: {
2267 enabled: true,
2268 },
2269 py3: {
2270 enabled: false,
2271 },
2272 },
2273}
2274
Martijn Coenen0c6de752019-01-02 12:52:51 +01002275python_binary_host {
2276 name: "genfunctosyscallnrs",
2277 main: "tools/genfunctosyscallnrs.py",
2278
2279 srcs: [
2280 "tools/genseccomp.py",
2281 "tools/genfunctosyscallnrs.py",
2282 "tools/gensyscalls.py",
2283 ],
2284
2285 data: [
2286 "kernel/uapi/**/*.h",
2287 ],
2288
2289 version: {
2290 py2: {
2291 enabled: true,
2292 },
2293 py3: {
2294 enabled: false,
2295 },
2296 },
2297}
2298
2299cc_genrule {
2300 name: "func_to_syscall_nrs",
2301 recovery_available: true,
2302 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2303
2304 tools: [ "genfunctosyscallnrs" ],
2305
2306 srcs: [
2307 "SYSCALLS.TXT",
2308 ":libseccomp_gen_syscall_nrs_arm",
2309 ":libseccomp_gen_syscall_nrs_arm64",
2310 ":libseccomp_gen_syscall_nrs_mips",
2311 ":libseccomp_gen_syscall_nrs_mips64",
2312 ":libseccomp_gen_syscall_nrs_x86",
2313 ":libseccomp_gen_syscall_nrs_x86_64",
2314 ],
2315
2316 out: [
2317 "func_to_syscall_nrs.h",
2318 ],
2319}
2320
Martijn Coenenc3752be2019-01-09 16:19:57 +01002321// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2322genrule {
2323 name: "generate_app_zygote_blacklist",
2324 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2325 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2326 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2327}
2328
2329cc_genrule {
2330 name: "libseccomp_policy_app_zygote_sources",
2331 recovery_available: true,
2332 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2333
2334 tools: [ "genseccomp" ],
2335
2336 srcs: [
2337 "SYSCALLS.TXT",
2338 "SECCOMP_WHITELIST_COMMON.TXT",
2339 "SECCOMP_WHITELIST_APP.TXT",
2340 "SECCOMP_BLACKLIST_COMMON.TXT",
2341 ":generate_app_zygote_blacklist",
2342 ":libseccomp_gen_syscall_nrs_arm",
2343 ":libseccomp_gen_syscall_nrs_arm64",
2344 ":libseccomp_gen_syscall_nrs_mips",
2345 ":libseccomp_gen_syscall_nrs_mips64",
2346 ":libseccomp_gen_syscall_nrs_x86",
2347 ":libseccomp_gen_syscall_nrs_x86_64",
2348 ],
2349
2350 out: [
2351 "arm64_app_zygote_policy.cpp",
2352 "arm_app_zygote_policy.cpp",
2353 "mips64_app_zygote_policy.cpp",
2354 "mips_app_zygote_policy.cpp",
2355 "x86_64_app_zygote_policy.cpp",
2356 "x86_app_zygote_policy.cpp",
2357 ],
2358}
2359
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002360cc_genrule {
2361 name: "libseccomp_policy_app_sources",
2362 recovery_available: true,
2363 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2364
2365 tools: [ "genseccomp" ],
2366
2367 srcs: [
2368 "SYSCALLS.TXT",
2369 "SECCOMP_WHITELIST_COMMON.TXT",
2370 "SECCOMP_WHITELIST_APP.TXT",
2371 "SECCOMP_BLACKLIST_COMMON.TXT",
2372 "SECCOMP_BLACKLIST_APP.TXT",
2373 ":libseccomp_gen_syscall_nrs_arm",
2374 ":libseccomp_gen_syscall_nrs_arm64",
2375 ":libseccomp_gen_syscall_nrs_mips",
2376 ":libseccomp_gen_syscall_nrs_mips64",
2377 ":libseccomp_gen_syscall_nrs_x86",
2378 ":libseccomp_gen_syscall_nrs_x86_64",
2379 ],
2380
2381 out: [
2382 "arm64_app_policy.cpp",
2383 "arm_app_policy.cpp",
2384 "mips64_app_policy.cpp",
2385 "mips_app_policy.cpp",
2386 "x86_64_app_policy.cpp",
2387 "x86_app_policy.cpp",
2388 ],
2389}
2390
2391cc_genrule {
2392 name: "libseccomp_policy_system_sources",
2393 recovery_available: true,
2394 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2395
2396 tools: [ "genseccomp" ],
2397
2398 srcs: [
2399 "SYSCALLS.TXT",
2400 "SECCOMP_WHITELIST_COMMON.TXT",
2401 "SECCOMP_WHITELIST_SYSTEM.TXT",
2402 "SECCOMP_BLACKLIST_COMMON.TXT",
2403 ":libseccomp_gen_syscall_nrs_arm",
2404 ":libseccomp_gen_syscall_nrs_arm64",
2405 ":libseccomp_gen_syscall_nrs_mips",
2406 ":libseccomp_gen_syscall_nrs_mips64",
2407 ":libseccomp_gen_syscall_nrs_x86",
2408 ":libseccomp_gen_syscall_nrs_x86_64",
2409 ],
2410
2411 out: [
2412 "arm64_system_policy.cpp",
2413 "arm_system_policy.cpp",
2414 "mips64_system_policy.cpp",
2415 "mips_system_policy.cpp",
2416 "x86_64_system_policy.cpp",
2417 "x86_system_policy.cpp",
2418 ],
2419}
2420
2421cc_genrule {
2422 name: "libseccomp_policy_global_sources",
2423 recovery_available: true,
2424 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=global $(in)",
2425
2426 tools: [ "genseccomp" ],
2427
2428 srcs: [
2429 "SYSCALLS.TXT",
2430 "SECCOMP_WHITELIST_COMMON.TXT",
2431 "SECCOMP_WHITELIST_SYSTEM.TXT",
2432 "SECCOMP_WHITELIST_APP.TXT",
2433 "SECCOMP_WHITELIST_GLOBAL.TXT",
2434 "SECCOMP_BLACKLIST_COMMON.TXT",
2435 ":libseccomp_gen_syscall_nrs_arm",
2436 ":libseccomp_gen_syscall_nrs_arm64",
2437 ":libseccomp_gen_syscall_nrs_mips",
2438 ":libseccomp_gen_syscall_nrs_mips64",
2439 ":libseccomp_gen_syscall_nrs_x86",
2440 ":libseccomp_gen_syscall_nrs_x86_64",
2441 ],
2442
2443 out: [
2444 "arm64_global_policy.cpp",
2445 "arm_global_policy.cpp",
2446 "mips64_global_policy.cpp",
2447 "mips_global_policy.cpp",
2448 "x86_64_global_policy.cpp",
2449 "x86_global_policy.cpp",
2450 ],
2451}
2452
2453cc_library {
2454 name: "libseccomp_policy",
2455 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002456 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002457 generated_sources: [
2458 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002459 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002460 "libseccomp_policy_global_sources",
2461 "libseccomp_policy_system_sources",
2462 ],
2463
2464 srcs: [
2465 "seccomp/seccomp_policy.cpp",
2466 ],
2467
2468 export_include_dirs: ["seccomp/include"],
2469 cflags: [
2470 "-Wall",
2471 "-Werror",
2472 ],
2473 shared: {
2474 shared_libs: ["libbase"],
2475 },
2476 static: {
2477 static_libs: ["libbase"],
2478 },
2479}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002480
2481// This is a temporary library that will use scudo as the native memory
2482// allocator. To use it, add it as the first shared library.
2483cc_library_shared {
2484 name: "libc_scudo",
2485 vendor_available: true,
2486 srcs: [
2487 "bionic/malloc_common.cpp",
2488 "bionic/malloc_common_dynamic.cpp",
2489 "bionic/malloc_heapprofd.cpp",
2490 "bionic/malloc_limit.cpp",
2491 "bionic/scudo_wrapper.cpp",
2492 "bionic/__set_errno.cpp",
2493 ],
2494 cflags: ["-DUSE_SCUDO"],
2495 stl: "none",
2496 system_shared_libs: [],
2497
2498 header_libs: ["libc_headers"],
2499
2500 static_libs: ["libasync_safe"],
2501
2502 allow_undefined_symbols: true,
2503 shared_libs: ["libscudo_wrapper"],
2504
2505 arch: {
2506 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002507 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002508 },
2509 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002510 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002511 },
2512 x86: {
2513 srcs: [
2514 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002515 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002516 ],
2517 },
2518 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002519 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002520 },
2521 },
2522
2523 // Mark this library as global so it overrides all the allocation
2524 // definitions properly.
2525 ldflags: ["-Wl,-z,global"],
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002526
2527 // Like libc, disable native coverage for libc_scudo.
2528 native_coverage: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002529}
2530
2531subdirs = [
2532 "bionic/scudo",
2533]