blob: 4c5b0b39f4fd92cc3370ff4d43bdcc8e1d11946e [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// ANDROIDMK TRANSLATION ERROR: unsupported directive
85// ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
86//libc_common_cflags += ["-DDEBUG"]
87// ANDROIDMK TRANSLATION ERROR: unsupported directive
88// endif
89
Dan Willemsen208ae172015-09-16 16:33:27 -070090// ========================================================
91// libc_stack_protector.a - stack protector code
92// ========================================================
93//
Colin Crossa3f9fca2016-01-11 13:20:55 -080094// Code that implements the stack protector (or that runs
95// before TLS has been set up) needs to be compiled with
96// -fno-stack-protector, since it accesses the stack canary
97// TLS slot.
Dan Willemsen208ae172015-09-16 16:33:27 -070098
99cc_library_static {
100
Colin Crossa3f9fca2016-01-11 13:20:55 -0800101 srcs: [
102 "bionic/__libc_init_main_thread.cpp",
103 "bionic/__stack_chk_fail.cpp",
104 ],
105 arch: {
106 arm64: {
107 srcs: ["arch-arm64/bionic/__set_tls.c"],
108 },
109 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700110 srcs: [
111 "arch-x86/bionic/__libc_init_sysinfo.cpp",
112 "arch-x86/bionic/__set_tls.cpp",
113 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800114 },
115 x86_64: {
116 srcs: ["arch-x86_64/bionic/__set_tls.c"],
117 },
118 },
119
Colin Cross50c21ab2015-10-31 23:03:05 -0700120 defaults: ["libc_defaults"],
121 cflags: ["-fno-stack-protector"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700122 name: "libc_stack_protector",
Dan Willemsen208ae172015-09-16 16:33:27 -0700123}
124
Colin Crossa3f9fca2016-01-11 13:20:55 -0800125// libc_init_static.cpp also needs to be built without stack protector,
126// because it's responsible for setting up TLS for static executables.
127// This isn't the case for dynamic executables because the dynamic linker
128// has already set up the main thread's TLS.
129
130cc_library_static {
131 name: "libc_init_static",
132 defaults: ["libc_defaults"],
133 srcs: ["bionic/libc_init_static.cpp"],
134 cflags: ["-fno-stack-protector"],
135}
136
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700137cc_library_static {
138 name: "libc_init_dynamic",
139 defaults: ["libc_defaults"],
140 srcs: ["bionic/libc_init_dynamic.cpp"],
141 cflags: ["-fno-stack-protector"],
142}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800143
Dan Willemsen208ae172015-09-16 16:33:27 -0700144// ========================================================
145// libc_tzcode.a - upstream 'tzcode' code
146// ========================================================
147
148cc_library_static {
149
Colin Cross50c21ab2015-10-31 23:03:05 -0700150 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700151 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800152 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700153 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700154 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
155 ],
156
Colin Cross50c21ab2015-10-31 23:03:05 -0700157 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700158 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700159 // Don't use ridiculous amounts of stack.
160 "-DALL_STATE",
161 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
162 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800163 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700164 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700165 // The name of the tm_gmtoff field in our struct tm.
166 "-DTM_GMTOFF=tm_gmtoff",
167 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700168 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700169 // Include `tzname`, `timezone`, and `daylight` globals.
170 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700171 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800172 // Use the empty string (instead of " ") as the timezone abbreviation
173 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700174 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700175 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
176 "-Dlint",
177 ],
178
Dan Willemsen208ae172015-09-16 16:33:27 -0700179 local_include_dirs: ["tzcode/"],
180 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700181}
182
183// ========================================================
184// libc_dns.a - modified NetBSD DNS code
185// ========================================================
186
187cc_library_static {
188
Colin Cross50c21ab2015-10-31 23:03:05 -0700189 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700190 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800191 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700192
193 "upstream-netbsd/lib/libc/isc/ev_streams.c",
194 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700195 ],
196
Colin Cross50c21ab2015-10-31 23:03:05 -0700197 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700198 "-DANDROID_CHANGES",
199 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700200 "-Wno-unused-parameter",
201 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700202 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700203 ],
204
Dan Willemsen208ae172015-09-16 16:33:27 -0700205 local_include_dirs: [
206 "dns/include",
207 "private",
208 "upstream-netbsd/lib/libc/include",
209 "upstream-netbsd/android/include",
210 ],
211
212 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700213}
214
215// ========================================================
216// libc_freebsd.a - upstream FreeBSD C library code
217// ========================================================
218//
219// These files are built with the freebsd-compat.h header file
220// automatically included.
221
222cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700223 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700224 srcs: [
225 "upstream-freebsd/lib/libc/gen/ldexp.c",
226 "upstream-freebsd/lib/libc/gen/sleep.c",
227 "upstream-freebsd/lib/libc/gen/usleep.c",
228 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700229 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
230 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
231 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
232 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700233 "upstream-freebsd/lib/libc/stdlib/qsort.c",
234 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700235 "upstream-freebsd/lib/libc/string/wcpcpy.c",
236 "upstream-freebsd/lib/libc/string/wcpncpy.c",
237 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700238 "upstream-freebsd/lib/libc/string/wcscat.c",
239 "upstream-freebsd/lib/libc/string/wcschr.c",
240 "upstream-freebsd/lib/libc/string/wcscmp.c",
241 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700242 "upstream-freebsd/lib/libc/string/wcscspn.c",
243 "upstream-freebsd/lib/libc/string/wcsdup.c",
244 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700245 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700246 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
247 "upstream-freebsd/lib/libc/string/wcsncat.c",
248 "upstream-freebsd/lib/libc/string/wcsncmp.c",
249 "upstream-freebsd/lib/libc/string/wcsncpy.c",
250 "upstream-freebsd/lib/libc/string/wcsnlen.c",
251 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700252 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700253 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700254 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700255 "upstream-freebsd/lib/libc/string/wcstok.c",
256 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700257 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700258 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700259 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800260 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700261 ],
262 arch: {
263 arm64: {
264 exclude_srcs: [
265 "upstream-freebsd/lib/libc/string/wmemmove.c",
266 ],
267 },
268 x86: {
269 exclude_srcs: [
270 "upstream-freebsd/lib/libc/string/wcschr.c",
271 "upstream-freebsd/lib/libc/string/wcscmp.c",
272 "upstream-freebsd/lib/libc/string/wcslen.c",
273 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700274 "upstream-freebsd/lib/libc/string/wmemcmp.c",
275 "upstream-freebsd/lib/libc/string/wcscat.c",
276 "upstream-freebsd/lib/libc/string/wcscpy.c",
277 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700278 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700279 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700280 },
281
Colin Cross50c21ab2015-10-31 23:03:05 -0700282 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700283 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700284 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700285 "-include freebsd-compat.h",
286 ],
287
Dan Willemsen208ae172015-09-16 16:33:27 -0700288 local_include_dirs: [
289 "upstream-freebsd/android/include",
290 ],
291
292 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700293}
294
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700295cc_library_static {
296 defaults: ["libc_defaults"],
297 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700298 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700299 "upstream-freebsd/lib/libc/stdlib/realpath.c",
300 ],
301
302 cflags: [
303 "-Wno-sign-compare",
304 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700305 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700306 ],
307
308 local_include_dirs: [
309 "upstream-freebsd/android/include",
310 ],
311
312 name: "libc_freebsd_large_stack",
313}
314
Dan Willemsen208ae172015-09-16 16:33:27 -0700315// ========================================================
316// libc_netbsd.a - upstream NetBSD C library code
317// ========================================================
318//
319// These files are built with the netbsd-compat.h header file
320// automatically included.
321
322cc_library_static {
323
Colin Cross50c21ab2015-10-31 23:03:05 -0700324 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700325 srcs: [
326 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700327 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700328 "upstream-netbsd/lib/libc/gen/psignal.c",
329 "upstream-netbsd/lib/libc/gen/utime.c",
330 "upstream-netbsd/lib/libc/gen/utmp.c",
331 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
332 "upstream-netbsd/lib/libc/regex/regcomp.c",
333 "upstream-netbsd/lib/libc/regex/regerror.c",
334 "upstream-netbsd/lib/libc/regex/regexec.c",
335 "upstream-netbsd/lib/libc/regex/regfree.c",
336 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
337 "upstream-netbsd/lib/libc/stdlib/div.c",
338 "upstream-netbsd/lib/libc/stdlib/drand48.c",
339 "upstream-netbsd/lib/libc/stdlib/erand48.c",
340 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
341 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
342 "upstream-netbsd/lib/libc/stdlib/ldiv.c",
343 "upstream-netbsd/lib/libc/stdlib/lldiv.c",
344 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
345 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
346 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
347 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
348 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
349 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
350 "upstream-netbsd/lib/libc/stdlib/seed48.c",
351 "upstream-netbsd/lib/libc/stdlib/srand48.c",
352 "upstream-netbsd/lib/libc/string/memccpy.c",
353 "upstream-netbsd/lib/libc/string/strcasestr.c",
354 "upstream-netbsd/lib/libc/string/strcoll.c",
355 "upstream-netbsd/lib/libc/string/strxfrm.c",
356 ],
357 multilib: {
358 lib32: {
359 // LP32 cruft
360 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
361 },
362 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700363 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700364 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800365 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700366 "-DPOSIX_MISTAKE",
367 "-include netbsd-compat.h",
368 ],
369
Dan Willemsen208ae172015-09-16 16:33:27 -0700370 local_include_dirs: [
371 "upstream-netbsd/android/include",
372 "upstream-netbsd/lib/libc/include",
373 ],
374
375 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700376}
377
378// ========================================================
379// libc_openbsd_ndk.a - upstream OpenBSD C library code
380// that can be safely included in the libc_ndk.a (doesn't
381// contain any troublesome global data or constructors).
382// ========================================================
383//
384// These files are built with the openbsd-compat.h header file
385// automatically included.
386
387cc_library_static {
388 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700389 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700390 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700391 "upstream-openbsd/lib/libc/gen/alarm.c",
392 "upstream-openbsd/lib/libc/gen/ctype_.c",
393 "upstream-openbsd/lib/libc/gen/daemon.c",
394 "upstream-openbsd/lib/libc/gen/err.c",
395 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700396 "upstream-openbsd/lib/libc/gen/fnmatch.c",
397 "upstream-openbsd/lib/libc/gen/ftok.c",
398 "upstream-openbsd/lib/libc/gen/getprogname.c",
399 "upstream-openbsd/lib/libc/gen/isctype.c",
400 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700401 "upstream-openbsd/lib/libc/gen/tolower_.c",
402 "upstream-openbsd/lib/libc/gen/toupper_.c",
403 "upstream-openbsd/lib/libc/gen/verr.c",
404 "upstream-openbsd/lib/libc/gen/verrx.c",
405 "upstream-openbsd/lib/libc/gen/vwarn.c",
406 "upstream-openbsd/lib/libc/gen/vwarnx.c",
407 "upstream-openbsd/lib/libc/gen/warn.c",
408 "upstream-openbsd/lib/libc/gen/warnx.c",
409 "upstream-openbsd/lib/libc/locale/btowc.c",
410 "upstream-openbsd/lib/libc/locale/mbrlen.c",
411 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
412 "upstream-openbsd/lib/libc/locale/mbtowc.c",
413 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700414 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
415 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700416 "upstream-openbsd/lib/libc/locale/wcstoll.c",
417 "upstream-openbsd/lib/libc/locale/wcstombs.c",
418 "upstream-openbsd/lib/libc/locale/wcstoul.c",
419 "upstream-openbsd/lib/libc/locale/wcstoull.c",
420 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
421 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
422 "upstream-openbsd/lib/libc/locale/wctob.c",
423 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700424 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700425 "upstream-openbsd/lib/libc/net/htonl.c",
426 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700427 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
428 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
429 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700430 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
431 "upstream-openbsd/lib/libc/net/inet_ntop.c",
432 "upstream-openbsd/lib/libc/net/inet_pton.c",
433 "upstream-openbsd/lib/libc/net/ntohl.c",
434 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800435 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700436 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700437 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
438 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700439 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700440 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700441 "upstream-openbsd/lib/libc/stdio/fputwc.c",
442 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700443 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700444 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700445 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700446 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700447 "upstream-openbsd/lib/libc/stdio/makebuf.c",
448 "upstream-openbsd/lib/libc/stdio/mktemp.c",
449 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
450 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700451 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700452 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700453 "upstream-openbsd/lib/libc/stdio/tempnam.c",
454 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
455 "upstream-openbsd/lib/libc/stdio/ungetc.c",
456 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
457 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
458 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700459 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
460 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
461 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700462 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700463 "upstream-openbsd/lib/libc/stdio/wsetup.c",
464 "upstream-openbsd/lib/libc/stdlib/abs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700465 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700466 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700467 "upstream-openbsd/lib/libc/stdlib/insque.c",
468 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
469 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
470 "upstream-openbsd/lib/libc/stdlib/labs.c",
471 "upstream-openbsd/lib/libc/stdlib/llabs.c",
472 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700473 "upstream-openbsd/lib/libc/stdlib/remque.c",
474 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700475 "upstream-openbsd/lib/libc/stdlib/tfind.c",
476 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
477 "upstream-openbsd/lib/libc/string/strcasecmp.c",
478 "upstream-openbsd/lib/libc/string/strcspn.c",
479 "upstream-openbsd/lib/libc/string/strdup.c",
480 "upstream-openbsd/lib/libc/string/strndup.c",
481 "upstream-openbsd/lib/libc/string/strpbrk.c",
482 "upstream-openbsd/lib/libc/string/strsep.c",
483 "upstream-openbsd/lib/libc/string/strspn.c",
484 "upstream-openbsd/lib/libc/string/strstr.c",
485 "upstream-openbsd/lib/libc/string/strtok.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700486 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700487 "upstream-openbsd/lib/libc/string/wcswidth.c",
488 ],
489
Colin Cross50c21ab2015-10-31 23:03:05 -0700490 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700491 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700492 "-Wno-unused-parameter",
493 "-include openbsd-compat.h",
494 ],
495
Dan Willemsen208ae172015-09-16 16:33:27 -0700496 local_include_dirs: [
497 "private",
498 "stdio",
499 "upstream-openbsd/android/include",
500 "upstream-openbsd/lib/libc/include",
501 "upstream-openbsd/lib/libc/gdtoa/",
502 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700503}
504
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700505cc_library_static {
506 name: "libc_openbsd_large_stack",
507 defaults: ["libc_defaults"],
508 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700509 "stdio/vfprintf.cpp",
510 "stdio/vfwprintf.cpp",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700511 ],
512 cflags: [
513 "-include openbsd-compat.h",
514 "-Wno-sign-compare",
515 "-Wframe-larger-than=5000",
516 ],
517
518 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700519 "upstream-openbsd/android/include/",
520 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700521 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700522 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700523 ],
524}
525
Dan Willemsen208ae172015-09-16 16:33:27 -0700526// ========================================================
527// libc_openbsd.a - upstream OpenBSD C library code
528// ========================================================
529//
530// These files are built with the openbsd-compat.h header file
531// automatically included.
532cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700533 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700534 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800535 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700536 "upstream-openbsd/lib/libc/crypt/arc4random.c",
537 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
538
539 // May be overriden by per-arch optimized versions
540 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700541 "upstream-openbsd/lib/libc/string/memrchr.c",
542 "upstream-openbsd/lib/libc/string/stpcpy.c",
543 "upstream-openbsd/lib/libc/string/stpncpy.c",
544 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/string/strcpy.c",
546 "upstream-openbsd/lib/libc/string/strlcat.c",
547 "upstream-openbsd/lib/libc/string/strlcpy.c",
548 "upstream-openbsd/lib/libc/string/strncat.c",
549 "upstream-openbsd/lib/libc/string/strncmp.c",
550 "upstream-openbsd/lib/libc/string/strncpy.c",
551 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700552
553 arch: {
554 arm: {
555 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700556 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800557 "upstream-openbsd/lib/libc/string/stpcpy.c",
558 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700559 ],
560 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700561 arm64: {
562 exclude_srcs: [
563 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700564 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700565 "upstream-openbsd/lib/libc/string/strcpy.c",
566 "upstream-openbsd/lib/libc/string/strncmp.c",
567 ],
568 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530569 mips: {
570 exclude_srcs: [
571 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530572 "upstream-openbsd/lib/libc/string/strcpy.c",
573 "upstream-openbsd/lib/libc/string/strncmp.c",
574 ],
575 },
576 mips64: {
577 exclude_srcs: [
578 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530579 "upstream-openbsd/lib/libc/string/strcpy.c",
580 "upstream-openbsd/lib/libc/string/strncmp.c",
581 ],
582 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700583 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800584 exclude_srcs: [
585 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800586 "upstream-openbsd/lib/libc/string/memrchr.c",
587 "upstream-openbsd/lib/libc/string/stpcpy.c",
588 "upstream-openbsd/lib/libc/string/stpncpy.c",
589 "upstream-openbsd/lib/libc/string/strcat.c",
590 "upstream-openbsd/lib/libc/string/strcpy.c",
591 "upstream-openbsd/lib/libc/string/strncmp.c",
592 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700593 "upstream-openbsd/lib/libc/string/strlcat.c",
594 "upstream-openbsd/lib/libc/string/strlcpy.c",
595 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800596 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700597 },
598
599 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800600 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800601 "upstream-openbsd/lib/libc/string/stpcpy.c",
602 "upstream-openbsd/lib/libc/string/stpncpy.c",
603 "upstream-openbsd/lib/libc/string/strcat.c",
604 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800605 "upstream-openbsd/lib/libc/string/strncat.c",
606 "upstream-openbsd/lib/libc/string/strncmp.c",
607 "upstream-openbsd/lib/libc/string/strncpy.c",
608 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700609 },
610 },
611
Colin Cross50c21ab2015-10-31 23:03:05 -0700612 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700613 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700614 "-Wno-unused-parameter",
615 "-include openbsd-compat.h",
616 ],
617
Dan Willemsen208ae172015-09-16 16:33:27 -0700618 local_include_dirs: [
619 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700620 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700621 ],
622
623 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700624}
625
626// ========================================================
627// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
628// ========================================================
629//
630// These files are built with the openbsd-compat.h header file
631// automatically included.
632
633cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700634 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700635 srcs: [
636 "upstream-openbsd/android/gdtoa_support.cpp",
637 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
638 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
639 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
640 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
641 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
642 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
643 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
644 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
645 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
646 "upstream-openbsd/lib/libc/gdtoa/misc.c",
647 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
648 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
649 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
650 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
651 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
652 "upstream-openbsd/lib/libc/gdtoa/sum.c",
653 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
654 ],
655 multilib: {
656 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800657 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700658 },
659 },
660
Colin Cross50c21ab2015-10-31 23:03:05 -0700661 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700662 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700663 "-include openbsd-compat.h",
664 ],
665
Dan Willemsen208ae172015-09-16 16:33:27 -0700666 local_include_dirs: [
667 "private",
668 "upstream-openbsd/android/include",
669 "upstream-openbsd/lib/libc/include",
670 ],
671
672 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700673}
674
675// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700676// libc_fortify.a - container for our FORITFY
677// implementation details
678// ========================================================
679cc_library_static {
680 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700681 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700682
683 name: "libc_fortify",
684
685 // Disable FORTIFY for the compilation of these, so we don't end up having
686 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800687 cflags: [
688 "-U_FORTIFY_SOURCE",
689 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
690 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700691
692 arch: {
693 arm: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700694 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700695 srcs: [
696 "arch-arm/generic/bionic/__memcpy_chk.S",
697 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800698 neon: {
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800699 cflags: [
700 "-DNO___STRCAT_CHK",
701 "-DNO___STRCPY_CHK",
702 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700703 srcs: [
704 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
705 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
706 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700707 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800708 cortex_a7: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700709 srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800710 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
711 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
712 ],
713 exclude_srcs: [
George Burgess IV6cb06872017-07-21 13:28:42 -0700714 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
715 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
716 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700717 },
718 cortex_a9: {
719 srcs: [
720 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
721 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
722 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800723 exclude_srcs: [
724 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
725 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
726 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700727 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800728 krait: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700729 srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800730 "arch-arm/krait/bionic/__strcat_chk.S",
731 "arch-arm/krait/bionic/__strcpy_chk.S",
732 ],
733 exclude_srcs: [
734 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
735 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
736 ],
737 },
738 cortex_a53: {
739 srcs: [
740 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
741 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
742 ],
743 exclude_srcs: [
George Burgess IV6cb06872017-07-21 13:28:42 -0700744 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
745 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
746 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700747 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700748 cortex_a55: {
749 srcs: [
750 "arch-arm/denver/bionic/__strcat_chk.S",
751 "arch-arm/denver/bionic/__strcpy_chk.S",
752 ],
753 exclude_srcs: [
754 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
755 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
756 ],
757 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700758 cortex_a73: {
759 srcs: [
760 "arch-arm/denver/bionic/__strcat_chk.S",
761 "arch-arm/denver/bionic/__strcpy_chk.S",
762 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800763 exclude_srcs: [
764 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
765 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
766 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700767 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700768 cortex_a75: {
769 srcs: [
770 "arch-arm/denver/bionic/__strcat_chk.S",
771 "arch-arm/denver/bionic/__strcpy_chk.S",
772 ],
773 exclude_srcs: [
774 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
775 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
776 ],
777 },
Haibo Huangbc4f4112018-10-10 13:46:48 -0700778 cortex_a76: {
779 srcs: [
780 "arch-arm/denver/bionic/__strcat_chk.S",
781 "arch-arm/denver/bionic/__strcpy_chk.S",
782 ],
783 exclude_srcs: [
784 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
785 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
786 ],
787 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700788 denver: {
789 srcs: [
790 "arch-arm/denver/bionic/__strcat_chk.S",
791 "arch-arm/denver/bionic/__strcpy_chk.S",
792 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800793 exclude_srcs: [
794 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
795 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
796 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700797 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800798 kryo: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700799 srcs: [
800 "arch-arm/krait/bionic/__strcat_chk.S",
801 "arch-arm/krait/bionic/__strcpy_chk.S",
802 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800803 exclude_srcs: [
804 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
805 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700806 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700807 },
808 },
809 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700810 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700811 srcs: [
812 "arch-arm64/generic/bionic/__memcpy_chk.S",
813 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700814 },
815 },
816}
817
818// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700819// libc_bionic.a - home-grown C library code
820// ========================================================
821
822cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700823 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700824 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700825 // The data that backs getauxval is initialized in the libc init
826 // functions which are invoked by the linker. If this file is included
827 // in libc_ndk.a, only one of the copies of the global data will be
828 // initialized, resulting in nullptr dereferences.
829 "bionic/getauxval.cpp",
830
Elliott Hughes211c4d32018-02-02 15:10:32 -0800831 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700832 "bionic/sysconf.cpp",
833 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700834 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700835
Josh Gao10ec9282017-04-03 15:13:29 -0700836 // The following must not be statically linked into libc_ndk.a, because
837 // debuggerd will look for the abort message in libc.so's copy.
838 "bionic/android_set_abort_message.cpp",
839
Dan Willemsen208ae172015-09-16 16:33:27 -0700840 "bionic/strchr.cpp",
841 "bionic/strnlen.c",
842 "bionic/strrchr.cpp",
843 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700844
845 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700846 arm: {
847 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800848 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700849 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800850 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800851 "arch-arm/generic/bionic/stpcpy.c",
852 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800853 "arch-arm/generic/bionic/strcmp.S",
854 "arch-arm/generic/bionic/strcpy.S",
855 "arch-arm/generic/bionic/strlen.c",
856
Dan Willemsen208ae172015-09-16 16:33:27 -0700857 "arch-arm/bionic/atomics_arm.c",
858 "arch-arm/bionic/__bionic_clone.S",
859 "arch-arm/bionic/_exit_with_stack_teardown.S",
860 "arch-arm/bionic/libgcc_compat.c",
861 "arch-arm/bionic/popcount_tab.c",
862 "arch-arm/bionic/__restore.S",
863 "arch-arm/bionic/setjmp.S",
864 "arch-arm/bionic/syscall.S",
865 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800866
867 "arch-arm/cortex-a15/bionic/memcpy.S",
868 "arch-arm/cortex-a15/bionic/memmove.S",
869 "arch-arm/cortex-a15/bionic/memset.S",
870 "arch-arm/cortex-a15/bionic/stpcpy.S",
871 "arch-arm/cortex-a15/bionic/strcat.S",
872 "arch-arm/cortex-a15/bionic/strcmp.S",
873 "arch-arm/cortex-a15/bionic/strcpy.S",
874 "arch-arm/cortex-a15/bionic/strlen.S",
875
876 "arch-arm/cortex-a7/bionic/memcpy.S",
877 "arch-arm/cortex-a7/bionic/memmove.S",
878 "arch-arm/cortex-a7/bionic/memset.S",
879
880 "arch-arm/cortex-a9/bionic/memcpy.S",
881 "arch-arm/cortex-a9/bionic/memmove.S",
882 "arch-arm/cortex-a9/bionic/memset.S",
883 "arch-arm/cortex-a9/bionic/stpcpy.S",
884 "arch-arm/cortex-a9/bionic/strcat.S",
885 "arch-arm/cortex-a9/bionic/strcmp.S",
886 "arch-arm/cortex-a9/bionic/strcpy.S",
887 "arch-arm/cortex-a9/bionic/strlen.S",
888
889 "arch-arm/krait/bionic/memcpy.S",
890 "arch-arm/krait/bionic/memmove.S",
891 "arch-arm/krait/bionic/memset.S",
892 "arch-arm/krait/bionic/strcmp.S",
893
894 "arch-arm/cortex-a53/bionic/memcpy.S",
895 "arch-arm/cortex-a53/bionic/memmove.S",
896
897 "arch-arm/denver/bionic/memcpy.S",
898 "arch-arm/denver/bionic/memmove.S",
899 "arch-arm/denver/bionic/memset.S",
900
901 "arch-arm/kryo/bionic/memcpy.S",
902 "arch-arm/kryo/bionic/memmove.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700903 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700904 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700905 arm64: {
906 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700907 "arch-arm64/generic/bionic/memchr.S",
908 "arch-arm64/generic/bionic/memcmp.S",
909 "arch-arm64/generic/bionic/memcpy.S",
910 "arch-arm64/generic/bionic/memmove.S",
911 "arch-arm64/generic/bionic/memset.S",
912 "arch-arm64/generic/bionic/stpcpy.S",
913 "arch-arm64/generic/bionic/strchr.S",
914 "arch-arm64/generic/bionic/strcmp.S",
915 "arch-arm64/generic/bionic/strcpy.S",
916 "arch-arm64/generic/bionic/strlen.S",
917 "arch-arm64/generic/bionic/strncmp.S",
918 "arch-arm64/generic/bionic/strnlen.S",
919 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800920
921 "arch-arm64/bionic/__bionic_clone.S",
922 "arch-arm64/bionic/_exit_with_stack_teardown.S",
923 "arch-arm64/bionic/setjmp.S",
924 "arch-arm64/bionic/syscall.S",
925 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700926 ],
927 exclude_srcs: [
928 "bionic/__memcpy_chk.cpp",
929 "bionic/strchr.cpp",
930 "bionic/strnlen.c",
931 ],
Colin Cross6ab8f892015-11-23 14:12:15 -0800932 denver64: {
933 srcs: [
934 "arch-arm64/denver64/bionic/memcpy.S",
Haibo Huangece43e12018-05-26 13:07:43 -0700935 "arch-arm64/denver64/bionic/memmove.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800936 "arch-arm64/denver64/bionic/memset.S",
937 ],
938 exclude_srcs: [
939 "arch-arm64/generic/bionic/memcpy.S",
Haibo Huangece43e12018-05-26 13:07:43 -0700940 "arch-arm64/generic/bionic/memmove.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800941 "arch-arm64/generic/bionic/memset.S",
942 ],
943 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700944 },
945
946 mips: {
947 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800948 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530949 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800950 "arch-mips/string/memset.S",
951 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530952 "arch-mips/string/strncmp.S",
953 "arch-mips/string/strlen.c",
954 "arch-mips/string/strnlen.c",
955 "arch-mips/string/strchr.c",
956 "arch-mips/string/strcpy.c",
957 "arch-mips/string/memchr.c",
958 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800959
Dan Willemsen208ae172015-09-16 16:33:27 -0700960 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700961 "arch-mips/bionic/cacheflush.cpp",
962 "arch-mips/bionic/_exit_with_stack_teardown.S",
Dan Willemsen879cec22016-02-29 10:37:56 -0800963 "arch-mips/bionic/libgcc_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700964 "arch-mips/bionic/setjmp.S",
965 "arch-mips/bionic/syscall.S",
966 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700967 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530968 exclude_srcs: [
969 "bionic/strchr.cpp",
970 "bionic/strnlen.c",
971 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700972 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700973 mips64: {
974 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800975 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530976 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800977 "arch-mips/string/memset.S",
978 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530979 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800980 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530981 "arch-mips/string/strnlen.c",
982 "arch-mips/string/strchr.c",
983 "arch-mips/string/strcpy.c",
984 "arch-mips/string/memchr.c",
985 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800986
Dan Willemsen208ae172015-09-16 16:33:27 -0700987 "arch-mips64/bionic/__bionic_clone.S",
988 "arch-mips64/bionic/_exit_with_stack_teardown.S",
989 "arch-mips64/bionic/setjmp.S",
990 "arch-mips64/bionic/syscall.S",
991 "arch-mips64/bionic/vfork.S",
992 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700993 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530994 exclude_srcs: [
995 "bionic/strchr.cpp",
996 "bionic/strnlen.c",
997 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700998 },
999
1000 x86: {
1001 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001002 "arch-x86/generic/string/memcmp.S",
1003 "arch-x86/generic/string/strcmp.S",
1004 "arch-x86/generic/string/strncmp.S",
1005 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001006
1007 "arch-x86/generic/string/strlcat.c",
1008 "arch-x86/generic/string/strlcpy.c",
1009 "arch-x86/generic/string/strncat.c",
1010 "arch-x86/generic/string/wcscat.c",
1011 "arch-x86/generic/string/wcscpy.c",
1012 "arch-x86/generic/string/wmemcmp.c",
1013
Dan Willemsen208ae172015-09-16 16:33:27 -07001014 "arch-x86/atom/string/sse2-memchr-atom.S",
1015 "arch-x86/atom/string/sse2-memrchr-atom.S",
1016 "arch-x86/atom/string/sse2-strchr-atom.S",
1017 "arch-x86/atom/string/sse2-strnlen-atom.S",
1018 "arch-x86/atom/string/sse2-strrchr-atom.S",
1019 "arch-x86/atom/string/sse2-wcschr-atom.S",
1020 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
1021 "arch-x86/atom/string/sse2-wcslen-atom.S",
1022 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001023 "arch-x86/silvermont/string/sse2-memmove-slm.S",
1024 "arch-x86/silvermont/string/sse2-memset-slm.S",
1025 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
1026 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
1027 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
1028 "arch-x86/silvermont/string/sse2-strlen-slm.S",
1029 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001030
1031 "arch-x86/bionic/__bionic_clone.S",
1032 "arch-x86/bionic/_exit_with_stack_teardown.S",
1033 "arch-x86/bionic/libgcc_compat.c",
1034 "arch-x86/bionic/__restore.S",
1035 "arch-x86/bionic/setjmp.S",
1036 "arch-x86/bionic/syscall.S",
1037 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001038
1039 // ssse3 functions
1040 "arch-x86/atom/string/ssse3-strcat-atom.S",
1041 "arch-x86/atom/string/ssse3-strcmp-atom.S",
1042 "arch-x86/atom/string/ssse3-strlcat-atom.S",
1043 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
1044 "arch-x86/atom/string/ssse3-strncat-atom.S",
1045 "arch-x86/atom/string/ssse3-strncmp-atom.S",
1046 "arch-x86/atom/string/ssse3-wcscat-atom.S",
1047 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
1048
1049 // sse4 functions
1050 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
1051 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
1052
1053 // atom functions
1054 "arch-x86/atom/string/sse2-memset-atom.S",
1055 "arch-x86/atom/string/sse2-strlen-atom.S",
1056 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -08001057 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001058 "arch-x86/atom/string/ssse3-strcpy-atom.S",
1059 "arch-x86/atom/string/ssse3-strncpy-atom.S",
1060 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001061 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001062
1063 exclude_srcs: [
1064 "bionic/strchr.cpp",
1065 "bionic/strnlen.c",
1066 "bionic/strrchr.cpp",
1067 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001068 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001069 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001070 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001071 "arch-x86_64/string/sse2-memmove-slm.S",
1072 "arch-x86_64/string/sse2-memset-slm.S",
1073 "arch-x86_64/string/sse2-stpcpy-slm.S",
1074 "arch-x86_64/string/sse2-stpncpy-slm.S",
1075 "arch-x86_64/string/sse2-strcat-slm.S",
1076 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001077 "arch-x86_64/string/sse2-strlen-slm.S",
1078 "arch-x86_64/string/sse2-strncat-slm.S",
1079 "arch-x86_64/string/sse2-strncpy-slm.S",
1080 "arch-x86_64/string/sse4-memcmp-slm.S",
1081 "arch-x86_64/string/ssse3-strcmp-slm.S",
1082 "arch-x86_64/string/ssse3-strncmp-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001083
1084 "arch-x86_64/bionic/__bionic_clone.S",
1085 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1086 "arch-x86_64/bionic/__restore_rt.S",
1087 "arch-x86_64/bionic/setjmp.S",
1088 "arch-x86_64/bionic/syscall.S",
1089 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001090 ],
1091 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001092 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001093
Colin Cross50c21ab2015-10-31 23:03:05 -07001094 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001095 include_dirs: ["bionic/libstdc++/include"],
1096 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001097}
1098
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001099genrule {
1100 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001101 out: ["generated_android_ids.h"],
1102 srcs: [":android_filesystem_config_header"],
1103 tool_files: ["fs_config_generator.py"],
1104 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001105}
1106
Dan Willemsen268a6732015-10-15 14:49:45 -07001107// ========================================================
1108// libc_bionic_ndk.a- The portions of libc_bionic that can
1109// be safely used in libc_ndk.a (no troublesome global data
1110// or constructors).
1111// ========================================================
1112cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001113 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001114 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001115 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001116 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001117 "bionic/__cmsg_nxthdr.cpp",
1118 "bionic/__errno.cpp",
1119 "bionic/__gnu_basename.cpp",
1120 "bionic/__libc_current_sigrtmax.cpp",
1121 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001122 "bionic/abort.cpp",
1123 "bionic/accept.cpp",
1124 "bionic/accept4.cpp",
1125 "bionic/access.cpp",
1126 "bionic/arpa_inet.cpp",
1127 "bionic/assert.cpp",
1128 "bionic/atof.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001129 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001130 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001131 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001132 "bionic/bionic_systrace.cpp",
1133 "bionic/bionic_time_conversions.cpp",
1134 "bionic/brk.cpp",
1135 "bionic/c16rtomb.cpp",
1136 "bionic/c32rtomb.cpp",
1137 "bionic/chmod.cpp",
1138 "bionic/chown.cpp",
1139 "bionic/clearenv.cpp",
1140 "bionic/clock.cpp",
1141 "bionic/clock_getcpuclockid.cpp",
1142 "bionic/clock_nanosleep.cpp",
1143 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001144 "bionic/connect.cpp",
1145 "bionic/ctype.cpp",
1146 "bionic/dirent.cpp",
1147 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001148 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001149 "bionic/error.cpp",
1150 "bionic/eventfd_read.cpp",
1151 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001152 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001153 "bionic/faccessat.cpp",
1154 "bionic/fchmod.cpp",
1155 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001156 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001157 "bionic/ffs.cpp",
1158 "bionic/fgetxattr.cpp",
1159 "bionic/flistxattr.cpp",
1160 "bionic/flockfile.cpp",
1161 "bionic/fpclassify.cpp",
1162 "bionic/fsetxattr.cpp",
1163 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001164 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001165 "bionic/futimens.cpp",
1166 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001167 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001168 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001169 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001170 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001171 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001172 "bionic/getpgrp.cpp",
1173 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001174 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001175 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001176 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001177 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001178 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001179 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001180 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001181 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001182 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001183 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001184 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001185 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001186 "bionic/lchown.cpp",
1187 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001188 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001189 "bionic/libgen.cpp",
1190 "bionic/link.cpp",
1191 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001192 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001193 "bionic/lstat.cpp",
1194 "bionic/malloc_info.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001195 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001196 "bionic/mbrtoc16.cpp",
1197 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001198 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001199 "bionic/mempcpy.cpp",
1200 "bionic/mkdir.cpp",
1201 "bionic/mkfifo.cpp",
1202 "bionic/mknod.cpp",
1203 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001204 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001205 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001206 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001207 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001208 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001209 "bionic/open.cpp",
1210 "bionic/pathconf.cpp",
1211 "bionic/pause.cpp",
1212 "bionic/pipe.cpp",
1213 "bionic/poll.cpp",
1214 "bionic/posix_fadvise.cpp",
1215 "bionic/posix_fallocate.cpp",
1216 "bionic/posix_madvise.cpp",
1217 "bionic/posix_timers.cpp",
1218 "bionic/ptrace.cpp",
1219 "bionic/pty.cpp",
1220 "bionic/raise.cpp",
1221 "bionic/rand.cpp",
1222 "bionic/readlink.cpp",
1223 "bionic/reboot.cpp",
1224 "bionic/recv.cpp",
1225 "bionic/rename.cpp",
1226 "bionic/rmdir.cpp",
1227 "bionic/scandir.cpp",
1228 "bionic/sched_getaffinity.cpp",
1229 "bionic/sched_getcpu.cpp",
1230 "bionic/semaphore.cpp",
1231 "bionic/send.cpp",
1232 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001233 "bionic/seteuid.cpp",
1234 "bionic/setpgrp.cpp",
1235 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001236 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001237 "bionic/sigprocmask.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001238 "bionic/socket.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001239 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001240 "bionic/stat.cpp",
1241 "bionic/statvfs.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001242 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001243 "bionic/strchrnul.cpp",
1244 "bionic/strerror.cpp",
1245 "bionic/strerror_r.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001246 "bionic/string_l.cpp",
1247 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001248 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001249 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001250 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001251 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001252 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001253 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001254 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001255 "bionic/sys_msg.cpp",
1256 "bionic/sys_sem.cpp",
1257 "bionic/sys_shm.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001258 "bionic/sys_siglist.c",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001259 "bionic/sys_signalfd.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001260 "bionic/sys_signame.c",
Elliott Hughes449eff02016-06-08 19:51:20 -07001261 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001262 "bionic/sysinfo.cpp",
1263 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001264 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001265 "bionic/system_property_api.cpp",
1266 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001267 "bionic/tdestroy.cpp",
1268 "bionic/termios.cpp",
1269 "bionic/thread_private.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001270 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001271 "bionic/tmpfile.cpp",
1272 "bionic/umount.cpp",
1273 "bionic/unlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001274 "bionic/wait.cpp",
1275 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001276 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001277 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001278 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001279 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001280 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001281
1282 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1283 // which will be overridden by the actual one in libc.so.
1284 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001285 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001286
Dan Willemsen208ae172015-09-16 16:33:27 -07001287 multilib: {
1288 lib32: {
1289 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001290 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001291 },
1292 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001293 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001294 treble_linker_namespaces: {
1295 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001296 },
1297 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001298 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001299 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001300 local_include_dirs: ["stdio"],
1301 include_dirs: ["bionic/libstdc++/include"],
1302 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001303 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001304}
1305
Dan Willemsen208ae172015-09-16 16:33:27 -07001306// ========================================================
1307// libc_pthread.a - pthreads parts that previously lived in
1308// libc_bionic.a. Relocated to their own library because
1309// they can't be included in libc_ndk.a (as they layout of
1310// pthread_t has changed over the years and has ABI
1311// compatibility issues).
1312// ========================================================
1313
1314cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001315 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001316 srcs: [
1317 "bionic/pthread_atfork.cpp",
1318 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001319 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001320 "bionic/pthread_cond.cpp",
1321 "bionic/pthread_create.cpp",
1322 "bionic/pthread_detach.cpp",
1323 "bionic/pthread_equal.cpp",
1324 "bionic/pthread_exit.cpp",
1325 "bionic/pthread_getcpuclockid.cpp",
1326 "bionic/pthread_getschedparam.cpp",
1327 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001328 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001329 "bionic/pthread_join.cpp",
1330 "bionic/pthread_key.cpp",
1331 "bionic/pthread_kill.cpp",
1332 "bionic/pthread_mutex.cpp",
1333 "bionic/pthread_once.cpp",
1334 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001335 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001336 "bionic/pthread_self.cpp",
1337 "bionic/pthread_setname_np.cpp",
1338 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001339 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001340
1341 // The following implementations depend on pthread data or implementation,
1342 // so we can't include them in libc_ndk.a.
1343 "bionic/__cxa_thread_atexit_impl.cpp",
1344 "stdlib/atexit.c",
1345 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001346 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001347
Colin Cross50c21ab2015-10-31 23:03:05 -07001348 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001349 include_dirs: ["bionic/libstdc++/include"],
1350 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001351}
1352
1353// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001354// libc_syscalls.a
1355// ========================================================
1356
1357cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001358 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001359 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001360 arch: {
1361 arm: {
1362 srcs: ["arch-arm/syscalls/**/*.S"],
1363 },
1364 arm64: {
1365 srcs: ["arch-arm64/syscalls/**/*.S"],
1366 },
1367 mips: {
1368 srcs: ["arch-mips/syscalls/**/*.S"],
1369 },
1370 mips64: {
1371 srcs: ["arch-mips64/syscalls/**/*.S"],
1372 },
1373 x86: {
1374 srcs: ["arch-x86/syscalls/**/*.S"],
1375 },
1376 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001377 srcs: ["arch-x86_64/syscalls/**/*.S"],
1378 },
1379 },
1380 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001381}
1382
1383// ========================================================
1384// libc_aeabi.a
1385// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1386// to avoid infinite recursion. For the other architectures we just build an
1387// empty library to keep this makefile simple.
1388// ========================================================
1389
1390cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001391 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001392 arch: {
1393 arm: {
1394 srcs: ["arch-arm/bionic/__aeabi.c"],
1395 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001396 },
1397 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001398 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001399}
1400
1401// ========================================================
1402// libc_ndk.a
1403// Compatibility library for the NDK. This library contains
1404// all the parts of libc that are safe to statically link.
1405// We can't safely statically link things that can only run
1406// on a certain version of the OS. Examples include
1407// anything that talks to netd (a large portion of the DNS
1408// code) and anything that is dependent on the layout of a
1409// data structure that has changed across releases (such as
1410// pthread_t).
1411// ========================================================
1412
1413cc_library_static {
1414 name: "libc_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001415 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001416 srcs: libc_common_src_files + ["bionic/malloc_common.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001417 multilib: {
1418 lib32: {
1419 srcs: libc_common_src_files_32,
1420 },
1421 },
1422 arch: {
1423 arm: {
1424 srcs: [
1425 "arch-arm/bionic/exidx_dynamic.c",
1426 "arch-common/bionic/crtbegin_so.c",
1427 "arch-arm/bionic/atexit_legacy.c",
1428 "arch-common/bionic/crtend_so.S",
1429 ],
1430 whole_static_libs: ["libc_aeabi"],
1431 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001432 },
1433
Colin Cross50c21ab2015-10-31 23:03:05 -07001434 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001435 "-fvisibility=hidden",
1436 "-DLIBC_STATIC",
1437 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001438
1439 whole_static_libs: [
1440 "libc_bionic_ndk",
George Burgess IV6cb06872017-07-21 13:28:42 -07001441 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001442 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001443 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001444 "libc_gdtoa",
1445 "libc_malloc",
1446 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001447 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001448 "libc_openbsd_ndk",
1449 "libc_stack_protector",
1450 "libc_syscalls",
1451 "libc_tzcode",
1452 "libm",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001453 "libjemalloc5",
Elliott Hughes816fab92016-05-27 17:57:46 -07001454 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001455 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001456}
1457
1458// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001459// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001460// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001461cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001462 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001463 srcs: libc_common_src_files,
1464 multilib: {
1465 lib32: {
1466 srcs: libc_common_src_files_32,
1467 },
1468 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001469 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001470
1471 whole_static_libs: [
1472 "libc_bionic",
1473 "libc_bionic_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001474 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001475 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001476 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001477 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001478 "libc_gdtoa",
1479 "libc_malloc",
1480 "libc_netbsd",
1481 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001482 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001483 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001484 "libc_stack_protector",
1485 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001486 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001487 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001488 ],
1489
1490 arch: {
1491 arm: {
1492 whole_static_libs: ["libc_aeabi"],
1493 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001494 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001495}
1496
1497// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001498// libc_common.a
1499// ========================================================
1500
1501cc_library_static {
1502 defaults: ["libc_defaults"],
1503 name: "libc_common",
1504
1505 whole_static_libs: [
1506 "libc_nopthread",
1507 "libc_pthread",
1508 ],
1509}
1510
1511// ========================================================
Haibo Huangf71edfa2018-11-12 10:06:56 -08001512// libc_common_static.a For static binaries.
1513// ========================================================
1514cc_library_static {
1515 defaults: ["libc_defaults"],
1516 name: "libc_common_static",
1517
Haibo Huangb9244ff2018-08-11 10:12:13 -07001518 arch: {
1519 x86: {
1520 srcs: ["arch-x86/static_function_dispatch.S"],
1521 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001522 arm: {
1523 srcs: ["arch-arm/static_function_dispatch.S"],
1524 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001525 },
1526
Haibo Huangf71edfa2018-11-12 10:06:56 -08001527 whole_static_libs: [
1528 "libc_common",
1529 ],
1530}
1531
1532// ========================================================
1533// libc_common_shared.a For shared libraries.
1534// ========================================================
1535cc_library_static {
1536 defaults: ["libc_defaults"],
1537 name: "libc_common_shared",
1538
Haibo Huangb9244ff2018-08-11 10:12:13 -07001539 cflags: [
1540 "-fno-stack-protector",
1541 "-fno-jump-tables",
1542 ],
1543 arch: {
1544 x86: {
1545 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1546 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001547 arm: {
1548 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
1549 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001550 },
1551
Haibo Huangf71edfa2018-11-12 10:06:56 -08001552 whole_static_libs: [
1553 "libc_common",
1554 ],
1555}
1556
1557// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001558// libc_nomalloc.a
1559// ========================================================
1560//
1561// This is a version of the static C library that does not
1562// include malloc. It's useful in situations when the user wants
1563// to provide their own malloc implementation, or wants to
1564// explicitly disallow the use of malloc, such as in the
1565// dynamic linker.
1566
1567cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001568 name: "libc_nomalloc",
1569
Colin Cross50c21ab2015-10-31 23:03:05 -07001570 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001571
1572 arch: {
1573 arm: {
1574 srcs: ["arch-arm/bionic/exidx_static.c"],
1575 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001576 },
1577
Colin Cross50c21ab2015-10-31 23:03:05 -07001578 cflags: ["-DLIBC_STATIC"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001579
Colin Crossa3f9fca2016-01-11 13:20:55 -08001580 whole_static_libs: [
Haibo Huangf71edfa2018-11-12 10:06:56 -08001581 "libc_common_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001582 "libc_init_static",
1583 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001584}
1585
1586// ========================================================
1587// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1588// ========================================================
1589cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001590 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001591 srcs: ["bionic/jemalloc_wrapper.cpp"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001592 cflags: ["-fvisibility=hidden"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001593
Dan Willemsen208ae172015-09-16 16:33:27 -07001594 name: "libc_malloc",
Dan Willemsen208ae172015-09-16 16:33:27 -07001595}
1596
1597// ========================================================
1598// libc.a + libc.so
1599// ========================================================
1600cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001601 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001602 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001603 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001604 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001605 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001606 platform_sdk_version: {
1607 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1608 },
1609 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001610 static: {
1611 srcs: [
1612 "bionic/dl_iterate_phdr_static.cpp",
Dan Willemsen0c657082016-05-12 01:43:07 -07001613 "bionic/malloc_common.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001614 ],
1615 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001616 whole_static_libs: [
1617 "libc_init_static",
1618 "libc_common_static",
1619 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001620 },
1621 shared: {
1622 srcs: [
1623 "arch-common/bionic/crtbegin_so.c",
1624 "arch-common/bionic/crtbrand.S",
Elliott Hughesa57ca0d2016-11-17 18:18:08 -08001625 "bionic/icu.cpp",
Dan Willemsen0c657082016-05-12 01:43:07 -07001626 "bionic/malloc_common.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001627 "bionic/NetdClient.cpp",
1628 "arch-common/bionic/crtend_so.S",
1629 ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001630 whole_static_libs: [
1631 "libc_init_dynamic",
1632 "libc_common_shared",
1633 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001634 },
1635
1636 required: ["tzdata"],
1637
1638 // Leave the symbols in the shared library so that stack unwinders can produce
1639 // meaningful name resolution.
Colin Cross37f36322016-04-25 14:09:13 -07001640 strip: {
1641 keep_symbols: true,
1642 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001643
Colin Cross4ce94d22016-11-15 13:15:43 -08001644 // Do not pack libc.so relocations; see http://b/20645321 for details.
1645 pack_relocations: false,
1646
dimitry06016f22018-01-05 11:39:28 +01001647 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1648 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1649 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1650 // those new libraries from libgcc.a are not declared external; if that were the case,
1651 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1652 // on the external symbols from the dependent libraries. That would create a "cloaked"
1653 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001654
dimitry06016f22018-01-05 11:39:28 +01001655 shared_libs: [
1656 "ld-android",
1657 "libdl",
1658 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001659 whole_static_libs: [
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001660 "libjemalloc5",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001661 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001662
1663 nocrt: true,
1664
Dan Willemsen208ae172015-09-16 16:33:27 -07001665 arch: {
1666 arm: {
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001667 //TODO: This is to work around b/24465209. Remove after root cause is fixed
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001668 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001669 ldflags: ["-Wl,--hash-style=both"],
1670
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001671 // Don't re-export new/delete and friends, even if the compiler really wants to.
1672 version_script: "libc.arm.map",
1673
Dan Willemsen208ae172015-09-16 16:33:27 -07001674 shared: {
Dan Willemsen0c657082016-05-12 01:43:07 -07001675 srcs: [
1676 "arch-arm/bionic/exidx_dynamic.c",
1677
1678 // special for arm
1679 "arch-arm/bionic/atexit_legacy.c",
1680 ],
1681 // special for arm
1682 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001683 },
1684 static: {
1685 srcs: ["arch-arm/bionic/exidx_static.c"],
1686 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001687 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001688 arm64: {
1689 // Don't re-export new/delete and friends, even if the compiler really wants to.
1690 version_script: "libc.arm64.map",
1691 },
1692 mips: {
1693 // Don't re-export new/delete and friends, even if the compiler really wants to.
1694 version_script: "libc.mips.map",
1695 },
1696 mips64: {
1697 // Don't re-export new/delete and friends, even if the compiler really wants to.
1698 version_script: "libc.mips64.map",
1699 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001700 x86: {
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001701 //TODO: This is to work around b/24465209. Remove after root cause is fixed
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001702 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001703 ldflags: ["-Wl,--hash-style=both"],
1704
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001705 // Don't re-export new/delete and friends, even if the compiler really wants to.
1706 version_script: "libc.x86.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001707 },
1708 x86_64: {
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001709 // Don't re-export new/delete and friends, even if the compiler really wants to.
1710 version_script: "libc.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001711 },
1712 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001713}
1714
Dan Willemsen208ae172015-09-16 16:33:27 -07001715// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001716// libstdc++.so + libstdc++.a
1717// ========================================================
1718cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001719 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001720 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001721 srcs: [
1722 "bionic/__cxa_guard.cpp",
1723 "bionic/__cxa_pure_virtual.cpp",
1724 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001725 ],
1726 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001727 static_ndk_lib: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001728 system_shared_libs: ["libc"],
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001729 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001730
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001731 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001732 arch: {
1733 arm: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001734 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001735 ldflags: ["-Wl,--hash-style=both"],
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001736 version_script: "libstdc++.arm.map",
1737 },
1738 arm64: {
1739 version_script: "libstdc++.arm64.map",
1740 },
1741 mips: {
1742 version_script: "libstdc++.mips.map",
1743 },
1744 mips64: {
1745 version_script: "libstdc++.mips64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001746 },
1747 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001748 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001749 ldflags: ["-Wl,--hash-style=both"],
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001750 version_script: "libstdc++.x86.map",
1751 },
1752 x86_64: {
1753 version_script: "libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001754 },
1755 },
1756}
1757
Colin Cross50c21ab2015-10-31 23:03:05 -07001758cc_defaults {
1759 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001760 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001761 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001762 recovery_available: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001763
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001764 cflags: [
1765 "-Wno-gcc-compat",
1766 "-Wall",
1767 "-Werror",
1768 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001769}
1770
Colin Cross50c21ab2015-10-31 23:03:05 -07001771cc_defaults {
1772 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001773 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001774
1775 arch: {
1776 mips: {
1777 cflags: ["-fPIC"],
1778 },
1779 mips64: {
1780 cflags: ["-fPIC"],
1781 },
1782 x86: {
1783 cflags: ["-fPIC"],
1784 },
1785 x86_64: {
1786 cflags: ["-fPIC"],
1787 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001788 },
Colin Crossab179442018-09-27 11:03:22 -07001789 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001790}
1791
Dan Willemsena3ed9012017-04-04 15:51:26 -07001792// crt obj files
Dan Willemsen208ae172015-09-16 16:33:27 -07001793cc_object {
1794 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001795 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001796 local_include_dirs: ["include"],
1797 product_variables: {
1798 platform_sdk_version: {
1799 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1800 },
1801 },
1802 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001803
Colin Cross7d7b3682017-11-03 13:38:40 -07001804 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001805}
1806
Dan Willemsen208ae172015-09-16 16:33:27 -07001807cc_object {
1808 name: "crtbegin_so1",
1809 local_include_dirs: ["include"],
1810 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001811
Colin Cross7d7b3682017-11-03 13:38:40 -07001812 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001813}
1814
Dan Willemsen208ae172015-09-16 16:33:27 -07001815cc_object {
1816 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07001817
Colin Cross7d7b3682017-11-03 13:38:40 -07001818 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07001819 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001820 "crtbegin_so1",
1821 "crtbrand",
1822 ],
1823}
1824
Dan Willemsen208ae172015-09-16 16:33:27 -07001825cc_object {
1826 name: "crtend_so",
1827 local_include_dirs: ["include"],
1828 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001829
Colin Cross7d7b3682017-11-03 13:38:40 -07001830 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001831}
1832
Dan Willemsen208ae172015-09-16 16:33:27 -07001833cc_object {
1834 name: "crtbegin_static1",
1835 local_include_dirs: ["include"],
1836 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001837
Colin Cross50c21ab2015-10-31 23:03:05 -07001838 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001839 mips: {
1840 srcs: [
1841 "arch-mips/bionic/crtbegin.c",
1842 ],
1843 exclude_srcs: [
1844 "arch-common/bionic/crtbegin.c",
1845 ],
1846 },
1847 mips64: {
1848 srcs: [
1849 "arch-mips64/bionic/crtbegin.c",
1850 ],
1851 exclude_srcs: [
1852 "arch-common/bionic/crtbegin.c",
1853 ],
1854 },
1855 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001856
1857 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001858}
1859
Dan Willemsen208ae172015-09-16 16:33:27 -07001860cc_object {
1861 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07001862
Colin Cross77d57bf2016-04-11 14:34:18 -07001863 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001864 "crtbegin_static1",
1865 "crtbrand",
1866 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001867 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001868}
1869
Dan Willemsen208ae172015-09-16 16:33:27 -07001870cc_object {
1871 name: "crtbegin_dynamic1",
1872 local_include_dirs: ["include"],
1873 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001874
Colin Cross50c21ab2015-10-31 23:03:05 -07001875 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001876 mips: {
1877 srcs: [
1878 "arch-mips/bionic/crtbegin.c",
1879 ],
1880 exclude_srcs: [
1881 "arch-common/bionic/crtbegin.c",
1882 ],
1883 },
1884 mips64: {
1885 srcs: [
1886 "arch-mips64/bionic/crtbegin.c",
1887 ],
1888 exclude_srcs: [
1889 "arch-common/bionic/crtbegin.c",
1890 ],
1891 },
1892 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001893 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001894}
1895
Dan Willemsen208ae172015-09-16 16:33:27 -07001896cc_object {
1897 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07001898
Colin Cross77d57bf2016-04-11 14:34:18 -07001899 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001900 "crtbegin_dynamic1",
1901 "crtbrand",
1902 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07001903 target: {
1904 linux_bionic: {
1905 generated_sources: ["host_bionic_linker_asm"],
1906 objs: [
1907 "linker_wrapper",
1908 ],
1909 },
1910 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001911 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001912}
1913
Dan Willemsen208ae172015-09-16 16:33:27 -07001914cc_object {
1915 // We rename crtend.o to crtend_android.o to avoid a
1916 // name clash between gcc and bionic.
1917 name: "crtend_android",
1918 local_include_dirs: ["include"],
1919 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001920
Colin Cross50c21ab2015-10-31 23:03:05 -07001921 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001922}
Colin Crossbaa48992016-07-13 11:15:21 -07001923
Dan Albert26e1c412018-05-24 14:56:46 -07001924versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07001925 name: "common_libc",
1926 from: "include",
1927 to: "",
1928 license: "NOTICE",
1929}
Dan Albert4238a352016-06-28 11:18:05 -07001930
1931ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08001932 name: "libc_uapi",
1933 from: "kernel/uapi",
1934 to: "",
1935 srcs: [
1936 "kernel/uapi/asm-generic/**/*.h",
1937 "kernel/uapi/drm/**/*.h",
1938 "kernel/uapi/linux/**/*.h",
1939 "kernel/uapi/misc/**/*.h",
1940 "kernel/uapi/mtd/**/*.h",
1941 "kernel/uapi/rdma/**/*.h",
1942 "kernel/uapi/scsi/**/*.h",
1943 "kernel/uapi/sound/**/*.h",
1944 "kernel/uapi/video/**/*.h",
1945 "kernel/uapi/xen/**/*.h",
1946 ],
Dan Albert92592652016-10-20 01:42:54 -07001947 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07001948}
1949
1950ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07001951 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07001952 from: "kernel/android/uapi/linux",
1953 to: "linux",
1954 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07001955 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07001956}
1957
1958ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07001959 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07001960 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07001961 to: "scsi",
1962 srcs: ["kernel/android/scsi/**/*.h"],
1963 license: "NOTICE",
1964}
1965
1966ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07001967 name: "libc_asm_arm",
1968 from: "kernel/uapi/asm-arm",
1969 to: "arm-linux-androideabi",
1970 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07001971 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07001972}
1973
1974ndk_headers {
1975 name: "libc_asm_arm64",
1976 from: "kernel/uapi/asm-arm64",
1977 to: "aarch64-linux-android",
1978 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07001979 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07001980}
1981
Elliott Hughesee291c02017-12-11 11:32:34 -08001982// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07001983ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01001984 name: "libc_asm_mips",
1985 from: "kernel/uapi/asm-mips",
1986 to: "mipsel-linux-android",
1987 srcs: ["kernel/uapi/asm-mips/**/*.h"],
1988 license: "NOTICE",
1989}
1990
Elliott Hughesee291c02017-12-11 11:32:34 -08001991// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01001992ndk_headers {
1993 name: "libc_asm_mips64",
1994 from: "kernel/uapi/asm-mips",
1995 to: "mips64el-linux-android",
1996 srcs: ["kernel/uapi/asm-mips/**/*.h"],
1997 license: "NOTICE",
1998}
1999
2000ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002001 name: "libc_asm_x86",
2002 from: "kernel/uapi/asm-x86",
2003 to: "i686-linux-android",
2004 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002005 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002006}
2007
2008ndk_headers {
2009 name: "libc_asm_x86_64",
2010 from: "kernel/uapi/asm-x86",
2011 to: "x86_64-linux-android",
2012 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002013 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002014}
2015
Dan Albert4238a352016-06-28 11:18:05 -07002016ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002017 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002018 symbol_file: "libc.map.txt",
2019 first_version: "9",
2020}
2021
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002022llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002023 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002024 symbol_file: "libc.map.txt",
2025 export_headers_as_system: true,
2026 export_preprocessed_headers: ["include"],
2027 arch: {
2028 arm: {
2029 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002030 "kernel/uapi",
2031 "kernel/uapi/asm-arm",
2032 "kernel/android/uapi",
2033 ],
2034 },
2035 arm64: {
2036 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002037 "kernel/uapi",
2038 "kernel/uapi/asm-arm64",
2039 "kernel/android/uapi",
2040 ],
2041 },
2042 mips: {
2043 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002044 "kernel/uapi",
2045 "kernel/uapi/asm-mips",
2046 "kernel/android/uapi",
2047 ],
2048 },
2049 mips64: {
2050 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002051 "kernel/uapi",
2052 "kernel/uapi/asm-mips",
2053 "kernel/android/uapi",
2054 ],
2055 },
2056 x86: {
2057 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002058 "kernel/uapi",
2059 "kernel/uapi/asm-x86",
2060 "kernel/android/uapi",
2061 ],
2062 },
2063 x86_64: {
2064 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002065 "kernel/uapi",
2066 "kernel/uapi/asm-x86",
2067 "kernel/android/uapi",
2068 ],
2069 },
2070 },
2071}
2072
Dan Albertdf31aff2016-10-06 15:50:41 -07002073ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002074 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002075 symbol_file: "libstdc++.map.txt",
2076 first_version: "9",
2077}
2078
Dan Willemsenca056d72018-01-08 14:00:24 -08002079// Export these headers for toolbox to process
2080filegroup {
2081 name: "kernel_input_headers",
2082 srcs: [
2083 "kernel/uapi/linux/input.h",
2084 "kernel/uapi/linux/input-event-codes.h",
2085 ],
2086}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002087
2088// Generate a syscall name / number mapping. These objects are text files
2089// (thanks to the -dD -E flags) and not binary files. They will then be
2090// consumed by the genseccomp.py script and converted into C++ code.
2091cc_defaults {
2092 name: "libseccomp_gen_syscall_nrs_defaults",
2093 recovery_available: true,
2094 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2095 cflags: [
2096 "-dD",
2097 "-E",
2098 "-Wall",
2099 "-Werror",
2100 "-nostdinc",
2101 ],
2102}
2103
2104cc_object {
2105 name: "libseccomp_gen_syscall_nrs_arm",
2106 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2107 local_include_dirs: [
2108 "kernel/uapi/asm-arm",
2109 "kernel/uapi",
2110 ],
2111}
2112
2113cc_object {
2114 name: "libseccomp_gen_syscall_nrs_arm64",
2115 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2116 local_include_dirs: [
2117 "kernel/uapi/asm-arm64",
2118 "kernel/uapi",
2119 ],
2120}
2121
2122cc_object {
2123 name: "libseccomp_gen_syscall_nrs_x86",
2124 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2125 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2126 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2127 local_include_dirs: [
2128 "kernel/uapi/asm-x86",
2129 "kernel/uapi",
2130 ],
2131}
2132
2133cc_object {
2134 name: "libseccomp_gen_syscall_nrs_x86_64",
2135 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2136 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2137 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2138 local_include_dirs: [
2139 "kernel/uapi/asm-x86",
2140 "kernel/uapi",
2141 ],
2142}
2143
2144cc_object {
2145 name: "libseccomp_gen_syscall_nrs_mips",
2146 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2147 cflags: [
2148 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2149 ],
2150 local_include_dirs: [
2151 "kernel/uapi/asm-mips",
2152 "kernel/uapi",
2153 ],
2154}
2155
2156cc_object {
2157 name: "libseccomp_gen_syscall_nrs_mips64",
2158 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2159 cflags: [
2160 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2161 ],
2162 local_include_dirs: [
2163 "kernel/uapi/asm-mips",
2164 "kernel/uapi",
2165 ],
2166}
2167
2168// Generate the C++ policy sources for app, system, and global seccomp-bpf
2169// filters.
2170python_binary_host {
2171 name: "genseccomp",
2172 main: "tools/genseccomp.py",
2173
2174 srcs: [
2175 "tools/genseccomp.py",
2176 "tools/gensyscalls.py",
2177 ],
2178
2179 data: [
2180 "kernel/uapi/**/*.h",
2181 ],
2182
2183 version: {
2184 py2: {
2185 enabled: true,
2186 },
2187 py3: {
2188 enabled: false,
2189 },
2190 },
2191}
2192
2193cc_genrule {
2194 name: "libseccomp_policy_app_sources",
2195 recovery_available: true,
2196 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2197
2198 tools: [ "genseccomp" ],
2199
2200 srcs: [
2201 "SYSCALLS.TXT",
2202 "SECCOMP_WHITELIST_COMMON.TXT",
2203 "SECCOMP_WHITELIST_APP.TXT",
2204 "SECCOMP_BLACKLIST_COMMON.TXT",
2205 "SECCOMP_BLACKLIST_APP.TXT",
2206 ":libseccomp_gen_syscall_nrs_arm",
2207 ":libseccomp_gen_syscall_nrs_arm64",
2208 ":libseccomp_gen_syscall_nrs_mips",
2209 ":libseccomp_gen_syscall_nrs_mips64",
2210 ":libseccomp_gen_syscall_nrs_x86",
2211 ":libseccomp_gen_syscall_nrs_x86_64",
2212 ],
2213
2214 out: [
2215 "arm64_app_policy.cpp",
2216 "arm_app_policy.cpp",
2217 "mips64_app_policy.cpp",
2218 "mips_app_policy.cpp",
2219 "x86_64_app_policy.cpp",
2220 "x86_app_policy.cpp",
2221 ],
2222}
2223
2224cc_genrule {
2225 name: "libseccomp_policy_system_sources",
2226 recovery_available: true,
2227 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2228
2229 tools: [ "genseccomp" ],
2230
2231 srcs: [
2232 "SYSCALLS.TXT",
2233 "SECCOMP_WHITELIST_COMMON.TXT",
2234 "SECCOMP_WHITELIST_SYSTEM.TXT",
2235 "SECCOMP_BLACKLIST_COMMON.TXT",
2236 ":libseccomp_gen_syscall_nrs_arm",
2237 ":libseccomp_gen_syscall_nrs_arm64",
2238 ":libseccomp_gen_syscall_nrs_mips",
2239 ":libseccomp_gen_syscall_nrs_mips64",
2240 ":libseccomp_gen_syscall_nrs_x86",
2241 ":libseccomp_gen_syscall_nrs_x86_64",
2242 ],
2243
2244 out: [
2245 "arm64_system_policy.cpp",
2246 "arm_system_policy.cpp",
2247 "mips64_system_policy.cpp",
2248 "mips_system_policy.cpp",
2249 "x86_64_system_policy.cpp",
2250 "x86_system_policy.cpp",
2251 ],
2252}
2253
2254cc_genrule {
2255 name: "libseccomp_policy_global_sources",
2256 recovery_available: true,
2257 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=global $(in)",
2258
2259 tools: [ "genseccomp" ],
2260
2261 srcs: [
2262 "SYSCALLS.TXT",
2263 "SECCOMP_WHITELIST_COMMON.TXT",
2264 "SECCOMP_WHITELIST_SYSTEM.TXT",
2265 "SECCOMP_WHITELIST_APP.TXT",
2266 "SECCOMP_WHITELIST_GLOBAL.TXT",
2267 "SECCOMP_BLACKLIST_COMMON.TXT",
2268 ":libseccomp_gen_syscall_nrs_arm",
2269 ":libseccomp_gen_syscall_nrs_arm64",
2270 ":libseccomp_gen_syscall_nrs_mips",
2271 ":libseccomp_gen_syscall_nrs_mips64",
2272 ":libseccomp_gen_syscall_nrs_x86",
2273 ":libseccomp_gen_syscall_nrs_x86_64",
2274 ],
2275
2276 out: [
2277 "arm64_global_policy.cpp",
2278 "arm_global_policy.cpp",
2279 "mips64_global_policy.cpp",
2280 "mips_global_policy.cpp",
2281 "x86_64_global_policy.cpp",
2282 "x86_global_policy.cpp",
2283 ],
2284}
2285
2286cc_library {
2287 name: "libseccomp_policy",
2288 recovery_available: true,
2289 generated_sources: [
2290 "libseccomp_policy_app_sources",
2291 "libseccomp_policy_global_sources",
2292 "libseccomp_policy_system_sources",
2293 ],
2294
2295 srcs: [
2296 "seccomp/seccomp_policy.cpp",
2297 ],
2298
2299 export_include_dirs: ["seccomp/include"],
2300 cflags: [
2301 "-Wall",
2302 "-Werror",
2303 ],
2304 shared: {
2305 shared_libs: ["libbase"],
2306 },
2307 static: {
2308 static_libs: ["libbase"],
2309 },
2310}