blob: 51a7bf0471be588871536b96e54b79549a7e2e82 [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
80 // TODO(ivanlozano): Remove after b/118321713
81 xom: false,
Dan Willemsen208ae172015-09-16 16:33:27 -070082}
83
Dan Willemsen208ae172015-09-16 16:33:27 -070084// ========================================================
85// libc_stack_protector.a - stack protector code
86// ========================================================
87//
Colin Crossa3f9fca2016-01-11 13:20:55 -080088// Code that implements the stack protector (or that runs
89// before TLS has been set up) needs to be compiled with
90// -fno-stack-protector, since it accesses the stack canary
91// TLS slot.
Dan Willemsen208ae172015-09-16 16:33:27 -070092
93cc_library_static {
94
Colin Crossa3f9fca2016-01-11 13:20:55 -080095 srcs: [
96 "bionic/__libc_init_main_thread.cpp",
97 "bionic/__stack_chk_fail.cpp",
98 ],
99 arch: {
100 arm64: {
101 srcs: ["arch-arm64/bionic/__set_tls.c"],
102 },
103 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700104 srcs: [
105 "arch-x86/bionic/__libc_init_sysinfo.cpp",
106 "arch-x86/bionic/__set_tls.cpp",
107 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800108 },
109 x86_64: {
110 srcs: ["arch-x86_64/bionic/__set_tls.c"],
111 },
112 },
113
Colin Cross50c21ab2015-10-31 23:03:05 -0700114 defaults: ["libc_defaults"],
115 cflags: ["-fno-stack-protector"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700116 name: "libc_stack_protector",
Dan Willemsen208ae172015-09-16 16:33:27 -0700117}
118
Colin Crossa3f9fca2016-01-11 13:20:55 -0800119// libc_init_static.cpp also needs to be built without stack protector,
120// because it's responsible for setting up TLS for static executables.
121// This isn't the case for dynamic executables because the dynamic linker
122// has already set up the main thread's TLS.
123
124cc_library_static {
125 name: "libc_init_static",
126 defaults: ["libc_defaults"],
127 srcs: ["bionic/libc_init_static.cpp"],
128 cflags: ["-fno-stack-protector"],
129}
130
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700131cc_library_static {
132 name: "libc_init_dynamic",
133 defaults: ["libc_defaults"],
134 srcs: ["bionic/libc_init_dynamic.cpp"],
135 cflags: ["-fno-stack-protector"],
136}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800137
Dan Willemsen208ae172015-09-16 16:33:27 -0700138// ========================================================
139// libc_tzcode.a - upstream 'tzcode' code
140// ========================================================
141
142cc_library_static {
143
Colin Cross50c21ab2015-10-31 23:03:05 -0700144 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700145 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800146 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700147 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700148 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
149 ],
150
Colin Cross50c21ab2015-10-31 23:03:05 -0700151 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700152 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700153 // Don't use ridiculous amounts of stack.
154 "-DALL_STATE",
155 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
156 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800157 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700158 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700159 // The name of the tm_gmtoff field in our struct tm.
160 "-DTM_GMTOFF=tm_gmtoff",
161 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700162 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700163 // Include `tzname`, `timezone`, and `daylight` globals.
164 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700165 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800166 // Use the empty string (instead of " ") as the timezone abbreviation
167 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700168 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700169 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
170 "-Dlint",
171 ],
172
Dan Willemsen208ae172015-09-16 16:33:27 -0700173 local_include_dirs: ["tzcode/"],
174 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700175}
176
177// ========================================================
178// libc_dns.a - modified NetBSD DNS code
179// ========================================================
180
181cc_library_static {
182
Colin Cross50c21ab2015-10-31 23:03:05 -0700183 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700184 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800185 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700186
187 "upstream-netbsd/lib/libc/isc/ev_streams.c",
188 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700189 ],
190
Colin Cross50c21ab2015-10-31 23:03:05 -0700191 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700192 "-DANDROID_CHANGES",
193 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700194 "-Wno-unused-parameter",
195 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700196 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700197 ],
198
Dan Willemsen208ae172015-09-16 16:33:27 -0700199 local_include_dirs: [
200 "dns/include",
201 "private",
202 "upstream-netbsd/lib/libc/include",
203 "upstream-netbsd/android/include",
204 ],
205
206 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700207}
208
209// ========================================================
210// libc_freebsd.a - upstream FreeBSD C library code
211// ========================================================
212//
213// These files are built with the freebsd-compat.h header file
214// automatically included.
215
216cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700217 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700218 srcs: [
219 "upstream-freebsd/lib/libc/gen/ldexp.c",
220 "upstream-freebsd/lib/libc/gen/sleep.c",
221 "upstream-freebsd/lib/libc/gen/usleep.c",
222 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700223 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
224 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
225 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
226 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700227 "upstream-freebsd/lib/libc/stdlib/qsort.c",
228 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700229 "upstream-freebsd/lib/libc/string/wcpcpy.c",
230 "upstream-freebsd/lib/libc/string/wcpncpy.c",
231 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700232 "upstream-freebsd/lib/libc/string/wcscat.c",
233 "upstream-freebsd/lib/libc/string/wcschr.c",
234 "upstream-freebsd/lib/libc/string/wcscmp.c",
235 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700236 "upstream-freebsd/lib/libc/string/wcscspn.c",
237 "upstream-freebsd/lib/libc/string/wcsdup.c",
238 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700239 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700240 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
241 "upstream-freebsd/lib/libc/string/wcsncat.c",
242 "upstream-freebsd/lib/libc/string/wcsncmp.c",
243 "upstream-freebsd/lib/libc/string/wcsncpy.c",
244 "upstream-freebsd/lib/libc/string/wcsnlen.c",
245 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700246 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700247 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700248 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700249 "upstream-freebsd/lib/libc/string/wcstok.c",
250 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700251 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700252 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700253 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800254 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700255 ],
256 arch: {
257 arm64: {
258 exclude_srcs: [
259 "upstream-freebsd/lib/libc/string/wmemmove.c",
260 ],
261 },
262 x86: {
263 exclude_srcs: [
264 "upstream-freebsd/lib/libc/string/wcschr.c",
265 "upstream-freebsd/lib/libc/string/wcscmp.c",
266 "upstream-freebsd/lib/libc/string/wcslen.c",
267 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700268 "upstream-freebsd/lib/libc/string/wmemcmp.c",
269 "upstream-freebsd/lib/libc/string/wcscat.c",
270 "upstream-freebsd/lib/libc/string/wcscpy.c",
271 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700272 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700273 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700274 },
275
Colin Cross50c21ab2015-10-31 23:03:05 -0700276 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700277 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700278 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700279 "-include freebsd-compat.h",
280 ],
281
Dan Willemsen208ae172015-09-16 16:33:27 -0700282 local_include_dirs: [
283 "upstream-freebsd/android/include",
284 ],
285
286 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700287}
288
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700289cc_library_static {
290 defaults: ["libc_defaults"],
291 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700292 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700293 "upstream-freebsd/lib/libc/stdlib/realpath.c",
294 ],
295
296 cflags: [
297 "-Wno-sign-compare",
298 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700299 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700300 ],
301
302 local_include_dirs: [
303 "upstream-freebsd/android/include",
304 ],
305
306 name: "libc_freebsd_large_stack",
307}
308
Dan Willemsen208ae172015-09-16 16:33:27 -0700309// ========================================================
310// libc_netbsd.a - upstream NetBSD C library code
311// ========================================================
312//
313// These files are built with the netbsd-compat.h header file
314// automatically included.
315
316cc_library_static {
317
Colin Cross50c21ab2015-10-31 23:03:05 -0700318 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700319 srcs: [
320 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700321 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700322 "upstream-netbsd/lib/libc/gen/psignal.c",
323 "upstream-netbsd/lib/libc/gen/utime.c",
324 "upstream-netbsd/lib/libc/gen/utmp.c",
325 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
326 "upstream-netbsd/lib/libc/regex/regcomp.c",
327 "upstream-netbsd/lib/libc/regex/regerror.c",
328 "upstream-netbsd/lib/libc/regex/regexec.c",
329 "upstream-netbsd/lib/libc/regex/regfree.c",
330 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
331 "upstream-netbsd/lib/libc/stdlib/div.c",
332 "upstream-netbsd/lib/libc/stdlib/drand48.c",
333 "upstream-netbsd/lib/libc/stdlib/erand48.c",
334 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
335 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
336 "upstream-netbsd/lib/libc/stdlib/ldiv.c",
337 "upstream-netbsd/lib/libc/stdlib/lldiv.c",
338 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
339 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
340 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
341 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
342 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
343 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
344 "upstream-netbsd/lib/libc/stdlib/seed48.c",
345 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700346 ],
347 multilib: {
348 lib32: {
349 // LP32 cruft
350 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
351 },
352 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700353 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700354 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800355 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700356 "-DPOSIX_MISTAKE",
357 "-include netbsd-compat.h",
358 ],
359
Dan Willemsen208ae172015-09-16 16:33:27 -0700360 local_include_dirs: [
361 "upstream-netbsd/android/include",
362 "upstream-netbsd/lib/libc/include",
363 ],
364
365 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700366}
367
368// ========================================================
369// libc_openbsd_ndk.a - upstream OpenBSD C library code
370// that can be safely included in the libc_ndk.a (doesn't
371// contain any troublesome global data or constructors).
372// ========================================================
373//
374// These files are built with the openbsd-compat.h header file
375// automatically included.
376
377cc_library_static {
378 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700379 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700380 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700381 "upstream-openbsd/lib/libc/gen/alarm.c",
382 "upstream-openbsd/lib/libc/gen/ctype_.c",
383 "upstream-openbsd/lib/libc/gen/daemon.c",
384 "upstream-openbsd/lib/libc/gen/err.c",
385 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700386 "upstream-openbsd/lib/libc/gen/fnmatch.c",
387 "upstream-openbsd/lib/libc/gen/ftok.c",
388 "upstream-openbsd/lib/libc/gen/getprogname.c",
389 "upstream-openbsd/lib/libc/gen/isctype.c",
390 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700391 "upstream-openbsd/lib/libc/gen/tolower_.c",
392 "upstream-openbsd/lib/libc/gen/toupper_.c",
393 "upstream-openbsd/lib/libc/gen/verr.c",
394 "upstream-openbsd/lib/libc/gen/verrx.c",
395 "upstream-openbsd/lib/libc/gen/vwarn.c",
396 "upstream-openbsd/lib/libc/gen/vwarnx.c",
397 "upstream-openbsd/lib/libc/gen/warn.c",
398 "upstream-openbsd/lib/libc/gen/warnx.c",
399 "upstream-openbsd/lib/libc/locale/btowc.c",
400 "upstream-openbsd/lib/libc/locale/mbrlen.c",
401 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
402 "upstream-openbsd/lib/libc/locale/mbtowc.c",
403 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700404 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
405 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700406 "upstream-openbsd/lib/libc/locale/wcstoll.c",
407 "upstream-openbsd/lib/libc/locale/wcstombs.c",
408 "upstream-openbsd/lib/libc/locale/wcstoul.c",
409 "upstream-openbsd/lib/libc/locale/wcstoull.c",
410 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
411 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
412 "upstream-openbsd/lib/libc/locale/wctob.c",
413 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700414 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700415 "upstream-openbsd/lib/libc/net/htonl.c",
416 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700417 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
418 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
419 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700420 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
421 "upstream-openbsd/lib/libc/net/inet_ntop.c",
422 "upstream-openbsd/lib/libc/net/inet_pton.c",
423 "upstream-openbsd/lib/libc/net/ntohl.c",
424 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800425 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700426 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700427 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
428 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700429 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700430 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700431 "upstream-openbsd/lib/libc/stdio/fputwc.c",
432 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700433 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700434 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700435 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700436 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700437 "upstream-openbsd/lib/libc/stdio/makebuf.c",
438 "upstream-openbsd/lib/libc/stdio/mktemp.c",
439 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
440 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700441 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700442 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700443 "upstream-openbsd/lib/libc/stdio/tempnam.c",
444 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
445 "upstream-openbsd/lib/libc/stdio/ungetc.c",
446 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
447 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
448 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700449 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
450 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
451 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700452 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700453 "upstream-openbsd/lib/libc/stdio/wsetup.c",
454 "upstream-openbsd/lib/libc/stdlib/abs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700455 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700456 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700457 "upstream-openbsd/lib/libc/stdlib/insque.c",
458 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
459 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
460 "upstream-openbsd/lib/libc/stdlib/labs.c",
461 "upstream-openbsd/lib/libc/stdlib/llabs.c",
462 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700463 "upstream-openbsd/lib/libc/stdlib/remque.c",
464 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700465 "upstream-openbsd/lib/libc/stdlib/tfind.c",
466 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800467 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700468 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800469 "upstream-openbsd/lib/libc/string/strcasestr.c",
470 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700471 "upstream-openbsd/lib/libc/string/strcspn.c",
472 "upstream-openbsd/lib/libc/string/strdup.c",
473 "upstream-openbsd/lib/libc/string/strndup.c",
474 "upstream-openbsd/lib/libc/string/strpbrk.c",
475 "upstream-openbsd/lib/libc/string/strsep.c",
476 "upstream-openbsd/lib/libc/string/strspn.c",
477 "upstream-openbsd/lib/libc/string/strstr.c",
478 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800479 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700480 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700481 "upstream-openbsd/lib/libc/string/wcswidth.c",
482 ],
483
Colin Cross50c21ab2015-10-31 23:03:05 -0700484 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700485 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700486 "-Wno-unused-parameter",
487 "-include openbsd-compat.h",
488 ],
489
Dan Willemsen208ae172015-09-16 16:33:27 -0700490 local_include_dirs: [
491 "private",
492 "stdio",
493 "upstream-openbsd/android/include",
494 "upstream-openbsd/lib/libc/include",
495 "upstream-openbsd/lib/libc/gdtoa/",
496 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700497}
498
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700499cc_library_static {
500 name: "libc_openbsd_large_stack",
501 defaults: ["libc_defaults"],
502 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700503 "stdio/vfprintf.cpp",
504 "stdio/vfwprintf.cpp",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700505 ],
506 cflags: [
507 "-include openbsd-compat.h",
508 "-Wno-sign-compare",
509 "-Wframe-larger-than=5000",
510 ],
511
512 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700513 "upstream-openbsd/android/include/",
514 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700515 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700516 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700517 ],
518}
519
Dan Willemsen208ae172015-09-16 16:33:27 -0700520// ========================================================
521// libc_openbsd.a - upstream OpenBSD C library code
522// ========================================================
523//
524// These files are built with the openbsd-compat.h header file
525// automatically included.
526cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700527 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700528 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800529 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700530 "upstream-openbsd/lib/libc/crypt/arc4random.c",
531 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
532
533 // May be overriden by per-arch optimized versions
534 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700535 "upstream-openbsd/lib/libc/string/memrchr.c",
536 "upstream-openbsd/lib/libc/string/stpcpy.c",
537 "upstream-openbsd/lib/libc/string/stpncpy.c",
538 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700539 "upstream-openbsd/lib/libc/string/strcpy.c",
540 "upstream-openbsd/lib/libc/string/strlcat.c",
541 "upstream-openbsd/lib/libc/string/strlcpy.c",
542 "upstream-openbsd/lib/libc/string/strncat.c",
543 "upstream-openbsd/lib/libc/string/strncmp.c",
544 "upstream-openbsd/lib/libc/string/strncpy.c",
545 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700546
547 arch: {
548 arm: {
549 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700550 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800551 "upstream-openbsd/lib/libc/string/stpcpy.c",
552 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700553 ],
554 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700555 arm64: {
556 exclude_srcs: [
557 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700558 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700559 "upstream-openbsd/lib/libc/string/strcpy.c",
560 "upstream-openbsd/lib/libc/string/strncmp.c",
561 ],
562 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530563 mips: {
564 exclude_srcs: [
565 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530566 "upstream-openbsd/lib/libc/string/strcpy.c",
567 "upstream-openbsd/lib/libc/string/strncmp.c",
568 ],
569 },
570 mips64: {
571 exclude_srcs: [
572 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530573 "upstream-openbsd/lib/libc/string/strcpy.c",
574 "upstream-openbsd/lib/libc/string/strncmp.c",
575 ],
576 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700577 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800578 exclude_srcs: [
579 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800580 "upstream-openbsd/lib/libc/string/memrchr.c",
581 "upstream-openbsd/lib/libc/string/stpcpy.c",
582 "upstream-openbsd/lib/libc/string/stpncpy.c",
583 "upstream-openbsd/lib/libc/string/strcat.c",
584 "upstream-openbsd/lib/libc/string/strcpy.c",
585 "upstream-openbsd/lib/libc/string/strncmp.c",
586 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700587 "upstream-openbsd/lib/libc/string/strlcat.c",
588 "upstream-openbsd/lib/libc/string/strlcpy.c",
589 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800590 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700591 },
592
593 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800594 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800595 "upstream-openbsd/lib/libc/string/stpcpy.c",
596 "upstream-openbsd/lib/libc/string/stpncpy.c",
597 "upstream-openbsd/lib/libc/string/strcat.c",
598 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800599 "upstream-openbsd/lib/libc/string/strncat.c",
600 "upstream-openbsd/lib/libc/string/strncmp.c",
601 "upstream-openbsd/lib/libc/string/strncpy.c",
602 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700603 },
604 },
605
Colin Cross50c21ab2015-10-31 23:03:05 -0700606 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700607 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700608 "-Wno-unused-parameter",
609 "-include openbsd-compat.h",
610 ],
611
Dan Willemsen208ae172015-09-16 16:33:27 -0700612 local_include_dirs: [
613 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700614 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700615 ],
616
617 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700618}
619
620// ========================================================
621// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
622// ========================================================
623//
624// These files are built with the openbsd-compat.h header file
625// automatically included.
626
627cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700628 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700629 srcs: [
630 "upstream-openbsd/android/gdtoa_support.cpp",
631 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
632 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
633 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
634 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
635 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
636 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
637 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
638 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
639 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
640 "upstream-openbsd/lib/libc/gdtoa/misc.c",
641 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
642 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
643 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
644 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
645 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
646 "upstream-openbsd/lib/libc/gdtoa/sum.c",
647 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
648 ],
649 multilib: {
650 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800651 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700652 },
653 },
654
Colin Cross50c21ab2015-10-31 23:03:05 -0700655 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700656 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700657 "-include openbsd-compat.h",
658 ],
659
Dan Willemsen208ae172015-09-16 16:33:27 -0700660 local_include_dirs: [
661 "private",
662 "upstream-openbsd/android/include",
663 "upstream-openbsd/lib/libc/include",
664 ],
665
666 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700667}
668
669// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700670// libc_fortify.a - container for our FORITFY
671// implementation details
672// ========================================================
673cc_library_static {
674 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700675 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700676
677 name: "libc_fortify",
678
679 // Disable FORTIFY for the compilation of these, so we don't end up having
680 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800681 cflags: [
682 "-U_FORTIFY_SOURCE",
683 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
684 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700685
686 arch: {
687 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800688 cflags: [
689 "-DNO___MEMCPY_CHK",
690 "-DRENAME___STRCAT_CHK",
691 "-DRENAME___STRCPY_CHK",
692 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700693 srcs: [
694 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800695
696 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
697 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
698
699 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
700 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
701
702 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
703 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
704
705 "arch-arm/krait/bionic/__strcat_chk.S",
706 "arch-arm/krait/bionic/__strcpy_chk.S",
707
708 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
709 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
710
Haibo Huang01bfd892018-12-03 15:05:16 -0800711 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
712 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700713 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700714 },
715 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700716 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700717 srcs: [
718 "arch-arm64/generic/bionic/__memcpy_chk.S",
719 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700720 },
721 },
722}
723
724// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700725// libc_bionic.a - home-grown C library code
726// ========================================================
727
728cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700729 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700730 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700731 // The data that backs getauxval is initialized in the libc init
732 // functions which are invoked by the linker. If this file is included
733 // in libc_ndk.a, only one of the copies of the global data will be
734 // initialized, resulting in nullptr dereferences.
735 "bionic/getauxval.cpp",
736
Elliott Hughes211c4d32018-02-02 15:10:32 -0800737 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700738 "bionic/sysconf.cpp",
739 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700740 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700741
Josh Gao10ec9282017-04-03 15:13:29 -0700742 // The following must not be statically linked into libc_ndk.a, because
743 // debuggerd will look for the abort message in libc.so's copy.
744 "bionic/android_set_abort_message.cpp",
745
Dan Willemsen208ae172015-09-16 16:33:27 -0700746 "bionic/strchr.cpp",
747 "bionic/strnlen.c",
748 "bionic/strrchr.cpp",
749 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700750
751 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700752 arm: {
753 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800754 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700755 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800756 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800757 "arch-arm/generic/bionic/stpcpy.c",
758 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800759 "arch-arm/generic/bionic/strcmp.S",
760 "arch-arm/generic/bionic/strcpy.S",
761 "arch-arm/generic/bionic/strlen.c",
762
Ryan Prichard45024fe2018-12-30 21:10:26 -0800763 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700764 "arch-arm/bionic/atomics_arm.c",
765 "arch-arm/bionic/__bionic_clone.S",
766 "arch-arm/bionic/_exit_with_stack_teardown.S",
767 "arch-arm/bionic/libgcc_compat.c",
768 "arch-arm/bionic/popcount_tab.c",
769 "arch-arm/bionic/__restore.S",
770 "arch-arm/bionic/setjmp.S",
771 "arch-arm/bionic/syscall.S",
772 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800773
774 "arch-arm/cortex-a15/bionic/memcpy.S",
775 "arch-arm/cortex-a15/bionic/memmove.S",
776 "arch-arm/cortex-a15/bionic/memset.S",
777 "arch-arm/cortex-a15/bionic/stpcpy.S",
778 "arch-arm/cortex-a15/bionic/strcat.S",
779 "arch-arm/cortex-a15/bionic/strcmp.S",
780 "arch-arm/cortex-a15/bionic/strcpy.S",
781 "arch-arm/cortex-a15/bionic/strlen.S",
782
783 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800784 "arch-arm/cortex-a7/bionic/memset.S",
785
786 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800787 "arch-arm/cortex-a9/bionic/memset.S",
788 "arch-arm/cortex-a9/bionic/stpcpy.S",
789 "arch-arm/cortex-a9/bionic/strcat.S",
790 "arch-arm/cortex-a9/bionic/strcmp.S",
791 "arch-arm/cortex-a9/bionic/strcpy.S",
792 "arch-arm/cortex-a9/bionic/strlen.S",
793
794 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800795 "arch-arm/krait/bionic/memset.S",
796 "arch-arm/krait/bionic/strcmp.S",
797
798 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800799
Haibo Huang01bfd892018-12-03 15:05:16 -0800800 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800801
802 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700803 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700804 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700805 arm64: {
806 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700807 "arch-arm64/generic/bionic/memchr.S",
808 "arch-arm64/generic/bionic/memcmp.S",
809 "arch-arm64/generic/bionic/memcpy.S",
810 "arch-arm64/generic/bionic/memmove.S",
811 "arch-arm64/generic/bionic/memset.S",
812 "arch-arm64/generic/bionic/stpcpy.S",
813 "arch-arm64/generic/bionic/strchr.S",
814 "arch-arm64/generic/bionic/strcmp.S",
815 "arch-arm64/generic/bionic/strcpy.S",
816 "arch-arm64/generic/bionic/strlen.S",
817 "arch-arm64/generic/bionic/strncmp.S",
818 "arch-arm64/generic/bionic/strnlen.S",
819 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800820
821 "arch-arm64/bionic/__bionic_clone.S",
822 "arch-arm64/bionic/_exit_with_stack_teardown.S",
823 "arch-arm64/bionic/setjmp.S",
824 "arch-arm64/bionic/syscall.S",
825 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700826 ],
827 exclude_srcs: [
828 "bionic/__memcpy_chk.cpp",
829 "bionic/strchr.cpp",
830 "bionic/strnlen.c",
831 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700832 },
833
834 mips: {
835 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800836 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530837 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800838 "arch-mips/string/memset.S",
839 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530840 "arch-mips/string/strncmp.S",
841 "arch-mips/string/strlen.c",
842 "arch-mips/string/strnlen.c",
843 "arch-mips/string/strchr.c",
844 "arch-mips/string/strcpy.c",
845 "arch-mips/string/memchr.c",
846 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800847
Dan Willemsen208ae172015-09-16 16:33:27 -0700848 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700849 "arch-mips/bionic/cacheflush.cpp",
850 "arch-mips/bionic/_exit_with_stack_teardown.S",
Dan Willemsen879cec22016-02-29 10:37:56 -0800851 "arch-mips/bionic/libgcc_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700852 "arch-mips/bionic/setjmp.S",
853 "arch-mips/bionic/syscall.S",
854 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700855 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530856 exclude_srcs: [
857 "bionic/strchr.cpp",
858 "bionic/strnlen.c",
859 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700860 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700861 mips64: {
862 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800863 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530864 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800865 "arch-mips/string/memset.S",
866 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530867 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800868 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530869 "arch-mips/string/strnlen.c",
870 "arch-mips/string/strchr.c",
871 "arch-mips/string/strcpy.c",
872 "arch-mips/string/memchr.c",
873 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800874
Dan Willemsen208ae172015-09-16 16:33:27 -0700875 "arch-mips64/bionic/__bionic_clone.S",
876 "arch-mips64/bionic/_exit_with_stack_teardown.S",
877 "arch-mips64/bionic/setjmp.S",
878 "arch-mips64/bionic/syscall.S",
879 "arch-mips64/bionic/vfork.S",
880 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700881 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530882 exclude_srcs: [
883 "bionic/strchr.cpp",
884 "bionic/strnlen.c",
885 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700886 },
887
888 x86: {
889 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700890 "arch-x86/generic/string/memcmp.S",
891 "arch-x86/generic/string/strcmp.S",
892 "arch-x86/generic/string/strncmp.S",
893 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700894
895 "arch-x86/generic/string/strlcat.c",
896 "arch-x86/generic/string/strlcpy.c",
897 "arch-x86/generic/string/strncat.c",
898 "arch-x86/generic/string/wcscat.c",
899 "arch-x86/generic/string/wcscpy.c",
900 "arch-x86/generic/string/wmemcmp.c",
901
Dan Willemsen208ae172015-09-16 16:33:27 -0700902 "arch-x86/atom/string/sse2-memchr-atom.S",
903 "arch-x86/atom/string/sse2-memrchr-atom.S",
904 "arch-x86/atom/string/sse2-strchr-atom.S",
905 "arch-x86/atom/string/sse2-strnlen-atom.S",
906 "arch-x86/atom/string/sse2-strrchr-atom.S",
907 "arch-x86/atom/string/sse2-wcschr-atom.S",
908 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
909 "arch-x86/atom/string/sse2-wcslen-atom.S",
910 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700911 "arch-x86/silvermont/string/sse2-memmove-slm.S",
912 "arch-x86/silvermont/string/sse2-memset-slm.S",
913 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
914 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
915 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
916 "arch-x86/silvermont/string/sse2-strlen-slm.S",
917 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800918
919 "arch-x86/bionic/__bionic_clone.S",
920 "arch-x86/bionic/_exit_with_stack_teardown.S",
921 "arch-x86/bionic/libgcc_compat.c",
922 "arch-x86/bionic/__restore.S",
923 "arch-x86/bionic/setjmp.S",
924 "arch-x86/bionic/syscall.S",
925 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700926
927 // ssse3 functions
928 "arch-x86/atom/string/ssse3-strcat-atom.S",
929 "arch-x86/atom/string/ssse3-strcmp-atom.S",
930 "arch-x86/atom/string/ssse3-strlcat-atom.S",
931 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
932 "arch-x86/atom/string/ssse3-strncat-atom.S",
933 "arch-x86/atom/string/ssse3-strncmp-atom.S",
934 "arch-x86/atom/string/ssse3-wcscat-atom.S",
935 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
936
937 // sse4 functions
938 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
939 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
940
941 // atom functions
942 "arch-x86/atom/string/sse2-memset-atom.S",
943 "arch-x86/atom/string/sse2-strlen-atom.S",
944 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800945 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700946 "arch-x86/atom/string/ssse3-strcpy-atom.S",
947 "arch-x86/atom/string/ssse3-strncpy-atom.S",
948 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700949 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700950
951 exclude_srcs: [
952 "bionic/strchr.cpp",
953 "bionic/strnlen.c",
954 "bionic/strrchr.cpp",
955 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700956 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700957 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700958 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700959 "arch-x86_64/string/sse2-memmove-slm.S",
960 "arch-x86_64/string/sse2-memset-slm.S",
961 "arch-x86_64/string/sse2-stpcpy-slm.S",
962 "arch-x86_64/string/sse2-stpncpy-slm.S",
963 "arch-x86_64/string/sse2-strcat-slm.S",
964 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700965 "arch-x86_64/string/sse2-strlen-slm.S",
966 "arch-x86_64/string/sse2-strncat-slm.S",
967 "arch-x86_64/string/sse2-strncpy-slm.S",
968 "arch-x86_64/string/sse4-memcmp-slm.S",
969 "arch-x86_64/string/ssse3-strcmp-slm.S",
970 "arch-x86_64/string/ssse3-strncmp-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800971
972 "arch-x86_64/bionic/__bionic_clone.S",
973 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
974 "arch-x86_64/bionic/__restore_rt.S",
975 "arch-x86_64/bionic/setjmp.S",
976 "arch-x86_64/bionic/syscall.S",
977 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700978 ],
979 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700980 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700981
Colin Cross50c21ab2015-10-31 23:03:05 -0700982 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700983 include_dirs: ["bionic/libstdc++/include"],
984 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700985}
986
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000987genrule {
988 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -0800989 out: ["generated_android_ids.h"],
990 srcs: [":android_filesystem_config_header"],
991 tool_files: ["fs_config_generator.py"],
992 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000993}
994
Dan Willemsen268a6732015-10-15 14:49:45 -0700995// ========================================================
996// libc_bionic_ndk.a- The portions of libc_bionic that can
997// be safely used in libc_ndk.a (no troublesome global data
998// or constructors).
999// ========================================================
1000cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001001 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001002 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001003 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001004 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001005 "bionic/__cmsg_nxthdr.cpp",
1006 "bionic/__errno.cpp",
1007 "bionic/__gnu_basename.cpp",
1008 "bionic/__libc_current_sigrtmax.cpp",
1009 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001010 "bionic/abort.cpp",
1011 "bionic/accept.cpp",
1012 "bionic/accept4.cpp",
1013 "bionic/access.cpp",
1014 "bionic/arpa_inet.cpp",
1015 "bionic/assert.cpp",
1016 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001017 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001018 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001019 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001020 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001021 "bionic/bionic_systrace.cpp",
1022 "bionic/bionic_time_conversions.cpp",
1023 "bionic/brk.cpp",
1024 "bionic/c16rtomb.cpp",
1025 "bionic/c32rtomb.cpp",
1026 "bionic/chmod.cpp",
1027 "bionic/chown.cpp",
1028 "bionic/clearenv.cpp",
1029 "bionic/clock.cpp",
1030 "bionic/clock_getcpuclockid.cpp",
1031 "bionic/clock_nanosleep.cpp",
1032 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001033 "bionic/connect.cpp",
1034 "bionic/ctype.cpp",
1035 "bionic/dirent.cpp",
1036 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001037 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001038 "bionic/error.cpp",
1039 "bionic/eventfd_read.cpp",
1040 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001041 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001042 "bionic/faccessat.cpp",
1043 "bionic/fchmod.cpp",
1044 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001045 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001046 "bionic/ffs.cpp",
1047 "bionic/fgetxattr.cpp",
1048 "bionic/flistxattr.cpp",
1049 "bionic/flockfile.cpp",
1050 "bionic/fpclassify.cpp",
1051 "bionic/fsetxattr.cpp",
1052 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001053 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001054 "bionic/futimens.cpp",
1055 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001056 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001057 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001058 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001059 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001060 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001061 "bionic/getpgrp.cpp",
1062 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001063 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001064 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001065 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001066 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001067 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001068 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001069 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001070 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001071 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001072 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001073 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001074 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001075 "bionic/lchown.cpp",
1076 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001077 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001078 "bionic/libgen.cpp",
1079 "bionic/link.cpp",
1080 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001081 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001082 "bionic/lstat.cpp",
1083 "bionic/malloc_info.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001084 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001085 "bionic/mbrtoc16.cpp",
1086 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001087 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001088 "bionic/mempcpy.cpp",
1089 "bionic/mkdir.cpp",
1090 "bionic/mkfifo.cpp",
1091 "bionic/mknod.cpp",
1092 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001093 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001094 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001095 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001096 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001097 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001098 "bionic/open.cpp",
1099 "bionic/pathconf.cpp",
1100 "bionic/pause.cpp",
1101 "bionic/pipe.cpp",
1102 "bionic/poll.cpp",
1103 "bionic/posix_fadvise.cpp",
1104 "bionic/posix_fallocate.cpp",
1105 "bionic/posix_madvise.cpp",
1106 "bionic/posix_timers.cpp",
1107 "bionic/ptrace.cpp",
1108 "bionic/pty.cpp",
1109 "bionic/raise.cpp",
1110 "bionic/rand.cpp",
1111 "bionic/readlink.cpp",
1112 "bionic/reboot.cpp",
1113 "bionic/recv.cpp",
1114 "bionic/rename.cpp",
1115 "bionic/rmdir.cpp",
1116 "bionic/scandir.cpp",
1117 "bionic/sched_getaffinity.cpp",
1118 "bionic/sched_getcpu.cpp",
1119 "bionic/semaphore.cpp",
1120 "bionic/send.cpp",
1121 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001122 "bionic/seteuid.cpp",
1123 "bionic/setpgrp.cpp",
1124 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001125 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001126 "bionic/sigprocmask.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001127 "bionic/socket.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001128 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001129 "bionic/stat.cpp",
1130 "bionic/statvfs.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001131 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001132 "bionic/strchrnul.cpp",
1133 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001134 "bionic/string_l.cpp",
1135 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001136 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001137 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001138 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001139 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001140 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001141 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001142 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001143 "bionic/sys_msg.cpp",
1144 "bionic/sys_sem.cpp",
1145 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001146 "bionic/sys_signalfd.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001147 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001148 "bionic/sysinfo.cpp",
1149 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001150 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001151 "bionic/system_property_api.cpp",
1152 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001153 "bionic/tdestroy.cpp",
1154 "bionic/termios.cpp",
1155 "bionic/thread_private.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001156 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001157 "bionic/tmpfile.cpp",
1158 "bionic/umount.cpp",
1159 "bionic/unlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001160 "bionic/wait.cpp",
1161 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001162 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001163 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001164 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001165 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001166 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001167
1168 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1169 // which will be overridden by the actual one in libc.so.
1170 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001171 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001172
Dan Willemsen208ae172015-09-16 16:33:27 -07001173 multilib: {
1174 lib32: {
1175 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001176 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001177 },
1178 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001179 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001180 treble_linker_namespaces: {
1181 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001182 },
1183 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001184 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001185 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001186 local_include_dirs: ["stdio"],
1187 include_dirs: ["bionic/libstdc++/include"],
1188 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001189 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001190}
1191
Dan Willemsen208ae172015-09-16 16:33:27 -07001192// ========================================================
1193// libc_pthread.a - pthreads parts that previously lived in
1194// libc_bionic.a. Relocated to their own library because
1195// they can't be included in libc_ndk.a (as they layout of
1196// pthread_t has changed over the years and has ABI
1197// compatibility issues).
1198// ========================================================
1199
1200cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001201 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001202 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001203 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001204 "bionic/pthread_atfork.cpp",
1205 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001206 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001207 "bionic/pthread_cond.cpp",
1208 "bionic/pthread_create.cpp",
1209 "bionic/pthread_detach.cpp",
1210 "bionic/pthread_equal.cpp",
1211 "bionic/pthread_exit.cpp",
1212 "bionic/pthread_getcpuclockid.cpp",
1213 "bionic/pthread_getschedparam.cpp",
1214 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001215 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001216 "bionic/pthread_join.cpp",
1217 "bionic/pthread_key.cpp",
1218 "bionic/pthread_kill.cpp",
1219 "bionic/pthread_mutex.cpp",
1220 "bionic/pthread_once.cpp",
1221 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001222 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001223 "bionic/pthread_self.cpp",
1224 "bionic/pthread_setname_np.cpp",
1225 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001226 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001227
1228 // The following implementations depend on pthread data or implementation,
1229 // so we can't include them in libc_ndk.a.
1230 "bionic/__cxa_thread_atexit_impl.cpp",
1231 "stdlib/atexit.c",
1232 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001233 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001234
Colin Cross50c21ab2015-10-31 23:03:05 -07001235 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001236 include_dirs: ["bionic/libstdc++/include"],
1237 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001238}
1239
1240// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001241// libc_syscalls.a
1242// ========================================================
1243
1244cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001245 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001246 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001247 arch: {
1248 arm: {
1249 srcs: ["arch-arm/syscalls/**/*.S"],
1250 },
1251 arm64: {
1252 srcs: ["arch-arm64/syscalls/**/*.S"],
1253 },
1254 mips: {
1255 srcs: ["arch-mips/syscalls/**/*.S"],
1256 },
1257 mips64: {
1258 srcs: ["arch-mips64/syscalls/**/*.S"],
1259 },
1260 x86: {
1261 srcs: ["arch-x86/syscalls/**/*.S"],
1262 },
1263 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001264 srcs: ["arch-x86_64/syscalls/**/*.S"],
1265 },
1266 },
1267 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001268}
1269
1270// ========================================================
1271// libc_aeabi.a
1272// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1273// to avoid infinite recursion. For the other architectures we just build an
1274// empty library to keep this makefile simple.
1275// ========================================================
1276
1277cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001278 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001279 arch: {
1280 arm: {
1281 srcs: ["arch-arm/bionic/__aeabi.c"],
1282 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001283 },
1284 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001285 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001286}
1287
1288// ========================================================
1289// libc_ndk.a
1290// Compatibility library for the NDK. This library contains
1291// all the parts of libc that are safe to statically link.
1292// We can't safely statically link things that can only run
1293// on a certain version of the OS. Examples include
1294// anything that talks to netd (a large portion of the DNS
1295// code) and anything that is dependent on the layout of a
1296// data structure that has changed across releases (such as
1297// pthread_t).
1298// ========================================================
1299
1300cc_library_static {
1301 name: "libc_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001302 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001303 srcs: libc_common_src_files + ["bionic/malloc_common.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001304 multilib: {
1305 lib32: {
1306 srcs: libc_common_src_files_32,
1307 },
1308 },
1309 arch: {
1310 arm: {
1311 srcs: [
1312 "arch-arm/bionic/exidx_dynamic.c",
1313 "arch-common/bionic/crtbegin_so.c",
1314 "arch-arm/bionic/atexit_legacy.c",
1315 "arch-common/bionic/crtend_so.S",
1316 ],
1317 whole_static_libs: ["libc_aeabi"],
1318 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001319 },
1320
Colin Cross50c21ab2015-10-31 23:03:05 -07001321 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001322 "-fvisibility=hidden",
1323 "-DLIBC_STATIC",
1324 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001325
1326 whole_static_libs: [
1327 "libc_bionic_ndk",
George Burgess IV6cb06872017-07-21 13:28:42 -07001328 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001329 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001330 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001331 "libc_gdtoa",
1332 "libc_malloc",
1333 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001334 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001335 "libc_openbsd_ndk",
1336 "libc_stack_protector",
1337 "libc_syscalls",
1338 "libc_tzcode",
1339 "libm",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001340 "libjemalloc5",
Elliott Hughes816fab92016-05-27 17:57:46 -07001341 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001342 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001343}
1344
1345// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001346// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001347// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001348cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001349 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001350 srcs: libc_common_src_files,
1351 multilib: {
1352 lib32: {
1353 srcs: libc_common_src_files_32,
1354 },
1355 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001356 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001357
1358 whole_static_libs: [
1359 "libc_bionic",
1360 "libc_bionic_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001361 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001362 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001363 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001364 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001365 "libc_gdtoa",
1366 "libc_malloc",
1367 "libc_netbsd",
1368 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001369 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001370 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001371 "libc_stack_protector",
1372 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001373 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001374 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001375 ],
1376
1377 arch: {
1378 arm: {
1379 whole_static_libs: ["libc_aeabi"],
1380 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001381 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001382}
1383
1384// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001385// libc_common.a
1386// ========================================================
1387
1388cc_library_static {
1389 defaults: ["libc_defaults"],
1390 name: "libc_common",
1391
1392 whole_static_libs: [
1393 "libc_nopthread",
1394 "libc_pthread",
1395 ],
1396}
1397
1398// ========================================================
Haibo Huangf71edfa2018-11-12 10:06:56 -08001399// libc_common_static.a For static binaries.
1400// ========================================================
1401cc_library_static {
1402 defaults: ["libc_defaults"],
1403 name: "libc_common_static",
1404
Haibo Huangb9244ff2018-08-11 10:12:13 -07001405 arch: {
1406 x86: {
1407 srcs: ["arch-x86/static_function_dispatch.S"],
1408 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001409 arm: {
1410 srcs: ["arch-arm/static_function_dispatch.S"],
1411 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001412 },
1413
Haibo Huangf71edfa2018-11-12 10:06:56 -08001414 whole_static_libs: [
1415 "libc_common",
1416 ],
1417}
1418
1419// ========================================================
1420// libc_common_shared.a For shared libraries.
1421// ========================================================
1422cc_library_static {
1423 defaults: ["libc_defaults"],
1424 name: "libc_common_shared",
1425
Haibo Huangb9244ff2018-08-11 10:12:13 -07001426 cflags: [
1427 "-fno-stack-protector",
1428 "-fno-jump-tables",
1429 ],
1430 arch: {
1431 x86: {
1432 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1433 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001434 arm: {
Haibo Huange4788d42018-12-11 20:28:02 -08001435 srcs: [
1436 "arch-arm/dynamic_function_dispatch.cpp",
1437
1438 // Workaround for b/120254692.
1439 "arch-arm/dynamic_function_wrapper.S",
1440 ],
Haibo Huangea9957a2018-11-19 11:00:32 -08001441 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001442 },
1443
Haibo Huangf71edfa2018-11-12 10:06:56 -08001444 whole_static_libs: [
1445 "libc_common",
1446 ],
1447}
1448
1449// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001450// libc_nomalloc.a
1451// ========================================================
1452//
1453// This is a version of the static C library that does not
1454// include malloc. It's useful in situations when the user wants
1455// to provide their own malloc implementation, or wants to
1456// explicitly disallow the use of malloc, such as in the
1457// dynamic linker.
1458
1459cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001460 name: "libc_nomalloc",
1461
Colin Cross50c21ab2015-10-31 23:03:05 -07001462 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001463
1464 arch: {
1465 arm: {
1466 srcs: ["arch-arm/bionic/exidx_static.c"],
1467 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001468 },
1469
Colin Cross50c21ab2015-10-31 23:03:05 -07001470 cflags: ["-DLIBC_STATIC"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001471
Colin Crossa3f9fca2016-01-11 13:20:55 -08001472 whole_static_libs: [
Haibo Huangf71edfa2018-11-12 10:06:56 -08001473 "libc_common_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001474 "libc_init_static",
1475 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001476}
1477
1478// ========================================================
1479// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1480// ========================================================
1481cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001482 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001483 srcs: ["bionic/jemalloc_wrapper.cpp"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001484 cflags: ["-fvisibility=hidden"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001485
Dan Willemsen208ae172015-09-16 16:33:27 -07001486 name: "libc_malloc",
Dan Willemsen208ae172015-09-16 16:33:27 -07001487}
1488
dimitryc0c0ef62018-12-05 16:33:52 +01001489filegroup {
1490 name: "libc_sources_shared",
1491 srcs: [
1492 "arch-common/bionic/crtbegin_so.c",
1493 "arch-common/bionic/crtbrand.S",
1494 "bionic/icu.cpp",
1495 "bionic/malloc_common.cpp",
1496 "bionic/NetdClient.cpp",
1497 "arch-common/bionic/crtend_so.S",
1498 ],
1499}
1500
1501filegroup {
1502 name: "libc_sources_static",
1503 srcs: [
1504 "bionic/dl_iterate_phdr_static.cpp",
1505 "bionic/malloc_common.cpp",
1506 ],
1507}
1508
1509filegroup {
1510 name: "libc_sources_shared_arm",
1511 srcs: [
1512 "arch-arm/bionic/exidx_dynamic.c",
1513 "arch-arm/bionic/atexit_legacy.c",
1514 ],
1515}
1516
1517filegroup {
1518 name: "libc_sources_static_arm",
1519 srcs: [ "arch-arm/bionic/exidx_static.c" ],
1520}
1521
Dan Willemsen208ae172015-09-16 16:33:27 -07001522// ========================================================
1523// libc.a + libc.so
1524// ========================================================
1525cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001526 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001527 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001528 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001529 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001530 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001531 platform_sdk_version: {
1532 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1533 },
1534 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001535 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001536 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001537 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001538 whole_static_libs: [
1539 "libc_init_static",
1540 "libc_common_static",
1541 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001542 },
1543 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001544 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001545 whole_static_libs: [
1546 "libc_init_dynamic",
1547 "libc_common_shared",
1548 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001549 },
1550
Jiyong Parka5f914a2019-01-20 21:02:00 +09001551 required: ["tzdata", "libc.mountpoint"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001552
1553 // Leave the symbols in the shared library so that stack unwinders can produce
1554 // meaningful name resolution.
Colin Cross37f36322016-04-25 14:09:13 -07001555 strip: {
1556 keep_symbols: true,
1557 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001558
Colin Cross4ce94d22016-11-15 13:15:43 -08001559 // Do not pack libc.so relocations; see http://b/20645321 for details.
1560 pack_relocations: false,
1561
dimitry06016f22018-01-05 11:39:28 +01001562 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1563 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1564 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1565 // those new libraries from libgcc.a are not declared external; if that were the case,
1566 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1567 // on the external symbols from the dependent libraries. That would create a "cloaked"
1568 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001569
dimitry06016f22018-01-05 11:39:28 +01001570 shared_libs: [
1571 "ld-android",
1572 "libdl",
1573 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001574 whole_static_libs: [
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001575 "libjemalloc5",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001576 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001577
1578 nocrt: true,
1579
Dan Willemsen208ae172015-09-16 16:33:27 -07001580 arch: {
1581 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001582 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001583 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001584 ldflags: ["-Wl,--hash-style=both"],
1585
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001586 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001587
Dan Willemsen208ae172015-09-16 16:33:27 -07001588 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001589 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001590 // special for arm
1591 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001592 },
1593 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001594 srcs: [":libc_sources_static_arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001595 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001596 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001597 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001598 version_script: ":libc.arm64.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001599 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001600 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001601 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001602 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001603 ldflags: ["-Wl,--hash-style=both"],
1604
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001605 version_script: ":libc.x86.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001606 },
1607 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001608 version_script: ":libc.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001609 },
1610 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001611
1612 stubs: {
1613 symbol_file: "libc.map.txt",
1614 versions: ["10000"],
1615 },
Vic Yang6903fb82019-01-14 11:34:39 -08001616
1617 symbol_ordering_file: "symbol_ordering",
Dan Willemsen208ae172015-09-16 16:33:27 -07001618}
1619
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001620genrule {
1621 name: "libc.arm.map",
1622 out: ["libc.arm.map"],
1623 srcs: ["libc.map.txt"],
1624 tool_files: [":bionic-generate-version-script"],
1625 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1626}
1627
1628genrule {
1629 name: "libc.arm64.map",
1630 out: ["libc.arm64.map"],
1631 srcs: ["libc.map.txt"],
1632 tool_files: [":bionic-generate-version-script"],
1633 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1634}
1635
1636genrule {
1637 name: "libc.x86.map",
1638 out: ["libc.x86.map"],
1639 srcs: ["libc.map.txt"],
1640 tool_files: [":bionic-generate-version-script"],
1641 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1642}
1643
1644genrule {
1645 name: "libc.x86_64.map",
1646 out: ["libc.x86_64.map"],
1647 srcs: ["libc.map.txt"],
1648 tool_files: [":bionic-generate-version-script"],
1649 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1650}
1651
Logan Chien17af91b2019-01-15 21:19:56 +08001652// libc_headers for libasync_safe and libpropertyinfoparser
1653cc_library_headers {
1654 name: "libc_headers",
1655
1656 host_supported: true,
1657 vendor_available: true,
1658 recovery_available: true,
1659
1660 no_libcrt: true,
1661 no_libgcc: true,
1662 stl: "none",
1663 system_shared_libs: [],
1664
1665 export_include_dirs: [
1666 "include",
1667 "kernel/uapi",
1668 "kernel/android/uapi",
1669 ],
1670
1671 arch: {
1672 arm: {
1673 export_include_dirs: [
1674 "kernel/uapi/asm-arm",
1675 ],
1676 },
1677 arm64: {
1678 export_include_dirs: [
1679 "kernel/uapi/asm-arm64",
1680 ],
1681 },
1682 mips: {
1683 export_include_dirs: [
1684 "kernel/uapi/asm-mips",
1685 ],
1686 },
1687 mips64: {
1688 export_include_dirs: [
1689 "kernel/uapi/asm-mips",
1690 ],
1691 },
1692 x86: {
1693 export_include_dirs: [
1694 "kernel/uapi/asm-x86",
1695 ],
1696 },
1697 x86_64: {
1698 export_include_dirs: [
1699 "kernel/uapi/asm-x86",
1700 ],
1701 },
1702 },
1703}
1704
Dan Willemsen208ae172015-09-16 16:33:27 -07001705// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001706// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001707// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001708
Dan Willemsen208ae172015-09-16 16:33:27 -07001709cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001710 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001711 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001712 srcs: [
1713 "bionic/__cxa_guard.cpp",
1714 "bionic/__cxa_pure_virtual.cpp",
1715 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001716 ],
1717 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001718 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001719 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001720
Dan Willemsen6b3be172018-12-03 13:57:20 -08001721 static: {
1722 system_shared_libs: [],
1723 },
1724 shared: {
1725 system_shared_libs: ["libc"],
1726 },
1727
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001728 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001729 arch: {
1730 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001731 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001732 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001733 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001734 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001735 },
1736 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001737 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001738 },
1739 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001740 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001741 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001742 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001743 },
1744 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001745 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001746 },
1747 },
1748}
1749
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001750genrule {
1751 name: "libstdc++.arm.map",
1752 out: ["libstdc++.arm.map"],
1753 srcs: ["libstdc++.map.txt"],
1754 tool_files: [":bionic-generate-version-script"],
1755 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1756}
1757
1758genrule {
1759 name: "libstdc++.arm64.map",
1760 out: ["libstdc++.arm64.map"],
1761 srcs: ["libstdc++.map.txt"],
1762 tool_files: [":bionic-generate-version-script"],
1763 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1764}
1765
1766genrule {
1767 name: "libstdc++.x86.map",
1768 out: ["libstdc++.x86.map"],
1769 srcs: ["libstdc++.map.txt"],
1770 tool_files: [":bionic-generate-version-script"],
1771 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1772}
1773
1774genrule {
1775 name: "libstdc++.x86_64.map",
1776 out: ["libstdc++.x86_64.map"],
1777 srcs: ["libstdc++.map.txt"],
1778 tool_files: [":bionic-generate-version-script"],
1779 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1780}
1781
1782// ========================================================
1783// crt object files.
1784// ========================================================
1785
Colin Cross50c21ab2015-10-31 23:03:05 -07001786cc_defaults {
1787 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001788 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001789 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001790 recovery_available: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001791
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001792 cflags: [
1793 "-Wno-gcc-compat",
1794 "-Wall",
1795 "-Werror",
1796 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001797}
1798
Colin Cross50c21ab2015-10-31 23:03:05 -07001799cc_defaults {
1800 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001801 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001802
1803 arch: {
1804 mips: {
1805 cflags: ["-fPIC"],
1806 },
1807 mips64: {
1808 cflags: ["-fPIC"],
1809 },
1810 x86: {
1811 cflags: ["-fPIC"],
1812 },
1813 x86_64: {
1814 cflags: ["-fPIC"],
1815 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001816 },
Colin Crossab179442018-09-27 11:03:22 -07001817 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001818}
1819
Dan Willemsen208ae172015-09-16 16:33:27 -07001820cc_object {
1821 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001822 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001823 local_include_dirs: ["include"],
1824 product_variables: {
1825 platform_sdk_version: {
1826 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1827 },
1828 },
1829 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001830
Colin Cross7d7b3682017-11-03 13:38:40 -07001831 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001832}
1833
Dan Willemsen208ae172015-09-16 16:33:27 -07001834cc_object {
1835 name: "crtbegin_so1",
1836 local_include_dirs: ["include"],
1837 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001838
Colin Cross7d7b3682017-11-03 13:38:40 -07001839 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001840}
1841
Dan Willemsen208ae172015-09-16 16:33:27 -07001842cc_object {
1843 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07001844
Colin Cross7d7b3682017-11-03 13:38:40 -07001845 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07001846 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001847 "crtbegin_so1",
1848 "crtbrand",
1849 ],
1850}
1851
Dan Willemsen208ae172015-09-16 16:33:27 -07001852cc_object {
1853 name: "crtend_so",
1854 local_include_dirs: ["include"],
1855 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001856
Colin Cross7d7b3682017-11-03 13:38:40 -07001857 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001858}
1859
Dan Willemsen208ae172015-09-16 16:33:27 -07001860cc_object {
1861 name: "crtbegin_static1",
1862 local_include_dirs: ["include"],
1863 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001864
Colin Cross50c21ab2015-10-31 23:03:05 -07001865 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001866 mips: {
1867 srcs: [
1868 "arch-mips/bionic/crtbegin.c",
1869 ],
1870 exclude_srcs: [
1871 "arch-common/bionic/crtbegin.c",
1872 ],
1873 },
1874 mips64: {
1875 srcs: [
1876 "arch-mips64/bionic/crtbegin.c",
1877 ],
1878 exclude_srcs: [
1879 "arch-common/bionic/crtbegin.c",
1880 ],
1881 },
1882 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001883
1884 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001885}
1886
Dan Willemsen208ae172015-09-16 16:33:27 -07001887cc_object {
1888 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07001889
Colin Cross77d57bf2016-04-11 14:34:18 -07001890 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001891 "crtbegin_static1",
1892 "crtbrand",
1893 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001894 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001895}
1896
Dan Willemsen208ae172015-09-16 16:33:27 -07001897cc_object {
1898 name: "crtbegin_dynamic1",
1899 local_include_dirs: ["include"],
1900 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001901
Colin Cross50c21ab2015-10-31 23:03:05 -07001902 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001903 mips: {
1904 srcs: [
1905 "arch-mips/bionic/crtbegin.c",
1906 ],
1907 exclude_srcs: [
1908 "arch-common/bionic/crtbegin.c",
1909 ],
1910 },
1911 mips64: {
1912 srcs: [
1913 "arch-mips64/bionic/crtbegin.c",
1914 ],
1915 exclude_srcs: [
1916 "arch-common/bionic/crtbegin.c",
1917 ],
1918 },
1919 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001920 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001921}
1922
Dan Willemsen208ae172015-09-16 16:33:27 -07001923cc_object {
1924 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07001925
Colin Cross77d57bf2016-04-11 14:34:18 -07001926 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001927 "crtbegin_dynamic1",
1928 "crtbrand",
1929 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07001930 target: {
1931 linux_bionic: {
1932 generated_sources: ["host_bionic_linker_asm"],
1933 objs: [
1934 "linker_wrapper",
1935 ],
1936 },
1937 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001938 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001939}
1940
Dan Willemsen208ae172015-09-16 16:33:27 -07001941cc_object {
1942 // We rename crtend.o to crtend_android.o to avoid a
1943 // name clash between gcc and bionic.
1944 name: "crtend_android",
1945 local_include_dirs: ["include"],
1946 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001947
Colin Cross50c21ab2015-10-31 23:03:05 -07001948 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001949}
Colin Crossbaa48992016-07-13 11:15:21 -07001950
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001951// ========================================================
1952// NDK headers.
1953// ========================================================
1954
Dan Albert26e1c412018-05-24 14:56:46 -07001955versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07001956 name: "common_libc",
1957 from: "include",
1958 to: "",
1959 license: "NOTICE",
1960}
Dan Albert4238a352016-06-28 11:18:05 -07001961
1962ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08001963 name: "libc_uapi",
1964 from: "kernel/uapi",
1965 to: "",
1966 srcs: [
1967 "kernel/uapi/asm-generic/**/*.h",
1968 "kernel/uapi/drm/**/*.h",
1969 "kernel/uapi/linux/**/*.h",
1970 "kernel/uapi/misc/**/*.h",
1971 "kernel/uapi/mtd/**/*.h",
1972 "kernel/uapi/rdma/**/*.h",
1973 "kernel/uapi/scsi/**/*.h",
1974 "kernel/uapi/sound/**/*.h",
1975 "kernel/uapi/video/**/*.h",
1976 "kernel/uapi/xen/**/*.h",
1977 ],
Dan Albert92592652016-10-20 01:42:54 -07001978 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07001979}
1980
1981ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07001982 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07001983 from: "kernel/android/uapi/linux",
1984 to: "linux",
1985 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07001986 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07001987}
1988
1989ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07001990 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07001991 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07001992 to: "scsi",
1993 srcs: ["kernel/android/scsi/**/*.h"],
1994 license: "NOTICE",
1995}
1996
1997ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07001998 name: "libc_asm_arm",
1999 from: "kernel/uapi/asm-arm",
2000 to: "arm-linux-androideabi",
2001 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002002 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002003}
2004
2005ndk_headers {
2006 name: "libc_asm_arm64",
2007 from: "kernel/uapi/asm-arm64",
2008 to: "aarch64-linux-android",
2009 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002010 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002011}
2012
Elliott Hughesee291c02017-12-11 11:32:34 -08002013// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002014ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002015 name: "libc_asm_mips",
2016 from: "kernel/uapi/asm-mips",
2017 to: "mipsel-linux-android",
2018 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2019 license: "NOTICE",
2020}
2021
Elliott Hughesee291c02017-12-11 11:32:34 -08002022// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002023ndk_headers {
2024 name: "libc_asm_mips64",
2025 from: "kernel/uapi/asm-mips",
2026 to: "mips64el-linux-android",
2027 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2028 license: "NOTICE",
2029}
2030
2031ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002032 name: "libc_asm_x86",
2033 from: "kernel/uapi/asm-x86",
2034 to: "i686-linux-android",
2035 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002036 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002037}
2038
2039ndk_headers {
2040 name: "libc_asm_x86_64",
2041 from: "kernel/uapi/asm-x86",
2042 to: "x86_64-linux-android",
2043 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002044 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002045}
2046
Dan Albert4238a352016-06-28 11:18:05 -07002047ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002048 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002049 symbol_file: "libc.map.txt",
2050 first_version: "9",
2051}
2052
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002053llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002054 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002055 symbol_file: "libc.map.txt",
2056 export_headers_as_system: true,
2057 export_preprocessed_headers: ["include"],
Logan Chien17af91b2019-01-15 21:19:56 +08002058 export_include_dirs: [
2059 "kernel/android/uapi",
2060 "kernel/uapi",
2061 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002062 arch: {
2063 arm: {
2064 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002065 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002066 ],
2067 },
2068 arm64: {
2069 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002070 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002071 ],
2072 },
2073 mips: {
2074 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002075 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002076 ],
2077 },
2078 mips64: {
2079 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002080 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002081 ],
2082 },
2083 x86: {
2084 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002085 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002086 ],
2087 },
2088 x86_64: {
2089 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002090 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002091 ],
2092 },
2093 },
2094}
2095
Dan Albertdf31aff2016-10-06 15:50:41 -07002096ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002097 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002098 symbol_file: "libstdc++.map.txt",
2099 first_version: "9",
2100}
2101
Dan Willemsenca056d72018-01-08 14:00:24 -08002102// Export these headers for toolbox to process
2103filegroup {
2104 name: "kernel_input_headers",
2105 srcs: [
2106 "kernel/uapi/linux/input.h",
2107 "kernel/uapi/linux/input-event-codes.h",
2108 ],
2109}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002110
2111// Generate a syscall name / number mapping. These objects are text files
2112// (thanks to the -dD -E flags) and not binary files. They will then be
2113// consumed by the genseccomp.py script and converted into C++ code.
2114cc_defaults {
2115 name: "libseccomp_gen_syscall_nrs_defaults",
2116 recovery_available: true,
2117 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2118 cflags: [
2119 "-dD",
2120 "-E",
2121 "-Wall",
2122 "-Werror",
2123 "-nostdinc",
2124 ],
2125}
2126
2127cc_object {
2128 name: "libseccomp_gen_syscall_nrs_arm",
2129 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2130 local_include_dirs: [
2131 "kernel/uapi/asm-arm",
2132 "kernel/uapi",
2133 ],
2134}
2135
2136cc_object {
2137 name: "libseccomp_gen_syscall_nrs_arm64",
2138 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2139 local_include_dirs: [
2140 "kernel/uapi/asm-arm64",
2141 "kernel/uapi",
2142 ],
2143}
2144
2145cc_object {
2146 name: "libseccomp_gen_syscall_nrs_x86",
2147 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2148 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2149 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2150 local_include_dirs: [
2151 "kernel/uapi/asm-x86",
2152 "kernel/uapi",
2153 ],
2154}
2155
2156cc_object {
2157 name: "libseccomp_gen_syscall_nrs_x86_64",
2158 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2159 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2160 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2161 local_include_dirs: [
2162 "kernel/uapi/asm-x86",
2163 "kernel/uapi",
2164 ],
2165}
2166
2167cc_object {
2168 name: "libseccomp_gen_syscall_nrs_mips",
2169 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2170 cflags: [
2171 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2172 ],
2173 local_include_dirs: [
2174 "kernel/uapi/asm-mips",
2175 "kernel/uapi",
2176 ],
2177}
2178
2179cc_object {
2180 name: "libseccomp_gen_syscall_nrs_mips64",
2181 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2182 cflags: [
2183 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2184 ],
2185 local_include_dirs: [
2186 "kernel/uapi/asm-mips",
2187 "kernel/uapi",
2188 ],
2189}
2190
2191// Generate the C++ policy sources for app, system, and global seccomp-bpf
2192// filters.
2193python_binary_host {
2194 name: "genseccomp",
2195 main: "tools/genseccomp.py",
2196
2197 srcs: [
2198 "tools/genseccomp.py",
2199 "tools/gensyscalls.py",
2200 ],
2201
2202 data: [
2203 "kernel/uapi/**/*.h",
2204 ],
2205
2206 version: {
2207 py2: {
2208 enabled: true,
2209 },
2210 py3: {
2211 enabled: false,
2212 },
2213 },
2214}
2215
Martijn Coenen0c6de752019-01-02 12:52:51 +01002216python_binary_host {
2217 name: "genfunctosyscallnrs",
2218 main: "tools/genfunctosyscallnrs.py",
2219
2220 srcs: [
2221 "tools/genseccomp.py",
2222 "tools/genfunctosyscallnrs.py",
2223 "tools/gensyscalls.py",
2224 ],
2225
2226 data: [
2227 "kernel/uapi/**/*.h",
2228 ],
2229
2230 version: {
2231 py2: {
2232 enabled: true,
2233 },
2234 py3: {
2235 enabled: false,
2236 },
2237 },
2238}
2239
2240cc_genrule {
2241 name: "func_to_syscall_nrs",
2242 recovery_available: true,
2243 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2244
2245 tools: [ "genfunctosyscallnrs" ],
2246
2247 srcs: [
2248 "SYSCALLS.TXT",
2249 ":libseccomp_gen_syscall_nrs_arm",
2250 ":libseccomp_gen_syscall_nrs_arm64",
2251 ":libseccomp_gen_syscall_nrs_mips",
2252 ":libseccomp_gen_syscall_nrs_mips64",
2253 ":libseccomp_gen_syscall_nrs_x86",
2254 ":libseccomp_gen_syscall_nrs_x86_64",
2255 ],
2256
2257 out: [
2258 "func_to_syscall_nrs.h",
2259 ],
2260}
2261
Martijn Coenenc3752be2019-01-09 16:19:57 +01002262// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2263genrule {
2264 name: "generate_app_zygote_blacklist",
2265 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2266 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2267 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2268}
2269
2270cc_genrule {
2271 name: "libseccomp_policy_app_zygote_sources",
2272 recovery_available: true,
2273 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2274
2275 tools: [ "genseccomp" ],
2276
2277 srcs: [
2278 "SYSCALLS.TXT",
2279 "SECCOMP_WHITELIST_COMMON.TXT",
2280 "SECCOMP_WHITELIST_APP.TXT",
2281 "SECCOMP_BLACKLIST_COMMON.TXT",
2282 ":generate_app_zygote_blacklist",
2283 ":libseccomp_gen_syscall_nrs_arm",
2284 ":libseccomp_gen_syscall_nrs_arm64",
2285 ":libseccomp_gen_syscall_nrs_mips",
2286 ":libseccomp_gen_syscall_nrs_mips64",
2287 ":libseccomp_gen_syscall_nrs_x86",
2288 ":libseccomp_gen_syscall_nrs_x86_64",
2289 ],
2290
2291 out: [
2292 "arm64_app_zygote_policy.cpp",
2293 "arm_app_zygote_policy.cpp",
2294 "mips64_app_zygote_policy.cpp",
2295 "mips_app_zygote_policy.cpp",
2296 "x86_64_app_zygote_policy.cpp",
2297 "x86_app_zygote_policy.cpp",
2298 ],
2299}
2300
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002301cc_genrule {
2302 name: "libseccomp_policy_app_sources",
2303 recovery_available: true,
2304 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2305
2306 tools: [ "genseccomp" ],
2307
2308 srcs: [
2309 "SYSCALLS.TXT",
2310 "SECCOMP_WHITELIST_COMMON.TXT",
2311 "SECCOMP_WHITELIST_APP.TXT",
2312 "SECCOMP_BLACKLIST_COMMON.TXT",
2313 "SECCOMP_BLACKLIST_APP.TXT",
2314 ":libseccomp_gen_syscall_nrs_arm",
2315 ":libseccomp_gen_syscall_nrs_arm64",
2316 ":libseccomp_gen_syscall_nrs_mips",
2317 ":libseccomp_gen_syscall_nrs_mips64",
2318 ":libseccomp_gen_syscall_nrs_x86",
2319 ":libseccomp_gen_syscall_nrs_x86_64",
2320 ],
2321
2322 out: [
2323 "arm64_app_policy.cpp",
2324 "arm_app_policy.cpp",
2325 "mips64_app_policy.cpp",
2326 "mips_app_policy.cpp",
2327 "x86_64_app_policy.cpp",
2328 "x86_app_policy.cpp",
2329 ],
2330}
2331
2332cc_genrule {
2333 name: "libseccomp_policy_system_sources",
2334 recovery_available: true,
2335 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2336
2337 tools: [ "genseccomp" ],
2338
2339 srcs: [
2340 "SYSCALLS.TXT",
2341 "SECCOMP_WHITELIST_COMMON.TXT",
2342 "SECCOMP_WHITELIST_SYSTEM.TXT",
2343 "SECCOMP_BLACKLIST_COMMON.TXT",
2344 ":libseccomp_gen_syscall_nrs_arm",
2345 ":libseccomp_gen_syscall_nrs_arm64",
2346 ":libseccomp_gen_syscall_nrs_mips",
2347 ":libseccomp_gen_syscall_nrs_mips64",
2348 ":libseccomp_gen_syscall_nrs_x86",
2349 ":libseccomp_gen_syscall_nrs_x86_64",
2350 ],
2351
2352 out: [
2353 "arm64_system_policy.cpp",
2354 "arm_system_policy.cpp",
2355 "mips64_system_policy.cpp",
2356 "mips_system_policy.cpp",
2357 "x86_64_system_policy.cpp",
2358 "x86_system_policy.cpp",
2359 ],
2360}
2361
2362cc_genrule {
2363 name: "libseccomp_policy_global_sources",
2364 recovery_available: true,
2365 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=global $(in)",
2366
2367 tools: [ "genseccomp" ],
2368
2369 srcs: [
2370 "SYSCALLS.TXT",
2371 "SECCOMP_WHITELIST_COMMON.TXT",
2372 "SECCOMP_WHITELIST_SYSTEM.TXT",
2373 "SECCOMP_WHITELIST_APP.TXT",
2374 "SECCOMP_WHITELIST_GLOBAL.TXT",
2375 "SECCOMP_BLACKLIST_COMMON.TXT",
2376 ":libseccomp_gen_syscall_nrs_arm",
2377 ":libseccomp_gen_syscall_nrs_arm64",
2378 ":libseccomp_gen_syscall_nrs_mips",
2379 ":libseccomp_gen_syscall_nrs_mips64",
2380 ":libseccomp_gen_syscall_nrs_x86",
2381 ":libseccomp_gen_syscall_nrs_x86_64",
2382 ],
2383
2384 out: [
2385 "arm64_global_policy.cpp",
2386 "arm_global_policy.cpp",
2387 "mips64_global_policy.cpp",
2388 "mips_global_policy.cpp",
2389 "x86_64_global_policy.cpp",
2390 "x86_global_policy.cpp",
2391 ],
2392}
2393
2394cc_library {
2395 name: "libseccomp_policy",
2396 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002397 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002398 generated_sources: [
2399 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002400 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002401 "libseccomp_policy_global_sources",
2402 "libseccomp_policy_system_sources",
2403 ],
2404
2405 srcs: [
2406 "seccomp/seccomp_policy.cpp",
2407 ],
2408
2409 export_include_dirs: ["seccomp/include"],
2410 cflags: [
2411 "-Wall",
2412 "-Werror",
2413 ],
2414 shared: {
2415 shared_libs: ["libbase"],
2416 },
2417 static: {
2418 static_libs: ["libbase"],
2419 },
2420}