blob: 2bce1f550899c4072895332b9c058c695154f603 [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,
Dan Willemsen208ae172015-09-16 16:33:27 -070079}
80
Dan Willemsen208ae172015-09-16 16:33:27 -070081// ANDROIDMK TRANSLATION ERROR: unsupported directive
82// ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
83//libc_common_cflags += ["-DDEBUG"]
84// ANDROIDMK TRANSLATION ERROR: unsupported directive
85// endif
86
Dan Willemsen208ae172015-09-16 16:33:27 -070087// ========================================================
88// libc_stack_protector.a - stack protector code
89// ========================================================
90//
Colin Crossa3f9fca2016-01-11 13:20:55 -080091// Code that implements the stack protector (or that runs
92// before TLS has been set up) needs to be compiled with
93// -fno-stack-protector, since it accesses the stack canary
94// TLS slot.
Dan Willemsen208ae172015-09-16 16:33:27 -070095
96cc_library_static {
97
Colin Crossa3f9fca2016-01-11 13:20:55 -080098 srcs: [
99 "bionic/__libc_init_main_thread.cpp",
100 "bionic/__stack_chk_fail.cpp",
101 ],
102 arch: {
103 arm64: {
104 srcs: ["arch-arm64/bionic/__set_tls.c"],
105 },
106 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700107 srcs: [
108 "arch-x86/bionic/__libc_init_sysinfo.cpp",
109 "arch-x86/bionic/__set_tls.cpp",
110 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800111 },
112 x86_64: {
113 srcs: ["arch-x86_64/bionic/__set_tls.c"],
114 },
115 },
116
Colin Cross50c21ab2015-10-31 23:03:05 -0700117 defaults: ["libc_defaults"],
118 cflags: ["-fno-stack-protector"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700119 name: "libc_stack_protector",
Dan Willemsen208ae172015-09-16 16:33:27 -0700120}
121
Colin Crossa3f9fca2016-01-11 13:20:55 -0800122// libc_init_static.cpp also needs to be built without stack protector,
123// because it's responsible for setting up TLS for static executables.
124// This isn't the case for dynamic executables because the dynamic linker
125// has already set up the main thread's TLS.
126
127cc_library_static {
128 name: "libc_init_static",
129 defaults: ["libc_defaults"],
130 srcs: ["bionic/libc_init_static.cpp"],
131 cflags: ["-fno-stack-protector"],
132}
133
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700134cc_library_static {
135 name: "libc_init_dynamic",
136 defaults: ["libc_defaults"],
137 srcs: ["bionic/libc_init_dynamic.cpp"],
138 cflags: ["-fno-stack-protector"],
139}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800140
Dan Willemsen208ae172015-09-16 16:33:27 -0700141// ========================================================
142// libc_tzcode.a - upstream 'tzcode' code
143// ========================================================
144
145cc_library_static {
146
Colin Cross50c21ab2015-10-31 23:03:05 -0700147 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700148 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800149 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700150 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700151 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
152 ],
153
Colin Cross50c21ab2015-10-31 23:03:05 -0700154 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700155 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700156 // Don't use ridiculous amounts of stack.
157 "-DALL_STATE",
158 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
159 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800160 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700161 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700162 // The name of the tm_gmtoff field in our struct tm.
163 "-DTM_GMTOFF=tm_gmtoff",
164 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700165 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700166 // Include `tzname`, `timezone`, and `daylight` globals.
167 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700168 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800169 // Use the empty string (instead of " ") as the timezone abbreviation
170 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700171 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700172 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
173 "-Dlint",
174 ],
175
Dan Willemsen208ae172015-09-16 16:33:27 -0700176 local_include_dirs: ["tzcode/"],
177 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700178}
179
180// ========================================================
181// libc_dns.a - modified NetBSD DNS code
182// ========================================================
183
184cc_library_static {
185
Colin Cross50c21ab2015-10-31 23:03:05 -0700186 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700187 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800188 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700189
190 "upstream-netbsd/lib/libc/isc/ev_streams.c",
191 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700192 ],
193
Colin Cross50c21ab2015-10-31 23:03:05 -0700194 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700195 "-DANDROID_CHANGES",
196 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700197 "-Wno-unused-parameter",
198 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700199 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700200 ],
201
Dan Willemsen208ae172015-09-16 16:33:27 -0700202 local_include_dirs: [
203 "dns/include",
204 "private",
205 "upstream-netbsd/lib/libc/include",
206 "upstream-netbsd/android/include",
207 ],
208
209 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700210}
211
212// ========================================================
213// libc_freebsd.a - upstream FreeBSD C library code
214// ========================================================
215//
216// These files are built with the freebsd-compat.h header file
217// automatically included.
218
219cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700220 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700221 srcs: [
222 "upstream-freebsd/lib/libc/gen/ldexp.c",
223 "upstream-freebsd/lib/libc/gen/sleep.c",
224 "upstream-freebsd/lib/libc/gen/usleep.c",
225 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700226 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
227 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
228 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
229 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700230 "upstream-freebsd/lib/libc/stdlib/qsort.c",
231 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700232 "upstream-freebsd/lib/libc/string/wcpcpy.c",
233 "upstream-freebsd/lib/libc/string/wcpncpy.c",
234 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700235 "upstream-freebsd/lib/libc/string/wcscat.c",
236 "upstream-freebsd/lib/libc/string/wcschr.c",
237 "upstream-freebsd/lib/libc/string/wcscmp.c",
238 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700239 "upstream-freebsd/lib/libc/string/wcscspn.c",
240 "upstream-freebsd/lib/libc/string/wcsdup.c",
241 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700242 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700243 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
244 "upstream-freebsd/lib/libc/string/wcsncat.c",
245 "upstream-freebsd/lib/libc/string/wcsncmp.c",
246 "upstream-freebsd/lib/libc/string/wcsncpy.c",
247 "upstream-freebsd/lib/libc/string/wcsnlen.c",
248 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700249 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700250 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700251 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700252 "upstream-freebsd/lib/libc/string/wcstok.c",
253 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700254 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700255 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700256 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800257 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700258 ],
259 arch: {
260 arm64: {
261 exclude_srcs: [
262 "upstream-freebsd/lib/libc/string/wmemmove.c",
263 ],
264 },
265 x86: {
266 exclude_srcs: [
267 "upstream-freebsd/lib/libc/string/wcschr.c",
268 "upstream-freebsd/lib/libc/string/wcscmp.c",
269 "upstream-freebsd/lib/libc/string/wcslen.c",
270 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700271 "upstream-freebsd/lib/libc/string/wmemcmp.c",
272 "upstream-freebsd/lib/libc/string/wcscat.c",
273 "upstream-freebsd/lib/libc/string/wcscpy.c",
274 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700275 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700276 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700277 },
278
Colin Cross50c21ab2015-10-31 23:03:05 -0700279 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700280 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700281 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700282 "-include freebsd-compat.h",
283 ],
284
Dan Willemsen208ae172015-09-16 16:33:27 -0700285 local_include_dirs: [
286 "upstream-freebsd/android/include",
287 ],
288
289 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700290}
291
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700292cc_library_static {
293 defaults: ["libc_defaults"],
294 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700295 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700296 "upstream-freebsd/lib/libc/stdlib/realpath.c",
297 ],
298
299 cflags: [
300 "-Wno-sign-compare",
301 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700302 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700303 ],
304
305 local_include_dirs: [
306 "upstream-freebsd/android/include",
307 ],
308
309 name: "libc_freebsd_large_stack",
310}
311
Dan Willemsen208ae172015-09-16 16:33:27 -0700312// ========================================================
313// libc_netbsd.a - upstream NetBSD C library code
314// ========================================================
315//
316// These files are built with the netbsd-compat.h header file
317// automatically included.
318
319cc_library_static {
320
Colin Cross50c21ab2015-10-31 23:03:05 -0700321 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700322 srcs: [
323 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700324 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700325 "upstream-netbsd/lib/libc/gen/psignal.c",
326 "upstream-netbsd/lib/libc/gen/utime.c",
327 "upstream-netbsd/lib/libc/gen/utmp.c",
328 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
329 "upstream-netbsd/lib/libc/regex/regcomp.c",
330 "upstream-netbsd/lib/libc/regex/regerror.c",
331 "upstream-netbsd/lib/libc/regex/regexec.c",
332 "upstream-netbsd/lib/libc/regex/regfree.c",
333 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
334 "upstream-netbsd/lib/libc/stdlib/div.c",
335 "upstream-netbsd/lib/libc/stdlib/drand48.c",
336 "upstream-netbsd/lib/libc/stdlib/erand48.c",
337 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
338 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
339 "upstream-netbsd/lib/libc/stdlib/ldiv.c",
340 "upstream-netbsd/lib/libc/stdlib/lldiv.c",
341 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
342 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
343 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
344 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
345 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
346 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
347 "upstream-netbsd/lib/libc/stdlib/seed48.c",
348 "upstream-netbsd/lib/libc/stdlib/srand48.c",
349 "upstream-netbsd/lib/libc/string/memccpy.c",
350 "upstream-netbsd/lib/libc/string/strcasestr.c",
351 "upstream-netbsd/lib/libc/string/strcoll.c",
352 "upstream-netbsd/lib/libc/string/strxfrm.c",
353 ],
354 multilib: {
355 lib32: {
356 // LP32 cruft
357 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
358 },
359 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700360 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700361 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800362 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700363 "-DPOSIX_MISTAKE",
364 "-include netbsd-compat.h",
365 ],
366
Dan Willemsen208ae172015-09-16 16:33:27 -0700367 local_include_dirs: [
368 "upstream-netbsd/android/include",
369 "upstream-netbsd/lib/libc/include",
370 ],
371
372 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700373}
374
375// ========================================================
376// libc_openbsd_ndk.a - upstream OpenBSD C library code
377// that can be safely included in the libc_ndk.a (doesn't
378// contain any troublesome global data or constructors).
379// ========================================================
380//
381// These files are built with the openbsd-compat.h header file
382// automatically included.
383
384cc_library_static {
385 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700386 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700387 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700388 "upstream-openbsd/lib/libc/gen/alarm.c",
389 "upstream-openbsd/lib/libc/gen/ctype_.c",
390 "upstream-openbsd/lib/libc/gen/daemon.c",
391 "upstream-openbsd/lib/libc/gen/err.c",
392 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700393 "upstream-openbsd/lib/libc/gen/fnmatch.c",
394 "upstream-openbsd/lib/libc/gen/ftok.c",
395 "upstream-openbsd/lib/libc/gen/getprogname.c",
396 "upstream-openbsd/lib/libc/gen/isctype.c",
397 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700398 "upstream-openbsd/lib/libc/gen/tolower_.c",
399 "upstream-openbsd/lib/libc/gen/toupper_.c",
400 "upstream-openbsd/lib/libc/gen/verr.c",
401 "upstream-openbsd/lib/libc/gen/verrx.c",
402 "upstream-openbsd/lib/libc/gen/vwarn.c",
403 "upstream-openbsd/lib/libc/gen/vwarnx.c",
404 "upstream-openbsd/lib/libc/gen/warn.c",
405 "upstream-openbsd/lib/libc/gen/warnx.c",
406 "upstream-openbsd/lib/libc/locale/btowc.c",
407 "upstream-openbsd/lib/libc/locale/mbrlen.c",
408 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
409 "upstream-openbsd/lib/libc/locale/mbtowc.c",
410 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700411 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
412 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700413 "upstream-openbsd/lib/libc/locale/wcstoll.c",
414 "upstream-openbsd/lib/libc/locale/wcstombs.c",
415 "upstream-openbsd/lib/libc/locale/wcstoul.c",
416 "upstream-openbsd/lib/libc/locale/wcstoull.c",
417 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
418 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
419 "upstream-openbsd/lib/libc/locale/wctob.c",
420 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700421 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700422 "upstream-openbsd/lib/libc/net/htonl.c",
423 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700424 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
425 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
426 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700427 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
428 "upstream-openbsd/lib/libc/net/inet_ntop.c",
429 "upstream-openbsd/lib/libc/net/inet_pton.c",
430 "upstream-openbsd/lib/libc/net/ntohl.c",
431 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800432 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700433 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700434 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
435 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700436 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700437 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700438 "upstream-openbsd/lib/libc/stdio/fputwc.c",
439 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700440 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700441 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700442 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700443 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700444 "upstream-openbsd/lib/libc/stdio/makebuf.c",
445 "upstream-openbsd/lib/libc/stdio/mktemp.c",
446 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
447 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700448 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700449 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700450 "upstream-openbsd/lib/libc/stdio/tempnam.c",
451 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
452 "upstream-openbsd/lib/libc/stdio/ungetc.c",
453 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
454 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
455 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700456 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
457 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
458 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700459 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700460 "upstream-openbsd/lib/libc/stdio/wsetup.c",
461 "upstream-openbsd/lib/libc/stdlib/abs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700462 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700463 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700464 "upstream-openbsd/lib/libc/stdlib/insque.c",
465 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
466 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
467 "upstream-openbsd/lib/libc/stdlib/labs.c",
468 "upstream-openbsd/lib/libc/stdlib/llabs.c",
469 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700470 "upstream-openbsd/lib/libc/stdlib/remque.c",
471 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700472 "upstream-openbsd/lib/libc/stdlib/tfind.c",
473 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
474 "upstream-openbsd/lib/libc/string/strcasecmp.c",
475 "upstream-openbsd/lib/libc/string/strcspn.c",
476 "upstream-openbsd/lib/libc/string/strdup.c",
477 "upstream-openbsd/lib/libc/string/strndup.c",
478 "upstream-openbsd/lib/libc/string/strpbrk.c",
479 "upstream-openbsd/lib/libc/string/strsep.c",
480 "upstream-openbsd/lib/libc/string/strspn.c",
481 "upstream-openbsd/lib/libc/string/strstr.c",
482 "upstream-openbsd/lib/libc/string/strtok.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700483 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700484 "upstream-openbsd/lib/libc/string/wcswidth.c",
485 ],
486
Colin Cross50c21ab2015-10-31 23:03:05 -0700487 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700488 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700489 "-Wno-unused-parameter",
490 "-include openbsd-compat.h",
491 ],
492
Dan Willemsen208ae172015-09-16 16:33:27 -0700493 local_include_dirs: [
494 "private",
495 "stdio",
496 "upstream-openbsd/android/include",
497 "upstream-openbsd/lib/libc/include",
498 "upstream-openbsd/lib/libc/gdtoa/",
499 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700500}
501
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700502cc_library_static {
503 name: "libc_openbsd_large_stack",
504 defaults: ["libc_defaults"],
505 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700506 "stdio/vfprintf.cpp",
507 "stdio/vfwprintf.cpp",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700508 ],
509 cflags: [
510 "-include openbsd-compat.h",
511 "-Wno-sign-compare",
512 "-Wframe-larger-than=5000",
513 ],
514
515 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700516 "upstream-openbsd/android/include/",
517 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700518 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700519 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700520 ],
521}
522
Dan Willemsen208ae172015-09-16 16:33:27 -0700523// ========================================================
524// libc_openbsd.a - upstream OpenBSD C library code
525// ========================================================
526//
527// These files are built with the openbsd-compat.h header file
528// automatically included.
529cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700530 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700531 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800532 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700533 "upstream-openbsd/lib/libc/crypt/arc4random.c",
534 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
535
536 // May be overriden by per-arch optimized versions
537 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700538 "upstream-openbsd/lib/libc/string/memrchr.c",
539 "upstream-openbsd/lib/libc/string/stpcpy.c",
540 "upstream-openbsd/lib/libc/string/stpncpy.c",
541 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700542 "upstream-openbsd/lib/libc/string/strcpy.c",
543 "upstream-openbsd/lib/libc/string/strlcat.c",
544 "upstream-openbsd/lib/libc/string/strlcpy.c",
545 "upstream-openbsd/lib/libc/string/strncat.c",
546 "upstream-openbsd/lib/libc/string/strncmp.c",
547 "upstream-openbsd/lib/libc/string/strncpy.c",
548 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700549
550 arch: {
551 arm: {
552 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700553 "upstream-openbsd/lib/libc/string/strcpy.c",
554 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800555 neon: {
Christopher Ferris950a9582017-03-29 13:10:56 -0700556 exclude_srcs: [
Christopher Ferris950a9582017-03-29 13:10:56 -0700557 "upstream-openbsd/lib/libc/string/stpcpy.c",
558 "upstream-openbsd/lib/libc/string/strcat.c",
559 ],
560 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700561 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700562 arm64: {
563 exclude_srcs: [
564 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700565 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700566 "upstream-openbsd/lib/libc/string/strcpy.c",
567 "upstream-openbsd/lib/libc/string/strncmp.c",
568 ],
569 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530570 mips: {
571 exclude_srcs: [
572 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530573 "upstream-openbsd/lib/libc/string/strcpy.c",
574 "upstream-openbsd/lib/libc/string/strncmp.c",
575 ],
576 },
577 mips64: {
578 exclude_srcs: [
579 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530580 "upstream-openbsd/lib/libc/string/strcpy.c",
581 "upstream-openbsd/lib/libc/string/strncmp.c",
582 ],
583 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700584 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800585 exclude_srcs: [
586 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800587 "upstream-openbsd/lib/libc/string/memrchr.c",
588 "upstream-openbsd/lib/libc/string/stpcpy.c",
589 "upstream-openbsd/lib/libc/string/stpncpy.c",
590 "upstream-openbsd/lib/libc/string/strcat.c",
591 "upstream-openbsd/lib/libc/string/strcpy.c",
592 "upstream-openbsd/lib/libc/string/strncmp.c",
593 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700594 "upstream-openbsd/lib/libc/string/strlcat.c",
595 "upstream-openbsd/lib/libc/string/strlcpy.c",
596 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800597 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700598 },
599
600 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800601 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800602 "upstream-openbsd/lib/libc/string/stpcpy.c",
603 "upstream-openbsd/lib/libc/string/stpncpy.c",
604 "upstream-openbsd/lib/libc/string/strcat.c",
605 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800606 "upstream-openbsd/lib/libc/string/strncat.c",
607 "upstream-openbsd/lib/libc/string/strncmp.c",
608 "upstream-openbsd/lib/libc/string/strncpy.c",
609 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700610 },
611 },
612
Colin Cross50c21ab2015-10-31 23:03:05 -0700613 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700614 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700615 "-Wno-unused-parameter",
616 "-include openbsd-compat.h",
617 ],
618
Dan Willemsen208ae172015-09-16 16:33:27 -0700619 local_include_dirs: [
620 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700621 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700622 ],
623
624 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700625}
626
627// ========================================================
628// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
629// ========================================================
630//
631// These files are built with the openbsd-compat.h header file
632// automatically included.
633
634cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700635 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700636 srcs: [
637 "upstream-openbsd/android/gdtoa_support.cpp",
638 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
639 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
640 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
641 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
642 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
643 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
644 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
645 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
646 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
647 "upstream-openbsd/lib/libc/gdtoa/misc.c",
648 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
649 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
650 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
651 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
652 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
653 "upstream-openbsd/lib/libc/gdtoa/sum.c",
654 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
655 ],
656 multilib: {
657 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800658 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700659 },
660 },
661
Colin Cross50c21ab2015-10-31 23:03:05 -0700662 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700663 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700664 "-include openbsd-compat.h",
665 ],
666
Dan Willemsen208ae172015-09-16 16:33:27 -0700667 local_include_dirs: [
668 "private",
669 "upstream-openbsd/android/include",
670 "upstream-openbsd/lib/libc/include",
671 ],
672
673 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700674}
675
676// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700677// libc_fortify.a - container for our FORITFY
678// implementation details
679// ========================================================
680cc_library_static {
681 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700682 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700683
684 name: "libc_fortify",
685
686 // Disable FORTIFY for the compilation of these, so we don't end up having
687 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800688 cflags: [
689 "-U_FORTIFY_SOURCE",
690 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
691 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700692
693 arch: {
694 arm: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700695 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700696 srcs: [
697 "arch-arm/generic/bionic/__memcpy_chk.S",
698 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800699 neon: {
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800700 cflags: [
701 "-DNO___STRCAT_CHK",
702 "-DNO___STRCPY_CHK",
703 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700704 srcs: [
705 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
706 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
707 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700708 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800709 cortex_a7: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700710 srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800711 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
712 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
713 ],
714 exclude_srcs: [
George Burgess IV6cb06872017-07-21 13:28:42 -0700715 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
716 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
717 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700718 },
719 cortex_a9: {
720 srcs: [
721 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
722 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
723 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800724 exclude_srcs: [
725 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
726 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
727 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700728 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800729 krait: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700730 srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800731 "arch-arm/krait/bionic/__strcat_chk.S",
732 "arch-arm/krait/bionic/__strcpy_chk.S",
733 ],
734 exclude_srcs: [
735 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
736 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
737 ],
738 },
739 cortex_a53: {
740 srcs: [
741 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
742 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
743 ],
744 exclude_srcs: [
George Burgess IV6cb06872017-07-21 13:28:42 -0700745 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
746 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
747 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700748 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700749 cortex_a55: {
750 srcs: [
751 "arch-arm/denver/bionic/__strcat_chk.S",
752 "arch-arm/denver/bionic/__strcpy_chk.S",
753 ],
754 exclude_srcs: [
755 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
756 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
757 ],
758 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700759 cortex_a73: {
760 srcs: [
761 "arch-arm/denver/bionic/__strcat_chk.S",
762 "arch-arm/denver/bionic/__strcpy_chk.S",
763 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800764 exclude_srcs: [
765 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
766 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
767 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700768 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700769 cortex_a75: {
770 srcs: [
771 "arch-arm/denver/bionic/__strcat_chk.S",
772 "arch-arm/denver/bionic/__strcpy_chk.S",
773 ],
774 exclude_srcs: [
775 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
776 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
777 ],
778 },
Haibo Huangbc4f4112018-10-10 13:46:48 -0700779 cortex_a76: {
780 srcs: [
781 "arch-arm/denver/bionic/__strcat_chk.S",
782 "arch-arm/denver/bionic/__strcpy_chk.S",
783 ],
784 exclude_srcs: [
785 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
786 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
787 ],
788 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700789 denver: {
790 srcs: [
791 "arch-arm/denver/bionic/__strcat_chk.S",
792 "arch-arm/denver/bionic/__strcpy_chk.S",
793 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800794 exclude_srcs: [
795 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
796 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
797 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700798 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800799 kryo: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700800 srcs: [
801 "arch-arm/krait/bionic/__strcat_chk.S",
802 "arch-arm/krait/bionic/__strcpy_chk.S",
803 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800804 exclude_srcs: [
805 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
806 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700807 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700808 },
809 },
810 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700811 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700812 srcs: [
813 "arch-arm64/generic/bionic/__memcpy_chk.S",
814 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700815 },
816 },
817}
818
819// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700820// libc_bionic.a - home-grown C library code
821// ========================================================
822
823cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700824 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700825 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700826 // The data that backs getauxval is initialized in the libc init
827 // functions which are invoked by the linker. If this file is included
828 // in libc_ndk.a, only one of the copies of the global data will be
829 // initialized, resulting in nullptr dereferences.
830 "bionic/getauxval.cpp",
831
Elliott Hughes211c4d32018-02-02 15:10:32 -0800832 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700833 "bionic/sysconf.cpp",
834 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700835 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700836
Josh Gao10ec9282017-04-03 15:13:29 -0700837 // The following must not be statically linked into libc_ndk.a, because
838 // debuggerd will look for the abort message in libc.so's copy.
839 "bionic/android_set_abort_message.cpp",
840
Dan Willemsen208ae172015-09-16 16:33:27 -0700841 "bionic/strchr.cpp",
842 "bionic/strnlen.c",
843 "bionic/strrchr.cpp",
844 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700845
846 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700847 arm: {
848 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800849 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700850 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800851 "arch-arm/generic/bionic/memset.S",
852 "arch-arm/generic/bionic/strcmp.S",
853 "arch-arm/generic/bionic/strcpy.S",
854 "arch-arm/generic/bionic/strlen.c",
855
Dan Willemsen208ae172015-09-16 16:33:27 -0700856 "arch-arm/bionic/atomics_arm.c",
857 "arch-arm/bionic/__bionic_clone.S",
858 "arch-arm/bionic/_exit_with_stack_teardown.S",
859 "arch-arm/bionic/libgcc_compat.c",
860 "arch-arm/bionic/popcount_tab.c",
861 "arch-arm/bionic/__restore.S",
862 "arch-arm/bionic/setjmp.S",
863 "arch-arm/bionic/syscall.S",
864 "arch-arm/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700865 ],
Colin Cross6ab8f892015-11-23 14:12:15 -0800866 cortex_a7: {
867 srcs: [
Christopher Ferrisecebb492016-11-28 11:09:49 -0800868 "arch-arm/cortex-a7/bionic/memcpy.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700869 "arch-arm/cortex-a7/bionic/memset.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800870 ],
871 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800872 "arch-arm/cortex-a15/bionic/memcpy.S",
873 "arch-arm/cortex-a15/bionic/memset.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800874 ],
875 },
876 cortex_a9: {
877 srcs: [
878 "arch-arm/cortex-a9/bionic/memcpy.S",
879 "arch-arm/cortex-a9/bionic/memset.S",
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800880
Colin Cross6ab8f892015-11-23 14:12:15 -0800881 "arch-arm/cortex-a9/bionic/stpcpy.S",
882 "arch-arm/cortex-a9/bionic/strcat.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800883 "arch-arm/cortex-a9/bionic/strcmp.S",
884 "arch-arm/cortex-a9/bionic/strcpy.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800885 "arch-arm/cortex-a9/bionic/strlen.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800886 ],
887 exclude_srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800888 "arch-arm/cortex-a15/bionic/memcpy.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700889 "arch-arm/cortex-a15/bionic/memset.S",
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800890
Colin Cross6ab8f892015-11-23 14:12:15 -0800891 "arch-arm/cortex-a15/bionic/stpcpy.S",
892 "arch-arm/cortex-a15/bionic/strcat.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800893 "arch-arm/cortex-a15/bionic/strcmp.S",
894 "arch-arm/cortex-a15/bionic/strcpy.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800895 "arch-arm/cortex-a15/bionic/strlen.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800896 ],
897 },
898 krait: {
899 srcs: [
900 "arch-arm/krait/bionic/memcpy.S",
901 "arch-arm/krait/bionic/memset.S",
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800902
Colin Cross6ab8f892015-11-23 14:12:15 -0800903 "arch-arm/krait/bionic/strcmp.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800904 ],
905 exclude_srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800906 "arch-arm/cortex-a15/bionic/memset.S",
907 "arch-arm/cortex-a15/bionic/memcpy.S",
908
909 "arch-arm/cortex-a15/bionic/strcmp.S",
910 ],
911 },
912 cortex_a53: {
913 srcs: [
914 "arch-arm/cortex-a53/bionic/memcpy.S",
915 "arch-arm/cortex-a7/bionic/memset.S",
916 ],
917 exclude_srcs: [
918 "arch-arm/cortex-a15/bionic/memset.S",
919 "arch-arm/cortex-a15/bionic/memcpy.S",
920 ],
921 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700922 cortex_a55: {
923 srcs: [
924 "arch-arm/cortex-a7/bionic/memset.S",
925 "arch-arm/denver/bionic/memcpy.S",
926
927 "arch-arm/krait/bionic/strcmp.S",
928 ],
929 exclude_srcs: [
930 "arch-arm/cortex-a15/bionic/memset.S",
931 "arch-arm/cortex-a15/bionic/memcpy.S",
932 "arch-arm/cortex-a15/bionic/strcmp.S",
933 ],
934 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800935 cortex_a73: {
936 srcs: [
937 "arch-arm/cortex-a7/bionic/memset.S",
938 "arch-arm/denver/bionic/memcpy.S",
939
940 "arch-arm/krait/bionic/strcmp.S",
941 ],
942 exclude_srcs: [
943 "arch-arm/cortex-a15/bionic/memset.S",
944 "arch-arm/cortex-a15/bionic/memcpy.S",
945 "arch-arm/cortex-a15/bionic/strcmp.S",
946 ],
947 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700948 cortex_a75: {
949 srcs: [
950 "arch-arm/cortex-a7/bionic/memset.S",
951 "arch-arm/denver/bionic/memcpy.S",
952
953 "arch-arm/krait/bionic/strcmp.S",
954 ],
955 exclude_srcs: [
956 "arch-arm/cortex-a15/bionic/memset.S",
957 "arch-arm/cortex-a15/bionic/memcpy.S",
958 "arch-arm/cortex-a15/bionic/strcmp.S",
959 ],
960 },
Haibo Huangbc4f4112018-10-10 13:46:48 -0700961 cortex_a76: {
962 srcs: [
963 "arch-arm/cortex-a7/bionic/memset.S",
964 "arch-arm/denver/bionic/memcpy.S",
965
966 "arch-arm/krait/bionic/strcmp.S",
967 ],
968 exclude_srcs: [
969 "arch-arm/cortex-a15/bionic/memset.S",
970 "arch-arm/cortex-a15/bionic/memcpy.S",
971 "arch-arm/cortex-a15/bionic/strcmp.S",
972 ],
973 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800974 denver: {
975 srcs: [
976 "arch-arm/denver/bionic/memcpy.S",
977 "arch-arm/denver/bionic/memset.S",
978 ],
979 exclude_srcs: [
980 "arch-arm/cortex-a15/bionic/memset.S",
981 "arch-arm/cortex-a15/bionic/memcpy.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800982 ],
983 },
Christopher Ferris950a9582017-03-29 13:10:56 -0700984 kryo: {
985 srcs: [
Jake Weinstein04d99df2016-08-25 20:03:25 -0400986 "arch-arm/kryo/bionic/memcpy.S",
Jake Weinstein4d114f92017-04-07 14:55:53 -0400987 "arch-arm/cortex-a7/bionic/memset.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800988
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800989 "arch-arm/krait/bionic/strcmp.S",
990 ],
991 exclude_srcs: [
992 "arch-arm/cortex-a15/bionic/memset.S",
993 "arch-arm/cortex-a15/bionic/memcpy.S",
994 "arch-arm/cortex-a15/bionic/strcmp.S",
995 ],
996 },
997 // Cores not listed above (like cortex-a8, cortex-a15) or
998 // "generic" core will use the following implementation.
999 neon: {
1000 srcs: [
1001 "arch-arm/cortex-a15/bionic/memcpy.S",
1002 "arch-arm/cortex-a15/bionic/memset.S",
1003
Christopher Ferris950a9582017-03-29 13:10:56 -07001004 "arch-arm/cortex-a15/bionic/stpcpy.S",
1005 "arch-arm/cortex-a15/bionic/strcat.S",
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001006 "arch-arm/cortex-a15/bionic/strcmp.S",
Christopher Ferris950a9582017-03-29 13:10:56 -07001007 "arch-arm/cortex-a15/bionic/strcpy.S",
1008 "arch-arm/cortex-a15/bionic/strlen.S",
1009
1010 "arch-arm/denver/bionic/memmove.S",
1011 ],
1012 exclude_srcs: [
1013 "arch-arm/generic/bionic/memcpy.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -07001014 "arch-arm/generic/bionic/memmove.S",
Christopher Ferris950a9582017-03-29 13:10:56 -07001015 "arch-arm/generic/bionic/memset.S",
1016 "arch-arm/generic/bionic/strcmp.S",
1017 "arch-arm/generic/bionic/strcpy.S",
1018 "arch-arm/generic/bionic/strlen.c",
Christopher Ferris950a9582017-03-29 13:10:56 -07001019 ],
1020 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001021 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001022 arm64: {
1023 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001024 "arch-arm64/generic/bionic/memchr.S",
1025 "arch-arm64/generic/bionic/memcmp.S",
1026 "arch-arm64/generic/bionic/memcpy.S",
1027 "arch-arm64/generic/bionic/memmove.S",
1028 "arch-arm64/generic/bionic/memset.S",
1029 "arch-arm64/generic/bionic/stpcpy.S",
1030 "arch-arm64/generic/bionic/strchr.S",
1031 "arch-arm64/generic/bionic/strcmp.S",
1032 "arch-arm64/generic/bionic/strcpy.S",
1033 "arch-arm64/generic/bionic/strlen.S",
1034 "arch-arm64/generic/bionic/strncmp.S",
1035 "arch-arm64/generic/bionic/strnlen.S",
1036 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001037
1038 "arch-arm64/bionic/__bionic_clone.S",
1039 "arch-arm64/bionic/_exit_with_stack_teardown.S",
1040 "arch-arm64/bionic/setjmp.S",
1041 "arch-arm64/bionic/syscall.S",
1042 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001043 ],
1044 exclude_srcs: [
1045 "bionic/__memcpy_chk.cpp",
1046 "bionic/strchr.cpp",
1047 "bionic/strnlen.c",
1048 ],
Colin Cross6ab8f892015-11-23 14:12:15 -08001049 denver64: {
1050 srcs: [
1051 "arch-arm64/denver64/bionic/memcpy.S",
Haibo Huangece43e12018-05-26 13:07:43 -07001052 "arch-arm64/denver64/bionic/memmove.S",
Colin Cross6ab8f892015-11-23 14:12:15 -08001053 "arch-arm64/denver64/bionic/memset.S",
1054 ],
1055 exclude_srcs: [
1056 "arch-arm64/generic/bionic/memcpy.S",
Haibo Huangece43e12018-05-26 13:07:43 -07001057 "arch-arm64/generic/bionic/memmove.S",
Colin Cross6ab8f892015-11-23 14:12:15 -08001058 "arch-arm64/generic/bionic/memset.S",
1059 ],
1060 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001061 },
1062
1063 mips: {
1064 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001065 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301066 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -08001067 "arch-mips/string/memset.S",
1068 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301069 "arch-mips/string/strncmp.S",
1070 "arch-mips/string/strlen.c",
1071 "arch-mips/string/strnlen.c",
1072 "arch-mips/string/strchr.c",
1073 "arch-mips/string/strcpy.c",
1074 "arch-mips/string/memchr.c",
1075 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -08001076
Dan Willemsen208ae172015-09-16 16:33:27 -07001077 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001078 "arch-mips/bionic/cacheflush.cpp",
1079 "arch-mips/bionic/_exit_with_stack_teardown.S",
Dan Willemsen879cec22016-02-29 10:37:56 -08001080 "arch-mips/bionic/libgcc_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001081 "arch-mips/bionic/setjmp.S",
1082 "arch-mips/bionic/syscall.S",
1083 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001084 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +05301085 exclude_srcs: [
1086 "bionic/strchr.cpp",
1087 "bionic/strnlen.c",
1088 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001089 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001090 mips64: {
1091 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001092 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301093 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -08001094 "arch-mips/string/memset.S",
1095 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301096 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001097 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301098 "arch-mips/string/strnlen.c",
1099 "arch-mips/string/strchr.c",
1100 "arch-mips/string/strcpy.c",
1101 "arch-mips/string/memchr.c",
1102 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -08001103
Dan Willemsen208ae172015-09-16 16:33:27 -07001104 "arch-mips64/bionic/__bionic_clone.S",
1105 "arch-mips64/bionic/_exit_with_stack_teardown.S",
1106 "arch-mips64/bionic/setjmp.S",
1107 "arch-mips64/bionic/syscall.S",
1108 "arch-mips64/bionic/vfork.S",
1109 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001110 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +05301111 exclude_srcs: [
1112 "bionic/strchr.cpp",
1113 "bionic/strnlen.c",
1114 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001115 },
1116
1117 x86: {
1118 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001119 "arch-x86/generic/string/memcmp.S",
1120 "arch-x86/generic/string/strcmp.S",
1121 "arch-x86/generic/string/strncmp.S",
1122 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001123
1124 "arch-x86/generic/string/strlcat.c",
1125 "arch-x86/generic/string/strlcpy.c",
1126 "arch-x86/generic/string/strncat.c",
1127 "arch-x86/generic/string/wcscat.c",
1128 "arch-x86/generic/string/wcscpy.c",
1129 "arch-x86/generic/string/wmemcmp.c",
1130
Dan Willemsen208ae172015-09-16 16:33:27 -07001131 "arch-x86/atom/string/sse2-memchr-atom.S",
1132 "arch-x86/atom/string/sse2-memrchr-atom.S",
1133 "arch-x86/atom/string/sse2-strchr-atom.S",
1134 "arch-x86/atom/string/sse2-strnlen-atom.S",
1135 "arch-x86/atom/string/sse2-strrchr-atom.S",
1136 "arch-x86/atom/string/sse2-wcschr-atom.S",
1137 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
1138 "arch-x86/atom/string/sse2-wcslen-atom.S",
1139 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001140 "arch-x86/silvermont/string/sse2-memmove-slm.S",
1141 "arch-x86/silvermont/string/sse2-memset-slm.S",
1142 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
1143 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
1144 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
1145 "arch-x86/silvermont/string/sse2-strlen-slm.S",
1146 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001147
1148 "arch-x86/bionic/__bionic_clone.S",
1149 "arch-x86/bionic/_exit_with_stack_teardown.S",
1150 "arch-x86/bionic/libgcc_compat.c",
1151 "arch-x86/bionic/__restore.S",
1152 "arch-x86/bionic/setjmp.S",
1153 "arch-x86/bionic/syscall.S",
1154 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001155
1156 // ssse3 functions
1157 "arch-x86/atom/string/ssse3-strcat-atom.S",
1158 "arch-x86/atom/string/ssse3-strcmp-atom.S",
1159 "arch-x86/atom/string/ssse3-strlcat-atom.S",
1160 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
1161 "arch-x86/atom/string/ssse3-strncat-atom.S",
1162 "arch-x86/atom/string/ssse3-strncmp-atom.S",
1163 "arch-x86/atom/string/ssse3-wcscat-atom.S",
1164 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
1165
1166 // sse4 functions
1167 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
1168 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
1169
1170 // atom functions
1171 "arch-x86/atom/string/sse2-memset-atom.S",
1172 "arch-x86/atom/string/sse2-strlen-atom.S",
1173 "arch-x86/atom/string/ssse3-memcmp-atom.S",
1174 "arch-x86/atom/string/ssse3-memcpy-atom.S",
1175 "arch-x86/atom/string/ssse3-strcpy-atom.S",
1176 "arch-x86/atom/string/ssse3-strncpy-atom.S",
1177 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001178 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001179
1180 exclude_srcs: [
1181 "bionic/strchr.cpp",
1182 "bionic/strnlen.c",
1183 "bionic/strrchr.cpp",
1184 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001185 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001186 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001187 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001188 "arch-x86_64/string/sse2-memmove-slm.S",
1189 "arch-x86_64/string/sse2-memset-slm.S",
1190 "arch-x86_64/string/sse2-stpcpy-slm.S",
1191 "arch-x86_64/string/sse2-stpncpy-slm.S",
1192 "arch-x86_64/string/sse2-strcat-slm.S",
1193 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001194 "arch-x86_64/string/sse2-strlen-slm.S",
1195 "arch-x86_64/string/sse2-strncat-slm.S",
1196 "arch-x86_64/string/sse2-strncpy-slm.S",
1197 "arch-x86_64/string/sse4-memcmp-slm.S",
1198 "arch-x86_64/string/ssse3-strcmp-slm.S",
1199 "arch-x86_64/string/ssse3-strncmp-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001200
1201 "arch-x86_64/bionic/__bionic_clone.S",
1202 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1203 "arch-x86_64/bionic/__restore_rt.S",
1204 "arch-x86_64/bionic/setjmp.S",
1205 "arch-x86_64/bionic/syscall.S",
1206 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001207 ],
1208 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001209 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001210
Colin Cross50c21ab2015-10-31 23:03:05 -07001211 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001212 include_dirs: ["bionic/libstdc++/include"],
1213 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001214}
1215
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001216genrule {
1217 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001218 out: ["generated_android_ids.h"],
1219 srcs: [":android_filesystem_config_header"],
1220 tool_files: ["fs_config_generator.py"],
1221 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001222}
1223
Dan Willemsen268a6732015-10-15 14:49:45 -07001224// ========================================================
1225// libc_bionic_ndk.a- The portions of libc_bionic that can
1226// be safely used in libc_ndk.a (no troublesome global data
1227// or constructors).
1228// ========================================================
1229cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001230 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001231 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001232 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001233 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001234 "bionic/__cmsg_nxthdr.cpp",
1235 "bionic/__errno.cpp",
1236 "bionic/__gnu_basename.cpp",
1237 "bionic/__libc_current_sigrtmax.cpp",
1238 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001239 "bionic/abort.cpp",
1240 "bionic/accept.cpp",
1241 "bionic/accept4.cpp",
1242 "bionic/access.cpp",
1243 "bionic/arpa_inet.cpp",
1244 "bionic/assert.cpp",
1245 "bionic/atof.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001246 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001247 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001248 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001249 "bionic/bionic_systrace.cpp",
1250 "bionic/bionic_time_conversions.cpp",
1251 "bionic/brk.cpp",
1252 "bionic/c16rtomb.cpp",
1253 "bionic/c32rtomb.cpp",
1254 "bionic/chmod.cpp",
1255 "bionic/chown.cpp",
1256 "bionic/clearenv.cpp",
1257 "bionic/clock.cpp",
1258 "bionic/clock_getcpuclockid.cpp",
1259 "bionic/clock_nanosleep.cpp",
1260 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001261 "bionic/connect.cpp",
1262 "bionic/ctype.cpp",
1263 "bionic/dirent.cpp",
1264 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001265 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001266 "bionic/error.cpp",
1267 "bionic/eventfd_read.cpp",
1268 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001269 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001270 "bionic/faccessat.cpp",
1271 "bionic/fchmod.cpp",
1272 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001273 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001274 "bionic/ffs.cpp",
1275 "bionic/fgetxattr.cpp",
1276 "bionic/flistxattr.cpp",
1277 "bionic/flockfile.cpp",
1278 "bionic/fpclassify.cpp",
1279 "bionic/fsetxattr.cpp",
1280 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001281 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001282 "bionic/futimens.cpp",
1283 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001284 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001285 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001286 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001287 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001288 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001289 "bionic/getpgrp.cpp",
1290 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001291 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001292 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001293 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001294 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001295 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001296 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001297 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001298 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001299 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001300 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001301 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001302 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001303 "bionic/lchown.cpp",
1304 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001305 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001306 "bionic/libgen.cpp",
1307 "bionic/link.cpp",
1308 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001309 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001310 "bionic/lstat.cpp",
1311 "bionic/malloc_info.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001312 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001313 "bionic/mbrtoc16.cpp",
1314 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001315 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001316 "bionic/mempcpy.cpp",
1317 "bionic/mkdir.cpp",
1318 "bionic/mkfifo.cpp",
1319 "bionic/mknod.cpp",
1320 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001321 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001322 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001323 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001324 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001325 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001326 "bionic/open.cpp",
1327 "bionic/pathconf.cpp",
1328 "bionic/pause.cpp",
1329 "bionic/pipe.cpp",
1330 "bionic/poll.cpp",
1331 "bionic/posix_fadvise.cpp",
1332 "bionic/posix_fallocate.cpp",
1333 "bionic/posix_madvise.cpp",
1334 "bionic/posix_timers.cpp",
1335 "bionic/ptrace.cpp",
1336 "bionic/pty.cpp",
1337 "bionic/raise.cpp",
1338 "bionic/rand.cpp",
1339 "bionic/readlink.cpp",
1340 "bionic/reboot.cpp",
1341 "bionic/recv.cpp",
1342 "bionic/rename.cpp",
1343 "bionic/rmdir.cpp",
1344 "bionic/scandir.cpp",
1345 "bionic/sched_getaffinity.cpp",
1346 "bionic/sched_getcpu.cpp",
1347 "bionic/semaphore.cpp",
1348 "bionic/send.cpp",
1349 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001350 "bionic/seteuid.cpp",
1351 "bionic/setpgrp.cpp",
1352 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001353 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001354 "bionic/sigprocmask.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001355 "bionic/socket.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001356 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001357 "bionic/stat.cpp",
1358 "bionic/statvfs.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001359 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001360 "bionic/strchrnul.cpp",
1361 "bionic/strerror.cpp",
1362 "bionic/strerror_r.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001363 "bionic/string_l.cpp",
1364 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001365 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001366 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001367 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001368 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001369 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001370 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001371 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001372 "bionic/sys_msg.cpp",
1373 "bionic/sys_sem.cpp",
1374 "bionic/sys_shm.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001375 "bionic/sys_siglist.c",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001376 "bionic/sys_signalfd.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001377 "bionic/sys_signame.c",
Elliott Hughes449eff02016-06-08 19:51:20 -07001378 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001379 "bionic/sysinfo.cpp",
1380 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001381 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001382 "bionic/system_property_api.cpp",
1383 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001384 "bionic/tdestroy.cpp",
1385 "bionic/termios.cpp",
1386 "bionic/thread_private.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001387 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001388 "bionic/tmpfile.cpp",
1389 "bionic/umount.cpp",
1390 "bionic/unlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001391 "bionic/wait.cpp",
1392 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001393 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001394 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001395 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001396 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001397 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001398
1399 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1400 // which will be overridden by the actual one in libc.so.
1401 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001402 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001403
Dan Willemsen208ae172015-09-16 16:33:27 -07001404 multilib: {
1405 lib32: {
1406 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001407 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001408 },
1409 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001410 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001411 treble_linker_namespaces: {
1412 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001413 },
1414 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001415 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001416 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001417 local_include_dirs: ["stdio"],
1418 include_dirs: ["bionic/libstdc++/include"],
1419 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001420 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001421}
1422
Dan Willemsen208ae172015-09-16 16:33:27 -07001423// ========================================================
1424// libc_pthread.a - pthreads parts that previously lived in
1425// libc_bionic.a. Relocated to their own library because
1426// they can't be included in libc_ndk.a (as they layout of
1427// pthread_t has changed over the years and has ABI
1428// compatibility issues).
1429// ========================================================
1430
1431cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001432 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001433 srcs: [
1434 "bionic/pthread_atfork.cpp",
1435 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001436 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001437 "bionic/pthread_cond.cpp",
1438 "bionic/pthread_create.cpp",
1439 "bionic/pthread_detach.cpp",
1440 "bionic/pthread_equal.cpp",
1441 "bionic/pthread_exit.cpp",
1442 "bionic/pthread_getcpuclockid.cpp",
1443 "bionic/pthread_getschedparam.cpp",
1444 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001445 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001446 "bionic/pthread_join.cpp",
1447 "bionic/pthread_key.cpp",
1448 "bionic/pthread_kill.cpp",
1449 "bionic/pthread_mutex.cpp",
1450 "bionic/pthread_once.cpp",
1451 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001452 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001453 "bionic/pthread_self.cpp",
1454 "bionic/pthread_setname_np.cpp",
1455 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001456 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001457
1458 // The following implementations depend on pthread data or implementation,
1459 // so we can't include them in libc_ndk.a.
1460 "bionic/__cxa_thread_atexit_impl.cpp",
1461 "stdlib/atexit.c",
1462 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001463 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001464
Colin Cross50c21ab2015-10-31 23:03:05 -07001465 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001466 include_dirs: ["bionic/libstdc++/include"],
1467 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001468}
1469
1470// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001471// libc_syscalls.a
1472// ========================================================
1473
1474cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001475 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001476 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001477 arch: {
1478 arm: {
1479 srcs: ["arch-arm/syscalls/**/*.S"],
1480 },
1481 arm64: {
1482 srcs: ["arch-arm64/syscalls/**/*.S"],
1483 },
1484 mips: {
1485 srcs: ["arch-mips/syscalls/**/*.S"],
1486 },
1487 mips64: {
1488 srcs: ["arch-mips64/syscalls/**/*.S"],
1489 },
1490 x86: {
1491 srcs: ["arch-x86/syscalls/**/*.S"],
1492 },
1493 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001494 srcs: ["arch-x86_64/syscalls/**/*.S"],
1495 },
1496 },
1497 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001498}
1499
1500// ========================================================
1501// libc_aeabi.a
1502// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1503// to avoid infinite recursion. For the other architectures we just build an
1504// empty library to keep this makefile simple.
1505// ========================================================
1506
1507cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001508 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001509 arch: {
1510 arm: {
1511 srcs: ["arch-arm/bionic/__aeabi.c"],
1512 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001513 },
1514 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001515 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001516}
1517
1518// ========================================================
1519// libc_ndk.a
1520// Compatibility library for the NDK. This library contains
1521// all the parts of libc that are safe to statically link.
1522// We can't safely statically link things that can only run
1523// on a certain version of the OS. Examples include
1524// anything that talks to netd (a large portion of the DNS
1525// code) and anything that is dependent on the layout of a
1526// data structure that has changed across releases (such as
1527// pthread_t).
1528// ========================================================
1529
1530cc_library_static {
1531 name: "libc_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001532 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001533 srcs: libc_common_src_files + ["bionic/malloc_common.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001534 multilib: {
1535 lib32: {
1536 srcs: libc_common_src_files_32,
1537 },
1538 },
1539 arch: {
1540 arm: {
1541 srcs: [
1542 "arch-arm/bionic/exidx_dynamic.c",
1543 "arch-common/bionic/crtbegin_so.c",
1544 "arch-arm/bionic/atexit_legacy.c",
1545 "arch-common/bionic/crtend_so.S",
1546 ],
1547 whole_static_libs: ["libc_aeabi"],
1548 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001549 },
1550
Colin Cross50c21ab2015-10-31 23:03:05 -07001551 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001552 "-fvisibility=hidden",
1553 "-DLIBC_STATIC",
1554 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001555
1556 whole_static_libs: [
1557 "libc_bionic_ndk",
George Burgess IV6cb06872017-07-21 13:28:42 -07001558 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001559 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001560 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001561 "libc_gdtoa",
1562 "libc_malloc",
1563 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001564 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001565 "libc_openbsd_ndk",
1566 "libc_stack_protector",
1567 "libc_syscalls",
1568 "libc_tzcode",
1569 "libm",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001570 "libjemalloc5",
Elliott Hughes816fab92016-05-27 17:57:46 -07001571 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001572 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001573}
1574
1575// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001576// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001577// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001578cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001579 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001580 srcs: libc_common_src_files,
1581 multilib: {
1582 lib32: {
1583 srcs: libc_common_src_files_32,
1584 },
1585 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001586 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001587
1588 whole_static_libs: [
1589 "libc_bionic",
1590 "libc_bionic_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001591 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001592 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001593 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001594 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001595 "libc_gdtoa",
1596 "libc_malloc",
1597 "libc_netbsd",
1598 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001599 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001600 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001601 "libc_stack_protector",
1602 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001603 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001604 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001605 ],
1606
1607 arch: {
1608 arm: {
1609 whole_static_libs: ["libc_aeabi"],
1610 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001611 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001612}
1613
1614// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001615// libc_common.a
1616// ========================================================
1617
1618cc_library_static {
1619 defaults: ["libc_defaults"],
1620 name: "libc_common",
1621
1622 whole_static_libs: [
1623 "libc_nopthread",
1624 "libc_pthread",
1625 ],
1626}
1627
1628// ========================================================
Haibo Huangf71edfa2018-11-12 10:06:56 -08001629// libc_common_static.a For static binaries.
1630// ========================================================
1631cc_library_static {
1632 defaults: ["libc_defaults"],
1633 name: "libc_common_static",
1634
Haibo Huangb9244ff2018-08-11 10:12:13 -07001635 arch: {
1636 x86: {
1637 srcs: ["arch-x86/static_function_dispatch.S"],
1638 },
1639 },
1640
Haibo Huangf71edfa2018-11-12 10:06:56 -08001641 whole_static_libs: [
1642 "libc_common",
1643 ],
1644}
1645
1646// ========================================================
1647// libc_common_shared.a For shared libraries.
1648// ========================================================
1649cc_library_static {
1650 defaults: ["libc_defaults"],
1651 name: "libc_common_shared",
1652
Haibo Huangb9244ff2018-08-11 10:12:13 -07001653 cflags: [
1654 "-fno-stack-protector",
1655 "-fno-jump-tables",
1656 ],
1657 arch: {
1658 x86: {
1659 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1660 },
1661 },
1662
Haibo Huangf71edfa2018-11-12 10:06:56 -08001663 whole_static_libs: [
1664 "libc_common",
1665 ],
1666}
1667
1668// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001669// libc_nomalloc.a
1670// ========================================================
1671//
1672// This is a version of the static C library that does not
1673// include malloc. It's useful in situations when the user wants
1674// to provide their own malloc implementation, or wants to
1675// explicitly disallow the use of malloc, such as in the
1676// dynamic linker.
1677
1678cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001679 name: "libc_nomalloc",
1680
Colin Cross50c21ab2015-10-31 23:03:05 -07001681 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001682
1683 arch: {
1684 arm: {
1685 srcs: ["arch-arm/bionic/exidx_static.c"],
1686 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001687 },
1688
Colin Cross50c21ab2015-10-31 23:03:05 -07001689 cflags: ["-DLIBC_STATIC"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001690
Colin Crossa3f9fca2016-01-11 13:20:55 -08001691 whole_static_libs: [
Haibo Huangf71edfa2018-11-12 10:06:56 -08001692 "libc_common_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001693 "libc_init_static",
1694 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001695}
1696
1697// ========================================================
1698// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1699// ========================================================
1700cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001701 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001702 srcs: ["bionic/jemalloc_wrapper.cpp"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001703 cflags: ["-fvisibility=hidden"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001704
Dan Willemsen208ae172015-09-16 16:33:27 -07001705 name: "libc_malloc",
Dan Willemsen208ae172015-09-16 16:33:27 -07001706}
1707
1708// ========================================================
1709// libc.a + libc.so
1710// ========================================================
1711cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001712 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001713 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001714 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001715 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001716 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001717 platform_sdk_version: {
1718 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1719 },
1720 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001721 static: {
1722 srcs: [
1723 "bionic/dl_iterate_phdr_static.cpp",
Dan Willemsen0c657082016-05-12 01:43:07 -07001724 "bionic/malloc_common.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001725 ],
1726 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001727 whole_static_libs: [
1728 "libc_init_static",
1729 "libc_common_static",
1730 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001731 },
1732 shared: {
1733 srcs: [
1734 "arch-common/bionic/crtbegin_so.c",
1735 "arch-common/bionic/crtbrand.S",
Elliott Hughesa57ca0d2016-11-17 18:18:08 -08001736 "bionic/icu.cpp",
Dan Willemsen0c657082016-05-12 01:43:07 -07001737 "bionic/malloc_common.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001738 "bionic/NetdClient.cpp",
1739 "arch-common/bionic/crtend_so.S",
1740 ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001741 whole_static_libs: [
1742 "libc_init_dynamic",
1743 "libc_common_shared",
1744 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001745 },
1746
1747 required: ["tzdata"],
1748
1749 // Leave the symbols in the shared library so that stack unwinders can produce
1750 // meaningful name resolution.
Colin Cross37f36322016-04-25 14:09:13 -07001751 strip: {
1752 keep_symbols: true,
1753 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001754
Colin Cross4ce94d22016-11-15 13:15:43 -08001755 // Do not pack libc.so relocations; see http://b/20645321 for details.
1756 pack_relocations: false,
1757
dimitry06016f22018-01-05 11:39:28 +01001758 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1759 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1760 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1761 // those new libraries from libgcc.a are not declared external; if that were the case,
1762 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1763 // on the external symbols from the dependent libraries. That would create a "cloaked"
1764 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001765
dimitry06016f22018-01-05 11:39:28 +01001766 shared_libs: [
1767 "ld-android",
1768 "libdl",
1769 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001770 whole_static_libs: [
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001771 "libjemalloc5",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001772 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001773
1774 nocrt: true,
1775
Dan Willemsen208ae172015-09-16 16:33:27 -07001776 arch: {
1777 arm: {
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001778 //TODO: This is to work around b/24465209. Remove after root cause is fixed
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001779 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001780 ldflags: ["-Wl,--hash-style=both"],
1781
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001782 // Don't re-export new/delete and friends, even if the compiler really wants to.
1783 version_script: "libc.arm.map",
1784
Dan Willemsen208ae172015-09-16 16:33:27 -07001785 shared: {
Dan Willemsen0c657082016-05-12 01:43:07 -07001786 srcs: [
1787 "arch-arm/bionic/exidx_dynamic.c",
1788
1789 // special for arm
1790 "arch-arm/bionic/atexit_legacy.c",
1791 ],
1792 // special for arm
1793 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001794 },
1795 static: {
1796 srcs: ["arch-arm/bionic/exidx_static.c"],
1797 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001798 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001799 arm64: {
1800 // Don't re-export new/delete and friends, even if the compiler really wants to.
1801 version_script: "libc.arm64.map",
1802 },
1803 mips: {
1804 // Don't re-export new/delete and friends, even if the compiler really wants to.
1805 version_script: "libc.mips.map",
1806 },
1807 mips64: {
1808 // Don't re-export new/delete and friends, even if the compiler really wants to.
1809 version_script: "libc.mips64.map",
1810 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001811 x86: {
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001812 //TODO: This is to work around b/24465209. Remove after root cause is fixed
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001813 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001814 ldflags: ["-Wl,--hash-style=both"],
1815
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001816 // Don't re-export new/delete and friends, even if the compiler really wants to.
1817 version_script: "libc.x86.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001818 },
1819 x86_64: {
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001820 // Don't re-export new/delete and friends, even if the compiler really wants to.
1821 version_script: "libc.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001822 },
1823 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001824}
1825
Dan Willemsen208ae172015-09-16 16:33:27 -07001826// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001827// libstdc++.so + libstdc++.a
1828// ========================================================
1829cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001830 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001831 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001832 srcs: [
1833 "bionic/__cxa_guard.cpp",
1834 "bionic/__cxa_pure_virtual.cpp",
1835 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001836 ],
1837 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001838 static_ndk_lib: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001839 system_shared_libs: ["libc"],
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001840 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001841
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001842 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001843 arch: {
1844 arm: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001845 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001846 ldflags: ["-Wl,--hash-style=both"],
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001847 version_script: "libstdc++.arm.map",
1848 },
1849 arm64: {
1850 version_script: "libstdc++.arm64.map",
1851 },
1852 mips: {
1853 version_script: "libstdc++.mips.map",
1854 },
1855 mips64: {
1856 version_script: "libstdc++.mips64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001857 },
1858 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001859 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001860 ldflags: ["-Wl,--hash-style=both"],
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001861 version_script: "libstdc++.x86.map",
1862 },
1863 x86_64: {
1864 version_script: "libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001865 },
1866 },
1867}
1868
Colin Cross50c21ab2015-10-31 23:03:05 -07001869cc_defaults {
1870 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001871 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001872 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001873 recovery_available: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001874
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001875 cflags: [
1876 "-Wno-gcc-compat",
1877 "-Wall",
1878 "-Werror",
1879 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001880}
1881
Colin Cross50c21ab2015-10-31 23:03:05 -07001882cc_defaults {
1883 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001884 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001885
1886 arch: {
1887 mips: {
1888 cflags: ["-fPIC"],
1889 },
1890 mips64: {
1891 cflags: ["-fPIC"],
1892 },
1893 x86: {
1894 cflags: ["-fPIC"],
1895 },
1896 x86_64: {
1897 cflags: ["-fPIC"],
1898 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001899 },
Colin Crossab179442018-09-27 11:03:22 -07001900 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001901}
1902
Dan Willemsena3ed9012017-04-04 15:51:26 -07001903// crt obj files
Dan Willemsen208ae172015-09-16 16:33:27 -07001904cc_object {
1905 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001906 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001907 local_include_dirs: ["include"],
1908 product_variables: {
1909 platform_sdk_version: {
1910 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1911 },
1912 },
1913 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001914
Colin Cross7d7b3682017-11-03 13:38:40 -07001915 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001916}
1917
Dan Willemsen208ae172015-09-16 16:33:27 -07001918cc_object {
1919 name: "crtbegin_so1",
1920 local_include_dirs: ["include"],
1921 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001922
Colin Cross7d7b3682017-11-03 13:38:40 -07001923 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001924}
1925
Dan Willemsen208ae172015-09-16 16:33:27 -07001926cc_object {
1927 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07001928
Colin Cross7d7b3682017-11-03 13:38:40 -07001929 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07001930 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001931 "crtbegin_so1",
1932 "crtbrand",
1933 ],
1934}
1935
Dan Willemsen208ae172015-09-16 16:33:27 -07001936cc_object {
1937 name: "crtend_so",
1938 local_include_dirs: ["include"],
1939 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001940
Colin Cross7d7b3682017-11-03 13:38:40 -07001941 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001942}
1943
Dan Willemsen208ae172015-09-16 16:33:27 -07001944cc_object {
1945 name: "crtbegin_static1",
1946 local_include_dirs: ["include"],
1947 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001948
Colin Cross50c21ab2015-10-31 23:03:05 -07001949 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001950 mips: {
1951 srcs: [
1952 "arch-mips/bionic/crtbegin.c",
1953 ],
1954 exclude_srcs: [
1955 "arch-common/bionic/crtbegin.c",
1956 ],
1957 },
1958 mips64: {
1959 srcs: [
1960 "arch-mips64/bionic/crtbegin.c",
1961 ],
1962 exclude_srcs: [
1963 "arch-common/bionic/crtbegin.c",
1964 ],
1965 },
1966 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001967
1968 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001969}
1970
Dan Willemsen208ae172015-09-16 16:33:27 -07001971cc_object {
1972 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07001973
Colin Cross77d57bf2016-04-11 14:34:18 -07001974 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001975 "crtbegin_static1",
1976 "crtbrand",
1977 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001978 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001979}
1980
Dan Willemsen208ae172015-09-16 16:33:27 -07001981cc_object {
1982 name: "crtbegin_dynamic1",
1983 local_include_dirs: ["include"],
1984 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001985
Colin Cross50c21ab2015-10-31 23:03:05 -07001986 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001987 mips: {
1988 srcs: [
1989 "arch-mips/bionic/crtbegin.c",
1990 ],
1991 exclude_srcs: [
1992 "arch-common/bionic/crtbegin.c",
1993 ],
1994 },
1995 mips64: {
1996 srcs: [
1997 "arch-mips64/bionic/crtbegin.c",
1998 ],
1999 exclude_srcs: [
2000 "arch-common/bionic/crtbegin.c",
2001 ],
2002 },
2003 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002004 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002005}
2006
Dan Willemsen208ae172015-09-16 16:33:27 -07002007cc_object {
2008 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002009
Colin Cross77d57bf2016-04-11 14:34:18 -07002010 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002011 "crtbegin_dynamic1",
2012 "crtbrand",
2013 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002014 target: {
2015 linux_bionic: {
2016 generated_sources: ["host_bionic_linker_asm"],
2017 objs: [
2018 "linker_wrapper",
2019 ],
2020 },
2021 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002022 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002023}
2024
Dan Willemsen208ae172015-09-16 16:33:27 -07002025cc_object {
2026 // We rename crtend.o to crtend_android.o to avoid a
2027 // name clash between gcc and bionic.
2028 name: "crtend_android",
2029 local_include_dirs: ["include"],
2030 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002031
Colin Cross50c21ab2015-10-31 23:03:05 -07002032 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002033}
Colin Crossbaa48992016-07-13 11:15:21 -07002034
Dan Albert26e1c412018-05-24 14:56:46 -07002035versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002036 name: "common_libc",
2037 from: "include",
2038 to: "",
2039 license: "NOTICE",
2040}
Dan Albert4238a352016-06-28 11:18:05 -07002041
2042ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002043 name: "libc_uapi",
2044 from: "kernel/uapi",
2045 to: "",
2046 srcs: [
2047 "kernel/uapi/asm-generic/**/*.h",
2048 "kernel/uapi/drm/**/*.h",
2049 "kernel/uapi/linux/**/*.h",
2050 "kernel/uapi/misc/**/*.h",
2051 "kernel/uapi/mtd/**/*.h",
2052 "kernel/uapi/rdma/**/*.h",
2053 "kernel/uapi/scsi/**/*.h",
2054 "kernel/uapi/sound/**/*.h",
2055 "kernel/uapi/video/**/*.h",
2056 "kernel/uapi/xen/**/*.h",
2057 ],
Dan Albert92592652016-10-20 01:42:54 -07002058 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002059}
2060
2061ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002062 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002063 from: "kernel/android/uapi/linux",
2064 to: "linux",
2065 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002066 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002067}
2068
2069ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002070 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002071 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002072 to: "scsi",
2073 srcs: ["kernel/android/scsi/**/*.h"],
2074 license: "NOTICE",
2075}
2076
2077ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002078 name: "libc_asm_arm",
2079 from: "kernel/uapi/asm-arm",
2080 to: "arm-linux-androideabi",
2081 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002082 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002083}
2084
2085ndk_headers {
2086 name: "libc_asm_arm64",
2087 from: "kernel/uapi/asm-arm64",
2088 to: "aarch64-linux-android",
2089 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002090 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002091}
2092
Elliott Hughesee291c02017-12-11 11:32:34 -08002093// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002094ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002095 name: "libc_asm_mips",
2096 from: "kernel/uapi/asm-mips",
2097 to: "mipsel-linux-android",
2098 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2099 license: "NOTICE",
2100}
2101
Elliott Hughesee291c02017-12-11 11:32:34 -08002102// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002103ndk_headers {
2104 name: "libc_asm_mips64",
2105 from: "kernel/uapi/asm-mips",
2106 to: "mips64el-linux-android",
2107 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2108 license: "NOTICE",
2109}
2110
2111ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002112 name: "libc_asm_x86",
2113 from: "kernel/uapi/asm-x86",
2114 to: "i686-linux-android",
2115 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002116 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002117}
2118
2119ndk_headers {
2120 name: "libc_asm_x86_64",
2121 from: "kernel/uapi/asm-x86",
2122 to: "x86_64-linux-android",
2123 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002124 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002125}
2126
Dan Albert4238a352016-06-28 11:18:05 -07002127ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002128 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002129 symbol_file: "libc.map.txt",
2130 first_version: "9",
2131}
2132
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002133llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002134 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002135 symbol_file: "libc.map.txt",
2136 export_headers_as_system: true,
2137 export_preprocessed_headers: ["include"],
2138 arch: {
2139 arm: {
2140 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002141 "kernel/uapi",
2142 "kernel/uapi/asm-arm",
2143 "kernel/android/uapi",
2144 ],
2145 },
2146 arm64: {
2147 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002148 "kernel/uapi",
2149 "kernel/uapi/asm-arm64",
2150 "kernel/android/uapi",
2151 ],
2152 },
2153 mips: {
2154 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002155 "kernel/uapi",
2156 "kernel/uapi/asm-mips",
2157 "kernel/android/uapi",
2158 ],
2159 },
2160 mips64: {
2161 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002162 "kernel/uapi",
2163 "kernel/uapi/asm-mips",
2164 "kernel/android/uapi",
2165 ],
2166 },
2167 x86: {
2168 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002169 "kernel/uapi",
2170 "kernel/uapi/asm-x86",
2171 "kernel/android/uapi",
2172 ],
2173 },
2174 x86_64: {
2175 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002176 "kernel/uapi",
2177 "kernel/uapi/asm-x86",
2178 "kernel/android/uapi",
2179 ],
2180 },
2181 },
2182}
2183
Dan Albertdf31aff2016-10-06 15:50:41 -07002184ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002185 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002186 symbol_file: "libstdc++.map.txt",
2187 first_version: "9",
2188}
2189
Dan Willemsenca056d72018-01-08 14:00:24 -08002190// Export these headers for toolbox to process
2191filegroup {
2192 name: "kernel_input_headers",
2193 srcs: [
2194 "kernel/uapi/linux/input.h",
2195 "kernel/uapi/linux/input-event-codes.h",
2196 ],
2197}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002198
2199// Generate a syscall name / number mapping. These objects are text files
2200// (thanks to the -dD -E flags) and not binary files. They will then be
2201// consumed by the genseccomp.py script and converted into C++ code.
2202cc_defaults {
2203 name: "libseccomp_gen_syscall_nrs_defaults",
2204 recovery_available: true,
2205 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2206 cflags: [
2207 "-dD",
2208 "-E",
2209 "-Wall",
2210 "-Werror",
2211 "-nostdinc",
2212 ],
2213}
2214
2215cc_object {
2216 name: "libseccomp_gen_syscall_nrs_arm",
2217 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2218 local_include_dirs: [
2219 "kernel/uapi/asm-arm",
2220 "kernel/uapi",
2221 ],
2222}
2223
2224cc_object {
2225 name: "libseccomp_gen_syscall_nrs_arm64",
2226 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2227 local_include_dirs: [
2228 "kernel/uapi/asm-arm64",
2229 "kernel/uapi",
2230 ],
2231}
2232
2233cc_object {
2234 name: "libseccomp_gen_syscall_nrs_x86",
2235 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2236 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2237 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2238 local_include_dirs: [
2239 "kernel/uapi/asm-x86",
2240 "kernel/uapi",
2241 ],
2242}
2243
2244cc_object {
2245 name: "libseccomp_gen_syscall_nrs_x86_64",
2246 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2247 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2248 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2249 local_include_dirs: [
2250 "kernel/uapi/asm-x86",
2251 "kernel/uapi",
2252 ],
2253}
2254
2255cc_object {
2256 name: "libseccomp_gen_syscall_nrs_mips",
2257 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2258 cflags: [
2259 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2260 ],
2261 local_include_dirs: [
2262 "kernel/uapi/asm-mips",
2263 "kernel/uapi",
2264 ],
2265}
2266
2267cc_object {
2268 name: "libseccomp_gen_syscall_nrs_mips64",
2269 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2270 cflags: [
2271 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2272 ],
2273 local_include_dirs: [
2274 "kernel/uapi/asm-mips",
2275 "kernel/uapi",
2276 ],
2277}
2278
2279// Generate the C++ policy sources for app, system, and global seccomp-bpf
2280// filters.
2281python_binary_host {
2282 name: "genseccomp",
2283 main: "tools/genseccomp.py",
2284
2285 srcs: [
2286 "tools/genseccomp.py",
2287 "tools/gensyscalls.py",
2288 ],
2289
2290 data: [
2291 "kernel/uapi/**/*.h",
2292 ],
2293
2294 version: {
2295 py2: {
2296 enabled: true,
2297 },
2298 py3: {
2299 enabled: false,
2300 },
2301 },
2302}
2303
2304cc_genrule {
2305 name: "libseccomp_policy_app_sources",
2306 recovery_available: true,
2307 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2308
2309 tools: [ "genseccomp" ],
2310
2311 srcs: [
2312 "SYSCALLS.TXT",
2313 "SECCOMP_WHITELIST_COMMON.TXT",
2314 "SECCOMP_WHITELIST_APP.TXT",
2315 "SECCOMP_BLACKLIST_COMMON.TXT",
2316 "SECCOMP_BLACKLIST_APP.TXT",
2317 ":libseccomp_gen_syscall_nrs_arm",
2318 ":libseccomp_gen_syscall_nrs_arm64",
2319 ":libseccomp_gen_syscall_nrs_mips",
2320 ":libseccomp_gen_syscall_nrs_mips64",
2321 ":libseccomp_gen_syscall_nrs_x86",
2322 ":libseccomp_gen_syscall_nrs_x86_64",
2323 ],
2324
2325 out: [
2326 "arm64_app_policy.cpp",
2327 "arm_app_policy.cpp",
2328 "mips64_app_policy.cpp",
2329 "mips_app_policy.cpp",
2330 "x86_64_app_policy.cpp",
2331 "x86_app_policy.cpp",
2332 ],
2333}
2334
2335cc_genrule {
2336 name: "libseccomp_policy_system_sources",
2337 recovery_available: true,
2338 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2339
2340 tools: [ "genseccomp" ],
2341
2342 srcs: [
2343 "SYSCALLS.TXT",
2344 "SECCOMP_WHITELIST_COMMON.TXT",
2345 "SECCOMP_WHITELIST_SYSTEM.TXT",
2346 "SECCOMP_BLACKLIST_COMMON.TXT",
2347 ":libseccomp_gen_syscall_nrs_arm",
2348 ":libseccomp_gen_syscall_nrs_arm64",
2349 ":libseccomp_gen_syscall_nrs_mips",
2350 ":libseccomp_gen_syscall_nrs_mips64",
2351 ":libseccomp_gen_syscall_nrs_x86",
2352 ":libseccomp_gen_syscall_nrs_x86_64",
2353 ],
2354
2355 out: [
2356 "arm64_system_policy.cpp",
2357 "arm_system_policy.cpp",
2358 "mips64_system_policy.cpp",
2359 "mips_system_policy.cpp",
2360 "x86_64_system_policy.cpp",
2361 "x86_system_policy.cpp",
2362 ],
2363}
2364
2365cc_genrule {
2366 name: "libseccomp_policy_global_sources",
2367 recovery_available: true,
2368 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=global $(in)",
2369
2370 tools: [ "genseccomp" ],
2371
2372 srcs: [
2373 "SYSCALLS.TXT",
2374 "SECCOMP_WHITELIST_COMMON.TXT",
2375 "SECCOMP_WHITELIST_SYSTEM.TXT",
2376 "SECCOMP_WHITELIST_APP.TXT",
2377 "SECCOMP_WHITELIST_GLOBAL.TXT",
2378 "SECCOMP_BLACKLIST_COMMON.TXT",
2379 ":libseccomp_gen_syscall_nrs_arm",
2380 ":libseccomp_gen_syscall_nrs_arm64",
2381 ":libseccomp_gen_syscall_nrs_mips",
2382 ":libseccomp_gen_syscall_nrs_mips64",
2383 ":libseccomp_gen_syscall_nrs_x86",
2384 ":libseccomp_gen_syscall_nrs_x86_64",
2385 ],
2386
2387 out: [
2388 "arm64_global_policy.cpp",
2389 "arm_global_policy.cpp",
2390 "mips64_global_policy.cpp",
2391 "mips_global_policy.cpp",
2392 "x86_64_global_policy.cpp",
2393 "x86_global_policy.cpp",
2394 ],
2395}
2396
2397cc_library {
2398 name: "libseccomp_policy",
2399 recovery_available: true,
2400 generated_sources: [
2401 "libseccomp_policy_app_sources",
2402 "libseccomp_policy_global_sources",
2403 "libseccomp_policy_system_sources",
2404 ],
2405
2406 srcs: [
2407 "seccomp/seccomp_policy.cpp",
2408 ],
2409
2410 export_include_dirs: ["seccomp/include"],
2411 cflags: [
2412 "-Wall",
2413 "-Werror",
2414 ],
2415 shared: {
2416 shared_libs: ["libbase"],
2417 },
2418 static: {
2419 static_libs: ["libbase"],
2420 },
2421}