blob: 5ffb2e13bd1ac4e97389dc0b407bde5b7b50aa68 [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001// Define the common source files for all the libc instances
2// =========================================================
3libc_common_src_files = [
Christopher Ferris7a3681e2017-04-24 17:48:32 -07004 "async_safe/async_safe_log.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07005 "bionic/ether_aton.c",
6 "bionic/ether_ntoa.c",
7 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/pututline.c",
11 "bionic/sched_cpualloc.c",
12 "bionic/sched_cpucount.c",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070013 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070014 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070015 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080016 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070017 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080018 "stdio/vfscanf.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070019 "stdio/vfwscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070020 "stdlib/exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070021]
22
23// Various kinds of cruft.
24// ========================================================
25libc_common_src_files += [
26 "bionic/ndk_cruft.cpp",
Elliott Hughes1c8a2a92019-09-27 14:42:39 -070027 "bionic/ndk_cruft_data.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070028]
29
30libc_common_src_files_32 = [
31 "bionic/legacy_32_bit_support.cpp",
32 "bionic/time64.c",
33]
34
Elliott Hughes53cf3482016-08-09 13:06:41 -070035libc_common_flags = [
36 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080037 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070038 "-Wall",
39 "-Wextra",
40 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080041 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070042 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070043 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070044 "-Wframe-larger-than=2048",
George Burgess IVfa5410f2018-08-13 17:44:06 -070045 "-Wimplicit-fallthrough",
Elliott Hughes53cf3482016-08-09 13:06:41 -070046
47 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
48 "-Werror=pointer-to-int-cast",
49 "-Werror=int-to-pointer-cast",
50 "-Werror=type-limits",
51 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080052
53 // Clang's exit-time destructor registration hides __dso_handle, but
54 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
55 "-Wexit-time-destructors",
Elliott Hughes53cf3482016-08-09 13:06:41 -070056]
57
Dan Willemsen208ae172015-09-16 16:33:27 -070058// Define some common cflags
59// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070060cc_defaults {
61 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080062 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070063 cflags: libc_common_flags,
64 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070065 conlyflags: ["-std=gnu99"],
66 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070067 include_dirs: [
68 "bionic/libc/async_safe/include",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -070069 "external/jemalloc_new/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070070 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070071
Colin Cross50c21ab2015-10-31 23:03:05 -070072 stl: "none",
73 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070074 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070075 address: false,
76 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070077 // TODO(b/132640749): Fix broken fuzzer support.
78 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070079 },
Colin Cross50c21ab2015-10-31 23:03:05 -070080 native_coverage: false,
Jiyong Park5603c6e2018-04-27 21:53:11 +090081 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020082 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080083
Yi Konge3d90de2019-02-20 14:28:56 -080084 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
85 // warning since this is intended right now.
86 ldflags: ["-Wl,-z,muldefs"],
Dan Willemsen208ae172015-09-16 16:33:27 -070087}
88
Dan Willemsen208ae172015-09-16 16:33:27 -070089// ========================================================
90// libc_stack_protector.a - stack protector code
91// ========================================================
92//
Colin Crossa3f9fca2016-01-11 13:20:55 -080093// Code that implements the stack protector (or that runs
94// before TLS has been set up) needs to be compiled with
95// -fno-stack-protector, since it accesses the stack canary
96// TLS slot.
Dan Willemsen208ae172015-09-16 16:33:27 -070097
98cc_library_static {
99
Colin Crossa3f9fca2016-01-11 13:20:55 -0800100 srcs: [
101 "bionic/__libc_init_main_thread.cpp",
102 "bionic/__stack_chk_fail.cpp",
103 ],
104 arch: {
105 arm64: {
106 srcs: ["arch-arm64/bionic/__set_tls.c"],
107 },
108 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700109 srcs: [
110 "arch-x86/bionic/__libc_init_sysinfo.cpp",
111 "arch-x86/bionic/__set_tls.cpp",
112 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800113 },
114 x86_64: {
115 srcs: ["arch-x86_64/bionic/__set_tls.c"],
116 },
117 },
118
Colin Cross50c21ab2015-10-31 23:03:05 -0700119 defaults: ["libc_defaults"],
120 cflags: ["-fno-stack-protector"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700121 name: "libc_stack_protector",
Dan Willemsen208ae172015-09-16 16:33:27 -0700122}
123
Colin Crossa3f9fca2016-01-11 13:20:55 -0800124// libc_init_static.cpp also needs to be built without stack protector,
125// because it's responsible for setting up TLS for static executables.
126// This isn't the case for dynamic executables because the dynamic linker
127// has already set up the main thread's TLS.
128
129cc_library_static {
130 name: "libc_init_static",
131 defaults: ["libc_defaults"],
132 srcs: ["bionic/libc_init_static.cpp"],
133 cflags: ["-fno-stack-protector"],
134}
135
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700136cc_library_static {
137 name: "libc_init_dynamic",
138 defaults: ["libc_defaults"],
139 srcs: ["bionic/libc_init_dynamic.cpp"],
140 cflags: ["-fno-stack-protector"],
141}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800142
Dan Willemsen208ae172015-09-16 16:33:27 -0700143// ========================================================
144// libc_tzcode.a - upstream 'tzcode' code
145// ========================================================
146
147cc_library_static {
148
Colin Cross50c21ab2015-10-31 23:03:05 -0700149 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700150 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800151 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700152 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700153 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
154 ],
155
Colin Cross50c21ab2015-10-31 23:03:05 -0700156 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700157 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700158 // Don't use ridiculous amounts of stack.
159 "-DALL_STATE",
160 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
161 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800162 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700163 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700164 // The name of the tm_gmtoff field in our struct tm.
165 "-DTM_GMTOFF=tm_gmtoff",
166 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700167 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700168 // Include `tzname`, `timezone`, and `daylight` globals.
169 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700170 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800171 // Use the empty string (instead of " ") as the timezone abbreviation
172 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700173 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700174 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
175 "-Dlint",
176 ],
177
Dan Willemsen208ae172015-09-16 16:33:27 -0700178 local_include_dirs: ["tzcode/"],
179 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700180}
181
182// ========================================================
183// libc_dns.a - modified NetBSD DNS code
184// ========================================================
185
186cc_library_static {
187
Colin Cross50c21ab2015-10-31 23:03:05 -0700188 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700189 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800190 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700191
192 "upstream-netbsd/lib/libc/isc/ev_streams.c",
193 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700194 ],
195
Colin Cross50c21ab2015-10-31 23:03:05 -0700196 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700197 "-DANDROID_CHANGES",
198 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700199 "-Wno-unused-parameter",
200 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700201 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700202 ],
203
Dan Willemsen208ae172015-09-16 16:33:27 -0700204 local_include_dirs: [
205 "dns/include",
206 "private",
207 "upstream-netbsd/lib/libc/include",
208 "upstream-netbsd/android/include",
209 ],
210
211 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700212}
213
214// ========================================================
215// libc_freebsd.a - upstream FreeBSD C library code
216// ========================================================
217//
218// These files are built with the freebsd-compat.h header file
219// automatically included.
220
221cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700222 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700223 srcs: [
224 "upstream-freebsd/lib/libc/gen/ldexp.c",
225 "upstream-freebsd/lib/libc/gen/sleep.c",
226 "upstream-freebsd/lib/libc/gen/usleep.c",
227 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700228 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
229 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
230 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
231 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700232 "upstream-freebsd/lib/libc/stdlib/qsort.c",
233 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700234 "upstream-freebsd/lib/libc/string/wcpcpy.c",
235 "upstream-freebsd/lib/libc/string/wcpncpy.c",
236 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700237 "upstream-freebsd/lib/libc/string/wcscat.c",
238 "upstream-freebsd/lib/libc/string/wcschr.c",
239 "upstream-freebsd/lib/libc/string/wcscmp.c",
240 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700241 "upstream-freebsd/lib/libc/string/wcscspn.c",
242 "upstream-freebsd/lib/libc/string/wcsdup.c",
243 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700244 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700245 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
246 "upstream-freebsd/lib/libc/string/wcsncat.c",
247 "upstream-freebsd/lib/libc/string/wcsncmp.c",
248 "upstream-freebsd/lib/libc/string/wcsncpy.c",
249 "upstream-freebsd/lib/libc/string/wcsnlen.c",
250 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700251 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700252 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700253 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700254 "upstream-freebsd/lib/libc/string/wcstok.c",
255 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700256 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700257 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700258 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800259 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700260 ],
261 arch: {
262 arm64: {
263 exclude_srcs: [
264 "upstream-freebsd/lib/libc/string/wmemmove.c",
265 ],
266 },
267 x86: {
268 exclude_srcs: [
269 "upstream-freebsd/lib/libc/string/wcschr.c",
270 "upstream-freebsd/lib/libc/string/wcscmp.c",
271 "upstream-freebsd/lib/libc/string/wcslen.c",
272 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700273 "upstream-freebsd/lib/libc/string/wmemcmp.c",
274 "upstream-freebsd/lib/libc/string/wcscat.c",
275 "upstream-freebsd/lib/libc/string/wcscpy.c",
276 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530277 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700278 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700279 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700280 },
281
Colin Cross50c21ab2015-10-31 23:03:05 -0700282 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700283 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700284 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700285 "-include freebsd-compat.h",
286 ],
287
Dan Willemsen208ae172015-09-16 16:33:27 -0700288 local_include_dirs: [
289 "upstream-freebsd/android/include",
290 ],
291
292 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700293}
294
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700295cc_library_static {
296 defaults: ["libc_defaults"],
297 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700298 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700299 "upstream-freebsd/lib/libc/stdlib/realpath.c",
300 ],
301
302 cflags: [
303 "-Wno-sign-compare",
304 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700305 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700306 ],
307
308 local_include_dirs: [
309 "upstream-freebsd/android/include",
310 ],
311
312 name: "libc_freebsd_large_stack",
313}
314
Dan Willemsen208ae172015-09-16 16:33:27 -0700315// ========================================================
316// libc_netbsd.a - upstream NetBSD C library code
317// ========================================================
318//
319// These files are built with the netbsd-compat.h header file
320// automatically included.
321
322cc_library_static {
323
Colin Cross50c21ab2015-10-31 23:03:05 -0700324 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700325 srcs: [
326 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700327 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700328 "upstream-netbsd/lib/libc/gen/psignal.c",
329 "upstream-netbsd/lib/libc/gen/utime.c",
330 "upstream-netbsd/lib/libc/gen/utmp.c",
331 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
332 "upstream-netbsd/lib/libc/regex/regcomp.c",
333 "upstream-netbsd/lib/libc/regex/regerror.c",
334 "upstream-netbsd/lib/libc/regex/regexec.c",
335 "upstream-netbsd/lib/libc/regex/regfree.c",
336 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700337 "upstream-netbsd/lib/libc/stdlib/drand48.c",
338 "upstream-netbsd/lib/libc/stdlib/erand48.c",
339 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
340 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700341 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
342 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
343 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
344 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
345 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
346 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
347 "upstream-netbsd/lib/libc/stdlib/seed48.c",
348 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700349 ],
350 multilib: {
351 lib32: {
352 // LP32 cruft
353 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
354 },
355 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700356 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700357 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800358 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700359 "-DPOSIX_MISTAKE",
360 "-include netbsd-compat.h",
361 ],
362
Dan Willemsen208ae172015-09-16 16:33:27 -0700363 local_include_dirs: [
364 "upstream-netbsd/android/include",
365 "upstream-netbsd/lib/libc/include",
366 ],
367
368 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700369}
370
371// ========================================================
372// libc_openbsd_ndk.a - upstream OpenBSD C library code
373// that can be safely included in the libc_ndk.a (doesn't
374// contain any troublesome global data or constructors).
375// ========================================================
376//
377// These files are built with the openbsd-compat.h header file
378// automatically included.
379
380cc_library_static {
381 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700382 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700383 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700384 "upstream-openbsd/lib/libc/gen/alarm.c",
385 "upstream-openbsd/lib/libc/gen/ctype_.c",
386 "upstream-openbsd/lib/libc/gen/daemon.c",
387 "upstream-openbsd/lib/libc/gen/err.c",
388 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700389 "upstream-openbsd/lib/libc/gen/fnmatch.c",
390 "upstream-openbsd/lib/libc/gen/ftok.c",
391 "upstream-openbsd/lib/libc/gen/getprogname.c",
392 "upstream-openbsd/lib/libc/gen/isctype.c",
393 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700394 "upstream-openbsd/lib/libc/gen/verr.c",
395 "upstream-openbsd/lib/libc/gen/verrx.c",
396 "upstream-openbsd/lib/libc/gen/vwarn.c",
397 "upstream-openbsd/lib/libc/gen/vwarnx.c",
398 "upstream-openbsd/lib/libc/gen/warn.c",
399 "upstream-openbsd/lib/libc/gen/warnx.c",
400 "upstream-openbsd/lib/libc/locale/btowc.c",
401 "upstream-openbsd/lib/libc/locale/mbrlen.c",
402 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
403 "upstream-openbsd/lib/libc/locale/mbtowc.c",
404 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700405 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
406 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700407 "upstream-openbsd/lib/libc/locale/wcstoll.c",
408 "upstream-openbsd/lib/libc/locale/wcstombs.c",
409 "upstream-openbsd/lib/libc/locale/wcstoul.c",
410 "upstream-openbsd/lib/libc/locale/wcstoull.c",
411 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
412 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
413 "upstream-openbsd/lib/libc/locale/wctob.c",
414 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700415 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700416 "upstream-openbsd/lib/libc/net/htonl.c",
417 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700418 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
419 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
420 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700421 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
422 "upstream-openbsd/lib/libc/net/inet_ntop.c",
423 "upstream-openbsd/lib/libc/net/inet_pton.c",
424 "upstream-openbsd/lib/libc/net/ntohl.c",
425 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800426 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700427 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700428 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
429 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700430 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700431 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700432 "upstream-openbsd/lib/libc/stdio/fputwc.c",
433 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700434 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700435 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700436 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700437 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700438 "upstream-openbsd/lib/libc/stdio/makebuf.c",
439 "upstream-openbsd/lib/libc/stdio/mktemp.c",
440 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
441 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700442 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700443 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700444 "upstream-openbsd/lib/libc/stdio/tempnam.c",
445 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
446 "upstream-openbsd/lib/libc/stdio/ungetc.c",
447 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
448 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
449 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700450 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
451 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
452 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700453 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700454 "upstream-openbsd/lib/libc/stdio/wsetup.c",
455 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800456 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700457 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700458 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700459 "upstream-openbsd/lib/libc/stdlib/insque.c",
460 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
461 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
462 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800463 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700464 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800465 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700466 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700467 "upstream-openbsd/lib/libc/stdlib/remque.c",
468 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700469 "upstream-openbsd/lib/libc/stdlib/tfind.c",
470 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800471 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700472 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800473 "upstream-openbsd/lib/libc/string/strcasestr.c",
474 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700475 "upstream-openbsd/lib/libc/string/strcspn.c",
476 "upstream-openbsd/lib/libc/string/strdup.c",
477 "upstream-openbsd/lib/libc/string/strndup.c",
478 "upstream-openbsd/lib/libc/string/strpbrk.c",
479 "upstream-openbsd/lib/libc/string/strsep.c",
480 "upstream-openbsd/lib/libc/string/strspn.c",
481 "upstream-openbsd/lib/libc/string/strstr.c",
482 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800483 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700484 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700485 "upstream-openbsd/lib/libc/string/wcswidth.c",
486 ],
487
Colin Cross50c21ab2015-10-31 23:03:05 -0700488 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700489 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700490 "-Wno-unused-parameter",
491 "-include openbsd-compat.h",
492 ],
493
Dan Willemsen208ae172015-09-16 16:33:27 -0700494 local_include_dirs: [
495 "private",
496 "stdio",
497 "upstream-openbsd/android/include",
498 "upstream-openbsd/lib/libc/include",
499 "upstream-openbsd/lib/libc/gdtoa/",
500 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700501}
502
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700503cc_library_static {
504 name: "libc_openbsd_large_stack",
505 defaults: ["libc_defaults"],
506 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700507 "stdio/vfprintf.cpp",
508 "stdio/vfwprintf.cpp",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700509 ],
510 cflags: [
511 "-include openbsd-compat.h",
512 "-Wno-sign-compare",
513 "-Wframe-larger-than=5000",
514 ],
515
516 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700517 "upstream-openbsd/android/include/",
518 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700519 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700520 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700521 ],
522}
523
Dan Willemsen208ae172015-09-16 16:33:27 -0700524// ========================================================
525// libc_openbsd.a - upstream OpenBSD C library code
526// ========================================================
527//
528// These files are built with the openbsd-compat.h header file
529// automatically included.
530cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700531 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700532 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800533 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700534 "upstream-openbsd/lib/libc/crypt/arc4random.c",
535 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
536
537 // May be overriden by per-arch optimized versions
538 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700539 "upstream-openbsd/lib/libc/string/memrchr.c",
540 "upstream-openbsd/lib/libc/string/stpcpy.c",
541 "upstream-openbsd/lib/libc/string/stpncpy.c",
542 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700543 "upstream-openbsd/lib/libc/string/strcpy.c",
544 "upstream-openbsd/lib/libc/string/strlcat.c",
545 "upstream-openbsd/lib/libc/string/strlcpy.c",
546 "upstream-openbsd/lib/libc/string/strncat.c",
547 "upstream-openbsd/lib/libc/string/strncmp.c",
548 "upstream-openbsd/lib/libc/string/strncpy.c",
549 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700550
551 arch: {
552 arm: {
553 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700554 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800555 "upstream-openbsd/lib/libc/string/stpcpy.c",
556 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700557 ],
558 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700559 arm64: {
560 exclude_srcs: [
561 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700562 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700563 "upstream-openbsd/lib/libc/string/strcpy.c",
564 "upstream-openbsd/lib/libc/string/strncmp.c",
565 ],
566 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530567 mips: {
568 exclude_srcs: [
569 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530570 "upstream-openbsd/lib/libc/string/strcpy.c",
571 "upstream-openbsd/lib/libc/string/strncmp.c",
572 ],
573 },
574 mips64: {
575 exclude_srcs: [
576 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530577 "upstream-openbsd/lib/libc/string/strcpy.c",
578 "upstream-openbsd/lib/libc/string/strncmp.c",
579 ],
580 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700581 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800582 exclude_srcs: [
583 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800584 "upstream-openbsd/lib/libc/string/memrchr.c",
585 "upstream-openbsd/lib/libc/string/stpcpy.c",
586 "upstream-openbsd/lib/libc/string/stpncpy.c",
587 "upstream-openbsd/lib/libc/string/strcat.c",
588 "upstream-openbsd/lib/libc/string/strcpy.c",
589 "upstream-openbsd/lib/libc/string/strncmp.c",
590 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700591 "upstream-openbsd/lib/libc/string/strlcat.c",
592 "upstream-openbsd/lib/libc/string/strlcpy.c",
593 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800594 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700595 },
596
597 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800598 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800599 "upstream-openbsd/lib/libc/string/stpcpy.c",
600 "upstream-openbsd/lib/libc/string/stpncpy.c",
601 "upstream-openbsd/lib/libc/string/strcat.c",
602 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800603 "upstream-openbsd/lib/libc/string/strncat.c",
604 "upstream-openbsd/lib/libc/string/strncmp.c",
605 "upstream-openbsd/lib/libc/string/strncpy.c",
606 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700607 },
608 },
609
Colin Cross50c21ab2015-10-31 23:03:05 -0700610 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700611 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700612 "-Wno-unused-parameter",
613 "-include openbsd-compat.h",
614 ],
615
Dan Willemsen208ae172015-09-16 16:33:27 -0700616 local_include_dirs: [
617 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700618 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700619 ],
620
621 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700622}
623
624// ========================================================
625// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
626// ========================================================
627//
628// These files are built with the openbsd-compat.h header file
629// automatically included.
630
631cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700632 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700633 srcs: [
634 "upstream-openbsd/android/gdtoa_support.cpp",
635 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
636 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
637 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
638 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
639 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
640 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
641 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
642 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
643 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
644 "upstream-openbsd/lib/libc/gdtoa/misc.c",
645 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
646 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
647 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
648 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
649 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
650 "upstream-openbsd/lib/libc/gdtoa/sum.c",
651 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
652 ],
653 multilib: {
654 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800655 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700656 },
657 },
658
Colin Cross50c21ab2015-10-31 23:03:05 -0700659 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700660 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700661 "-include openbsd-compat.h",
662 ],
663
Dan Willemsen208ae172015-09-16 16:33:27 -0700664 local_include_dirs: [
665 "private",
666 "upstream-openbsd/android/include",
667 "upstream-openbsd/lib/libc/include",
668 ],
669
670 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700671}
672
673// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700674// libc_fortify.a - container for our FORITFY
675// implementation details
676// ========================================================
677cc_library_static {
678 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700679 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700680
681 name: "libc_fortify",
682
683 // Disable FORTIFY for the compilation of these, so we don't end up having
684 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800685 cflags: [
686 "-U_FORTIFY_SOURCE",
687 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
688 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700689
690 arch: {
691 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800692 cflags: [
693 "-DNO___MEMCPY_CHK",
694 "-DRENAME___STRCAT_CHK",
695 "-DRENAME___STRCPY_CHK",
696 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700697 srcs: [
698 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800699
700 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
701 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
702
703 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
704 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
705
706 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
707 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
708
709 "arch-arm/krait/bionic/__strcat_chk.S",
710 "arch-arm/krait/bionic/__strcpy_chk.S",
711
712 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
713 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
714
Haibo Huang01bfd892018-12-03 15:05:16 -0800715 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
716 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700717 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700718 },
719 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700720 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700721 srcs: [
722 "arch-arm64/generic/bionic/__memcpy_chk.S",
723 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700724 },
725 },
726}
727
728// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700729// libc_bionic.a - home-grown C library code
730// ========================================================
731
732cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700733 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700734 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700735 // The data that backs getauxval is initialized in the libc init
736 // functions which are invoked by the linker. If this file is included
737 // in libc_ndk.a, only one of the copies of the global data will be
738 // initialized, resulting in nullptr dereferences.
739 "bionic/getauxval.cpp",
740
Elliott Hughes211c4d32018-02-02 15:10:32 -0800741 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700742 "bionic/sysconf.cpp",
743 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700744 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700745
Josh Gao10ec9282017-04-03 15:13:29 -0700746 // The following must not be statically linked into libc_ndk.a, because
747 // debuggerd will look for the abort message in libc.so's copy.
748 "bionic/android_set_abort_message.cpp",
749
Dan Willemsen208ae172015-09-16 16:33:27 -0700750 "bionic/strchr.cpp",
751 "bionic/strnlen.c",
752 "bionic/strrchr.cpp",
753 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700754
755 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700756 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700757 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700758 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800759 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700760 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800761 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800762 "arch-arm/generic/bionic/stpcpy.c",
763 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800764 "arch-arm/generic/bionic/strcmp.S",
765 "arch-arm/generic/bionic/strcpy.S",
766 "arch-arm/generic/bionic/strlen.c",
767
Ryan Prichard45024fe2018-12-30 21:10:26 -0800768 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700769 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700770 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700771 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700772 "arch-arm/bionic/atomics_arm.c",
773 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800774 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700775 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700776 "arch-arm/bionic/setjmp.S",
777 "arch-arm/bionic/syscall.S",
778 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800779
780 "arch-arm/cortex-a15/bionic/memcpy.S",
781 "arch-arm/cortex-a15/bionic/memmove.S",
782 "arch-arm/cortex-a15/bionic/memset.S",
783 "arch-arm/cortex-a15/bionic/stpcpy.S",
784 "arch-arm/cortex-a15/bionic/strcat.S",
785 "arch-arm/cortex-a15/bionic/strcmp.S",
786 "arch-arm/cortex-a15/bionic/strcpy.S",
787 "arch-arm/cortex-a15/bionic/strlen.S",
788
789 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800790 "arch-arm/cortex-a7/bionic/memset.S",
791
792 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800793 "arch-arm/cortex-a9/bionic/memset.S",
794 "arch-arm/cortex-a9/bionic/stpcpy.S",
795 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800796 "arch-arm/cortex-a9/bionic/strcpy.S",
797 "arch-arm/cortex-a9/bionic/strlen.S",
798
799 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800800 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800801
802 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800803
Haibo Huang01bfd892018-12-03 15:05:16 -0800804 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800805
806 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700807 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700808 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700809 arm64: {
810 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700811 "arch-arm64/generic/bionic/memchr.S",
812 "arch-arm64/generic/bionic/memcmp.S",
813 "arch-arm64/generic/bionic/memcpy.S",
814 "arch-arm64/generic/bionic/memmove.S",
815 "arch-arm64/generic/bionic/memset.S",
816 "arch-arm64/generic/bionic/stpcpy.S",
817 "arch-arm64/generic/bionic/strchr.S",
818 "arch-arm64/generic/bionic/strcmp.S",
819 "arch-arm64/generic/bionic/strcpy.S",
820 "arch-arm64/generic/bionic/strlen.S",
821 "arch-arm64/generic/bionic/strncmp.S",
822 "arch-arm64/generic/bionic/strnlen.S",
823 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800824
825 "arch-arm64/bionic/__bionic_clone.S",
826 "arch-arm64/bionic/_exit_with_stack_teardown.S",
827 "arch-arm64/bionic/setjmp.S",
828 "arch-arm64/bionic/syscall.S",
829 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700830 ],
831 exclude_srcs: [
832 "bionic/__memcpy_chk.cpp",
833 "bionic/strchr.cpp",
834 "bionic/strnlen.c",
835 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700836 },
837
838 mips: {
839 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800840 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530841 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800842 "arch-mips/string/memset.S",
843 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530844 "arch-mips/string/strncmp.S",
845 "arch-mips/string/strlen.c",
846 "arch-mips/string/strnlen.c",
847 "arch-mips/string/strchr.c",
848 "arch-mips/string/strcpy.c",
849 "arch-mips/string/memchr.c",
850 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800851
Dan Willemsen208ae172015-09-16 16:33:27 -0700852 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700853 "arch-mips/bionic/cacheflush.cpp",
854 "arch-mips/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800855 "arch-mips/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700856 "arch-mips/bionic/setjmp.S",
857 "arch-mips/bionic/syscall.S",
858 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700859 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530860 exclude_srcs: [
861 "bionic/strchr.cpp",
862 "bionic/strnlen.c",
863 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700864 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700865 mips64: {
866 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800867 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530868 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800869 "arch-mips/string/memset.S",
870 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530871 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800872 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530873 "arch-mips/string/strnlen.c",
874 "arch-mips/string/strchr.c",
875 "arch-mips/string/strcpy.c",
876 "arch-mips/string/memchr.c",
877 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800878
Dan Willemsen208ae172015-09-16 16:33:27 -0700879 "arch-mips64/bionic/__bionic_clone.S",
880 "arch-mips64/bionic/_exit_with_stack_teardown.S",
881 "arch-mips64/bionic/setjmp.S",
882 "arch-mips64/bionic/syscall.S",
883 "arch-mips64/bionic/vfork.S",
884 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700885 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530886 exclude_srcs: [
887 "bionic/strchr.cpp",
888 "bionic/strnlen.c",
889 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700890 },
891
892 x86: {
893 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700894 "arch-x86/generic/string/memcmp.S",
895 "arch-x86/generic/string/strcmp.S",
896 "arch-x86/generic/string/strncmp.S",
897 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700898
899 "arch-x86/generic/string/strlcat.c",
900 "arch-x86/generic/string/strlcpy.c",
901 "arch-x86/generic/string/strncat.c",
902 "arch-x86/generic/string/wcscat.c",
903 "arch-x86/generic/string/wcscpy.c",
904 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530905 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700906
Dan Willemsen208ae172015-09-16 16:33:27 -0700907 "arch-x86/atom/string/sse2-memchr-atom.S",
908 "arch-x86/atom/string/sse2-memrchr-atom.S",
909 "arch-x86/atom/string/sse2-strchr-atom.S",
910 "arch-x86/atom/string/sse2-strnlen-atom.S",
911 "arch-x86/atom/string/sse2-strrchr-atom.S",
912 "arch-x86/atom/string/sse2-wcschr-atom.S",
913 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
914 "arch-x86/atom/string/sse2-wcslen-atom.S",
915 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700916 "arch-x86/silvermont/string/sse2-memmove-slm.S",
917 "arch-x86/silvermont/string/sse2-memset-slm.S",
918 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
919 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
920 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
921 "arch-x86/silvermont/string/sse2-strlen-slm.S",
922 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800923
924 "arch-x86/bionic/__bionic_clone.S",
925 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800926 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800927 "arch-x86/bionic/__restore.S",
928 "arch-x86/bionic/setjmp.S",
929 "arch-x86/bionic/syscall.S",
930 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700931
932 // ssse3 functions
933 "arch-x86/atom/string/ssse3-strcat-atom.S",
934 "arch-x86/atom/string/ssse3-strcmp-atom.S",
935 "arch-x86/atom/string/ssse3-strlcat-atom.S",
936 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
937 "arch-x86/atom/string/ssse3-strncat-atom.S",
938 "arch-x86/atom/string/ssse3-strncmp-atom.S",
939 "arch-x86/atom/string/ssse3-wcscat-atom.S",
940 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
941
942 // sse4 functions
943 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
944 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
945
946 // atom functions
947 "arch-x86/atom/string/sse2-memset-atom.S",
948 "arch-x86/atom/string/sse2-strlen-atom.S",
949 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800950 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700951 "arch-x86/atom/string/ssse3-strcpy-atom.S",
952 "arch-x86/atom/string/ssse3-strncpy-atom.S",
953 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530954
955 // avx2 functions
956 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700957 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700958
959 exclude_srcs: [
960 "bionic/strchr.cpp",
961 "bionic/strnlen.c",
962 "bionic/strrchr.cpp",
963 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700964 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700965 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700966 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700967 "arch-x86_64/string/sse2-memmove-slm.S",
968 "arch-x86_64/string/sse2-memset-slm.S",
969 "arch-x86_64/string/sse2-stpcpy-slm.S",
970 "arch-x86_64/string/sse2-stpncpy-slm.S",
971 "arch-x86_64/string/sse2-strcat-slm.S",
972 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700973 "arch-x86_64/string/sse2-strlen-slm.S",
974 "arch-x86_64/string/sse2-strncat-slm.S",
975 "arch-x86_64/string/sse2-strncpy-slm.S",
976 "arch-x86_64/string/sse4-memcmp-slm.S",
977 "arch-x86_64/string/ssse3-strcmp-slm.S",
978 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530979 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800980
981 "arch-x86_64/bionic/__bionic_clone.S",
982 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
983 "arch-x86_64/bionic/__restore_rt.S",
984 "arch-x86_64/bionic/setjmp.S",
985 "arch-x86_64/bionic/syscall.S",
986 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700987 ],
988 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700989 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700990
Colin Cross50c21ab2015-10-31 23:03:05 -0700991 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700992 include_dirs: ["bionic/libstdc++/include"],
993 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700994}
995
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000996genrule {
997 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -0800998 out: ["generated_android_ids.h"],
999 srcs: [":android_filesystem_config_header"],
1000 tool_files: ["fs_config_generator.py"],
1001 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001002}
1003
Dan Willemsen268a6732015-10-15 14:49:45 -07001004// ========================================================
1005// libc_bionic_ndk.a- The portions of libc_bionic that can
1006// be safely used in libc_ndk.a (no troublesome global data
1007// or constructors).
1008// ========================================================
1009cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001010 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001011 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001012 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001013 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001014 "bionic/__cmsg_nxthdr.cpp",
1015 "bionic/__errno.cpp",
1016 "bionic/__gnu_basename.cpp",
1017 "bionic/__libc_current_sigrtmax.cpp",
1018 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001019 "bionic/abort.cpp",
1020 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001021 "bionic/access.cpp",
1022 "bionic/arpa_inet.cpp",
1023 "bionic/assert.cpp",
1024 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001025 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001026 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001027 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001028 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001029 "bionic/bionic_systrace.cpp",
1030 "bionic/bionic_time_conversions.cpp",
1031 "bionic/brk.cpp",
1032 "bionic/c16rtomb.cpp",
1033 "bionic/c32rtomb.cpp",
1034 "bionic/chmod.cpp",
1035 "bionic/chown.cpp",
1036 "bionic/clearenv.cpp",
1037 "bionic/clock.cpp",
1038 "bionic/clock_getcpuclockid.cpp",
1039 "bionic/clock_nanosleep.cpp",
1040 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001041 "bionic/ctype.cpp",
1042 "bionic/dirent.cpp",
1043 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001044 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001045 "bionic/error.cpp",
1046 "bionic/eventfd_read.cpp",
1047 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001048 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001049 "bionic/faccessat.cpp",
1050 "bionic/fchmod.cpp",
1051 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001052 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001053 "bionic/ffs.cpp",
1054 "bionic/fgetxattr.cpp",
1055 "bionic/flistxattr.cpp",
1056 "bionic/flockfile.cpp",
1057 "bionic/fpclassify.cpp",
1058 "bionic/fsetxattr.cpp",
1059 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001060 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001061 "bionic/futimens.cpp",
1062 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001063 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001064 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001065 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001066 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001067 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001068 "bionic/getpgrp.cpp",
1069 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001070 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001071 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001072 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001073 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001074 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001075 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001076 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001077 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001078 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001079 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001080 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001081 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001082 "bionic/lchown.cpp",
1083 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001084 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001085 "bionic/libgen.cpp",
1086 "bionic/link.cpp",
1087 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001088 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001089 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001090 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001091 "bionic/mbrtoc16.cpp",
1092 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001093 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001094 "bionic/mempcpy.cpp",
1095 "bionic/mkdir.cpp",
1096 "bionic/mkfifo.cpp",
1097 "bionic/mknod.cpp",
1098 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001099 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001100 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001101 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001102 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001103 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001104 "bionic/open.cpp",
1105 "bionic/pathconf.cpp",
1106 "bionic/pause.cpp",
1107 "bionic/pipe.cpp",
1108 "bionic/poll.cpp",
1109 "bionic/posix_fadvise.cpp",
1110 "bionic/posix_fallocate.cpp",
1111 "bionic/posix_madvise.cpp",
1112 "bionic/posix_timers.cpp",
1113 "bionic/ptrace.cpp",
1114 "bionic/pty.cpp",
1115 "bionic/raise.cpp",
1116 "bionic/rand.cpp",
1117 "bionic/readlink.cpp",
1118 "bionic/reboot.cpp",
1119 "bionic/recv.cpp",
1120 "bionic/rename.cpp",
1121 "bionic/rmdir.cpp",
1122 "bionic/scandir.cpp",
1123 "bionic/sched_getaffinity.cpp",
1124 "bionic/sched_getcpu.cpp",
1125 "bionic/semaphore.cpp",
1126 "bionic/send.cpp",
1127 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001128 "bionic/seteuid.cpp",
1129 "bionic/setpgrp.cpp",
1130 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001131 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001132 "bionic/sigprocmask.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001133 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001134 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001135 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001136 "bionic/strchrnul.cpp",
1137 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001138 "bionic/string_l.cpp",
1139 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001140 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001141 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001142 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001143 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001144 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001145 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001146 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001147 "bionic/sys_msg.cpp",
1148 "bionic/sys_sem.cpp",
1149 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001150 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001151 "bionic/sys_statfs.cpp",
1152 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001153 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001154 "bionic/sysinfo.cpp",
1155 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001156 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001157 "bionic/system_property_api.cpp",
1158 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001159 "bionic/tdestroy.cpp",
1160 "bionic/termios.cpp",
1161 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001162 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001163 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001164 "bionic/tmpfile.cpp",
1165 "bionic/umount.cpp",
1166 "bionic/unlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001167 "bionic/wait.cpp",
1168 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001169 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001170 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001171 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001172 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001173 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001174
1175 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1176 // which will be overridden by the actual one in libc.so.
1177 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001178 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001179
Dan Willemsen208ae172015-09-16 16:33:27 -07001180 multilib: {
1181 lib32: {
1182 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001183 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001184 },
1185 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001186 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001187 treble_linker_namespaces: {
1188 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001189 },
1190 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001191 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001192 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001193 local_include_dirs: ["stdio"],
1194 include_dirs: ["bionic/libstdc++/include"],
1195 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001196 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001197}
1198
Dan Willemsen208ae172015-09-16 16:33:27 -07001199// ========================================================
1200// libc_pthread.a - pthreads parts that previously lived in
1201// libc_bionic.a. Relocated to their own library because
1202// they can't be included in libc_ndk.a (as they layout of
1203// pthread_t has changed over the years and has ABI
1204// compatibility issues).
1205// ========================================================
1206
1207cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001208 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001209 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001210 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001211 "bionic/pthread_atfork.cpp",
1212 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001213 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001214 "bionic/pthread_cond.cpp",
1215 "bionic/pthread_create.cpp",
1216 "bionic/pthread_detach.cpp",
1217 "bionic/pthread_equal.cpp",
1218 "bionic/pthread_exit.cpp",
1219 "bionic/pthread_getcpuclockid.cpp",
1220 "bionic/pthread_getschedparam.cpp",
1221 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001222 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001223 "bionic/pthread_join.cpp",
1224 "bionic/pthread_key.cpp",
1225 "bionic/pthread_kill.cpp",
1226 "bionic/pthread_mutex.cpp",
1227 "bionic/pthread_once.cpp",
1228 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001229 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001230 "bionic/pthread_self.cpp",
1231 "bionic/pthread_setname_np.cpp",
1232 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001233 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001234
1235 // The following implementations depend on pthread data or implementation,
1236 // so we can't include them in libc_ndk.a.
1237 "bionic/__cxa_thread_atexit_impl.cpp",
1238 "stdlib/atexit.c",
1239 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001240 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001241
Colin Cross50c21ab2015-10-31 23:03:05 -07001242 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001243 include_dirs: ["bionic/libstdc++/include"],
1244 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001245}
1246
1247// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001248// libc_syscalls.a
1249// ========================================================
1250
Elliott Hughes782c4852019-04-16 12:31:00 -07001251genrule {
1252 name: "syscalls-arm.S",
1253 out: ["syscalls-arm.S"],
1254 srcs: ["SYSCALLS.TXT"],
1255 tool_files: [":bionic-gensyscalls"],
1256 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1257}
1258
1259genrule {
1260 name: "syscalls-arm64.S",
1261 out: ["syscalls-arm64.S"],
1262 srcs: ["SYSCALLS.TXT"],
1263 tool_files: [":bionic-gensyscalls"],
1264 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1265}
1266
1267genrule {
1268 name: "syscalls-x86.S",
1269 out: ["syscalls-x86.S"],
1270 srcs: ["SYSCALLS.TXT"],
1271 tool_files: [":bionic-gensyscalls"],
1272 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1273}
1274
1275genrule {
1276 name: "syscalls-x86_64.S",
1277 out: ["syscalls-x86_64.S"],
1278 srcs: ["SYSCALLS.TXT"],
1279 tool_files: [":bionic-gensyscalls"],
1280 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1281}
1282
Dan Willemsen208ae172015-09-16 16:33:27 -07001283cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001284 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001285 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001286 arch: {
1287 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001288 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001289 },
1290 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001291 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001292 },
1293 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001294 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001295 },
1296 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001297 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001298 },
1299 },
1300 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001301}
1302
1303// ========================================================
1304// libc_aeabi.a
1305// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1306// to avoid infinite recursion. For the other architectures we just build an
1307// empty library to keep this makefile simple.
1308// ========================================================
1309
1310cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001311 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001312 arch: {
1313 arm: {
1314 srcs: ["arch-arm/bionic/__aeabi.c"],
1315 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001316 },
1317 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001318 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001319}
1320
1321// ========================================================
1322// libc_ndk.a
1323// Compatibility library for the NDK. This library contains
1324// all the parts of libc that are safe to statically link.
1325// We can't safely statically link things that can only run
1326// on a certain version of the OS. Examples include
1327// anything that talks to netd (a large portion of the DNS
1328// code) and anything that is dependent on the layout of a
1329// data structure that has changed across releases (such as
1330// pthread_t).
1331// ========================================================
1332
1333cc_library_static {
1334 name: "libc_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001335 defaults: ["libc_defaults"],
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001336 srcs: libc_common_src_files + [
1337 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001338 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001339 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001340 multilib: {
1341 lib32: {
1342 srcs: libc_common_src_files_32,
1343 },
1344 },
1345 arch: {
1346 arm: {
1347 srcs: [
1348 "arch-arm/bionic/exidx_dynamic.c",
1349 "arch-common/bionic/crtbegin_so.c",
1350 "arch-arm/bionic/atexit_legacy.c",
1351 "arch-common/bionic/crtend_so.S",
1352 ],
1353 whole_static_libs: ["libc_aeabi"],
1354 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001355 },
1356
Colin Cross50c21ab2015-10-31 23:03:05 -07001357 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001358 "-fvisibility=hidden",
1359 "-DLIBC_STATIC",
1360 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001361
1362 whole_static_libs: [
1363 "libc_bionic_ndk",
George Burgess IV6cb06872017-07-21 13:28:42 -07001364 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001365 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001366 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001367 "libc_gdtoa",
1368 "libc_malloc",
1369 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001370 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001371 "libc_openbsd_ndk",
1372 "libc_stack_protector",
1373 "libc_syscalls",
1374 "libc_tzcode",
1375 "libm",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001376 "libjemalloc5",
Elliott Hughes816fab92016-05-27 17:57:46 -07001377 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001378 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001379}
1380
1381// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001382// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001383// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001384cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001385 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001386 srcs: libc_common_src_files,
1387 multilib: {
1388 lib32: {
1389 srcs: libc_common_src_files_32,
1390 },
1391 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001392 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001393
1394 whole_static_libs: [
1395 "libc_bionic",
1396 "libc_bionic_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001397 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001398 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001399 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001400 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001401 "libc_gdtoa",
1402 "libc_malloc",
1403 "libc_netbsd",
1404 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001405 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001406 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001407 "libc_stack_protector",
1408 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001409 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001410 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001411 ],
1412
1413 arch: {
1414 arm: {
1415 whole_static_libs: ["libc_aeabi"],
1416 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001417 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001418}
1419
1420// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001421// libc_common.a
1422// ========================================================
1423
1424cc_library_static {
1425 defaults: ["libc_defaults"],
1426 name: "libc_common",
1427
1428 whole_static_libs: [
1429 "libc_nopthread",
1430 "libc_pthread",
1431 ],
1432}
1433
1434// ========================================================
Haibo Huangf71edfa2018-11-12 10:06:56 -08001435// libc_common_static.a For static binaries.
1436// ========================================================
1437cc_library_static {
1438 defaults: ["libc_defaults"],
1439 name: "libc_common_static",
1440
Haibo Huangb9244ff2018-08-11 10:12:13 -07001441 arch: {
1442 x86: {
1443 srcs: ["arch-x86/static_function_dispatch.S"],
1444 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001445 arm: {
1446 srcs: ["arch-arm/static_function_dispatch.S"],
1447 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001448 },
1449
Haibo Huangf71edfa2018-11-12 10:06:56 -08001450 whole_static_libs: [
1451 "libc_common",
1452 ],
1453}
1454
1455// ========================================================
1456// libc_common_shared.a For shared libraries.
1457// ========================================================
1458cc_library_static {
1459 defaults: ["libc_defaults"],
1460 name: "libc_common_shared",
1461
Haibo Huangb9244ff2018-08-11 10:12:13 -07001462 cflags: [
1463 "-fno-stack-protector",
1464 "-fno-jump-tables",
1465 ],
1466 arch: {
1467 x86: {
1468 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1469 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001470 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001471 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001472 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001473 },
1474
Haibo Huangf71edfa2018-11-12 10:06:56 -08001475 whole_static_libs: [
1476 "libc_common",
1477 ],
1478}
1479
1480// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001481// libc_nomalloc.a
1482// ========================================================
1483//
1484// This is a version of the static C library that does not
1485// include malloc. It's useful in situations when the user wants
1486// to provide their own malloc implementation, or wants to
1487// explicitly disallow the use of malloc, such as in the
1488// dynamic linker.
1489
1490cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001491 name: "libc_nomalloc",
1492
Colin Cross50c21ab2015-10-31 23:03:05 -07001493 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001494
1495 arch: {
1496 arm: {
1497 srcs: ["arch-arm/bionic/exidx_static.c"],
1498 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001499 },
1500
Colin Cross50c21ab2015-10-31 23:03:05 -07001501 cflags: ["-DLIBC_STATIC"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001502
Colin Crossa3f9fca2016-01-11 13:20:55 -08001503 whole_static_libs: [
Haibo Huangf71edfa2018-11-12 10:06:56 -08001504 "libc_common_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001505 "libc_init_static",
1506 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001507}
1508
1509// ========================================================
1510// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1511// ========================================================
1512cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001513 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001514 srcs: ["bionic/jemalloc_wrapper.cpp"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001515 cflags: ["-fvisibility=hidden"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001516
Dan Willemsen208ae172015-09-16 16:33:27 -07001517 name: "libc_malloc",
Dan Willemsen208ae172015-09-16 16:33:27 -07001518}
1519
dimitryc0c0ef62018-12-05 16:33:52 +01001520filegroup {
1521 name: "libc_sources_shared",
1522 srcs: [
1523 "arch-common/bionic/crtbegin_so.c",
1524 "arch-common/bionic/crtbrand.S",
1525 "bionic/icu.cpp",
1526 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001527 "bionic/malloc_common_dynamic.cpp",
1528 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001529 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001530 "bionic/NetdClient.cpp",
1531 "arch-common/bionic/crtend_so.S",
1532 ],
1533}
1534
1535filegroup {
1536 name: "libc_sources_static",
1537 srcs: [
1538 "bionic/dl_iterate_phdr_static.cpp",
1539 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001540 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001541 ],
1542}
1543
1544filegroup {
1545 name: "libc_sources_shared_arm",
1546 srcs: [
1547 "arch-arm/bionic/exidx_dynamic.c",
1548 "arch-arm/bionic/atexit_legacy.c",
1549 ],
1550}
1551
1552filegroup {
1553 name: "libc_sources_static_arm",
1554 srcs: [ "arch-arm/bionic/exidx_static.c" ],
1555}
1556
Dan Willemsen208ae172015-09-16 16:33:27 -07001557// ========================================================
1558// libc.a + libc.so
1559// ========================================================
1560cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001561 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001562 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001563 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001564 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001565 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001566 platform_sdk_version: {
1567 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1568 },
1569 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001570 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001571 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001572 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001573 whole_static_libs: [
1574 "libc_init_static",
1575 "libc_common_static",
1576 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001577 },
1578 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001579 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001580 whole_static_libs: [
1581 "libc_init_dynamic",
1582 "libc_common_shared",
1583 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001584 },
1585
Neil Fullera7db90f2019-04-25 09:28:27 +01001586 required: [
1587 "tzdata",
1588 "tz_version", // Version metadata for tzdata to help debugging.
1589 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001590
Colin Cross4ce94d22016-11-15 13:15:43 -08001591 // Do not pack libc.so relocations; see http://b/20645321 for details.
1592 pack_relocations: false,
1593
dimitry06016f22018-01-05 11:39:28 +01001594 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1595 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1596 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1597 // those new libraries from libgcc.a are not declared external; if that were the case,
1598 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1599 // on the external symbols from the dependent libraries. That would create a "cloaked"
1600 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001601
dimitry06016f22018-01-05 11:39:28 +01001602 shared_libs: [
1603 "ld-android",
1604 "libdl",
1605 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001606 static_libs: [
1607 "libdl_android",
1608 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001609 whole_static_libs: [
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001610 "libjemalloc5",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001611 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001612
1613 nocrt: true,
1614
Dan Willemsen208ae172015-09-16 16:33:27 -07001615 arch: {
1616 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001617 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001618 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001619 ldflags: ["-Wl,--hash-style=both"],
1620
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001621 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001622
Dan Willemsen208ae172015-09-16 16:33:27 -07001623 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001624 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001625 // special for arm
1626 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001627 },
1628 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001629 srcs: [":libc_sources_static_arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001630 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001631
1632 // Arm 32 bit does not produce complete exidx unwind information
1633 // so keep the .debug_frame which is relatively small and does
1634 // include needed unwind information.
1635 // See b/132992102 for details.
1636 strip: {
1637 keep_symbols_and_debug_frame: true,
1638 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001639 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001640 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001641 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001642
1643 // Leave the symbols in the shared library so that stack unwinders can produce
1644 // meaningful name resolution.
1645 strip: {
1646 keep_symbols: true,
1647 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001648 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001649 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001650 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001651 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001652 ldflags: ["-Wl,--hash-style=both"],
1653
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001654 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001655
1656 // Leave the symbols in the shared library so that stack unwinders can produce
1657 // meaningful name resolution.
1658 strip: {
1659 keep_symbols: true,
1660 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001661 },
1662 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001663 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001664
1665 // Leave the symbols in the shared library so that stack unwinders can produce
1666 // meaningful name resolution.
1667 strip: {
1668 keep_symbols: true,
1669 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001670 },
1671 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001672
1673 stubs: {
1674 symbol_file: "libc.map.txt",
1675 versions: ["10000"],
1676 },
Vic Yang6903fb82019-01-14 11:34:39 -08001677
Vic Yang03ff4362019-06-24 16:11:37 -07001678 // Sorting bss symbols by size usually results in less dirty pages at run
1679 // time, because small symbols are grouped together.
1680 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001681}
1682
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001683genrule {
1684 name: "libc.arm.map",
1685 out: ["libc.arm.map"],
1686 srcs: ["libc.map.txt"],
1687 tool_files: [":bionic-generate-version-script"],
1688 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1689}
1690
1691genrule {
1692 name: "libc.arm64.map",
1693 out: ["libc.arm64.map"],
1694 srcs: ["libc.map.txt"],
1695 tool_files: [":bionic-generate-version-script"],
1696 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1697}
1698
1699genrule {
1700 name: "libc.x86.map",
1701 out: ["libc.x86.map"],
1702 srcs: ["libc.map.txt"],
1703 tool_files: [":bionic-generate-version-script"],
1704 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1705}
1706
1707genrule {
1708 name: "libc.x86_64.map",
1709 out: ["libc.x86_64.map"],
1710 srcs: ["libc.map.txt"],
1711 tool_files: [":bionic-generate-version-script"],
1712 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1713}
1714
Paul Duffin6b5cb032019-07-18 14:36:26 +01001715// Makes bionic_tls.h available for art to use in its implementation of Thread::Current().
1716cc_library_headers {
1717 name: "bionic_libc_private_headers",
1718 visibility: [
1719 "//art:__subpackages__",
1720 ],
1721 host_supported: true,
1722 export_include_dirs: [
1723 "private",
1724 ],
1725 sdk_version: "current",
1726}
1727
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001728// Headers that only other parts of the platform can include.
1729cc_library_headers {
1730 name: "bionic_libc_platform_headers",
1731 visibility: [
1732 "//bionic/libc/malloc_debug:__subpackages__",
1733 "//bionic/libc/malloc_hooks:__subpackages__",
1734 "//frameworks/av/media/libmedia:__subpackages__",
1735 "//frameworks/av/media/utils:__subpackages__",
1736 "//frameworks/base/core/jni:__subpackages__",
1737 "//frameworks/base/services/core/jni:__subpackages__",
1738 "//external/perfetto:__subpackages__",
1739 ],
1740 host_supported: true,
1741 export_include_dirs: [
1742 "platform",
1743 ],
1744 sdk_version: "current",
1745}
1746
Logan Chien17af91b2019-01-15 21:19:56 +08001747// libc_headers for libasync_safe and libpropertyinfoparser
1748cc_library_headers {
1749 name: "libc_headers",
1750
1751 host_supported: true,
1752 vendor_available: true,
1753 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001754 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001755
1756 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001757 stl: "none",
1758 system_shared_libs: [],
1759
1760 export_include_dirs: [
1761 "include",
1762 "kernel/uapi",
1763 "kernel/android/uapi",
1764 ],
1765
1766 arch: {
1767 arm: {
1768 export_include_dirs: [
1769 "kernel/uapi/asm-arm",
1770 ],
1771 },
1772 arm64: {
1773 export_include_dirs: [
1774 "kernel/uapi/asm-arm64",
1775 ],
1776 },
1777 mips: {
1778 export_include_dirs: [
1779 "kernel/uapi/asm-mips",
1780 ],
1781 },
1782 mips64: {
1783 export_include_dirs: [
1784 "kernel/uapi/asm-mips",
1785 ],
1786 },
1787 x86: {
1788 export_include_dirs: [
1789 "kernel/uapi/asm-x86",
1790 ],
1791 },
1792 x86_64: {
1793 export_include_dirs: [
1794 "kernel/uapi/asm-x86",
1795 ],
1796 },
1797 },
1798}
1799
Dan Willemsen208ae172015-09-16 16:33:27 -07001800// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001801// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001802// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001803
Dan Willemsen208ae172015-09-16 16:33:27 -07001804cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001805 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001806 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001807 srcs: [
1808 "bionic/__cxa_guard.cpp",
1809 "bionic/__cxa_pure_virtual.cpp",
1810 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001811 ],
1812 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001813 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001814 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001815
Dan Willemsen6b3be172018-12-03 13:57:20 -08001816 static: {
1817 system_shared_libs: [],
1818 },
1819 shared: {
1820 system_shared_libs: ["libc"],
1821 },
1822
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001823 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001824 arch: {
1825 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001826 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001827 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001828 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001829 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001830 },
1831 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001832 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001833 },
1834 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001835 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001836 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001837 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001838 },
1839 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001840 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001841 },
1842 },
1843}
1844
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001845genrule {
1846 name: "libstdc++.arm.map",
1847 out: ["libstdc++.arm.map"],
1848 srcs: ["libstdc++.map.txt"],
1849 tool_files: [":bionic-generate-version-script"],
1850 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1851}
1852
1853genrule {
1854 name: "libstdc++.arm64.map",
1855 out: ["libstdc++.arm64.map"],
1856 srcs: ["libstdc++.map.txt"],
1857 tool_files: [":bionic-generate-version-script"],
1858 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1859}
1860
1861genrule {
1862 name: "libstdc++.x86.map",
1863 out: ["libstdc++.x86.map"],
1864 srcs: ["libstdc++.map.txt"],
1865 tool_files: [":bionic-generate-version-script"],
1866 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1867}
1868
1869genrule {
1870 name: "libstdc++.x86_64.map",
1871 out: ["libstdc++.x86_64.map"],
1872 srcs: ["libstdc++.map.txt"],
1873 tool_files: [":bionic-generate-version-script"],
1874 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1875}
1876
1877// ========================================================
1878// crt object files.
1879// ========================================================
1880
Colin Cross50c21ab2015-10-31 23:03:05 -07001881cc_defaults {
1882 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001883 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001884 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001885 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001886 native_bridge_supported: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001887
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001888 cflags: [
1889 "-Wno-gcc-compat",
1890 "-Wall",
1891 "-Werror",
1892 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001893}
1894
Colin Cross50c21ab2015-10-31 23:03:05 -07001895cc_defaults {
1896 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001897 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001898
1899 arch: {
1900 mips: {
1901 cflags: ["-fPIC"],
1902 },
1903 mips64: {
1904 cflags: ["-fPIC"],
1905 },
1906 x86: {
1907 cflags: ["-fPIC"],
1908 },
1909 x86_64: {
1910 cflags: ["-fPIC"],
1911 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001912 },
Colin Crossab179442018-09-27 11:03:22 -07001913 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001914}
1915
Dan Willemsen208ae172015-09-16 16:33:27 -07001916cc_object {
1917 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001918 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001919 local_include_dirs: ["include"],
1920 product_variables: {
1921 platform_sdk_version: {
1922 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1923 },
1924 },
1925 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001926
Colin Cross7d7b3682017-11-03 13:38:40 -07001927 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001928}
1929
Dan Willemsen208ae172015-09-16 16:33:27 -07001930cc_object {
1931 name: "crtbegin_so1",
1932 local_include_dirs: ["include"],
1933 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001934
Colin Cross7d7b3682017-11-03 13:38:40 -07001935 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001936}
1937
Dan Willemsen208ae172015-09-16 16:33:27 -07001938cc_object {
1939 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07001940
Colin Cross7d7b3682017-11-03 13:38:40 -07001941 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07001942 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001943 "crtbegin_so1",
1944 "crtbrand",
1945 ],
1946}
1947
Dan Willemsen208ae172015-09-16 16:33:27 -07001948cc_object {
1949 name: "crtend_so",
1950 local_include_dirs: ["include"],
1951 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001952
Colin Cross7d7b3682017-11-03 13:38:40 -07001953 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001954}
1955
Dan Willemsen208ae172015-09-16 16:33:27 -07001956cc_object {
1957 name: "crtbegin_static1",
1958 local_include_dirs: ["include"],
1959 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001960
Colin Cross50c21ab2015-10-31 23:03:05 -07001961 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001962 mips: {
1963 srcs: [
1964 "arch-mips/bionic/crtbegin.c",
1965 ],
1966 exclude_srcs: [
1967 "arch-common/bionic/crtbegin.c",
1968 ],
1969 },
1970 mips64: {
1971 srcs: [
1972 "arch-mips64/bionic/crtbegin.c",
1973 ],
1974 exclude_srcs: [
1975 "arch-common/bionic/crtbegin.c",
1976 ],
1977 },
1978 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001979
1980 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001981}
1982
Dan Willemsen208ae172015-09-16 16:33:27 -07001983cc_object {
1984 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07001985
Colin Cross77d57bf2016-04-11 14:34:18 -07001986 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001987 "crtbegin_static1",
1988 "crtbrand",
1989 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001990 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001991}
1992
Dan Willemsen208ae172015-09-16 16:33:27 -07001993cc_object {
1994 name: "crtbegin_dynamic1",
1995 local_include_dirs: ["include"],
1996 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001997
Colin Cross50c21ab2015-10-31 23:03:05 -07001998 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001999 mips: {
2000 srcs: [
2001 "arch-mips/bionic/crtbegin.c",
2002 ],
2003 exclude_srcs: [
2004 "arch-common/bionic/crtbegin.c",
2005 ],
2006 },
2007 mips64: {
2008 srcs: [
2009 "arch-mips64/bionic/crtbegin.c",
2010 ],
2011 exclude_srcs: [
2012 "arch-common/bionic/crtbegin.c",
2013 ],
2014 },
2015 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002016 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002017}
2018
Dan Willemsen208ae172015-09-16 16:33:27 -07002019cc_object {
2020 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002021
Colin Cross77d57bf2016-04-11 14:34:18 -07002022 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002023 "crtbegin_dynamic1",
2024 "crtbrand",
2025 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002026 target: {
2027 linux_bionic: {
2028 generated_sources: ["host_bionic_linker_asm"],
2029 objs: [
2030 "linker_wrapper",
2031 ],
2032 },
2033 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002034 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002035}
2036
Dan Willemsen208ae172015-09-16 16:33:27 -07002037cc_object {
2038 // We rename crtend.o to crtend_android.o to avoid a
2039 // name clash between gcc and bionic.
2040 name: "crtend_android",
2041 local_include_dirs: ["include"],
2042 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002043
Colin Cross50c21ab2015-10-31 23:03:05 -07002044 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002045}
Colin Crossbaa48992016-07-13 11:15:21 -07002046
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002047// ========================================================
2048// NDK headers.
2049// ========================================================
2050
Dan Albert26e1c412018-05-24 14:56:46 -07002051versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002052 name: "common_libc",
2053 from: "include",
2054 to: "",
2055 license: "NOTICE",
2056}
Dan Albert4238a352016-06-28 11:18:05 -07002057
2058ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002059 name: "libc_uapi",
2060 from: "kernel/uapi",
2061 to: "",
2062 srcs: [
2063 "kernel/uapi/asm-generic/**/*.h",
2064 "kernel/uapi/drm/**/*.h",
2065 "kernel/uapi/linux/**/*.h",
2066 "kernel/uapi/misc/**/*.h",
2067 "kernel/uapi/mtd/**/*.h",
2068 "kernel/uapi/rdma/**/*.h",
2069 "kernel/uapi/scsi/**/*.h",
2070 "kernel/uapi/sound/**/*.h",
2071 "kernel/uapi/video/**/*.h",
2072 "kernel/uapi/xen/**/*.h",
2073 ],
Dan Albert92592652016-10-20 01:42:54 -07002074 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002075}
2076
2077ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002078 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002079 from: "kernel/android/uapi/linux",
2080 to: "linux",
2081 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002082 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002083}
2084
2085ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002086 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002087 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002088 to: "scsi",
2089 srcs: ["kernel/android/scsi/**/*.h"],
2090 license: "NOTICE",
2091}
2092
2093ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002094 name: "libc_asm_arm",
2095 from: "kernel/uapi/asm-arm",
2096 to: "arm-linux-androideabi",
2097 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002098 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002099}
2100
2101ndk_headers {
2102 name: "libc_asm_arm64",
2103 from: "kernel/uapi/asm-arm64",
2104 to: "aarch64-linux-android",
2105 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002106 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002107}
2108
Elliott Hughesee291c02017-12-11 11:32:34 -08002109// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002110ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002111 name: "libc_asm_mips",
2112 from: "kernel/uapi/asm-mips",
2113 to: "mipsel-linux-android",
2114 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2115 license: "NOTICE",
2116}
2117
Elliott Hughesee291c02017-12-11 11:32:34 -08002118// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002119ndk_headers {
2120 name: "libc_asm_mips64",
2121 from: "kernel/uapi/asm-mips",
2122 to: "mips64el-linux-android",
2123 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2124 license: "NOTICE",
2125}
2126
2127ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002128 name: "libc_asm_x86",
2129 from: "kernel/uapi/asm-x86",
2130 to: "i686-linux-android",
2131 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002132 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002133}
2134
2135ndk_headers {
2136 name: "libc_asm_x86_64",
2137 from: "kernel/uapi/asm-x86",
2138 to: "x86_64-linux-android",
2139 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002140 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002141}
2142
Dan Albert4238a352016-06-28 11:18:05 -07002143ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002144 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002145 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002146 symbol_file: "libc.map.txt",
2147 first_version: "9",
2148}
2149
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002150llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002151 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002152 symbol_file: "libc.map.txt",
2153 export_headers_as_system: true,
2154 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002155 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002156 export_include_dirs: [
2157 "kernel/android/uapi",
2158 "kernel/uapi",
2159 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002160 arch: {
2161 arm: {
2162 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002163 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002164 ],
2165 },
2166 arm64: {
2167 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002168 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002169 ],
2170 },
2171 mips: {
2172 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002173 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002174 ],
2175 },
2176 mips64: {
2177 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002178 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002179 ],
2180 },
2181 x86: {
2182 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002183 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002184 ],
2185 },
2186 x86_64: {
2187 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002188 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002189 ],
2190 },
2191 },
2192}
2193
Dan Albertdf31aff2016-10-06 15:50:41 -07002194ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002195 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002196 symbol_file: "libstdc++.map.txt",
2197 first_version: "9",
2198}
2199
Dan Willemsenca056d72018-01-08 14:00:24 -08002200// Export these headers for toolbox to process
2201filegroup {
2202 name: "kernel_input_headers",
2203 srcs: [
2204 "kernel/uapi/linux/input.h",
2205 "kernel/uapi/linux/input-event-codes.h",
2206 ],
2207}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002208
2209// Generate a syscall name / number mapping. These objects are text files
2210// (thanks to the -dD -E flags) and not binary files. They will then be
2211// consumed by the genseccomp.py script and converted into C++ code.
2212cc_defaults {
2213 name: "libseccomp_gen_syscall_nrs_defaults",
2214 recovery_available: true,
2215 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2216 cflags: [
2217 "-dD",
2218 "-E",
2219 "-Wall",
2220 "-Werror",
2221 "-nostdinc",
2222 ],
2223}
2224
2225cc_object {
2226 name: "libseccomp_gen_syscall_nrs_arm",
2227 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2228 local_include_dirs: [
2229 "kernel/uapi/asm-arm",
2230 "kernel/uapi",
2231 ],
2232}
2233
2234cc_object {
2235 name: "libseccomp_gen_syscall_nrs_arm64",
2236 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2237 local_include_dirs: [
2238 "kernel/uapi/asm-arm64",
2239 "kernel/uapi",
2240 ],
2241}
2242
2243cc_object {
2244 name: "libseccomp_gen_syscall_nrs_x86",
2245 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2246 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2247 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2248 local_include_dirs: [
2249 "kernel/uapi/asm-x86",
2250 "kernel/uapi",
2251 ],
2252}
2253
2254cc_object {
2255 name: "libseccomp_gen_syscall_nrs_x86_64",
2256 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2257 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2258 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2259 local_include_dirs: [
2260 "kernel/uapi/asm-x86",
2261 "kernel/uapi",
2262 ],
2263}
2264
2265cc_object {
2266 name: "libseccomp_gen_syscall_nrs_mips",
2267 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2268 cflags: [
2269 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2270 ],
2271 local_include_dirs: [
2272 "kernel/uapi/asm-mips",
2273 "kernel/uapi",
2274 ],
2275}
2276
2277cc_object {
2278 name: "libseccomp_gen_syscall_nrs_mips64",
2279 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2280 cflags: [
2281 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2282 ],
2283 local_include_dirs: [
2284 "kernel/uapi/asm-mips",
2285 "kernel/uapi",
2286 ],
2287}
2288
Elliott Hughesae03b122019-09-17 16:37:05 -07002289// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002290python_binary_host {
2291 name: "genseccomp",
2292 main: "tools/genseccomp.py",
2293
2294 srcs: [
2295 "tools/genseccomp.py",
2296 "tools/gensyscalls.py",
2297 ],
2298
2299 data: [
2300 "kernel/uapi/**/*.h",
2301 ],
2302
2303 version: {
2304 py2: {
2305 enabled: true,
2306 },
2307 py3: {
2308 enabled: false,
2309 },
2310 },
2311}
2312
Martijn Coenen0c6de752019-01-02 12:52:51 +01002313python_binary_host {
2314 name: "genfunctosyscallnrs",
2315 main: "tools/genfunctosyscallnrs.py",
2316
2317 srcs: [
2318 "tools/genseccomp.py",
2319 "tools/genfunctosyscallnrs.py",
2320 "tools/gensyscalls.py",
2321 ],
2322
2323 data: [
2324 "kernel/uapi/**/*.h",
2325 ],
2326
2327 version: {
2328 py2: {
2329 enabled: true,
2330 },
2331 py3: {
2332 enabled: false,
2333 },
2334 },
2335}
2336
2337cc_genrule {
2338 name: "func_to_syscall_nrs",
2339 recovery_available: true,
2340 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2341
2342 tools: [ "genfunctosyscallnrs" ],
2343
2344 srcs: [
2345 "SYSCALLS.TXT",
2346 ":libseccomp_gen_syscall_nrs_arm",
2347 ":libseccomp_gen_syscall_nrs_arm64",
2348 ":libseccomp_gen_syscall_nrs_mips",
2349 ":libseccomp_gen_syscall_nrs_mips64",
2350 ":libseccomp_gen_syscall_nrs_x86",
2351 ":libseccomp_gen_syscall_nrs_x86_64",
2352 ],
2353
2354 out: [
2355 "func_to_syscall_nrs.h",
2356 ],
2357}
2358
Martijn Coenenc3752be2019-01-09 16:19:57 +01002359// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2360genrule {
2361 name: "generate_app_zygote_blacklist",
2362 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2363 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2364 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2365}
2366
2367cc_genrule {
2368 name: "libseccomp_policy_app_zygote_sources",
2369 recovery_available: true,
2370 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2371
2372 tools: [ "genseccomp" ],
2373
2374 srcs: [
2375 "SYSCALLS.TXT",
2376 "SECCOMP_WHITELIST_COMMON.TXT",
2377 "SECCOMP_WHITELIST_APP.TXT",
2378 "SECCOMP_BLACKLIST_COMMON.TXT",
2379 ":generate_app_zygote_blacklist",
2380 ":libseccomp_gen_syscall_nrs_arm",
2381 ":libseccomp_gen_syscall_nrs_arm64",
2382 ":libseccomp_gen_syscall_nrs_mips",
2383 ":libseccomp_gen_syscall_nrs_mips64",
2384 ":libseccomp_gen_syscall_nrs_x86",
2385 ":libseccomp_gen_syscall_nrs_x86_64",
2386 ],
2387
2388 out: [
2389 "arm64_app_zygote_policy.cpp",
2390 "arm_app_zygote_policy.cpp",
2391 "mips64_app_zygote_policy.cpp",
2392 "mips_app_zygote_policy.cpp",
2393 "x86_64_app_zygote_policy.cpp",
2394 "x86_app_zygote_policy.cpp",
2395 ],
2396}
2397
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002398cc_genrule {
2399 name: "libseccomp_policy_app_sources",
2400 recovery_available: true,
2401 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2402
2403 tools: [ "genseccomp" ],
2404
2405 srcs: [
2406 "SYSCALLS.TXT",
2407 "SECCOMP_WHITELIST_COMMON.TXT",
2408 "SECCOMP_WHITELIST_APP.TXT",
2409 "SECCOMP_BLACKLIST_COMMON.TXT",
2410 "SECCOMP_BLACKLIST_APP.TXT",
2411 ":libseccomp_gen_syscall_nrs_arm",
2412 ":libseccomp_gen_syscall_nrs_arm64",
2413 ":libseccomp_gen_syscall_nrs_mips",
2414 ":libseccomp_gen_syscall_nrs_mips64",
2415 ":libseccomp_gen_syscall_nrs_x86",
2416 ":libseccomp_gen_syscall_nrs_x86_64",
2417 ],
2418
2419 out: [
2420 "arm64_app_policy.cpp",
2421 "arm_app_policy.cpp",
2422 "mips64_app_policy.cpp",
2423 "mips_app_policy.cpp",
2424 "x86_64_app_policy.cpp",
2425 "x86_app_policy.cpp",
2426 ],
2427}
2428
2429cc_genrule {
2430 name: "libseccomp_policy_system_sources",
2431 recovery_available: true,
2432 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2433
2434 tools: [ "genseccomp" ],
2435
2436 srcs: [
2437 "SYSCALLS.TXT",
2438 "SECCOMP_WHITELIST_COMMON.TXT",
2439 "SECCOMP_WHITELIST_SYSTEM.TXT",
2440 "SECCOMP_BLACKLIST_COMMON.TXT",
2441 ":libseccomp_gen_syscall_nrs_arm",
2442 ":libseccomp_gen_syscall_nrs_arm64",
2443 ":libseccomp_gen_syscall_nrs_mips",
2444 ":libseccomp_gen_syscall_nrs_mips64",
2445 ":libseccomp_gen_syscall_nrs_x86",
2446 ":libseccomp_gen_syscall_nrs_x86_64",
2447 ],
2448
2449 out: [
2450 "arm64_system_policy.cpp",
2451 "arm_system_policy.cpp",
2452 "mips64_system_policy.cpp",
2453 "mips_system_policy.cpp",
2454 "x86_64_system_policy.cpp",
2455 "x86_system_policy.cpp",
2456 ],
2457}
2458
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002459cc_library {
2460 name: "libseccomp_policy",
2461 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002462 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002463 generated_sources: [
2464 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002465 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002466 "libseccomp_policy_system_sources",
2467 ],
2468
2469 srcs: [
2470 "seccomp/seccomp_policy.cpp",
2471 ],
2472
2473 export_include_dirs: ["seccomp/include"],
2474 cflags: [
2475 "-Wall",
2476 "-Werror",
2477 ],
2478 shared: {
2479 shared_libs: ["libbase"],
2480 },
2481 static: {
2482 static_libs: ["libbase"],
2483 },
2484}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002485
2486// This is a temporary library that will use scudo as the native memory
2487// allocator. To use it, add it as the first shared library.
2488cc_library_shared {
2489 name: "libc_scudo",
2490 vendor_available: true,
2491 srcs: [
2492 "bionic/malloc_common.cpp",
2493 "bionic/malloc_common_dynamic.cpp",
2494 "bionic/malloc_heapprofd.cpp",
2495 "bionic/malloc_limit.cpp",
2496 "bionic/scudo_wrapper.cpp",
2497 "bionic/__set_errno.cpp",
2498 ],
2499 cflags: ["-DUSE_SCUDO"],
2500 stl: "none",
2501 system_shared_libs: [],
2502
2503 header_libs: ["libc_headers"],
2504
2505 static_libs: ["libasync_safe"],
2506
2507 allow_undefined_symbols: true,
2508 shared_libs: ["libscudo_wrapper"],
2509
2510 arch: {
2511 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002512 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002513 },
2514 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002515 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002516 },
2517 x86: {
2518 srcs: [
2519 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002520 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002521 ],
2522 },
2523 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002524 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002525 },
2526 },
2527
2528 // Mark this library as global so it overrides all the allocation
2529 // definitions properly.
2530 ldflags: ["-Wl,-z,global"],
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002531
2532 // Like libc, disable native coverage for libc_scudo.
2533 native_coverage: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002534}
2535
2536subdirs = [
2537 "bionic/scudo",
2538]