blob: 22678f1dd1e4b1a6548810966b46053aec4a3b8e [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",
271 ],
Colin Cross6ab8f892015-11-23 14:12:15 -0800272 atom: {
273 exclude_srcs: [
274 "upstream-freebsd/lib/libc/string/wmemcmp.c",
275 ],
276 },
277 ssse3: {
278 exclude_srcs: [
279 "upstream-freebsd/lib/libc/string/wcscat.c",
280 "upstream-freebsd/lib/libc/string/wcscpy.c",
281 ],
282 },
283 sse4: {
284 exclude_srcs: [
285 "upstream-freebsd/lib/libc/string/wmemcmp.c",
286 ],
287 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700288 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700289 },
290
Colin Cross50c21ab2015-10-31 23:03:05 -0700291 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700292 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700293 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700294 "-include freebsd-compat.h",
295 ],
296
Dan Willemsen208ae172015-09-16 16:33:27 -0700297 local_include_dirs: [
298 "upstream-freebsd/android/include",
299 ],
300
301 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700302}
303
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700304cc_library_static {
305 defaults: ["libc_defaults"],
306 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700307 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700308 "upstream-freebsd/lib/libc/stdlib/realpath.c",
309 ],
310
311 cflags: [
312 "-Wno-sign-compare",
313 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700314 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700315 ],
316
317 local_include_dirs: [
318 "upstream-freebsd/android/include",
319 ],
320
321 name: "libc_freebsd_large_stack",
322}
323
Dan Willemsen208ae172015-09-16 16:33:27 -0700324// ========================================================
325// libc_netbsd.a - upstream NetBSD C library code
326// ========================================================
327//
328// These files are built with the netbsd-compat.h header file
329// automatically included.
330
331cc_library_static {
332
Colin Cross50c21ab2015-10-31 23:03:05 -0700333 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700334 srcs: [
335 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700336 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700337 "upstream-netbsd/lib/libc/gen/psignal.c",
338 "upstream-netbsd/lib/libc/gen/utime.c",
339 "upstream-netbsd/lib/libc/gen/utmp.c",
340 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
341 "upstream-netbsd/lib/libc/regex/regcomp.c",
342 "upstream-netbsd/lib/libc/regex/regerror.c",
343 "upstream-netbsd/lib/libc/regex/regexec.c",
344 "upstream-netbsd/lib/libc/regex/regfree.c",
345 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
346 "upstream-netbsd/lib/libc/stdlib/div.c",
347 "upstream-netbsd/lib/libc/stdlib/drand48.c",
348 "upstream-netbsd/lib/libc/stdlib/erand48.c",
349 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
350 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
351 "upstream-netbsd/lib/libc/stdlib/ldiv.c",
352 "upstream-netbsd/lib/libc/stdlib/lldiv.c",
353 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
354 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
355 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
356 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
357 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
358 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
359 "upstream-netbsd/lib/libc/stdlib/seed48.c",
360 "upstream-netbsd/lib/libc/stdlib/srand48.c",
361 "upstream-netbsd/lib/libc/string/memccpy.c",
362 "upstream-netbsd/lib/libc/string/strcasestr.c",
363 "upstream-netbsd/lib/libc/string/strcoll.c",
364 "upstream-netbsd/lib/libc/string/strxfrm.c",
365 ],
366 multilib: {
367 lib32: {
368 // LP32 cruft
369 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
370 },
371 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700372 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700373 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800374 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700375 "-DPOSIX_MISTAKE",
376 "-include netbsd-compat.h",
377 ],
378
Dan Willemsen208ae172015-09-16 16:33:27 -0700379 local_include_dirs: [
380 "upstream-netbsd/android/include",
381 "upstream-netbsd/lib/libc/include",
382 ],
383
384 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700385}
386
387// ========================================================
388// libc_openbsd_ndk.a - upstream OpenBSD C library code
389// that can be safely included in the libc_ndk.a (doesn't
390// contain any troublesome global data or constructors).
391// ========================================================
392//
393// These files are built with the openbsd-compat.h header file
394// automatically included.
395
396cc_library_static {
397 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700398 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700399 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700400 "upstream-openbsd/lib/libc/gen/alarm.c",
401 "upstream-openbsd/lib/libc/gen/ctype_.c",
402 "upstream-openbsd/lib/libc/gen/daemon.c",
403 "upstream-openbsd/lib/libc/gen/err.c",
404 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700405 "upstream-openbsd/lib/libc/gen/fnmatch.c",
406 "upstream-openbsd/lib/libc/gen/ftok.c",
407 "upstream-openbsd/lib/libc/gen/getprogname.c",
408 "upstream-openbsd/lib/libc/gen/isctype.c",
409 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700410 "upstream-openbsd/lib/libc/gen/tolower_.c",
411 "upstream-openbsd/lib/libc/gen/toupper_.c",
412 "upstream-openbsd/lib/libc/gen/verr.c",
413 "upstream-openbsd/lib/libc/gen/verrx.c",
414 "upstream-openbsd/lib/libc/gen/vwarn.c",
415 "upstream-openbsd/lib/libc/gen/vwarnx.c",
416 "upstream-openbsd/lib/libc/gen/warn.c",
417 "upstream-openbsd/lib/libc/gen/warnx.c",
418 "upstream-openbsd/lib/libc/locale/btowc.c",
419 "upstream-openbsd/lib/libc/locale/mbrlen.c",
420 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
421 "upstream-openbsd/lib/libc/locale/mbtowc.c",
422 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700423 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
424 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700425 "upstream-openbsd/lib/libc/locale/wcstoll.c",
426 "upstream-openbsd/lib/libc/locale/wcstombs.c",
427 "upstream-openbsd/lib/libc/locale/wcstoul.c",
428 "upstream-openbsd/lib/libc/locale/wcstoull.c",
429 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
430 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
431 "upstream-openbsd/lib/libc/locale/wctob.c",
432 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700433 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700434 "upstream-openbsd/lib/libc/net/htonl.c",
435 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700436 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
437 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
438 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700439 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
440 "upstream-openbsd/lib/libc/net/inet_ntop.c",
441 "upstream-openbsd/lib/libc/net/inet_pton.c",
442 "upstream-openbsd/lib/libc/net/ntohl.c",
443 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800444 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700445 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700446 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
447 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700448 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700449 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700450 "upstream-openbsd/lib/libc/stdio/fputwc.c",
451 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700452 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700453 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700454 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700455 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700456 "upstream-openbsd/lib/libc/stdio/makebuf.c",
457 "upstream-openbsd/lib/libc/stdio/mktemp.c",
458 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
459 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700460 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700461 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700462 "upstream-openbsd/lib/libc/stdio/tempnam.c",
463 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
464 "upstream-openbsd/lib/libc/stdio/ungetc.c",
465 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
466 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
467 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700468 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
469 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
470 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700471 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700472 "upstream-openbsd/lib/libc/stdio/wsetup.c",
473 "upstream-openbsd/lib/libc/stdlib/abs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700474 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700475 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700476 "upstream-openbsd/lib/libc/stdlib/insque.c",
477 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
478 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
479 "upstream-openbsd/lib/libc/stdlib/labs.c",
480 "upstream-openbsd/lib/libc/stdlib/llabs.c",
481 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700482 "upstream-openbsd/lib/libc/stdlib/remque.c",
483 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700484 "upstream-openbsd/lib/libc/stdlib/tfind.c",
485 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
486 "upstream-openbsd/lib/libc/string/strcasecmp.c",
487 "upstream-openbsd/lib/libc/string/strcspn.c",
488 "upstream-openbsd/lib/libc/string/strdup.c",
489 "upstream-openbsd/lib/libc/string/strndup.c",
490 "upstream-openbsd/lib/libc/string/strpbrk.c",
491 "upstream-openbsd/lib/libc/string/strsep.c",
492 "upstream-openbsd/lib/libc/string/strspn.c",
493 "upstream-openbsd/lib/libc/string/strstr.c",
494 "upstream-openbsd/lib/libc/string/strtok.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700495 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700496 "upstream-openbsd/lib/libc/string/wcswidth.c",
497 ],
498
Colin Cross50c21ab2015-10-31 23:03:05 -0700499 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700500 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700501 "-Wno-unused-parameter",
502 "-include openbsd-compat.h",
503 ],
504
Dan Willemsen208ae172015-09-16 16:33:27 -0700505 local_include_dirs: [
506 "private",
507 "stdio",
508 "upstream-openbsd/android/include",
509 "upstream-openbsd/lib/libc/include",
510 "upstream-openbsd/lib/libc/gdtoa/",
511 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700512}
513
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700514cc_library_static {
515 name: "libc_openbsd_large_stack",
516 defaults: ["libc_defaults"],
517 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700518 "stdio/vfprintf.cpp",
519 "stdio/vfwprintf.cpp",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700520 ],
521 cflags: [
522 "-include openbsd-compat.h",
523 "-Wno-sign-compare",
524 "-Wframe-larger-than=5000",
525 ],
526
527 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700528 "upstream-openbsd/android/include/",
529 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700530 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700531 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700532 ],
533}
534
Dan Willemsen208ae172015-09-16 16:33:27 -0700535// ========================================================
536// libc_openbsd.a - upstream OpenBSD C library code
537// ========================================================
538//
539// These files are built with the openbsd-compat.h header file
540// automatically included.
541cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700542 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700543 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800544 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/crypt/arc4random.c",
546 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
547
548 // May be overriden by per-arch optimized versions
549 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700550 "upstream-openbsd/lib/libc/string/memrchr.c",
551 "upstream-openbsd/lib/libc/string/stpcpy.c",
552 "upstream-openbsd/lib/libc/string/stpncpy.c",
553 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700554 "upstream-openbsd/lib/libc/string/strcpy.c",
555 "upstream-openbsd/lib/libc/string/strlcat.c",
556 "upstream-openbsd/lib/libc/string/strlcpy.c",
557 "upstream-openbsd/lib/libc/string/strncat.c",
558 "upstream-openbsd/lib/libc/string/strncmp.c",
559 "upstream-openbsd/lib/libc/string/strncpy.c",
560 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700561
562 arch: {
563 arm: {
564 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700565 "upstream-openbsd/lib/libc/string/strcpy.c",
566 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800567 neon: {
Christopher Ferris950a9582017-03-29 13:10:56 -0700568 exclude_srcs: [
Christopher Ferris950a9582017-03-29 13:10:56 -0700569 "upstream-openbsd/lib/libc/string/stpcpy.c",
570 "upstream-openbsd/lib/libc/string/strcat.c",
571 ],
572 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700573 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700574 arm64: {
575 exclude_srcs: [
576 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700577 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700578 "upstream-openbsd/lib/libc/string/strcpy.c",
579 "upstream-openbsd/lib/libc/string/strncmp.c",
580 ],
581 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530582 mips: {
583 exclude_srcs: [
584 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530585 "upstream-openbsd/lib/libc/string/strcpy.c",
586 "upstream-openbsd/lib/libc/string/strncmp.c",
587 ],
588 },
589 mips64: {
590 exclude_srcs: [
591 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530592 "upstream-openbsd/lib/libc/string/strcpy.c",
593 "upstream-openbsd/lib/libc/string/strncmp.c",
594 ],
595 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700596 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800597 exclude_srcs: [
598 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800599 "upstream-openbsd/lib/libc/string/memrchr.c",
600 "upstream-openbsd/lib/libc/string/stpcpy.c",
601 "upstream-openbsd/lib/libc/string/stpncpy.c",
602 "upstream-openbsd/lib/libc/string/strcat.c",
603 "upstream-openbsd/lib/libc/string/strcpy.c",
604 "upstream-openbsd/lib/libc/string/strncmp.c",
605 "upstream-openbsd/lib/libc/string/strncpy.c",
606 ],
607 ssse3: {
608 exclude_srcs: [
609 "upstream-openbsd/lib/libc/string/strlcat.c",
610 "upstream-openbsd/lib/libc/string/strlcpy.c",
611 "upstream-openbsd/lib/libc/string/strncat.c",
612 ],
613 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700614 },
615
616 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800617 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800618 "upstream-openbsd/lib/libc/string/stpcpy.c",
619 "upstream-openbsd/lib/libc/string/stpncpy.c",
620 "upstream-openbsd/lib/libc/string/strcat.c",
621 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800622 "upstream-openbsd/lib/libc/string/strncat.c",
623 "upstream-openbsd/lib/libc/string/strncmp.c",
624 "upstream-openbsd/lib/libc/string/strncpy.c",
625 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700626 },
627 },
628
Colin Cross50c21ab2015-10-31 23:03:05 -0700629 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700630 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700631 "-Wno-unused-parameter",
632 "-include openbsd-compat.h",
633 ],
634
Dan Willemsen208ae172015-09-16 16:33:27 -0700635 local_include_dirs: [
636 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700637 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700638 ],
639
640 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700641}
642
643// ========================================================
644// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
645// ========================================================
646//
647// These files are built with the openbsd-compat.h header file
648// automatically included.
649
650cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700651 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700652 srcs: [
653 "upstream-openbsd/android/gdtoa_support.cpp",
654 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
655 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
656 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
657 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
658 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
659 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
660 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
661 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
662 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
663 "upstream-openbsd/lib/libc/gdtoa/misc.c",
664 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
665 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
666 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
667 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
668 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
669 "upstream-openbsd/lib/libc/gdtoa/sum.c",
670 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
671 ],
672 multilib: {
673 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800674 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700675 },
676 },
677
Colin Cross50c21ab2015-10-31 23:03:05 -0700678 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700679 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700680 "-include openbsd-compat.h",
681 ],
682
Dan Willemsen208ae172015-09-16 16:33:27 -0700683 local_include_dirs: [
684 "private",
685 "upstream-openbsd/android/include",
686 "upstream-openbsd/lib/libc/include",
687 ],
688
689 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700690}
691
692// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700693// libc_fortify.a - container for our FORITFY
694// implementation details
695// ========================================================
696cc_library_static {
697 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700698 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700699
700 name: "libc_fortify",
701
702 // Disable FORTIFY for the compilation of these, so we don't end up having
703 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800704 cflags: [
705 "-U_FORTIFY_SOURCE",
706 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
707 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700708
709 arch: {
710 arm: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700711 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700712 srcs: [
713 "arch-arm/generic/bionic/__memcpy_chk.S",
714 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800715 neon: {
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800716 cflags: [
717 "-DNO___STRCAT_CHK",
718 "-DNO___STRCPY_CHK",
719 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700720 srcs: [
721 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
722 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
723 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700724 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800725 cortex_a7: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700726 srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800727 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
728 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
729 ],
730 exclude_srcs: [
George Burgess IV6cb06872017-07-21 13:28:42 -0700731 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
732 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
733 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700734 },
735 cortex_a9: {
736 srcs: [
737 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
738 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
739 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800740 exclude_srcs: [
741 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
742 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
743 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700744 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800745 krait: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700746 srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800747 "arch-arm/krait/bionic/__strcat_chk.S",
748 "arch-arm/krait/bionic/__strcpy_chk.S",
749 ],
750 exclude_srcs: [
751 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
752 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
753 ],
754 },
755 cortex_a53: {
756 srcs: [
757 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
758 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
759 ],
760 exclude_srcs: [
George Burgess IV6cb06872017-07-21 13:28:42 -0700761 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
762 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
763 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700764 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700765 cortex_a55: {
766 srcs: [
767 "arch-arm/denver/bionic/__strcat_chk.S",
768 "arch-arm/denver/bionic/__strcpy_chk.S",
769 ],
770 exclude_srcs: [
771 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
772 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
773 ],
774 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700775 cortex_a73: {
776 srcs: [
777 "arch-arm/denver/bionic/__strcat_chk.S",
778 "arch-arm/denver/bionic/__strcpy_chk.S",
779 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800780 exclude_srcs: [
781 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
782 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
783 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700784 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700785 cortex_a75: {
786 srcs: [
787 "arch-arm/denver/bionic/__strcat_chk.S",
788 "arch-arm/denver/bionic/__strcpy_chk.S",
789 ],
790 exclude_srcs: [
791 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
792 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
793 ],
794 },
Haibo Huangbc4f4112018-10-10 13:46:48 -0700795 cortex_a76: {
796 srcs: [
797 "arch-arm/denver/bionic/__strcat_chk.S",
798 "arch-arm/denver/bionic/__strcpy_chk.S",
799 ],
800 exclude_srcs: [
801 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
802 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
803 ],
804 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700805 denver: {
806 srcs: [
807 "arch-arm/denver/bionic/__strcat_chk.S",
808 "arch-arm/denver/bionic/__strcpy_chk.S",
809 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800810 exclude_srcs: [
811 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
812 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
813 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700814 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800815 kryo: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700816 srcs: [
817 "arch-arm/krait/bionic/__strcat_chk.S",
818 "arch-arm/krait/bionic/__strcpy_chk.S",
819 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800820 exclude_srcs: [
821 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
822 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700823 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700824 },
825 },
826 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700827 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700828 srcs: [
829 "arch-arm64/generic/bionic/__memcpy_chk.S",
830 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700831 },
832 },
833}
834
835// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700836// libc_bionic.a - home-grown C library code
837// ========================================================
838
839cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700840 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700841 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700842 // The data that backs getauxval is initialized in the libc init
843 // functions which are invoked by the linker. If this file is included
844 // in libc_ndk.a, only one of the copies of the global data will be
845 // initialized, resulting in nullptr dereferences.
846 "bionic/getauxval.cpp",
847
Elliott Hughes211c4d32018-02-02 15:10:32 -0800848 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700849 "bionic/sysconf.cpp",
850 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700851 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700852
Josh Gao10ec9282017-04-03 15:13:29 -0700853 // The following must not be statically linked into libc_ndk.a, because
854 // debuggerd will look for the abort message in libc.so's copy.
855 "bionic/android_set_abort_message.cpp",
856
Dan Willemsen208ae172015-09-16 16:33:27 -0700857 "bionic/strchr.cpp",
858 "bionic/strnlen.c",
859 "bionic/strrchr.cpp",
860 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700861
862 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700863 arm: {
864 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800865 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700866 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800867 "arch-arm/generic/bionic/memset.S",
868 "arch-arm/generic/bionic/strcmp.S",
869 "arch-arm/generic/bionic/strcpy.S",
870 "arch-arm/generic/bionic/strlen.c",
871
Dan Willemsen208ae172015-09-16 16:33:27 -0700872 "arch-arm/bionic/atomics_arm.c",
873 "arch-arm/bionic/__bionic_clone.S",
874 "arch-arm/bionic/_exit_with_stack_teardown.S",
875 "arch-arm/bionic/libgcc_compat.c",
876 "arch-arm/bionic/popcount_tab.c",
877 "arch-arm/bionic/__restore.S",
878 "arch-arm/bionic/setjmp.S",
879 "arch-arm/bionic/syscall.S",
880 "arch-arm/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700881 ],
Colin Cross6ab8f892015-11-23 14:12:15 -0800882 cortex_a7: {
883 srcs: [
Christopher Ferrisecebb492016-11-28 11:09:49 -0800884 "arch-arm/cortex-a7/bionic/memcpy.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700885 "arch-arm/cortex-a7/bionic/memset.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800886 ],
887 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800888 "arch-arm/cortex-a15/bionic/memcpy.S",
889 "arch-arm/cortex-a15/bionic/memset.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800890 ],
891 },
892 cortex_a9: {
893 srcs: [
894 "arch-arm/cortex-a9/bionic/memcpy.S",
895 "arch-arm/cortex-a9/bionic/memset.S",
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800896
Colin Cross6ab8f892015-11-23 14:12:15 -0800897 "arch-arm/cortex-a9/bionic/stpcpy.S",
898 "arch-arm/cortex-a9/bionic/strcat.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800899 "arch-arm/cortex-a9/bionic/strcmp.S",
900 "arch-arm/cortex-a9/bionic/strcpy.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800901 "arch-arm/cortex-a9/bionic/strlen.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800902 ],
903 exclude_srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800904 "arch-arm/cortex-a15/bionic/memcpy.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700905 "arch-arm/cortex-a15/bionic/memset.S",
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800906
Colin Cross6ab8f892015-11-23 14:12:15 -0800907 "arch-arm/cortex-a15/bionic/stpcpy.S",
908 "arch-arm/cortex-a15/bionic/strcat.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800909 "arch-arm/cortex-a15/bionic/strcmp.S",
910 "arch-arm/cortex-a15/bionic/strcpy.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800911 "arch-arm/cortex-a15/bionic/strlen.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800912 ],
913 },
914 krait: {
915 srcs: [
916 "arch-arm/krait/bionic/memcpy.S",
917 "arch-arm/krait/bionic/memset.S",
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800918
Colin Cross6ab8f892015-11-23 14:12:15 -0800919 "arch-arm/krait/bionic/strcmp.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800920 ],
921 exclude_srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800922 "arch-arm/cortex-a15/bionic/memset.S",
923 "arch-arm/cortex-a15/bionic/memcpy.S",
924
925 "arch-arm/cortex-a15/bionic/strcmp.S",
926 ],
927 },
928 cortex_a53: {
929 srcs: [
930 "arch-arm/cortex-a53/bionic/memcpy.S",
931 "arch-arm/cortex-a7/bionic/memset.S",
932 ],
933 exclude_srcs: [
934 "arch-arm/cortex-a15/bionic/memset.S",
935 "arch-arm/cortex-a15/bionic/memcpy.S",
936 ],
937 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700938 cortex_a55: {
939 srcs: [
940 "arch-arm/cortex-a7/bionic/memset.S",
941 "arch-arm/denver/bionic/memcpy.S",
942
943 "arch-arm/krait/bionic/strcmp.S",
944 ],
945 exclude_srcs: [
946 "arch-arm/cortex-a15/bionic/memset.S",
947 "arch-arm/cortex-a15/bionic/memcpy.S",
948 "arch-arm/cortex-a15/bionic/strcmp.S",
949 ],
950 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800951 cortex_a73: {
952 srcs: [
953 "arch-arm/cortex-a7/bionic/memset.S",
954 "arch-arm/denver/bionic/memcpy.S",
955
956 "arch-arm/krait/bionic/strcmp.S",
957 ],
958 exclude_srcs: [
959 "arch-arm/cortex-a15/bionic/memset.S",
960 "arch-arm/cortex-a15/bionic/memcpy.S",
961 "arch-arm/cortex-a15/bionic/strcmp.S",
962 ],
963 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700964 cortex_a75: {
965 srcs: [
966 "arch-arm/cortex-a7/bionic/memset.S",
967 "arch-arm/denver/bionic/memcpy.S",
968
969 "arch-arm/krait/bionic/strcmp.S",
970 ],
971 exclude_srcs: [
972 "arch-arm/cortex-a15/bionic/memset.S",
973 "arch-arm/cortex-a15/bionic/memcpy.S",
974 "arch-arm/cortex-a15/bionic/strcmp.S",
975 ],
976 },
Haibo Huangbc4f4112018-10-10 13:46:48 -0700977 cortex_a76: {
978 srcs: [
979 "arch-arm/cortex-a7/bionic/memset.S",
980 "arch-arm/denver/bionic/memcpy.S",
981
982 "arch-arm/krait/bionic/strcmp.S",
983 ],
984 exclude_srcs: [
985 "arch-arm/cortex-a15/bionic/memset.S",
986 "arch-arm/cortex-a15/bionic/memcpy.S",
987 "arch-arm/cortex-a15/bionic/strcmp.S",
988 ],
989 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800990 denver: {
991 srcs: [
992 "arch-arm/denver/bionic/memcpy.S",
993 "arch-arm/denver/bionic/memset.S",
994 ],
995 exclude_srcs: [
996 "arch-arm/cortex-a15/bionic/memset.S",
997 "arch-arm/cortex-a15/bionic/memcpy.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800998 ],
999 },
Christopher Ferris950a9582017-03-29 13:10:56 -07001000 kryo: {
1001 srcs: [
Jake Weinstein04d99df2016-08-25 20:03:25 -04001002 "arch-arm/kryo/bionic/memcpy.S",
Jake Weinstein4d114f92017-04-07 14:55:53 -04001003 "arch-arm/cortex-a7/bionic/memset.S",
Colin Cross6ab8f892015-11-23 14:12:15 -08001004
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001005 "arch-arm/krait/bionic/strcmp.S",
1006 ],
1007 exclude_srcs: [
1008 "arch-arm/cortex-a15/bionic/memset.S",
1009 "arch-arm/cortex-a15/bionic/memcpy.S",
1010 "arch-arm/cortex-a15/bionic/strcmp.S",
1011 ],
1012 },
1013 // Cores not listed above (like cortex-a8, cortex-a15) or
1014 // "generic" core will use the following implementation.
1015 neon: {
1016 srcs: [
1017 "arch-arm/cortex-a15/bionic/memcpy.S",
1018 "arch-arm/cortex-a15/bionic/memset.S",
1019
Christopher Ferris950a9582017-03-29 13:10:56 -07001020 "arch-arm/cortex-a15/bionic/stpcpy.S",
1021 "arch-arm/cortex-a15/bionic/strcat.S",
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001022 "arch-arm/cortex-a15/bionic/strcmp.S",
Christopher Ferris950a9582017-03-29 13:10:56 -07001023 "arch-arm/cortex-a15/bionic/strcpy.S",
1024 "arch-arm/cortex-a15/bionic/strlen.S",
1025
1026 "arch-arm/denver/bionic/memmove.S",
1027 ],
1028 exclude_srcs: [
1029 "arch-arm/generic/bionic/memcpy.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -07001030 "arch-arm/generic/bionic/memmove.S",
Christopher Ferris950a9582017-03-29 13:10:56 -07001031 "arch-arm/generic/bionic/memset.S",
1032 "arch-arm/generic/bionic/strcmp.S",
1033 "arch-arm/generic/bionic/strcpy.S",
1034 "arch-arm/generic/bionic/strlen.c",
Christopher Ferris950a9582017-03-29 13:10:56 -07001035 ],
1036 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001037 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001038 arm64: {
1039 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001040 "arch-arm64/generic/bionic/memchr.S",
1041 "arch-arm64/generic/bionic/memcmp.S",
1042 "arch-arm64/generic/bionic/memcpy.S",
1043 "arch-arm64/generic/bionic/memmove.S",
1044 "arch-arm64/generic/bionic/memset.S",
1045 "arch-arm64/generic/bionic/stpcpy.S",
1046 "arch-arm64/generic/bionic/strchr.S",
1047 "arch-arm64/generic/bionic/strcmp.S",
1048 "arch-arm64/generic/bionic/strcpy.S",
1049 "arch-arm64/generic/bionic/strlen.S",
1050 "arch-arm64/generic/bionic/strncmp.S",
1051 "arch-arm64/generic/bionic/strnlen.S",
1052 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001053
1054 "arch-arm64/bionic/__bionic_clone.S",
1055 "arch-arm64/bionic/_exit_with_stack_teardown.S",
1056 "arch-arm64/bionic/setjmp.S",
1057 "arch-arm64/bionic/syscall.S",
1058 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001059 ],
1060 exclude_srcs: [
1061 "bionic/__memcpy_chk.cpp",
1062 "bionic/strchr.cpp",
1063 "bionic/strnlen.c",
1064 ],
Colin Cross6ab8f892015-11-23 14:12:15 -08001065 denver64: {
1066 srcs: [
1067 "arch-arm64/denver64/bionic/memcpy.S",
Haibo Huangece43e12018-05-26 13:07:43 -07001068 "arch-arm64/denver64/bionic/memmove.S",
Colin Cross6ab8f892015-11-23 14:12:15 -08001069 "arch-arm64/denver64/bionic/memset.S",
1070 ],
1071 exclude_srcs: [
1072 "arch-arm64/generic/bionic/memcpy.S",
Haibo Huangece43e12018-05-26 13:07:43 -07001073 "arch-arm64/generic/bionic/memmove.S",
Colin Cross6ab8f892015-11-23 14:12:15 -08001074 "arch-arm64/generic/bionic/memset.S",
1075 ],
1076 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001077 },
1078
1079 mips: {
1080 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001081 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301082 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -08001083 "arch-mips/string/memset.S",
1084 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301085 "arch-mips/string/strncmp.S",
1086 "arch-mips/string/strlen.c",
1087 "arch-mips/string/strnlen.c",
1088 "arch-mips/string/strchr.c",
1089 "arch-mips/string/strcpy.c",
1090 "arch-mips/string/memchr.c",
1091 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -08001092
Dan Willemsen208ae172015-09-16 16:33:27 -07001093 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001094 "arch-mips/bionic/cacheflush.cpp",
1095 "arch-mips/bionic/_exit_with_stack_teardown.S",
Dan Willemsen879cec22016-02-29 10:37:56 -08001096 "arch-mips/bionic/libgcc_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001097 "arch-mips/bionic/setjmp.S",
1098 "arch-mips/bionic/syscall.S",
1099 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001100 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +05301101 exclude_srcs: [
1102 "bionic/strchr.cpp",
1103 "bionic/strnlen.c",
1104 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001105 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001106 mips64: {
1107 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001108 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301109 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -08001110 "arch-mips/string/memset.S",
1111 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301112 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001113 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301114 "arch-mips/string/strnlen.c",
1115 "arch-mips/string/strchr.c",
1116 "arch-mips/string/strcpy.c",
1117 "arch-mips/string/memchr.c",
1118 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -08001119
Dan Willemsen208ae172015-09-16 16:33:27 -07001120 "arch-mips64/bionic/__bionic_clone.S",
1121 "arch-mips64/bionic/_exit_with_stack_teardown.S",
1122 "arch-mips64/bionic/setjmp.S",
1123 "arch-mips64/bionic/syscall.S",
1124 "arch-mips64/bionic/vfork.S",
1125 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001126 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +05301127 exclude_srcs: [
1128 "bionic/strchr.cpp",
1129 "bionic/strnlen.c",
1130 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001131 },
1132
1133 x86: {
1134 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001135 "arch-x86/generic/string/memcmp.S",
1136 "arch-x86/generic/string/strcmp.S",
1137 "arch-x86/generic/string/strncmp.S",
1138 "arch-x86/generic/string/strcat.S",
1139 "arch-x86/atom/string/sse2-memchr-atom.S",
1140 "arch-x86/atom/string/sse2-memrchr-atom.S",
1141 "arch-x86/atom/string/sse2-strchr-atom.S",
1142 "arch-x86/atom/string/sse2-strnlen-atom.S",
1143 "arch-x86/atom/string/sse2-strrchr-atom.S",
1144 "arch-x86/atom/string/sse2-wcschr-atom.S",
1145 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
1146 "arch-x86/atom/string/sse2-wcslen-atom.S",
1147 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001148 "arch-x86/silvermont/string/sse2-memmove-slm.S",
1149 "arch-x86/silvermont/string/sse2-memset-slm.S",
1150 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
1151 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
1152 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
1153 "arch-x86/silvermont/string/sse2-strlen-slm.S",
1154 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001155
1156 "arch-x86/bionic/__bionic_clone.S",
1157 "arch-x86/bionic/_exit_with_stack_teardown.S",
1158 "arch-x86/bionic/libgcc_compat.c",
1159 "arch-x86/bionic/__restore.S",
1160 "arch-x86/bionic/setjmp.S",
1161 "arch-x86/bionic/syscall.S",
1162 "arch-x86/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001163 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001164
1165 exclude_srcs: [
1166 "bionic/strchr.cpp",
1167 "bionic/strnlen.c",
1168 "bionic/strrchr.cpp",
1169 ],
Colin Cross6ab8f892015-11-23 14:12:15 -08001170 atom: {
1171 srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -08001172 "arch-x86/atom/string/sse2-memset-atom.S",
1173 "arch-x86/atom/string/sse2-strlen-atom.S",
Colin Cross6ab8f892015-11-23 14:12:15 -08001174 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Dan Willemsen701b5452016-01-12 19:35:40 -08001175 "arch-x86/atom/string/ssse3-memcpy-atom.S",
Dan Willemsen701b5452016-01-12 19:35:40 -08001176 "arch-x86/atom/string/ssse3-strcpy-atom.S",
Colin Cross6ab8f892015-11-23 14:12:15 -08001177 "arch-x86/atom/string/ssse3-strncpy-atom.S",
1178 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
1179 ],
1180 exclude_srcs: [
1181 "arch-x86/generic/string/memcmp.S",
Colin Cross6ab8f892015-11-23 14:12:15 -08001182 "arch-x86/silvermont/string/sse2-memmove-slm.S",
1183 "arch-x86/silvermont/string/sse2-memset-slm.S",
1184 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
1185 "arch-x86/silvermont/string/sse2-strlen-slm.S",
1186 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
1187 ],
1188 },
1189 ssse3: {
1190 srcs: [
1191 "arch-x86/atom/string/ssse3-strncat-atom.S",
1192 "arch-x86/atom/string/ssse3-strlcat-atom.S",
1193 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
1194 "arch-x86/atom/string/ssse3-strcat-atom.S",
1195 "arch-x86/atom/string/ssse3-strcmp-atom.S",
1196 "arch-x86/atom/string/ssse3-strncmp-atom.S",
1197 "arch-x86/atom/string/ssse3-wcscat-atom.S",
1198 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
1199 ],
1200 exclude_srcs: [
1201 "arch-x86/generic/string/strcmp.S",
1202 "arch-x86/generic/string/strncmp.S",
1203 "arch-x86/generic/string/strcat.S",
1204 ],
1205 },
1206 sse4: {
1207 srcs: [
1208 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
1209 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
1210 ],
1211 exclude_srcs: [
1212 "arch-x86/generic/string/memcmp.S",
1213 ],
1214 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001215 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001216 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001217 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001218 "arch-x86_64/string/sse2-memmove-slm.S",
1219 "arch-x86_64/string/sse2-memset-slm.S",
1220 "arch-x86_64/string/sse2-stpcpy-slm.S",
1221 "arch-x86_64/string/sse2-stpncpy-slm.S",
1222 "arch-x86_64/string/sse2-strcat-slm.S",
1223 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001224 "arch-x86_64/string/sse2-strlen-slm.S",
1225 "arch-x86_64/string/sse2-strncat-slm.S",
1226 "arch-x86_64/string/sse2-strncpy-slm.S",
1227 "arch-x86_64/string/sse4-memcmp-slm.S",
1228 "arch-x86_64/string/ssse3-strcmp-slm.S",
1229 "arch-x86_64/string/ssse3-strncmp-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001230
1231 "arch-x86_64/bionic/__bionic_clone.S",
1232 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1233 "arch-x86_64/bionic/__restore_rt.S",
1234 "arch-x86_64/bionic/setjmp.S",
1235 "arch-x86_64/bionic/syscall.S",
1236 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001237 ],
1238 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001239 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001240
Colin Cross50c21ab2015-10-31 23:03:05 -07001241 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001242 include_dirs: ["bionic/libstdc++/include"],
1243 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001244}
1245
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001246genrule {
1247 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001248 out: ["generated_android_ids.h"],
1249 srcs: [":android_filesystem_config_header"],
1250 tool_files: ["fs_config_generator.py"],
1251 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001252}
1253
Dan Willemsen268a6732015-10-15 14:49:45 -07001254// ========================================================
1255// libc_bionic_ndk.a- The portions of libc_bionic that can
1256// be safely used in libc_ndk.a (no troublesome global data
1257// or constructors).
1258// ========================================================
1259cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001260 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001261 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001262 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001263 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001264 "bionic/__cmsg_nxthdr.cpp",
1265 "bionic/__errno.cpp",
1266 "bionic/__gnu_basename.cpp",
1267 "bionic/__libc_current_sigrtmax.cpp",
1268 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001269 "bionic/abort.cpp",
1270 "bionic/accept.cpp",
1271 "bionic/accept4.cpp",
1272 "bionic/access.cpp",
1273 "bionic/arpa_inet.cpp",
1274 "bionic/assert.cpp",
1275 "bionic/atof.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001276 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001277 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001278 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001279 "bionic/bionic_systrace.cpp",
1280 "bionic/bionic_time_conversions.cpp",
1281 "bionic/brk.cpp",
1282 "bionic/c16rtomb.cpp",
1283 "bionic/c32rtomb.cpp",
1284 "bionic/chmod.cpp",
1285 "bionic/chown.cpp",
1286 "bionic/clearenv.cpp",
1287 "bionic/clock.cpp",
1288 "bionic/clock_getcpuclockid.cpp",
1289 "bionic/clock_nanosleep.cpp",
1290 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001291 "bionic/connect.cpp",
1292 "bionic/ctype.cpp",
1293 "bionic/dirent.cpp",
1294 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001295 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001296 "bionic/error.cpp",
1297 "bionic/eventfd_read.cpp",
1298 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001299 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001300 "bionic/faccessat.cpp",
1301 "bionic/fchmod.cpp",
1302 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001303 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001304 "bionic/ffs.cpp",
1305 "bionic/fgetxattr.cpp",
1306 "bionic/flistxattr.cpp",
1307 "bionic/flockfile.cpp",
1308 "bionic/fpclassify.cpp",
1309 "bionic/fsetxattr.cpp",
1310 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001311 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001312 "bionic/futimens.cpp",
1313 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001314 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001315 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001316 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001317 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001318 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001319 "bionic/getpgrp.cpp",
1320 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001321 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001322 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001323 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001324 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001325 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001326 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001327 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001328 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001329 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001330 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001331 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001332 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001333 "bionic/lchown.cpp",
1334 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001335 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001336 "bionic/libgen.cpp",
1337 "bionic/link.cpp",
1338 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001339 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001340 "bionic/lstat.cpp",
1341 "bionic/malloc_info.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001342 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001343 "bionic/mbrtoc16.cpp",
1344 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001345 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001346 "bionic/mempcpy.cpp",
1347 "bionic/mkdir.cpp",
1348 "bionic/mkfifo.cpp",
1349 "bionic/mknod.cpp",
1350 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001351 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001352 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001353 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001354 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001355 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001356 "bionic/open.cpp",
1357 "bionic/pathconf.cpp",
1358 "bionic/pause.cpp",
1359 "bionic/pipe.cpp",
1360 "bionic/poll.cpp",
1361 "bionic/posix_fadvise.cpp",
1362 "bionic/posix_fallocate.cpp",
1363 "bionic/posix_madvise.cpp",
1364 "bionic/posix_timers.cpp",
1365 "bionic/ptrace.cpp",
1366 "bionic/pty.cpp",
1367 "bionic/raise.cpp",
1368 "bionic/rand.cpp",
1369 "bionic/readlink.cpp",
1370 "bionic/reboot.cpp",
1371 "bionic/recv.cpp",
1372 "bionic/rename.cpp",
1373 "bionic/rmdir.cpp",
1374 "bionic/scandir.cpp",
1375 "bionic/sched_getaffinity.cpp",
1376 "bionic/sched_getcpu.cpp",
1377 "bionic/semaphore.cpp",
1378 "bionic/send.cpp",
1379 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001380 "bionic/seteuid.cpp",
1381 "bionic/setpgrp.cpp",
1382 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001383 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001384 "bionic/sigprocmask.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001385 "bionic/socket.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001386 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001387 "bionic/stat.cpp",
1388 "bionic/statvfs.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001389 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001390 "bionic/strchrnul.cpp",
1391 "bionic/strerror.cpp",
1392 "bionic/strerror_r.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001393 "bionic/string_l.cpp",
1394 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001395 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001396 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001397 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001398 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001399 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001400 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001401 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001402 "bionic/sys_msg.cpp",
1403 "bionic/sys_sem.cpp",
1404 "bionic/sys_shm.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001405 "bionic/sys_siglist.c",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001406 "bionic/sys_signalfd.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001407 "bionic/sys_signame.c",
Elliott Hughes449eff02016-06-08 19:51:20 -07001408 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001409 "bionic/sysinfo.cpp",
1410 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001411 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001412 "bionic/system_property_api.cpp",
1413 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001414 "bionic/tdestroy.cpp",
1415 "bionic/termios.cpp",
1416 "bionic/thread_private.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001417 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001418 "bionic/tmpfile.cpp",
1419 "bionic/umount.cpp",
1420 "bionic/unlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001421 "bionic/wait.cpp",
1422 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001423 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001424 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001425 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001426 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001427 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001428
1429 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1430 // which will be overridden by the actual one in libc.so.
1431 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001432 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001433
Dan Willemsen208ae172015-09-16 16:33:27 -07001434 multilib: {
1435 lib32: {
1436 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001437 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001438 },
1439 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001440 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001441 treble_linker_namespaces: {
1442 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001443 },
1444 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001445 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001446 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001447 local_include_dirs: ["stdio"],
1448 include_dirs: ["bionic/libstdc++/include"],
1449 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001450 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001451}
1452
Dan Willemsen208ae172015-09-16 16:33:27 -07001453// ========================================================
1454// libc_pthread.a - pthreads parts that previously lived in
1455// libc_bionic.a. Relocated to their own library because
1456// they can't be included in libc_ndk.a (as they layout of
1457// pthread_t has changed over the years and has ABI
1458// compatibility issues).
1459// ========================================================
1460
1461cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001462 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001463 srcs: [
1464 "bionic/pthread_atfork.cpp",
1465 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001466 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001467 "bionic/pthread_cond.cpp",
1468 "bionic/pthread_create.cpp",
1469 "bionic/pthread_detach.cpp",
1470 "bionic/pthread_equal.cpp",
1471 "bionic/pthread_exit.cpp",
1472 "bionic/pthread_getcpuclockid.cpp",
1473 "bionic/pthread_getschedparam.cpp",
1474 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001475 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001476 "bionic/pthread_join.cpp",
1477 "bionic/pthread_key.cpp",
1478 "bionic/pthread_kill.cpp",
1479 "bionic/pthread_mutex.cpp",
1480 "bionic/pthread_once.cpp",
1481 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001482 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001483 "bionic/pthread_self.cpp",
1484 "bionic/pthread_setname_np.cpp",
1485 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001486 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001487
1488 // The following implementations depend on pthread data or implementation,
1489 // so we can't include them in libc_ndk.a.
1490 "bionic/__cxa_thread_atexit_impl.cpp",
1491 "stdlib/atexit.c",
1492 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001493 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001494
Colin Cross50c21ab2015-10-31 23:03:05 -07001495 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001496 include_dirs: ["bionic/libstdc++/include"],
1497 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001498}
1499
1500// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001501// libc_syscalls.a
1502// ========================================================
1503
1504cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001505 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001506 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001507 arch: {
1508 arm: {
1509 srcs: ["arch-arm/syscalls/**/*.S"],
1510 },
1511 arm64: {
1512 srcs: ["arch-arm64/syscalls/**/*.S"],
1513 },
1514 mips: {
1515 srcs: ["arch-mips/syscalls/**/*.S"],
1516 },
1517 mips64: {
1518 srcs: ["arch-mips64/syscalls/**/*.S"],
1519 },
1520 x86: {
1521 srcs: ["arch-x86/syscalls/**/*.S"],
1522 },
1523 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001524 srcs: ["arch-x86_64/syscalls/**/*.S"],
1525 },
1526 },
1527 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001528}
1529
1530// ========================================================
1531// libc_aeabi.a
1532// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1533// to avoid infinite recursion. For the other architectures we just build an
1534// empty library to keep this makefile simple.
1535// ========================================================
1536
1537cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001538 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001539 arch: {
1540 arm: {
1541 srcs: ["arch-arm/bionic/__aeabi.c"],
1542 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001543 },
1544 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001545 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001546}
1547
1548// ========================================================
1549// libc_ndk.a
1550// Compatibility library for the NDK. This library contains
1551// all the parts of libc that are safe to statically link.
1552// We can't safely statically link things that can only run
1553// on a certain version of the OS. Examples include
1554// anything that talks to netd (a large portion of the DNS
1555// code) and anything that is dependent on the layout of a
1556// data structure that has changed across releases (such as
1557// pthread_t).
1558// ========================================================
1559
1560cc_library_static {
1561 name: "libc_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001562 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001563 srcs: libc_common_src_files + ["bionic/malloc_common.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001564 multilib: {
1565 lib32: {
1566 srcs: libc_common_src_files_32,
1567 },
1568 },
1569 arch: {
1570 arm: {
1571 srcs: [
1572 "arch-arm/bionic/exidx_dynamic.c",
1573 "arch-common/bionic/crtbegin_so.c",
1574 "arch-arm/bionic/atexit_legacy.c",
1575 "arch-common/bionic/crtend_so.S",
1576 ],
1577 whole_static_libs: ["libc_aeabi"],
1578 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001579 },
1580
Colin Cross50c21ab2015-10-31 23:03:05 -07001581 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001582 "-fvisibility=hidden",
1583 "-DLIBC_STATIC",
1584 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001585
1586 whole_static_libs: [
1587 "libc_bionic_ndk",
George Burgess IV6cb06872017-07-21 13:28:42 -07001588 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001589 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001590 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001591 "libc_gdtoa",
1592 "libc_malloc",
1593 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001594 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001595 "libc_openbsd_ndk",
1596 "libc_stack_protector",
1597 "libc_syscalls",
1598 "libc_tzcode",
1599 "libm",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001600 "libjemalloc5",
Elliott Hughes816fab92016-05-27 17:57:46 -07001601 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001602 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001603}
1604
1605// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001606// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001607// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001608cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001609 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001610 srcs: libc_common_src_files,
1611 multilib: {
1612 lib32: {
1613 srcs: libc_common_src_files_32,
1614 },
1615 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001616 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001617
1618 whole_static_libs: [
1619 "libc_bionic",
1620 "libc_bionic_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001621 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001622 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001623 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001624 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001625 "libc_gdtoa",
1626 "libc_malloc",
1627 "libc_netbsd",
1628 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001629 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001630 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001631 "libc_stack_protector",
1632 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001633 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001634 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001635 ],
1636
1637 arch: {
1638 arm: {
1639 whole_static_libs: ["libc_aeabi"],
1640 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001641 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001642}
1643
1644// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001645// libc_common.a
1646// ========================================================
1647
1648cc_library_static {
1649 defaults: ["libc_defaults"],
1650 name: "libc_common",
1651
1652 whole_static_libs: [
1653 "libc_nopthread",
1654 "libc_pthread",
1655 ],
1656}
1657
1658// ========================================================
Haibo Huangf71edfa2018-11-12 10:06:56 -08001659// libc_common_static.a For static binaries.
1660// ========================================================
1661cc_library_static {
1662 defaults: ["libc_defaults"],
1663 name: "libc_common_static",
1664
1665 whole_static_libs: [
1666 "libc_common",
1667 ],
1668}
1669
1670// ========================================================
1671// libc_common_shared.a For shared libraries.
1672// ========================================================
1673cc_library_static {
1674 defaults: ["libc_defaults"],
1675 name: "libc_common_shared",
1676
1677 whole_static_libs: [
1678 "libc_common",
1679 ],
1680}
1681
1682// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001683// libc_nomalloc.a
1684// ========================================================
1685//
1686// This is a version of the static C library that does not
1687// include malloc. It's useful in situations when the user wants
1688// to provide their own malloc implementation, or wants to
1689// explicitly disallow the use of malloc, such as in the
1690// dynamic linker.
1691
1692cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001693 name: "libc_nomalloc",
1694
Colin Cross50c21ab2015-10-31 23:03:05 -07001695 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001696
1697 arch: {
1698 arm: {
1699 srcs: ["arch-arm/bionic/exidx_static.c"],
1700 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001701 },
1702
Colin Cross50c21ab2015-10-31 23:03:05 -07001703 cflags: ["-DLIBC_STATIC"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001704
Colin Crossa3f9fca2016-01-11 13:20:55 -08001705 whole_static_libs: [
Haibo Huangf71edfa2018-11-12 10:06:56 -08001706 "libc_common_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001707 "libc_init_static",
1708 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001709}
1710
1711// ========================================================
1712// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1713// ========================================================
1714cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001715 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001716 srcs: ["bionic/jemalloc_wrapper.cpp"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001717 cflags: ["-fvisibility=hidden"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001718
Dan Willemsen208ae172015-09-16 16:33:27 -07001719 name: "libc_malloc",
Dan Willemsen208ae172015-09-16 16:33:27 -07001720}
1721
1722// ========================================================
1723// libc.a + libc.so
1724// ========================================================
1725cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001726 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001727 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001728 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001729 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001730 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001731 platform_sdk_version: {
1732 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1733 },
1734 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001735 static: {
1736 srcs: [
1737 "bionic/dl_iterate_phdr_static.cpp",
Dan Willemsen0c657082016-05-12 01:43:07 -07001738 "bionic/malloc_common.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001739 ],
1740 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001741 whole_static_libs: [
1742 "libc_init_static",
1743 "libc_common_static",
1744 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001745 },
1746 shared: {
1747 srcs: [
1748 "arch-common/bionic/crtbegin_so.c",
1749 "arch-common/bionic/crtbrand.S",
Elliott Hughesa57ca0d2016-11-17 18:18:08 -08001750 "bionic/icu.cpp",
Dan Willemsen0c657082016-05-12 01:43:07 -07001751 "bionic/malloc_common.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001752 "bionic/NetdClient.cpp",
1753 "arch-common/bionic/crtend_so.S",
1754 ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001755 whole_static_libs: [
1756 "libc_init_dynamic",
1757 "libc_common_shared",
1758 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001759 },
1760
1761 required: ["tzdata"],
1762
1763 // Leave the symbols in the shared library so that stack unwinders can produce
1764 // meaningful name resolution.
Colin Cross37f36322016-04-25 14:09:13 -07001765 strip: {
1766 keep_symbols: true,
1767 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001768
Colin Cross4ce94d22016-11-15 13:15:43 -08001769 // Do not pack libc.so relocations; see http://b/20645321 for details.
1770 pack_relocations: false,
1771
dimitry06016f22018-01-05 11:39:28 +01001772 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1773 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1774 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1775 // those new libraries from libgcc.a are not declared external; if that were the case,
1776 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1777 // on the external symbols from the dependent libraries. That would create a "cloaked"
1778 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001779
dimitry06016f22018-01-05 11:39:28 +01001780 shared_libs: [
1781 "ld-android",
1782 "libdl",
1783 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001784 whole_static_libs: [
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001785 "libjemalloc5",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001786 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001787
1788 nocrt: true,
1789
Dan Willemsen208ae172015-09-16 16:33:27 -07001790 arch: {
1791 arm: {
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001792 //TODO: This is to work around b/24465209. Remove after root cause is fixed
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001793 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001794 ldflags: ["-Wl,--hash-style=both"],
1795
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001796 // Don't re-export new/delete and friends, even if the compiler really wants to.
1797 version_script: "libc.arm.map",
1798
Dan Willemsen208ae172015-09-16 16:33:27 -07001799 shared: {
Dan Willemsen0c657082016-05-12 01:43:07 -07001800 srcs: [
1801 "arch-arm/bionic/exidx_dynamic.c",
1802
1803 // special for arm
1804 "arch-arm/bionic/atexit_legacy.c",
1805 ],
1806 // special for arm
1807 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001808 },
1809 static: {
1810 srcs: ["arch-arm/bionic/exidx_static.c"],
1811 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001812 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001813 arm64: {
1814 // Don't re-export new/delete and friends, even if the compiler really wants to.
1815 version_script: "libc.arm64.map",
1816 },
1817 mips: {
1818 // Don't re-export new/delete and friends, even if the compiler really wants to.
1819 version_script: "libc.mips.map",
1820 },
1821 mips64: {
1822 // Don't re-export new/delete and friends, even if the compiler really wants to.
1823 version_script: "libc.mips64.map",
1824 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001825 x86: {
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001826 //TODO: This is to work around b/24465209. Remove after root cause is fixed
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001827 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001828 ldflags: ["-Wl,--hash-style=both"],
1829
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001830 // Don't re-export new/delete and friends, even if the compiler really wants to.
1831 version_script: "libc.x86.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001832 },
1833 x86_64: {
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001834 // Don't re-export new/delete and friends, even if the compiler really wants to.
1835 version_script: "libc.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001836 },
1837 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001838}
1839
Dan Willemsen208ae172015-09-16 16:33:27 -07001840// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001841// libstdc++.so + libstdc++.a
1842// ========================================================
1843cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001844 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001845 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001846 srcs: [
1847 "bionic/__cxa_guard.cpp",
1848 "bionic/__cxa_pure_virtual.cpp",
1849 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001850 ],
1851 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001852 static_ndk_lib: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001853 system_shared_libs: ["libc"],
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001854 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001855
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001856 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001857 arch: {
1858 arm: {
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++.arm.map",
1862 },
1863 arm64: {
1864 version_script: "libstdc++.arm64.map",
1865 },
1866 mips: {
1867 version_script: "libstdc++.mips.map",
1868 },
1869 mips64: {
1870 version_script: "libstdc++.mips64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001871 },
1872 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001873 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001874 ldflags: ["-Wl,--hash-style=both"],
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001875 version_script: "libstdc++.x86.map",
1876 },
1877 x86_64: {
1878 version_script: "libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001879 },
1880 },
1881}
1882
Colin Cross50c21ab2015-10-31 23:03:05 -07001883cc_defaults {
1884 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001885 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001886 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001887 recovery_available: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001888
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001889 cflags: [
1890 "-Wno-gcc-compat",
1891 "-Wall",
1892 "-Werror",
1893 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001894}
1895
Colin Cross50c21ab2015-10-31 23:03:05 -07001896cc_defaults {
1897 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001898 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001899
1900 arch: {
1901 mips: {
1902 cflags: ["-fPIC"],
1903 },
1904 mips64: {
1905 cflags: ["-fPIC"],
1906 },
1907 x86: {
1908 cflags: ["-fPIC"],
1909 },
1910 x86_64: {
1911 cflags: ["-fPIC"],
1912 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001913 },
Colin Crossab179442018-09-27 11:03:22 -07001914 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001915}
1916
Dan Willemsena3ed9012017-04-04 15:51:26 -07001917// crt obj files
Dan Willemsen208ae172015-09-16 16:33:27 -07001918cc_object {
1919 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001920 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001921 local_include_dirs: ["include"],
1922 product_variables: {
1923 platform_sdk_version: {
1924 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1925 },
1926 },
1927 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001928
Colin Cross7d7b3682017-11-03 13:38:40 -07001929 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001930}
1931
Dan Willemsen208ae172015-09-16 16:33:27 -07001932cc_object {
1933 name: "crtbegin_so1",
1934 local_include_dirs: ["include"],
1935 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001936
Colin Cross7d7b3682017-11-03 13:38:40 -07001937 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001938}
1939
Dan Willemsen208ae172015-09-16 16:33:27 -07001940cc_object {
1941 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07001942
Colin Cross7d7b3682017-11-03 13:38:40 -07001943 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07001944 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001945 "crtbegin_so1",
1946 "crtbrand",
1947 ],
1948}
1949
Dan Willemsen208ae172015-09-16 16:33:27 -07001950cc_object {
1951 name: "crtend_so",
1952 local_include_dirs: ["include"],
1953 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001954
Colin Cross7d7b3682017-11-03 13:38:40 -07001955 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001956}
1957
Dan Willemsen208ae172015-09-16 16:33:27 -07001958cc_object {
1959 name: "crtbegin_static1",
1960 local_include_dirs: ["include"],
1961 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001962
Colin Cross50c21ab2015-10-31 23:03:05 -07001963 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001964 mips: {
1965 srcs: [
1966 "arch-mips/bionic/crtbegin.c",
1967 ],
1968 exclude_srcs: [
1969 "arch-common/bionic/crtbegin.c",
1970 ],
1971 },
1972 mips64: {
1973 srcs: [
1974 "arch-mips64/bionic/crtbegin.c",
1975 ],
1976 exclude_srcs: [
1977 "arch-common/bionic/crtbegin.c",
1978 ],
1979 },
1980 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001981
1982 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001983}
1984
Dan Willemsen208ae172015-09-16 16:33:27 -07001985cc_object {
1986 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07001987
Colin Cross77d57bf2016-04-11 14:34:18 -07001988 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001989 "crtbegin_static1",
1990 "crtbrand",
1991 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001992 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001993}
1994
Dan Willemsen208ae172015-09-16 16:33:27 -07001995cc_object {
1996 name: "crtbegin_dynamic1",
1997 local_include_dirs: ["include"],
1998 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001999
Colin Cross50c21ab2015-10-31 23:03:05 -07002000 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002001 mips: {
2002 srcs: [
2003 "arch-mips/bionic/crtbegin.c",
2004 ],
2005 exclude_srcs: [
2006 "arch-common/bionic/crtbegin.c",
2007 ],
2008 },
2009 mips64: {
2010 srcs: [
2011 "arch-mips64/bionic/crtbegin.c",
2012 ],
2013 exclude_srcs: [
2014 "arch-common/bionic/crtbegin.c",
2015 ],
2016 },
2017 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002018 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002019}
2020
Dan Willemsen208ae172015-09-16 16:33:27 -07002021cc_object {
2022 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002023
Colin Cross77d57bf2016-04-11 14:34:18 -07002024 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002025 "crtbegin_dynamic1",
2026 "crtbrand",
2027 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002028 target: {
2029 linux_bionic: {
2030 generated_sources: ["host_bionic_linker_asm"],
2031 objs: [
2032 "linker_wrapper",
2033 ],
2034 },
2035 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002036 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002037}
2038
Dan Willemsen208ae172015-09-16 16:33:27 -07002039cc_object {
2040 // We rename crtend.o to crtend_android.o to avoid a
2041 // name clash between gcc and bionic.
2042 name: "crtend_android",
2043 local_include_dirs: ["include"],
2044 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002045
Colin Cross50c21ab2015-10-31 23:03:05 -07002046 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002047}
Colin Crossbaa48992016-07-13 11:15:21 -07002048
Dan Albert26e1c412018-05-24 14:56:46 -07002049versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002050 name: "common_libc",
2051 from: "include",
2052 to: "",
2053 license: "NOTICE",
2054}
Dan Albert4238a352016-06-28 11:18:05 -07002055
2056ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002057 name: "libc_uapi",
2058 from: "kernel/uapi",
2059 to: "",
2060 srcs: [
2061 "kernel/uapi/asm-generic/**/*.h",
2062 "kernel/uapi/drm/**/*.h",
2063 "kernel/uapi/linux/**/*.h",
2064 "kernel/uapi/misc/**/*.h",
2065 "kernel/uapi/mtd/**/*.h",
2066 "kernel/uapi/rdma/**/*.h",
2067 "kernel/uapi/scsi/**/*.h",
2068 "kernel/uapi/sound/**/*.h",
2069 "kernel/uapi/video/**/*.h",
2070 "kernel/uapi/xen/**/*.h",
2071 ],
Dan Albert92592652016-10-20 01:42:54 -07002072 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002073}
2074
2075ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002076 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002077 from: "kernel/android/uapi/linux",
2078 to: "linux",
2079 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002080 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002081}
2082
2083ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002084 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002085 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002086 to: "scsi",
2087 srcs: ["kernel/android/scsi/**/*.h"],
2088 license: "NOTICE",
2089}
2090
2091ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002092 name: "libc_asm_arm",
2093 from: "kernel/uapi/asm-arm",
2094 to: "arm-linux-androideabi",
2095 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002096 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002097}
2098
2099ndk_headers {
2100 name: "libc_asm_arm64",
2101 from: "kernel/uapi/asm-arm64",
2102 to: "aarch64-linux-android",
2103 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002104 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002105}
2106
Elliott Hughesee291c02017-12-11 11:32:34 -08002107// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002108ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002109 name: "libc_asm_mips",
2110 from: "kernel/uapi/asm-mips",
2111 to: "mipsel-linux-android",
2112 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2113 license: "NOTICE",
2114}
2115
Elliott Hughesee291c02017-12-11 11:32:34 -08002116// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002117ndk_headers {
2118 name: "libc_asm_mips64",
2119 from: "kernel/uapi/asm-mips",
2120 to: "mips64el-linux-android",
2121 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2122 license: "NOTICE",
2123}
2124
2125ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002126 name: "libc_asm_x86",
2127 from: "kernel/uapi/asm-x86",
2128 to: "i686-linux-android",
2129 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002130 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002131}
2132
2133ndk_headers {
2134 name: "libc_asm_x86_64",
2135 from: "kernel/uapi/asm-x86",
2136 to: "x86_64-linux-android",
2137 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002138 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002139}
2140
Dan Albert4238a352016-06-28 11:18:05 -07002141ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002142 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002143 symbol_file: "libc.map.txt",
2144 first_version: "9",
2145}
2146
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002147llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002148 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002149 symbol_file: "libc.map.txt",
2150 export_headers_as_system: true,
2151 export_preprocessed_headers: ["include"],
2152 arch: {
2153 arm: {
2154 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002155 "kernel/uapi",
2156 "kernel/uapi/asm-arm",
2157 "kernel/android/uapi",
2158 ],
2159 },
2160 arm64: {
2161 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002162 "kernel/uapi",
2163 "kernel/uapi/asm-arm64",
2164 "kernel/android/uapi",
2165 ],
2166 },
2167 mips: {
2168 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002169 "kernel/uapi",
2170 "kernel/uapi/asm-mips",
2171 "kernel/android/uapi",
2172 ],
2173 },
2174 mips64: {
2175 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002176 "kernel/uapi",
2177 "kernel/uapi/asm-mips",
2178 "kernel/android/uapi",
2179 ],
2180 },
2181 x86: {
2182 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002183 "kernel/uapi",
2184 "kernel/uapi/asm-x86",
2185 "kernel/android/uapi",
2186 ],
2187 },
2188 x86_64: {
2189 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002190 "kernel/uapi",
2191 "kernel/uapi/asm-x86",
2192 "kernel/android/uapi",
2193 ],
2194 },
2195 },
2196}
2197
Dan Albertdf31aff2016-10-06 15:50:41 -07002198ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002199 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002200 symbol_file: "libstdc++.map.txt",
2201 first_version: "9",
2202}
2203
Dan Willemsenca056d72018-01-08 14:00:24 -08002204// Export these headers for toolbox to process
2205filegroup {
2206 name: "kernel_input_headers",
2207 srcs: [
2208 "kernel/uapi/linux/input.h",
2209 "kernel/uapi/linux/input-event-codes.h",
2210 ],
2211}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002212
2213// Generate a syscall name / number mapping. These objects are text files
2214// (thanks to the -dD -E flags) and not binary files. They will then be
2215// consumed by the genseccomp.py script and converted into C++ code.
2216cc_defaults {
2217 name: "libseccomp_gen_syscall_nrs_defaults",
2218 recovery_available: true,
2219 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2220 cflags: [
2221 "-dD",
2222 "-E",
2223 "-Wall",
2224 "-Werror",
2225 "-nostdinc",
2226 ],
2227}
2228
2229cc_object {
2230 name: "libseccomp_gen_syscall_nrs_arm",
2231 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2232 local_include_dirs: [
2233 "kernel/uapi/asm-arm",
2234 "kernel/uapi",
2235 ],
2236}
2237
2238cc_object {
2239 name: "libseccomp_gen_syscall_nrs_arm64",
2240 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2241 local_include_dirs: [
2242 "kernel/uapi/asm-arm64",
2243 "kernel/uapi",
2244 ],
2245}
2246
2247cc_object {
2248 name: "libseccomp_gen_syscall_nrs_x86",
2249 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2250 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2251 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2252 local_include_dirs: [
2253 "kernel/uapi/asm-x86",
2254 "kernel/uapi",
2255 ],
2256}
2257
2258cc_object {
2259 name: "libseccomp_gen_syscall_nrs_x86_64",
2260 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2261 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2262 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2263 local_include_dirs: [
2264 "kernel/uapi/asm-x86",
2265 "kernel/uapi",
2266 ],
2267}
2268
2269cc_object {
2270 name: "libseccomp_gen_syscall_nrs_mips",
2271 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2272 cflags: [
2273 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2274 ],
2275 local_include_dirs: [
2276 "kernel/uapi/asm-mips",
2277 "kernel/uapi",
2278 ],
2279}
2280
2281cc_object {
2282 name: "libseccomp_gen_syscall_nrs_mips64",
2283 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2284 cflags: [
2285 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2286 ],
2287 local_include_dirs: [
2288 "kernel/uapi/asm-mips",
2289 "kernel/uapi",
2290 ],
2291}
2292
2293// Generate the C++ policy sources for app, system, and global seccomp-bpf
2294// filters.
2295python_binary_host {
2296 name: "genseccomp",
2297 main: "tools/genseccomp.py",
2298
2299 srcs: [
2300 "tools/genseccomp.py",
2301 "tools/gensyscalls.py",
2302 ],
2303
2304 data: [
2305 "kernel/uapi/**/*.h",
2306 ],
2307
2308 version: {
2309 py2: {
2310 enabled: true,
2311 },
2312 py3: {
2313 enabled: false,
2314 },
2315 },
2316}
2317
2318cc_genrule {
2319 name: "libseccomp_policy_app_sources",
2320 recovery_available: true,
2321 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2322
2323 tools: [ "genseccomp" ],
2324
2325 srcs: [
2326 "SYSCALLS.TXT",
2327 "SECCOMP_WHITELIST_COMMON.TXT",
2328 "SECCOMP_WHITELIST_APP.TXT",
2329 "SECCOMP_BLACKLIST_COMMON.TXT",
2330 "SECCOMP_BLACKLIST_APP.TXT",
2331 ":libseccomp_gen_syscall_nrs_arm",
2332 ":libseccomp_gen_syscall_nrs_arm64",
2333 ":libseccomp_gen_syscall_nrs_mips",
2334 ":libseccomp_gen_syscall_nrs_mips64",
2335 ":libseccomp_gen_syscall_nrs_x86",
2336 ":libseccomp_gen_syscall_nrs_x86_64",
2337 ],
2338
2339 out: [
2340 "arm64_app_policy.cpp",
2341 "arm_app_policy.cpp",
2342 "mips64_app_policy.cpp",
2343 "mips_app_policy.cpp",
2344 "x86_64_app_policy.cpp",
2345 "x86_app_policy.cpp",
2346 ],
2347}
2348
2349cc_genrule {
2350 name: "libseccomp_policy_system_sources",
2351 recovery_available: true,
2352 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2353
2354 tools: [ "genseccomp" ],
2355
2356 srcs: [
2357 "SYSCALLS.TXT",
2358 "SECCOMP_WHITELIST_COMMON.TXT",
2359 "SECCOMP_WHITELIST_SYSTEM.TXT",
2360 "SECCOMP_BLACKLIST_COMMON.TXT",
2361 ":libseccomp_gen_syscall_nrs_arm",
2362 ":libseccomp_gen_syscall_nrs_arm64",
2363 ":libseccomp_gen_syscall_nrs_mips",
2364 ":libseccomp_gen_syscall_nrs_mips64",
2365 ":libseccomp_gen_syscall_nrs_x86",
2366 ":libseccomp_gen_syscall_nrs_x86_64",
2367 ],
2368
2369 out: [
2370 "arm64_system_policy.cpp",
2371 "arm_system_policy.cpp",
2372 "mips64_system_policy.cpp",
2373 "mips_system_policy.cpp",
2374 "x86_64_system_policy.cpp",
2375 "x86_system_policy.cpp",
2376 ],
2377}
2378
2379cc_genrule {
2380 name: "libseccomp_policy_global_sources",
2381 recovery_available: true,
2382 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=global $(in)",
2383
2384 tools: [ "genseccomp" ],
2385
2386 srcs: [
2387 "SYSCALLS.TXT",
2388 "SECCOMP_WHITELIST_COMMON.TXT",
2389 "SECCOMP_WHITELIST_SYSTEM.TXT",
2390 "SECCOMP_WHITELIST_APP.TXT",
2391 "SECCOMP_WHITELIST_GLOBAL.TXT",
2392 "SECCOMP_BLACKLIST_COMMON.TXT",
2393 ":libseccomp_gen_syscall_nrs_arm",
2394 ":libseccomp_gen_syscall_nrs_arm64",
2395 ":libseccomp_gen_syscall_nrs_mips",
2396 ":libseccomp_gen_syscall_nrs_mips64",
2397 ":libseccomp_gen_syscall_nrs_x86",
2398 ":libseccomp_gen_syscall_nrs_x86_64",
2399 ],
2400
2401 out: [
2402 "arm64_global_policy.cpp",
2403 "arm_global_policy.cpp",
2404 "mips64_global_policy.cpp",
2405 "mips_global_policy.cpp",
2406 "x86_64_global_policy.cpp",
2407 "x86_global_policy.cpp",
2408 ],
2409}
2410
2411cc_library {
2412 name: "libseccomp_policy",
2413 recovery_available: true,
2414 generated_sources: [
2415 "libseccomp_policy_app_sources",
2416 "libseccomp_policy_global_sources",
2417 "libseccomp_policy_system_sources",
2418 ],
2419
2420 srcs: [
2421 "seccomp/seccomp_policy.cpp",
2422 ],
2423
2424 export_include_dirs: ["seccomp/include"],
2425 cflags: [
2426 "-Wall",
2427 "-Werror",
2428 ],
2429 shared: {
2430 shared_libs: ["libbase"],
2431 },
2432 static: {
2433 static_libs: ["libbase"],
2434 },
2435}