blob: e1c007208b01db49981375f03cb96c410a755d4b [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001// Define the common source files for all the libc instances
2// =========================================================
3libc_common_src_files = [
Christopher Ferris7a3681e2017-04-24 17:48:32 -07004 "async_safe/async_safe_log.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07005 "bionic/ether_aton.c",
6 "bionic/ether_ntoa.c",
7 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/pututline.c",
11 "bionic/sched_cpualloc.c",
12 "bionic/sched_cpucount.c",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070013 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070014 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070015 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080016 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070017 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080018 "stdio/vfscanf.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070019 "stdio/vfwscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070020 "stdlib/exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070021]
22
23// Various kinds of cruft.
24// ========================================================
25libc_common_src_files += [
26 "bionic/ndk_cruft.cpp",
27]
28
29libc_common_src_files_32 = [
30 "bionic/legacy_32_bit_support.cpp",
31 "bionic/time64.c",
32]
33
Elliott Hughes53cf3482016-08-09 13:06:41 -070034libc_common_flags = [
35 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080036 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070037 "-Wall",
38 "-Wextra",
39 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080040 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070041 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070042 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070043 "-Wframe-larger-than=2048",
George Burgess IVfa5410f2018-08-13 17:44:06 -070044 "-Wimplicit-fallthrough",
Elliott Hughes53cf3482016-08-09 13:06:41 -070045
46 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
47 "-Werror=pointer-to-int-cast",
48 "-Werror=int-to-pointer-cast",
49 "-Werror=type-limits",
50 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080051
52 // Clang's exit-time destructor registration hides __dso_handle, but
53 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
54 "-Wexit-time-destructors",
Elliott Hughes53cf3482016-08-09 13:06:41 -070055]
56
Dan Willemsen208ae172015-09-16 16:33:27 -070057// Define some common cflags
58// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070059cc_defaults {
60 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080061 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070062 cflags: libc_common_flags,
63 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070064 conlyflags: ["-std=gnu99"],
65 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070066 include_dirs: [
67 "bionic/libc/async_safe/include",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -070068 "external/jemalloc_new/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070069 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070070
Colin Cross50c21ab2015-10-31 23:03:05 -070071 stl: "none",
72 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070073 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070074 address: false,
75 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070076 // TODO(b/132640749): Fix broken fuzzer support.
77 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070078 },
Colin Cross50c21ab2015-10-31 23:03:05 -070079 native_coverage: false,
Jiyong Park5603c6e2018-04-27 21:53:11 +090080 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020081 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080082
Yi Konge3d90de2019-02-20 14:28:56 -080083 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
84 // warning since this is intended right now.
85 ldflags: ["-Wl,-z,muldefs"],
Dan Willemsen208ae172015-09-16 16:33:27 -070086}
87
Dan Willemsen208ae172015-09-16 16:33:27 -070088// ========================================================
89// libc_stack_protector.a - stack protector code
90// ========================================================
91//
Colin Crossa3f9fca2016-01-11 13:20:55 -080092// Code that implements the stack protector (or that runs
93// before TLS has been set up) needs to be compiled with
94// -fno-stack-protector, since it accesses the stack canary
95// TLS slot.
Dan Willemsen208ae172015-09-16 16:33:27 -070096
97cc_library_static {
98
Colin Crossa3f9fca2016-01-11 13:20:55 -080099 srcs: [
100 "bionic/__libc_init_main_thread.cpp",
101 "bionic/__stack_chk_fail.cpp",
102 ],
103 arch: {
104 arm64: {
105 srcs: ["arch-arm64/bionic/__set_tls.c"],
106 },
107 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700108 srcs: [
109 "arch-x86/bionic/__libc_init_sysinfo.cpp",
110 "arch-x86/bionic/__set_tls.cpp",
111 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800112 },
113 x86_64: {
114 srcs: ["arch-x86_64/bionic/__set_tls.c"],
115 },
116 },
117
Colin Cross50c21ab2015-10-31 23:03:05 -0700118 defaults: ["libc_defaults"],
119 cflags: ["-fno-stack-protector"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700120 name: "libc_stack_protector",
Dan Willemsen208ae172015-09-16 16:33:27 -0700121}
122
Colin Crossa3f9fca2016-01-11 13:20:55 -0800123// libc_init_static.cpp also needs to be built without stack protector,
124// because it's responsible for setting up TLS for static executables.
125// This isn't the case for dynamic executables because the dynamic linker
126// has already set up the main thread's TLS.
127
128cc_library_static {
129 name: "libc_init_static",
130 defaults: ["libc_defaults"],
131 srcs: ["bionic/libc_init_static.cpp"],
132 cflags: ["-fno-stack-protector"],
133}
134
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700135cc_library_static {
136 name: "libc_init_dynamic",
137 defaults: ["libc_defaults"],
138 srcs: ["bionic/libc_init_dynamic.cpp"],
139 cflags: ["-fno-stack-protector"],
140}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800141
Dan Willemsen208ae172015-09-16 16:33:27 -0700142// ========================================================
143// libc_tzcode.a - upstream 'tzcode' code
144// ========================================================
145
146cc_library_static {
147
Colin Cross50c21ab2015-10-31 23:03:05 -0700148 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700149 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800150 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700151 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700152 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
153 ],
154
Colin Cross50c21ab2015-10-31 23:03:05 -0700155 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700156 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700157 // Don't use ridiculous amounts of stack.
158 "-DALL_STATE",
159 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
160 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800161 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700162 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700163 // The name of the tm_gmtoff field in our struct tm.
164 "-DTM_GMTOFF=tm_gmtoff",
165 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700166 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700167 // Include `tzname`, `timezone`, and `daylight` globals.
168 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700169 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800170 // Use the empty string (instead of " ") as the timezone abbreviation
171 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700172 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700173 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
174 "-Dlint",
175 ],
176
Dan Willemsen208ae172015-09-16 16:33:27 -0700177 local_include_dirs: ["tzcode/"],
178 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700179}
180
181// ========================================================
182// libc_dns.a - modified NetBSD DNS code
183// ========================================================
184
185cc_library_static {
186
Colin Cross50c21ab2015-10-31 23:03:05 -0700187 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700188 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800189 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700190
191 "upstream-netbsd/lib/libc/isc/ev_streams.c",
192 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700193 ],
194
Colin Cross50c21ab2015-10-31 23:03:05 -0700195 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700196 "-DANDROID_CHANGES",
197 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700198 "-Wno-unused-parameter",
199 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700200 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700201 ],
202
Dan Willemsen208ae172015-09-16 16:33:27 -0700203 local_include_dirs: [
204 "dns/include",
205 "private",
206 "upstream-netbsd/lib/libc/include",
207 "upstream-netbsd/android/include",
208 ],
209
210 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700211}
212
213// ========================================================
214// libc_freebsd.a - upstream FreeBSD C library code
215// ========================================================
216//
217// These files are built with the freebsd-compat.h header file
218// automatically included.
219
220cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700221 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700222 srcs: [
223 "upstream-freebsd/lib/libc/gen/ldexp.c",
224 "upstream-freebsd/lib/libc/gen/sleep.c",
225 "upstream-freebsd/lib/libc/gen/usleep.c",
226 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700227 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
228 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
229 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
230 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700231 "upstream-freebsd/lib/libc/stdlib/qsort.c",
232 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700233 "upstream-freebsd/lib/libc/string/wcpcpy.c",
234 "upstream-freebsd/lib/libc/string/wcpncpy.c",
235 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700236 "upstream-freebsd/lib/libc/string/wcscat.c",
237 "upstream-freebsd/lib/libc/string/wcschr.c",
238 "upstream-freebsd/lib/libc/string/wcscmp.c",
239 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700240 "upstream-freebsd/lib/libc/string/wcscspn.c",
241 "upstream-freebsd/lib/libc/string/wcsdup.c",
242 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700243 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700244 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
245 "upstream-freebsd/lib/libc/string/wcsncat.c",
246 "upstream-freebsd/lib/libc/string/wcsncmp.c",
247 "upstream-freebsd/lib/libc/string/wcsncpy.c",
248 "upstream-freebsd/lib/libc/string/wcsnlen.c",
249 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700250 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700251 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700252 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700253 "upstream-freebsd/lib/libc/string/wcstok.c",
254 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700255 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700256 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700257 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800258 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700259 ],
260 arch: {
261 arm64: {
262 exclude_srcs: [
263 "upstream-freebsd/lib/libc/string/wmemmove.c",
264 ],
265 },
266 x86: {
267 exclude_srcs: [
268 "upstream-freebsd/lib/libc/string/wcschr.c",
269 "upstream-freebsd/lib/libc/string/wcscmp.c",
270 "upstream-freebsd/lib/libc/string/wcslen.c",
271 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700272 "upstream-freebsd/lib/libc/string/wmemcmp.c",
273 "upstream-freebsd/lib/libc/string/wcscat.c",
274 "upstream-freebsd/lib/libc/string/wcscpy.c",
275 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530276 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700277 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700278 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700279 },
280
Colin Cross50c21ab2015-10-31 23:03:05 -0700281 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700282 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700283 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700284 "-include freebsd-compat.h",
285 ],
286
Dan Willemsen208ae172015-09-16 16:33:27 -0700287 local_include_dirs: [
288 "upstream-freebsd/android/include",
289 ],
290
291 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700292}
293
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700294cc_library_static {
295 defaults: ["libc_defaults"],
296 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700297 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700298 "upstream-freebsd/lib/libc/stdlib/realpath.c",
299 ],
300
301 cflags: [
302 "-Wno-sign-compare",
303 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700304 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700305 ],
306
307 local_include_dirs: [
308 "upstream-freebsd/android/include",
309 ],
310
311 name: "libc_freebsd_large_stack",
312}
313
Dan Willemsen208ae172015-09-16 16:33:27 -0700314// ========================================================
315// libc_netbsd.a - upstream NetBSD C library code
316// ========================================================
317//
318// These files are built with the netbsd-compat.h header file
319// automatically included.
320
321cc_library_static {
322
Colin Cross50c21ab2015-10-31 23:03:05 -0700323 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700324 srcs: [
325 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700326 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700327 "upstream-netbsd/lib/libc/gen/psignal.c",
328 "upstream-netbsd/lib/libc/gen/utime.c",
329 "upstream-netbsd/lib/libc/gen/utmp.c",
330 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
331 "upstream-netbsd/lib/libc/regex/regcomp.c",
332 "upstream-netbsd/lib/libc/regex/regerror.c",
333 "upstream-netbsd/lib/libc/regex/regexec.c",
334 "upstream-netbsd/lib/libc/regex/regfree.c",
335 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700336 "upstream-netbsd/lib/libc/stdlib/drand48.c",
337 "upstream-netbsd/lib/libc/stdlib/erand48.c",
338 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
339 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700340 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
341 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
342 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
343 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
344 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
345 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
346 "upstream-netbsd/lib/libc/stdlib/seed48.c",
347 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700348 ],
349 multilib: {
350 lib32: {
351 // LP32 cruft
352 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
353 },
354 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700355 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700356 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800357 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700358 "-DPOSIX_MISTAKE",
359 "-include netbsd-compat.h",
360 ],
361
Dan Willemsen208ae172015-09-16 16:33:27 -0700362 local_include_dirs: [
363 "upstream-netbsd/android/include",
364 "upstream-netbsd/lib/libc/include",
365 ],
366
367 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700368}
369
370// ========================================================
371// libc_openbsd_ndk.a - upstream OpenBSD C library code
372// that can be safely included in the libc_ndk.a (doesn't
373// contain any troublesome global data or constructors).
374// ========================================================
375//
376// These files are built with the openbsd-compat.h header file
377// automatically included.
378
379cc_library_static {
380 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700381 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700382 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700383 "upstream-openbsd/lib/libc/gen/alarm.c",
384 "upstream-openbsd/lib/libc/gen/ctype_.c",
385 "upstream-openbsd/lib/libc/gen/daemon.c",
386 "upstream-openbsd/lib/libc/gen/err.c",
387 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700388 "upstream-openbsd/lib/libc/gen/fnmatch.c",
389 "upstream-openbsd/lib/libc/gen/ftok.c",
390 "upstream-openbsd/lib/libc/gen/getprogname.c",
391 "upstream-openbsd/lib/libc/gen/isctype.c",
392 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700393 "upstream-openbsd/lib/libc/gen/tolower_.c",
394 "upstream-openbsd/lib/libc/gen/toupper_.c",
395 "upstream-openbsd/lib/libc/gen/verr.c",
396 "upstream-openbsd/lib/libc/gen/verrx.c",
397 "upstream-openbsd/lib/libc/gen/vwarn.c",
398 "upstream-openbsd/lib/libc/gen/vwarnx.c",
399 "upstream-openbsd/lib/libc/gen/warn.c",
400 "upstream-openbsd/lib/libc/gen/warnx.c",
401 "upstream-openbsd/lib/libc/locale/btowc.c",
402 "upstream-openbsd/lib/libc/locale/mbrlen.c",
403 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
404 "upstream-openbsd/lib/libc/locale/mbtowc.c",
405 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700406 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
407 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700408 "upstream-openbsd/lib/libc/locale/wcstoll.c",
409 "upstream-openbsd/lib/libc/locale/wcstombs.c",
410 "upstream-openbsd/lib/libc/locale/wcstoul.c",
411 "upstream-openbsd/lib/libc/locale/wcstoull.c",
412 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
413 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
414 "upstream-openbsd/lib/libc/locale/wctob.c",
415 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700416 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700417 "upstream-openbsd/lib/libc/net/htonl.c",
418 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700419 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
420 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
421 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700422 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
423 "upstream-openbsd/lib/libc/net/inet_ntop.c",
424 "upstream-openbsd/lib/libc/net/inet_pton.c",
425 "upstream-openbsd/lib/libc/net/ntohl.c",
426 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800427 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700428 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700429 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
430 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700431 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700432 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700433 "upstream-openbsd/lib/libc/stdio/fputwc.c",
434 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700435 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700436 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700437 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700438 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700439 "upstream-openbsd/lib/libc/stdio/makebuf.c",
440 "upstream-openbsd/lib/libc/stdio/mktemp.c",
441 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
442 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700443 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700444 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700445 "upstream-openbsd/lib/libc/stdio/tempnam.c",
446 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
447 "upstream-openbsd/lib/libc/stdio/ungetc.c",
448 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
449 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
450 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700451 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
452 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
453 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700454 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700455 "upstream-openbsd/lib/libc/stdio/wsetup.c",
456 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800457 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700458 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700459 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700460 "upstream-openbsd/lib/libc/stdlib/insque.c",
461 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
462 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
463 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800464 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700465 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800466 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700467 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700468 "upstream-openbsd/lib/libc/stdlib/remque.c",
469 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700470 "upstream-openbsd/lib/libc/stdlib/tfind.c",
471 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800472 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700473 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800474 "upstream-openbsd/lib/libc/string/strcasestr.c",
475 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700476 "upstream-openbsd/lib/libc/string/strcspn.c",
477 "upstream-openbsd/lib/libc/string/strdup.c",
478 "upstream-openbsd/lib/libc/string/strndup.c",
479 "upstream-openbsd/lib/libc/string/strpbrk.c",
480 "upstream-openbsd/lib/libc/string/strsep.c",
481 "upstream-openbsd/lib/libc/string/strspn.c",
482 "upstream-openbsd/lib/libc/string/strstr.c",
483 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800484 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700485 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700486 "upstream-openbsd/lib/libc/string/wcswidth.c",
487 ],
488
Colin Cross50c21ab2015-10-31 23:03:05 -0700489 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700490 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700491 "-Wno-unused-parameter",
492 "-include openbsd-compat.h",
493 ],
494
Dan Willemsen208ae172015-09-16 16:33:27 -0700495 local_include_dirs: [
496 "private",
497 "stdio",
498 "upstream-openbsd/android/include",
499 "upstream-openbsd/lib/libc/include",
500 "upstream-openbsd/lib/libc/gdtoa/",
501 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700502}
503
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700504cc_library_static {
505 name: "libc_openbsd_large_stack",
506 defaults: ["libc_defaults"],
507 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700508 "stdio/vfprintf.cpp",
509 "stdio/vfwprintf.cpp",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700510 ],
511 cflags: [
512 "-include openbsd-compat.h",
513 "-Wno-sign-compare",
514 "-Wframe-larger-than=5000",
515 ],
516
517 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700518 "upstream-openbsd/android/include/",
519 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700520 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700521 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700522 ],
523}
524
Dan Willemsen208ae172015-09-16 16:33:27 -0700525// ========================================================
526// libc_openbsd.a - upstream OpenBSD C library code
527// ========================================================
528//
529// These files are built with the openbsd-compat.h header file
530// automatically included.
531cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700532 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700533 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800534 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700535 "upstream-openbsd/lib/libc/crypt/arc4random.c",
536 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
537
538 // May be overriden by per-arch optimized versions
539 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700540 "upstream-openbsd/lib/libc/string/memrchr.c",
541 "upstream-openbsd/lib/libc/string/stpcpy.c",
542 "upstream-openbsd/lib/libc/string/stpncpy.c",
543 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700544 "upstream-openbsd/lib/libc/string/strcpy.c",
545 "upstream-openbsd/lib/libc/string/strlcat.c",
546 "upstream-openbsd/lib/libc/string/strlcpy.c",
547 "upstream-openbsd/lib/libc/string/strncat.c",
548 "upstream-openbsd/lib/libc/string/strncmp.c",
549 "upstream-openbsd/lib/libc/string/strncpy.c",
550 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700551
552 arch: {
553 arm: {
554 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700555 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800556 "upstream-openbsd/lib/libc/string/stpcpy.c",
557 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700558 ],
559 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700560 arm64: {
561 exclude_srcs: [
562 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700563 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700564 "upstream-openbsd/lib/libc/string/strcpy.c",
565 "upstream-openbsd/lib/libc/string/strncmp.c",
566 ],
567 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530568 mips: {
569 exclude_srcs: [
570 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530571 "upstream-openbsd/lib/libc/string/strcpy.c",
572 "upstream-openbsd/lib/libc/string/strncmp.c",
573 ],
574 },
575 mips64: {
576 exclude_srcs: [
577 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530578 "upstream-openbsd/lib/libc/string/strcpy.c",
579 "upstream-openbsd/lib/libc/string/strncmp.c",
580 ],
581 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700582 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800583 exclude_srcs: [
584 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800585 "upstream-openbsd/lib/libc/string/memrchr.c",
586 "upstream-openbsd/lib/libc/string/stpcpy.c",
587 "upstream-openbsd/lib/libc/string/stpncpy.c",
588 "upstream-openbsd/lib/libc/string/strcat.c",
589 "upstream-openbsd/lib/libc/string/strcpy.c",
590 "upstream-openbsd/lib/libc/string/strncmp.c",
591 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700592 "upstream-openbsd/lib/libc/string/strlcat.c",
593 "upstream-openbsd/lib/libc/string/strlcpy.c",
594 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800595 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700596 },
597
598 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800599 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800600 "upstream-openbsd/lib/libc/string/stpcpy.c",
601 "upstream-openbsd/lib/libc/string/stpncpy.c",
602 "upstream-openbsd/lib/libc/string/strcat.c",
603 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800604 "upstream-openbsd/lib/libc/string/strncat.c",
605 "upstream-openbsd/lib/libc/string/strncmp.c",
606 "upstream-openbsd/lib/libc/string/strncpy.c",
607 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700608 },
609 },
610
Colin Cross50c21ab2015-10-31 23:03:05 -0700611 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700612 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700613 "-Wno-unused-parameter",
614 "-include openbsd-compat.h",
615 ],
616
Dan Willemsen208ae172015-09-16 16:33:27 -0700617 local_include_dirs: [
618 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700619 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700620 ],
621
622 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700623}
624
625// ========================================================
626// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
627// ========================================================
628//
629// These files are built with the openbsd-compat.h header file
630// automatically included.
631
632cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700633 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700634 srcs: [
635 "upstream-openbsd/android/gdtoa_support.cpp",
636 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
637 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
638 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
639 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
640 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
641 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
642 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
643 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
644 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
645 "upstream-openbsd/lib/libc/gdtoa/misc.c",
646 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
647 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
648 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
649 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
650 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
651 "upstream-openbsd/lib/libc/gdtoa/sum.c",
652 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
653 ],
654 multilib: {
655 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800656 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700657 },
658 },
659
Colin Cross50c21ab2015-10-31 23:03:05 -0700660 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700661 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700662 "-include openbsd-compat.h",
663 ],
664
Dan Willemsen208ae172015-09-16 16:33:27 -0700665 local_include_dirs: [
666 "private",
667 "upstream-openbsd/android/include",
668 "upstream-openbsd/lib/libc/include",
669 ],
670
671 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700672}
673
674// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700675// libc_fortify.a - container for our FORITFY
676// implementation details
677// ========================================================
678cc_library_static {
679 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700680 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700681
682 name: "libc_fortify",
683
684 // Disable FORTIFY for the compilation of these, so we don't end up having
685 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800686 cflags: [
687 "-U_FORTIFY_SOURCE",
688 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
689 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700690
691 arch: {
692 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800693 cflags: [
694 "-DNO___MEMCPY_CHK",
695 "-DRENAME___STRCAT_CHK",
696 "-DRENAME___STRCPY_CHK",
697 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700698 srcs: [
699 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800700
701 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
702 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
703
704 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
705 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
706
707 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
708 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
709
710 "arch-arm/krait/bionic/__strcat_chk.S",
711 "arch-arm/krait/bionic/__strcpy_chk.S",
712
713 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
714 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
715
Haibo Huang01bfd892018-12-03 15:05:16 -0800716 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
717 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700718 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700719 },
720 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700721 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700722 srcs: [
723 "arch-arm64/generic/bionic/__memcpy_chk.S",
724 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700725 },
726 },
727}
728
729// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700730// libc_bionic.a - home-grown C library code
731// ========================================================
732
733cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700734 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700735 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700736 // The data that backs getauxval is initialized in the libc init
737 // functions which are invoked by the linker. If this file is included
738 // in libc_ndk.a, only one of the copies of the global data will be
739 // initialized, resulting in nullptr dereferences.
740 "bionic/getauxval.cpp",
741
Elliott Hughes211c4d32018-02-02 15:10:32 -0800742 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700743 "bionic/sysconf.cpp",
744 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700745 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700746
Josh Gao10ec9282017-04-03 15:13:29 -0700747 // The following must not be statically linked into libc_ndk.a, because
748 // debuggerd will look for the abort message in libc.so's copy.
749 "bionic/android_set_abort_message.cpp",
750
Dan Willemsen208ae172015-09-16 16:33:27 -0700751 "bionic/strchr.cpp",
752 "bionic/strnlen.c",
753 "bionic/strrchr.cpp",
754 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700755
756 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700757 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700758 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700759 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800760 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700761 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800762 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800763 "arch-arm/generic/bionic/stpcpy.c",
764 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800765 "arch-arm/generic/bionic/strcmp.S",
766 "arch-arm/generic/bionic/strcpy.S",
767 "arch-arm/generic/bionic/strlen.c",
768
Ryan Prichard45024fe2018-12-30 21:10:26 -0800769 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700770 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700771 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700772 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700773 "arch-arm/bionic/atomics_arm.c",
774 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800775 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700776 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700777 "arch-arm/bionic/setjmp.S",
778 "arch-arm/bionic/syscall.S",
779 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800780
781 "arch-arm/cortex-a15/bionic/memcpy.S",
782 "arch-arm/cortex-a15/bionic/memmove.S",
783 "arch-arm/cortex-a15/bionic/memset.S",
784 "arch-arm/cortex-a15/bionic/stpcpy.S",
785 "arch-arm/cortex-a15/bionic/strcat.S",
786 "arch-arm/cortex-a15/bionic/strcmp.S",
787 "arch-arm/cortex-a15/bionic/strcpy.S",
788 "arch-arm/cortex-a15/bionic/strlen.S",
789
790 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800791 "arch-arm/cortex-a7/bionic/memset.S",
792
793 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800794 "arch-arm/cortex-a9/bionic/memset.S",
795 "arch-arm/cortex-a9/bionic/stpcpy.S",
796 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800797 "arch-arm/cortex-a9/bionic/strcpy.S",
798 "arch-arm/cortex-a9/bionic/strlen.S",
799
800 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800801 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800802
803 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800804
Haibo Huang01bfd892018-12-03 15:05:16 -0800805 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800806
807 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700808 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700809 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700810 arm64: {
811 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700812 "arch-arm64/generic/bionic/memchr.S",
813 "arch-arm64/generic/bionic/memcmp.S",
814 "arch-arm64/generic/bionic/memcpy.S",
815 "arch-arm64/generic/bionic/memmove.S",
816 "arch-arm64/generic/bionic/memset.S",
817 "arch-arm64/generic/bionic/stpcpy.S",
818 "arch-arm64/generic/bionic/strchr.S",
819 "arch-arm64/generic/bionic/strcmp.S",
820 "arch-arm64/generic/bionic/strcpy.S",
821 "arch-arm64/generic/bionic/strlen.S",
822 "arch-arm64/generic/bionic/strncmp.S",
823 "arch-arm64/generic/bionic/strnlen.S",
824 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800825
826 "arch-arm64/bionic/__bionic_clone.S",
827 "arch-arm64/bionic/_exit_with_stack_teardown.S",
828 "arch-arm64/bionic/setjmp.S",
829 "arch-arm64/bionic/syscall.S",
830 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700831 ],
832 exclude_srcs: [
833 "bionic/__memcpy_chk.cpp",
834 "bionic/strchr.cpp",
835 "bionic/strnlen.c",
836 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700837 },
838
839 mips: {
840 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800841 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530842 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800843 "arch-mips/string/memset.S",
844 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530845 "arch-mips/string/strncmp.S",
846 "arch-mips/string/strlen.c",
847 "arch-mips/string/strnlen.c",
848 "arch-mips/string/strchr.c",
849 "arch-mips/string/strcpy.c",
850 "arch-mips/string/memchr.c",
851 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800852
Dan Willemsen208ae172015-09-16 16:33:27 -0700853 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700854 "arch-mips/bionic/cacheflush.cpp",
855 "arch-mips/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800856 "arch-mips/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700857 "arch-mips/bionic/setjmp.S",
858 "arch-mips/bionic/syscall.S",
859 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700860 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530861 exclude_srcs: [
862 "bionic/strchr.cpp",
863 "bionic/strnlen.c",
864 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700865 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700866 mips64: {
867 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800868 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530869 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800870 "arch-mips/string/memset.S",
871 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530872 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800873 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530874 "arch-mips/string/strnlen.c",
875 "arch-mips/string/strchr.c",
876 "arch-mips/string/strcpy.c",
877 "arch-mips/string/memchr.c",
878 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800879
Dan Willemsen208ae172015-09-16 16:33:27 -0700880 "arch-mips64/bionic/__bionic_clone.S",
881 "arch-mips64/bionic/_exit_with_stack_teardown.S",
882 "arch-mips64/bionic/setjmp.S",
883 "arch-mips64/bionic/syscall.S",
884 "arch-mips64/bionic/vfork.S",
885 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700886 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530887 exclude_srcs: [
888 "bionic/strchr.cpp",
889 "bionic/strnlen.c",
890 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700891 },
892
893 x86: {
894 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700895 "arch-x86/generic/string/memcmp.S",
896 "arch-x86/generic/string/strcmp.S",
897 "arch-x86/generic/string/strncmp.S",
898 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700899
900 "arch-x86/generic/string/strlcat.c",
901 "arch-x86/generic/string/strlcpy.c",
902 "arch-x86/generic/string/strncat.c",
903 "arch-x86/generic/string/wcscat.c",
904 "arch-x86/generic/string/wcscpy.c",
905 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530906 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700907
Dan Willemsen208ae172015-09-16 16:33:27 -0700908 "arch-x86/atom/string/sse2-memchr-atom.S",
909 "arch-x86/atom/string/sse2-memrchr-atom.S",
910 "arch-x86/atom/string/sse2-strchr-atom.S",
911 "arch-x86/atom/string/sse2-strnlen-atom.S",
912 "arch-x86/atom/string/sse2-strrchr-atom.S",
913 "arch-x86/atom/string/sse2-wcschr-atom.S",
914 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
915 "arch-x86/atom/string/sse2-wcslen-atom.S",
916 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700917 "arch-x86/silvermont/string/sse2-memmove-slm.S",
918 "arch-x86/silvermont/string/sse2-memset-slm.S",
919 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
920 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
921 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
922 "arch-x86/silvermont/string/sse2-strlen-slm.S",
923 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800924
925 "arch-x86/bionic/__bionic_clone.S",
926 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800927 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800928 "arch-x86/bionic/__restore.S",
929 "arch-x86/bionic/setjmp.S",
930 "arch-x86/bionic/syscall.S",
931 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700932
933 // ssse3 functions
934 "arch-x86/atom/string/ssse3-strcat-atom.S",
935 "arch-x86/atom/string/ssse3-strcmp-atom.S",
936 "arch-x86/atom/string/ssse3-strlcat-atom.S",
937 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
938 "arch-x86/atom/string/ssse3-strncat-atom.S",
939 "arch-x86/atom/string/ssse3-strncmp-atom.S",
940 "arch-x86/atom/string/ssse3-wcscat-atom.S",
941 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
942
943 // sse4 functions
944 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
945 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
946
947 // atom functions
948 "arch-x86/atom/string/sse2-memset-atom.S",
949 "arch-x86/atom/string/sse2-strlen-atom.S",
950 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800951 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700952 "arch-x86/atom/string/ssse3-strcpy-atom.S",
953 "arch-x86/atom/string/ssse3-strncpy-atom.S",
954 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530955
956 // avx2 functions
957 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700958 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700959
960 exclude_srcs: [
961 "bionic/strchr.cpp",
962 "bionic/strnlen.c",
963 "bionic/strrchr.cpp",
964 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700965 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700966 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700967 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700968 "arch-x86_64/string/sse2-memmove-slm.S",
969 "arch-x86_64/string/sse2-memset-slm.S",
970 "arch-x86_64/string/sse2-stpcpy-slm.S",
971 "arch-x86_64/string/sse2-stpncpy-slm.S",
972 "arch-x86_64/string/sse2-strcat-slm.S",
973 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700974 "arch-x86_64/string/sse2-strlen-slm.S",
975 "arch-x86_64/string/sse2-strncat-slm.S",
976 "arch-x86_64/string/sse2-strncpy-slm.S",
977 "arch-x86_64/string/sse4-memcmp-slm.S",
978 "arch-x86_64/string/ssse3-strcmp-slm.S",
979 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530980 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800981
982 "arch-x86_64/bionic/__bionic_clone.S",
983 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
984 "arch-x86_64/bionic/__restore_rt.S",
985 "arch-x86_64/bionic/setjmp.S",
986 "arch-x86_64/bionic/syscall.S",
987 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700988 ],
989 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700990 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700991
Colin Cross50c21ab2015-10-31 23:03:05 -0700992 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700993 include_dirs: ["bionic/libstdc++/include"],
994 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700995}
996
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000997genrule {
998 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -0800999 out: ["generated_android_ids.h"],
1000 srcs: [":android_filesystem_config_header"],
1001 tool_files: ["fs_config_generator.py"],
1002 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001003}
1004
Dan Willemsen268a6732015-10-15 14:49:45 -07001005// ========================================================
1006// libc_bionic_ndk.a- The portions of libc_bionic that can
1007// be safely used in libc_ndk.a (no troublesome global data
1008// or constructors).
1009// ========================================================
1010cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001011 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001012 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001013 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001014 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001015 "bionic/__cmsg_nxthdr.cpp",
1016 "bionic/__errno.cpp",
1017 "bionic/__gnu_basename.cpp",
1018 "bionic/__libc_current_sigrtmax.cpp",
1019 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001020 "bionic/abort.cpp",
1021 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001022 "bionic/access.cpp",
1023 "bionic/arpa_inet.cpp",
1024 "bionic/assert.cpp",
1025 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001026 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001027 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001028 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001029 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001030 "bionic/bionic_systrace.cpp",
1031 "bionic/bionic_time_conversions.cpp",
1032 "bionic/brk.cpp",
1033 "bionic/c16rtomb.cpp",
1034 "bionic/c32rtomb.cpp",
1035 "bionic/chmod.cpp",
1036 "bionic/chown.cpp",
1037 "bionic/clearenv.cpp",
1038 "bionic/clock.cpp",
1039 "bionic/clock_getcpuclockid.cpp",
1040 "bionic/clock_nanosleep.cpp",
1041 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001042 "bionic/ctype.cpp",
1043 "bionic/dirent.cpp",
1044 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001045 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001046 "bionic/error.cpp",
1047 "bionic/eventfd_read.cpp",
1048 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001049 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001050 "bionic/faccessat.cpp",
1051 "bionic/fchmod.cpp",
1052 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001053 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001054 "bionic/ffs.cpp",
1055 "bionic/fgetxattr.cpp",
1056 "bionic/flistxattr.cpp",
1057 "bionic/flockfile.cpp",
1058 "bionic/fpclassify.cpp",
1059 "bionic/fsetxattr.cpp",
1060 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001061 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001062 "bionic/futimens.cpp",
1063 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001064 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001065 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001066 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001067 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001068 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001069 "bionic/getpgrp.cpp",
1070 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001071 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001072 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001073 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001074 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001075 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001076 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001077 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001078 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001079 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001080 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001081 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001082 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001083 "bionic/lchown.cpp",
1084 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001085 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001086 "bionic/libgen.cpp",
1087 "bionic/link.cpp",
1088 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001089 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001090 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001091 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001092 "bionic/mbrtoc16.cpp",
1093 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001094 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001095 "bionic/mempcpy.cpp",
1096 "bionic/mkdir.cpp",
1097 "bionic/mkfifo.cpp",
1098 "bionic/mknod.cpp",
1099 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001100 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001101 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001102 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001103 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001104 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001105 "bionic/open.cpp",
1106 "bionic/pathconf.cpp",
1107 "bionic/pause.cpp",
1108 "bionic/pipe.cpp",
1109 "bionic/poll.cpp",
1110 "bionic/posix_fadvise.cpp",
1111 "bionic/posix_fallocate.cpp",
1112 "bionic/posix_madvise.cpp",
1113 "bionic/posix_timers.cpp",
1114 "bionic/ptrace.cpp",
1115 "bionic/pty.cpp",
1116 "bionic/raise.cpp",
1117 "bionic/rand.cpp",
1118 "bionic/readlink.cpp",
1119 "bionic/reboot.cpp",
1120 "bionic/recv.cpp",
1121 "bionic/rename.cpp",
1122 "bionic/rmdir.cpp",
1123 "bionic/scandir.cpp",
1124 "bionic/sched_getaffinity.cpp",
1125 "bionic/sched_getcpu.cpp",
1126 "bionic/semaphore.cpp",
1127 "bionic/send.cpp",
1128 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001129 "bionic/seteuid.cpp",
1130 "bionic/setpgrp.cpp",
1131 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001132 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001133 "bionic/sigprocmask.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001134 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001135 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001136 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001137 "bionic/strchrnul.cpp",
1138 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001139 "bionic/string_l.cpp",
1140 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001141 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001142 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001143 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001144 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001145 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001146 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001147 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001148 "bionic/sys_msg.cpp",
1149 "bionic/sys_sem.cpp",
1150 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001151 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001152 "bionic/sys_statfs.cpp",
1153 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001154 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001155 "bionic/sysinfo.cpp",
1156 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001157 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001158 "bionic/system_property_api.cpp",
1159 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001160 "bionic/tdestroy.cpp",
1161 "bionic/termios.cpp",
1162 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001163 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001164 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001165 "bionic/tmpfile.cpp",
1166 "bionic/umount.cpp",
1167 "bionic/unlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001168 "bionic/wait.cpp",
1169 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001170 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001171 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001172 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001173 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001174 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001175
1176 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1177 // which will be overridden by the actual one in libc.so.
1178 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001179 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001180
Dan Willemsen208ae172015-09-16 16:33:27 -07001181 multilib: {
1182 lib32: {
1183 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001184 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001185 },
1186 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001187 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001188 treble_linker_namespaces: {
1189 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001190 },
1191 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001192 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001193 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001194 local_include_dirs: ["stdio"],
1195 include_dirs: ["bionic/libstdc++/include"],
1196 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001197 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001198}
1199
Dan Willemsen208ae172015-09-16 16:33:27 -07001200// ========================================================
1201// libc_pthread.a - pthreads parts that previously lived in
1202// libc_bionic.a. Relocated to their own library because
1203// they can't be included in libc_ndk.a (as they layout of
1204// pthread_t has changed over the years and has ABI
1205// compatibility issues).
1206// ========================================================
1207
1208cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001209 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001210 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001211 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001212 "bionic/pthread_atfork.cpp",
1213 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001214 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001215 "bionic/pthread_cond.cpp",
1216 "bionic/pthread_create.cpp",
1217 "bionic/pthread_detach.cpp",
1218 "bionic/pthread_equal.cpp",
1219 "bionic/pthread_exit.cpp",
1220 "bionic/pthread_getcpuclockid.cpp",
1221 "bionic/pthread_getschedparam.cpp",
1222 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001223 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001224 "bionic/pthread_join.cpp",
1225 "bionic/pthread_key.cpp",
1226 "bionic/pthread_kill.cpp",
1227 "bionic/pthread_mutex.cpp",
1228 "bionic/pthread_once.cpp",
1229 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001230 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001231 "bionic/pthread_self.cpp",
1232 "bionic/pthread_setname_np.cpp",
1233 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001234 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001235
1236 // The following implementations depend on pthread data or implementation,
1237 // so we can't include them in libc_ndk.a.
1238 "bionic/__cxa_thread_atexit_impl.cpp",
1239 "stdlib/atexit.c",
1240 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001241 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001242
Colin Cross50c21ab2015-10-31 23:03:05 -07001243 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001244 include_dirs: ["bionic/libstdc++/include"],
1245 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001246}
1247
1248// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001249// libc_syscalls.a
1250// ========================================================
1251
Elliott Hughes782c4852019-04-16 12:31:00 -07001252genrule {
1253 name: "syscalls-arm.S",
1254 out: ["syscalls-arm.S"],
1255 srcs: ["SYSCALLS.TXT"],
1256 tool_files: [":bionic-gensyscalls"],
1257 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1258}
1259
1260genrule {
1261 name: "syscalls-arm64.S",
1262 out: ["syscalls-arm64.S"],
1263 srcs: ["SYSCALLS.TXT"],
1264 tool_files: [":bionic-gensyscalls"],
1265 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1266}
1267
1268genrule {
1269 name: "syscalls-x86.S",
1270 out: ["syscalls-x86.S"],
1271 srcs: ["SYSCALLS.TXT"],
1272 tool_files: [":bionic-gensyscalls"],
1273 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1274}
1275
1276genrule {
1277 name: "syscalls-x86_64.S",
1278 out: ["syscalls-x86_64.S"],
1279 srcs: ["SYSCALLS.TXT"],
1280 tool_files: [":bionic-gensyscalls"],
1281 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1282}
1283
Dan Willemsen208ae172015-09-16 16:33:27 -07001284cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001285 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001286 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001287 arch: {
1288 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001289 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001290 },
1291 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001292 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001293 },
1294 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001295 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001296 },
1297 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001298 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001299 },
1300 },
1301 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001302}
1303
1304// ========================================================
1305// libc_aeabi.a
1306// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1307// to avoid infinite recursion. For the other architectures we just build an
1308// empty library to keep this makefile simple.
1309// ========================================================
1310
1311cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001312 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001313 arch: {
1314 arm: {
1315 srcs: ["arch-arm/bionic/__aeabi.c"],
1316 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001317 },
1318 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001319 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001320}
1321
1322// ========================================================
1323// libc_ndk.a
1324// Compatibility library for the NDK. This library contains
1325// all the parts of libc that are safe to statically link.
1326// We can't safely statically link things that can only run
1327// on a certain version of the OS. Examples include
1328// anything that talks to netd (a large portion of the DNS
1329// code) and anything that is dependent on the layout of a
1330// data structure that has changed across releases (such as
1331// pthread_t).
1332// ========================================================
1333
1334cc_library_static {
1335 name: "libc_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001336 defaults: ["libc_defaults"],
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001337 srcs: libc_common_src_files + [
1338 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001339 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001340 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001341 multilib: {
1342 lib32: {
1343 srcs: libc_common_src_files_32,
1344 },
1345 },
1346 arch: {
1347 arm: {
1348 srcs: [
1349 "arch-arm/bionic/exidx_dynamic.c",
1350 "arch-common/bionic/crtbegin_so.c",
1351 "arch-arm/bionic/atexit_legacy.c",
1352 "arch-common/bionic/crtend_so.S",
1353 ],
1354 whole_static_libs: ["libc_aeabi"],
1355 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001356 },
1357
Colin Cross50c21ab2015-10-31 23:03:05 -07001358 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001359 "-fvisibility=hidden",
1360 "-DLIBC_STATIC",
1361 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001362
1363 whole_static_libs: [
1364 "libc_bionic_ndk",
George Burgess IV6cb06872017-07-21 13:28:42 -07001365 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001366 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001367 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001368 "libc_gdtoa",
1369 "libc_malloc",
1370 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001371 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001372 "libc_openbsd_ndk",
1373 "libc_stack_protector",
1374 "libc_syscalls",
1375 "libc_tzcode",
1376 "libm",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001377 "libjemalloc5",
Elliott Hughes816fab92016-05-27 17:57:46 -07001378 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001379 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001380}
1381
1382// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001383// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001384// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001385cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001386 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001387 srcs: libc_common_src_files,
1388 multilib: {
1389 lib32: {
1390 srcs: libc_common_src_files_32,
1391 },
1392 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001393 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001394
1395 whole_static_libs: [
1396 "libc_bionic",
1397 "libc_bionic_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001398 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001399 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001400 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001401 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001402 "libc_gdtoa",
1403 "libc_malloc",
1404 "libc_netbsd",
1405 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001406 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001407 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001408 "libc_stack_protector",
1409 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001410 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001411 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001412 ],
1413
1414 arch: {
1415 arm: {
1416 whole_static_libs: ["libc_aeabi"],
1417 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001418 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001419}
1420
1421// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001422// libc_common.a
1423// ========================================================
1424
1425cc_library_static {
1426 defaults: ["libc_defaults"],
1427 name: "libc_common",
1428
1429 whole_static_libs: [
1430 "libc_nopthread",
1431 "libc_pthread",
1432 ],
1433}
1434
1435// ========================================================
Haibo Huangf71edfa2018-11-12 10:06:56 -08001436// libc_common_static.a For static binaries.
1437// ========================================================
1438cc_library_static {
1439 defaults: ["libc_defaults"],
1440 name: "libc_common_static",
1441
Haibo Huangb9244ff2018-08-11 10:12:13 -07001442 arch: {
1443 x86: {
1444 srcs: ["arch-x86/static_function_dispatch.S"],
1445 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001446 arm: {
1447 srcs: ["arch-arm/static_function_dispatch.S"],
1448 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001449 },
1450
Haibo Huangf71edfa2018-11-12 10:06:56 -08001451 whole_static_libs: [
1452 "libc_common",
1453 ],
1454}
1455
1456// ========================================================
1457// libc_common_shared.a For shared libraries.
1458// ========================================================
1459cc_library_static {
1460 defaults: ["libc_defaults"],
1461 name: "libc_common_shared",
1462
Haibo Huangb9244ff2018-08-11 10:12:13 -07001463 cflags: [
1464 "-fno-stack-protector",
1465 "-fno-jump-tables",
1466 ],
1467 arch: {
1468 x86: {
1469 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1470 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001471 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001472 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001473 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001474 },
1475
Haibo Huangf71edfa2018-11-12 10:06:56 -08001476 whole_static_libs: [
1477 "libc_common",
1478 ],
1479}
1480
1481// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001482// libc_nomalloc.a
1483// ========================================================
1484//
1485// This is a version of the static C library that does not
1486// include malloc. It's useful in situations when the user wants
1487// to provide their own malloc implementation, or wants to
1488// explicitly disallow the use of malloc, such as in the
1489// dynamic linker.
1490
1491cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001492 name: "libc_nomalloc",
1493
Colin Cross50c21ab2015-10-31 23:03:05 -07001494 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001495
1496 arch: {
1497 arm: {
1498 srcs: ["arch-arm/bionic/exidx_static.c"],
1499 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001500 },
1501
Colin Cross50c21ab2015-10-31 23:03:05 -07001502 cflags: ["-DLIBC_STATIC"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001503
Colin Crossa3f9fca2016-01-11 13:20:55 -08001504 whole_static_libs: [
Haibo Huangf71edfa2018-11-12 10:06:56 -08001505 "libc_common_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001506 "libc_init_static",
1507 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001508}
1509
1510// ========================================================
1511// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1512// ========================================================
1513cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001514 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001515 srcs: ["bionic/jemalloc_wrapper.cpp"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001516 cflags: ["-fvisibility=hidden"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001517
Dan Willemsen208ae172015-09-16 16:33:27 -07001518 name: "libc_malloc",
Dan Willemsen208ae172015-09-16 16:33:27 -07001519}
1520
dimitryc0c0ef62018-12-05 16:33:52 +01001521filegroup {
1522 name: "libc_sources_shared",
1523 srcs: [
1524 "arch-common/bionic/crtbegin_so.c",
1525 "arch-common/bionic/crtbrand.S",
1526 "bionic/icu.cpp",
1527 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001528 "bionic/malloc_common_dynamic.cpp",
1529 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001530 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001531 "bionic/NetdClient.cpp",
1532 "arch-common/bionic/crtend_so.S",
1533 ],
1534}
1535
1536filegroup {
1537 name: "libc_sources_static",
1538 srcs: [
1539 "bionic/dl_iterate_phdr_static.cpp",
1540 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001541 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001542 ],
1543}
1544
1545filegroup {
1546 name: "libc_sources_shared_arm",
1547 srcs: [
1548 "arch-arm/bionic/exidx_dynamic.c",
1549 "arch-arm/bionic/atexit_legacy.c",
1550 ],
1551}
1552
1553filegroup {
1554 name: "libc_sources_static_arm",
1555 srcs: [ "arch-arm/bionic/exidx_static.c" ],
1556}
1557
Dan Willemsen208ae172015-09-16 16:33:27 -07001558// ========================================================
1559// libc.a + libc.so
1560// ========================================================
1561cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001562 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001563 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001564 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001565 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001566 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001567 platform_sdk_version: {
1568 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1569 },
1570 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001571 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001572 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001573 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001574 whole_static_libs: [
1575 "libc_init_static",
1576 "libc_common_static",
1577 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001578 },
1579 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001580 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001581 whole_static_libs: [
1582 "libc_init_dynamic",
1583 "libc_common_shared",
1584 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001585 },
1586
Neil Fullera7db90f2019-04-25 09:28:27 +01001587 required: [
1588 "tzdata",
1589 "tz_version", // Version metadata for tzdata to help debugging.
1590 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001591
Colin Cross4ce94d22016-11-15 13:15:43 -08001592 // Do not pack libc.so relocations; see http://b/20645321 for details.
1593 pack_relocations: false,
1594
dimitry06016f22018-01-05 11:39:28 +01001595 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1596 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1597 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1598 // those new libraries from libgcc.a are not declared external; if that were the case,
1599 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1600 // on the external symbols from the dependent libraries. That would create a "cloaked"
1601 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001602
dimitry06016f22018-01-05 11:39:28 +01001603 shared_libs: [
1604 "ld-android",
1605 "libdl",
1606 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001607 static_libs: [
1608 "libdl_android",
1609 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001610 whole_static_libs: [
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001611 "libjemalloc5",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001612 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001613
1614 nocrt: true,
1615
Dan Willemsen208ae172015-09-16 16:33:27 -07001616 arch: {
1617 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001618 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001619 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001620 ldflags: ["-Wl,--hash-style=both"],
1621
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001622 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001623
Dan Willemsen208ae172015-09-16 16:33:27 -07001624 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001625 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001626 // special for arm
1627 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001628 },
1629 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001630 srcs: [":libc_sources_static_arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001631 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001632
1633 // Arm 32 bit does not produce complete exidx unwind information
1634 // so keep the .debug_frame which is relatively small and does
1635 // include needed unwind information.
1636 // See b/132992102 for details.
1637 strip: {
1638 keep_symbols_and_debug_frame: true,
1639 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001640 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001641 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001642 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001643
1644 // Leave the symbols in the shared library so that stack unwinders can produce
1645 // meaningful name resolution.
1646 strip: {
1647 keep_symbols: true,
1648 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001649 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001650 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001651 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001652 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001653 ldflags: ["-Wl,--hash-style=both"],
1654
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001655 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001656
1657 // Leave the symbols in the shared library so that stack unwinders can produce
1658 // meaningful name resolution.
1659 strip: {
1660 keep_symbols: true,
1661 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001662 },
1663 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001664 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001665
1666 // Leave the symbols in the shared library so that stack unwinders can produce
1667 // meaningful name resolution.
1668 strip: {
1669 keep_symbols: true,
1670 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001671 },
1672 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001673
1674 stubs: {
1675 symbol_file: "libc.map.txt",
1676 versions: ["10000"],
1677 },
Vic Yang6903fb82019-01-14 11:34:39 -08001678
Vic Yang03ff4362019-06-24 16:11:37 -07001679 // Sorting bss symbols by size usually results in less dirty pages at run
1680 // time, because small symbols are grouped together.
1681 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001682}
1683
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001684genrule {
1685 name: "libc.arm.map",
1686 out: ["libc.arm.map"],
1687 srcs: ["libc.map.txt"],
1688 tool_files: [":bionic-generate-version-script"],
1689 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1690}
1691
1692genrule {
1693 name: "libc.arm64.map",
1694 out: ["libc.arm64.map"],
1695 srcs: ["libc.map.txt"],
1696 tool_files: [":bionic-generate-version-script"],
1697 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1698}
1699
1700genrule {
1701 name: "libc.x86.map",
1702 out: ["libc.x86.map"],
1703 srcs: ["libc.map.txt"],
1704 tool_files: [":bionic-generate-version-script"],
1705 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1706}
1707
1708genrule {
1709 name: "libc.x86_64.map",
1710 out: ["libc.x86_64.map"],
1711 srcs: ["libc.map.txt"],
1712 tool_files: [":bionic-generate-version-script"],
1713 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1714}
1715
Paul Duffin6b5cb032019-07-18 14:36:26 +01001716// Makes bionic_tls.h available for art to use in its implementation of Thread::Current().
1717cc_library_headers {
1718 name: "bionic_libc_private_headers",
1719 visibility: [
1720 "//art:__subpackages__",
1721 ],
1722 host_supported: true,
1723 export_include_dirs: [
1724 "private",
1725 ],
1726 sdk_version: "current",
1727}
1728
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001729// Headers that only other parts of the platform can include.
1730cc_library_headers {
1731 name: "bionic_libc_platform_headers",
1732 visibility: [
1733 "//bionic/libc/malloc_debug:__subpackages__",
1734 "//bionic/libc/malloc_hooks:__subpackages__",
1735 "//frameworks/av/media/libmedia:__subpackages__",
1736 "//frameworks/av/media/utils:__subpackages__",
1737 "//frameworks/base/core/jni:__subpackages__",
1738 "//frameworks/base/services/core/jni:__subpackages__",
1739 "//external/perfetto:__subpackages__",
1740 ],
1741 host_supported: true,
1742 export_include_dirs: [
1743 "platform",
1744 ],
1745 sdk_version: "current",
1746}
1747
Logan Chien17af91b2019-01-15 21:19:56 +08001748// libc_headers for libasync_safe and libpropertyinfoparser
1749cc_library_headers {
1750 name: "libc_headers",
1751
1752 host_supported: true,
1753 vendor_available: true,
1754 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001755 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001756
1757 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001758 stl: "none",
1759 system_shared_libs: [],
1760
1761 export_include_dirs: [
1762 "include",
1763 "kernel/uapi",
1764 "kernel/android/uapi",
1765 ],
1766
1767 arch: {
1768 arm: {
1769 export_include_dirs: [
1770 "kernel/uapi/asm-arm",
1771 ],
1772 },
1773 arm64: {
1774 export_include_dirs: [
1775 "kernel/uapi/asm-arm64",
1776 ],
1777 },
1778 mips: {
1779 export_include_dirs: [
1780 "kernel/uapi/asm-mips",
1781 ],
1782 },
1783 mips64: {
1784 export_include_dirs: [
1785 "kernel/uapi/asm-mips",
1786 ],
1787 },
1788 x86: {
1789 export_include_dirs: [
1790 "kernel/uapi/asm-x86",
1791 ],
1792 },
1793 x86_64: {
1794 export_include_dirs: [
1795 "kernel/uapi/asm-x86",
1796 ],
1797 },
1798 },
1799}
1800
Dan Willemsen208ae172015-09-16 16:33:27 -07001801// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001802// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001803// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001804
Dan Willemsen208ae172015-09-16 16:33:27 -07001805cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001806 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001807 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001808 srcs: [
1809 "bionic/__cxa_guard.cpp",
1810 "bionic/__cxa_pure_virtual.cpp",
1811 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001812 ],
1813 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001814 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001815 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001816
Dan Willemsen6b3be172018-12-03 13:57:20 -08001817 static: {
1818 system_shared_libs: [],
1819 },
1820 shared: {
1821 system_shared_libs: ["libc"],
1822 },
1823
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001824 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001825 arch: {
1826 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001827 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001828 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001829 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001830 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001831 },
1832 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001833 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001834 },
1835 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001836 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001837 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001838 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001839 },
1840 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001841 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001842 },
1843 },
1844}
1845
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001846genrule {
1847 name: "libstdc++.arm.map",
1848 out: ["libstdc++.arm.map"],
1849 srcs: ["libstdc++.map.txt"],
1850 tool_files: [":bionic-generate-version-script"],
1851 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1852}
1853
1854genrule {
1855 name: "libstdc++.arm64.map",
1856 out: ["libstdc++.arm64.map"],
1857 srcs: ["libstdc++.map.txt"],
1858 tool_files: [":bionic-generate-version-script"],
1859 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1860}
1861
1862genrule {
1863 name: "libstdc++.x86.map",
1864 out: ["libstdc++.x86.map"],
1865 srcs: ["libstdc++.map.txt"],
1866 tool_files: [":bionic-generate-version-script"],
1867 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1868}
1869
1870genrule {
1871 name: "libstdc++.x86_64.map",
1872 out: ["libstdc++.x86_64.map"],
1873 srcs: ["libstdc++.map.txt"],
1874 tool_files: [":bionic-generate-version-script"],
1875 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1876}
1877
1878// ========================================================
1879// crt object files.
1880// ========================================================
1881
Colin Cross50c21ab2015-10-31 23:03:05 -07001882cc_defaults {
1883 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001884 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001885 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001886 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001887 native_bridge_supported: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001888
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001889 cflags: [
1890 "-Wno-gcc-compat",
1891 "-Wall",
1892 "-Werror",
1893 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001894}
1895
Colin Cross50c21ab2015-10-31 23:03:05 -07001896cc_defaults {
1897 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001898 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001899
1900 arch: {
1901 mips: {
1902 cflags: ["-fPIC"],
1903 },
1904 mips64: {
1905 cflags: ["-fPIC"],
1906 },
1907 x86: {
1908 cflags: ["-fPIC"],
1909 },
1910 x86_64: {
1911 cflags: ["-fPIC"],
1912 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001913 },
Colin Crossab179442018-09-27 11:03:22 -07001914 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001915}
1916
Dan Willemsen208ae172015-09-16 16:33:27 -07001917cc_object {
1918 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001919 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001920 local_include_dirs: ["include"],
1921 product_variables: {
1922 platform_sdk_version: {
1923 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1924 },
1925 },
1926 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001927
Colin Cross7d7b3682017-11-03 13:38:40 -07001928 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001929}
1930
Dan Willemsen208ae172015-09-16 16:33:27 -07001931cc_object {
1932 name: "crtbegin_so1",
1933 local_include_dirs: ["include"],
1934 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001935
Colin Cross7d7b3682017-11-03 13:38:40 -07001936 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001937}
1938
Dan Willemsen208ae172015-09-16 16:33:27 -07001939cc_object {
1940 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07001941
Colin Cross7d7b3682017-11-03 13:38:40 -07001942 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07001943 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001944 "crtbegin_so1",
1945 "crtbrand",
1946 ],
1947}
1948
Dan Willemsen208ae172015-09-16 16:33:27 -07001949cc_object {
1950 name: "crtend_so",
1951 local_include_dirs: ["include"],
1952 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001953
Colin Cross7d7b3682017-11-03 13:38:40 -07001954 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001955}
1956
Dan Willemsen208ae172015-09-16 16:33:27 -07001957cc_object {
1958 name: "crtbegin_static1",
1959 local_include_dirs: ["include"],
1960 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001961
Colin Cross50c21ab2015-10-31 23:03:05 -07001962 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001963 mips: {
1964 srcs: [
1965 "arch-mips/bionic/crtbegin.c",
1966 ],
1967 exclude_srcs: [
1968 "arch-common/bionic/crtbegin.c",
1969 ],
1970 },
1971 mips64: {
1972 srcs: [
1973 "arch-mips64/bionic/crtbegin.c",
1974 ],
1975 exclude_srcs: [
1976 "arch-common/bionic/crtbegin.c",
1977 ],
1978 },
1979 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001980
1981 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001982}
1983
Dan Willemsen208ae172015-09-16 16:33:27 -07001984cc_object {
1985 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07001986
Colin Cross77d57bf2016-04-11 14:34:18 -07001987 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001988 "crtbegin_static1",
1989 "crtbrand",
1990 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001991 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001992}
1993
Dan Willemsen208ae172015-09-16 16:33:27 -07001994cc_object {
1995 name: "crtbegin_dynamic1",
1996 local_include_dirs: ["include"],
1997 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001998
Colin Cross50c21ab2015-10-31 23:03:05 -07001999 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002000 mips: {
2001 srcs: [
2002 "arch-mips/bionic/crtbegin.c",
2003 ],
2004 exclude_srcs: [
2005 "arch-common/bionic/crtbegin.c",
2006 ],
2007 },
2008 mips64: {
2009 srcs: [
2010 "arch-mips64/bionic/crtbegin.c",
2011 ],
2012 exclude_srcs: [
2013 "arch-common/bionic/crtbegin.c",
2014 ],
2015 },
2016 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002017 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002018}
2019
Dan Willemsen208ae172015-09-16 16:33:27 -07002020cc_object {
2021 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002022
Colin Cross77d57bf2016-04-11 14:34:18 -07002023 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002024 "crtbegin_dynamic1",
2025 "crtbrand",
2026 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002027 target: {
2028 linux_bionic: {
2029 generated_sources: ["host_bionic_linker_asm"],
2030 objs: [
2031 "linker_wrapper",
2032 ],
2033 },
2034 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002035 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002036}
2037
Dan Willemsen208ae172015-09-16 16:33:27 -07002038cc_object {
2039 // We rename crtend.o to crtend_android.o to avoid a
2040 // name clash between gcc and bionic.
2041 name: "crtend_android",
2042 local_include_dirs: ["include"],
2043 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002044
Colin Cross50c21ab2015-10-31 23:03:05 -07002045 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002046}
Colin Crossbaa48992016-07-13 11:15:21 -07002047
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002048// ========================================================
2049// NDK headers.
2050// ========================================================
2051
Dan Albert26e1c412018-05-24 14:56:46 -07002052versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002053 name: "common_libc",
2054 from: "include",
2055 to: "",
2056 license: "NOTICE",
2057}
Dan Albert4238a352016-06-28 11:18:05 -07002058
2059ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002060 name: "libc_uapi",
2061 from: "kernel/uapi",
2062 to: "",
2063 srcs: [
2064 "kernel/uapi/asm-generic/**/*.h",
2065 "kernel/uapi/drm/**/*.h",
2066 "kernel/uapi/linux/**/*.h",
2067 "kernel/uapi/misc/**/*.h",
2068 "kernel/uapi/mtd/**/*.h",
2069 "kernel/uapi/rdma/**/*.h",
2070 "kernel/uapi/scsi/**/*.h",
2071 "kernel/uapi/sound/**/*.h",
2072 "kernel/uapi/video/**/*.h",
2073 "kernel/uapi/xen/**/*.h",
2074 ],
Dan Albert92592652016-10-20 01:42:54 -07002075 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002076}
2077
2078ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002079 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002080 from: "kernel/android/uapi/linux",
2081 to: "linux",
2082 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002083 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002084}
2085
2086ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002087 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002088 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002089 to: "scsi",
2090 srcs: ["kernel/android/scsi/**/*.h"],
2091 license: "NOTICE",
2092}
2093
2094ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002095 name: "libc_asm_arm",
2096 from: "kernel/uapi/asm-arm",
2097 to: "arm-linux-androideabi",
2098 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002099 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002100}
2101
2102ndk_headers {
2103 name: "libc_asm_arm64",
2104 from: "kernel/uapi/asm-arm64",
2105 to: "aarch64-linux-android",
2106 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002107 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002108}
2109
Elliott Hughesee291c02017-12-11 11:32:34 -08002110// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002111ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002112 name: "libc_asm_mips",
2113 from: "kernel/uapi/asm-mips",
2114 to: "mipsel-linux-android",
2115 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2116 license: "NOTICE",
2117}
2118
Elliott Hughesee291c02017-12-11 11:32:34 -08002119// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002120ndk_headers {
2121 name: "libc_asm_mips64",
2122 from: "kernel/uapi/asm-mips",
2123 to: "mips64el-linux-android",
2124 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2125 license: "NOTICE",
2126}
2127
2128ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002129 name: "libc_asm_x86",
2130 from: "kernel/uapi/asm-x86",
2131 to: "i686-linux-android",
2132 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002133 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002134}
2135
2136ndk_headers {
2137 name: "libc_asm_x86_64",
2138 from: "kernel/uapi/asm-x86",
2139 to: "x86_64-linux-android",
2140 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002141 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002142}
2143
Dan Albert4238a352016-06-28 11:18:05 -07002144ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002145 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002146 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002147 symbol_file: "libc.map.txt",
2148 first_version: "9",
2149}
2150
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002151llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002152 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002153 symbol_file: "libc.map.txt",
2154 export_headers_as_system: true,
2155 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002156 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002157 export_include_dirs: [
2158 "kernel/android/uapi",
2159 "kernel/uapi",
2160 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002161 arch: {
2162 arm: {
2163 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002164 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002165 ],
2166 },
2167 arm64: {
2168 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002169 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002170 ],
2171 },
2172 mips: {
2173 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002174 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002175 ],
2176 },
2177 mips64: {
2178 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002179 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002180 ],
2181 },
2182 x86: {
2183 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002184 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002185 ],
2186 },
2187 x86_64: {
2188 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002189 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002190 ],
2191 },
2192 },
2193}
2194
Dan Albertdf31aff2016-10-06 15:50:41 -07002195ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002196 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002197 symbol_file: "libstdc++.map.txt",
2198 first_version: "9",
2199}
2200
Dan Willemsenca056d72018-01-08 14:00:24 -08002201// Export these headers for toolbox to process
2202filegroup {
2203 name: "kernel_input_headers",
2204 srcs: [
2205 "kernel/uapi/linux/input.h",
2206 "kernel/uapi/linux/input-event-codes.h",
2207 ],
2208}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002209
2210// Generate a syscall name / number mapping. These objects are text files
2211// (thanks to the -dD -E flags) and not binary files. They will then be
2212// consumed by the genseccomp.py script and converted into C++ code.
2213cc_defaults {
2214 name: "libseccomp_gen_syscall_nrs_defaults",
2215 recovery_available: true,
2216 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2217 cflags: [
2218 "-dD",
2219 "-E",
2220 "-Wall",
2221 "-Werror",
2222 "-nostdinc",
2223 ],
2224}
2225
2226cc_object {
2227 name: "libseccomp_gen_syscall_nrs_arm",
2228 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2229 local_include_dirs: [
2230 "kernel/uapi/asm-arm",
2231 "kernel/uapi",
2232 ],
2233}
2234
2235cc_object {
2236 name: "libseccomp_gen_syscall_nrs_arm64",
2237 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2238 local_include_dirs: [
2239 "kernel/uapi/asm-arm64",
2240 "kernel/uapi",
2241 ],
2242}
2243
2244cc_object {
2245 name: "libseccomp_gen_syscall_nrs_x86",
2246 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2247 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2248 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2249 local_include_dirs: [
2250 "kernel/uapi/asm-x86",
2251 "kernel/uapi",
2252 ],
2253}
2254
2255cc_object {
2256 name: "libseccomp_gen_syscall_nrs_x86_64",
2257 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2258 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2259 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2260 local_include_dirs: [
2261 "kernel/uapi/asm-x86",
2262 "kernel/uapi",
2263 ],
2264}
2265
2266cc_object {
2267 name: "libseccomp_gen_syscall_nrs_mips",
2268 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2269 cflags: [
2270 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2271 ],
2272 local_include_dirs: [
2273 "kernel/uapi/asm-mips",
2274 "kernel/uapi",
2275 ],
2276}
2277
2278cc_object {
2279 name: "libseccomp_gen_syscall_nrs_mips64",
2280 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2281 cflags: [
2282 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2283 ],
2284 local_include_dirs: [
2285 "kernel/uapi/asm-mips",
2286 "kernel/uapi",
2287 ],
2288}
2289
2290// Generate the C++ policy sources for app, system, and global seccomp-bpf
2291// filters.
2292python_binary_host {
2293 name: "genseccomp",
2294 main: "tools/genseccomp.py",
2295
2296 srcs: [
2297 "tools/genseccomp.py",
2298 "tools/gensyscalls.py",
2299 ],
2300
2301 data: [
2302 "kernel/uapi/**/*.h",
2303 ],
2304
2305 version: {
2306 py2: {
2307 enabled: true,
2308 },
2309 py3: {
2310 enabled: false,
2311 },
2312 },
2313}
2314
Martijn Coenen0c6de752019-01-02 12:52:51 +01002315python_binary_host {
2316 name: "genfunctosyscallnrs",
2317 main: "tools/genfunctosyscallnrs.py",
2318
2319 srcs: [
2320 "tools/genseccomp.py",
2321 "tools/genfunctosyscallnrs.py",
2322 "tools/gensyscalls.py",
2323 ],
2324
2325 data: [
2326 "kernel/uapi/**/*.h",
2327 ],
2328
2329 version: {
2330 py2: {
2331 enabled: true,
2332 },
2333 py3: {
2334 enabled: false,
2335 },
2336 },
2337}
2338
2339cc_genrule {
2340 name: "func_to_syscall_nrs",
2341 recovery_available: true,
2342 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2343
2344 tools: [ "genfunctosyscallnrs" ],
2345
2346 srcs: [
2347 "SYSCALLS.TXT",
2348 ":libseccomp_gen_syscall_nrs_arm",
2349 ":libseccomp_gen_syscall_nrs_arm64",
2350 ":libseccomp_gen_syscall_nrs_mips",
2351 ":libseccomp_gen_syscall_nrs_mips64",
2352 ":libseccomp_gen_syscall_nrs_x86",
2353 ":libseccomp_gen_syscall_nrs_x86_64",
2354 ],
2355
2356 out: [
2357 "func_to_syscall_nrs.h",
2358 ],
2359}
2360
Martijn Coenenc3752be2019-01-09 16:19:57 +01002361// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2362genrule {
2363 name: "generate_app_zygote_blacklist",
2364 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2365 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2366 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2367}
2368
2369cc_genrule {
2370 name: "libseccomp_policy_app_zygote_sources",
2371 recovery_available: true,
2372 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2373
2374 tools: [ "genseccomp" ],
2375
2376 srcs: [
2377 "SYSCALLS.TXT",
2378 "SECCOMP_WHITELIST_COMMON.TXT",
2379 "SECCOMP_WHITELIST_APP.TXT",
2380 "SECCOMP_BLACKLIST_COMMON.TXT",
2381 ":generate_app_zygote_blacklist",
2382 ":libseccomp_gen_syscall_nrs_arm",
2383 ":libseccomp_gen_syscall_nrs_arm64",
2384 ":libseccomp_gen_syscall_nrs_mips",
2385 ":libseccomp_gen_syscall_nrs_mips64",
2386 ":libseccomp_gen_syscall_nrs_x86",
2387 ":libseccomp_gen_syscall_nrs_x86_64",
2388 ],
2389
2390 out: [
2391 "arm64_app_zygote_policy.cpp",
2392 "arm_app_zygote_policy.cpp",
2393 "mips64_app_zygote_policy.cpp",
2394 "mips_app_zygote_policy.cpp",
2395 "x86_64_app_zygote_policy.cpp",
2396 "x86_app_zygote_policy.cpp",
2397 ],
2398}
2399
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002400cc_genrule {
2401 name: "libseccomp_policy_app_sources",
2402 recovery_available: true,
2403 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2404
2405 tools: [ "genseccomp" ],
2406
2407 srcs: [
2408 "SYSCALLS.TXT",
2409 "SECCOMP_WHITELIST_COMMON.TXT",
2410 "SECCOMP_WHITELIST_APP.TXT",
2411 "SECCOMP_BLACKLIST_COMMON.TXT",
2412 "SECCOMP_BLACKLIST_APP.TXT",
2413 ":libseccomp_gen_syscall_nrs_arm",
2414 ":libseccomp_gen_syscall_nrs_arm64",
2415 ":libseccomp_gen_syscall_nrs_mips",
2416 ":libseccomp_gen_syscall_nrs_mips64",
2417 ":libseccomp_gen_syscall_nrs_x86",
2418 ":libseccomp_gen_syscall_nrs_x86_64",
2419 ],
2420
2421 out: [
2422 "arm64_app_policy.cpp",
2423 "arm_app_policy.cpp",
2424 "mips64_app_policy.cpp",
2425 "mips_app_policy.cpp",
2426 "x86_64_app_policy.cpp",
2427 "x86_app_policy.cpp",
2428 ],
2429}
2430
2431cc_genrule {
2432 name: "libseccomp_policy_system_sources",
2433 recovery_available: true,
2434 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2435
2436 tools: [ "genseccomp" ],
2437
2438 srcs: [
2439 "SYSCALLS.TXT",
2440 "SECCOMP_WHITELIST_COMMON.TXT",
2441 "SECCOMP_WHITELIST_SYSTEM.TXT",
2442 "SECCOMP_BLACKLIST_COMMON.TXT",
2443 ":libseccomp_gen_syscall_nrs_arm",
2444 ":libseccomp_gen_syscall_nrs_arm64",
2445 ":libseccomp_gen_syscall_nrs_mips",
2446 ":libseccomp_gen_syscall_nrs_mips64",
2447 ":libseccomp_gen_syscall_nrs_x86",
2448 ":libseccomp_gen_syscall_nrs_x86_64",
2449 ],
2450
2451 out: [
2452 "arm64_system_policy.cpp",
2453 "arm_system_policy.cpp",
2454 "mips64_system_policy.cpp",
2455 "mips_system_policy.cpp",
2456 "x86_64_system_policy.cpp",
2457 "x86_system_policy.cpp",
2458 ],
2459}
2460
2461cc_genrule {
2462 name: "libseccomp_policy_global_sources",
2463 recovery_available: true,
2464 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=global $(in)",
2465
2466 tools: [ "genseccomp" ],
2467
2468 srcs: [
2469 "SYSCALLS.TXT",
2470 "SECCOMP_WHITELIST_COMMON.TXT",
2471 "SECCOMP_WHITELIST_SYSTEM.TXT",
2472 "SECCOMP_WHITELIST_APP.TXT",
2473 "SECCOMP_WHITELIST_GLOBAL.TXT",
2474 "SECCOMP_BLACKLIST_COMMON.TXT",
2475 ":libseccomp_gen_syscall_nrs_arm",
2476 ":libseccomp_gen_syscall_nrs_arm64",
2477 ":libseccomp_gen_syscall_nrs_mips",
2478 ":libseccomp_gen_syscall_nrs_mips64",
2479 ":libseccomp_gen_syscall_nrs_x86",
2480 ":libseccomp_gen_syscall_nrs_x86_64",
2481 ],
2482
2483 out: [
2484 "arm64_global_policy.cpp",
2485 "arm_global_policy.cpp",
2486 "mips64_global_policy.cpp",
2487 "mips_global_policy.cpp",
2488 "x86_64_global_policy.cpp",
2489 "x86_global_policy.cpp",
2490 ],
2491}
2492
2493cc_library {
2494 name: "libseccomp_policy",
2495 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002496 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002497 generated_sources: [
2498 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002499 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002500 "libseccomp_policy_global_sources",
2501 "libseccomp_policy_system_sources",
2502 ],
2503
2504 srcs: [
2505 "seccomp/seccomp_policy.cpp",
2506 ],
2507
2508 export_include_dirs: ["seccomp/include"],
2509 cflags: [
2510 "-Wall",
2511 "-Werror",
2512 ],
2513 shared: {
2514 shared_libs: ["libbase"],
2515 },
2516 static: {
2517 static_libs: ["libbase"],
2518 },
2519}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002520
2521// This is a temporary library that will use scudo as the native memory
2522// allocator. To use it, add it as the first shared library.
2523cc_library_shared {
2524 name: "libc_scudo",
2525 vendor_available: true,
2526 srcs: [
2527 "bionic/malloc_common.cpp",
2528 "bionic/malloc_common_dynamic.cpp",
2529 "bionic/malloc_heapprofd.cpp",
2530 "bionic/malloc_limit.cpp",
2531 "bionic/scudo_wrapper.cpp",
2532 "bionic/__set_errno.cpp",
2533 ],
2534 cflags: ["-DUSE_SCUDO"],
2535 stl: "none",
2536 system_shared_libs: [],
2537
2538 header_libs: ["libc_headers"],
2539
2540 static_libs: ["libasync_safe"],
2541
2542 allow_undefined_symbols: true,
2543 shared_libs: ["libscudo_wrapper"],
2544
2545 arch: {
2546 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002547 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002548 },
2549 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002550 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002551 },
2552 x86: {
2553 srcs: [
2554 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002555 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002556 ],
2557 },
2558 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002559 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002560 },
2561 },
2562
2563 // Mark this library as global so it overrides all the allocation
2564 // definitions properly.
2565 ldflags: ["-Wl,-z,global"],
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002566
2567 // Like libc, disable native coverage for libc_scudo.
2568 native_coverage: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002569}
2570
2571subdirs = [
2572 "bionic/scudo",
2573]