blob: 720156255641c7cc96eed7b7c0f017b57fcd4b70 [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001// Define the common source files for all the libc instances
2// =========================================================
3libc_common_src_files = [
Christopher Ferris7a3681e2017-04-24 17:48:32 -07004 "async_safe/async_safe_log.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07005 "bionic/ether_aton.c",
6 "bionic/ether_ntoa.c",
7 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/pututline.c",
11 "bionic/sched_cpualloc.c",
12 "bionic/sched_cpucount.c",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070013 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070014 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070015 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080016 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070017 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080018 "stdio/vfscanf.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070019 "stdio/vfwscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070020 "stdlib/exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070021]
22
23// Various kinds of cruft.
24// ========================================================
25libc_common_src_files += [
26 "bionic/ndk_cruft.cpp",
27]
28
29libc_common_src_files_32 = [
30 "bionic/legacy_32_bit_support.cpp",
31 "bionic/time64.c",
32]
33
Elliott Hughes53cf3482016-08-09 13:06:41 -070034libc_common_flags = [
35 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080036 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070037 "-Wall",
38 "-Wextra",
39 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080040 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070041 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070042 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070043 "-Wframe-larger-than=2048",
George Burgess IVfa5410f2018-08-13 17:44:06 -070044 "-Wimplicit-fallthrough",
Elliott Hughes53cf3482016-08-09 13:06:41 -070045
46 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
47 "-Werror=pointer-to-int-cast",
48 "-Werror=int-to-pointer-cast",
49 "-Werror=type-limits",
50 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080051
52 // Clang's exit-time destructor registration hides __dso_handle, but
53 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
54 "-Wexit-time-destructors",
Elliott Hughes53cf3482016-08-09 13:06:41 -070055]
56
Dan Willemsen208ae172015-09-16 16:33:27 -070057// Define some common cflags
58// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070059cc_defaults {
60 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080061 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070062 cflags: libc_common_flags,
63 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070064 conlyflags: ["-std=gnu99"],
65 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070066 include_dirs: [
67 "bionic/libc/async_safe/include",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -070068 "external/jemalloc_new/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070069 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070070
Colin Cross50c21ab2015-10-31 23:03:05 -070071 stl: "none",
72 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070073 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070074 address: false,
75 integer_overflow: false,
Colin Cross27c43c52016-04-07 13:27:24 -070076 },
Colin Cross50c21ab2015-10-31 23:03:05 -070077 native_coverage: false,
Jiyong Park5603c6e2018-04-27 21:53:11 +090078 recovery_available: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080079
Yi Konge3d90de2019-02-20 14:28:56 -080080 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
81 // warning since this is intended right now.
82 ldflags: ["-Wl,-z,muldefs"],
Dan Willemsen208ae172015-09-16 16:33:27 -070083}
84
Dan Willemsen208ae172015-09-16 16:33:27 -070085// ========================================================
86// libc_stack_protector.a - stack protector code
87// ========================================================
88//
Colin Crossa3f9fca2016-01-11 13:20:55 -080089// Code that implements the stack protector (or that runs
90// before TLS has been set up) needs to be compiled with
91// -fno-stack-protector, since it accesses the stack canary
92// TLS slot.
Dan Willemsen208ae172015-09-16 16:33:27 -070093
94cc_library_static {
95
Colin Crossa3f9fca2016-01-11 13:20:55 -080096 srcs: [
97 "bionic/__libc_init_main_thread.cpp",
98 "bionic/__stack_chk_fail.cpp",
99 ],
100 arch: {
101 arm64: {
102 srcs: ["arch-arm64/bionic/__set_tls.c"],
103 },
104 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700105 srcs: [
106 "arch-x86/bionic/__libc_init_sysinfo.cpp",
107 "arch-x86/bionic/__set_tls.cpp",
108 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800109 },
110 x86_64: {
111 srcs: ["arch-x86_64/bionic/__set_tls.c"],
112 },
113 },
114
Colin Cross50c21ab2015-10-31 23:03:05 -0700115 defaults: ["libc_defaults"],
116 cflags: ["-fno-stack-protector"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700117 name: "libc_stack_protector",
Dan Willemsen208ae172015-09-16 16:33:27 -0700118}
119
Colin Crossa3f9fca2016-01-11 13:20:55 -0800120// libc_init_static.cpp also needs to be built without stack protector,
121// because it's responsible for setting up TLS for static executables.
122// This isn't the case for dynamic executables because the dynamic linker
123// has already set up the main thread's TLS.
124
125cc_library_static {
126 name: "libc_init_static",
127 defaults: ["libc_defaults"],
128 srcs: ["bionic/libc_init_static.cpp"],
129 cflags: ["-fno-stack-protector"],
130}
131
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700132cc_library_static {
133 name: "libc_init_dynamic",
134 defaults: ["libc_defaults"],
135 srcs: ["bionic/libc_init_dynamic.cpp"],
136 cflags: ["-fno-stack-protector"],
137}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800138
Dan Willemsen208ae172015-09-16 16:33:27 -0700139// ========================================================
140// libc_tzcode.a - upstream 'tzcode' code
141// ========================================================
142
143cc_library_static {
144
Colin Cross50c21ab2015-10-31 23:03:05 -0700145 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700146 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800147 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700148 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700149 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
150 ],
151
Colin Cross50c21ab2015-10-31 23:03:05 -0700152 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700153 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700154 // Don't use ridiculous amounts of stack.
155 "-DALL_STATE",
156 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
157 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800158 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700159 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700160 // The name of the tm_gmtoff field in our struct tm.
161 "-DTM_GMTOFF=tm_gmtoff",
162 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700163 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700164 // Include `tzname`, `timezone`, and `daylight` globals.
165 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700166 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800167 // Use the empty string (instead of " ") as the timezone abbreviation
168 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700169 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700170 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
171 "-Dlint",
172 ],
173
Dan Willemsen208ae172015-09-16 16:33:27 -0700174 local_include_dirs: ["tzcode/"],
175 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700176}
177
178// ========================================================
179// libc_dns.a - modified NetBSD DNS code
180// ========================================================
181
182cc_library_static {
183
Colin Cross50c21ab2015-10-31 23:03:05 -0700184 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700185 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800186 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700187
188 "upstream-netbsd/lib/libc/isc/ev_streams.c",
189 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700190 ],
191
Colin Cross50c21ab2015-10-31 23:03:05 -0700192 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700193 "-DANDROID_CHANGES",
194 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700195 "-Wno-unused-parameter",
196 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700197 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700198 ],
199
Dan Willemsen208ae172015-09-16 16:33:27 -0700200 local_include_dirs: [
201 "dns/include",
202 "private",
203 "upstream-netbsd/lib/libc/include",
204 "upstream-netbsd/android/include",
205 ],
206
207 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700208}
209
210// ========================================================
211// libc_freebsd.a - upstream FreeBSD C library code
212// ========================================================
213//
214// These files are built with the freebsd-compat.h header file
215// automatically included.
216
217cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700218 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700219 srcs: [
220 "upstream-freebsd/lib/libc/gen/ldexp.c",
221 "upstream-freebsd/lib/libc/gen/sleep.c",
222 "upstream-freebsd/lib/libc/gen/usleep.c",
223 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700224 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
225 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
226 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
227 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700228 "upstream-freebsd/lib/libc/stdlib/qsort.c",
229 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700230 "upstream-freebsd/lib/libc/string/wcpcpy.c",
231 "upstream-freebsd/lib/libc/string/wcpncpy.c",
232 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700233 "upstream-freebsd/lib/libc/string/wcscat.c",
234 "upstream-freebsd/lib/libc/string/wcschr.c",
235 "upstream-freebsd/lib/libc/string/wcscmp.c",
236 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700237 "upstream-freebsd/lib/libc/string/wcscspn.c",
238 "upstream-freebsd/lib/libc/string/wcsdup.c",
239 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700240 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700241 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
242 "upstream-freebsd/lib/libc/string/wcsncat.c",
243 "upstream-freebsd/lib/libc/string/wcsncmp.c",
244 "upstream-freebsd/lib/libc/string/wcsncpy.c",
245 "upstream-freebsd/lib/libc/string/wcsnlen.c",
246 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700247 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700248 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700249 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700250 "upstream-freebsd/lib/libc/string/wcstok.c",
251 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700252 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700253 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700254 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800255 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700256 ],
257 arch: {
258 arm64: {
259 exclude_srcs: [
260 "upstream-freebsd/lib/libc/string/wmemmove.c",
261 ],
262 },
263 x86: {
264 exclude_srcs: [
265 "upstream-freebsd/lib/libc/string/wcschr.c",
266 "upstream-freebsd/lib/libc/string/wcscmp.c",
267 "upstream-freebsd/lib/libc/string/wcslen.c",
268 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700269 "upstream-freebsd/lib/libc/string/wmemcmp.c",
270 "upstream-freebsd/lib/libc/string/wcscat.c",
271 "upstream-freebsd/lib/libc/string/wcscpy.c",
272 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700273 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700274 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700275 },
276
Colin Cross50c21ab2015-10-31 23:03:05 -0700277 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700278 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700279 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700280 "-include freebsd-compat.h",
281 ],
282
Dan Willemsen208ae172015-09-16 16:33:27 -0700283 local_include_dirs: [
284 "upstream-freebsd/android/include",
285 ],
286
287 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700288}
289
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700290cc_library_static {
291 defaults: ["libc_defaults"],
292 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700293 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700294 "upstream-freebsd/lib/libc/stdlib/realpath.c",
295 ],
296
297 cflags: [
298 "-Wno-sign-compare",
299 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700300 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700301 ],
302
303 local_include_dirs: [
304 "upstream-freebsd/android/include",
305 ],
306
307 name: "libc_freebsd_large_stack",
308}
309
Dan Willemsen208ae172015-09-16 16:33:27 -0700310// ========================================================
311// libc_netbsd.a - upstream NetBSD C library code
312// ========================================================
313//
314// These files are built with the netbsd-compat.h header file
315// automatically included.
316
317cc_library_static {
318
Colin Cross50c21ab2015-10-31 23:03:05 -0700319 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700320 srcs: [
321 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700322 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700323 "upstream-netbsd/lib/libc/gen/psignal.c",
324 "upstream-netbsd/lib/libc/gen/utime.c",
325 "upstream-netbsd/lib/libc/gen/utmp.c",
326 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
327 "upstream-netbsd/lib/libc/regex/regcomp.c",
328 "upstream-netbsd/lib/libc/regex/regerror.c",
329 "upstream-netbsd/lib/libc/regex/regexec.c",
330 "upstream-netbsd/lib/libc/regex/regfree.c",
331 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700332 "upstream-netbsd/lib/libc/stdlib/drand48.c",
333 "upstream-netbsd/lib/libc/stdlib/erand48.c",
334 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
335 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700336 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
337 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
338 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
339 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
340 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
341 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
342 "upstream-netbsd/lib/libc/stdlib/seed48.c",
343 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700344 ],
345 multilib: {
346 lib32: {
347 // LP32 cruft
348 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
349 },
350 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700351 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700352 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800353 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700354 "-DPOSIX_MISTAKE",
355 "-include netbsd-compat.h",
356 ],
357
Dan Willemsen208ae172015-09-16 16:33:27 -0700358 local_include_dirs: [
359 "upstream-netbsd/android/include",
360 "upstream-netbsd/lib/libc/include",
361 ],
362
363 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700364}
365
366// ========================================================
367// libc_openbsd_ndk.a - upstream OpenBSD C library code
368// that can be safely included in the libc_ndk.a (doesn't
369// contain any troublesome global data or constructors).
370// ========================================================
371//
372// These files are built with the openbsd-compat.h header file
373// automatically included.
374
375cc_library_static {
376 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700377 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700378 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700379 "upstream-openbsd/lib/libc/gen/alarm.c",
380 "upstream-openbsd/lib/libc/gen/ctype_.c",
381 "upstream-openbsd/lib/libc/gen/daemon.c",
382 "upstream-openbsd/lib/libc/gen/err.c",
383 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700384 "upstream-openbsd/lib/libc/gen/fnmatch.c",
385 "upstream-openbsd/lib/libc/gen/ftok.c",
386 "upstream-openbsd/lib/libc/gen/getprogname.c",
387 "upstream-openbsd/lib/libc/gen/isctype.c",
388 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700389 "upstream-openbsd/lib/libc/gen/tolower_.c",
390 "upstream-openbsd/lib/libc/gen/toupper_.c",
391 "upstream-openbsd/lib/libc/gen/verr.c",
392 "upstream-openbsd/lib/libc/gen/verrx.c",
393 "upstream-openbsd/lib/libc/gen/vwarn.c",
394 "upstream-openbsd/lib/libc/gen/vwarnx.c",
395 "upstream-openbsd/lib/libc/gen/warn.c",
396 "upstream-openbsd/lib/libc/gen/warnx.c",
397 "upstream-openbsd/lib/libc/locale/btowc.c",
398 "upstream-openbsd/lib/libc/locale/mbrlen.c",
399 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
400 "upstream-openbsd/lib/libc/locale/mbtowc.c",
401 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700402 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
403 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700404 "upstream-openbsd/lib/libc/locale/wcstoll.c",
405 "upstream-openbsd/lib/libc/locale/wcstombs.c",
406 "upstream-openbsd/lib/libc/locale/wcstoul.c",
407 "upstream-openbsd/lib/libc/locale/wcstoull.c",
408 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
409 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
410 "upstream-openbsd/lib/libc/locale/wctob.c",
411 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700412 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700413 "upstream-openbsd/lib/libc/net/htonl.c",
414 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700415 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
416 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
417 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700418 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
419 "upstream-openbsd/lib/libc/net/inet_ntop.c",
420 "upstream-openbsd/lib/libc/net/inet_pton.c",
421 "upstream-openbsd/lib/libc/net/ntohl.c",
422 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800423 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700424 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700425 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
426 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700427 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700428 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700429 "upstream-openbsd/lib/libc/stdio/fputwc.c",
430 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700431 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700432 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700433 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700434 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700435 "upstream-openbsd/lib/libc/stdio/makebuf.c",
436 "upstream-openbsd/lib/libc/stdio/mktemp.c",
437 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
438 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700439 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700440 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700441 "upstream-openbsd/lib/libc/stdio/tempnam.c",
442 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
443 "upstream-openbsd/lib/libc/stdio/ungetc.c",
444 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
445 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
446 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700447 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
448 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
449 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700450 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700451 "upstream-openbsd/lib/libc/stdio/wsetup.c",
452 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800453 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700454 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700455 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700456 "upstream-openbsd/lib/libc/stdlib/insque.c",
457 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
458 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
459 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800460 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700461 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800462 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700463 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700464 "upstream-openbsd/lib/libc/stdlib/remque.c",
465 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700466 "upstream-openbsd/lib/libc/stdlib/tfind.c",
467 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800468 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700469 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800470 "upstream-openbsd/lib/libc/string/strcasestr.c",
471 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700472 "upstream-openbsd/lib/libc/string/strcspn.c",
473 "upstream-openbsd/lib/libc/string/strdup.c",
474 "upstream-openbsd/lib/libc/string/strndup.c",
475 "upstream-openbsd/lib/libc/string/strpbrk.c",
476 "upstream-openbsd/lib/libc/string/strsep.c",
477 "upstream-openbsd/lib/libc/string/strspn.c",
478 "upstream-openbsd/lib/libc/string/strstr.c",
479 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800480 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700481 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700482 "upstream-openbsd/lib/libc/string/wcswidth.c",
483 ],
484
Colin Cross50c21ab2015-10-31 23:03:05 -0700485 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700486 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700487 "-Wno-unused-parameter",
488 "-include openbsd-compat.h",
489 ],
490
Dan Willemsen208ae172015-09-16 16:33:27 -0700491 local_include_dirs: [
492 "private",
493 "stdio",
494 "upstream-openbsd/android/include",
495 "upstream-openbsd/lib/libc/include",
496 "upstream-openbsd/lib/libc/gdtoa/",
497 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700498}
499
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700500cc_library_static {
501 name: "libc_openbsd_large_stack",
502 defaults: ["libc_defaults"],
503 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700504 "stdio/vfprintf.cpp",
505 "stdio/vfwprintf.cpp",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700506 ],
507 cflags: [
508 "-include openbsd-compat.h",
509 "-Wno-sign-compare",
510 "-Wframe-larger-than=5000",
511 ],
512
513 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700514 "upstream-openbsd/android/include/",
515 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700516 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700517 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700518 ],
519}
520
Dan Willemsen208ae172015-09-16 16:33:27 -0700521// ========================================================
522// libc_openbsd.a - upstream OpenBSD C library code
523// ========================================================
524//
525// These files are built with the openbsd-compat.h header file
526// automatically included.
527cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700528 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700529 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800530 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700531 "upstream-openbsd/lib/libc/crypt/arc4random.c",
532 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
533
534 // May be overriden by per-arch optimized versions
535 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700536 "upstream-openbsd/lib/libc/string/memrchr.c",
537 "upstream-openbsd/lib/libc/string/stpcpy.c",
538 "upstream-openbsd/lib/libc/string/stpncpy.c",
539 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700540 "upstream-openbsd/lib/libc/string/strcpy.c",
541 "upstream-openbsd/lib/libc/string/strlcat.c",
542 "upstream-openbsd/lib/libc/string/strlcpy.c",
543 "upstream-openbsd/lib/libc/string/strncat.c",
544 "upstream-openbsd/lib/libc/string/strncmp.c",
545 "upstream-openbsd/lib/libc/string/strncpy.c",
546 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700547
548 arch: {
549 arm: {
550 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700551 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800552 "upstream-openbsd/lib/libc/string/stpcpy.c",
553 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700554 ],
555 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700556 arm64: {
557 exclude_srcs: [
558 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700559 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700560 "upstream-openbsd/lib/libc/string/strcpy.c",
561 "upstream-openbsd/lib/libc/string/strncmp.c",
562 ],
563 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530564 mips: {
565 exclude_srcs: [
566 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530567 "upstream-openbsd/lib/libc/string/strcpy.c",
568 "upstream-openbsd/lib/libc/string/strncmp.c",
569 ],
570 },
571 mips64: {
572 exclude_srcs: [
573 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530574 "upstream-openbsd/lib/libc/string/strcpy.c",
575 "upstream-openbsd/lib/libc/string/strncmp.c",
576 ],
577 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700578 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800579 exclude_srcs: [
580 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800581 "upstream-openbsd/lib/libc/string/memrchr.c",
582 "upstream-openbsd/lib/libc/string/stpcpy.c",
583 "upstream-openbsd/lib/libc/string/stpncpy.c",
584 "upstream-openbsd/lib/libc/string/strcat.c",
585 "upstream-openbsd/lib/libc/string/strcpy.c",
586 "upstream-openbsd/lib/libc/string/strncmp.c",
587 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700588 "upstream-openbsd/lib/libc/string/strlcat.c",
589 "upstream-openbsd/lib/libc/string/strlcpy.c",
590 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800591 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700592 },
593
594 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800595 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800596 "upstream-openbsd/lib/libc/string/stpcpy.c",
597 "upstream-openbsd/lib/libc/string/stpncpy.c",
598 "upstream-openbsd/lib/libc/string/strcat.c",
599 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800600 "upstream-openbsd/lib/libc/string/strncat.c",
601 "upstream-openbsd/lib/libc/string/strncmp.c",
602 "upstream-openbsd/lib/libc/string/strncpy.c",
603 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700604 },
605 },
606
Colin Cross50c21ab2015-10-31 23:03:05 -0700607 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700608 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700609 "-Wno-unused-parameter",
610 "-include openbsd-compat.h",
611 ],
612
Dan Willemsen208ae172015-09-16 16:33:27 -0700613 local_include_dirs: [
614 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700615 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700616 ],
617
618 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700619}
620
621// ========================================================
622// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
623// ========================================================
624//
625// These files are built with the openbsd-compat.h header file
626// automatically included.
627
628cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700629 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700630 srcs: [
631 "upstream-openbsd/android/gdtoa_support.cpp",
632 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
633 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
634 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
635 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
636 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
637 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
638 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
639 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
640 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
641 "upstream-openbsd/lib/libc/gdtoa/misc.c",
642 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
643 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
644 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
645 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
646 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
647 "upstream-openbsd/lib/libc/gdtoa/sum.c",
648 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
649 ],
650 multilib: {
651 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800652 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700653 },
654 },
655
Colin Cross50c21ab2015-10-31 23:03:05 -0700656 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700657 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700658 "-include openbsd-compat.h",
659 ],
660
Dan Willemsen208ae172015-09-16 16:33:27 -0700661 local_include_dirs: [
662 "private",
663 "upstream-openbsd/android/include",
664 "upstream-openbsd/lib/libc/include",
665 ],
666
667 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700668}
669
670// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700671// libc_fortify.a - container for our FORITFY
672// implementation details
673// ========================================================
674cc_library_static {
675 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700676 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700677
678 name: "libc_fortify",
679
680 // Disable FORTIFY for the compilation of these, so we don't end up having
681 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800682 cflags: [
683 "-U_FORTIFY_SOURCE",
684 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
685 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700686
687 arch: {
688 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800689 cflags: [
690 "-DNO___MEMCPY_CHK",
691 "-DRENAME___STRCAT_CHK",
692 "-DRENAME___STRCPY_CHK",
693 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700694 srcs: [
695 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800696
697 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
698 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
699
700 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
701 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
702
703 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
704 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
705
706 "arch-arm/krait/bionic/__strcat_chk.S",
707 "arch-arm/krait/bionic/__strcpy_chk.S",
708
709 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
710 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
711
Haibo Huang01bfd892018-12-03 15:05:16 -0800712 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
713 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700714 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700715 },
716 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700717 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700718 srcs: [
719 "arch-arm64/generic/bionic/__memcpy_chk.S",
720 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700721 },
722 },
723}
724
725// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700726// libc_bionic.a - home-grown C library code
727// ========================================================
728
729cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700730 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700731 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700732 // The data that backs getauxval is initialized in the libc init
733 // functions which are invoked by the linker. If this file is included
734 // in libc_ndk.a, only one of the copies of the global data will be
735 // initialized, resulting in nullptr dereferences.
736 "bionic/getauxval.cpp",
737
Elliott Hughes211c4d32018-02-02 15:10:32 -0800738 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700739 "bionic/sysconf.cpp",
740 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700741 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700742
Josh Gao10ec9282017-04-03 15:13:29 -0700743 // The following must not be statically linked into libc_ndk.a, because
744 // debuggerd will look for the abort message in libc.so's copy.
745 "bionic/android_set_abort_message.cpp",
746
Dan Willemsen208ae172015-09-16 16:33:27 -0700747 "bionic/strchr.cpp",
748 "bionic/strnlen.c",
749 "bionic/strrchr.cpp",
750 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700751
752 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700753 arm: {
754 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800755 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700756 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800757 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800758 "arch-arm/generic/bionic/stpcpy.c",
759 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800760 "arch-arm/generic/bionic/strcmp.S",
761 "arch-arm/generic/bionic/strcpy.S",
762 "arch-arm/generic/bionic/strlen.c",
763
Ryan Prichard45024fe2018-12-30 21:10:26 -0800764 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700765 "arch-arm/bionic/__bionic_clone.S",
Yi Kong570ab492019-04-22 23:13:17 -0700766 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700767 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kong570ab492019-04-22 23:13:17 -0700768 "arch-arm/bionic/atomics_arm.c",
769 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800770 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700771 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700772 "arch-arm/bionic/setjmp.S",
773 "arch-arm/bionic/syscall.S",
774 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800775
776 "arch-arm/cortex-a15/bionic/memcpy.S",
777 "arch-arm/cortex-a15/bionic/memmove.S",
778 "arch-arm/cortex-a15/bionic/memset.S",
779 "arch-arm/cortex-a15/bionic/stpcpy.S",
780 "arch-arm/cortex-a15/bionic/strcat.S",
781 "arch-arm/cortex-a15/bionic/strcmp.S",
782 "arch-arm/cortex-a15/bionic/strcpy.S",
783 "arch-arm/cortex-a15/bionic/strlen.S",
784
785 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800786 "arch-arm/cortex-a7/bionic/memset.S",
787
788 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800789 "arch-arm/cortex-a9/bionic/memset.S",
790 "arch-arm/cortex-a9/bionic/stpcpy.S",
791 "arch-arm/cortex-a9/bionic/strcat.S",
792 "arch-arm/cortex-a9/bionic/strcmp.S",
793 "arch-arm/cortex-a9/bionic/strcpy.S",
794 "arch-arm/cortex-a9/bionic/strlen.S",
795
796 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800797 "arch-arm/krait/bionic/memset.S",
798 "arch-arm/krait/bionic/strcmp.S",
799
800 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800801
Haibo Huang01bfd892018-12-03 15:05:16 -0800802 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800803
804 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700805 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700806 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700807 arm64: {
808 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700809 "arch-arm64/generic/bionic/memchr.S",
810 "arch-arm64/generic/bionic/memcmp.S",
811 "arch-arm64/generic/bionic/memcpy.S",
812 "arch-arm64/generic/bionic/memmove.S",
813 "arch-arm64/generic/bionic/memset.S",
814 "arch-arm64/generic/bionic/stpcpy.S",
815 "arch-arm64/generic/bionic/strchr.S",
816 "arch-arm64/generic/bionic/strcmp.S",
817 "arch-arm64/generic/bionic/strcpy.S",
818 "arch-arm64/generic/bionic/strlen.S",
819 "arch-arm64/generic/bionic/strncmp.S",
820 "arch-arm64/generic/bionic/strnlen.S",
821 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800822
823 "arch-arm64/bionic/__bionic_clone.S",
824 "arch-arm64/bionic/_exit_with_stack_teardown.S",
825 "arch-arm64/bionic/setjmp.S",
826 "arch-arm64/bionic/syscall.S",
827 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700828 ],
829 exclude_srcs: [
830 "bionic/__memcpy_chk.cpp",
831 "bionic/strchr.cpp",
832 "bionic/strnlen.c",
833 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700834 },
835
836 mips: {
837 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800838 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530839 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800840 "arch-mips/string/memset.S",
841 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530842 "arch-mips/string/strncmp.S",
843 "arch-mips/string/strlen.c",
844 "arch-mips/string/strnlen.c",
845 "arch-mips/string/strchr.c",
846 "arch-mips/string/strcpy.c",
847 "arch-mips/string/memchr.c",
848 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800849
Dan Willemsen208ae172015-09-16 16:33:27 -0700850 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700851 "arch-mips/bionic/cacheflush.cpp",
852 "arch-mips/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800853 "arch-mips/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700854 "arch-mips/bionic/setjmp.S",
855 "arch-mips/bionic/syscall.S",
856 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700857 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530858 exclude_srcs: [
859 "bionic/strchr.cpp",
860 "bionic/strnlen.c",
861 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700862 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700863 mips64: {
864 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800865 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530866 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800867 "arch-mips/string/memset.S",
868 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530869 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800870 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530871 "arch-mips/string/strnlen.c",
872 "arch-mips/string/strchr.c",
873 "arch-mips/string/strcpy.c",
874 "arch-mips/string/memchr.c",
875 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800876
Dan Willemsen208ae172015-09-16 16:33:27 -0700877 "arch-mips64/bionic/__bionic_clone.S",
878 "arch-mips64/bionic/_exit_with_stack_teardown.S",
879 "arch-mips64/bionic/setjmp.S",
880 "arch-mips64/bionic/syscall.S",
881 "arch-mips64/bionic/vfork.S",
882 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700883 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530884 exclude_srcs: [
885 "bionic/strchr.cpp",
886 "bionic/strnlen.c",
887 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700888 },
889
890 x86: {
891 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700892 "arch-x86/generic/string/memcmp.S",
893 "arch-x86/generic/string/strcmp.S",
894 "arch-x86/generic/string/strncmp.S",
895 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700896
897 "arch-x86/generic/string/strlcat.c",
898 "arch-x86/generic/string/strlcpy.c",
899 "arch-x86/generic/string/strncat.c",
900 "arch-x86/generic/string/wcscat.c",
901 "arch-x86/generic/string/wcscpy.c",
902 "arch-x86/generic/string/wmemcmp.c",
903
Dan Willemsen208ae172015-09-16 16:33:27 -0700904 "arch-x86/atom/string/sse2-memchr-atom.S",
905 "arch-x86/atom/string/sse2-memrchr-atom.S",
906 "arch-x86/atom/string/sse2-strchr-atom.S",
907 "arch-x86/atom/string/sse2-strnlen-atom.S",
908 "arch-x86/atom/string/sse2-strrchr-atom.S",
909 "arch-x86/atom/string/sse2-wcschr-atom.S",
910 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
911 "arch-x86/atom/string/sse2-wcslen-atom.S",
912 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700913 "arch-x86/silvermont/string/sse2-memmove-slm.S",
914 "arch-x86/silvermont/string/sse2-memset-slm.S",
915 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
916 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
917 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
918 "arch-x86/silvermont/string/sse2-strlen-slm.S",
919 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800920
921 "arch-x86/bionic/__bionic_clone.S",
922 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800923 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800924 "arch-x86/bionic/__restore.S",
925 "arch-x86/bionic/setjmp.S",
926 "arch-x86/bionic/syscall.S",
927 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700928
929 // ssse3 functions
930 "arch-x86/atom/string/ssse3-strcat-atom.S",
931 "arch-x86/atom/string/ssse3-strcmp-atom.S",
932 "arch-x86/atom/string/ssse3-strlcat-atom.S",
933 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
934 "arch-x86/atom/string/ssse3-strncat-atom.S",
935 "arch-x86/atom/string/ssse3-strncmp-atom.S",
936 "arch-x86/atom/string/ssse3-wcscat-atom.S",
937 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
938
939 // sse4 functions
940 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
941 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
942
943 // atom functions
944 "arch-x86/atom/string/sse2-memset-atom.S",
945 "arch-x86/atom/string/sse2-strlen-atom.S",
946 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800947 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700948 "arch-x86/atom/string/ssse3-strcpy-atom.S",
949 "arch-x86/atom/string/ssse3-strncpy-atom.S",
950 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700951 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700952
953 exclude_srcs: [
954 "bionic/strchr.cpp",
955 "bionic/strnlen.c",
956 "bionic/strrchr.cpp",
957 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700958 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700959 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700960 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700961 "arch-x86_64/string/sse2-memmove-slm.S",
962 "arch-x86_64/string/sse2-memset-slm.S",
963 "arch-x86_64/string/sse2-stpcpy-slm.S",
964 "arch-x86_64/string/sse2-stpncpy-slm.S",
965 "arch-x86_64/string/sse2-strcat-slm.S",
966 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700967 "arch-x86_64/string/sse2-strlen-slm.S",
968 "arch-x86_64/string/sse2-strncat-slm.S",
969 "arch-x86_64/string/sse2-strncpy-slm.S",
970 "arch-x86_64/string/sse4-memcmp-slm.S",
971 "arch-x86_64/string/ssse3-strcmp-slm.S",
972 "arch-x86_64/string/ssse3-strncmp-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800973
974 "arch-x86_64/bionic/__bionic_clone.S",
975 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
976 "arch-x86_64/bionic/__restore_rt.S",
977 "arch-x86_64/bionic/setjmp.S",
978 "arch-x86_64/bionic/syscall.S",
979 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700980 ],
981 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700982 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700983
Colin Cross50c21ab2015-10-31 23:03:05 -0700984 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700985 include_dirs: ["bionic/libstdc++/include"],
986 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700987}
988
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000989genrule {
990 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -0800991 out: ["generated_android_ids.h"],
992 srcs: [":android_filesystem_config_header"],
993 tool_files: ["fs_config_generator.py"],
994 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000995}
996
Dan Willemsen268a6732015-10-15 14:49:45 -0700997// ========================================================
998// libc_bionic_ndk.a- The portions of libc_bionic that can
999// be safely used in libc_ndk.a (no troublesome global data
1000// or constructors).
1001// ========================================================
1002cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001003 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001004 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001005 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001006 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001007 "bionic/__cmsg_nxthdr.cpp",
1008 "bionic/__errno.cpp",
1009 "bionic/__gnu_basename.cpp",
1010 "bionic/__libc_current_sigrtmax.cpp",
1011 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001012 "bionic/abort.cpp",
1013 "bionic/accept.cpp",
1014 "bionic/accept4.cpp",
1015 "bionic/access.cpp",
1016 "bionic/arpa_inet.cpp",
1017 "bionic/assert.cpp",
1018 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001019 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001020 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001021 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001022 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001023 "bionic/bionic_systrace.cpp",
1024 "bionic/bionic_time_conversions.cpp",
1025 "bionic/brk.cpp",
1026 "bionic/c16rtomb.cpp",
1027 "bionic/c32rtomb.cpp",
1028 "bionic/chmod.cpp",
1029 "bionic/chown.cpp",
1030 "bionic/clearenv.cpp",
1031 "bionic/clock.cpp",
1032 "bionic/clock_getcpuclockid.cpp",
1033 "bionic/clock_nanosleep.cpp",
1034 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001035 "bionic/connect.cpp",
1036 "bionic/ctype.cpp",
1037 "bionic/dirent.cpp",
1038 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001039 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001040 "bionic/error.cpp",
1041 "bionic/eventfd_read.cpp",
1042 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001043 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001044 "bionic/faccessat.cpp",
1045 "bionic/fchmod.cpp",
1046 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001047 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001048 "bionic/ffs.cpp",
1049 "bionic/fgetxattr.cpp",
1050 "bionic/flistxattr.cpp",
1051 "bionic/flockfile.cpp",
1052 "bionic/fpclassify.cpp",
1053 "bionic/fsetxattr.cpp",
1054 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001055 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001056 "bionic/futimens.cpp",
1057 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001058 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001059 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001060 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001061 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001062 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001063 "bionic/getpgrp.cpp",
1064 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001065 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001066 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001067 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001068 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001069 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001070 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001071 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001072 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001073 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001074 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001075 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001076 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001077 "bionic/lchown.cpp",
1078 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001079 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001080 "bionic/libgen.cpp",
1081 "bionic/link.cpp",
1082 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001083 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001084 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001085 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001086 "bionic/mbrtoc16.cpp",
1087 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001088 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001089 "bionic/mempcpy.cpp",
1090 "bionic/mkdir.cpp",
1091 "bionic/mkfifo.cpp",
1092 "bionic/mknod.cpp",
1093 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001094 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001095 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001096 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001097 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001098 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001099 "bionic/open.cpp",
1100 "bionic/pathconf.cpp",
1101 "bionic/pause.cpp",
1102 "bionic/pipe.cpp",
1103 "bionic/poll.cpp",
1104 "bionic/posix_fadvise.cpp",
1105 "bionic/posix_fallocate.cpp",
1106 "bionic/posix_madvise.cpp",
1107 "bionic/posix_timers.cpp",
1108 "bionic/ptrace.cpp",
1109 "bionic/pty.cpp",
1110 "bionic/raise.cpp",
1111 "bionic/rand.cpp",
1112 "bionic/readlink.cpp",
1113 "bionic/reboot.cpp",
1114 "bionic/recv.cpp",
1115 "bionic/rename.cpp",
1116 "bionic/rmdir.cpp",
1117 "bionic/scandir.cpp",
1118 "bionic/sched_getaffinity.cpp",
1119 "bionic/sched_getcpu.cpp",
1120 "bionic/semaphore.cpp",
1121 "bionic/send.cpp",
1122 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001123 "bionic/seteuid.cpp",
1124 "bionic/setpgrp.cpp",
1125 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001126 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001127 "bionic/sigprocmask.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001128 "bionic/socket.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001129 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001130 "bionic/stat.cpp",
1131 "bionic/statvfs.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001132 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001133 "bionic/strchrnul.cpp",
1134 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001135 "bionic/string_l.cpp",
1136 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001137 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001138 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001139 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001140 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001141 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001142 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001143 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001144 "bionic/sys_msg.cpp",
1145 "bionic/sys_sem.cpp",
1146 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001147 "bionic/sys_signalfd.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001148 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001149 "bionic/sysinfo.cpp",
1150 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001151 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001152 "bionic/system_property_api.cpp",
1153 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001154 "bionic/tdestroy.cpp",
1155 "bionic/termios.cpp",
1156 "bionic/thread_private.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001157 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001158 "bionic/tmpfile.cpp",
1159 "bionic/umount.cpp",
1160 "bionic/unlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001161 "bionic/wait.cpp",
1162 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001163 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001164 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001165 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001166 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001167 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001168
1169 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1170 // which will be overridden by the actual one in libc.so.
1171 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001172 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001173
Dan Willemsen208ae172015-09-16 16:33:27 -07001174 multilib: {
1175 lib32: {
1176 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001177 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001178 },
1179 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001180 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001181 treble_linker_namespaces: {
1182 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001183 },
1184 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001185 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001186 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001187 local_include_dirs: ["stdio"],
1188 include_dirs: ["bionic/libstdc++/include"],
1189 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001190 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001191}
1192
Dan Willemsen208ae172015-09-16 16:33:27 -07001193// ========================================================
1194// libc_pthread.a - pthreads parts that previously lived in
1195// libc_bionic.a. Relocated to their own library because
1196// they can't be included in libc_ndk.a (as they layout of
1197// pthread_t has changed over the years and has ABI
1198// compatibility issues).
1199// ========================================================
1200
1201cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001202 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001203 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001204 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001205 "bionic/pthread_atfork.cpp",
1206 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001207 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001208 "bionic/pthread_cond.cpp",
1209 "bionic/pthread_create.cpp",
1210 "bionic/pthread_detach.cpp",
1211 "bionic/pthread_equal.cpp",
1212 "bionic/pthread_exit.cpp",
1213 "bionic/pthread_getcpuclockid.cpp",
1214 "bionic/pthread_getschedparam.cpp",
1215 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001216 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001217 "bionic/pthread_join.cpp",
1218 "bionic/pthread_key.cpp",
1219 "bionic/pthread_kill.cpp",
1220 "bionic/pthread_mutex.cpp",
1221 "bionic/pthread_once.cpp",
1222 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001223 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001224 "bionic/pthread_self.cpp",
1225 "bionic/pthread_setname_np.cpp",
1226 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001227 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001228
1229 // The following implementations depend on pthread data or implementation,
1230 // so we can't include them in libc_ndk.a.
1231 "bionic/__cxa_thread_atexit_impl.cpp",
1232 "stdlib/atexit.c",
1233 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001234 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001235
Colin Cross50c21ab2015-10-31 23:03:05 -07001236 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001237 include_dirs: ["bionic/libstdc++/include"],
1238 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001239}
1240
1241// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001242// libc_syscalls.a
1243// ========================================================
1244
1245cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001246 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001247 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001248 arch: {
1249 arm: {
1250 srcs: ["arch-arm/syscalls/**/*.S"],
1251 },
1252 arm64: {
1253 srcs: ["arch-arm64/syscalls/**/*.S"],
1254 },
1255 mips: {
1256 srcs: ["arch-mips/syscalls/**/*.S"],
1257 },
1258 mips64: {
1259 srcs: ["arch-mips64/syscalls/**/*.S"],
1260 },
1261 x86: {
1262 srcs: ["arch-x86/syscalls/**/*.S"],
1263 },
1264 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001265 srcs: ["arch-x86_64/syscalls/**/*.S"],
1266 },
1267 },
1268 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001269}
1270
1271// ========================================================
1272// libc_aeabi.a
1273// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1274// to avoid infinite recursion. For the other architectures we just build an
1275// empty library to keep this makefile simple.
1276// ========================================================
1277
1278cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001279 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001280 arch: {
1281 arm: {
1282 srcs: ["arch-arm/bionic/__aeabi.c"],
1283 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001284 },
1285 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001286 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001287}
1288
1289// ========================================================
1290// libc_ndk.a
1291// Compatibility library for the NDK. This library contains
1292// all the parts of libc that are safe to statically link.
1293// We can't safely statically link things that can only run
1294// on a certain version of the OS. Examples include
1295// anything that talks to netd (a large portion of the DNS
1296// code) and anything that is dependent on the layout of a
1297// data structure that has changed across releases (such as
1298// pthread_t).
1299// ========================================================
1300
1301cc_library_static {
1302 name: "libc_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001303 defaults: ["libc_defaults"],
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001304 srcs: libc_common_src_files + [
1305 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001306 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001307 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001308 multilib: {
1309 lib32: {
1310 srcs: libc_common_src_files_32,
1311 },
1312 },
1313 arch: {
1314 arm: {
1315 srcs: [
1316 "arch-arm/bionic/exidx_dynamic.c",
1317 "arch-common/bionic/crtbegin_so.c",
1318 "arch-arm/bionic/atexit_legacy.c",
1319 "arch-common/bionic/crtend_so.S",
1320 ],
1321 whole_static_libs: ["libc_aeabi"],
1322 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001323 },
1324
Colin Cross50c21ab2015-10-31 23:03:05 -07001325 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001326 "-fvisibility=hidden",
1327 "-DLIBC_STATIC",
1328 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001329
1330 whole_static_libs: [
1331 "libc_bionic_ndk",
George Burgess IV6cb06872017-07-21 13:28:42 -07001332 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001333 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001334 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001335 "libc_gdtoa",
1336 "libc_malloc",
1337 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001338 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001339 "libc_openbsd_ndk",
1340 "libc_stack_protector",
1341 "libc_syscalls",
1342 "libc_tzcode",
1343 "libm",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001344 "libjemalloc5",
Elliott Hughes816fab92016-05-27 17:57:46 -07001345 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001346 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001347}
1348
1349// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001350// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001351// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001352cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001353 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001354 srcs: libc_common_src_files,
1355 multilib: {
1356 lib32: {
1357 srcs: libc_common_src_files_32,
1358 },
1359 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001360 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001361
1362 whole_static_libs: [
1363 "libc_bionic",
1364 "libc_bionic_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001365 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001366 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001367 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001368 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001369 "libc_gdtoa",
1370 "libc_malloc",
1371 "libc_netbsd",
1372 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001373 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001374 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001375 "libc_stack_protector",
1376 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001377 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001378 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001379 ],
1380
1381 arch: {
1382 arm: {
1383 whole_static_libs: ["libc_aeabi"],
1384 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001385 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001386}
1387
1388// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001389// libc_common.a
1390// ========================================================
1391
1392cc_library_static {
1393 defaults: ["libc_defaults"],
1394 name: "libc_common",
1395
1396 whole_static_libs: [
1397 "libc_nopthread",
1398 "libc_pthread",
1399 ],
1400}
1401
1402// ========================================================
Haibo Huangf71edfa2018-11-12 10:06:56 -08001403// libc_common_static.a For static binaries.
1404// ========================================================
1405cc_library_static {
1406 defaults: ["libc_defaults"],
1407 name: "libc_common_static",
1408
Haibo Huangb9244ff2018-08-11 10:12:13 -07001409 arch: {
1410 x86: {
1411 srcs: ["arch-x86/static_function_dispatch.S"],
1412 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001413 arm: {
1414 srcs: ["arch-arm/static_function_dispatch.S"],
1415 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001416 },
1417
Haibo Huangf71edfa2018-11-12 10:06:56 -08001418 whole_static_libs: [
1419 "libc_common",
1420 ],
1421}
1422
1423// ========================================================
1424// libc_common_shared.a For shared libraries.
1425// ========================================================
1426cc_library_static {
1427 defaults: ["libc_defaults"],
1428 name: "libc_common_shared",
1429
Haibo Huangb9244ff2018-08-11 10:12:13 -07001430 cflags: [
1431 "-fno-stack-protector",
1432 "-fno-jump-tables",
1433 ],
1434 arch: {
1435 x86: {
1436 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1437 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001438 arm: {
Haibo Huange4788d42018-12-11 20:28:02 -08001439 srcs: [
1440 "arch-arm/dynamic_function_dispatch.cpp",
1441
1442 // Workaround for b/120254692.
1443 "arch-arm/dynamic_function_wrapper.S",
1444 ],
Haibo Huangea9957a2018-11-19 11:00:32 -08001445 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001446 },
1447
Haibo Huangf71edfa2018-11-12 10:06:56 -08001448 whole_static_libs: [
1449 "libc_common",
1450 ],
1451}
1452
1453// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001454// libc_nomalloc.a
1455// ========================================================
1456//
1457// This is a version of the static C library that does not
1458// include malloc. It's useful in situations when the user wants
1459// to provide their own malloc implementation, or wants to
1460// explicitly disallow the use of malloc, such as in the
1461// dynamic linker.
1462
1463cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001464 name: "libc_nomalloc",
1465
Colin Cross50c21ab2015-10-31 23:03:05 -07001466 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001467
1468 arch: {
1469 arm: {
1470 srcs: ["arch-arm/bionic/exidx_static.c"],
1471 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001472 },
1473
Colin Cross50c21ab2015-10-31 23:03:05 -07001474 cflags: ["-DLIBC_STATIC"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001475
Colin Crossa3f9fca2016-01-11 13:20:55 -08001476 whole_static_libs: [
Haibo Huangf71edfa2018-11-12 10:06:56 -08001477 "libc_common_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001478 "libc_init_static",
1479 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001480}
1481
1482// ========================================================
1483// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1484// ========================================================
1485cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001486 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001487 srcs: ["bionic/jemalloc_wrapper.cpp"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001488 cflags: ["-fvisibility=hidden"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001489
Dan Willemsen208ae172015-09-16 16:33:27 -07001490 name: "libc_malloc",
Dan Willemsen208ae172015-09-16 16:33:27 -07001491}
1492
dimitryc0c0ef62018-12-05 16:33:52 +01001493filegroup {
1494 name: "libc_sources_shared",
1495 srcs: [
1496 "arch-common/bionic/crtbegin_so.c",
1497 "arch-common/bionic/crtbrand.S",
1498 "bionic/icu.cpp",
1499 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001500 "bionic/malloc_common_dynamic.cpp",
1501 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001502 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001503 "bionic/NetdClient.cpp",
1504 "arch-common/bionic/crtend_so.S",
1505 ],
1506}
1507
1508filegroup {
1509 name: "libc_sources_static",
1510 srcs: [
1511 "bionic/dl_iterate_phdr_static.cpp",
1512 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001513 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001514 ],
1515}
1516
1517filegroup {
1518 name: "libc_sources_shared_arm",
1519 srcs: [
1520 "arch-arm/bionic/exidx_dynamic.c",
1521 "arch-arm/bionic/atexit_legacy.c",
1522 ],
1523}
1524
1525filegroup {
1526 name: "libc_sources_static_arm",
1527 srcs: [ "arch-arm/bionic/exidx_static.c" ],
1528}
1529
Dan Willemsen208ae172015-09-16 16:33:27 -07001530// ========================================================
1531// libc.a + libc.so
1532// ========================================================
1533cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001534 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001535 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001536 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001537 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001538 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001539 platform_sdk_version: {
1540 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1541 },
1542 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001543 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001544 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001545 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001546 whole_static_libs: [
1547 "libc_init_static",
1548 "libc_common_static",
1549 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001550 },
1551 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001552 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001553 whole_static_libs: [
1554 "libc_init_dynamic",
1555 "libc_common_shared",
1556 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001557 },
1558
Jiyong Park036e09c2019-02-25 10:54:29 +09001559 required: ["tzdata"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001560
1561 // Leave the symbols in the shared library so that stack unwinders can produce
1562 // meaningful name resolution.
Colin Cross37f36322016-04-25 14:09:13 -07001563 strip: {
1564 keep_symbols: true,
1565 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001566
Colin Cross4ce94d22016-11-15 13:15:43 -08001567 // Do not pack libc.so relocations; see http://b/20645321 for details.
1568 pack_relocations: false,
1569
dimitry06016f22018-01-05 11:39:28 +01001570 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1571 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1572 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1573 // those new libraries from libgcc.a are not declared external; if that were the case,
1574 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1575 // on the external symbols from the dependent libraries. That would create a "cloaked"
1576 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001577
dimitry06016f22018-01-05 11:39:28 +01001578 shared_libs: [
1579 "ld-android",
1580 "libdl",
1581 ],
Jiyong Park4e46ac62019-04-02 23:04:52 +09001582 static_libs: [
1583 "libdl_android",
1584 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001585 whole_static_libs: [
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001586 "libjemalloc5",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001587 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001588
1589 nocrt: true,
1590
Dan Willemsen208ae172015-09-16 16:33:27 -07001591 arch: {
1592 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001593 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001594 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001595 ldflags: ["-Wl,--hash-style=both"],
1596
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001597 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001598
Dan Willemsen208ae172015-09-16 16:33:27 -07001599 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001600 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001601 // special for arm
1602 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001603 },
1604 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001605 srcs: [":libc_sources_static_arm"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001606 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001607 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001608 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001609 version_script: ":libc.arm64.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001610 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001611 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001612 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001613 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001614 ldflags: ["-Wl,--hash-style=both"],
1615
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001616 version_script: ":libc.x86.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001617 },
1618 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001619 version_script: ":libc.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001620 },
1621 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001622
1623 stubs: {
1624 symbol_file: "libc.map.txt",
1625 versions: ["10000"],
1626 },
Vic Yang6903fb82019-01-14 11:34:39 -08001627
1628 symbol_ordering_file: "symbol_ordering",
Dan Willemsen208ae172015-09-16 16:33:27 -07001629}
1630
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001631genrule {
1632 name: "libc.arm.map",
1633 out: ["libc.arm.map"],
1634 srcs: ["libc.map.txt"],
1635 tool_files: [":bionic-generate-version-script"],
1636 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1637}
1638
1639genrule {
1640 name: "libc.arm64.map",
1641 out: ["libc.arm64.map"],
1642 srcs: ["libc.map.txt"],
1643 tool_files: [":bionic-generate-version-script"],
1644 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1645}
1646
1647genrule {
1648 name: "libc.x86.map",
1649 out: ["libc.x86.map"],
1650 srcs: ["libc.map.txt"],
1651 tool_files: [":bionic-generate-version-script"],
1652 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1653}
1654
1655genrule {
1656 name: "libc.x86_64.map",
1657 out: ["libc.x86_64.map"],
1658 srcs: ["libc.map.txt"],
1659 tool_files: [":bionic-generate-version-script"],
1660 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1661}
1662
Logan Chien17af91b2019-01-15 21:19:56 +08001663// libc_headers for libasync_safe and libpropertyinfoparser
1664cc_library_headers {
1665 name: "libc_headers",
1666
1667 host_supported: true,
1668 vendor_available: true,
1669 recovery_available: true,
1670
1671 no_libcrt: true,
1672 no_libgcc: true,
1673 stl: "none",
1674 system_shared_libs: [],
1675
1676 export_include_dirs: [
1677 "include",
1678 "kernel/uapi",
1679 "kernel/android/uapi",
1680 ],
1681
1682 arch: {
1683 arm: {
1684 export_include_dirs: [
1685 "kernel/uapi/asm-arm",
1686 ],
1687 },
1688 arm64: {
1689 export_include_dirs: [
1690 "kernel/uapi/asm-arm64",
1691 ],
1692 },
1693 mips: {
1694 export_include_dirs: [
1695 "kernel/uapi/asm-mips",
1696 ],
1697 },
1698 mips64: {
1699 export_include_dirs: [
1700 "kernel/uapi/asm-mips",
1701 ],
1702 },
1703 x86: {
1704 export_include_dirs: [
1705 "kernel/uapi/asm-x86",
1706 ],
1707 },
1708 x86_64: {
1709 export_include_dirs: [
1710 "kernel/uapi/asm-x86",
1711 ],
1712 },
1713 },
1714}
1715
Dan Willemsen208ae172015-09-16 16:33:27 -07001716// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001717// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001718// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001719
Dan Willemsen208ae172015-09-16 16:33:27 -07001720cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001721 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001722 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001723 srcs: [
1724 "bionic/__cxa_guard.cpp",
1725 "bionic/__cxa_pure_virtual.cpp",
1726 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001727 ],
1728 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001729 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001730 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001731
Dan Willemsen6b3be172018-12-03 13:57:20 -08001732 static: {
1733 system_shared_libs: [],
1734 },
1735 shared: {
1736 system_shared_libs: ["libc"],
1737 },
1738
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001739 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001740 arch: {
1741 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001742 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001743 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001744 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001745 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001746 },
1747 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001748 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001749 },
1750 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001751 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001752 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001753 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001754 },
1755 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001756 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001757 },
1758 },
1759}
1760
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001761genrule {
1762 name: "libstdc++.arm.map",
1763 out: ["libstdc++.arm.map"],
1764 srcs: ["libstdc++.map.txt"],
1765 tool_files: [":bionic-generate-version-script"],
1766 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1767}
1768
1769genrule {
1770 name: "libstdc++.arm64.map",
1771 out: ["libstdc++.arm64.map"],
1772 srcs: ["libstdc++.map.txt"],
1773 tool_files: [":bionic-generate-version-script"],
1774 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1775}
1776
1777genrule {
1778 name: "libstdc++.x86.map",
1779 out: ["libstdc++.x86.map"],
1780 srcs: ["libstdc++.map.txt"],
1781 tool_files: [":bionic-generate-version-script"],
1782 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1783}
1784
1785genrule {
1786 name: "libstdc++.x86_64.map",
1787 out: ["libstdc++.x86_64.map"],
1788 srcs: ["libstdc++.map.txt"],
1789 tool_files: [":bionic-generate-version-script"],
1790 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1791}
1792
1793// ========================================================
1794// crt object files.
1795// ========================================================
1796
Colin Cross50c21ab2015-10-31 23:03:05 -07001797cc_defaults {
1798 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001799 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001800 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001801 recovery_available: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001802
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001803 cflags: [
1804 "-Wno-gcc-compat",
1805 "-Wall",
1806 "-Werror",
1807 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001808}
1809
Colin Cross50c21ab2015-10-31 23:03:05 -07001810cc_defaults {
1811 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001812 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001813
1814 arch: {
1815 mips: {
1816 cflags: ["-fPIC"],
1817 },
1818 mips64: {
1819 cflags: ["-fPIC"],
1820 },
1821 x86: {
1822 cflags: ["-fPIC"],
1823 },
1824 x86_64: {
1825 cflags: ["-fPIC"],
1826 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001827 },
Colin Crossab179442018-09-27 11:03:22 -07001828 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001829}
1830
Dan Willemsen208ae172015-09-16 16:33:27 -07001831cc_object {
1832 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001833 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001834 local_include_dirs: ["include"],
1835 product_variables: {
1836 platform_sdk_version: {
1837 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1838 },
1839 },
1840 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001841
Colin Cross7d7b3682017-11-03 13:38:40 -07001842 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001843}
1844
Dan Willemsen208ae172015-09-16 16:33:27 -07001845cc_object {
1846 name: "crtbegin_so1",
1847 local_include_dirs: ["include"],
1848 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001849
Colin Cross7d7b3682017-11-03 13:38:40 -07001850 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001851}
1852
Dan Willemsen208ae172015-09-16 16:33:27 -07001853cc_object {
1854 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07001855
Colin Cross7d7b3682017-11-03 13:38:40 -07001856 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07001857 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001858 "crtbegin_so1",
1859 "crtbrand",
1860 ],
1861}
1862
Dan Willemsen208ae172015-09-16 16:33:27 -07001863cc_object {
1864 name: "crtend_so",
1865 local_include_dirs: ["include"],
1866 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001867
Colin Cross7d7b3682017-11-03 13:38:40 -07001868 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001869}
1870
Dan Willemsen208ae172015-09-16 16:33:27 -07001871cc_object {
1872 name: "crtbegin_static1",
1873 local_include_dirs: ["include"],
1874 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001875
Colin Cross50c21ab2015-10-31 23:03:05 -07001876 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001877 mips: {
1878 srcs: [
1879 "arch-mips/bionic/crtbegin.c",
1880 ],
1881 exclude_srcs: [
1882 "arch-common/bionic/crtbegin.c",
1883 ],
1884 },
1885 mips64: {
1886 srcs: [
1887 "arch-mips64/bionic/crtbegin.c",
1888 ],
1889 exclude_srcs: [
1890 "arch-common/bionic/crtbegin.c",
1891 ],
1892 },
1893 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001894
1895 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001896}
1897
Dan Willemsen208ae172015-09-16 16:33:27 -07001898cc_object {
1899 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07001900
Colin Cross77d57bf2016-04-11 14:34:18 -07001901 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001902 "crtbegin_static1",
1903 "crtbrand",
1904 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001905 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001906}
1907
Dan Willemsen208ae172015-09-16 16:33:27 -07001908cc_object {
1909 name: "crtbegin_dynamic1",
1910 local_include_dirs: ["include"],
1911 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001912
Colin Cross50c21ab2015-10-31 23:03:05 -07001913 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001914 mips: {
1915 srcs: [
1916 "arch-mips/bionic/crtbegin.c",
1917 ],
1918 exclude_srcs: [
1919 "arch-common/bionic/crtbegin.c",
1920 ],
1921 },
1922 mips64: {
1923 srcs: [
1924 "arch-mips64/bionic/crtbegin.c",
1925 ],
1926 exclude_srcs: [
1927 "arch-common/bionic/crtbegin.c",
1928 ],
1929 },
1930 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001931 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001932}
1933
Dan Willemsen208ae172015-09-16 16:33:27 -07001934cc_object {
1935 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07001936
Colin Cross77d57bf2016-04-11 14:34:18 -07001937 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001938 "crtbegin_dynamic1",
1939 "crtbrand",
1940 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07001941 target: {
1942 linux_bionic: {
1943 generated_sources: ["host_bionic_linker_asm"],
1944 objs: [
1945 "linker_wrapper",
1946 ],
1947 },
1948 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001949 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001950}
1951
Dan Willemsen208ae172015-09-16 16:33:27 -07001952cc_object {
1953 // We rename crtend.o to crtend_android.o to avoid a
1954 // name clash between gcc and bionic.
1955 name: "crtend_android",
1956 local_include_dirs: ["include"],
1957 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001958
Colin Cross50c21ab2015-10-31 23:03:05 -07001959 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001960}
Colin Crossbaa48992016-07-13 11:15:21 -07001961
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001962// ========================================================
1963// NDK headers.
1964// ========================================================
1965
Dan Albert26e1c412018-05-24 14:56:46 -07001966versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07001967 name: "common_libc",
1968 from: "include",
1969 to: "",
1970 license: "NOTICE",
1971}
Dan Albert4238a352016-06-28 11:18:05 -07001972
1973ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08001974 name: "libc_uapi",
1975 from: "kernel/uapi",
1976 to: "",
1977 srcs: [
1978 "kernel/uapi/asm-generic/**/*.h",
1979 "kernel/uapi/drm/**/*.h",
1980 "kernel/uapi/linux/**/*.h",
1981 "kernel/uapi/misc/**/*.h",
1982 "kernel/uapi/mtd/**/*.h",
1983 "kernel/uapi/rdma/**/*.h",
1984 "kernel/uapi/scsi/**/*.h",
1985 "kernel/uapi/sound/**/*.h",
1986 "kernel/uapi/video/**/*.h",
1987 "kernel/uapi/xen/**/*.h",
1988 ],
Dan Albert92592652016-10-20 01:42:54 -07001989 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07001990}
1991
1992ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07001993 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07001994 from: "kernel/android/uapi/linux",
1995 to: "linux",
1996 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07001997 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07001998}
1999
2000ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002001 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002002 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002003 to: "scsi",
2004 srcs: ["kernel/android/scsi/**/*.h"],
2005 license: "NOTICE",
2006}
2007
2008ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002009 name: "libc_asm_arm",
2010 from: "kernel/uapi/asm-arm",
2011 to: "arm-linux-androideabi",
2012 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002013 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002014}
2015
2016ndk_headers {
2017 name: "libc_asm_arm64",
2018 from: "kernel/uapi/asm-arm64",
2019 to: "aarch64-linux-android",
2020 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002021 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002022}
2023
Elliott Hughesee291c02017-12-11 11:32:34 -08002024// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002025ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002026 name: "libc_asm_mips",
2027 from: "kernel/uapi/asm-mips",
2028 to: "mipsel-linux-android",
2029 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2030 license: "NOTICE",
2031}
2032
Elliott Hughesee291c02017-12-11 11:32:34 -08002033// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002034ndk_headers {
2035 name: "libc_asm_mips64",
2036 from: "kernel/uapi/asm-mips",
2037 to: "mips64el-linux-android",
2038 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2039 license: "NOTICE",
2040}
2041
2042ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002043 name: "libc_asm_x86",
2044 from: "kernel/uapi/asm-x86",
2045 to: "i686-linux-android",
2046 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002047 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002048}
2049
2050ndk_headers {
2051 name: "libc_asm_x86_64",
2052 from: "kernel/uapi/asm-x86",
2053 to: "x86_64-linux-android",
2054 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002055 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002056}
2057
Dan Albert4238a352016-06-28 11:18:05 -07002058ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002059 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002060 symbol_file: "libc.map.txt",
2061 first_version: "9",
2062}
2063
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002064llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002065 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002066 symbol_file: "libc.map.txt",
2067 export_headers_as_system: true,
2068 export_preprocessed_headers: ["include"],
Logan Chien17af91b2019-01-15 21:19:56 +08002069 export_include_dirs: [
2070 "kernel/android/uapi",
2071 "kernel/uapi",
2072 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002073 arch: {
2074 arm: {
2075 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002076 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002077 ],
2078 },
2079 arm64: {
2080 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002081 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002082 ],
2083 },
2084 mips: {
2085 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002086 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002087 ],
2088 },
2089 mips64: {
2090 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002091 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002092 ],
2093 },
2094 x86: {
2095 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002096 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002097 ],
2098 },
2099 x86_64: {
2100 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002101 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002102 ],
2103 },
2104 },
2105}
2106
Dan Albertdf31aff2016-10-06 15:50:41 -07002107ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002108 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002109 symbol_file: "libstdc++.map.txt",
2110 first_version: "9",
2111}
2112
Dan Willemsenca056d72018-01-08 14:00:24 -08002113// Export these headers for toolbox to process
2114filegroup {
2115 name: "kernel_input_headers",
2116 srcs: [
2117 "kernel/uapi/linux/input.h",
2118 "kernel/uapi/linux/input-event-codes.h",
2119 ],
2120}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002121
2122// Generate a syscall name / number mapping. These objects are text files
2123// (thanks to the -dD -E flags) and not binary files. They will then be
2124// consumed by the genseccomp.py script and converted into C++ code.
2125cc_defaults {
2126 name: "libseccomp_gen_syscall_nrs_defaults",
2127 recovery_available: true,
2128 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2129 cflags: [
2130 "-dD",
2131 "-E",
2132 "-Wall",
2133 "-Werror",
2134 "-nostdinc",
2135 ],
2136}
2137
2138cc_object {
2139 name: "libseccomp_gen_syscall_nrs_arm",
2140 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2141 local_include_dirs: [
2142 "kernel/uapi/asm-arm",
2143 "kernel/uapi",
2144 ],
2145}
2146
2147cc_object {
2148 name: "libseccomp_gen_syscall_nrs_arm64",
2149 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2150 local_include_dirs: [
2151 "kernel/uapi/asm-arm64",
2152 "kernel/uapi",
2153 ],
2154}
2155
2156cc_object {
2157 name: "libseccomp_gen_syscall_nrs_x86",
2158 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2159 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2160 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2161 local_include_dirs: [
2162 "kernel/uapi/asm-x86",
2163 "kernel/uapi",
2164 ],
2165}
2166
2167cc_object {
2168 name: "libseccomp_gen_syscall_nrs_x86_64",
2169 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2170 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2171 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2172 local_include_dirs: [
2173 "kernel/uapi/asm-x86",
2174 "kernel/uapi",
2175 ],
2176}
2177
2178cc_object {
2179 name: "libseccomp_gen_syscall_nrs_mips",
2180 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2181 cflags: [
2182 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2183 ],
2184 local_include_dirs: [
2185 "kernel/uapi/asm-mips",
2186 "kernel/uapi",
2187 ],
2188}
2189
2190cc_object {
2191 name: "libseccomp_gen_syscall_nrs_mips64",
2192 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2193 cflags: [
2194 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2195 ],
2196 local_include_dirs: [
2197 "kernel/uapi/asm-mips",
2198 "kernel/uapi",
2199 ],
2200}
2201
2202// Generate the C++ policy sources for app, system, and global seccomp-bpf
2203// filters.
2204python_binary_host {
2205 name: "genseccomp",
2206 main: "tools/genseccomp.py",
2207
2208 srcs: [
2209 "tools/genseccomp.py",
2210 "tools/gensyscalls.py",
2211 ],
2212
2213 data: [
2214 "kernel/uapi/**/*.h",
2215 ],
2216
2217 version: {
2218 py2: {
2219 enabled: true,
2220 },
2221 py3: {
2222 enabled: false,
2223 },
2224 },
2225}
2226
Martijn Coenen0c6de752019-01-02 12:52:51 +01002227python_binary_host {
2228 name: "genfunctosyscallnrs",
2229 main: "tools/genfunctosyscallnrs.py",
2230
2231 srcs: [
2232 "tools/genseccomp.py",
2233 "tools/genfunctosyscallnrs.py",
2234 "tools/gensyscalls.py",
2235 ],
2236
2237 data: [
2238 "kernel/uapi/**/*.h",
2239 ],
2240
2241 version: {
2242 py2: {
2243 enabled: true,
2244 },
2245 py3: {
2246 enabled: false,
2247 },
2248 },
2249}
2250
2251cc_genrule {
2252 name: "func_to_syscall_nrs",
2253 recovery_available: true,
2254 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2255
2256 tools: [ "genfunctosyscallnrs" ],
2257
2258 srcs: [
2259 "SYSCALLS.TXT",
2260 ":libseccomp_gen_syscall_nrs_arm",
2261 ":libseccomp_gen_syscall_nrs_arm64",
2262 ":libseccomp_gen_syscall_nrs_mips",
2263 ":libseccomp_gen_syscall_nrs_mips64",
2264 ":libseccomp_gen_syscall_nrs_x86",
2265 ":libseccomp_gen_syscall_nrs_x86_64",
2266 ],
2267
2268 out: [
2269 "func_to_syscall_nrs.h",
2270 ],
2271}
2272
Martijn Coenenc3752be2019-01-09 16:19:57 +01002273// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2274genrule {
2275 name: "generate_app_zygote_blacklist",
2276 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2277 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2278 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2279}
2280
2281cc_genrule {
2282 name: "libseccomp_policy_app_zygote_sources",
2283 recovery_available: true,
2284 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2285
2286 tools: [ "genseccomp" ],
2287
2288 srcs: [
2289 "SYSCALLS.TXT",
2290 "SECCOMP_WHITELIST_COMMON.TXT",
2291 "SECCOMP_WHITELIST_APP.TXT",
2292 "SECCOMP_BLACKLIST_COMMON.TXT",
2293 ":generate_app_zygote_blacklist",
2294 ":libseccomp_gen_syscall_nrs_arm",
2295 ":libseccomp_gen_syscall_nrs_arm64",
2296 ":libseccomp_gen_syscall_nrs_mips",
2297 ":libseccomp_gen_syscall_nrs_mips64",
2298 ":libseccomp_gen_syscall_nrs_x86",
2299 ":libseccomp_gen_syscall_nrs_x86_64",
2300 ],
2301
2302 out: [
2303 "arm64_app_zygote_policy.cpp",
2304 "arm_app_zygote_policy.cpp",
2305 "mips64_app_zygote_policy.cpp",
2306 "mips_app_zygote_policy.cpp",
2307 "x86_64_app_zygote_policy.cpp",
2308 "x86_app_zygote_policy.cpp",
2309 ],
2310}
2311
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002312cc_genrule {
2313 name: "libseccomp_policy_app_sources",
2314 recovery_available: true,
2315 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2316
2317 tools: [ "genseccomp" ],
2318
2319 srcs: [
2320 "SYSCALLS.TXT",
2321 "SECCOMP_WHITELIST_COMMON.TXT",
2322 "SECCOMP_WHITELIST_APP.TXT",
2323 "SECCOMP_BLACKLIST_COMMON.TXT",
2324 "SECCOMP_BLACKLIST_APP.TXT",
2325 ":libseccomp_gen_syscall_nrs_arm",
2326 ":libseccomp_gen_syscall_nrs_arm64",
2327 ":libseccomp_gen_syscall_nrs_mips",
2328 ":libseccomp_gen_syscall_nrs_mips64",
2329 ":libseccomp_gen_syscall_nrs_x86",
2330 ":libseccomp_gen_syscall_nrs_x86_64",
2331 ],
2332
2333 out: [
2334 "arm64_app_policy.cpp",
2335 "arm_app_policy.cpp",
2336 "mips64_app_policy.cpp",
2337 "mips_app_policy.cpp",
2338 "x86_64_app_policy.cpp",
2339 "x86_app_policy.cpp",
2340 ],
2341}
2342
2343cc_genrule {
2344 name: "libseccomp_policy_system_sources",
2345 recovery_available: true,
2346 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2347
2348 tools: [ "genseccomp" ],
2349
2350 srcs: [
2351 "SYSCALLS.TXT",
2352 "SECCOMP_WHITELIST_COMMON.TXT",
2353 "SECCOMP_WHITELIST_SYSTEM.TXT",
2354 "SECCOMP_BLACKLIST_COMMON.TXT",
2355 ":libseccomp_gen_syscall_nrs_arm",
2356 ":libseccomp_gen_syscall_nrs_arm64",
2357 ":libseccomp_gen_syscall_nrs_mips",
2358 ":libseccomp_gen_syscall_nrs_mips64",
2359 ":libseccomp_gen_syscall_nrs_x86",
2360 ":libseccomp_gen_syscall_nrs_x86_64",
2361 ],
2362
2363 out: [
2364 "arm64_system_policy.cpp",
2365 "arm_system_policy.cpp",
2366 "mips64_system_policy.cpp",
2367 "mips_system_policy.cpp",
2368 "x86_64_system_policy.cpp",
2369 "x86_system_policy.cpp",
2370 ],
2371}
2372
2373cc_genrule {
2374 name: "libseccomp_policy_global_sources",
2375 recovery_available: true,
2376 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=global $(in)",
2377
2378 tools: [ "genseccomp" ],
2379
2380 srcs: [
2381 "SYSCALLS.TXT",
2382 "SECCOMP_WHITELIST_COMMON.TXT",
2383 "SECCOMP_WHITELIST_SYSTEM.TXT",
2384 "SECCOMP_WHITELIST_APP.TXT",
2385 "SECCOMP_WHITELIST_GLOBAL.TXT",
2386 "SECCOMP_BLACKLIST_COMMON.TXT",
2387 ":libseccomp_gen_syscall_nrs_arm",
2388 ":libseccomp_gen_syscall_nrs_arm64",
2389 ":libseccomp_gen_syscall_nrs_mips",
2390 ":libseccomp_gen_syscall_nrs_mips64",
2391 ":libseccomp_gen_syscall_nrs_x86",
2392 ":libseccomp_gen_syscall_nrs_x86_64",
2393 ],
2394
2395 out: [
2396 "arm64_global_policy.cpp",
2397 "arm_global_policy.cpp",
2398 "mips64_global_policy.cpp",
2399 "mips_global_policy.cpp",
2400 "x86_64_global_policy.cpp",
2401 "x86_global_policy.cpp",
2402 ],
2403}
2404
2405cc_library {
2406 name: "libseccomp_policy",
2407 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002408 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002409 generated_sources: [
2410 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002411 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002412 "libseccomp_policy_global_sources",
2413 "libseccomp_policy_system_sources",
2414 ],
2415
2416 srcs: [
2417 "seccomp/seccomp_policy.cpp",
2418 ],
2419
2420 export_include_dirs: ["seccomp/include"],
2421 cflags: [
2422 "-Wall",
2423 "-Werror",
2424 ],
2425 shared: {
2426 shared_libs: ["libbase"],
2427 },
2428 static: {
2429 static_libs: ["libbase"],
2430 },
2431}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002432
2433// This is a temporary library that will use scudo as the native memory
2434// allocator. To use it, add it as the first shared library.
2435cc_library_shared {
2436 name: "libc_scudo",
2437 vendor_available: true,
2438 srcs: [
2439 "bionic/malloc_common.cpp",
2440 "bionic/malloc_common_dynamic.cpp",
2441 "bionic/malloc_heapprofd.cpp",
2442 "bionic/malloc_limit.cpp",
2443 "bionic/scudo_wrapper.cpp",
2444 "bionic/__set_errno.cpp",
2445 ],
2446 cflags: ["-DUSE_SCUDO"],
2447 stl: "none",
2448 system_shared_libs: [],
2449
2450 header_libs: ["libc_headers"],
2451
2452 static_libs: ["libasync_safe"],
2453
2454 allow_undefined_symbols: true,
2455 shared_libs: ["libscudo_wrapper"],
2456
2457 arch: {
2458 arm: {
2459 srcs: ["arch-arm/syscalls/__rt_sigprocmask.S"],
2460 },
2461 arm64: {
2462 srcs: ["arch-arm64/syscalls/__rt_sigprocmask.S"],
2463 },
2464 x86: {
2465 srcs: [
2466 "arch-x86/bionic/__libc_init_sysinfo.cpp",
2467 "arch-x86/syscalls/__rt_sigprocmask.S",
2468 ],
2469 },
2470 x86_64: {
2471 srcs: ["arch-x86_64/syscalls/__rt_sigprocmask.S"],
2472 },
2473 },
2474
2475 // Mark this library as global so it overrides all the allocation
2476 // definitions properly.
2477 ldflags: ["-Wl,-z,global"],
2478}
2479
2480subdirs = [
2481 "bionic/scudo",
2482]