blob: ac8052b2e9961da4516dd4ce9698d75bb410ab9e [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",
Elliott Hughesedb3c442019-09-27 14:42:39 -070027 "bionic/ndk_cruft_data.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070028]
29
30libc_common_src_files_32 = [
31 "bionic/legacy_32_bit_support.cpp",
32 "bionic/time64.c",
33]
34
Elliott Hughes53cf3482016-08-09 13:06:41 -070035libc_common_flags = [
36 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080037 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070038 "-Wall",
39 "-Wextra",
40 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080041 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070042 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070043 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070044 "-Wframe-larger-than=2048",
George Burgess IVfa5410f2018-08-13 17:44:06 -070045 "-Wimplicit-fallthrough",
Elliott Hughes53cf3482016-08-09 13:06:41 -070046
47 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
48 "-Werror=pointer-to-int-cast",
49 "-Werror=int-to-pointer-cast",
50 "-Werror=type-limits",
51 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080052
53 // Clang's exit-time destructor registration hides __dso_handle, but
54 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
55 "-Wexit-time-destructors",
Elliott Hughes53cf3482016-08-09 13:06:41 -070056]
57
Dan Willemsen208ae172015-09-16 16:33:27 -070058// Define some common cflags
59// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070060cc_defaults {
61 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080062 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070063 cflags: libc_common_flags,
64 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070065 conlyflags: ["-std=gnu99"],
66 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070067 include_dirs: [
68 "bionic/libc/async_safe/include",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -070069 "external/jemalloc_new/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070070 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070071
Colin Cross50c21ab2015-10-31 23:03:05 -070072 stl: "none",
73 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070074 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070075 address: false,
76 integer_overflow: false,
Colin Cross27c43c52016-04-07 13:27:24 -070077 },
Colin Cross50c21ab2015-10-31 23:03:05 -070078 native_coverage: false,
Jiyong Park5603c6e2018-04-27 21:53:11 +090079 recovery_available: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080080
Yi Konge3d90de2019-02-20 14:28:56 -080081 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
82 // warning since this is intended right now.
83 ldflags: ["-Wl,-z,muldefs"],
Dan Willemsen208ae172015-09-16 16:33:27 -070084}
85
Dan Willemsen208ae172015-09-16 16:33:27 -070086// ========================================================
87// libc_stack_protector.a - stack protector code
88// ========================================================
89//
Colin Crossa3f9fca2016-01-11 13:20:55 -080090// Code that implements the stack protector (or that runs
91// before TLS has been set up) needs to be compiled with
92// -fno-stack-protector, since it accesses the stack canary
93// TLS slot.
Dan Willemsen208ae172015-09-16 16:33:27 -070094
95cc_library_static {
96
Colin Crossa3f9fca2016-01-11 13:20:55 -080097 srcs: [
98 "bionic/__libc_init_main_thread.cpp",
99 "bionic/__stack_chk_fail.cpp",
100 ],
101 arch: {
102 arm64: {
103 srcs: ["arch-arm64/bionic/__set_tls.c"],
104 },
105 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700106 srcs: [
107 "arch-x86/bionic/__libc_init_sysinfo.cpp",
108 "arch-x86/bionic/__set_tls.cpp",
109 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800110 },
111 x86_64: {
112 srcs: ["arch-x86_64/bionic/__set_tls.c"],
113 },
114 },
115
Colin Cross50c21ab2015-10-31 23:03:05 -0700116 defaults: ["libc_defaults"],
117 cflags: ["-fno-stack-protector"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700118 name: "libc_stack_protector",
Dan Willemsen208ae172015-09-16 16:33:27 -0700119}
120
Colin Crossa3f9fca2016-01-11 13:20:55 -0800121// libc_init_static.cpp also needs to be built without stack protector,
122// because it's responsible for setting up TLS for static executables.
123// This isn't the case for dynamic executables because the dynamic linker
124// has already set up the main thread's TLS.
125
126cc_library_static {
127 name: "libc_init_static",
128 defaults: ["libc_defaults"],
129 srcs: ["bionic/libc_init_static.cpp"],
130 cflags: ["-fno-stack-protector"],
131}
132
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700133cc_library_static {
134 name: "libc_init_dynamic",
135 defaults: ["libc_defaults"],
136 srcs: ["bionic/libc_init_dynamic.cpp"],
137 cflags: ["-fno-stack-protector"],
138}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800139
Dan Willemsen208ae172015-09-16 16:33:27 -0700140// ========================================================
141// libc_tzcode.a - upstream 'tzcode' code
142// ========================================================
143
144cc_library_static {
145
Colin Cross50c21ab2015-10-31 23:03:05 -0700146 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700147 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800148 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700149 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700150 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
151 ],
152
Colin Cross50c21ab2015-10-31 23:03:05 -0700153 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700154 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700155 // Don't use ridiculous amounts of stack.
156 "-DALL_STATE",
157 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
158 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800159 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700160 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700161 // The name of the tm_gmtoff field in our struct tm.
162 "-DTM_GMTOFF=tm_gmtoff",
163 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700164 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700165 // Include `tzname`, `timezone`, and `daylight` globals.
166 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700167 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800168 // Use the empty string (instead of " ") as the timezone abbreviation
169 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700170 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700171 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
172 "-Dlint",
173 ],
174
Dan Willemsen208ae172015-09-16 16:33:27 -0700175 local_include_dirs: ["tzcode/"],
176 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700177}
178
179// ========================================================
180// libc_dns.a - modified NetBSD DNS code
181// ========================================================
182
183cc_library_static {
184
Colin Cross50c21ab2015-10-31 23:03:05 -0700185 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700186 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800187 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700188
189 "upstream-netbsd/lib/libc/isc/ev_streams.c",
190 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700191 ],
192
Colin Cross50c21ab2015-10-31 23:03:05 -0700193 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700194 "-DANDROID_CHANGES",
195 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700196 "-Wno-unused-parameter",
197 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700198 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700199 ],
200
Dan Willemsen208ae172015-09-16 16:33:27 -0700201 local_include_dirs: [
202 "dns/include",
203 "private",
204 "upstream-netbsd/lib/libc/include",
205 "upstream-netbsd/android/include",
206 ],
207
208 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700209}
210
211// ========================================================
212// libc_freebsd.a - upstream FreeBSD C library code
213// ========================================================
214//
215// These files are built with the freebsd-compat.h header file
216// automatically included.
217
218cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700219 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700220 srcs: [
221 "upstream-freebsd/lib/libc/gen/ldexp.c",
222 "upstream-freebsd/lib/libc/gen/sleep.c",
223 "upstream-freebsd/lib/libc/gen/usleep.c",
224 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700225 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
226 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
227 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
228 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700229 "upstream-freebsd/lib/libc/stdlib/qsort.c",
230 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700231 "upstream-freebsd/lib/libc/string/wcpcpy.c",
232 "upstream-freebsd/lib/libc/string/wcpncpy.c",
233 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700234 "upstream-freebsd/lib/libc/string/wcscat.c",
235 "upstream-freebsd/lib/libc/string/wcschr.c",
236 "upstream-freebsd/lib/libc/string/wcscmp.c",
237 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700238 "upstream-freebsd/lib/libc/string/wcscspn.c",
239 "upstream-freebsd/lib/libc/string/wcsdup.c",
240 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700241 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700242 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
243 "upstream-freebsd/lib/libc/string/wcsncat.c",
244 "upstream-freebsd/lib/libc/string/wcsncmp.c",
245 "upstream-freebsd/lib/libc/string/wcsncpy.c",
246 "upstream-freebsd/lib/libc/string/wcsnlen.c",
247 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700248 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700249 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700250 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700251 "upstream-freebsd/lib/libc/string/wcstok.c",
252 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700253 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700254 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700255 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800256 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700257 ],
258 arch: {
259 arm64: {
260 exclude_srcs: [
261 "upstream-freebsd/lib/libc/string/wmemmove.c",
262 ],
263 },
264 x86: {
265 exclude_srcs: [
266 "upstream-freebsd/lib/libc/string/wcschr.c",
267 "upstream-freebsd/lib/libc/string/wcscmp.c",
268 "upstream-freebsd/lib/libc/string/wcslen.c",
269 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700270 "upstream-freebsd/lib/libc/string/wmemcmp.c",
271 "upstream-freebsd/lib/libc/string/wcscat.c",
272 "upstream-freebsd/lib/libc/string/wcscpy.c",
273 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700274 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700275 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700276 },
277
Colin Cross50c21ab2015-10-31 23:03:05 -0700278 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700279 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700280 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700281 "-include freebsd-compat.h",
282 ],
283
Dan Willemsen208ae172015-09-16 16:33:27 -0700284 local_include_dirs: [
285 "upstream-freebsd/android/include",
286 ],
287
288 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700289}
290
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700291cc_library_static {
292 defaults: ["libc_defaults"],
293 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700294 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700295 "upstream-freebsd/lib/libc/stdlib/realpath.c",
296 ],
297
298 cflags: [
299 "-Wno-sign-compare",
300 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700301 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700302 ],
303
304 local_include_dirs: [
305 "upstream-freebsd/android/include",
306 ],
307
308 name: "libc_freebsd_large_stack",
309}
310
Dan Willemsen208ae172015-09-16 16:33:27 -0700311// ========================================================
312// libc_netbsd.a - upstream NetBSD C library code
313// ========================================================
314//
315// These files are built with the netbsd-compat.h header file
316// automatically included.
317
318cc_library_static {
319
Colin Cross50c21ab2015-10-31 23:03:05 -0700320 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700321 srcs: [
322 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700323 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700324 "upstream-netbsd/lib/libc/gen/psignal.c",
325 "upstream-netbsd/lib/libc/gen/utime.c",
326 "upstream-netbsd/lib/libc/gen/utmp.c",
327 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
328 "upstream-netbsd/lib/libc/regex/regcomp.c",
329 "upstream-netbsd/lib/libc/regex/regerror.c",
330 "upstream-netbsd/lib/libc/regex/regexec.c",
331 "upstream-netbsd/lib/libc/regex/regfree.c",
332 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700333 "upstream-netbsd/lib/libc/stdlib/drand48.c",
334 "upstream-netbsd/lib/libc/stdlib/erand48.c",
335 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
336 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700337 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
338 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
339 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
340 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
341 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
342 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
343 "upstream-netbsd/lib/libc/stdlib/seed48.c",
344 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700345 ],
346 multilib: {
347 lib32: {
348 // LP32 cruft
349 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
350 },
351 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700352 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700353 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800354 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700355 "-DPOSIX_MISTAKE",
356 "-include netbsd-compat.h",
357 ],
358
Dan Willemsen208ae172015-09-16 16:33:27 -0700359 local_include_dirs: [
360 "upstream-netbsd/android/include",
361 "upstream-netbsd/lib/libc/include",
362 ],
363
364 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700365}
366
367// ========================================================
368// libc_openbsd_ndk.a - upstream OpenBSD C library code
369// that can be safely included in the libc_ndk.a (doesn't
370// contain any troublesome global data or constructors).
371// ========================================================
372//
373// These files are built with the openbsd-compat.h header file
374// automatically included.
375
376cc_library_static {
377 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700378 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700379 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700380 "upstream-openbsd/lib/libc/gen/alarm.c",
381 "upstream-openbsd/lib/libc/gen/ctype_.c",
382 "upstream-openbsd/lib/libc/gen/daemon.c",
383 "upstream-openbsd/lib/libc/gen/err.c",
384 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700385 "upstream-openbsd/lib/libc/gen/fnmatch.c",
386 "upstream-openbsd/lib/libc/gen/ftok.c",
387 "upstream-openbsd/lib/libc/gen/getprogname.c",
388 "upstream-openbsd/lib/libc/gen/isctype.c",
389 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700390 "upstream-openbsd/lib/libc/gen/verr.c",
391 "upstream-openbsd/lib/libc/gen/verrx.c",
392 "upstream-openbsd/lib/libc/gen/vwarn.c",
393 "upstream-openbsd/lib/libc/gen/vwarnx.c",
394 "upstream-openbsd/lib/libc/gen/warn.c",
395 "upstream-openbsd/lib/libc/gen/warnx.c",
396 "upstream-openbsd/lib/libc/locale/btowc.c",
397 "upstream-openbsd/lib/libc/locale/mbrlen.c",
398 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
399 "upstream-openbsd/lib/libc/locale/mbtowc.c",
400 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700401 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
402 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700403 "upstream-openbsd/lib/libc/locale/wcstoll.c",
404 "upstream-openbsd/lib/libc/locale/wcstombs.c",
405 "upstream-openbsd/lib/libc/locale/wcstoul.c",
406 "upstream-openbsd/lib/libc/locale/wcstoull.c",
407 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
408 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
409 "upstream-openbsd/lib/libc/locale/wctob.c",
410 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700411 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700412 "upstream-openbsd/lib/libc/net/htonl.c",
413 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700414 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
415 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
416 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700417 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
418 "upstream-openbsd/lib/libc/net/inet_ntop.c",
419 "upstream-openbsd/lib/libc/net/inet_pton.c",
420 "upstream-openbsd/lib/libc/net/ntohl.c",
421 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800422 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700423 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700424 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
425 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700426 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700427 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700428 "upstream-openbsd/lib/libc/stdio/fputwc.c",
429 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700430 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700431 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700432 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700433 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700434 "upstream-openbsd/lib/libc/stdio/makebuf.c",
435 "upstream-openbsd/lib/libc/stdio/mktemp.c",
436 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
437 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700438 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700439 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700440 "upstream-openbsd/lib/libc/stdio/tempnam.c",
441 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
442 "upstream-openbsd/lib/libc/stdio/ungetc.c",
443 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
444 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
445 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700446 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
447 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
448 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700449 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700450 "upstream-openbsd/lib/libc/stdio/wsetup.c",
451 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800452 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700453 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700454 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700455 "upstream-openbsd/lib/libc/stdlib/insque.c",
456 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
457 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
458 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800459 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700460 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800461 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700462 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughesc0081d32020-07-31 11:00:10 -0700463 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700464 "upstream-openbsd/lib/libc/stdlib/remque.c",
465 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700466 "upstream-openbsd/lib/libc/stdlib/tfind.c",
467 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800468 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700469 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800470 "upstream-openbsd/lib/libc/string/strcasestr.c",
471 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700472 "upstream-openbsd/lib/libc/string/strcspn.c",
473 "upstream-openbsd/lib/libc/string/strdup.c",
474 "upstream-openbsd/lib/libc/string/strndup.c",
475 "upstream-openbsd/lib/libc/string/strpbrk.c",
476 "upstream-openbsd/lib/libc/string/strsep.c",
477 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700478 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800479 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700480 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700481 "upstream-openbsd/lib/libc/string/wcswidth.c",
482 ],
483
Colin Cross50c21ab2015-10-31 23:03:05 -0700484 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700485 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700486 "-Wno-unused-parameter",
487 "-include openbsd-compat.h",
488 ],
489
Dan Willemsen208ae172015-09-16 16:33:27 -0700490 local_include_dirs: [
491 "private",
492 "stdio",
493 "upstream-openbsd/android/include",
494 "upstream-openbsd/lib/libc/include",
495 "upstream-openbsd/lib/libc/gdtoa/",
496 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700497}
498
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700499cc_library_static {
500 name: "libc_openbsd_large_stack",
501 defaults: ["libc_defaults"],
502 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700503 "stdio/vfprintf.cpp",
504 "stdio/vfwprintf.cpp",
Elliott Hughes0bf6c242020-08-06 14:32:43 -0700505 "upstream-openbsd/lib/libc/string/memmem.c",
Elliott Hughes4aa63cd2019-11-22 11:15:42 -0800506 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700507 ],
508 cflags: [
509 "-include openbsd-compat.h",
510 "-Wno-sign-compare",
511 "-Wframe-larger-than=5000",
512 ],
513
514 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700515 "upstream-openbsd/android/include/",
516 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700517 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700518 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700519 ],
520}
521
Dan Willemsen208ae172015-09-16 16:33:27 -0700522// ========================================================
523// libc_openbsd.a - upstream OpenBSD C library code
524// ========================================================
525//
526// These files are built with the openbsd-compat.h header file
527// automatically included.
528cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700529 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700530 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800531 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700532 "upstream-openbsd/lib/libc/crypt/arc4random.c",
533 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
534
535 // May be overriden by per-arch optimized versions
536 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700537 "upstream-openbsd/lib/libc/string/memrchr.c",
538 "upstream-openbsd/lib/libc/string/stpcpy.c",
539 "upstream-openbsd/lib/libc/string/stpncpy.c",
540 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700541 "upstream-openbsd/lib/libc/string/strcpy.c",
542 "upstream-openbsd/lib/libc/string/strlcat.c",
543 "upstream-openbsd/lib/libc/string/strlcpy.c",
544 "upstream-openbsd/lib/libc/string/strncat.c",
545 "upstream-openbsd/lib/libc/string/strncmp.c",
546 "upstream-openbsd/lib/libc/string/strncpy.c",
547 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700548
549 arch: {
550 arm: {
551 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700552 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800553 "upstream-openbsd/lib/libc/string/stpcpy.c",
554 "upstream-openbsd/lib/libc/string/strcat.c",
Prakhar Bahuguna9f7271b2017-04-10 00:41:23 +0200555 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700556 ],
557 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700558 arm64: {
559 exclude_srcs: [
560 "upstream-openbsd/lib/libc/string/memchr.c",
Wilco Dijkstra147016e2020-05-12 11:59:54 +0100561 "upstream-openbsd/lib/libc/string/memrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700562 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700563 "upstream-openbsd/lib/libc/string/strcpy.c",
564 "upstream-openbsd/lib/libc/string/strncmp.c",
565 ],
566 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530567 mips: {
568 exclude_srcs: [
569 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530570 "upstream-openbsd/lib/libc/string/strcpy.c",
571 "upstream-openbsd/lib/libc/string/strncmp.c",
572 ],
573 },
574 mips64: {
575 exclude_srcs: [
576 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530577 "upstream-openbsd/lib/libc/string/strcpy.c",
578 "upstream-openbsd/lib/libc/string/strncmp.c",
579 ],
580 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700581 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800582 exclude_srcs: [
583 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800584 "upstream-openbsd/lib/libc/string/memrchr.c",
585 "upstream-openbsd/lib/libc/string/stpcpy.c",
586 "upstream-openbsd/lib/libc/string/stpncpy.c",
587 "upstream-openbsd/lib/libc/string/strcat.c",
588 "upstream-openbsd/lib/libc/string/strcpy.c",
589 "upstream-openbsd/lib/libc/string/strncmp.c",
590 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700591 "upstream-openbsd/lib/libc/string/strlcat.c",
592 "upstream-openbsd/lib/libc/string/strlcpy.c",
593 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800594 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700595 },
596
597 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800598 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800599 "upstream-openbsd/lib/libc/string/stpcpy.c",
600 "upstream-openbsd/lib/libc/string/stpncpy.c",
601 "upstream-openbsd/lib/libc/string/strcat.c",
602 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800603 "upstream-openbsd/lib/libc/string/strncat.c",
604 "upstream-openbsd/lib/libc/string/strncmp.c",
605 "upstream-openbsd/lib/libc/string/strncpy.c",
606 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700607 },
608 },
609
Colin Cross50c21ab2015-10-31 23:03:05 -0700610 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700611 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700612 "-Wno-unused-parameter",
613 "-include openbsd-compat.h",
614 ],
615
Dan Willemsen208ae172015-09-16 16:33:27 -0700616 local_include_dirs: [
617 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700618 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700619 ],
620
621 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700622}
623
624// ========================================================
625// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
626// ========================================================
627//
628// These files are built with the openbsd-compat.h header file
629// automatically included.
630
631cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700632 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700633 srcs: [
634 "upstream-openbsd/android/gdtoa_support.cpp",
635 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
636 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
637 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
638 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
639 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
640 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
641 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
642 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
643 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
644 "upstream-openbsd/lib/libc/gdtoa/misc.c",
645 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
646 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
647 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
648 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
649 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
650 "upstream-openbsd/lib/libc/gdtoa/sum.c",
651 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
652 ],
653 multilib: {
654 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800655 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700656 },
657 },
658
Colin Cross50c21ab2015-10-31 23:03:05 -0700659 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700660 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700661 "-include openbsd-compat.h",
662 ],
663
Dan Willemsen208ae172015-09-16 16:33:27 -0700664 local_include_dirs: [
665 "private",
666 "upstream-openbsd/android/include",
667 "upstream-openbsd/lib/libc/include",
668 ],
669
670 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700671}
672
673// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700674// libc_fortify.a - container for our FORITFY
675// implementation details
676// ========================================================
677cc_library_static {
678 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700679 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700680
681 name: "libc_fortify",
682
683 // Disable FORTIFY for the compilation of these, so we don't end up having
684 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800685 cflags: [
686 "-U_FORTIFY_SOURCE",
687 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
688 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700689
690 arch: {
691 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800692 cflags: [
693 "-DNO___MEMCPY_CHK",
694 "-DRENAME___STRCAT_CHK",
695 "-DRENAME___STRCPY_CHK",
696 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700697 srcs: [
698 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800699
700 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
701 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
702
703 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
704 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
705
706 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
707 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
708
709 "arch-arm/krait/bionic/__strcat_chk.S",
710 "arch-arm/krait/bionic/__strcpy_chk.S",
711
712 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
713 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
714
Haibo Huang01bfd892018-12-03 15:05:16 -0800715 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
716 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700717 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700718 },
719 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700720 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700721 srcs: [
722 "arch-arm64/generic/bionic/__memcpy_chk.S",
723 ],
Chitti Babu Theegala399afde2017-09-11 17:31:11 +0530724 kryo: {
725 srcs: [
726 "arch-arm64/kryo/bionic/__memcpy_chk.S",
727 ],
728 exclude_srcs: [
729 "arch-arm64/generic/bionic/__memcpy_chk.S",
730 ],
731 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700732 },
733 },
734}
735
736// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700737// libc_bionic.a - home-grown C library code
738// ========================================================
739
740cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700741 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700742 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700743 // The data that backs getauxval is initialized in the libc init
744 // functions which are invoked by the linker. If this file is included
745 // in libc_ndk.a, only one of the copies of the global data will be
746 // initialized, resulting in nullptr dereferences.
747 "bionic/getauxval.cpp",
748
Elliott Hughes211c4d32018-02-02 15:10:32 -0800749 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700750 "bionic/sysconf.cpp",
751 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700752 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700753
Josh Gao10ec9282017-04-03 15:13:29 -0700754 // The following must not be statically linked into libc_ndk.a, because
755 // debuggerd will look for the abort message in libc.so's copy.
756 "bionic/android_set_abort_message.cpp",
757
Dan Willemsen208ae172015-09-16 16:33:27 -0700758 "bionic/strchr.cpp",
759 "bionic/strnlen.c",
760 "bionic/strrchr.cpp",
761 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700762
763 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700764 arm: {
765 srcs: [
Prakhar Bahuguna9f7271b2017-04-10 00:41:23 +0200766 "arch-arm/generic/bionic/memchr.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800767 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700768 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800769 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800770 "arch-arm/generic/bionic/stpcpy.c",
771 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800772 "arch-arm/generic/bionic/strcmp.S",
773 "arch-arm/generic/bionic/strcpy.S",
774 "arch-arm/generic/bionic/strlen.c",
775
Ryan Prichard45024fe2018-12-30 21:10:26 -0800776 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700777 "arch-arm/bionic/__bionic_clone.S",
Yi Kong570ab492019-04-22 23:13:17 -0700778 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700779 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kong570ab492019-04-22 23:13:17 -0700780 "arch-arm/bionic/atomics_arm.c",
781 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800782 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700783 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700784 "arch-arm/bionic/setjmp.S",
785 "arch-arm/bionic/syscall.S",
786 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800787
788 "arch-arm/cortex-a15/bionic/memcpy.S",
789 "arch-arm/cortex-a15/bionic/memmove.S",
790 "arch-arm/cortex-a15/bionic/memset.S",
791 "arch-arm/cortex-a15/bionic/stpcpy.S",
792 "arch-arm/cortex-a15/bionic/strcat.S",
793 "arch-arm/cortex-a15/bionic/strcmp.S",
794 "arch-arm/cortex-a15/bionic/strcpy.S",
795 "arch-arm/cortex-a15/bionic/strlen.S",
796
797 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800798 "arch-arm/cortex-a7/bionic/memset.S",
799
800 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800801 "arch-arm/cortex-a9/bionic/memset.S",
802 "arch-arm/cortex-a9/bionic/stpcpy.S",
803 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800804 "arch-arm/cortex-a9/bionic/strcpy.S",
805 "arch-arm/cortex-a9/bionic/strlen.S",
806
807 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800808 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800809
810 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800811
Haibo Huang01bfd892018-12-03 15:05:16 -0800812 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800813
814 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700815 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700816 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700817 arm64: {
818 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700819 "arch-arm64/generic/bionic/memchr.S",
820 "arch-arm64/generic/bionic/memcmp.S",
821 "arch-arm64/generic/bionic/memcpy.S",
822 "arch-arm64/generic/bionic/memmove.S",
Wilco Dijkstra147016e2020-05-12 11:59:54 +0100823 "arch-arm64/generic/bionic/memrchr.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700824 "arch-arm64/generic/bionic/memset.S",
825 "arch-arm64/generic/bionic/stpcpy.S",
826 "arch-arm64/generic/bionic/strchr.S",
Jake Weinstein0b2863f2017-05-04 02:43:44 -0400827 "arch-arm64/generic/bionic/strrchr.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700828 "arch-arm64/generic/bionic/strcmp.S",
829 "arch-arm64/generic/bionic/strcpy.S",
830 "arch-arm64/generic/bionic/strlen.S",
831 "arch-arm64/generic/bionic/strncmp.S",
832 "arch-arm64/generic/bionic/strnlen.S",
833 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800834
835 "arch-arm64/bionic/__bionic_clone.S",
836 "arch-arm64/bionic/_exit_with_stack_teardown.S",
837 "arch-arm64/bionic/setjmp.S",
838 "arch-arm64/bionic/syscall.S",
839 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700840 ],
841 exclude_srcs: [
842 "bionic/__memcpy_chk.cpp",
843 "bionic/strchr.cpp",
844 "bionic/strnlen.c",
Jake Weinstein0b2863f2017-05-04 02:43:44 -0400845 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700846 ],
Chitti Babu Theegala399afde2017-09-11 17:31:11 +0530847 kryo: {
848 srcs: [
849 "arch-arm64/kryo/bionic/__memcpy.S",
850 "arch-arm64/kryo/bionic/memcpy.S",
851 "arch-arm64/kryo/bionic/memmove.S",
852 "arch-arm64/kryo/bionic/wmemmove.S",
853 ],
854 exclude_srcs: [
855 "arch-arm64/generic/bionic/memcpy.S",
856 "arch-arm64/generic/bionic/memmove.S",
857 "arch-arm64/generic/bionic/wmemmove.S",
858 ],
859 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700860 },
861
862 mips: {
863 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800864 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530865 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800866 "arch-mips/string/memset.S",
867 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530868 "arch-mips/string/strncmp.S",
869 "arch-mips/string/strlen.c",
870 "arch-mips/string/strnlen.c",
871 "arch-mips/string/strchr.c",
872 "arch-mips/string/strcpy.c",
873 "arch-mips/string/memchr.c",
874 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800875
Dan Willemsen208ae172015-09-16 16:33:27 -0700876 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700877 "arch-mips/bionic/cacheflush.cpp",
878 "arch-mips/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800879 "arch-mips/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700880 "arch-mips/bionic/setjmp.S",
881 "arch-mips/bionic/syscall.S",
882 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700883 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530884 exclude_srcs: [
885 "bionic/strchr.cpp",
886 "bionic/strnlen.c",
887 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700888 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700889 mips64: {
890 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800891 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530892 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800893 "arch-mips/string/memset.S",
894 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530895 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800896 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530897 "arch-mips/string/strnlen.c",
898 "arch-mips/string/strchr.c",
899 "arch-mips/string/strcpy.c",
900 "arch-mips/string/memchr.c",
901 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800902
Dan Willemsen208ae172015-09-16 16:33:27 -0700903 "arch-mips64/bionic/__bionic_clone.S",
904 "arch-mips64/bionic/_exit_with_stack_teardown.S",
905 "arch-mips64/bionic/setjmp.S",
906 "arch-mips64/bionic/syscall.S",
907 "arch-mips64/bionic/vfork.S",
908 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700909 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530910 exclude_srcs: [
911 "bionic/strchr.cpp",
912 "bionic/strnlen.c",
913 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700914 },
915
916 x86: {
917 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700918 "arch-x86/generic/string/memcmp.S",
919 "arch-x86/generic/string/strcmp.S",
920 "arch-x86/generic/string/strncmp.S",
921 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700922
923 "arch-x86/generic/string/strlcat.c",
924 "arch-x86/generic/string/strlcpy.c",
925 "arch-x86/generic/string/strncat.c",
926 "arch-x86/generic/string/wcscat.c",
927 "arch-x86/generic/string/wcscpy.c",
928 "arch-x86/generic/string/wmemcmp.c",
929
Dan Willemsen208ae172015-09-16 16:33:27 -0700930 "arch-x86/atom/string/sse2-memchr-atom.S",
931 "arch-x86/atom/string/sse2-memrchr-atom.S",
932 "arch-x86/atom/string/sse2-strchr-atom.S",
933 "arch-x86/atom/string/sse2-strnlen-atom.S",
934 "arch-x86/atom/string/sse2-strrchr-atom.S",
935 "arch-x86/atom/string/sse2-wcschr-atom.S",
936 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
937 "arch-x86/atom/string/sse2-wcslen-atom.S",
938 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700939 "arch-x86/silvermont/string/sse2-memmove-slm.S",
940 "arch-x86/silvermont/string/sse2-memset-slm.S",
941 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
942 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
943 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
944 "arch-x86/silvermont/string/sse2-strlen-slm.S",
945 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800946
947 "arch-x86/bionic/__bionic_clone.S",
948 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800949 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800950 "arch-x86/bionic/__restore.S",
951 "arch-x86/bionic/setjmp.S",
952 "arch-x86/bionic/syscall.S",
953 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700954
955 // ssse3 functions
956 "arch-x86/atom/string/ssse3-strcat-atom.S",
957 "arch-x86/atom/string/ssse3-strcmp-atom.S",
958 "arch-x86/atom/string/ssse3-strlcat-atom.S",
959 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
960 "arch-x86/atom/string/ssse3-strncat-atom.S",
961 "arch-x86/atom/string/ssse3-strncmp-atom.S",
962 "arch-x86/atom/string/ssse3-wcscat-atom.S",
963 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
964
965 // sse4 functions
966 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
967 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
968
969 // atom functions
970 "arch-x86/atom/string/sse2-memset-atom.S",
971 "arch-x86/atom/string/sse2-strlen-atom.S",
972 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800973 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700974 "arch-x86/atom/string/ssse3-strcpy-atom.S",
975 "arch-x86/atom/string/ssse3-strncpy-atom.S",
976 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700977 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700978
979 exclude_srcs: [
980 "bionic/strchr.cpp",
981 "bionic/strnlen.c",
982 "bionic/strrchr.cpp",
983 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700984 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700985 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700986 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700987 "arch-x86_64/string/sse2-memmove-slm.S",
988 "arch-x86_64/string/sse2-memset-slm.S",
989 "arch-x86_64/string/sse2-stpcpy-slm.S",
990 "arch-x86_64/string/sse2-stpncpy-slm.S",
991 "arch-x86_64/string/sse2-strcat-slm.S",
992 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700993 "arch-x86_64/string/sse2-strlen-slm.S",
994 "arch-x86_64/string/sse2-strncat-slm.S",
995 "arch-x86_64/string/sse2-strncpy-slm.S",
996 "arch-x86_64/string/sse4-memcmp-slm.S",
997 "arch-x86_64/string/ssse3-strcmp-slm.S",
998 "arch-x86_64/string/ssse3-strncmp-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800999
1000 "arch-x86_64/bionic/__bionic_clone.S",
1001 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1002 "arch-x86_64/bionic/__restore_rt.S",
1003 "arch-x86_64/bionic/setjmp.S",
1004 "arch-x86_64/bionic/syscall.S",
1005 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001006 ],
1007 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001008 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001009
Colin Cross50c21ab2015-10-31 23:03:05 -07001010 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001011 include_dirs: ["bionic/libstdc++/include"],
1012 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001013}
1014
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001015genrule {
1016 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001017 out: ["generated_android_ids.h"],
1018 srcs: [":android_filesystem_config_header"],
1019 tool_files: ["fs_config_generator.py"],
1020 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001021}
1022
Dan Willemsen268a6732015-10-15 14:49:45 -07001023// ========================================================
1024// libc_bionic_ndk.a- The portions of libc_bionic that can
1025// be safely used in libc_ndk.a (no troublesome global data
1026// or constructors).
1027// ========================================================
1028cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001029 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001030 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001031 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001032 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001033 "bionic/__cmsg_nxthdr.cpp",
1034 "bionic/__errno.cpp",
1035 "bionic/__gnu_basename.cpp",
1036 "bionic/__libc_current_sigrtmax.cpp",
1037 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001038 "bionic/abort.cpp",
1039 "bionic/accept.cpp",
1040 "bionic/accept4.cpp",
1041 "bionic/access.cpp",
1042 "bionic/arpa_inet.cpp",
1043 "bionic/assert.cpp",
1044 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001045 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001046 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001047 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001048 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001049 "bionic/bionic_systrace.cpp",
1050 "bionic/bionic_time_conversions.cpp",
1051 "bionic/brk.cpp",
1052 "bionic/c16rtomb.cpp",
1053 "bionic/c32rtomb.cpp",
1054 "bionic/chmod.cpp",
1055 "bionic/chown.cpp",
1056 "bionic/clearenv.cpp",
1057 "bionic/clock.cpp",
1058 "bionic/clock_getcpuclockid.cpp",
1059 "bionic/clock_nanosleep.cpp",
1060 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001061 "bionic/connect.cpp",
1062 "bionic/ctype.cpp",
1063 "bionic/dirent.cpp",
1064 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001065 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001066 "bionic/error.cpp",
1067 "bionic/eventfd_read.cpp",
1068 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001069 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001070 "bionic/faccessat.cpp",
1071 "bionic/fchmod.cpp",
1072 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001073 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001074 "bionic/ffs.cpp",
1075 "bionic/fgetxattr.cpp",
1076 "bionic/flistxattr.cpp",
1077 "bionic/flockfile.cpp",
1078 "bionic/fpclassify.cpp",
1079 "bionic/fsetxattr.cpp",
1080 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001081 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001082 "bionic/futimens.cpp",
1083 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001084 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001085 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001086 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001087 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001088 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001089 "bionic/getpgrp.cpp",
1090 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001091 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001092 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001093 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001094 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001095 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001096 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001097 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001098 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001099 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001100 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001101 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001102 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001103 "bionic/lchown.cpp",
1104 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001105 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001106 "bionic/libgen.cpp",
1107 "bionic/link.cpp",
1108 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001109 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001110 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001111 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001112 "bionic/mbrtoc16.cpp",
1113 "bionic/mbrtoc32.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001114 "bionic/mempcpy.cpp",
1115 "bionic/mkdir.cpp",
1116 "bionic/mkfifo.cpp",
1117 "bionic/mknod.cpp",
1118 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001119 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001120 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001121 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001122 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001123 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001124 "bionic/open.cpp",
1125 "bionic/pathconf.cpp",
1126 "bionic/pause.cpp",
1127 "bionic/pipe.cpp",
1128 "bionic/poll.cpp",
1129 "bionic/posix_fadvise.cpp",
1130 "bionic/posix_fallocate.cpp",
1131 "bionic/posix_madvise.cpp",
1132 "bionic/posix_timers.cpp",
1133 "bionic/ptrace.cpp",
1134 "bionic/pty.cpp",
1135 "bionic/raise.cpp",
1136 "bionic/rand.cpp",
1137 "bionic/readlink.cpp",
1138 "bionic/reboot.cpp",
1139 "bionic/recv.cpp",
1140 "bionic/rename.cpp",
1141 "bionic/rmdir.cpp",
1142 "bionic/scandir.cpp",
1143 "bionic/sched_getaffinity.cpp",
1144 "bionic/sched_getcpu.cpp",
1145 "bionic/semaphore.cpp",
1146 "bionic/send.cpp",
1147 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001148 "bionic/seteuid.cpp",
1149 "bionic/setpgrp.cpp",
1150 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001151 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001152 "bionic/sigprocmask.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001153 "bionic/socket.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001154 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001155 "bionic/stat.cpp",
1156 "bionic/statvfs.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001157 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001158 "bionic/strchrnul.cpp",
1159 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001160 "bionic/string_l.cpp",
1161 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001162 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001163 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001164 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001165 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001166 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001167 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001168 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001169 "bionic/sys_msg.cpp",
1170 "bionic/sys_sem.cpp",
1171 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001172 "bionic/sys_signalfd.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001173 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001174 "bionic/sysinfo.cpp",
1175 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001176 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001177 "bionic/system_property_api.cpp",
1178 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001179 "bionic/tdestroy.cpp",
1180 "bionic/termios.cpp",
1181 "bionic/thread_private.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001182 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001183 "bionic/tmpfile.cpp",
1184 "bionic/umount.cpp",
1185 "bionic/unlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001186 "bionic/wait.cpp",
1187 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001188 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001189 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001190 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001191 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001192 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001193
1194 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1195 // which will be overridden by the actual one in libc.so.
1196 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001197 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001198
Dan Willemsen208ae172015-09-16 16:33:27 -07001199 multilib: {
1200 lib32: {
1201 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001202 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001203 },
1204 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001205 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001206 treble_linker_namespaces: {
1207 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001208 },
1209 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001210 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001211 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001212 local_include_dirs: ["stdio"],
1213 include_dirs: ["bionic/libstdc++/include"],
1214 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001215 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001216}
1217
Dan Willemsen208ae172015-09-16 16:33:27 -07001218// ========================================================
1219// libc_pthread.a - pthreads parts that previously lived in
1220// libc_bionic.a. Relocated to their own library because
1221// they can't be included in libc_ndk.a (as they layout of
1222// pthread_t has changed over the years and has ABI
1223// compatibility issues).
1224// ========================================================
1225
1226cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001227 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001228 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001229 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001230 "bionic/pthread_atfork.cpp",
1231 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001232 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001233 "bionic/pthread_cond.cpp",
1234 "bionic/pthread_create.cpp",
1235 "bionic/pthread_detach.cpp",
1236 "bionic/pthread_equal.cpp",
1237 "bionic/pthread_exit.cpp",
1238 "bionic/pthread_getcpuclockid.cpp",
1239 "bionic/pthread_getschedparam.cpp",
1240 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001241 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001242 "bionic/pthread_join.cpp",
1243 "bionic/pthread_key.cpp",
1244 "bionic/pthread_kill.cpp",
1245 "bionic/pthread_mutex.cpp",
1246 "bionic/pthread_once.cpp",
1247 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001248 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001249 "bionic/pthread_self.cpp",
1250 "bionic/pthread_setname_np.cpp",
1251 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001252 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001253
1254 // The following implementations depend on pthread data or implementation,
1255 // so we can't include them in libc_ndk.a.
1256 "bionic/__cxa_thread_atexit_impl.cpp",
1257 "stdlib/atexit.c",
1258 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001259 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001260
Colin Cross50c21ab2015-10-31 23:03:05 -07001261 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001262 include_dirs: ["bionic/libstdc++/include"],
1263 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001264}
1265
1266// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001267// libc_syscalls.a
1268// ========================================================
1269
1270cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001271 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001272 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001273 arch: {
1274 arm: {
1275 srcs: ["arch-arm/syscalls/**/*.S"],
1276 },
1277 arm64: {
1278 srcs: ["arch-arm64/syscalls/**/*.S"],
1279 },
1280 mips: {
1281 srcs: ["arch-mips/syscalls/**/*.S"],
1282 },
1283 mips64: {
1284 srcs: ["arch-mips64/syscalls/**/*.S"],
1285 },
1286 x86: {
1287 srcs: ["arch-x86/syscalls/**/*.S"],
1288 },
1289 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001290 srcs: ["arch-x86_64/syscalls/**/*.S"],
1291 },
1292 },
1293 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001294}
1295
1296// ========================================================
1297// libc_aeabi.a
1298// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1299// to avoid infinite recursion. For the other architectures we just build an
1300// empty library to keep this makefile simple.
1301// ========================================================
1302
1303cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001304 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001305 arch: {
1306 arm: {
1307 srcs: ["arch-arm/bionic/__aeabi.c"],
1308 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001309 },
1310 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001311 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001312}
1313
1314// ========================================================
1315// libc_ndk.a
1316// Compatibility library for the NDK. This library contains
1317// all the parts of libc that are safe to statically link.
1318// We can't safely statically link things that can only run
1319// on a certain version of the OS. Examples include
1320// anything that talks to netd (a large portion of the DNS
1321// code) and anything that is dependent on the layout of a
1322// data structure that has changed across releases (such as
1323// pthread_t).
1324// ========================================================
1325
1326cc_library_static {
1327 name: "libc_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001328 defaults: ["libc_defaults"],
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001329 srcs: libc_common_src_files + [
1330 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001331 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001332 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001333 multilib: {
1334 lib32: {
1335 srcs: libc_common_src_files_32,
1336 },
1337 },
1338 arch: {
1339 arm: {
1340 srcs: [
1341 "arch-arm/bionic/exidx_dynamic.c",
1342 "arch-common/bionic/crtbegin_so.c",
1343 "arch-arm/bionic/atexit_legacy.c",
1344 "arch-common/bionic/crtend_so.S",
1345 ],
1346 whole_static_libs: ["libc_aeabi"],
1347 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001348 },
1349
Colin Cross50c21ab2015-10-31 23:03:05 -07001350 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001351 "-fvisibility=hidden",
1352 "-DLIBC_STATIC",
1353 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001354
1355 whole_static_libs: [
1356 "libc_bionic_ndk",
George Burgess IV6cb06872017-07-21 13:28:42 -07001357 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001358 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001359 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001360 "libc_gdtoa",
1361 "libc_malloc",
1362 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001363 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001364 "libc_openbsd_ndk",
1365 "libc_stack_protector",
1366 "libc_syscalls",
1367 "libc_tzcode",
1368 "libm",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001369 "libjemalloc5",
Elliott Hughes816fab92016-05-27 17:57:46 -07001370 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001371 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001372}
1373
1374// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001375// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001376// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001377cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001378 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001379 srcs: libc_common_src_files,
1380 multilib: {
1381 lib32: {
1382 srcs: libc_common_src_files_32,
1383 },
1384 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001385 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001386
1387 whole_static_libs: [
1388 "libc_bionic",
1389 "libc_bionic_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001390 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001391 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001392 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001393 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001394 "libc_gdtoa",
1395 "libc_malloc",
1396 "libc_netbsd",
1397 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001398 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001399 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001400 "libc_stack_protector",
1401 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001402 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001403 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001404 ],
1405
1406 arch: {
1407 arm: {
1408 whole_static_libs: ["libc_aeabi"],
1409 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001410 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001411}
1412
1413// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001414// libc_common.a
1415// ========================================================
1416
1417cc_library_static {
1418 defaults: ["libc_defaults"],
1419 name: "libc_common",
1420
1421 whole_static_libs: [
1422 "libc_nopthread",
1423 "libc_pthread",
1424 ],
1425}
1426
1427// ========================================================
Haibo Huangf71edfa2018-11-12 10:06:56 -08001428// libc_common_static.a For static binaries.
1429// ========================================================
1430cc_library_static {
1431 defaults: ["libc_defaults"],
1432 name: "libc_common_static",
1433
Haibo Huangb9244ff2018-08-11 10:12:13 -07001434 arch: {
1435 x86: {
1436 srcs: ["arch-x86/static_function_dispatch.S"],
1437 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001438 arm: {
1439 srcs: ["arch-arm/static_function_dispatch.S"],
1440 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001441 },
1442
Haibo Huangf71edfa2018-11-12 10:06:56 -08001443 whole_static_libs: [
1444 "libc_common",
1445 ],
1446}
1447
1448// ========================================================
1449// libc_common_shared.a For shared libraries.
1450// ========================================================
1451cc_library_static {
1452 defaults: ["libc_defaults"],
1453 name: "libc_common_shared",
1454
Haibo Huangb9244ff2018-08-11 10:12:13 -07001455 cflags: [
1456 "-fno-stack-protector",
1457 "-fno-jump-tables",
1458 ],
1459 arch: {
1460 x86: {
1461 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1462 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001463 arm: {
Elliott Hughes84cb3242019-01-31 22:29:22 +00001464 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001465 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001466 },
1467
Haibo Huangf71edfa2018-11-12 10:06:56 -08001468 whole_static_libs: [
1469 "libc_common",
1470 ],
1471}
1472
1473// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001474// libc_nomalloc.a
1475// ========================================================
1476//
1477// This is a version of the static C library that does not
1478// include malloc. It's useful in situations when the user wants
1479// to provide their own malloc implementation, or wants to
1480// explicitly disallow the use of malloc, such as in the
1481// dynamic linker.
1482
1483cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001484 name: "libc_nomalloc",
1485
Colin Cross50c21ab2015-10-31 23:03:05 -07001486 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001487
1488 arch: {
1489 arm: {
1490 srcs: ["arch-arm/bionic/exidx_static.c"],
1491 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001492 },
1493
Colin Cross50c21ab2015-10-31 23:03:05 -07001494 cflags: ["-DLIBC_STATIC"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001495
Colin Crossa3f9fca2016-01-11 13:20:55 -08001496 whole_static_libs: [
Haibo Huangf71edfa2018-11-12 10:06:56 -08001497 "libc_common_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001498 "libc_init_static",
1499 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001500}
1501
1502// ========================================================
1503// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1504// ========================================================
1505cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001506 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001507 srcs: ["bionic/jemalloc_wrapper.cpp"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001508 cflags: ["-fvisibility=hidden"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001509
Dan Willemsen208ae172015-09-16 16:33:27 -07001510 name: "libc_malloc",
Dan Willemsen208ae172015-09-16 16:33:27 -07001511}
1512
dimitryc0c0ef62018-12-05 16:33:52 +01001513filegroup {
1514 name: "libc_sources_shared",
1515 srcs: [
1516 "arch-common/bionic/crtbegin_so.c",
1517 "arch-common/bionic/crtbrand.S",
1518 "bionic/icu.cpp",
1519 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001520 "bionic/malloc_common_dynamic.cpp",
1521 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001522 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001523 "bionic/NetdClient.cpp",
1524 "arch-common/bionic/crtend_so.S",
1525 ],
1526}
1527
1528filegroup {
1529 name: "libc_sources_static",
1530 srcs: [
1531 "bionic/dl_iterate_phdr_static.cpp",
1532 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001533 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001534 ],
1535}
1536
1537filegroup {
1538 name: "libc_sources_shared_arm",
1539 srcs: [
1540 "arch-arm/bionic/exidx_dynamic.c",
1541 "arch-arm/bionic/atexit_legacy.c",
1542 ],
1543}
1544
1545filegroup {
1546 name: "libc_sources_static_arm",
1547 srcs: [ "arch-arm/bionic/exidx_static.c" ],
1548}
1549
Dan Willemsen208ae172015-09-16 16:33:27 -07001550// ========================================================
1551// libc.a + libc.so
1552// ========================================================
1553cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001554 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001555 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001556 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001557 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001558 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001559 platform_sdk_version: {
1560 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1561 },
1562 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001563 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001564 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001565 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001566 whole_static_libs: [
1567 "libc_init_static",
1568 "libc_common_static",
1569 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001570 },
1571 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001572 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001573 whole_static_libs: [
1574 "libc_init_dynamic",
1575 "libc_common_shared",
1576 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001577 },
1578
Jiyong Park036e09c2019-02-25 10:54:29 +09001579 required: ["tzdata"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001580
1581 // Leave the symbols in the shared library so that stack unwinders can produce
1582 // meaningful name resolution.
Colin Cross37f36322016-04-25 14:09:13 -07001583 strip: {
1584 keep_symbols: true,
1585 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001586
Colin Cross4ce94d22016-11-15 13:15:43 -08001587 // Do not pack libc.so relocations; see http://b/20645321 for details.
1588 pack_relocations: false,
1589
dimitry06016f22018-01-05 11:39:28 +01001590 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1591 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1592 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1593 // those new libraries from libgcc.a are not declared external; if that were the case,
1594 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1595 // on the external symbols from the dependent libraries. That would create a "cloaked"
1596 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001597
dimitry06016f22018-01-05 11:39:28 +01001598 shared_libs: [
1599 "ld-android",
1600 "libdl",
1601 ],
Jiyong Park4e46ac62019-04-02 23:04:52 +09001602 static_libs: [
1603 "libdl_android",
1604 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001605 whole_static_libs: [
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001606 "libjemalloc5",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001607 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001608
1609 nocrt: true,
1610
Dan Willemsen208ae172015-09-16 16:33:27 -07001611 arch: {
1612 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001613 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001614 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001615 ldflags: ["-Wl,--hash-style=both"],
1616
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001617 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001618
Dan Willemsen208ae172015-09-16 16:33:27 -07001619 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001620 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001621 // special for arm
1622 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001623 },
1624 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001625 srcs: [":libc_sources_static_arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001626 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001627 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001628 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001629 version_script: ":libc.arm64.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001630 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001631 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001632 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001633 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001634 ldflags: ["-Wl,--hash-style=both"],
1635
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001636 version_script: ":libc.x86.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001637 },
1638 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001639 version_script: ":libc.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001640 },
1641 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001642
1643 stubs: {
1644 symbol_file: "libc.map.txt",
1645 versions: ["10000"],
1646 },
Vic Yang6903fb82019-01-14 11:34:39 -08001647
1648 symbol_ordering_file: "symbol_ordering",
Dan Willemsen208ae172015-09-16 16:33:27 -07001649}
1650
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001651genrule {
1652 name: "libc.arm.map",
1653 out: ["libc.arm.map"],
1654 srcs: ["libc.map.txt"],
1655 tool_files: [":bionic-generate-version-script"],
1656 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1657}
1658
1659genrule {
1660 name: "libc.arm64.map",
1661 out: ["libc.arm64.map"],
1662 srcs: ["libc.map.txt"],
1663 tool_files: [":bionic-generate-version-script"],
1664 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1665}
1666
1667genrule {
1668 name: "libc.x86.map",
1669 out: ["libc.x86.map"],
1670 srcs: ["libc.map.txt"],
1671 tool_files: [":bionic-generate-version-script"],
1672 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1673}
1674
1675genrule {
1676 name: "libc.x86_64.map",
1677 out: ["libc.x86_64.map"],
1678 srcs: ["libc.map.txt"],
1679 tool_files: [":bionic-generate-version-script"],
1680 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1681}
1682
Logan Chien17af91b2019-01-15 21:19:56 +08001683// libc_headers for libasync_safe and libpropertyinfoparser
1684cc_library_headers {
1685 name: "libc_headers",
1686
1687 host_supported: true,
1688 vendor_available: true,
1689 recovery_available: true,
1690
1691 no_libcrt: true,
1692 no_libgcc: true,
1693 stl: "none",
1694 system_shared_libs: [],
1695
1696 export_include_dirs: [
1697 "include",
1698 "kernel/uapi",
1699 "kernel/android/uapi",
1700 ],
1701
1702 arch: {
1703 arm: {
1704 export_include_dirs: [
1705 "kernel/uapi/asm-arm",
1706 ],
1707 },
1708 arm64: {
1709 export_include_dirs: [
1710 "kernel/uapi/asm-arm64",
1711 ],
1712 },
1713 mips: {
1714 export_include_dirs: [
1715 "kernel/uapi/asm-mips",
1716 ],
1717 },
1718 mips64: {
1719 export_include_dirs: [
1720 "kernel/uapi/asm-mips",
1721 ],
1722 },
1723 x86: {
1724 export_include_dirs: [
1725 "kernel/uapi/asm-x86",
1726 ],
1727 },
1728 x86_64: {
1729 export_include_dirs: [
1730 "kernel/uapi/asm-x86",
1731 ],
1732 },
1733 },
1734}
1735
Dan Willemsen208ae172015-09-16 16:33:27 -07001736// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001737// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001738// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001739
Dan Willemsen208ae172015-09-16 16:33:27 -07001740cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001741 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001742 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001743 srcs: [
1744 "bionic/__cxa_guard.cpp",
1745 "bionic/__cxa_pure_virtual.cpp",
1746 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001747 ],
1748 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001749 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001750 static_libs: ["libasync_safe"],
Rashed Abdel-Tawab127d86d2018-04-15 10:18:26 -07001751 vendor_available: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001752
Dan Willemsen6b3be172018-12-03 13:57:20 -08001753 static: {
1754 system_shared_libs: [],
1755 },
1756 shared: {
1757 system_shared_libs: ["libc"],
1758 },
1759
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001760 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001761 arch: {
1762 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001763 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001764 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001765 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001766 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001767 },
1768 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001769 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001770 },
1771 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001772 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001773 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001774 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001775 },
1776 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001777 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001778 },
1779 },
1780}
1781
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001782genrule {
1783 name: "libstdc++.arm.map",
1784 out: ["libstdc++.arm.map"],
1785 srcs: ["libstdc++.map.txt"],
1786 tool_files: [":bionic-generate-version-script"],
1787 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1788}
1789
1790genrule {
1791 name: "libstdc++.arm64.map",
1792 out: ["libstdc++.arm64.map"],
1793 srcs: ["libstdc++.map.txt"],
1794 tool_files: [":bionic-generate-version-script"],
1795 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1796}
1797
1798genrule {
1799 name: "libstdc++.x86.map",
1800 out: ["libstdc++.x86.map"],
1801 srcs: ["libstdc++.map.txt"],
1802 tool_files: [":bionic-generate-version-script"],
1803 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1804}
1805
1806genrule {
1807 name: "libstdc++.x86_64.map",
1808 out: ["libstdc++.x86_64.map"],
1809 srcs: ["libstdc++.map.txt"],
1810 tool_files: [":bionic-generate-version-script"],
1811 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1812}
1813
1814// ========================================================
1815// crt object files.
1816// ========================================================
1817
Colin Cross50c21ab2015-10-31 23:03:05 -07001818cc_defaults {
1819 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001820 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001821 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001822 recovery_available: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001823
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001824 cflags: [
1825 "-Wno-gcc-compat",
1826 "-Wall",
1827 "-Werror",
1828 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001829}
1830
Colin Cross50c21ab2015-10-31 23:03:05 -07001831cc_defaults {
1832 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001833 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001834
1835 arch: {
1836 mips: {
1837 cflags: ["-fPIC"],
1838 },
1839 mips64: {
1840 cflags: ["-fPIC"],
1841 },
1842 x86: {
1843 cflags: ["-fPIC"],
1844 },
1845 x86_64: {
1846 cflags: ["-fPIC"],
1847 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001848 },
Colin Crossab179442018-09-27 11:03:22 -07001849 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001850}
1851
Dan Willemsen208ae172015-09-16 16:33:27 -07001852cc_object {
1853 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001854 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001855 local_include_dirs: ["include"],
1856 product_variables: {
1857 platform_sdk_version: {
1858 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1859 },
1860 },
1861 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001862
Colin Cross7d7b3682017-11-03 13:38:40 -07001863 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001864}
1865
Dan Willemsen208ae172015-09-16 16:33:27 -07001866cc_object {
1867 name: "crtbegin_so1",
1868 local_include_dirs: ["include"],
1869 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001870
Colin Cross7d7b3682017-11-03 13:38:40 -07001871 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001872}
1873
Dan Willemsen208ae172015-09-16 16:33:27 -07001874cc_object {
1875 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07001876
Colin Cross7d7b3682017-11-03 13:38:40 -07001877 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07001878 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001879 "crtbegin_so1",
1880 "crtbrand",
1881 ],
1882}
1883
Dan Willemsen208ae172015-09-16 16:33:27 -07001884cc_object {
1885 name: "crtend_so",
1886 local_include_dirs: ["include"],
1887 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001888
Colin Cross7d7b3682017-11-03 13:38:40 -07001889 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001890}
1891
Dan Willemsen208ae172015-09-16 16:33:27 -07001892cc_object {
1893 name: "crtbegin_static1",
1894 local_include_dirs: ["include"],
1895 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001896
Colin Cross50c21ab2015-10-31 23:03:05 -07001897 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001898 mips: {
1899 srcs: [
1900 "arch-mips/bionic/crtbegin.c",
1901 ],
1902 exclude_srcs: [
1903 "arch-common/bionic/crtbegin.c",
1904 ],
1905 },
1906 mips64: {
1907 srcs: [
1908 "arch-mips64/bionic/crtbegin.c",
1909 ],
1910 exclude_srcs: [
1911 "arch-common/bionic/crtbegin.c",
1912 ],
1913 },
1914 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001915
1916 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001917}
1918
Dan Willemsen208ae172015-09-16 16:33:27 -07001919cc_object {
1920 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07001921
Colin Cross77d57bf2016-04-11 14:34:18 -07001922 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001923 "crtbegin_static1",
1924 "crtbrand",
1925 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001926 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001927}
1928
Dan Willemsen208ae172015-09-16 16:33:27 -07001929cc_object {
1930 name: "crtbegin_dynamic1",
1931 local_include_dirs: ["include"],
1932 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001933
Colin Cross50c21ab2015-10-31 23:03:05 -07001934 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001935 mips: {
1936 srcs: [
1937 "arch-mips/bionic/crtbegin.c",
1938 ],
1939 exclude_srcs: [
1940 "arch-common/bionic/crtbegin.c",
1941 ],
1942 },
1943 mips64: {
1944 srcs: [
1945 "arch-mips64/bionic/crtbegin.c",
1946 ],
1947 exclude_srcs: [
1948 "arch-common/bionic/crtbegin.c",
1949 ],
1950 },
1951 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001952 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001953}
1954
Dan Willemsen208ae172015-09-16 16:33:27 -07001955cc_object {
1956 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07001957
Colin Cross77d57bf2016-04-11 14:34:18 -07001958 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001959 "crtbegin_dynamic1",
1960 "crtbrand",
1961 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07001962 target: {
1963 linux_bionic: {
1964 generated_sources: ["host_bionic_linker_asm"],
1965 objs: [
1966 "linker_wrapper",
1967 ],
1968 },
1969 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001970 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001971}
1972
Dan Willemsen208ae172015-09-16 16:33:27 -07001973cc_object {
1974 // We rename crtend.o to crtend_android.o to avoid a
1975 // name clash between gcc and bionic.
1976 name: "crtend_android",
1977 local_include_dirs: ["include"],
1978 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001979
Colin Cross50c21ab2015-10-31 23:03:05 -07001980 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001981}
Colin Crossbaa48992016-07-13 11:15:21 -07001982
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001983// ========================================================
1984// NDK headers.
1985// ========================================================
1986
Dan Albert26e1c412018-05-24 14:56:46 -07001987versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07001988 name: "common_libc",
1989 from: "include",
1990 to: "",
1991 license: "NOTICE",
1992}
Dan Albert4238a352016-06-28 11:18:05 -07001993
1994ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08001995 name: "libc_uapi",
1996 from: "kernel/uapi",
1997 to: "",
1998 srcs: [
1999 "kernel/uapi/asm-generic/**/*.h",
2000 "kernel/uapi/drm/**/*.h",
2001 "kernel/uapi/linux/**/*.h",
2002 "kernel/uapi/misc/**/*.h",
2003 "kernel/uapi/mtd/**/*.h",
2004 "kernel/uapi/rdma/**/*.h",
2005 "kernel/uapi/scsi/**/*.h",
2006 "kernel/uapi/sound/**/*.h",
2007 "kernel/uapi/video/**/*.h",
2008 "kernel/uapi/xen/**/*.h",
2009 ],
Dan Albert92592652016-10-20 01:42:54 -07002010 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002011}
2012
2013ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002014 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002015 from: "kernel/android/uapi/linux",
2016 to: "linux",
2017 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002018 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002019}
2020
2021ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002022 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002023 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002024 to: "scsi",
2025 srcs: ["kernel/android/scsi/**/*.h"],
2026 license: "NOTICE",
2027}
2028
2029ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002030 name: "libc_asm_arm",
2031 from: "kernel/uapi/asm-arm",
2032 to: "arm-linux-androideabi",
2033 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002034 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002035}
2036
2037ndk_headers {
2038 name: "libc_asm_arm64",
2039 from: "kernel/uapi/asm-arm64",
2040 to: "aarch64-linux-android",
2041 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002042 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002043}
2044
Elliott Hughesee291c02017-12-11 11:32:34 -08002045// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002046ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002047 name: "libc_asm_mips",
2048 from: "kernel/uapi/asm-mips",
2049 to: "mipsel-linux-android",
2050 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2051 license: "NOTICE",
2052}
2053
Elliott Hughesee291c02017-12-11 11:32:34 -08002054// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002055ndk_headers {
2056 name: "libc_asm_mips64",
2057 from: "kernel/uapi/asm-mips",
2058 to: "mips64el-linux-android",
2059 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2060 license: "NOTICE",
2061}
2062
2063ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002064 name: "libc_asm_x86",
2065 from: "kernel/uapi/asm-x86",
2066 to: "i686-linux-android",
2067 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002068 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002069}
2070
2071ndk_headers {
2072 name: "libc_asm_x86_64",
2073 from: "kernel/uapi/asm-x86",
2074 to: "x86_64-linux-android",
2075 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002076 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002077}
2078
Dan Albert4238a352016-06-28 11:18:05 -07002079ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002080 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002081 symbol_file: "libc.map.txt",
2082 first_version: "9",
2083}
2084
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002085llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002086 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002087 symbol_file: "libc.map.txt",
2088 export_headers_as_system: true,
2089 export_preprocessed_headers: ["include"],
Logan Chien17af91b2019-01-15 21:19:56 +08002090 export_include_dirs: [
2091 "kernel/android/uapi",
2092 "kernel/uapi",
2093 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002094 arch: {
2095 arm: {
2096 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002097 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002098 ],
2099 },
2100 arm64: {
2101 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002102 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002103 ],
2104 },
2105 mips: {
2106 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002107 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002108 ],
2109 },
2110 mips64: {
2111 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002112 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002113 ],
2114 },
2115 x86: {
2116 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002117 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002118 ],
2119 },
2120 x86_64: {
2121 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002122 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002123 ],
2124 },
2125 },
2126}
2127
Dan Albertdf31aff2016-10-06 15:50:41 -07002128ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002129 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002130 symbol_file: "libstdc++.map.txt",
2131 first_version: "9",
2132}
2133
Dan Willemsenca056d72018-01-08 14:00:24 -08002134// Export these headers for toolbox to process
2135filegroup {
2136 name: "kernel_input_headers",
2137 srcs: [
2138 "kernel/uapi/linux/input.h",
2139 "kernel/uapi/linux/input-event-codes.h",
2140 ],
2141}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002142
2143// Generate a syscall name / number mapping. These objects are text files
2144// (thanks to the -dD -E flags) and not binary files. They will then be
2145// consumed by the genseccomp.py script and converted into C++ code.
2146cc_defaults {
2147 name: "libseccomp_gen_syscall_nrs_defaults",
2148 recovery_available: true,
2149 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2150 cflags: [
2151 "-dD",
2152 "-E",
2153 "-Wall",
2154 "-Werror",
2155 "-nostdinc",
2156 ],
2157}
2158
2159cc_object {
2160 name: "libseccomp_gen_syscall_nrs_arm",
2161 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2162 local_include_dirs: [
2163 "kernel/uapi/asm-arm",
2164 "kernel/uapi",
2165 ],
2166}
2167
2168cc_object {
2169 name: "libseccomp_gen_syscall_nrs_arm64",
2170 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2171 local_include_dirs: [
2172 "kernel/uapi/asm-arm64",
2173 "kernel/uapi",
2174 ],
2175}
2176
2177cc_object {
2178 name: "libseccomp_gen_syscall_nrs_x86",
2179 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2180 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2181 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2182 local_include_dirs: [
2183 "kernel/uapi/asm-x86",
2184 "kernel/uapi",
2185 ],
2186}
2187
2188cc_object {
2189 name: "libseccomp_gen_syscall_nrs_x86_64",
2190 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2191 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2192 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2193 local_include_dirs: [
2194 "kernel/uapi/asm-x86",
2195 "kernel/uapi",
2196 ],
2197}
2198
2199cc_object {
2200 name: "libseccomp_gen_syscall_nrs_mips",
2201 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2202 cflags: [
2203 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2204 ],
2205 local_include_dirs: [
2206 "kernel/uapi/asm-mips",
2207 "kernel/uapi",
2208 ],
2209}
2210
2211cc_object {
2212 name: "libseccomp_gen_syscall_nrs_mips64",
2213 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2214 cflags: [
2215 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2216 ],
2217 local_include_dirs: [
2218 "kernel/uapi/asm-mips",
2219 "kernel/uapi",
2220 ],
2221}
2222
Elliott Hughes32a0a212019-09-17 16:37:05 -07002223// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002224python_binary_host {
2225 name: "genseccomp",
2226 main: "tools/genseccomp.py",
2227
2228 srcs: [
2229 "tools/genseccomp.py",
2230 "tools/gensyscalls.py",
2231 ],
2232
2233 data: [
2234 "kernel/uapi/**/*.h",
2235 ],
2236
2237 version: {
2238 py2: {
2239 enabled: true,
2240 },
2241 py3: {
2242 enabled: false,
2243 },
2244 },
2245}
2246
Martijn Coenen0c6de752019-01-02 12:52:51 +01002247python_binary_host {
2248 name: "genfunctosyscallnrs",
2249 main: "tools/genfunctosyscallnrs.py",
2250
2251 srcs: [
2252 "tools/genseccomp.py",
2253 "tools/genfunctosyscallnrs.py",
2254 "tools/gensyscalls.py",
2255 ],
2256
2257 data: [
2258 "kernel/uapi/**/*.h",
2259 ],
2260
2261 version: {
2262 py2: {
2263 enabled: true,
2264 },
2265 py3: {
2266 enabled: false,
2267 },
2268 },
2269}
2270
2271cc_genrule {
2272 name: "func_to_syscall_nrs",
2273 recovery_available: true,
2274 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2275
2276 tools: [ "genfunctosyscallnrs" ],
2277
2278 srcs: [
2279 "SYSCALLS.TXT",
2280 ":libseccomp_gen_syscall_nrs_arm",
2281 ":libseccomp_gen_syscall_nrs_arm64",
2282 ":libseccomp_gen_syscall_nrs_mips",
2283 ":libseccomp_gen_syscall_nrs_mips64",
2284 ":libseccomp_gen_syscall_nrs_x86",
2285 ":libseccomp_gen_syscall_nrs_x86_64",
2286 ],
2287
2288 out: [
2289 "func_to_syscall_nrs.h",
2290 ],
2291}
2292
Martijn Coenenc3752be2019-01-09 16:19:57 +01002293// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2294genrule {
2295 name: "generate_app_zygote_blacklist",
2296 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2297 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2298 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2299}
2300
2301cc_genrule {
2302 name: "libseccomp_policy_app_zygote_sources",
2303 recovery_available: true,
2304 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2305
2306 tools: [ "genseccomp" ],
2307
2308 srcs: [
2309 "SYSCALLS.TXT",
2310 "SECCOMP_WHITELIST_COMMON.TXT",
2311 "SECCOMP_WHITELIST_APP.TXT",
2312 "SECCOMP_BLACKLIST_COMMON.TXT",
Bram Bonnéefbd5d52020-05-06 13:49:55 +02002313 "SECCOMP_PRIORITY.TXT",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002314 ":generate_app_zygote_blacklist",
2315 ":libseccomp_gen_syscall_nrs_arm",
2316 ":libseccomp_gen_syscall_nrs_arm64",
2317 ":libseccomp_gen_syscall_nrs_mips",
2318 ":libseccomp_gen_syscall_nrs_mips64",
2319 ":libseccomp_gen_syscall_nrs_x86",
2320 ":libseccomp_gen_syscall_nrs_x86_64",
2321 ],
2322
2323 out: [
2324 "arm64_app_zygote_policy.cpp",
2325 "arm_app_zygote_policy.cpp",
2326 "mips64_app_zygote_policy.cpp",
2327 "mips_app_zygote_policy.cpp",
2328 "x86_64_app_zygote_policy.cpp",
2329 "x86_app_zygote_policy.cpp",
2330 ],
2331}
2332
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002333cc_genrule {
2334 name: "libseccomp_policy_app_sources",
2335 recovery_available: true,
2336 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2337
2338 tools: [ "genseccomp" ],
2339
2340 srcs: [
2341 "SYSCALLS.TXT",
2342 "SECCOMP_WHITELIST_COMMON.TXT",
2343 "SECCOMP_WHITELIST_APP.TXT",
2344 "SECCOMP_BLACKLIST_COMMON.TXT",
2345 "SECCOMP_BLACKLIST_APP.TXT",
Bram Bonnéefbd5d52020-05-06 13:49:55 +02002346 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002347 ":libseccomp_gen_syscall_nrs_arm",
2348 ":libseccomp_gen_syscall_nrs_arm64",
2349 ":libseccomp_gen_syscall_nrs_mips",
2350 ":libseccomp_gen_syscall_nrs_mips64",
2351 ":libseccomp_gen_syscall_nrs_x86",
2352 ":libseccomp_gen_syscall_nrs_x86_64",
2353 ],
2354
2355 out: [
2356 "arm64_app_policy.cpp",
2357 "arm_app_policy.cpp",
2358 "mips64_app_policy.cpp",
2359 "mips_app_policy.cpp",
2360 "x86_64_app_policy.cpp",
2361 "x86_app_policy.cpp",
2362 ],
2363}
2364
2365cc_genrule {
2366 name: "libseccomp_policy_system_sources",
2367 recovery_available: true,
2368 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2369
2370 tools: [ "genseccomp" ],
2371
2372 srcs: [
2373 "SYSCALLS.TXT",
2374 "SECCOMP_WHITELIST_COMMON.TXT",
2375 "SECCOMP_WHITELIST_SYSTEM.TXT",
2376 "SECCOMP_BLACKLIST_COMMON.TXT",
Bram Bonnéefbd5d52020-05-06 13:49:55 +02002377 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002378 ":libseccomp_gen_syscall_nrs_arm",
2379 ":libseccomp_gen_syscall_nrs_arm64",
2380 ":libseccomp_gen_syscall_nrs_mips",
2381 ":libseccomp_gen_syscall_nrs_mips64",
2382 ":libseccomp_gen_syscall_nrs_x86",
2383 ":libseccomp_gen_syscall_nrs_x86_64",
2384 ],
2385
2386 out: [
2387 "arm64_system_policy.cpp",
2388 "arm_system_policy.cpp",
2389 "mips64_system_policy.cpp",
2390 "mips_system_policy.cpp",
2391 "x86_64_system_policy.cpp",
2392 "x86_system_policy.cpp",
2393 ],
2394}
2395
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002396cc_library {
2397 name: "libseccomp_policy",
2398 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002399 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002400 generated_sources: [
2401 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002402 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002403 "libseccomp_policy_system_sources",
2404 ],
2405
2406 srcs: [
2407 "seccomp/seccomp_policy.cpp",
2408 ],
2409
2410 export_include_dirs: ["seccomp/include"],
2411 cflags: [
2412 "-Wall",
2413 "-Werror",
2414 ],
2415 shared: {
2416 shared_libs: ["libbase"],
2417 },
2418 static: {
2419 static_libs: ["libbase"],
2420 },
2421}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002422
2423// This is a temporary library that will use scudo as the native memory
2424// allocator. To use it, add it as the first shared library.
2425cc_library_shared {
2426 name: "libc_scudo",
2427 vendor_available: true,
2428 srcs: [
2429 "bionic/malloc_common.cpp",
2430 "bionic/malloc_common_dynamic.cpp",
2431 "bionic/malloc_heapprofd.cpp",
2432 "bionic/malloc_limit.cpp",
2433 "bionic/scudo_wrapper.cpp",
2434 "bionic/__set_errno.cpp",
2435 ],
2436 cflags: ["-DUSE_SCUDO"],
2437 stl: "none",
2438 system_shared_libs: [],
2439
2440 header_libs: ["libc_headers"],
2441
2442 static_libs: ["libasync_safe"],
2443
2444 allow_undefined_symbols: true,
2445 shared_libs: ["libscudo_wrapper"],
2446
2447 arch: {
2448 arm: {
2449 srcs: ["arch-arm/syscalls/__rt_sigprocmask.S"],
2450 },
2451 arm64: {
2452 srcs: ["arch-arm64/syscalls/__rt_sigprocmask.S"],
2453 },
2454 x86: {
2455 srcs: [
2456 "arch-x86/bionic/__libc_init_sysinfo.cpp",
2457 "arch-x86/syscalls/__rt_sigprocmask.S",
2458 ],
2459 },
2460 x86_64: {
2461 srcs: ["arch-x86_64/syscalls/__rt_sigprocmask.S"],
2462 },
2463 },
2464
2465 // Mark this library as global so it overrides all the allocation
2466 // definitions properly.
2467 ldflags: ["-Wl,-z,global"],
2468}
2469
2470subdirs = [
2471 "bionic/scudo",
2472]