blob: 7d0836584e34790bdde36bbd09ef936d777df6d5 [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,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070076 // TODO(b/132640749): Fix broken fuzzer support.
77 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070078 },
Colin Cross50c21ab2015-10-31 23:03:05 -070079 native_coverage: false,
Jiyong Park5603c6e2018-04-27 21:53:11 +090080 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020081 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080082
Yi Konge3d90de2019-02-20 14:28:56 -080083 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
84 // warning since this is intended right now.
85 ldflags: ["-Wl,-z,muldefs"],
Dan Willemsen208ae172015-09-16 16:33:27 -070086}
87
Dan Willemsen208ae172015-09-16 16:33:27 -070088// ========================================================
89// libc_stack_protector.a - stack protector code
90// ========================================================
91//
Colin Crossa3f9fca2016-01-11 13:20:55 -080092// Code that implements the stack protector (or that runs
93// before TLS has been set up) needs to be compiled with
94// -fno-stack-protector, since it accesses the stack canary
95// TLS slot.
Dan Willemsen208ae172015-09-16 16:33:27 -070096
97cc_library_static {
98
Colin Crossa3f9fca2016-01-11 13:20:55 -080099 srcs: [
100 "bionic/__libc_init_main_thread.cpp",
101 "bionic/__stack_chk_fail.cpp",
102 ],
103 arch: {
104 arm64: {
105 srcs: ["arch-arm64/bionic/__set_tls.c"],
106 },
107 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700108 srcs: [
109 "arch-x86/bionic/__libc_init_sysinfo.cpp",
110 "arch-x86/bionic/__set_tls.cpp",
111 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800112 },
113 x86_64: {
114 srcs: ["arch-x86_64/bionic/__set_tls.c"],
115 },
116 },
117
Colin Cross50c21ab2015-10-31 23:03:05 -0700118 defaults: ["libc_defaults"],
119 cflags: ["-fno-stack-protector"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700120 name: "libc_stack_protector",
Dan Willemsen208ae172015-09-16 16:33:27 -0700121}
122
Colin Crossa3f9fca2016-01-11 13:20:55 -0800123// libc_init_static.cpp also needs to be built without stack protector,
124// because it's responsible for setting up TLS for static executables.
125// This isn't the case for dynamic executables because the dynamic linker
126// has already set up the main thread's TLS.
127
128cc_library_static {
129 name: "libc_init_static",
130 defaults: ["libc_defaults"],
131 srcs: ["bionic/libc_init_static.cpp"],
132 cflags: ["-fno-stack-protector"],
133}
134
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700135cc_library_static {
136 name: "libc_init_dynamic",
137 defaults: ["libc_defaults"],
138 srcs: ["bionic/libc_init_dynamic.cpp"],
139 cflags: ["-fno-stack-protector"],
140}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800141
Dan Willemsen208ae172015-09-16 16:33:27 -0700142// ========================================================
143// libc_tzcode.a - upstream 'tzcode' code
144// ========================================================
145
146cc_library_static {
147
Colin Cross50c21ab2015-10-31 23:03:05 -0700148 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700149 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800150 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700151 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700152 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
153 ],
154
Colin Cross50c21ab2015-10-31 23:03:05 -0700155 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700156 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700157 // Don't use ridiculous amounts of stack.
158 "-DALL_STATE",
159 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
160 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800161 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700162 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700163 // The name of the tm_gmtoff field in our struct tm.
164 "-DTM_GMTOFF=tm_gmtoff",
165 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700166 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700167 // Include `tzname`, `timezone`, and `daylight` globals.
168 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700169 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800170 // Use the empty string (instead of " ") as the timezone abbreviation
171 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700172 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700173 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
174 "-Dlint",
175 ],
176
Dan Willemsen208ae172015-09-16 16:33:27 -0700177 local_include_dirs: ["tzcode/"],
178 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700179}
180
181// ========================================================
182// libc_dns.a - modified NetBSD DNS code
183// ========================================================
184
185cc_library_static {
186
Colin Cross50c21ab2015-10-31 23:03:05 -0700187 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700188 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800189 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700190
191 "upstream-netbsd/lib/libc/isc/ev_streams.c",
192 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700193 ],
194
Colin Cross50c21ab2015-10-31 23:03:05 -0700195 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700196 "-DANDROID_CHANGES",
197 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700198 "-Wno-unused-parameter",
199 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700200 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700201 ],
202
Dan Willemsen208ae172015-09-16 16:33:27 -0700203 local_include_dirs: [
204 "dns/include",
205 "private",
206 "upstream-netbsd/lib/libc/include",
207 "upstream-netbsd/android/include",
208 ],
209
210 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700211}
212
213// ========================================================
214// libc_freebsd.a - upstream FreeBSD C library code
215// ========================================================
216//
217// These files are built with the freebsd-compat.h header file
218// automatically included.
219
220cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700221 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700222 srcs: [
223 "upstream-freebsd/lib/libc/gen/ldexp.c",
224 "upstream-freebsd/lib/libc/gen/sleep.c",
225 "upstream-freebsd/lib/libc/gen/usleep.c",
226 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700227 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
228 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
229 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
230 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700231 "upstream-freebsd/lib/libc/stdlib/qsort.c",
232 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700233 "upstream-freebsd/lib/libc/string/wcpcpy.c",
234 "upstream-freebsd/lib/libc/string/wcpncpy.c",
235 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700236 "upstream-freebsd/lib/libc/string/wcscat.c",
237 "upstream-freebsd/lib/libc/string/wcschr.c",
238 "upstream-freebsd/lib/libc/string/wcscmp.c",
239 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700240 "upstream-freebsd/lib/libc/string/wcscspn.c",
241 "upstream-freebsd/lib/libc/string/wcsdup.c",
242 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700243 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700244 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
245 "upstream-freebsd/lib/libc/string/wcsncat.c",
246 "upstream-freebsd/lib/libc/string/wcsncmp.c",
247 "upstream-freebsd/lib/libc/string/wcsncpy.c",
248 "upstream-freebsd/lib/libc/string/wcsnlen.c",
249 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700250 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700251 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700252 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700253 "upstream-freebsd/lib/libc/string/wcstok.c",
254 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700255 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700256 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700257 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800258 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700259 ],
260 arch: {
261 arm64: {
262 exclude_srcs: [
263 "upstream-freebsd/lib/libc/string/wmemmove.c",
264 ],
265 },
266 x86: {
267 exclude_srcs: [
268 "upstream-freebsd/lib/libc/string/wcschr.c",
269 "upstream-freebsd/lib/libc/string/wcscmp.c",
270 "upstream-freebsd/lib/libc/string/wcslen.c",
271 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700272 "upstream-freebsd/lib/libc/string/wmemcmp.c",
273 "upstream-freebsd/lib/libc/string/wcscat.c",
274 "upstream-freebsd/lib/libc/string/wcscpy.c",
275 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700276 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700277 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700278 },
279
Colin Cross50c21ab2015-10-31 23:03:05 -0700280 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700281 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700282 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700283 "-include freebsd-compat.h",
284 ],
285
Dan Willemsen208ae172015-09-16 16:33:27 -0700286 local_include_dirs: [
287 "upstream-freebsd/android/include",
288 ],
289
290 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700291}
292
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700293cc_library_static {
294 defaults: ["libc_defaults"],
295 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700296 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700297 "upstream-freebsd/lib/libc/stdlib/realpath.c",
298 ],
299
300 cflags: [
301 "-Wno-sign-compare",
302 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700303 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700304 ],
305
306 local_include_dirs: [
307 "upstream-freebsd/android/include",
308 ],
309
310 name: "libc_freebsd_large_stack",
311}
312
Dan Willemsen208ae172015-09-16 16:33:27 -0700313// ========================================================
314// libc_netbsd.a - upstream NetBSD C library code
315// ========================================================
316//
317// These files are built with the netbsd-compat.h header file
318// automatically included.
319
320cc_library_static {
321
Colin Cross50c21ab2015-10-31 23:03:05 -0700322 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700323 srcs: [
324 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700325 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700326 "upstream-netbsd/lib/libc/gen/psignal.c",
327 "upstream-netbsd/lib/libc/gen/utime.c",
328 "upstream-netbsd/lib/libc/gen/utmp.c",
329 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
330 "upstream-netbsd/lib/libc/regex/regcomp.c",
331 "upstream-netbsd/lib/libc/regex/regerror.c",
332 "upstream-netbsd/lib/libc/regex/regexec.c",
333 "upstream-netbsd/lib/libc/regex/regfree.c",
334 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700335 "upstream-netbsd/lib/libc/stdlib/drand48.c",
336 "upstream-netbsd/lib/libc/stdlib/erand48.c",
337 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
338 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700339 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
340 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
341 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
342 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
343 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
344 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
345 "upstream-netbsd/lib/libc/stdlib/seed48.c",
346 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700347 ],
348 multilib: {
349 lib32: {
350 // LP32 cruft
351 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
352 },
353 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700354 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700355 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800356 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700357 "-DPOSIX_MISTAKE",
358 "-include netbsd-compat.h",
359 ],
360
Dan Willemsen208ae172015-09-16 16:33:27 -0700361 local_include_dirs: [
362 "upstream-netbsd/android/include",
363 "upstream-netbsd/lib/libc/include",
364 ],
365
366 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700367}
368
369// ========================================================
370// libc_openbsd_ndk.a - upstream OpenBSD C library code
371// that can be safely included in the libc_ndk.a (doesn't
372// contain any troublesome global data or constructors).
373// ========================================================
374//
375// These files are built with the openbsd-compat.h header file
376// automatically included.
377
378cc_library_static {
379 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700380 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700381 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700382 "upstream-openbsd/lib/libc/gen/alarm.c",
383 "upstream-openbsd/lib/libc/gen/ctype_.c",
384 "upstream-openbsd/lib/libc/gen/daemon.c",
385 "upstream-openbsd/lib/libc/gen/err.c",
386 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700387 "upstream-openbsd/lib/libc/gen/fnmatch.c",
388 "upstream-openbsd/lib/libc/gen/ftok.c",
389 "upstream-openbsd/lib/libc/gen/getprogname.c",
390 "upstream-openbsd/lib/libc/gen/isctype.c",
391 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700392 "upstream-openbsd/lib/libc/gen/tolower_.c",
393 "upstream-openbsd/lib/libc/gen/toupper_.c",
394 "upstream-openbsd/lib/libc/gen/verr.c",
395 "upstream-openbsd/lib/libc/gen/verrx.c",
396 "upstream-openbsd/lib/libc/gen/vwarn.c",
397 "upstream-openbsd/lib/libc/gen/vwarnx.c",
398 "upstream-openbsd/lib/libc/gen/warn.c",
399 "upstream-openbsd/lib/libc/gen/warnx.c",
400 "upstream-openbsd/lib/libc/locale/btowc.c",
401 "upstream-openbsd/lib/libc/locale/mbrlen.c",
402 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
403 "upstream-openbsd/lib/libc/locale/mbtowc.c",
404 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700405 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
406 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700407 "upstream-openbsd/lib/libc/locale/wcstoll.c",
408 "upstream-openbsd/lib/libc/locale/wcstombs.c",
409 "upstream-openbsd/lib/libc/locale/wcstoul.c",
410 "upstream-openbsd/lib/libc/locale/wcstoull.c",
411 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
412 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
413 "upstream-openbsd/lib/libc/locale/wctob.c",
414 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700415 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700416 "upstream-openbsd/lib/libc/net/htonl.c",
417 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700418 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
419 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
420 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700421 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
422 "upstream-openbsd/lib/libc/net/inet_ntop.c",
423 "upstream-openbsd/lib/libc/net/inet_pton.c",
424 "upstream-openbsd/lib/libc/net/ntohl.c",
425 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800426 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700427 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700428 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
429 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700430 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700431 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700432 "upstream-openbsd/lib/libc/stdio/fputwc.c",
433 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700434 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700435 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700436 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700437 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700438 "upstream-openbsd/lib/libc/stdio/makebuf.c",
439 "upstream-openbsd/lib/libc/stdio/mktemp.c",
440 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
441 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700442 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700443 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700444 "upstream-openbsd/lib/libc/stdio/tempnam.c",
445 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
446 "upstream-openbsd/lib/libc/stdio/ungetc.c",
447 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
448 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
449 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700450 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
451 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
452 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700453 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700454 "upstream-openbsd/lib/libc/stdio/wsetup.c",
455 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800456 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700457 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700458 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700459 "upstream-openbsd/lib/libc/stdlib/insque.c",
460 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
461 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
462 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800463 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700464 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800465 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700466 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700467 "upstream-openbsd/lib/libc/stdlib/remque.c",
468 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700469 "upstream-openbsd/lib/libc/stdlib/tfind.c",
470 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800471 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700472 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800473 "upstream-openbsd/lib/libc/string/strcasestr.c",
474 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700475 "upstream-openbsd/lib/libc/string/strcspn.c",
476 "upstream-openbsd/lib/libc/string/strdup.c",
477 "upstream-openbsd/lib/libc/string/strndup.c",
478 "upstream-openbsd/lib/libc/string/strpbrk.c",
479 "upstream-openbsd/lib/libc/string/strsep.c",
480 "upstream-openbsd/lib/libc/string/strspn.c",
481 "upstream-openbsd/lib/libc/string/strstr.c",
482 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800483 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700484 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700485 "upstream-openbsd/lib/libc/string/wcswidth.c",
486 ],
487
Colin Cross50c21ab2015-10-31 23:03:05 -0700488 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700489 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700490 "-Wno-unused-parameter",
491 "-include openbsd-compat.h",
492 ],
493
Dan Willemsen208ae172015-09-16 16:33:27 -0700494 local_include_dirs: [
495 "private",
496 "stdio",
497 "upstream-openbsd/android/include",
498 "upstream-openbsd/lib/libc/include",
499 "upstream-openbsd/lib/libc/gdtoa/",
500 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700501}
502
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700503cc_library_static {
504 name: "libc_openbsd_large_stack",
505 defaults: ["libc_defaults"],
506 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700507 "stdio/vfprintf.cpp",
508 "stdio/vfwprintf.cpp",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700509 ],
510 cflags: [
511 "-include openbsd-compat.h",
512 "-Wno-sign-compare",
513 "-Wframe-larger-than=5000",
514 ],
515
516 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700517 "upstream-openbsd/android/include/",
518 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700519 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700520 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700521 ],
522}
523
Dan Willemsen208ae172015-09-16 16:33:27 -0700524// ========================================================
525// libc_openbsd.a - upstream OpenBSD C library code
526// ========================================================
527//
528// These files are built with the openbsd-compat.h header file
529// automatically included.
530cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700531 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700532 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800533 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700534 "upstream-openbsd/lib/libc/crypt/arc4random.c",
535 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
536
537 // May be overriden by per-arch optimized versions
538 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700539 "upstream-openbsd/lib/libc/string/memrchr.c",
540 "upstream-openbsd/lib/libc/string/stpcpy.c",
541 "upstream-openbsd/lib/libc/string/stpncpy.c",
542 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700543 "upstream-openbsd/lib/libc/string/strcpy.c",
544 "upstream-openbsd/lib/libc/string/strlcat.c",
545 "upstream-openbsd/lib/libc/string/strlcpy.c",
546 "upstream-openbsd/lib/libc/string/strncat.c",
547 "upstream-openbsd/lib/libc/string/strncmp.c",
548 "upstream-openbsd/lib/libc/string/strncpy.c",
549 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700550
551 arch: {
552 arm: {
553 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700554 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800555 "upstream-openbsd/lib/libc/string/stpcpy.c",
556 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700557 ],
558 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700559 arm64: {
560 exclude_srcs: [
561 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700562 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700563 "upstream-openbsd/lib/libc/string/strcpy.c",
564 "upstream-openbsd/lib/libc/string/strncmp.c",
565 ],
566 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530567 mips: {
568 exclude_srcs: [
569 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530570 "upstream-openbsd/lib/libc/string/strcpy.c",
571 "upstream-openbsd/lib/libc/string/strncmp.c",
572 ],
573 },
574 mips64: {
575 exclude_srcs: [
576 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530577 "upstream-openbsd/lib/libc/string/strcpy.c",
578 "upstream-openbsd/lib/libc/string/strncmp.c",
579 ],
580 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700581 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800582 exclude_srcs: [
583 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800584 "upstream-openbsd/lib/libc/string/memrchr.c",
585 "upstream-openbsd/lib/libc/string/stpcpy.c",
586 "upstream-openbsd/lib/libc/string/stpncpy.c",
587 "upstream-openbsd/lib/libc/string/strcat.c",
588 "upstream-openbsd/lib/libc/string/strcpy.c",
589 "upstream-openbsd/lib/libc/string/strncmp.c",
590 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700591 "upstream-openbsd/lib/libc/string/strlcat.c",
592 "upstream-openbsd/lib/libc/string/strlcpy.c",
593 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800594 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700595 },
596
597 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800598 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800599 "upstream-openbsd/lib/libc/string/stpcpy.c",
600 "upstream-openbsd/lib/libc/string/stpncpy.c",
601 "upstream-openbsd/lib/libc/string/strcat.c",
602 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800603 "upstream-openbsd/lib/libc/string/strncat.c",
604 "upstream-openbsd/lib/libc/string/strncmp.c",
605 "upstream-openbsd/lib/libc/string/strncpy.c",
606 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700607 },
608 },
609
Colin Cross50c21ab2015-10-31 23:03:05 -0700610 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700611 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700612 "-Wno-unused-parameter",
613 "-include openbsd-compat.h",
614 ],
615
Dan Willemsen208ae172015-09-16 16:33:27 -0700616 local_include_dirs: [
617 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700618 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700619 ],
620
621 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700622}
623
624// ========================================================
625// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
626// ========================================================
627//
628// These files are built with the openbsd-compat.h header file
629// automatically included.
630
631cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700632 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700633 srcs: [
634 "upstream-openbsd/android/gdtoa_support.cpp",
635 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
636 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
637 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
638 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
639 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
640 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
641 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
642 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
643 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
644 "upstream-openbsd/lib/libc/gdtoa/misc.c",
645 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
646 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
647 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
648 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
649 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
650 "upstream-openbsd/lib/libc/gdtoa/sum.c",
651 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
652 ],
653 multilib: {
654 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800655 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700656 },
657 },
658
Colin Cross50c21ab2015-10-31 23:03:05 -0700659 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700660 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700661 "-include openbsd-compat.h",
662 ],
663
Dan Willemsen208ae172015-09-16 16:33:27 -0700664 local_include_dirs: [
665 "private",
666 "upstream-openbsd/android/include",
667 "upstream-openbsd/lib/libc/include",
668 ],
669
670 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700671}
672
673// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700674// libc_fortify.a - container for our FORITFY
675// implementation details
676// ========================================================
677cc_library_static {
678 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700679 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700680
681 name: "libc_fortify",
682
683 // Disable FORTIFY for the compilation of these, so we don't end up having
684 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800685 cflags: [
686 "-U_FORTIFY_SOURCE",
687 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
688 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700689
690 arch: {
691 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800692 cflags: [
693 "-DNO___MEMCPY_CHK",
694 "-DRENAME___STRCAT_CHK",
695 "-DRENAME___STRCPY_CHK",
696 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700697 srcs: [
698 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800699
700 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
701 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
702
703 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
704 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
705
706 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
707 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
708
709 "arch-arm/krait/bionic/__strcat_chk.S",
710 "arch-arm/krait/bionic/__strcpy_chk.S",
711
712 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
713 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
714
Haibo Huang01bfd892018-12-03 15:05:16 -0800715 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
716 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700717 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700718 },
719 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700720 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700721 srcs: [
722 "arch-arm64/generic/bionic/__memcpy_chk.S",
723 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700724 },
725 },
726}
727
728// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700729// libc_bionic.a - home-grown C library code
730// ========================================================
731
732cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700733 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700734 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700735 // The data that backs getauxval is initialized in the libc init
736 // functions which are invoked by the linker. If this file is included
737 // in libc_ndk.a, only one of the copies of the global data will be
738 // initialized, resulting in nullptr dereferences.
739 "bionic/getauxval.cpp",
740
Elliott Hughes211c4d32018-02-02 15:10:32 -0800741 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700742 "bionic/sysconf.cpp",
743 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700744 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700745
Josh Gao10ec9282017-04-03 15:13:29 -0700746 // The following must not be statically linked into libc_ndk.a, because
747 // debuggerd will look for the abort message in libc.so's copy.
748 "bionic/android_set_abort_message.cpp",
749
Dan Willemsen208ae172015-09-16 16:33:27 -0700750 "bionic/strchr.cpp",
751 "bionic/strnlen.c",
752 "bionic/strrchr.cpp",
753 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700754
755 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700756 arm: {
757 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800758 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700759 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800760 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800761 "arch-arm/generic/bionic/stpcpy.c",
762 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800763 "arch-arm/generic/bionic/strcmp.S",
764 "arch-arm/generic/bionic/strcpy.S",
765 "arch-arm/generic/bionic/strlen.c",
766
Ryan Prichard45024fe2018-12-30 21:10:26 -0800767 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700768 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700769 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700770 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700771 "arch-arm/bionic/atomics_arm.c",
772 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800773 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700774 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700775 "arch-arm/bionic/setjmp.S",
776 "arch-arm/bionic/syscall.S",
777 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800778
779 "arch-arm/cortex-a15/bionic/memcpy.S",
780 "arch-arm/cortex-a15/bionic/memmove.S",
781 "arch-arm/cortex-a15/bionic/memset.S",
782 "arch-arm/cortex-a15/bionic/stpcpy.S",
783 "arch-arm/cortex-a15/bionic/strcat.S",
784 "arch-arm/cortex-a15/bionic/strcmp.S",
785 "arch-arm/cortex-a15/bionic/strcpy.S",
786 "arch-arm/cortex-a15/bionic/strlen.S",
787
788 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800789 "arch-arm/cortex-a7/bionic/memset.S",
790
791 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800792 "arch-arm/cortex-a9/bionic/memset.S",
793 "arch-arm/cortex-a9/bionic/stpcpy.S",
794 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800795 "arch-arm/cortex-a9/bionic/strcpy.S",
796 "arch-arm/cortex-a9/bionic/strlen.S",
797
798 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800799 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800800
801 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800802
Haibo Huang01bfd892018-12-03 15:05:16 -0800803 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800804
805 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700806 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700807 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700808 arm64: {
809 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700810 "arch-arm64/generic/bionic/memchr.S",
811 "arch-arm64/generic/bionic/memcmp.S",
812 "arch-arm64/generic/bionic/memcpy.S",
813 "arch-arm64/generic/bionic/memmove.S",
814 "arch-arm64/generic/bionic/memset.S",
815 "arch-arm64/generic/bionic/stpcpy.S",
816 "arch-arm64/generic/bionic/strchr.S",
817 "arch-arm64/generic/bionic/strcmp.S",
818 "arch-arm64/generic/bionic/strcpy.S",
819 "arch-arm64/generic/bionic/strlen.S",
820 "arch-arm64/generic/bionic/strncmp.S",
821 "arch-arm64/generic/bionic/strnlen.S",
822 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800823
824 "arch-arm64/bionic/__bionic_clone.S",
825 "arch-arm64/bionic/_exit_with_stack_teardown.S",
826 "arch-arm64/bionic/setjmp.S",
827 "arch-arm64/bionic/syscall.S",
828 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700829 ],
830 exclude_srcs: [
831 "bionic/__memcpy_chk.cpp",
832 "bionic/strchr.cpp",
833 "bionic/strnlen.c",
834 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700835 },
836
837 mips: {
838 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800839 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530840 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800841 "arch-mips/string/memset.S",
842 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530843 "arch-mips/string/strncmp.S",
844 "arch-mips/string/strlen.c",
845 "arch-mips/string/strnlen.c",
846 "arch-mips/string/strchr.c",
847 "arch-mips/string/strcpy.c",
848 "arch-mips/string/memchr.c",
849 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800850
Dan Willemsen208ae172015-09-16 16:33:27 -0700851 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700852 "arch-mips/bionic/cacheflush.cpp",
853 "arch-mips/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800854 "arch-mips/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700855 "arch-mips/bionic/setjmp.S",
856 "arch-mips/bionic/syscall.S",
857 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700858 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530859 exclude_srcs: [
860 "bionic/strchr.cpp",
861 "bionic/strnlen.c",
862 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700863 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700864 mips64: {
865 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800866 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530867 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800868 "arch-mips/string/memset.S",
869 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530870 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800871 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530872 "arch-mips/string/strnlen.c",
873 "arch-mips/string/strchr.c",
874 "arch-mips/string/strcpy.c",
875 "arch-mips/string/memchr.c",
876 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800877
Dan Willemsen208ae172015-09-16 16:33:27 -0700878 "arch-mips64/bionic/__bionic_clone.S",
879 "arch-mips64/bionic/_exit_with_stack_teardown.S",
880 "arch-mips64/bionic/setjmp.S",
881 "arch-mips64/bionic/syscall.S",
882 "arch-mips64/bionic/vfork.S",
883 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700884 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530885 exclude_srcs: [
886 "bionic/strchr.cpp",
887 "bionic/strnlen.c",
888 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700889 },
890
891 x86: {
892 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700893 "arch-x86/generic/string/memcmp.S",
894 "arch-x86/generic/string/strcmp.S",
895 "arch-x86/generic/string/strncmp.S",
896 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700897
898 "arch-x86/generic/string/strlcat.c",
899 "arch-x86/generic/string/strlcpy.c",
900 "arch-x86/generic/string/strncat.c",
901 "arch-x86/generic/string/wcscat.c",
902 "arch-x86/generic/string/wcscpy.c",
903 "arch-x86/generic/string/wmemcmp.c",
904
Dan Willemsen208ae172015-09-16 16:33:27 -0700905 "arch-x86/atom/string/sse2-memchr-atom.S",
906 "arch-x86/atom/string/sse2-memrchr-atom.S",
907 "arch-x86/atom/string/sse2-strchr-atom.S",
908 "arch-x86/atom/string/sse2-strnlen-atom.S",
909 "arch-x86/atom/string/sse2-strrchr-atom.S",
910 "arch-x86/atom/string/sse2-wcschr-atom.S",
911 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
912 "arch-x86/atom/string/sse2-wcslen-atom.S",
913 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700914 "arch-x86/silvermont/string/sse2-memmove-slm.S",
915 "arch-x86/silvermont/string/sse2-memset-slm.S",
916 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
917 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
918 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
919 "arch-x86/silvermont/string/sse2-strlen-slm.S",
920 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800921
922 "arch-x86/bionic/__bionic_clone.S",
923 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800924 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800925 "arch-x86/bionic/__restore.S",
926 "arch-x86/bionic/setjmp.S",
927 "arch-x86/bionic/syscall.S",
928 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700929
930 // ssse3 functions
931 "arch-x86/atom/string/ssse3-strcat-atom.S",
932 "arch-x86/atom/string/ssse3-strcmp-atom.S",
933 "arch-x86/atom/string/ssse3-strlcat-atom.S",
934 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
935 "arch-x86/atom/string/ssse3-strncat-atom.S",
936 "arch-x86/atom/string/ssse3-strncmp-atom.S",
937 "arch-x86/atom/string/ssse3-wcscat-atom.S",
938 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
939
940 // sse4 functions
941 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
942 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
943
944 // atom functions
945 "arch-x86/atom/string/sse2-memset-atom.S",
946 "arch-x86/atom/string/sse2-strlen-atom.S",
947 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800948 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700949 "arch-x86/atom/string/ssse3-strcpy-atom.S",
950 "arch-x86/atom/string/ssse3-strncpy-atom.S",
951 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700952 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700953
954 exclude_srcs: [
955 "bionic/strchr.cpp",
956 "bionic/strnlen.c",
957 "bionic/strrchr.cpp",
958 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700959 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700960 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700961 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700962 "arch-x86_64/string/sse2-memmove-slm.S",
963 "arch-x86_64/string/sse2-memset-slm.S",
964 "arch-x86_64/string/sse2-stpcpy-slm.S",
965 "arch-x86_64/string/sse2-stpncpy-slm.S",
966 "arch-x86_64/string/sse2-strcat-slm.S",
967 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700968 "arch-x86_64/string/sse2-strlen-slm.S",
969 "arch-x86_64/string/sse2-strncat-slm.S",
970 "arch-x86_64/string/sse2-strncpy-slm.S",
971 "arch-x86_64/string/sse4-memcmp-slm.S",
972 "arch-x86_64/string/ssse3-strcmp-slm.S",
973 "arch-x86_64/string/ssse3-strncmp-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800974
975 "arch-x86_64/bionic/__bionic_clone.S",
976 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
977 "arch-x86_64/bionic/__restore_rt.S",
978 "arch-x86_64/bionic/setjmp.S",
979 "arch-x86_64/bionic/syscall.S",
980 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700981 ],
982 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700983 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700984
Colin Cross50c21ab2015-10-31 23:03:05 -0700985 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700986 include_dirs: ["bionic/libstdc++/include"],
987 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700988}
989
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000990genrule {
991 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -0800992 out: ["generated_android_ids.h"],
993 srcs: [":android_filesystem_config_header"],
994 tool_files: ["fs_config_generator.py"],
995 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000996}
997
Dan Willemsen268a6732015-10-15 14:49:45 -0700998// ========================================================
999// libc_bionic_ndk.a- The portions of libc_bionic that can
1000// be safely used in libc_ndk.a (no troublesome global data
1001// or constructors).
1002// ========================================================
1003cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001004 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001005 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001006 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001007 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001008 "bionic/__cmsg_nxthdr.cpp",
1009 "bionic/__errno.cpp",
1010 "bionic/__gnu_basename.cpp",
1011 "bionic/__libc_current_sigrtmax.cpp",
1012 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001013 "bionic/abort.cpp",
1014 "bionic/accept.cpp",
1015 "bionic/accept4.cpp",
1016 "bionic/access.cpp",
1017 "bionic/arpa_inet.cpp",
1018 "bionic/assert.cpp",
1019 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001020 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001021 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001022 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001023 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001024 "bionic/bionic_systrace.cpp",
1025 "bionic/bionic_time_conversions.cpp",
1026 "bionic/brk.cpp",
1027 "bionic/c16rtomb.cpp",
1028 "bionic/c32rtomb.cpp",
1029 "bionic/chmod.cpp",
1030 "bionic/chown.cpp",
1031 "bionic/clearenv.cpp",
1032 "bionic/clock.cpp",
1033 "bionic/clock_getcpuclockid.cpp",
1034 "bionic/clock_nanosleep.cpp",
1035 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001036 "bionic/connect.cpp",
1037 "bionic/ctype.cpp",
1038 "bionic/dirent.cpp",
1039 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001040 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001041 "bionic/error.cpp",
1042 "bionic/eventfd_read.cpp",
1043 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001044 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001045 "bionic/faccessat.cpp",
1046 "bionic/fchmod.cpp",
1047 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001048 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001049 "bionic/ffs.cpp",
1050 "bionic/fgetxattr.cpp",
1051 "bionic/flistxattr.cpp",
1052 "bionic/flockfile.cpp",
1053 "bionic/fpclassify.cpp",
1054 "bionic/fsetxattr.cpp",
1055 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001056 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001057 "bionic/futimens.cpp",
1058 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001059 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001060 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001061 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001062 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001063 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001064 "bionic/getpgrp.cpp",
1065 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001066 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001067 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001068 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001069 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001070 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001071 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001072 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001073 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001074 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001075 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001076 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001077 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001078 "bionic/lchown.cpp",
1079 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001080 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001081 "bionic/libgen.cpp",
1082 "bionic/link.cpp",
1083 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001084 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001085 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001086 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001087 "bionic/mbrtoc16.cpp",
1088 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001089 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001090 "bionic/mempcpy.cpp",
1091 "bionic/mkdir.cpp",
1092 "bionic/mkfifo.cpp",
1093 "bionic/mknod.cpp",
1094 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001095 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001096 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001097 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001098 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001099 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001100 "bionic/open.cpp",
1101 "bionic/pathconf.cpp",
1102 "bionic/pause.cpp",
1103 "bionic/pipe.cpp",
1104 "bionic/poll.cpp",
1105 "bionic/posix_fadvise.cpp",
1106 "bionic/posix_fallocate.cpp",
1107 "bionic/posix_madvise.cpp",
1108 "bionic/posix_timers.cpp",
1109 "bionic/ptrace.cpp",
1110 "bionic/pty.cpp",
1111 "bionic/raise.cpp",
1112 "bionic/rand.cpp",
1113 "bionic/readlink.cpp",
1114 "bionic/reboot.cpp",
1115 "bionic/recv.cpp",
1116 "bionic/rename.cpp",
1117 "bionic/rmdir.cpp",
1118 "bionic/scandir.cpp",
1119 "bionic/sched_getaffinity.cpp",
1120 "bionic/sched_getcpu.cpp",
1121 "bionic/semaphore.cpp",
1122 "bionic/send.cpp",
1123 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001124 "bionic/seteuid.cpp",
1125 "bionic/setpgrp.cpp",
1126 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001127 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001128 "bionic/sigprocmask.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001129 "bionic/socket.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001130 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001131 "bionic/stat.cpp",
1132 "bionic/statvfs.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001133 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001134 "bionic/strchrnul.cpp",
1135 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001136 "bionic/string_l.cpp",
1137 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001138 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001139 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001140 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001141 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001142 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001143 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001144 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001145 "bionic/sys_msg.cpp",
1146 "bionic/sys_sem.cpp",
1147 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001148 "bionic/sys_signalfd.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001149 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001150 "bionic/sysinfo.cpp",
1151 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001152 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001153 "bionic/system_property_api.cpp",
1154 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001155 "bionic/tdestroy.cpp",
1156 "bionic/termios.cpp",
1157 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001158 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001159 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001160 "bionic/tmpfile.cpp",
1161 "bionic/umount.cpp",
1162 "bionic/unlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001163 "bionic/wait.cpp",
1164 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001165 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001166 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001167 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001168 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001169 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001170
1171 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1172 // which will be overridden by the actual one in libc.so.
1173 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001174 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001175
Dan Willemsen208ae172015-09-16 16:33:27 -07001176 multilib: {
1177 lib32: {
1178 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001179 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001180 },
1181 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001182 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001183 treble_linker_namespaces: {
1184 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001185 },
1186 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001187 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001188 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001189 local_include_dirs: ["stdio"],
1190 include_dirs: ["bionic/libstdc++/include"],
1191 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001192 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001193}
1194
Dan Willemsen208ae172015-09-16 16:33:27 -07001195// ========================================================
1196// libc_pthread.a - pthreads parts that previously lived in
1197// libc_bionic.a. Relocated to their own library because
1198// they can't be included in libc_ndk.a (as they layout of
1199// pthread_t has changed over the years and has ABI
1200// compatibility issues).
1201// ========================================================
1202
1203cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001204 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001205 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001206 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001207 "bionic/pthread_atfork.cpp",
1208 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001209 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001210 "bionic/pthread_cond.cpp",
1211 "bionic/pthread_create.cpp",
1212 "bionic/pthread_detach.cpp",
1213 "bionic/pthread_equal.cpp",
1214 "bionic/pthread_exit.cpp",
1215 "bionic/pthread_getcpuclockid.cpp",
1216 "bionic/pthread_getschedparam.cpp",
1217 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001218 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001219 "bionic/pthread_join.cpp",
1220 "bionic/pthread_key.cpp",
1221 "bionic/pthread_kill.cpp",
1222 "bionic/pthread_mutex.cpp",
1223 "bionic/pthread_once.cpp",
1224 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001225 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001226 "bionic/pthread_self.cpp",
1227 "bionic/pthread_setname_np.cpp",
1228 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001229 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001230
1231 // The following implementations depend on pthread data or implementation,
1232 // so we can't include them in libc_ndk.a.
1233 "bionic/__cxa_thread_atexit_impl.cpp",
1234 "stdlib/atexit.c",
1235 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001236 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001237
Colin Cross50c21ab2015-10-31 23:03:05 -07001238 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001239 include_dirs: ["bionic/libstdc++/include"],
1240 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001241}
1242
1243// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001244// libc_syscalls.a
1245// ========================================================
1246
Elliott Hughes782c4852019-04-16 12:31:00 -07001247genrule {
1248 name: "syscalls-arm.S",
1249 out: ["syscalls-arm.S"],
1250 srcs: ["SYSCALLS.TXT"],
1251 tool_files: [":bionic-gensyscalls"],
1252 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1253}
1254
1255genrule {
1256 name: "syscalls-arm64.S",
1257 out: ["syscalls-arm64.S"],
1258 srcs: ["SYSCALLS.TXT"],
1259 tool_files: [":bionic-gensyscalls"],
1260 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1261}
1262
1263genrule {
1264 name: "syscalls-x86.S",
1265 out: ["syscalls-x86.S"],
1266 srcs: ["SYSCALLS.TXT"],
1267 tool_files: [":bionic-gensyscalls"],
1268 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1269}
1270
1271genrule {
1272 name: "syscalls-x86_64.S",
1273 out: ["syscalls-x86_64.S"],
1274 srcs: ["SYSCALLS.TXT"],
1275 tool_files: [":bionic-gensyscalls"],
1276 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1277}
1278
Dan Willemsen208ae172015-09-16 16:33:27 -07001279cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001280 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001281 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001282 arch: {
1283 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001284 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001285 },
1286 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001287 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001288 },
1289 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001290 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001291 },
1292 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001293 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001294 },
1295 },
1296 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001297}
1298
1299// ========================================================
1300// libc_aeabi.a
1301// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1302// to avoid infinite recursion. For the other architectures we just build an
1303// empty library to keep this makefile simple.
1304// ========================================================
1305
1306cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001307 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001308 arch: {
1309 arm: {
1310 srcs: ["arch-arm/bionic/__aeabi.c"],
1311 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001312 },
1313 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001314 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001315}
1316
1317// ========================================================
1318// libc_ndk.a
1319// Compatibility library for the NDK. This library contains
1320// all the parts of libc that are safe to statically link.
1321// We can't safely statically link things that can only run
1322// on a certain version of the OS. Examples include
1323// anything that talks to netd (a large portion of the DNS
1324// code) and anything that is dependent on the layout of a
1325// data structure that has changed across releases (such as
1326// pthread_t).
1327// ========================================================
1328
1329cc_library_static {
1330 name: "libc_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001331 defaults: ["libc_defaults"],
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001332 srcs: libc_common_src_files + [
1333 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001334 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001335 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001336 multilib: {
1337 lib32: {
1338 srcs: libc_common_src_files_32,
1339 },
1340 },
1341 arch: {
1342 arm: {
1343 srcs: [
1344 "arch-arm/bionic/exidx_dynamic.c",
1345 "arch-common/bionic/crtbegin_so.c",
1346 "arch-arm/bionic/atexit_legacy.c",
1347 "arch-common/bionic/crtend_so.S",
1348 ],
1349 whole_static_libs: ["libc_aeabi"],
1350 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001351 },
1352
Colin Cross50c21ab2015-10-31 23:03:05 -07001353 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001354 "-fvisibility=hidden",
1355 "-DLIBC_STATIC",
1356 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001357
1358 whole_static_libs: [
1359 "libc_bionic_ndk",
George Burgess IV6cb06872017-07-21 13:28:42 -07001360 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001361 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001362 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001363 "libc_gdtoa",
1364 "libc_malloc",
1365 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001366 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001367 "libc_openbsd_ndk",
1368 "libc_stack_protector",
1369 "libc_syscalls",
1370 "libc_tzcode",
1371 "libm",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001372 "libjemalloc5",
Elliott Hughes816fab92016-05-27 17:57:46 -07001373 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001374 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001375}
1376
1377// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001378// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001379// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001380cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001381 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001382 srcs: libc_common_src_files,
1383 multilib: {
1384 lib32: {
1385 srcs: libc_common_src_files_32,
1386 },
1387 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001388 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001389
1390 whole_static_libs: [
1391 "libc_bionic",
1392 "libc_bionic_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001393 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001394 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001395 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001396 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001397 "libc_gdtoa",
1398 "libc_malloc",
1399 "libc_netbsd",
1400 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001401 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001402 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001403 "libc_stack_protector",
1404 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001405 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001406 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001407 ],
1408
1409 arch: {
1410 arm: {
1411 whole_static_libs: ["libc_aeabi"],
1412 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001413 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001414}
1415
1416// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001417// libc_common.a
1418// ========================================================
1419
1420cc_library_static {
1421 defaults: ["libc_defaults"],
1422 name: "libc_common",
1423
1424 whole_static_libs: [
1425 "libc_nopthread",
1426 "libc_pthread",
1427 ],
1428}
1429
1430// ========================================================
Haibo Huangf71edfa2018-11-12 10:06:56 -08001431// libc_common_static.a For static binaries.
1432// ========================================================
1433cc_library_static {
1434 defaults: ["libc_defaults"],
1435 name: "libc_common_static",
1436
Haibo Huangb9244ff2018-08-11 10:12:13 -07001437 arch: {
1438 x86: {
1439 srcs: ["arch-x86/static_function_dispatch.S"],
1440 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001441 arm: {
1442 srcs: ["arch-arm/static_function_dispatch.S"],
1443 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001444 },
1445
Haibo Huangf71edfa2018-11-12 10:06:56 -08001446 whole_static_libs: [
1447 "libc_common",
1448 ],
1449}
1450
1451// ========================================================
1452// libc_common_shared.a For shared libraries.
1453// ========================================================
1454cc_library_static {
1455 defaults: ["libc_defaults"],
1456 name: "libc_common_shared",
1457
Haibo Huangb9244ff2018-08-11 10:12:13 -07001458 cflags: [
1459 "-fno-stack-protector",
1460 "-fno-jump-tables",
1461 ],
1462 arch: {
1463 x86: {
1464 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1465 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001466 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001467 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001468 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001469 },
1470
Haibo Huangf71edfa2018-11-12 10:06:56 -08001471 whole_static_libs: [
1472 "libc_common",
1473 ],
1474}
1475
1476// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001477// libc_nomalloc.a
1478// ========================================================
1479//
1480// This is a version of the static C library that does not
1481// include malloc. It's useful in situations when the user wants
1482// to provide their own malloc implementation, or wants to
1483// explicitly disallow the use of malloc, such as in the
1484// dynamic linker.
1485
1486cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001487 name: "libc_nomalloc",
1488
Colin Cross50c21ab2015-10-31 23:03:05 -07001489 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001490
1491 arch: {
1492 arm: {
1493 srcs: ["arch-arm/bionic/exidx_static.c"],
1494 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001495 },
1496
Colin Cross50c21ab2015-10-31 23:03:05 -07001497 cflags: ["-DLIBC_STATIC"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001498
Colin Crossa3f9fca2016-01-11 13:20:55 -08001499 whole_static_libs: [
Haibo Huangf71edfa2018-11-12 10:06:56 -08001500 "libc_common_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001501 "libc_init_static",
1502 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001503}
1504
1505// ========================================================
1506// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1507// ========================================================
1508cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001509 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001510 srcs: ["bionic/jemalloc_wrapper.cpp"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001511 cflags: ["-fvisibility=hidden"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001512
Dan Willemsen208ae172015-09-16 16:33:27 -07001513 name: "libc_malloc",
Dan Willemsen208ae172015-09-16 16:33:27 -07001514}
1515
dimitryc0c0ef62018-12-05 16:33:52 +01001516filegroup {
1517 name: "libc_sources_shared",
1518 srcs: [
1519 "arch-common/bionic/crtbegin_so.c",
1520 "arch-common/bionic/crtbrand.S",
1521 "bionic/icu.cpp",
1522 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001523 "bionic/malloc_common_dynamic.cpp",
1524 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001525 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001526 "bionic/NetdClient.cpp",
1527 "arch-common/bionic/crtend_so.S",
1528 ],
1529}
1530
1531filegroup {
1532 name: "libc_sources_static",
1533 srcs: [
1534 "bionic/dl_iterate_phdr_static.cpp",
1535 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001536 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001537 ],
1538}
1539
1540filegroup {
1541 name: "libc_sources_shared_arm",
1542 srcs: [
1543 "arch-arm/bionic/exidx_dynamic.c",
1544 "arch-arm/bionic/atexit_legacy.c",
1545 ],
1546}
1547
1548filegroup {
1549 name: "libc_sources_static_arm",
1550 srcs: [ "arch-arm/bionic/exidx_static.c" ],
1551}
1552
Dan Willemsen208ae172015-09-16 16:33:27 -07001553// ========================================================
1554// libc.a + libc.so
1555// ========================================================
1556cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001557 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001558 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001559 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001560 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001561 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001562 platform_sdk_version: {
1563 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1564 },
1565 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001566 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001567 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001568 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001569 whole_static_libs: [
1570 "libc_init_static",
1571 "libc_common_static",
1572 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001573 },
1574 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001575 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001576 whole_static_libs: [
1577 "libc_init_dynamic",
1578 "libc_common_shared",
1579 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001580 },
1581
Neil Fullera7db90f2019-04-25 09:28:27 +01001582 required: [
1583 "tzdata",
1584 "tz_version", // Version metadata for tzdata to help debugging.
1585 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001586
Colin Cross4ce94d22016-11-15 13:15:43 -08001587 // Do not pack libc.so relocations; see http://b/20645321 for details.
1588 pack_relocations: false,
1589
dimitry06016f22018-01-05 11:39:28 +01001590 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1591 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1592 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1593 // those new libraries from libgcc.a are not declared external; if that were the case,
1594 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1595 // on the external symbols from the dependent libraries. That would create a "cloaked"
1596 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001597
dimitry06016f22018-01-05 11:39:28 +01001598 shared_libs: [
1599 "ld-android",
1600 "libdl",
1601 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001602 static_libs: [
1603 "libdl_android",
1604 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001605 whole_static_libs: [
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001606 "libjemalloc5",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001607 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001608
1609 nocrt: true,
1610
Dan Willemsen208ae172015-09-16 16:33:27 -07001611 arch: {
1612 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001613 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001614 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001615 ldflags: ["-Wl,--hash-style=both"],
1616
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001617 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001618
Dan Willemsen208ae172015-09-16 16:33:27 -07001619 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001620 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001621 // special for arm
1622 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001623 },
1624 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001625 srcs: [":libc_sources_static_arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001626 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001627
1628 // Arm 32 bit does not produce complete exidx unwind information
1629 // so keep the .debug_frame which is relatively small and does
1630 // include needed unwind information.
1631 // See b/132992102 for details.
1632 strip: {
1633 keep_symbols_and_debug_frame: true,
1634 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001635 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001636 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001637 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001638
1639 // Leave the symbols in the shared library so that stack unwinders can produce
1640 // meaningful name resolution.
1641 strip: {
1642 keep_symbols: true,
1643 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001644 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001645 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001646 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001647 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001648 ldflags: ["-Wl,--hash-style=both"],
1649
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001650 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001651
1652 // Leave the symbols in the shared library so that stack unwinders can produce
1653 // meaningful name resolution.
1654 strip: {
1655 keep_symbols: true,
1656 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001657 },
1658 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001659 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001660
1661 // Leave the symbols in the shared library so that stack unwinders can produce
1662 // meaningful name resolution.
1663 strip: {
1664 keep_symbols: true,
1665 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001666 },
1667 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001668
1669 stubs: {
1670 symbol_file: "libc.map.txt",
1671 versions: ["10000"],
1672 },
Vic Yang6903fb82019-01-14 11:34:39 -08001673
1674 symbol_ordering_file: "symbol_ordering",
Dan Willemsen208ae172015-09-16 16:33:27 -07001675}
1676
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001677genrule {
1678 name: "libc.arm.map",
1679 out: ["libc.arm.map"],
1680 srcs: ["libc.map.txt"],
1681 tool_files: [":bionic-generate-version-script"],
1682 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1683}
1684
1685genrule {
1686 name: "libc.arm64.map",
1687 out: ["libc.arm64.map"],
1688 srcs: ["libc.map.txt"],
1689 tool_files: [":bionic-generate-version-script"],
1690 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1691}
1692
1693genrule {
1694 name: "libc.x86.map",
1695 out: ["libc.x86.map"],
1696 srcs: ["libc.map.txt"],
1697 tool_files: [":bionic-generate-version-script"],
1698 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1699}
1700
1701genrule {
1702 name: "libc.x86_64.map",
1703 out: ["libc.x86_64.map"],
1704 srcs: ["libc.map.txt"],
1705 tool_files: [":bionic-generate-version-script"],
1706 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1707}
1708
Logan Chien17af91b2019-01-15 21:19:56 +08001709// libc_headers for libasync_safe and libpropertyinfoparser
1710cc_library_headers {
1711 name: "libc_headers",
1712
1713 host_supported: true,
1714 vendor_available: true,
1715 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001716 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001717
1718 no_libcrt: true,
1719 no_libgcc: true,
1720 stl: "none",
1721 system_shared_libs: [],
1722
1723 export_include_dirs: [
1724 "include",
1725 "kernel/uapi",
1726 "kernel/android/uapi",
1727 ],
1728
1729 arch: {
1730 arm: {
1731 export_include_dirs: [
1732 "kernel/uapi/asm-arm",
1733 ],
1734 },
1735 arm64: {
1736 export_include_dirs: [
1737 "kernel/uapi/asm-arm64",
1738 ],
1739 },
1740 mips: {
1741 export_include_dirs: [
1742 "kernel/uapi/asm-mips",
1743 ],
1744 },
1745 mips64: {
1746 export_include_dirs: [
1747 "kernel/uapi/asm-mips",
1748 ],
1749 },
1750 x86: {
1751 export_include_dirs: [
1752 "kernel/uapi/asm-x86",
1753 ],
1754 },
1755 x86_64: {
1756 export_include_dirs: [
1757 "kernel/uapi/asm-x86",
1758 ],
1759 },
1760 },
1761}
1762
Dan Willemsen208ae172015-09-16 16:33:27 -07001763// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001764// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001765// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001766
Dan Willemsen208ae172015-09-16 16:33:27 -07001767cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001768 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001769 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001770 srcs: [
1771 "bionic/__cxa_guard.cpp",
1772 "bionic/__cxa_pure_virtual.cpp",
1773 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001774 ],
1775 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001776 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001777 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001778
Dan Willemsen6b3be172018-12-03 13:57:20 -08001779 static: {
1780 system_shared_libs: [],
1781 },
1782 shared: {
1783 system_shared_libs: ["libc"],
1784 },
1785
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001786 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001787 arch: {
1788 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001789 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001790 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001791 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001792 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001793 },
1794 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001795 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001796 },
1797 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001798 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001799 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001800 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001801 },
1802 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001803 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001804 },
1805 },
1806}
1807
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001808genrule {
1809 name: "libstdc++.arm.map",
1810 out: ["libstdc++.arm.map"],
1811 srcs: ["libstdc++.map.txt"],
1812 tool_files: [":bionic-generate-version-script"],
1813 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1814}
1815
1816genrule {
1817 name: "libstdc++.arm64.map",
1818 out: ["libstdc++.arm64.map"],
1819 srcs: ["libstdc++.map.txt"],
1820 tool_files: [":bionic-generate-version-script"],
1821 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1822}
1823
1824genrule {
1825 name: "libstdc++.x86.map",
1826 out: ["libstdc++.x86.map"],
1827 srcs: ["libstdc++.map.txt"],
1828 tool_files: [":bionic-generate-version-script"],
1829 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1830}
1831
1832genrule {
1833 name: "libstdc++.x86_64.map",
1834 out: ["libstdc++.x86_64.map"],
1835 srcs: ["libstdc++.map.txt"],
1836 tool_files: [":bionic-generate-version-script"],
1837 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1838}
1839
1840// ========================================================
1841// crt object files.
1842// ========================================================
1843
Colin Cross50c21ab2015-10-31 23:03:05 -07001844cc_defaults {
1845 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001846 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001847 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001848 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001849 native_bridge_supported: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001850
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001851 cflags: [
1852 "-Wno-gcc-compat",
1853 "-Wall",
1854 "-Werror",
1855 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001856}
1857
Colin Cross50c21ab2015-10-31 23:03:05 -07001858cc_defaults {
1859 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001860 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001861
1862 arch: {
1863 mips: {
1864 cflags: ["-fPIC"],
1865 },
1866 mips64: {
1867 cflags: ["-fPIC"],
1868 },
1869 x86: {
1870 cflags: ["-fPIC"],
1871 },
1872 x86_64: {
1873 cflags: ["-fPIC"],
1874 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001875 },
Colin Crossab179442018-09-27 11:03:22 -07001876 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001877}
1878
Dan Willemsen208ae172015-09-16 16:33:27 -07001879cc_object {
1880 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001881 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001882 local_include_dirs: ["include"],
1883 product_variables: {
1884 platform_sdk_version: {
1885 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1886 },
1887 },
1888 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001889
Colin Cross7d7b3682017-11-03 13:38:40 -07001890 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001891}
1892
Dan Willemsen208ae172015-09-16 16:33:27 -07001893cc_object {
1894 name: "crtbegin_so1",
1895 local_include_dirs: ["include"],
1896 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001897
Colin Cross7d7b3682017-11-03 13:38:40 -07001898 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001899}
1900
Dan Willemsen208ae172015-09-16 16:33:27 -07001901cc_object {
1902 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07001903
Colin Cross7d7b3682017-11-03 13:38:40 -07001904 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07001905 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001906 "crtbegin_so1",
1907 "crtbrand",
1908 ],
1909}
1910
Dan Willemsen208ae172015-09-16 16:33:27 -07001911cc_object {
1912 name: "crtend_so",
1913 local_include_dirs: ["include"],
1914 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001915
Colin Cross7d7b3682017-11-03 13:38:40 -07001916 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001917}
1918
Dan Willemsen208ae172015-09-16 16:33:27 -07001919cc_object {
1920 name: "crtbegin_static1",
1921 local_include_dirs: ["include"],
1922 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001923
Colin Cross50c21ab2015-10-31 23:03:05 -07001924 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001925 mips: {
1926 srcs: [
1927 "arch-mips/bionic/crtbegin.c",
1928 ],
1929 exclude_srcs: [
1930 "arch-common/bionic/crtbegin.c",
1931 ],
1932 },
1933 mips64: {
1934 srcs: [
1935 "arch-mips64/bionic/crtbegin.c",
1936 ],
1937 exclude_srcs: [
1938 "arch-common/bionic/crtbegin.c",
1939 ],
1940 },
1941 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001942
1943 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001944}
1945
Dan Willemsen208ae172015-09-16 16:33:27 -07001946cc_object {
1947 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07001948
Colin Cross77d57bf2016-04-11 14:34:18 -07001949 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001950 "crtbegin_static1",
1951 "crtbrand",
1952 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001953 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001954}
1955
Dan Willemsen208ae172015-09-16 16:33:27 -07001956cc_object {
1957 name: "crtbegin_dynamic1",
1958 local_include_dirs: ["include"],
1959 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001960
Colin Cross50c21ab2015-10-31 23:03:05 -07001961 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001962 mips: {
1963 srcs: [
1964 "arch-mips/bionic/crtbegin.c",
1965 ],
1966 exclude_srcs: [
1967 "arch-common/bionic/crtbegin.c",
1968 ],
1969 },
1970 mips64: {
1971 srcs: [
1972 "arch-mips64/bionic/crtbegin.c",
1973 ],
1974 exclude_srcs: [
1975 "arch-common/bionic/crtbegin.c",
1976 ],
1977 },
1978 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001979 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001980}
1981
Dan Willemsen208ae172015-09-16 16:33:27 -07001982cc_object {
1983 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07001984
Colin Cross77d57bf2016-04-11 14:34:18 -07001985 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001986 "crtbegin_dynamic1",
1987 "crtbrand",
1988 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07001989 target: {
1990 linux_bionic: {
1991 generated_sources: ["host_bionic_linker_asm"],
1992 objs: [
1993 "linker_wrapper",
1994 ],
1995 },
1996 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001997 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001998}
1999
Dan Willemsen208ae172015-09-16 16:33:27 -07002000cc_object {
2001 // We rename crtend.o to crtend_android.o to avoid a
2002 // name clash between gcc and bionic.
2003 name: "crtend_android",
2004 local_include_dirs: ["include"],
2005 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002006
Colin Cross50c21ab2015-10-31 23:03:05 -07002007 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002008}
Colin Crossbaa48992016-07-13 11:15:21 -07002009
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002010// ========================================================
2011// NDK headers.
2012// ========================================================
2013
Dan Albert26e1c412018-05-24 14:56:46 -07002014versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002015 name: "common_libc",
2016 from: "include",
2017 to: "",
2018 license: "NOTICE",
2019}
Dan Albert4238a352016-06-28 11:18:05 -07002020
2021ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002022 name: "libc_uapi",
2023 from: "kernel/uapi",
2024 to: "",
2025 srcs: [
2026 "kernel/uapi/asm-generic/**/*.h",
2027 "kernel/uapi/drm/**/*.h",
2028 "kernel/uapi/linux/**/*.h",
2029 "kernel/uapi/misc/**/*.h",
2030 "kernel/uapi/mtd/**/*.h",
2031 "kernel/uapi/rdma/**/*.h",
2032 "kernel/uapi/scsi/**/*.h",
2033 "kernel/uapi/sound/**/*.h",
2034 "kernel/uapi/video/**/*.h",
2035 "kernel/uapi/xen/**/*.h",
2036 ],
Dan Albert92592652016-10-20 01:42:54 -07002037 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002038}
2039
2040ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002041 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002042 from: "kernel/android/uapi/linux",
2043 to: "linux",
2044 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002045 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002046}
2047
2048ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002049 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002050 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002051 to: "scsi",
2052 srcs: ["kernel/android/scsi/**/*.h"],
2053 license: "NOTICE",
2054}
2055
2056ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002057 name: "libc_asm_arm",
2058 from: "kernel/uapi/asm-arm",
2059 to: "arm-linux-androideabi",
2060 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002061 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002062}
2063
2064ndk_headers {
2065 name: "libc_asm_arm64",
2066 from: "kernel/uapi/asm-arm64",
2067 to: "aarch64-linux-android",
2068 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002069 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002070}
2071
Elliott Hughesee291c02017-12-11 11:32:34 -08002072// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002073ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002074 name: "libc_asm_mips",
2075 from: "kernel/uapi/asm-mips",
2076 to: "mipsel-linux-android",
2077 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2078 license: "NOTICE",
2079}
2080
Elliott Hughesee291c02017-12-11 11:32:34 -08002081// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002082ndk_headers {
2083 name: "libc_asm_mips64",
2084 from: "kernel/uapi/asm-mips",
2085 to: "mips64el-linux-android",
2086 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2087 license: "NOTICE",
2088}
2089
2090ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002091 name: "libc_asm_x86",
2092 from: "kernel/uapi/asm-x86",
2093 to: "i686-linux-android",
2094 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002095 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002096}
2097
2098ndk_headers {
2099 name: "libc_asm_x86_64",
2100 from: "kernel/uapi/asm-x86",
2101 to: "x86_64-linux-android",
2102 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002103 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002104}
2105
Dan Albert4238a352016-06-28 11:18:05 -07002106ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002107 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002108 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002109 symbol_file: "libc.map.txt",
2110 first_version: "9",
2111}
2112
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002113llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002114 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002115 symbol_file: "libc.map.txt",
2116 export_headers_as_system: true,
2117 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002118 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002119 export_include_dirs: [
2120 "kernel/android/uapi",
2121 "kernel/uapi",
2122 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002123 arch: {
2124 arm: {
2125 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002126 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002127 ],
2128 },
2129 arm64: {
2130 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002131 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002132 ],
2133 },
2134 mips: {
2135 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002136 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002137 ],
2138 },
2139 mips64: {
2140 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002141 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002142 ],
2143 },
2144 x86: {
2145 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002146 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002147 ],
2148 },
2149 x86_64: {
2150 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002151 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002152 ],
2153 },
2154 },
2155}
2156
Dan Albertdf31aff2016-10-06 15:50:41 -07002157ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002158 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002159 symbol_file: "libstdc++.map.txt",
2160 first_version: "9",
2161}
2162
Dan Willemsenca056d72018-01-08 14:00:24 -08002163// Export these headers for toolbox to process
2164filegroup {
2165 name: "kernel_input_headers",
2166 srcs: [
2167 "kernel/uapi/linux/input.h",
2168 "kernel/uapi/linux/input-event-codes.h",
2169 ],
2170}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002171
2172// Generate a syscall name / number mapping. These objects are text files
2173// (thanks to the -dD -E flags) and not binary files. They will then be
2174// consumed by the genseccomp.py script and converted into C++ code.
2175cc_defaults {
2176 name: "libseccomp_gen_syscall_nrs_defaults",
2177 recovery_available: true,
2178 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2179 cflags: [
2180 "-dD",
2181 "-E",
2182 "-Wall",
2183 "-Werror",
2184 "-nostdinc",
2185 ],
2186}
2187
2188cc_object {
2189 name: "libseccomp_gen_syscall_nrs_arm",
2190 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2191 local_include_dirs: [
2192 "kernel/uapi/asm-arm",
2193 "kernel/uapi",
2194 ],
2195}
2196
2197cc_object {
2198 name: "libseccomp_gen_syscall_nrs_arm64",
2199 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2200 local_include_dirs: [
2201 "kernel/uapi/asm-arm64",
2202 "kernel/uapi",
2203 ],
2204}
2205
2206cc_object {
2207 name: "libseccomp_gen_syscall_nrs_x86",
2208 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2209 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2210 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2211 local_include_dirs: [
2212 "kernel/uapi/asm-x86",
2213 "kernel/uapi",
2214 ],
2215}
2216
2217cc_object {
2218 name: "libseccomp_gen_syscall_nrs_x86_64",
2219 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2220 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2221 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2222 local_include_dirs: [
2223 "kernel/uapi/asm-x86",
2224 "kernel/uapi",
2225 ],
2226}
2227
2228cc_object {
2229 name: "libseccomp_gen_syscall_nrs_mips",
2230 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2231 cflags: [
2232 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2233 ],
2234 local_include_dirs: [
2235 "kernel/uapi/asm-mips",
2236 "kernel/uapi",
2237 ],
2238}
2239
2240cc_object {
2241 name: "libseccomp_gen_syscall_nrs_mips64",
2242 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2243 cflags: [
2244 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2245 ],
2246 local_include_dirs: [
2247 "kernel/uapi/asm-mips",
2248 "kernel/uapi",
2249 ],
2250}
2251
2252// Generate the C++ policy sources for app, system, and global seccomp-bpf
2253// filters.
2254python_binary_host {
2255 name: "genseccomp",
2256 main: "tools/genseccomp.py",
2257
2258 srcs: [
2259 "tools/genseccomp.py",
2260 "tools/gensyscalls.py",
2261 ],
2262
2263 data: [
2264 "kernel/uapi/**/*.h",
2265 ],
2266
2267 version: {
2268 py2: {
2269 enabled: true,
2270 },
2271 py3: {
2272 enabled: false,
2273 },
2274 },
2275}
2276
Martijn Coenen0c6de752019-01-02 12:52:51 +01002277python_binary_host {
2278 name: "genfunctosyscallnrs",
2279 main: "tools/genfunctosyscallnrs.py",
2280
2281 srcs: [
2282 "tools/genseccomp.py",
2283 "tools/genfunctosyscallnrs.py",
2284 "tools/gensyscalls.py",
2285 ],
2286
2287 data: [
2288 "kernel/uapi/**/*.h",
2289 ],
2290
2291 version: {
2292 py2: {
2293 enabled: true,
2294 },
2295 py3: {
2296 enabled: false,
2297 },
2298 },
2299}
2300
2301cc_genrule {
2302 name: "func_to_syscall_nrs",
2303 recovery_available: true,
2304 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2305
2306 tools: [ "genfunctosyscallnrs" ],
2307
2308 srcs: [
2309 "SYSCALLS.TXT",
2310 ":libseccomp_gen_syscall_nrs_arm",
2311 ":libseccomp_gen_syscall_nrs_arm64",
2312 ":libseccomp_gen_syscall_nrs_mips",
2313 ":libseccomp_gen_syscall_nrs_mips64",
2314 ":libseccomp_gen_syscall_nrs_x86",
2315 ":libseccomp_gen_syscall_nrs_x86_64",
2316 ],
2317
2318 out: [
2319 "func_to_syscall_nrs.h",
2320 ],
2321}
2322
Martijn Coenenc3752be2019-01-09 16:19:57 +01002323// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2324genrule {
2325 name: "generate_app_zygote_blacklist",
2326 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2327 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2328 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2329}
2330
2331cc_genrule {
2332 name: "libseccomp_policy_app_zygote_sources",
2333 recovery_available: true,
2334 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2335
2336 tools: [ "genseccomp" ],
2337
2338 srcs: [
2339 "SYSCALLS.TXT",
2340 "SECCOMP_WHITELIST_COMMON.TXT",
2341 "SECCOMP_WHITELIST_APP.TXT",
2342 "SECCOMP_BLACKLIST_COMMON.TXT",
2343 ":generate_app_zygote_blacklist",
2344 ":libseccomp_gen_syscall_nrs_arm",
2345 ":libseccomp_gen_syscall_nrs_arm64",
2346 ":libseccomp_gen_syscall_nrs_mips",
2347 ":libseccomp_gen_syscall_nrs_mips64",
2348 ":libseccomp_gen_syscall_nrs_x86",
2349 ":libseccomp_gen_syscall_nrs_x86_64",
2350 ],
2351
2352 out: [
2353 "arm64_app_zygote_policy.cpp",
2354 "arm_app_zygote_policy.cpp",
2355 "mips64_app_zygote_policy.cpp",
2356 "mips_app_zygote_policy.cpp",
2357 "x86_64_app_zygote_policy.cpp",
2358 "x86_app_zygote_policy.cpp",
2359 ],
2360}
2361
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002362cc_genrule {
2363 name: "libseccomp_policy_app_sources",
2364 recovery_available: true,
2365 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2366
2367 tools: [ "genseccomp" ],
2368
2369 srcs: [
2370 "SYSCALLS.TXT",
2371 "SECCOMP_WHITELIST_COMMON.TXT",
2372 "SECCOMP_WHITELIST_APP.TXT",
2373 "SECCOMP_BLACKLIST_COMMON.TXT",
2374 "SECCOMP_BLACKLIST_APP.TXT",
2375 ":libseccomp_gen_syscall_nrs_arm",
2376 ":libseccomp_gen_syscall_nrs_arm64",
2377 ":libseccomp_gen_syscall_nrs_mips",
2378 ":libseccomp_gen_syscall_nrs_mips64",
2379 ":libseccomp_gen_syscall_nrs_x86",
2380 ":libseccomp_gen_syscall_nrs_x86_64",
2381 ],
2382
2383 out: [
2384 "arm64_app_policy.cpp",
2385 "arm_app_policy.cpp",
2386 "mips64_app_policy.cpp",
2387 "mips_app_policy.cpp",
2388 "x86_64_app_policy.cpp",
2389 "x86_app_policy.cpp",
2390 ],
2391}
2392
2393cc_genrule {
2394 name: "libseccomp_policy_system_sources",
2395 recovery_available: true,
2396 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2397
2398 tools: [ "genseccomp" ],
2399
2400 srcs: [
2401 "SYSCALLS.TXT",
2402 "SECCOMP_WHITELIST_COMMON.TXT",
2403 "SECCOMP_WHITELIST_SYSTEM.TXT",
2404 "SECCOMP_BLACKLIST_COMMON.TXT",
2405 ":libseccomp_gen_syscall_nrs_arm",
2406 ":libseccomp_gen_syscall_nrs_arm64",
2407 ":libseccomp_gen_syscall_nrs_mips",
2408 ":libseccomp_gen_syscall_nrs_mips64",
2409 ":libseccomp_gen_syscall_nrs_x86",
2410 ":libseccomp_gen_syscall_nrs_x86_64",
2411 ],
2412
2413 out: [
2414 "arm64_system_policy.cpp",
2415 "arm_system_policy.cpp",
2416 "mips64_system_policy.cpp",
2417 "mips_system_policy.cpp",
2418 "x86_64_system_policy.cpp",
2419 "x86_system_policy.cpp",
2420 ],
2421}
2422
2423cc_genrule {
2424 name: "libseccomp_policy_global_sources",
2425 recovery_available: true,
2426 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=global $(in)",
2427
2428 tools: [ "genseccomp" ],
2429
2430 srcs: [
2431 "SYSCALLS.TXT",
2432 "SECCOMP_WHITELIST_COMMON.TXT",
2433 "SECCOMP_WHITELIST_SYSTEM.TXT",
2434 "SECCOMP_WHITELIST_APP.TXT",
2435 "SECCOMP_WHITELIST_GLOBAL.TXT",
2436 "SECCOMP_BLACKLIST_COMMON.TXT",
2437 ":libseccomp_gen_syscall_nrs_arm",
2438 ":libseccomp_gen_syscall_nrs_arm64",
2439 ":libseccomp_gen_syscall_nrs_mips",
2440 ":libseccomp_gen_syscall_nrs_mips64",
2441 ":libseccomp_gen_syscall_nrs_x86",
2442 ":libseccomp_gen_syscall_nrs_x86_64",
2443 ],
2444
2445 out: [
2446 "arm64_global_policy.cpp",
2447 "arm_global_policy.cpp",
2448 "mips64_global_policy.cpp",
2449 "mips_global_policy.cpp",
2450 "x86_64_global_policy.cpp",
2451 "x86_global_policy.cpp",
2452 ],
2453}
2454
2455cc_library {
2456 name: "libseccomp_policy",
2457 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002458 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002459 generated_sources: [
2460 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002461 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002462 "libseccomp_policy_global_sources",
2463 "libseccomp_policy_system_sources",
2464 ],
2465
2466 srcs: [
2467 "seccomp/seccomp_policy.cpp",
2468 ],
2469
2470 export_include_dirs: ["seccomp/include"],
2471 cflags: [
2472 "-Wall",
2473 "-Werror",
2474 ],
2475 shared: {
2476 shared_libs: ["libbase"],
2477 },
2478 static: {
2479 static_libs: ["libbase"],
2480 },
2481}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002482
2483// This is a temporary library that will use scudo as the native memory
2484// allocator. To use it, add it as the first shared library.
2485cc_library_shared {
2486 name: "libc_scudo",
2487 vendor_available: true,
2488 srcs: [
2489 "bionic/malloc_common.cpp",
2490 "bionic/malloc_common_dynamic.cpp",
2491 "bionic/malloc_heapprofd.cpp",
2492 "bionic/malloc_limit.cpp",
2493 "bionic/scudo_wrapper.cpp",
2494 "bionic/__set_errno.cpp",
2495 ],
2496 cflags: ["-DUSE_SCUDO"],
2497 stl: "none",
2498 system_shared_libs: [],
2499
2500 header_libs: ["libc_headers"],
2501
2502 static_libs: ["libasync_safe"],
2503
2504 allow_undefined_symbols: true,
2505 shared_libs: ["libscudo_wrapper"],
2506
2507 arch: {
2508 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002509 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002510 },
2511 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002512 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002513 },
2514 x86: {
2515 srcs: [
2516 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002517 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002518 ],
2519 },
2520 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002521 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002522 },
2523 },
2524
2525 // Mark this library as global so it overrides all the allocation
2526 // definitions properly.
2527 ldflags: ["-Wl,-z,global"],
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002528
2529 // Like libc, disable native coverage for libc_scudo.
2530 native_coverage: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002531}
2532
2533subdirs = [
2534 "bionic/scudo",
2535]