blob: 669ffc06ca7acb428bca288dff827a2ca3c20bb3 [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001// Define the common source files for all the libc instances
2// =========================================================
3libc_common_src_files = [
Christopher Ferris7a3681e2017-04-24 17:48:32 -07004 "async_safe/async_safe_log.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07005 "bionic/ether_aton.c",
6 "bionic/ether_ntoa.c",
7 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/pututline.c",
11 "bionic/sched_cpualloc.c",
12 "bionic/sched_cpucount.c",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070013 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070014 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070015 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080016 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070017 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080018 "stdio/vfscanf.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070019 "stdio/vfwscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070020 "stdlib/exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070021]
22
23// Various kinds of cruft.
24// ========================================================
25libc_common_src_files += [
26 "bionic/ndk_cruft.cpp",
27]
28
29libc_common_src_files_32 = [
30 "bionic/legacy_32_bit_support.cpp",
31 "bionic/time64.c",
32]
33
Elliott Hughes53cf3482016-08-09 13:06:41 -070034libc_common_flags = [
35 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080036 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070037 "-Wall",
38 "-Wextra",
39 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080040 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070041 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070042 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070043 "-Wframe-larger-than=2048",
George Burgess IVfa5410f2018-08-13 17:44:06 -070044 "-Wimplicit-fallthrough",
Elliott Hughes53cf3482016-08-09 13:06:41 -070045
46 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
47 "-Werror=pointer-to-int-cast",
48 "-Werror=int-to-pointer-cast",
49 "-Werror=type-limits",
50 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080051
52 // Clang's exit-time destructor registration hides __dso_handle, but
53 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
54 "-Wexit-time-destructors",
Elliott Hughes53cf3482016-08-09 13:06:41 -070055]
56
Dan Willemsen208ae172015-09-16 16:33:27 -070057// Define some common cflags
58// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070059cc_defaults {
60 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080061 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070062 cflags: libc_common_flags,
63 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070064 conlyflags: ["-std=gnu99"],
65 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070066 include_dirs: [
67 "bionic/libc/async_safe/include",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -070068 "external/jemalloc_new/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070069 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070070
Colin Cross50c21ab2015-10-31 23:03:05 -070071 stl: "none",
72 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070073 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070074 address: false,
75 integer_overflow: false,
Colin Cross27c43c52016-04-07 13:27:24 -070076 },
Colin Cross50c21ab2015-10-31 23:03:05 -070077 native_coverage: false,
Jiyong Park5603c6e2018-04-27 21:53:11 +090078 recovery_available: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080079
Yi Kong165b1cf2019-02-13 14:10:10 -080080 arch: {
81 x86: {
82 no_libcrt: true,
83 },
84 x86_64: {
85 no_libcrt: true,
86 },
87 },
Yi Konge3d90de2019-02-20 14:28:56 -080088 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
89 // warning since this is intended right now.
90 ldflags: ["-Wl,-z,muldefs"],
Dan Willemsen208ae172015-09-16 16:33:27 -070091}
92
Dan Willemsen208ae172015-09-16 16:33:27 -070093// ========================================================
94// libc_stack_protector.a - stack protector code
95// ========================================================
96//
Colin Crossa3f9fca2016-01-11 13:20:55 -080097// Code that implements the stack protector (or that runs
98// before TLS has been set up) needs to be compiled with
99// -fno-stack-protector, since it accesses the stack canary
100// TLS slot.
Dan Willemsen208ae172015-09-16 16:33:27 -0700101
102cc_library_static {
103
Colin Crossa3f9fca2016-01-11 13:20:55 -0800104 srcs: [
105 "bionic/__libc_init_main_thread.cpp",
106 "bionic/__stack_chk_fail.cpp",
107 ],
108 arch: {
109 arm64: {
110 srcs: ["arch-arm64/bionic/__set_tls.c"],
111 },
112 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700113 srcs: [
114 "arch-x86/bionic/__libc_init_sysinfo.cpp",
115 "arch-x86/bionic/__set_tls.cpp",
116 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800117 },
118 x86_64: {
119 srcs: ["arch-x86_64/bionic/__set_tls.c"],
120 },
121 },
122
Colin Cross50c21ab2015-10-31 23:03:05 -0700123 defaults: ["libc_defaults"],
124 cflags: ["-fno-stack-protector"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700125 name: "libc_stack_protector",
Dan Willemsen208ae172015-09-16 16:33:27 -0700126}
127
Colin Crossa3f9fca2016-01-11 13:20:55 -0800128// libc_init_static.cpp also needs to be built without stack protector,
129// because it's responsible for setting up TLS for static executables.
130// This isn't the case for dynamic executables because the dynamic linker
131// has already set up the main thread's TLS.
132
133cc_library_static {
134 name: "libc_init_static",
135 defaults: ["libc_defaults"],
136 srcs: ["bionic/libc_init_static.cpp"],
137 cflags: ["-fno-stack-protector"],
138}
139
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700140cc_library_static {
141 name: "libc_init_dynamic",
142 defaults: ["libc_defaults"],
143 srcs: ["bionic/libc_init_dynamic.cpp"],
144 cflags: ["-fno-stack-protector"],
145}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800146
Dan Willemsen208ae172015-09-16 16:33:27 -0700147// ========================================================
148// libc_tzcode.a - upstream 'tzcode' code
149// ========================================================
150
151cc_library_static {
152
Colin Cross50c21ab2015-10-31 23:03:05 -0700153 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700154 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800155 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700156 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700157 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
158 ],
159
Colin Cross50c21ab2015-10-31 23:03:05 -0700160 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700161 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700162 // Don't use ridiculous amounts of stack.
163 "-DALL_STATE",
164 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
165 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800166 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700167 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700168 // The name of the tm_gmtoff field in our struct tm.
169 "-DTM_GMTOFF=tm_gmtoff",
170 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700171 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700172 // Include `tzname`, `timezone`, and `daylight` globals.
173 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700174 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800175 // Use the empty string (instead of " ") as the timezone abbreviation
176 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700177 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700178 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
179 "-Dlint",
180 ],
181
Dan Willemsen208ae172015-09-16 16:33:27 -0700182 local_include_dirs: ["tzcode/"],
183 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700184}
185
186// ========================================================
187// libc_dns.a - modified NetBSD DNS code
188// ========================================================
189
190cc_library_static {
191
Colin Cross50c21ab2015-10-31 23:03:05 -0700192 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700193 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800194 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700195
196 "upstream-netbsd/lib/libc/isc/ev_streams.c",
197 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700198 ],
199
Colin Cross50c21ab2015-10-31 23:03:05 -0700200 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700201 "-DANDROID_CHANGES",
202 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700203 "-Wno-unused-parameter",
204 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700205 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700206 ],
207
Dan Willemsen208ae172015-09-16 16:33:27 -0700208 local_include_dirs: [
209 "dns/include",
210 "private",
211 "upstream-netbsd/lib/libc/include",
212 "upstream-netbsd/android/include",
213 ],
214
215 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700216}
217
218// ========================================================
219// libc_freebsd.a - upstream FreeBSD C library code
220// ========================================================
221//
222// These files are built with the freebsd-compat.h header file
223// automatically included.
224
225cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700226 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700227 srcs: [
228 "upstream-freebsd/lib/libc/gen/ldexp.c",
229 "upstream-freebsd/lib/libc/gen/sleep.c",
230 "upstream-freebsd/lib/libc/gen/usleep.c",
231 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700232 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
233 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
234 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
235 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700236 "upstream-freebsd/lib/libc/stdlib/qsort.c",
237 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700238 "upstream-freebsd/lib/libc/string/wcpcpy.c",
239 "upstream-freebsd/lib/libc/string/wcpncpy.c",
240 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700241 "upstream-freebsd/lib/libc/string/wcscat.c",
242 "upstream-freebsd/lib/libc/string/wcschr.c",
243 "upstream-freebsd/lib/libc/string/wcscmp.c",
244 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700245 "upstream-freebsd/lib/libc/string/wcscspn.c",
246 "upstream-freebsd/lib/libc/string/wcsdup.c",
247 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700248 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700249 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
250 "upstream-freebsd/lib/libc/string/wcsncat.c",
251 "upstream-freebsd/lib/libc/string/wcsncmp.c",
252 "upstream-freebsd/lib/libc/string/wcsncpy.c",
253 "upstream-freebsd/lib/libc/string/wcsnlen.c",
254 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700255 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700256 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700257 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700258 "upstream-freebsd/lib/libc/string/wcstok.c",
259 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700260 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700261 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700262 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800263 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700264 ],
265 arch: {
266 arm64: {
267 exclude_srcs: [
268 "upstream-freebsd/lib/libc/string/wmemmove.c",
269 ],
270 },
271 x86: {
272 exclude_srcs: [
273 "upstream-freebsd/lib/libc/string/wcschr.c",
274 "upstream-freebsd/lib/libc/string/wcscmp.c",
275 "upstream-freebsd/lib/libc/string/wcslen.c",
276 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700277 "upstream-freebsd/lib/libc/string/wmemcmp.c",
278 "upstream-freebsd/lib/libc/string/wcscat.c",
279 "upstream-freebsd/lib/libc/string/wcscpy.c",
280 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700281 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700282 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700283 },
284
Colin Cross50c21ab2015-10-31 23:03:05 -0700285 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700286 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700287 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700288 "-include freebsd-compat.h",
289 ],
290
Dan Willemsen208ae172015-09-16 16:33:27 -0700291 local_include_dirs: [
292 "upstream-freebsd/android/include",
293 ],
294
295 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700296}
297
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700298cc_library_static {
299 defaults: ["libc_defaults"],
300 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700301 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700302 "upstream-freebsd/lib/libc/stdlib/realpath.c",
303 ],
304
305 cflags: [
306 "-Wno-sign-compare",
307 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700308 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700309 ],
310
311 local_include_dirs: [
312 "upstream-freebsd/android/include",
313 ],
314
315 name: "libc_freebsd_large_stack",
316}
317
Dan Willemsen208ae172015-09-16 16:33:27 -0700318// ========================================================
319// libc_netbsd.a - upstream NetBSD C library code
320// ========================================================
321//
322// These files are built with the netbsd-compat.h header file
323// automatically included.
324
325cc_library_static {
326
Colin Cross50c21ab2015-10-31 23:03:05 -0700327 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700328 srcs: [
329 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700330 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700331 "upstream-netbsd/lib/libc/gen/psignal.c",
332 "upstream-netbsd/lib/libc/gen/utime.c",
333 "upstream-netbsd/lib/libc/gen/utmp.c",
334 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
335 "upstream-netbsd/lib/libc/regex/regcomp.c",
336 "upstream-netbsd/lib/libc/regex/regerror.c",
337 "upstream-netbsd/lib/libc/regex/regexec.c",
338 "upstream-netbsd/lib/libc/regex/regfree.c",
339 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700340 "upstream-netbsd/lib/libc/stdlib/drand48.c",
341 "upstream-netbsd/lib/libc/stdlib/erand48.c",
342 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
343 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700344 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
345 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
346 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
347 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
348 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
349 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
350 "upstream-netbsd/lib/libc/stdlib/seed48.c",
351 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700352 ],
353 multilib: {
354 lib32: {
355 // LP32 cruft
356 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
357 },
358 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700359 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700360 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800361 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700362 "-DPOSIX_MISTAKE",
363 "-include netbsd-compat.h",
364 ],
365
Dan Willemsen208ae172015-09-16 16:33:27 -0700366 local_include_dirs: [
367 "upstream-netbsd/android/include",
368 "upstream-netbsd/lib/libc/include",
369 ],
370
371 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700372}
373
374// ========================================================
375// libc_openbsd_ndk.a - upstream OpenBSD C library code
376// that can be safely included in the libc_ndk.a (doesn't
377// contain any troublesome global data or constructors).
378// ========================================================
379//
380// These files are built with the openbsd-compat.h header file
381// automatically included.
382
383cc_library_static {
384 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700385 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700386 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700387 "upstream-openbsd/lib/libc/gen/alarm.c",
388 "upstream-openbsd/lib/libc/gen/ctype_.c",
389 "upstream-openbsd/lib/libc/gen/daemon.c",
390 "upstream-openbsd/lib/libc/gen/err.c",
391 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700392 "upstream-openbsd/lib/libc/gen/fnmatch.c",
393 "upstream-openbsd/lib/libc/gen/ftok.c",
394 "upstream-openbsd/lib/libc/gen/getprogname.c",
395 "upstream-openbsd/lib/libc/gen/isctype.c",
396 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700397 "upstream-openbsd/lib/libc/gen/tolower_.c",
398 "upstream-openbsd/lib/libc/gen/toupper_.c",
399 "upstream-openbsd/lib/libc/gen/verr.c",
400 "upstream-openbsd/lib/libc/gen/verrx.c",
401 "upstream-openbsd/lib/libc/gen/vwarn.c",
402 "upstream-openbsd/lib/libc/gen/vwarnx.c",
403 "upstream-openbsd/lib/libc/gen/warn.c",
404 "upstream-openbsd/lib/libc/gen/warnx.c",
405 "upstream-openbsd/lib/libc/locale/btowc.c",
406 "upstream-openbsd/lib/libc/locale/mbrlen.c",
407 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
408 "upstream-openbsd/lib/libc/locale/mbtowc.c",
409 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700410 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
411 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700412 "upstream-openbsd/lib/libc/locale/wcstoll.c",
413 "upstream-openbsd/lib/libc/locale/wcstombs.c",
414 "upstream-openbsd/lib/libc/locale/wcstoul.c",
415 "upstream-openbsd/lib/libc/locale/wcstoull.c",
416 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
417 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
418 "upstream-openbsd/lib/libc/locale/wctob.c",
419 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700420 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700421 "upstream-openbsd/lib/libc/net/htonl.c",
422 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700423 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
424 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
425 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700426 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
427 "upstream-openbsd/lib/libc/net/inet_ntop.c",
428 "upstream-openbsd/lib/libc/net/inet_pton.c",
429 "upstream-openbsd/lib/libc/net/ntohl.c",
430 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800431 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700432 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700433 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
434 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700435 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700436 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700437 "upstream-openbsd/lib/libc/stdio/fputwc.c",
438 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700439 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700440 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700441 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700442 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700443 "upstream-openbsd/lib/libc/stdio/makebuf.c",
444 "upstream-openbsd/lib/libc/stdio/mktemp.c",
445 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
446 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700447 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700448 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700449 "upstream-openbsd/lib/libc/stdio/tempnam.c",
450 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
451 "upstream-openbsd/lib/libc/stdio/ungetc.c",
452 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
453 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
454 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700455 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
456 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
457 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700458 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700459 "upstream-openbsd/lib/libc/stdio/wsetup.c",
460 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800461 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700462 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700463 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700464 "upstream-openbsd/lib/libc/stdlib/insque.c",
465 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
466 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
467 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800468 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700469 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800470 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700471 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700472 "upstream-openbsd/lib/libc/stdlib/remque.c",
473 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700474 "upstream-openbsd/lib/libc/stdlib/tfind.c",
475 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800476 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700477 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800478 "upstream-openbsd/lib/libc/string/strcasestr.c",
479 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700480 "upstream-openbsd/lib/libc/string/strcspn.c",
481 "upstream-openbsd/lib/libc/string/strdup.c",
482 "upstream-openbsd/lib/libc/string/strndup.c",
483 "upstream-openbsd/lib/libc/string/strpbrk.c",
484 "upstream-openbsd/lib/libc/string/strsep.c",
485 "upstream-openbsd/lib/libc/string/strspn.c",
486 "upstream-openbsd/lib/libc/string/strstr.c",
487 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800488 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700489 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700490 "upstream-openbsd/lib/libc/string/wcswidth.c",
491 ],
492
Colin Cross50c21ab2015-10-31 23:03:05 -0700493 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700494 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700495 "-Wno-unused-parameter",
496 "-include openbsd-compat.h",
497 ],
498
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 local_include_dirs: [
500 "private",
501 "stdio",
502 "upstream-openbsd/android/include",
503 "upstream-openbsd/lib/libc/include",
504 "upstream-openbsd/lib/libc/gdtoa/",
505 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700506}
507
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700508cc_library_static {
509 name: "libc_openbsd_large_stack",
510 defaults: ["libc_defaults"],
511 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700512 "stdio/vfprintf.cpp",
513 "stdio/vfwprintf.cpp",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700514 ],
515 cflags: [
516 "-include openbsd-compat.h",
517 "-Wno-sign-compare",
518 "-Wframe-larger-than=5000",
519 ],
520
521 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700522 "upstream-openbsd/android/include/",
523 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700524 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700525 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700526 ],
527}
528
Dan Willemsen208ae172015-09-16 16:33:27 -0700529// ========================================================
530// libc_openbsd.a - upstream OpenBSD C library code
531// ========================================================
532//
533// These files are built with the openbsd-compat.h header file
534// automatically included.
535cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700536 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700537 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800538 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700539 "upstream-openbsd/lib/libc/crypt/arc4random.c",
540 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
541
542 // May be overriden by per-arch optimized versions
543 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700544 "upstream-openbsd/lib/libc/string/memrchr.c",
545 "upstream-openbsd/lib/libc/string/stpcpy.c",
546 "upstream-openbsd/lib/libc/string/stpncpy.c",
547 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700548 "upstream-openbsd/lib/libc/string/strcpy.c",
549 "upstream-openbsd/lib/libc/string/strlcat.c",
550 "upstream-openbsd/lib/libc/string/strlcpy.c",
551 "upstream-openbsd/lib/libc/string/strncat.c",
552 "upstream-openbsd/lib/libc/string/strncmp.c",
553 "upstream-openbsd/lib/libc/string/strncpy.c",
554 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700555
556 arch: {
557 arm: {
558 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700559 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800560 "upstream-openbsd/lib/libc/string/stpcpy.c",
561 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700562 ],
563 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700564 arm64: {
565 exclude_srcs: [
566 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700567 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700568 "upstream-openbsd/lib/libc/string/strcpy.c",
569 "upstream-openbsd/lib/libc/string/strncmp.c",
570 ],
571 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530572 mips: {
573 exclude_srcs: [
574 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530575 "upstream-openbsd/lib/libc/string/strcpy.c",
576 "upstream-openbsd/lib/libc/string/strncmp.c",
577 ],
578 },
579 mips64: {
580 exclude_srcs: [
581 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530582 "upstream-openbsd/lib/libc/string/strcpy.c",
583 "upstream-openbsd/lib/libc/string/strncmp.c",
584 ],
585 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700586 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800587 exclude_srcs: [
588 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800589 "upstream-openbsd/lib/libc/string/memrchr.c",
590 "upstream-openbsd/lib/libc/string/stpcpy.c",
591 "upstream-openbsd/lib/libc/string/stpncpy.c",
592 "upstream-openbsd/lib/libc/string/strcat.c",
593 "upstream-openbsd/lib/libc/string/strcpy.c",
594 "upstream-openbsd/lib/libc/string/strncmp.c",
595 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700596 "upstream-openbsd/lib/libc/string/strlcat.c",
597 "upstream-openbsd/lib/libc/string/strlcpy.c",
598 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800599 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700600 },
601
602 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800603 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800604 "upstream-openbsd/lib/libc/string/stpcpy.c",
605 "upstream-openbsd/lib/libc/string/stpncpy.c",
606 "upstream-openbsd/lib/libc/string/strcat.c",
607 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800608 "upstream-openbsd/lib/libc/string/strncat.c",
609 "upstream-openbsd/lib/libc/string/strncmp.c",
610 "upstream-openbsd/lib/libc/string/strncpy.c",
611 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700612 },
613 },
614
Colin Cross50c21ab2015-10-31 23:03:05 -0700615 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700616 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700617 "-Wno-unused-parameter",
618 "-include openbsd-compat.h",
619 ],
620
Dan Willemsen208ae172015-09-16 16:33:27 -0700621 local_include_dirs: [
622 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700623 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700624 ],
625
626 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700627}
628
629// ========================================================
630// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
631// ========================================================
632//
633// These files are built with the openbsd-compat.h header file
634// automatically included.
635
636cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700637 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700638 srcs: [
639 "upstream-openbsd/android/gdtoa_support.cpp",
640 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
641 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
642 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
643 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
644 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
645 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
646 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
647 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
648 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
649 "upstream-openbsd/lib/libc/gdtoa/misc.c",
650 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
651 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
652 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
653 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
654 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
655 "upstream-openbsd/lib/libc/gdtoa/sum.c",
656 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
657 ],
658 multilib: {
659 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800660 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700661 },
662 },
663
Colin Cross50c21ab2015-10-31 23:03:05 -0700664 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700665 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700666 "-include openbsd-compat.h",
667 ],
668
Dan Willemsen208ae172015-09-16 16:33:27 -0700669 local_include_dirs: [
670 "private",
671 "upstream-openbsd/android/include",
672 "upstream-openbsd/lib/libc/include",
673 ],
674
675 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700676}
677
678// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700679// libc_fortify.a - container for our FORITFY
680// implementation details
681// ========================================================
682cc_library_static {
683 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700684 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700685
686 name: "libc_fortify",
687
688 // Disable FORTIFY for the compilation of these, so we don't end up having
689 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800690 cflags: [
691 "-U_FORTIFY_SOURCE",
692 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
693 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700694
695 arch: {
696 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800697 cflags: [
698 "-DNO___MEMCPY_CHK",
699 "-DRENAME___STRCAT_CHK",
700 "-DRENAME___STRCPY_CHK",
701 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700702 srcs: [
703 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800704
705 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
706 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
707
708 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
709 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
710
711 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
712 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
713
714 "arch-arm/krait/bionic/__strcat_chk.S",
715 "arch-arm/krait/bionic/__strcpy_chk.S",
716
717 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
718 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
719
Haibo Huang01bfd892018-12-03 15:05:16 -0800720 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
721 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700722 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700723 },
724 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700725 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700726 srcs: [
727 "arch-arm64/generic/bionic/__memcpy_chk.S",
728 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700729 },
730 },
731}
732
733// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700734// libc_bionic.a - home-grown C library code
735// ========================================================
736
737cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700738 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700739 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700740 // The data that backs getauxval is initialized in the libc init
741 // functions which are invoked by the linker. If this file is included
742 // in libc_ndk.a, only one of the copies of the global data will be
743 // initialized, resulting in nullptr dereferences.
744 "bionic/getauxval.cpp",
745
Elliott Hughes211c4d32018-02-02 15:10:32 -0800746 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700747 "bionic/sysconf.cpp",
748 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700749 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700750
Josh Gao10ec9282017-04-03 15:13:29 -0700751 // The following must not be statically linked into libc_ndk.a, because
752 // debuggerd will look for the abort message in libc.so's copy.
753 "bionic/android_set_abort_message.cpp",
754
Dan Willemsen208ae172015-09-16 16:33:27 -0700755 "bionic/strchr.cpp",
756 "bionic/strnlen.c",
757 "bionic/strrchr.cpp",
758 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700759
760 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700761 arm: {
762 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800763 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700764 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800765 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800766 "arch-arm/generic/bionic/stpcpy.c",
767 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800768 "arch-arm/generic/bionic/strcmp.S",
769 "arch-arm/generic/bionic/strcpy.S",
770 "arch-arm/generic/bionic/strlen.c",
771
Ryan Prichard45024fe2018-12-30 21:10:26 -0800772 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700773 "arch-arm/bionic/atomics_arm.c",
774 "arch-arm/bionic/__bionic_clone.S",
775 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800776 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700777 "arch-arm/bionic/popcount_tab.c",
778 "arch-arm/bionic/__restore.S",
779 "arch-arm/bionic/setjmp.S",
780 "arch-arm/bionic/syscall.S",
781 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800782
783 "arch-arm/cortex-a15/bionic/memcpy.S",
784 "arch-arm/cortex-a15/bionic/memmove.S",
785 "arch-arm/cortex-a15/bionic/memset.S",
786 "arch-arm/cortex-a15/bionic/stpcpy.S",
787 "arch-arm/cortex-a15/bionic/strcat.S",
788 "arch-arm/cortex-a15/bionic/strcmp.S",
789 "arch-arm/cortex-a15/bionic/strcpy.S",
790 "arch-arm/cortex-a15/bionic/strlen.S",
791
792 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800793 "arch-arm/cortex-a7/bionic/memset.S",
794
795 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800796 "arch-arm/cortex-a9/bionic/memset.S",
797 "arch-arm/cortex-a9/bionic/stpcpy.S",
798 "arch-arm/cortex-a9/bionic/strcat.S",
799 "arch-arm/cortex-a9/bionic/strcmp.S",
800 "arch-arm/cortex-a9/bionic/strcpy.S",
801 "arch-arm/cortex-a9/bionic/strlen.S",
802
803 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800804 "arch-arm/krait/bionic/memset.S",
805 "arch-arm/krait/bionic/strcmp.S",
806
807 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800808
Haibo Huang01bfd892018-12-03 15:05:16 -0800809 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800810
811 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700812 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700813 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700814 arm64: {
815 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700816 "arch-arm64/generic/bionic/memchr.S",
817 "arch-arm64/generic/bionic/memcmp.S",
818 "arch-arm64/generic/bionic/memcpy.S",
819 "arch-arm64/generic/bionic/memmove.S",
820 "arch-arm64/generic/bionic/memset.S",
821 "arch-arm64/generic/bionic/stpcpy.S",
822 "arch-arm64/generic/bionic/strchr.S",
823 "arch-arm64/generic/bionic/strcmp.S",
824 "arch-arm64/generic/bionic/strcpy.S",
825 "arch-arm64/generic/bionic/strlen.S",
826 "arch-arm64/generic/bionic/strncmp.S",
827 "arch-arm64/generic/bionic/strnlen.S",
828 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800829
830 "arch-arm64/bionic/__bionic_clone.S",
831 "arch-arm64/bionic/_exit_with_stack_teardown.S",
832 "arch-arm64/bionic/setjmp.S",
833 "arch-arm64/bionic/syscall.S",
834 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700835 ],
836 exclude_srcs: [
837 "bionic/__memcpy_chk.cpp",
838 "bionic/strchr.cpp",
839 "bionic/strnlen.c",
840 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700841 },
842
843 mips: {
844 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800845 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530846 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800847 "arch-mips/string/memset.S",
848 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530849 "arch-mips/string/strncmp.S",
850 "arch-mips/string/strlen.c",
851 "arch-mips/string/strnlen.c",
852 "arch-mips/string/strchr.c",
853 "arch-mips/string/strcpy.c",
854 "arch-mips/string/memchr.c",
855 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800856
Dan Willemsen208ae172015-09-16 16:33:27 -0700857 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700858 "arch-mips/bionic/cacheflush.cpp",
859 "arch-mips/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800860 "arch-mips/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700861 "arch-mips/bionic/setjmp.S",
862 "arch-mips/bionic/syscall.S",
863 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700864 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530865 exclude_srcs: [
866 "bionic/strchr.cpp",
867 "bionic/strnlen.c",
868 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700869 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700870 mips64: {
871 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800872 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530873 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800874 "arch-mips/string/memset.S",
875 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530876 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800877 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530878 "arch-mips/string/strnlen.c",
879 "arch-mips/string/strchr.c",
880 "arch-mips/string/strcpy.c",
881 "arch-mips/string/memchr.c",
882 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800883
Dan Willemsen208ae172015-09-16 16:33:27 -0700884 "arch-mips64/bionic/__bionic_clone.S",
885 "arch-mips64/bionic/_exit_with_stack_teardown.S",
886 "arch-mips64/bionic/setjmp.S",
887 "arch-mips64/bionic/syscall.S",
888 "arch-mips64/bionic/vfork.S",
889 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700890 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530891 exclude_srcs: [
892 "bionic/strchr.cpp",
893 "bionic/strnlen.c",
894 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700895 },
896
897 x86: {
898 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700899 "arch-x86/generic/string/memcmp.S",
900 "arch-x86/generic/string/strcmp.S",
901 "arch-x86/generic/string/strncmp.S",
902 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700903
904 "arch-x86/generic/string/strlcat.c",
905 "arch-x86/generic/string/strlcpy.c",
906 "arch-x86/generic/string/strncat.c",
907 "arch-x86/generic/string/wcscat.c",
908 "arch-x86/generic/string/wcscpy.c",
909 "arch-x86/generic/string/wmemcmp.c",
910
Dan Willemsen208ae172015-09-16 16:33:27 -0700911 "arch-x86/atom/string/sse2-memchr-atom.S",
912 "arch-x86/atom/string/sse2-memrchr-atom.S",
913 "arch-x86/atom/string/sse2-strchr-atom.S",
914 "arch-x86/atom/string/sse2-strnlen-atom.S",
915 "arch-x86/atom/string/sse2-strrchr-atom.S",
916 "arch-x86/atom/string/sse2-wcschr-atom.S",
917 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
918 "arch-x86/atom/string/sse2-wcslen-atom.S",
919 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700920 "arch-x86/silvermont/string/sse2-memmove-slm.S",
921 "arch-x86/silvermont/string/sse2-memset-slm.S",
922 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
923 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
924 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
925 "arch-x86/silvermont/string/sse2-strlen-slm.S",
926 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800927
928 "arch-x86/bionic/__bionic_clone.S",
929 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800930 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800931 "arch-x86/bionic/__restore.S",
932 "arch-x86/bionic/setjmp.S",
933 "arch-x86/bionic/syscall.S",
934 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700935
936 // ssse3 functions
937 "arch-x86/atom/string/ssse3-strcat-atom.S",
938 "arch-x86/atom/string/ssse3-strcmp-atom.S",
939 "arch-x86/atom/string/ssse3-strlcat-atom.S",
940 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
941 "arch-x86/atom/string/ssse3-strncat-atom.S",
942 "arch-x86/atom/string/ssse3-strncmp-atom.S",
943 "arch-x86/atom/string/ssse3-wcscat-atom.S",
944 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
945
946 // sse4 functions
947 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
948 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
949
950 // atom functions
951 "arch-x86/atom/string/sse2-memset-atom.S",
952 "arch-x86/atom/string/sse2-strlen-atom.S",
953 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800954 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700955 "arch-x86/atom/string/ssse3-strcpy-atom.S",
956 "arch-x86/atom/string/ssse3-strncpy-atom.S",
957 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700958 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700959
960 exclude_srcs: [
961 "bionic/strchr.cpp",
962 "bionic/strnlen.c",
963 "bionic/strrchr.cpp",
964 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700965 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700966 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700967 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700968 "arch-x86_64/string/sse2-memmove-slm.S",
969 "arch-x86_64/string/sse2-memset-slm.S",
970 "arch-x86_64/string/sse2-stpcpy-slm.S",
971 "arch-x86_64/string/sse2-stpncpy-slm.S",
972 "arch-x86_64/string/sse2-strcat-slm.S",
973 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700974 "arch-x86_64/string/sse2-strlen-slm.S",
975 "arch-x86_64/string/sse2-strncat-slm.S",
976 "arch-x86_64/string/sse2-strncpy-slm.S",
977 "arch-x86_64/string/sse4-memcmp-slm.S",
978 "arch-x86_64/string/ssse3-strcmp-slm.S",
979 "arch-x86_64/string/ssse3-strncmp-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800980
981 "arch-x86_64/bionic/__bionic_clone.S",
982 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
983 "arch-x86_64/bionic/__restore_rt.S",
984 "arch-x86_64/bionic/setjmp.S",
985 "arch-x86_64/bionic/syscall.S",
986 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700987 ],
988 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700989 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700990
Colin Cross50c21ab2015-10-31 23:03:05 -0700991 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700992 include_dirs: ["bionic/libstdc++/include"],
993 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700994}
995
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000996genrule {
997 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -0800998 out: ["generated_android_ids.h"],
999 srcs: [":android_filesystem_config_header"],
1000 tool_files: ["fs_config_generator.py"],
1001 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001002}
1003
Dan Willemsen268a6732015-10-15 14:49:45 -07001004// ========================================================
1005// libc_bionic_ndk.a- The portions of libc_bionic that can
1006// be safely used in libc_ndk.a (no troublesome global data
1007// or constructors).
1008// ========================================================
1009cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001010 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001011 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001012 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001013 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001014 "bionic/__cmsg_nxthdr.cpp",
1015 "bionic/__errno.cpp",
1016 "bionic/__gnu_basename.cpp",
1017 "bionic/__libc_current_sigrtmax.cpp",
1018 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001019 "bionic/abort.cpp",
1020 "bionic/accept.cpp",
1021 "bionic/accept4.cpp",
1022 "bionic/access.cpp",
1023 "bionic/arpa_inet.cpp",
1024 "bionic/assert.cpp",
1025 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001026 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001027 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001028 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001029 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001030 "bionic/bionic_systrace.cpp",
1031 "bionic/bionic_time_conversions.cpp",
1032 "bionic/brk.cpp",
1033 "bionic/c16rtomb.cpp",
1034 "bionic/c32rtomb.cpp",
1035 "bionic/chmod.cpp",
1036 "bionic/chown.cpp",
1037 "bionic/clearenv.cpp",
1038 "bionic/clock.cpp",
1039 "bionic/clock_getcpuclockid.cpp",
1040 "bionic/clock_nanosleep.cpp",
1041 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001042 "bionic/connect.cpp",
1043 "bionic/ctype.cpp",
1044 "bionic/dirent.cpp",
1045 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001046 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001047 "bionic/error.cpp",
1048 "bionic/eventfd_read.cpp",
1049 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001050 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001051 "bionic/faccessat.cpp",
1052 "bionic/fchmod.cpp",
1053 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001054 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001055 "bionic/ffs.cpp",
1056 "bionic/fgetxattr.cpp",
1057 "bionic/flistxattr.cpp",
1058 "bionic/flockfile.cpp",
1059 "bionic/fpclassify.cpp",
1060 "bionic/fsetxattr.cpp",
1061 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001062 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001063 "bionic/futimens.cpp",
1064 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001065 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001066 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001067 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001068 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001069 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001070 "bionic/getpgrp.cpp",
1071 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001072 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001073 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001074 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001075 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001076 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001077 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001078 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001079 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001080 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001081 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001082 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001083 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001084 "bionic/lchown.cpp",
1085 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001086 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001087 "bionic/libgen.cpp",
1088 "bionic/link.cpp",
1089 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001090 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001091 "bionic/lstat.cpp",
1092 "bionic/malloc_info.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001093 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001094 "bionic/mbrtoc16.cpp",
1095 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001096 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001097 "bionic/mempcpy.cpp",
1098 "bionic/mkdir.cpp",
1099 "bionic/mkfifo.cpp",
1100 "bionic/mknod.cpp",
1101 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001102 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001103 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001104 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001105 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001106 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001107 "bionic/open.cpp",
1108 "bionic/pathconf.cpp",
1109 "bionic/pause.cpp",
1110 "bionic/pipe.cpp",
1111 "bionic/poll.cpp",
1112 "bionic/posix_fadvise.cpp",
1113 "bionic/posix_fallocate.cpp",
1114 "bionic/posix_madvise.cpp",
1115 "bionic/posix_timers.cpp",
1116 "bionic/ptrace.cpp",
1117 "bionic/pty.cpp",
1118 "bionic/raise.cpp",
1119 "bionic/rand.cpp",
1120 "bionic/readlink.cpp",
1121 "bionic/reboot.cpp",
1122 "bionic/recv.cpp",
1123 "bionic/rename.cpp",
1124 "bionic/rmdir.cpp",
1125 "bionic/scandir.cpp",
1126 "bionic/sched_getaffinity.cpp",
1127 "bionic/sched_getcpu.cpp",
1128 "bionic/semaphore.cpp",
1129 "bionic/send.cpp",
1130 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001131 "bionic/seteuid.cpp",
1132 "bionic/setpgrp.cpp",
1133 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001134 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001135 "bionic/sigprocmask.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001136 "bionic/socket.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001137 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001138 "bionic/stat.cpp",
1139 "bionic/statvfs.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001140 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001141 "bionic/strchrnul.cpp",
1142 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001143 "bionic/string_l.cpp",
1144 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001145 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001146 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001147 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001148 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001149 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001150 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001151 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001152 "bionic/sys_msg.cpp",
1153 "bionic/sys_sem.cpp",
1154 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001155 "bionic/sys_signalfd.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001156 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001157 "bionic/sysinfo.cpp",
1158 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001159 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001160 "bionic/system_property_api.cpp",
1161 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001162 "bionic/tdestroy.cpp",
1163 "bionic/termios.cpp",
1164 "bionic/thread_private.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001165 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001166 "bionic/tmpfile.cpp",
1167 "bionic/umount.cpp",
1168 "bionic/unlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001169 "bionic/wait.cpp",
1170 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001171 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001172 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001173 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001174 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001175 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001176
1177 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1178 // which will be overridden by the actual one in libc.so.
1179 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001180 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001181
Dan Willemsen208ae172015-09-16 16:33:27 -07001182 multilib: {
1183 lib32: {
1184 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001185 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001186 },
1187 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001188 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001189 treble_linker_namespaces: {
1190 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001191 },
1192 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001193 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001194 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001195 local_include_dirs: ["stdio"],
1196 include_dirs: ["bionic/libstdc++/include"],
1197 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001198 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001199}
1200
Dan Willemsen208ae172015-09-16 16:33:27 -07001201// ========================================================
1202// libc_pthread.a - pthreads parts that previously lived in
1203// libc_bionic.a. Relocated to their own library because
1204// they can't be included in libc_ndk.a (as they layout of
1205// pthread_t has changed over the years and has ABI
1206// compatibility issues).
1207// ========================================================
1208
1209cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001210 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001211 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001212 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001213 "bionic/pthread_atfork.cpp",
1214 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001215 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001216 "bionic/pthread_cond.cpp",
1217 "bionic/pthread_create.cpp",
1218 "bionic/pthread_detach.cpp",
1219 "bionic/pthread_equal.cpp",
1220 "bionic/pthread_exit.cpp",
1221 "bionic/pthread_getcpuclockid.cpp",
1222 "bionic/pthread_getschedparam.cpp",
1223 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001224 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001225 "bionic/pthread_join.cpp",
1226 "bionic/pthread_key.cpp",
1227 "bionic/pthread_kill.cpp",
1228 "bionic/pthread_mutex.cpp",
1229 "bionic/pthread_once.cpp",
1230 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001231 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001232 "bionic/pthread_self.cpp",
1233 "bionic/pthread_setname_np.cpp",
1234 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001235 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001236
1237 // The following implementations depend on pthread data or implementation,
1238 // so we can't include them in libc_ndk.a.
1239 "bionic/__cxa_thread_atexit_impl.cpp",
1240 "stdlib/atexit.c",
1241 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001242 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001243
Colin Cross50c21ab2015-10-31 23:03:05 -07001244 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001245 include_dirs: ["bionic/libstdc++/include"],
1246 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001247}
1248
1249// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001250// libc_syscalls.a
1251// ========================================================
1252
1253cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001254 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001255 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001256 arch: {
1257 arm: {
1258 srcs: ["arch-arm/syscalls/**/*.S"],
1259 },
1260 arm64: {
1261 srcs: ["arch-arm64/syscalls/**/*.S"],
1262 },
1263 mips: {
1264 srcs: ["arch-mips/syscalls/**/*.S"],
1265 },
1266 mips64: {
1267 srcs: ["arch-mips64/syscalls/**/*.S"],
1268 },
1269 x86: {
1270 srcs: ["arch-x86/syscalls/**/*.S"],
1271 },
1272 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001273 srcs: ["arch-x86_64/syscalls/**/*.S"],
1274 },
1275 },
1276 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001277}
1278
1279// ========================================================
1280// libc_aeabi.a
1281// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1282// to avoid infinite recursion. For the other architectures we just build an
1283// empty library to keep this makefile simple.
1284// ========================================================
1285
1286cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001287 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001288 arch: {
1289 arm: {
1290 srcs: ["arch-arm/bionic/__aeabi.c"],
1291 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001292 },
1293 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001294 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001295}
1296
1297// ========================================================
1298// libc_ndk.a
1299// Compatibility library for the NDK. This library contains
1300// all the parts of libc that are safe to statically link.
1301// We can't safely statically link things that can only run
1302// on a certain version of the OS. Examples include
1303// anything that talks to netd (a large portion of the DNS
1304// code) and anything that is dependent on the layout of a
1305// data structure that has changed across releases (such as
1306// pthread_t).
1307// ========================================================
1308
1309cc_library_static {
1310 name: "libc_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001311 defaults: ["libc_defaults"],
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001312 srcs: libc_common_src_files + [
1313 "bionic/malloc_common.cpp",
1314 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001315 multilib: {
1316 lib32: {
1317 srcs: libc_common_src_files_32,
1318 },
1319 },
1320 arch: {
1321 arm: {
1322 srcs: [
1323 "arch-arm/bionic/exidx_dynamic.c",
1324 "arch-common/bionic/crtbegin_so.c",
1325 "arch-arm/bionic/atexit_legacy.c",
1326 "arch-common/bionic/crtend_so.S",
1327 ],
1328 whole_static_libs: ["libc_aeabi"],
1329 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001330 },
1331
Colin Cross50c21ab2015-10-31 23:03:05 -07001332 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001333 "-fvisibility=hidden",
1334 "-DLIBC_STATIC",
1335 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001336
1337 whole_static_libs: [
1338 "libc_bionic_ndk",
George Burgess IV6cb06872017-07-21 13:28:42 -07001339 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001340 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001341 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001342 "libc_gdtoa",
1343 "libc_malloc",
1344 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001345 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001346 "libc_openbsd_ndk",
1347 "libc_stack_protector",
1348 "libc_syscalls",
1349 "libc_tzcode",
1350 "libm",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001351 "libjemalloc5",
Elliott Hughes816fab92016-05-27 17:57:46 -07001352 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001353 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001354}
1355
1356// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001357// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001358// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001359cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001360 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001361 srcs: libc_common_src_files,
1362 multilib: {
1363 lib32: {
1364 srcs: libc_common_src_files_32,
1365 },
1366 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001367 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001368
1369 whole_static_libs: [
1370 "libc_bionic",
1371 "libc_bionic_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001372 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001373 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001374 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001375 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001376 "libc_gdtoa",
1377 "libc_malloc",
1378 "libc_netbsd",
1379 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001380 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001381 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001382 "libc_stack_protector",
1383 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001384 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001385 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001386 ],
1387
1388 arch: {
1389 arm: {
1390 whole_static_libs: ["libc_aeabi"],
1391 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001392 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001393}
1394
1395// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001396// libc_common.a
1397// ========================================================
1398
1399cc_library_static {
1400 defaults: ["libc_defaults"],
1401 name: "libc_common",
1402
1403 whole_static_libs: [
1404 "libc_nopthread",
1405 "libc_pthread",
1406 ],
1407}
1408
1409// ========================================================
Haibo Huangf71edfa2018-11-12 10:06:56 -08001410// libc_common_static.a For static binaries.
1411// ========================================================
1412cc_library_static {
1413 defaults: ["libc_defaults"],
1414 name: "libc_common_static",
1415
Haibo Huangb9244ff2018-08-11 10:12:13 -07001416 arch: {
1417 x86: {
1418 srcs: ["arch-x86/static_function_dispatch.S"],
1419 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001420 arm: {
1421 srcs: ["arch-arm/static_function_dispatch.S"],
1422 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001423 },
1424
Haibo Huangf71edfa2018-11-12 10:06:56 -08001425 whole_static_libs: [
1426 "libc_common",
1427 ],
1428}
1429
1430// ========================================================
1431// libc_common_shared.a For shared libraries.
1432// ========================================================
1433cc_library_static {
1434 defaults: ["libc_defaults"],
1435 name: "libc_common_shared",
1436
Haibo Huangb9244ff2018-08-11 10:12:13 -07001437 cflags: [
1438 "-fno-stack-protector",
1439 "-fno-jump-tables",
1440 ],
1441 arch: {
1442 x86: {
1443 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1444 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001445 arm: {
Haibo Huange4788d42018-12-11 20:28:02 -08001446 srcs: [
1447 "arch-arm/dynamic_function_dispatch.cpp",
1448
1449 // Workaround for b/120254692.
1450 "arch-arm/dynamic_function_wrapper.S",
1451 ],
Haibo Huangea9957a2018-11-19 11:00:32 -08001452 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001453 },
1454
Haibo Huangf71edfa2018-11-12 10:06:56 -08001455 whole_static_libs: [
1456 "libc_common",
1457 ],
1458}
1459
1460// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001461// libc_nomalloc.a
1462// ========================================================
1463//
1464// This is a version of the static C library that does not
1465// include malloc. It's useful in situations when the user wants
1466// to provide their own malloc implementation, or wants to
1467// explicitly disallow the use of malloc, such as in the
1468// dynamic linker.
1469
1470cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001471 name: "libc_nomalloc",
1472
Colin Cross50c21ab2015-10-31 23:03:05 -07001473 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001474
1475 arch: {
1476 arm: {
1477 srcs: ["arch-arm/bionic/exidx_static.c"],
1478 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001479 },
1480
Colin Cross50c21ab2015-10-31 23:03:05 -07001481 cflags: ["-DLIBC_STATIC"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001482
Colin Crossa3f9fca2016-01-11 13:20:55 -08001483 whole_static_libs: [
Haibo Huangf71edfa2018-11-12 10:06:56 -08001484 "libc_common_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001485 "libc_init_static",
1486 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001487}
1488
1489// ========================================================
1490// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1491// ========================================================
1492cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001493 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001494 srcs: ["bionic/jemalloc_wrapper.cpp"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001495 cflags: ["-fvisibility=hidden"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001496
Dan Willemsen208ae172015-09-16 16:33:27 -07001497 name: "libc_malloc",
Dan Willemsen208ae172015-09-16 16:33:27 -07001498}
1499
dimitryc0c0ef62018-12-05 16:33:52 +01001500filegroup {
1501 name: "libc_sources_shared",
1502 srcs: [
1503 "arch-common/bionic/crtbegin_so.c",
1504 "arch-common/bionic/crtbrand.S",
1505 "bionic/icu.cpp",
1506 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001507 "bionic/malloc_common_dynamic.cpp",
1508 "bionic/malloc_heapprofd.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001509 "bionic/NetdClient.cpp",
1510 "arch-common/bionic/crtend_so.S",
1511 ],
1512}
1513
1514filegroup {
1515 name: "libc_sources_static",
1516 srcs: [
1517 "bionic/dl_iterate_phdr_static.cpp",
1518 "bionic/malloc_common.cpp",
1519 ],
1520}
1521
1522filegroup {
1523 name: "libc_sources_shared_arm",
1524 srcs: [
1525 "arch-arm/bionic/exidx_dynamic.c",
1526 "arch-arm/bionic/atexit_legacy.c",
1527 ],
1528}
1529
1530filegroup {
1531 name: "libc_sources_static_arm",
1532 srcs: [ "arch-arm/bionic/exidx_static.c" ],
1533}
1534
Dan Willemsen208ae172015-09-16 16:33:27 -07001535// ========================================================
1536// libc.a + libc.so
1537// ========================================================
1538cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001539 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001540 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001541 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001542 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001543 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001544 platform_sdk_version: {
1545 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1546 },
1547 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001548 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001549 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001550 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001551 whole_static_libs: [
1552 "libc_init_static",
1553 "libc_common_static",
1554 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001555 },
1556 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001557 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001558 whole_static_libs: [
1559 "libc_init_dynamic",
1560 "libc_common_shared",
1561 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001562 },
1563
Jiyong Parka5f914a2019-01-20 21:02:00 +09001564 required: ["tzdata", "libc.mountpoint"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001565
1566 // Leave the symbols in the shared library so that stack unwinders can produce
1567 // meaningful name resolution.
Colin Cross37f36322016-04-25 14:09:13 -07001568 strip: {
1569 keep_symbols: true,
1570 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001571
Colin Cross4ce94d22016-11-15 13:15:43 -08001572 // Do not pack libc.so relocations; see http://b/20645321 for details.
1573 pack_relocations: false,
1574
dimitry06016f22018-01-05 11:39:28 +01001575 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1576 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1577 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1578 // those new libraries from libgcc.a are not declared external; if that were the case,
1579 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1580 // on the external symbols from the dependent libraries. That would create a "cloaked"
1581 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001582
dimitry06016f22018-01-05 11:39:28 +01001583 shared_libs: [
1584 "ld-android",
1585 "libdl",
1586 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001587 whole_static_libs: [
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001588 "libjemalloc5",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001589 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001590
1591 nocrt: true,
1592
Dan Willemsen208ae172015-09-16 16:33:27 -07001593 arch: {
1594 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001595 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001596 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001597 ldflags: ["-Wl,--hash-style=both"],
1598
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001599 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001600
Dan Willemsen208ae172015-09-16 16:33:27 -07001601 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001602 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001603 // special for arm
1604 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001605 },
1606 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001607 srcs: [":libc_sources_static_arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001608 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001609 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001610 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001611 version_script: ":libc.arm64.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001612 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001613 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001614 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001615 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001616 ldflags: ["-Wl,--hash-style=both"],
1617
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001618 version_script: ":libc.x86.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001619 },
1620 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001621 version_script: ":libc.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001622 },
1623 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001624
1625 stubs: {
1626 symbol_file: "libc.map.txt",
1627 versions: ["10000"],
1628 },
Vic Yang6903fb82019-01-14 11:34:39 -08001629
1630 symbol_ordering_file: "symbol_ordering",
Dan Willemsen208ae172015-09-16 16:33:27 -07001631}
1632
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001633genrule {
1634 name: "libc.arm.map",
1635 out: ["libc.arm.map"],
1636 srcs: ["libc.map.txt"],
1637 tool_files: [":bionic-generate-version-script"],
1638 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1639}
1640
1641genrule {
1642 name: "libc.arm64.map",
1643 out: ["libc.arm64.map"],
1644 srcs: ["libc.map.txt"],
1645 tool_files: [":bionic-generate-version-script"],
1646 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1647}
1648
1649genrule {
1650 name: "libc.x86.map",
1651 out: ["libc.x86.map"],
1652 srcs: ["libc.map.txt"],
1653 tool_files: [":bionic-generate-version-script"],
1654 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1655}
1656
1657genrule {
1658 name: "libc.x86_64.map",
1659 out: ["libc.x86_64.map"],
1660 srcs: ["libc.map.txt"],
1661 tool_files: [":bionic-generate-version-script"],
1662 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1663}
1664
Logan Chien17af91b2019-01-15 21:19:56 +08001665// libc_headers for libasync_safe and libpropertyinfoparser
1666cc_library_headers {
1667 name: "libc_headers",
1668
1669 host_supported: true,
1670 vendor_available: true,
1671 recovery_available: true,
1672
1673 no_libcrt: true,
1674 no_libgcc: true,
1675 stl: "none",
1676 system_shared_libs: [],
1677
1678 export_include_dirs: [
1679 "include",
1680 "kernel/uapi",
1681 "kernel/android/uapi",
1682 ],
1683
1684 arch: {
1685 arm: {
1686 export_include_dirs: [
1687 "kernel/uapi/asm-arm",
1688 ],
1689 },
1690 arm64: {
1691 export_include_dirs: [
1692 "kernel/uapi/asm-arm64",
1693 ],
1694 },
1695 mips: {
1696 export_include_dirs: [
1697 "kernel/uapi/asm-mips",
1698 ],
1699 },
1700 mips64: {
1701 export_include_dirs: [
1702 "kernel/uapi/asm-mips",
1703 ],
1704 },
1705 x86: {
1706 export_include_dirs: [
1707 "kernel/uapi/asm-x86",
1708 ],
1709 },
1710 x86_64: {
1711 export_include_dirs: [
1712 "kernel/uapi/asm-x86",
1713 ],
1714 },
1715 },
1716}
1717
Dan Willemsen208ae172015-09-16 16:33:27 -07001718// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001719// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001720// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001721
Dan Willemsen208ae172015-09-16 16:33:27 -07001722cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001723 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001724 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001725 srcs: [
1726 "bionic/__cxa_guard.cpp",
1727 "bionic/__cxa_pure_virtual.cpp",
1728 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001729 ],
1730 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001731 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001732 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001733
Dan Willemsen6b3be172018-12-03 13:57:20 -08001734 static: {
1735 system_shared_libs: [],
1736 },
1737 shared: {
1738 system_shared_libs: ["libc"],
1739 },
1740
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001741 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001742 arch: {
1743 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001744 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001745 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001746 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001747 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001748 },
1749 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001750 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001751 },
1752 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001753 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001754 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001755 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001756 },
1757 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001758 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001759 },
1760 },
1761}
1762
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001763genrule {
1764 name: "libstdc++.arm.map",
1765 out: ["libstdc++.arm.map"],
1766 srcs: ["libstdc++.map.txt"],
1767 tool_files: [":bionic-generate-version-script"],
1768 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1769}
1770
1771genrule {
1772 name: "libstdc++.arm64.map",
1773 out: ["libstdc++.arm64.map"],
1774 srcs: ["libstdc++.map.txt"],
1775 tool_files: [":bionic-generate-version-script"],
1776 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1777}
1778
1779genrule {
1780 name: "libstdc++.x86.map",
1781 out: ["libstdc++.x86.map"],
1782 srcs: ["libstdc++.map.txt"],
1783 tool_files: [":bionic-generate-version-script"],
1784 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1785}
1786
1787genrule {
1788 name: "libstdc++.x86_64.map",
1789 out: ["libstdc++.x86_64.map"],
1790 srcs: ["libstdc++.map.txt"],
1791 tool_files: [":bionic-generate-version-script"],
1792 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1793}
1794
1795// ========================================================
1796// crt object files.
1797// ========================================================
1798
Colin Cross50c21ab2015-10-31 23:03:05 -07001799cc_defaults {
1800 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001801 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001802 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001803 recovery_available: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001804
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001805 cflags: [
1806 "-Wno-gcc-compat",
1807 "-Wall",
1808 "-Werror",
1809 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001810}
1811
Colin Cross50c21ab2015-10-31 23:03:05 -07001812cc_defaults {
1813 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001814 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001815
1816 arch: {
1817 mips: {
1818 cflags: ["-fPIC"],
1819 },
1820 mips64: {
1821 cflags: ["-fPIC"],
1822 },
1823 x86: {
1824 cflags: ["-fPIC"],
1825 },
1826 x86_64: {
1827 cflags: ["-fPIC"],
1828 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001829 },
Colin Crossab179442018-09-27 11:03:22 -07001830 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001831}
1832
Dan Willemsen208ae172015-09-16 16:33:27 -07001833cc_object {
1834 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001835 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001836 local_include_dirs: ["include"],
1837 product_variables: {
1838 platform_sdk_version: {
1839 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1840 },
1841 },
1842 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001843
Colin Cross7d7b3682017-11-03 13:38:40 -07001844 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001845}
1846
Dan Willemsen208ae172015-09-16 16:33:27 -07001847cc_object {
1848 name: "crtbegin_so1",
1849 local_include_dirs: ["include"],
1850 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001851
Colin Cross7d7b3682017-11-03 13:38:40 -07001852 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001853}
1854
Dan Willemsen208ae172015-09-16 16:33:27 -07001855cc_object {
1856 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07001857
Colin Cross7d7b3682017-11-03 13:38:40 -07001858 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07001859 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001860 "crtbegin_so1",
1861 "crtbrand",
1862 ],
1863}
1864
Dan Willemsen208ae172015-09-16 16:33:27 -07001865cc_object {
1866 name: "crtend_so",
1867 local_include_dirs: ["include"],
1868 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001869
Colin Cross7d7b3682017-11-03 13:38:40 -07001870 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001871}
1872
Dan Willemsen208ae172015-09-16 16:33:27 -07001873cc_object {
1874 name: "crtbegin_static1",
1875 local_include_dirs: ["include"],
1876 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001877
Colin Cross50c21ab2015-10-31 23:03:05 -07001878 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001879 mips: {
1880 srcs: [
1881 "arch-mips/bionic/crtbegin.c",
1882 ],
1883 exclude_srcs: [
1884 "arch-common/bionic/crtbegin.c",
1885 ],
1886 },
1887 mips64: {
1888 srcs: [
1889 "arch-mips64/bionic/crtbegin.c",
1890 ],
1891 exclude_srcs: [
1892 "arch-common/bionic/crtbegin.c",
1893 ],
1894 },
1895 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001896
1897 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001898}
1899
Dan Willemsen208ae172015-09-16 16:33:27 -07001900cc_object {
1901 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07001902
Colin Cross77d57bf2016-04-11 14:34:18 -07001903 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001904 "crtbegin_static1",
1905 "crtbrand",
1906 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001907 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001908}
1909
Dan Willemsen208ae172015-09-16 16:33:27 -07001910cc_object {
1911 name: "crtbegin_dynamic1",
1912 local_include_dirs: ["include"],
1913 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001914
Colin Cross50c21ab2015-10-31 23:03:05 -07001915 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001916 mips: {
1917 srcs: [
1918 "arch-mips/bionic/crtbegin.c",
1919 ],
1920 exclude_srcs: [
1921 "arch-common/bionic/crtbegin.c",
1922 ],
1923 },
1924 mips64: {
1925 srcs: [
1926 "arch-mips64/bionic/crtbegin.c",
1927 ],
1928 exclude_srcs: [
1929 "arch-common/bionic/crtbegin.c",
1930 ],
1931 },
1932 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001933 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001934}
1935
Dan Willemsen208ae172015-09-16 16:33:27 -07001936cc_object {
1937 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07001938
Colin Cross77d57bf2016-04-11 14:34:18 -07001939 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001940 "crtbegin_dynamic1",
1941 "crtbrand",
1942 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07001943 target: {
1944 linux_bionic: {
1945 generated_sources: ["host_bionic_linker_asm"],
1946 objs: [
1947 "linker_wrapper",
1948 ],
1949 },
1950 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001951 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001952}
1953
Dan Willemsen208ae172015-09-16 16:33:27 -07001954cc_object {
1955 // We rename crtend.o to crtend_android.o to avoid a
1956 // name clash between gcc and bionic.
1957 name: "crtend_android",
1958 local_include_dirs: ["include"],
1959 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001960
Colin Cross50c21ab2015-10-31 23:03:05 -07001961 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001962}
Colin Crossbaa48992016-07-13 11:15:21 -07001963
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001964// ========================================================
1965// NDK headers.
1966// ========================================================
1967
Dan Albert26e1c412018-05-24 14:56:46 -07001968versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07001969 name: "common_libc",
1970 from: "include",
1971 to: "",
1972 license: "NOTICE",
1973}
Dan Albert4238a352016-06-28 11:18:05 -07001974
1975ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08001976 name: "libc_uapi",
1977 from: "kernel/uapi",
1978 to: "",
1979 srcs: [
1980 "kernel/uapi/asm-generic/**/*.h",
1981 "kernel/uapi/drm/**/*.h",
1982 "kernel/uapi/linux/**/*.h",
1983 "kernel/uapi/misc/**/*.h",
1984 "kernel/uapi/mtd/**/*.h",
1985 "kernel/uapi/rdma/**/*.h",
1986 "kernel/uapi/scsi/**/*.h",
1987 "kernel/uapi/sound/**/*.h",
1988 "kernel/uapi/video/**/*.h",
1989 "kernel/uapi/xen/**/*.h",
1990 ],
Dan Albert92592652016-10-20 01:42:54 -07001991 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07001992}
1993
1994ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07001995 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07001996 from: "kernel/android/uapi/linux",
1997 to: "linux",
1998 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07001999 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002000}
2001
2002ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002003 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002004 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002005 to: "scsi",
2006 srcs: ["kernel/android/scsi/**/*.h"],
2007 license: "NOTICE",
2008}
2009
2010ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002011 name: "libc_asm_arm",
2012 from: "kernel/uapi/asm-arm",
2013 to: "arm-linux-androideabi",
2014 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002015 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002016}
2017
2018ndk_headers {
2019 name: "libc_asm_arm64",
2020 from: "kernel/uapi/asm-arm64",
2021 to: "aarch64-linux-android",
2022 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002023 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002024}
2025
Elliott Hughesee291c02017-12-11 11:32:34 -08002026// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002027ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002028 name: "libc_asm_mips",
2029 from: "kernel/uapi/asm-mips",
2030 to: "mipsel-linux-android",
2031 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2032 license: "NOTICE",
2033}
2034
Elliott Hughesee291c02017-12-11 11:32:34 -08002035// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002036ndk_headers {
2037 name: "libc_asm_mips64",
2038 from: "kernel/uapi/asm-mips",
2039 to: "mips64el-linux-android",
2040 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2041 license: "NOTICE",
2042}
2043
2044ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002045 name: "libc_asm_x86",
2046 from: "kernel/uapi/asm-x86",
2047 to: "i686-linux-android",
2048 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002049 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002050}
2051
2052ndk_headers {
2053 name: "libc_asm_x86_64",
2054 from: "kernel/uapi/asm-x86",
2055 to: "x86_64-linux-android",
2056 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002057 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002058}
2059
Dan Albert4238a352016-06-28 11:18:05 -07002060ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002061 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002062 symbol_file: "libc.map.txt",
2063 first_version: "9",
2064}
2065
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002066llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002067 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002068 symbol_file: "libc.map.txt",
2069 export_headers_as_system: true,
2070 export_preprocessed_headers: ["include"],
Logan Chien17af91b2019-01-15 21:19:56 +08002071 export_include_dirs: [
2072 "kernel/android/uapi",
2073 "kernel/uapi",
2074 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002075 arch: {
2076 arm: {
2077 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002078 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002079 ],
2080 },
2081 arm64: {
2082 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002083 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002084 ],
2085 },
2086 mips: {
2087 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002088 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002089 ],
2090 },
2091 mips64: {
2092 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002093 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002094 ],
2095 },
2096 x86: {
2097 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002098 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002099 ],
2100 },
2101 x86_64: {
2102 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002103 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002104 ],
2105 },
2106 },
2107}
2108
Dan Albertdf31aff2016-10-06 15:50:41 -07002109ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002110 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002111 symbol_file: "libstdc++.map.txt",
2112 first_version: "9",
2113}
2114
Dan Willemsenca056d72018-01-08 14:00:24 -08002115// Export these headers for toolbox to process
2116filegroup {
2117 name: "kernel_input_headers",
2118 srcs: [
2119 "kernel/uapi/linux/input.h",
2120 "kernel/uapi/linux/input-event-codes.h",
2121 ],
2122}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002123
2124// Generate a syscall name / number mapping. These objects are text files
2125// (thanks to the -dD -E flags) and not binary files. They will then be
2126// consumed by the genseccomp.py script and converted into C++ code.
2127cc_defaults {
2128 name: "libseccomp_gen_syscall_nrs_defaults",
2129 recovery_available: true,
2130 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2131 cflags: [
2132 "-dD",
2133 "-E",
2134 "-Wall",
2135 "-Werror",
2136 "-nostdinc",
2137 ],
2138}
2139
2140cc_object {
2141 name: "libseccomp_gen_syscall_nrs_arm",
2142 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2143 local_include_dirs: [
2144 "kernel/uapi/asm-arm",
2145 "kernel/uapi",
2146 ],
2147}
2148
2149cc_object {
2150 name: "libseccomp_gen_syscall_nrs_arm64",
2151 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2152 local_include_dirs: [
2153 "kernel/uapi/asm-arm64",
2154 "kernel/uapi",
2155 ],
2156}
2157
2158cc_object {
2159 name: "libseccomp_gen_syscall_nrs_x86",
2160 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2161 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2162 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2163 local_include_dirs: [
2164 "kernel/uapi/asm-x86",
2165 "kernel/uapi",
2166 ],
2167}
2168
2169cc_object {
2170 name: "libseccomp_gen_syscall_nrs_x86_64",
2171 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2172 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2173 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2174 local_include_dirs: [
2175 "kernel/uapi/asm-x86",
2176 "kernel/uapi",
2177 ],
2178}
2179
2180cc_object {
2181 name: "libseccomp_gen_syscall_nrs_mips",
2182 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2183 cflags: [
2184 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2185 ],
2186 local_include_dirs: [
2187 "kernel/uapi/asm-mips",
2188 "kernel/uapi",
2189 ],
2190}
2191
2192cc_object {
2193 name: "libseccomp_gen_syscall_nrs_mips64",
2194 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2195 cflags: [
2196 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2197 ],
2198 local_include_dirs: [
2199 "kernel/uapi/asm-mips",
2200 "kernel/uapi",
2201 ],
2202}
2203
2204// Generate the C++ policy sources for app, system, and global seccomp-bpf
2205// filters.
2206python_binary_host {
2207 name: "genseccomp",
2208 main: "tools/genseccomp.py",
2209
2210 srcs: [
2211 "tools/genseccomp.py",
2212 "tools/gensyscalls.py",
2213 ],
2214
2215 data: [
2216 "kernel/uapi/**/*.h",
2217 ],
2218
2219 version: {
2220 py2: {
2221 enabled: true,
2222 },
2223 py3: {
2224 enabled: false,
2225 },
2226 },
2227}
2228
Martijn Coenen0c6de752019-01-02 12:52:51 +01002229python_binary_host {
2230 name: "genfunctosyscallnrs",
2231 main: "tools/genfunctosyscallnrs.py",
2232
2233 srcs: [
2234 "tools/genseccomp.py",
2235 "tools/genfunctosyscallnrs.py",
2236 "tools/gensyscalls.py",
2237 ],
2238
2239 data: [
2240 "kernel/uapi/**/*.h",
2241 ],
2242
2243 version: {
2244 py2: {
2245 enabled: true,
2246 },
2247 py3: {
2248 enabled: false,
2249 },
2250 },
2251}
2252
2253cc_genrule {
2254 name: "func_to_syscall_nrs",
2255 recovery_available: true,
2256 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2257
2258 tools: [ "genfunctosyscallnrs" ],
2259
2260 srcs: [
2261 "SYSCALLS.TXT",
2262 ":libseccomp_gen_syscall_nrs_arm",
2263 ":libseccomp_gen_syscall_nrs_arm64",
2264 ":libseccomp_gen_syscall_nrs_mips",
2265 ":libseccomp_gen_syscall_nrs_mips64",
2266 ":libseccomp_gen_syscall_nrs_x86",
2267 ":libseccomp_gen_syscall_nrs_x86_64",
2268 ],
2269
2270 out: [
2271 "func_to_syscall_nrs.h",
2272 ],
2273}
2274
Martijn Coenenc3752be2019-01-09 16:19:57 +01002275// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2276genrule {
2277 name: "generate_app_zygote_blacklist",
2278 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2279 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2280 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2281}
2282
2283cc_genrule {
2284 name: "libseccomp_policy_app_zygote_sources",
2285 recovery_available: true,
2286 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2287
2288 tools: [ "genseccomp" ],
2289
2290 srcs: [
2291 "SYSCALLS.TXT",
2292 "SECCOMP_WHITELIST_COMMON.TXT",
2293 "SECCOMP_WHITELIST_APP.TXT",
2294 "SECCOMP_BLACKLIST_COMMON.TXT",
2295 ":generate_app_zygote_blacklist",
2296 ":libseccomp_gen_syscall_nrs_arm",
2297 ":libseccomp_gen_syscall_nrs_arm64",
2298 ":libseccomp_gen_syscall_nrs_mips",
2299 ":libseccomp_gen_syscall_nrs_mips64",
2300 ":libseccomp_gen_syscall_nrs_x86",
2301 ":libseccomp_gen_syscall_nrs_x86_64",
2302 ],
2303
2304 out: [
2305 "arm64_app_zygote_policy.cpp",
2306 "arm_app_zygote_policy.cpp",
2307 "mips64_app_zygote_policy.cpp",
2308 "mips_app_zygote_policy.cpp",
2309 "x86_64_app_zygote_policy.cpp",
2310 "x86_app_zygote_policy.cpp",
2311 ],
2312}
2313
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002314cc_genrule {
2315 name: "libseccomp_policy_app_sources",
2316 recovery_available: true,
2317 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2318
2319 tools: [ "genseccomp" ],
2320
2321 srcs: [
2322 "SYSCALLS.TXT",
2323 "SECCOMP_WHITELIST_COMMON.TXT",
2324 "SECCOMP_WHITELIST_APP.TXT",
2325 "SECCOMP_BLACKLIST_COMMON.TXT",
2326 "SECCOMP_BLACKLIST_APP.TXT",
2327 ":libseccomp_gen_syscall_nrs_arm",
2328 ":libseccomp_gen_syscall_nrs_arm64",
2329 ":libseccomp_gen_syscall_nrs_mips",
2330 ":libseccomp_gen_syscall_nrs_mips64",
2331 ":libseccomp_gen_syscall_nrs_x86",
2332 ":libseccomp_gen_syscall_nrs_x86_64",
2333 ],
2334
2335 out: [
2336 "arm64_app_policy.cpp",
2337 "arm_app_policy.cpp",
2338 "mips64_app_policy.cpp",
2339 "mips_app_policy.cpp",
2340 "x86_64_app_policy.cpp",
2341 "x86_app_policy.cpp",
2342 ],
2343}
2344
2345cc_genrule {
2346 name: "libseccomp_policy_system_sources",
2347 recovery_available: true,
2348 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2349
2350 tools: [ "genseccomp" ],
2351
2352 srcs: [
2353 "SYSCALLS.TXT",
2354 "SECCOMP_WHITELIST_COMMON.TXT",
2355 "SECCOMP_WHITELIST_SYSTEM.TXT",
2356 "SECCOMP_BLACKLIST_COMMON.TXT",
2357 ":libseccomp_gen_syscall_nrs_arm",
2358 ":libseccomp_gen_syscall_nrs_arm64",
2359 ":libseccomp_gen_syscall_nrs_mips",
2360 ":libseccomp_gen_syscall_nrs_mips64",
2361 ":libseccomp_gen_syscall_nrs_x86",
2362 ":libseccomp_gen_syscall_nrs_x86_64",
2363 ],
2364
2365 out: [
2366 "arm64_system_policy.cpp",
2367 "arm_system_policy.cpp",
2368 "mips64_system_policy.cpp",
2369 "mips_system_policy.cpp",
2370 "x86_64_system_policy.cpp",
2371 "x86_system_policy.cpp",
2372 ],
2373}
2374
2375cc_genrule {
2376 name: "libseccomp_policy_global_sources",
2377 recovery_available: true,
2378 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=global $(in)",
2379
2380 tools: [ "genseccomp" ],
2381
2382 srcs: [
2383 "SYSCALLS.TXT",
2384 "SECCOMP_WHITELIST_COMMON.TXT",
2385 "SECCOMP_WHITELIST_SYSTEM.TXT",
2386 "SECCOMP_WHITELIST_APP.TXT",
2387 "SECCOMP_WHITELIST_GLOBAL.TXT",
2388 "SECCOMP_BLACKLIST_COMMON.TXT",
2389 ":libseccomp_gen_syscall_nrs_arm",
2390 ":libseccomp_gen_syscall_nrs_arm64",
2391 ":libseccomp_gen_syscall_nrs_mips",
2392 ":libseccomp_gen_syscall_nrs_mips64",
2393 ":libseccomp_gen_syscall_nrs_x86",
2394 ":libseccomp_gen_syscall_nrs_x86_64",
2395 ],
2396
2397 out: [
2398 "arm64_global_policy.cpp",
2399 "arm_global_policy.cpp",
2400 "mips64_global_policy.cpp",
2401 "mips_global_policy.cpp",
2402 "x86_64_global_policy.cpp",
2403 "x86_global_policy.cpp",
2404 ],
2405}
2406
2407cc_library {
2408 name: "libseccomp_policy",
2409 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002410 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002411 generated_sources: [
2412 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002413 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002414 "libseccomp_policy_global_sources",
2415 "libseccomp_policy_system_sources",
2416 ],
2417
2418 srcs: [
2419 "seccomp/seccomp_policy.cpp",
2420 ],
2421
2422 export_include_dirs: ["seccomp/include"],
2423 cflags: [
2424 "-Wall",
2425 "-Werror",
2426 ],
2427 shared: {
2428 shared_libs: ["libbase"],
2429 },
2430 static: {
2431 static_libs: ["libbase"],
2432 },
2433}