blob: 7356c647a895aa3c28bb8c5b743233b825ad0e84 [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",
68 "external/jemalloc/include",
69 ],
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: {
74 never: true,
75 },
Colin Cross50c21ab2015-10-31 23:03:05 -070076 native_coverage: false,
Jiyong Park5603c6e2018-04-27 21:53:11 +090077 recovery_available: true,
Dan Willemsen208ae172015-09-16 16:33:27 -070078}
79
Dan Willemsen208ae172015-09-16 16:33:27 -070080// ANDROIDMK TRANSLATION ERROR: unsupported directive
81// ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
82//libc_common_cflags += ["-DDEBUG"]
83// ANDROIDMK TRANSLATION ERROR: unsupported directive
84// endif
85
Dan Willemsen208ae172015-09-16 16:33:27 -070086// ========================================================
87// libc_stack_protector.a - stack protector code
88// ========================================================
89//
Colin Crossa3f9fca2016-01-11 13:20:55 -080090// Code that implements the stack protector (or that runs
91// before TLS has been set up) needs to be compiled with
92// -fno-stack-protector, since it accesses the stack canary
93// TLS slot.
Dan Willemsen208ae172015-09-16 16:33:27 -070094
95cc_library_static {
96
Colin Crossa3f9fca2016-01-11 13:20:55 -080097 srcs: [
98 "bionic/__libc_init_main_thread.cpp",
99 "bionic/__stack_chk_fail.cpp",
100 ],
101 arch: {
102 arm64: {
103 srcs: ["arch-arm64/bionic/__set_tls.c"],
104 },
105 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700106 srcs: [
107 "arch-x86/bionic/__libc_init_sysinfo.cpp",
108 "arch-x86/bionic/__set_tls.cpp",
109 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800110 },
111 x86_64: {
112 srcs: ["arch-x86_64/bionic/__set_tls.c"],
113 },
114 },
115
Colin Cross50c21ab2015-10-31 23:03:05 -0700116 defaults: ["libc_defaults"],
117 cflags: ["-fno-stack-protector"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700118 name: "libc_stack_protector",
Dan Willemsen208ae172015-09-16 16:33:27 -0700119}
120
Colin Crossa3f9fca2016-01-11 13:20:55 -0800121// libc_init_static.cpp also needs to be built without stack protector,
122// because it's responsible for setting up TLS for static executables.
123// This isn't the case for dynamic executables because the dynamic linker
124// has already set up the main thread's TLS.
125
126cc_library_static {
127 name: "libc_init_static",
128 defaults: ["libc_defaults"],
129 srcs: ["bionic/libc_init_static.cpp"],
130 cflags: ["-fno-stack-protector"],
131}
132
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700133cc_library_static {
134 name: "libc_init_dynamic",
135 defaults: ["libc_defaults"],
136 srcs: ["bionic/libc_init_dynamic.cpp"],
137 cflags: ["-fno-stack-protector"],
138}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800139
Dan Willemsen208ae172015-09-16 16:33:27 -0700140// ========================================================
141// libc_tzcode.a - upstream 'tzcode' code
142// ========================================================
143
144cc_library_static {
145
Colin Cross50c21ab2015-10-31 23:03:05 -0700146 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700147 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800148 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700149 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700150 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
151 ],
152
Colin Cross50c21ab2015-10-31 23:03:05 -0700153 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700154 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700155 // Don't use ridiculous amounts of stack.
156 "-DALL_STATE",
157 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
158 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800159 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700160 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700161 // The name of the tm_gmtoff field in our struct tm.
162 "-DTM_GMTOFF=tm_gmtoff",
163 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700164 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700165 // Include `tzname`, `timezone`, and `daylight` globals.
166 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700167 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800168 // Use the empty string (instead of " ") as the timezone abbreviation
169 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700170 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700171 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
172 "-Dlint",
173 ],
174
Dan Willemsen208ae172015-09-16 16:33:27 -0700175 local_include_dirs: ["tzcode/"],
176 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700177}
178
179// ========================================================
180// libc_dns.a - modified NetBSD DNS code
181// ========================================================
182
183cc_library_static {
184
Colin Cross50c21ab2015-10-31 23:03:05 -0700185 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700186 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800187 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700188
189 "upstream-netbsd/lib/libc/isc/ev_streams.c",
190 "upstream-netbsd/lib/libc/isc/ev_timers.c",
191 "upstream-netbsd/lib/libc/resolv/mtctxres.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",
482 "upstream-openbsd/lib/libc/stdlib/reallocarray.c",
483 "upstream-openbsd/lib/libc/stdlib/remque.c",
484 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700485 "upstream-openbsd/lib/libc/stdlib/tfind.c",
486 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
487 "upstream-openbsd/lib/libc/string/strcasecmp.c",
488 "upstream-openbsd/lib/libc/string/strcspn.c",
489 "upstream-openbsd/lib/libc/string/strdup.c",
490 "upstream-openbsd/lib/libc/string/strndup.c",
491 "upstream-openbsd/lib/libc/string/strpbrk.c",
492 "upstream-openbsd/lib/libc/string/strsep.c",
493 "upstream-openbsd/lib/libc/string/strspn.c",
494 "upstream-openbsd/lib/libc/string/strstr.c",
495 "upstream-openbsd/lib/libc/string/strtok.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700496 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700497 "upstream-openbsd/lib/libc/string/wcswidth.c",
498 ],
499
Colin Cross50c21ab2015-10-31 23:03:05 -0700500 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700501 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700502 "-Wno-unused-parameter",
503 "-include openbsd-compat.h",
504 ],
505
Dan Willemsen208ae172015-09-16 16:33:27 -0700506 local_include_dirs: [
507 "private",
508 "stdio",
509 "upstream-openbsd/android/include",
510 "upstream-openbsd/lib/libc/include",
511 "upstream-openbsd/lib/libc/gdtoa/",
512 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700513}
514
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700515cc_library_static {
516 name: "libc_openbsd_large_stack",
517 defaults: ["libc_defaults"],
518 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700519 "stdio/vfprintf.cpp",
520 "stdio/vfwprintf.cpp",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700521 ],
522 cflags: [
523 "-include openbsd-compat.h",
524 "-Wno-sign-compare",
525 "-Wframe-larger-than=5000",
526 ],
527
528 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700529 "upstream-openbsd/android/include/",
530 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700531 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700532 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700533 ],
534}
535
Dan Willemsen208ae172015-09-16 16:33:27 -0700536// ========================================================
537// libc_openbsd.a - upstream OpenBSD C library code
538// ========================================================
539//
540// These files are built with the openbsd-compat.h header file
541// automatically included.
542cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700543 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700544 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800545 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700546 "upstream-openbsd/lib/libc/crypt/arc4random.c",
547 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
548
549 // May be overriden by per-arch optimized versions
550 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700551 "upstream-openbsd/lib/libc/string/memrchr.c",
552 "upstream-openbsd/lib/libc/string/stpcpy.c",
553 "upstream-openbsd/lib/libc/string/stpncpy.c",
554 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700555 "upstream-openbsd/lib/libc/string/strcpy.c",
556 "upstream-openbsd/lib/libc/string/strlcat.c",
557 "upstream-openbsd/lib/libc/string/strlcpy.c",
558 "upstream-openbsd/lib/libc/string/strncat.c",
559 "upstream-openbsd/lib/libc/string/strncmp.c",
560 "upstream-openbsd/lib/libc/string/strncpy.c",
561 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700562
563 arch: {
564 arm: {
565 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700566 "upstream-openbsd/lib/libc/string/strcpy.c",
567 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800568 neon: {
Christopher Ferris950a9582017-03-29 13:10:56 -0700569 exclude_srcs: [
Christopher Ferris950a9582017-03-29 13:10:56 -0700570 "upstream-openbsd/lib/libc/string/stpcpy.c",
571 "upstream-openbsd/lib/libc/string/strcat.c",
572 ],
573 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700574 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700575 arm64: {
576 exclude_srcs: [
577 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700578 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700579 "upstream-openbsd/lib/libc/string/strcpy.c",
580 "upstream-openbsd/lib/libc/string/strncmp.c",
581 ],
582 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530583 mips: {
584 exclude_srcs: [
585 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530586 "upstream-openbsd/lib/libc/string/strcpy.c",
587 "upstream-openbsd/lib/libc/string/strncmp.c",
588 ],
589 },
590 mips64: {
591 exclude_srcs: [
592 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530593 "upstream-openbsd/lib/libc/string/strcpy.c",
594 "upstream-openbsd/lib/libc/string/strncmp.c",
595 ],
596 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700597 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800598 exclude_srcs: [
599 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800600 "upstream-openbsd/lib/libc/string/memrchr.c",
601 "upstream-openbsd/lib/libc/string/stpcpy.c",
602 "upstream-openbsd/lib/libc/string/stpncpy.c",
603 "upstream-openbsd/lib/libc/string/strcat.c",
604 "upstream-openbsd/lib/libc/string/strcpy.c",
605 "upstream-openbsd/lib/libc/string/strncmp.c",
606 "upstream-openbsd/lib/libc/string/strncpy.c",
607 ],
608 ssse3: {
609 exclude_srcs: [
610 "upstream-openbsd/lib/libc/string/strlcat.c",
611 "upstream-openbsd/lib/libc/string/strlcpy.c",
612 "upstream-openbsd/lib/libc/string/strncat.c",
613 ],
614 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700615 },
616
617 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800618 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800619 "upstream-openbsd/lib/libc/string/stpcpy.c",
620 "upstream-openbsd/lib/libc/string/stpncpy.c",
621 "upstream-openbsd/lib/libc/string/strcat.c",
622 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800623 "upstream-openbsd/lib/libc/string/strncat.c",
624 "upstream-openbsd/lib/libc/string/strncmp.c",
625 "upstream-openbsd/lib/libc/string/strncpy.c",
626 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700627 },
628 },
629
Colin Cross50c21ab2015-10-31 23:03:05 -0700630 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700631 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700632 "-Wno-unused-parameter",
633 "-include openbsd-compat.h",
634 ],
635
Dan Willemsen208ae172015-09-16 16:33:27 -0700636 local_include_dirs: [
637 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700638 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700639 ],
640
641 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700642}
643
644// ========================================================
645// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
646// ========================================================
647//
648// These files are built with the openbsd-compat.h header file
649// automatically included.
650
651cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700652 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700653 srcs: [
654 "upstream-openbsd/android/gdtoa_support.cpp",
655 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
656 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
657 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
658 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
659 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
660 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
661 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
662 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
663 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
664 "upstream-openbsd/lib/libc/gdtoa/misc.c",
665 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
666 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
667 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
668 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
669 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
670 "upstream-openbsd/lib/libc/gdtoa/sum.c",
671 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
672 ],
673 multilib: {
674 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800675 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700676 },
677 },
678
Colin Cross50c21ab2015-10-31 23:03:05 -0700679 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700680 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700681 "-include openbsd-compat.h",
682 ],
683
Dan Willemsen208ae172015-09-16 16:33:27 -0700684 local_include_dirs: [
685 "private",
686 "upstream-openbsd/android/include",
687 "upstream-openbsd/lib/libc/include",
688 ],
689
690 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700691}
692
693// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700694// libc_fortify.a - container for our FORITFY
695// implementation details
696// ========================================================
697cc_library_static {
698 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700699 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700700
701 name: "libc_fortify",
702
703 // Disable FORTIFY for the compilation of these, so we don't end up having
704 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800705 cflags: [
706 "-U_FORTIFY_SOURCE",
707 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
708 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700709
710 arch: {
711 arm: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700712 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700713 srcs: [
714 "arch-arm/generic/bionic/__memcpy_chk.S",
715 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800716 neon: {
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800717 cflags: [
718 "-DNO___STRCAT_CHK",
719 "-DNO___STRCPY_CHK",
720 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700721 srcs: [
722 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
723 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
724 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700725 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800726 cortex_a7: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700727 srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800728 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
729 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
730 ],
731 exclude_srcs: [
George Burgess IV6cb06872017-07-21 13:28:42 -0700732 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
733 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
734 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700735 },
736 cortex_a9: {
737 srcs: [
738 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
739 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
740 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800741 exclude_srcs: [
742 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
743 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
744 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700745 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800746 krait: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700747 srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800748 "arch-arm/krait/bionic/__strcat_chk.S",
749 "arch-arm/krait/bionic/__strcpy_chk.S",
750 ],
751 exclude_srcs: [
752 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
753 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
754 ],
755 },
756 cortex_a53: {
757 srcs: [
758 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
759 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
760 ],
761 exclude_srcs: [
George Burgess IV6cb06872017-07-21 13:28:42 -0700762 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
763 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
764 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700765 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700766 cortex_a55: {
767 srcs: [
768 "arch-arm/denver/bionic/__strcat_chk.S",
769 "arch-arm/denver/bionic/__strcpy_chk.S",
770 ],
771 exclude_srcs: [
772 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
773 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
774 ],
775 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700776 cortex_a73: {
777 srcs: [
778 "arch-arm/denver/bionic/__strcat_chk.S",
779 "arch-arm/denver/bionic/__strcpy_chk.S",
780 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800781 exclude_srcs: [
782 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
783 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
784 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700785 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700786 cortex_a75: {
787 srcs: [
788 "arch-arm/denver/bionic/__strcat_chk.S",
789 "arch-arm/denver/bionic/__strcpy_chk.S",
790 ],
791 exclude_srcs: [
792 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
793 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
794 ],
795 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700796 denver: {
797 srcs: [
798 "arch-arm/denver/bionic/__strcat_chk.S",
799 "arch-arm/denver/bionic/__strcpy_chk.S",
800 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800801 exclude_srcs: [
802 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
803 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
804 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700805 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800806 kryo: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700807 srcs: [
808 "arch-arm/krait/bionic/__strcat_chk.S",
809 "arch-arm/krait/bionic/__strcpy_chk.S",
810 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800811 exclude_srcs: [
812 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
813 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700814 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700815 },
816 },
817 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700818 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700819 srcs: [
820 "arch-arm64/generic/bionic/__memcpy_chk.S",
821 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700822 },
823 },
824}
825
826// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700827// libc_bionic.a - home-grown C library code
828// ========================================================
829
830cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700831 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700832 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700833 // The data that backs getauxval is initialized in the libc init
834 // functions which are invoked by the linker. If this file is included
835 // in libc_ndk.a, only one of the copies of the global data will be
836 // initialized, resulting in nullptr dereferences.
837 "bionic/getauxval.cpp",
838
Elliott Hughes211c4d32018-02-02 15:10:32 -0800839 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700840 "bionic/sysconf.cpp",
841 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700842 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700843
Josh Gao10ec9282017-04-03 15:13:29 -0700844 // The following must not be statically linked into libc_ndk.a, because
845 // debuggerd will look for the abort message in libc.so's copy.
846 "bionic/android_set_abort_message.cpp",
847
Dan Willemsen208ae172015-09-16 16:33:27 -0700848 "bionic/strchr.cpp",
849 "bionic/strnlen.c",
850 "bionic/strrchr.cpp",
851 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700852
853 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700854 arm: {
855 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800856 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700857 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800858 "arch-arm/generic/bionic/memset.S",
859 "arch-arm/generic/bionic/strcmp.S",
860 "arch-arm/generic/bionic/strcpy.S",
861 "arch-arm/generic/bionic/strlen.c",
862
Dan Willemsen208ae172015-09-16 16:33:27 -0700863 "arch-arm/bionic/atomics_arm.c",
864 "arch-arm/bionic/__bionic_clone.S",
865 "arch-arm/bionic/_exit_with_stack_teardown.S",
866 "arch-arm/bionic/libgcc_compat.c",
867 "arch-arm/bionic/popcount_tab.c",
868 "arch-arm/bionic/__restore.S",
869 "arch-arm/bionic/setjmp.S",
870 "arch-arm/bionic/syscall.S",
871 "arch-arm/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700872 ],
Colin Cross6ab8f892015-11-23 14:12:15 -0800873 cortex_a7: {
874 srcs: [
Christopher Ferrisecebb492016-11-28 11:09:49 -0800875 "arch-arm/cortex-a7/bionic/memcpy.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700876 "arch-arm/cortex-a7/bionic/memset.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800877 ],
878 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800879 "arch-arm/cortex-a15/bionic/memcpy.S",
880 "arch-arm/cortex-a15/bionic/memset.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800881 ],
882 },
883 cortex_a9: {
884 srcs: [
885 "arch-arm/cortex-a9/bionic/memcpy.S",
886 "arch-arm/cortex-a9/bionic/memset.S",
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800887
Colin Cross6ab8f892015-11-23 14:12:15 -0800888 "arch-arm/cortex-a9/bionic/stpcpy.S",
889 "arch-arm/cortex-a9/bionic/strcat.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800890 "arch-arm/cortex-a9/bionic/strcmp.S",
891 "arch-arm/cortex-a9/bionic/strcpy.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800892 "arch-arm/cortex-a9/bionic/strlen.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800893 ],
894 exclude_srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800895 "arch-arm/cortex-a15/bionic/memcpy.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700896 "arch-arm/cortex-a15/bionic/memset.S",
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800897
Colin Cross6ab8f892015-11-23 14:12:15 -0800898 "arch-arm/cortex-a15/bionic/stpcpy.S",
899 "arch-arm/cortex-a15/bionic/strcat.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800900 "arch-arm/cortex-a15/bionic/strcmp.S",
901 "arch-arm/cortex-a15/bionic/strcpy.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800902 "arch-arm/cortex-a15/bionic/strlen.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800903 ],
904 },
905 krait: {
906 srcs: [
907 "arch-arm/krait/bionic/memcpy.S",
908 "arch-arm/krait/bionic/memset.S",
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800909
Colin Cross6ab8f892015-11-23 14:12:15 -0800910 "arch-arm/krait/bionic/strcmp.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800911 ],
912 exclude_srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800913 "arch-arm/cortex-a15/bionic/memset.S",
914 "arch-arm/cortex-a15/bionic/memcpy.S",
915
916 "arch-arm/cortex-a15/bionic/strcmp.S",
917 ],
918 },
919 cortex_a53: {
920 srcs: [
921 "arch-arm/cortex-a53/bionic/memcpy.S",
922 "arch-arm/cortex-a7/bionic/memset.S",
923 ],
924 exclude_srcs: [
925 "arch-arm/cortex-a15/bionic/memset.S",
926 "arch-arm/cortex-a15/bionic/memcpy.S",
927 ],
928 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700929 cortex_a55: {
930 srcs: [
931 "arch-arm/cortex-a7/bionic/memset.S",
932 "arch-arm/denver/bionic/memcpy.S",
933
934 "arch-arm/krait/bionic/strcmp.S",
935 ],
936 exclude_srcs: [
937 "arch-arm/cortex-a15/bionic/memset.S",
938 "arch-arm/cortex-a15/bionic/memcpy.S",
939 "arch-arm/cortex-a15/bionic/strcmp.S",
940 ],
941 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800942 cortex_a73: {
943 srcs: [
944 "arch-arm/cortex-a7/bionic/memset.S",
945 "arch-arm/denver/bionic/memcpy.S",
946
947 "arch-arm/krait/bionic/strcmp.S",
948 ],
949 exclude_srcs: [
950 "arch-arm/cortex-a15/bionic/memset.S",
951 "arch-arm/cortex-a15/bionic/memcpy.S",
952 "arch-arm/cortex-a15/bionic/strcmp.S",
953 ],
954 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700955 cortex_a75: {
956 srcs: [
957 "arch-arm/cortex-a7/bionic/memset.S",
958 "arch-arm/denver/bionic/memcpy.S",
959
960 "arch-arm/krait/bionic/strcmp.S",
961 ],
962 exclude_srcs: [
963 "arch-arm/cortex-a15/bionic/memset.S",
964 "arch-arm/cortex-a15/bionic/memcpy.S",
965 "arch-arm/cortex-a15/bionic/strcmp.S",
966 ],
967 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800968 denver: {
969 srcs: [
970 "arch-arm/denver/bionic/memcpy.S",
971 "arch-arm/denver/bionic/memset.S",
972 ],
973 exclude_srcs: [
974 "arch-arm/cortex-a15/bionic/memset.S",
975 "arch-arm/cortex-a15/bionic/memcpy.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800976 ],
977 },
Christopher Ferris950a9582017-03-29 13:10:56 -0700978 kryo: {
979 srcs: [
Jake Weinstein04d99df2016-08-25 20:03:25 -0400980 "arch-arm/kryo/bionic/memcpy.S",
Jake Weinstein4d114f92017-04-07 14:55:53 -0400981 "arch-arm/cortex-a7/bionic/memset.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800982
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800983 "arch-arm/krait/bionic/strcmp.S",
984 ],
985 exclude_srcs: [
986 "arch-arm/cortex-a15/bionic/memset.S",
987 "arch-arm/cortex-a15/bionic/memcpy.S",
988 "arch-arm/cortex-a15/bionic/strcmp.S",
989 ],
990 },
991 // Cores not listed above (like cortex-a8, cortex-a15) or
992 // "generic" core will use the following implementation.
993 neon: {
994 srcs: [
995 "arch-arm/cortex-a15/bionic/memcpy.S",
996 "arch-arm/cortex-a15/bionic/memset.S",
997
Christopher Ferris950a9582017-03-29 13:10:56 -0700998 "arch-arm/cortex-a15/bionic/stpcpy.S",
999 "arch-arm/cortex-a15/bionic/strcat.S",
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001000 "arch-arm/cortex-a15/bionic/strcmp.S",
Christopher Ferris950a9582017-03-29 13:10:56 -07001001 "arch-arm/cortex-a15/bionic/strcpy.S",
1002 "arch-arm/cortex-a15/bionic/strlen.S",
1003
1004 "arch-arm/denver/bionic/memmove.S",
1005 ],
1006 exclude_srcs: [
1007 "arch-arm/generic/bionic/memcpy.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -07001008 "arch-arm/generic/bionic/memmove.S",
Christopher Ferris950a9582017-03-29 13:10:56 -07001009 "arch-arm/generic/bionic/memset.S",
1010 "arch-arm/generic/bionic/strcmp.S",
1011 "arch-arm/generic/bionic/strcpy.S",
1012 "arch-arm/generic/bionic/strlen.c",
Christopher Ferris950a9582017-03-29 13:10:56 -07001013 ],
1014 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001015 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001016 arm64: {
1017 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001018 "arch-arm64/generic/bionic/memchr.S",
1019 "arch-arm64/generic/bionic/memcmp.S",
1020 "arch-arm64/generic/bionic/memcpy.S",
1021 "arch-arm64/generic/bionic/memmove.S",
1022 "arch-arm64/generic/bionic/memset.S",
1023 "arch-arm64/generic/bionic/stpcpy.S",
1024 "arch-arm64/generic/bionic/strchr.S",
1025 "arch-arm64/generic/bionic/strcmp.S",
1026 "arch-arm64/generic/bionic/strcpy.S",
1027 "arch-arm64/generic/bionic/strlen.S",
1028 "arch-arm64/generic/bionic/strncmp.S",
1029 "arch-arm64/generic/bionic/strnlen.S",
1030 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001031
1032 "arch-arm64/bionic/__bionic_clone.S",
1033 "arch-arm64/bionic/_exit_with_stack_teardown.S",
1034 "arch-arm64/bionic/setjmp.S",
1035 "arch-arm64/bionic/syscall.S",
1036 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001037 ],
1038 exclude_srcs: [
1039 "bionic/__memcpy_chk.cpp",
1040 "bionic/strchr.cpp",
1041 "bionic/strnlen.c",
1042 ],
Colin Cross6ab8f892015-11-23 14:12:15 -08001043 denver64: {
1044 srcs: [
1045 "arch-arm64/denver64/bionic/memcpy.S",
Haibo Huangece43e12018-05-26 13:07:43 -07001046 "arch-arm64/denver64/bionic/memmove.S",
Colin Cross6ab8f892015-11-23 14:12:15 -08001047 "arch-arm64/denver64/bionic/memset.S",
1048 ],
1049 exclude_srcs: [
1050 "arch-arm64/generic/bionic/memcpy.S",
Haibo Huangece43e12018-05-26 13:07:43 -07001051 "arch-arm64/generic/bionic/memmove.S",
Colin Cross6ab8f892015-11-23 14:12:15 -08001052 "arch-arm64/generic/bionic/memset.S",
1053 ],
1054 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001055 },
1056
1057 mips: {
1058 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001059 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301060 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -08001061 "arch-mips/string/memset.S",
1062 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301063 "arch-mips/string/strncmp.S",
1064 "arch-mips/string/strlen.c",
1065 "arch-mips/string/strnlen.c",
1066 "arch-mips/string/strchr.c",
1067 "arch-mips/string/strcpy.c",
1068 "arch-mips/string/memchr.c",
1069 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -08001070
Dan Willemsen208ae172015-09-16 16:33:27 -07001071 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001072 "arch-mips/bionic/cacheflush.cpp",
1073 "arch-mips/bionic/_exit_with_stack_teardown.S",
Dan Willemsen879cec22016-02-29 10:37:56 -08001074 "arch-mips/bionic/libgcc_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07001075 "arch-mips/bionic/setjmp.S",
1076 "arch-mips/bionic/syscall.S",
1077 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001078 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +05301079 exclude_srcs: [
1080 "bionic/strchr.cpp",
1081 "bionic/strnlen.c",
1082 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001083 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001084 mips64: {
1085 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -08001086 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301087 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -08001088 "arch-mips/string/memset.S",
1089 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301090 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001091 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +05301092 "arch-mips/string/strnlen.c",
1093 "arch-mips/string/strchr.c",
1094 "arch-mips/string/strcpy.c",
1095 "arch-mips/string/memchr.c",
1096 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -08001097
Dan Willemsen208ae172015-09-16 16:33:27 -07001098 "arch-mips64/bionic/__bionic_clone.S",
1099 "arch-mips64/bionic/_exit_with_stack_teardown.S",
1100 "arch-mips64/bionic/setjmp.S",
1101 "arch-mips64/bionic/syscall.S",
1102 "arch-mips64/bionic/vfork.S",
1103 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001104 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +05301105 exclude_srcs: [
1106 "bionic/strchr.cpp",
1107 "bionic/strnlen.c",
1108 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001109 },
1110
1111 x86: {
1112 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001113 "arch-x86/generic/string/memcmp.S",
1114 "arch-x86/generic/string/strcmp.S",
1115 "arch-x86/generic/string/strncmp.S",
1116 "arch-x86/generic/string/strcat.S",
1117 "arch-x86/atom/string/sse2-memchr-atom.S",
1118 "arch-x86/atom/string/sse2-memrchr-atom.S",
1119 "arch-x86/atom/string/sse2-strchr-atom.S",
1120 "arch-x86/atom/string/sse2-strnlen-atom.S",
1121 "arch-x86/atom/string/sse2-strrchr-atom.S",
1122 "arch-x86/atom/string/sse2-wcschr-atom.S",
1123 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
1124 "arch-x86/atom/string/sse2-wcslen-atom.S",
1125 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001126 "arch-x86/silvermont/string/sse2-memmove-slm.S",
1127 "arch-x86/silvermont/string/sse2-memset-slm.S",
1128 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
1129 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
1130 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
1131 "arch-x86/silvermont/string/sse2-strlen-slm.S",
1132 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001133
1134 "arch-x86/bionic/__bionic_clone.S",
1135 "arch-x86/bionic/_exit_with_stack_teardown.S",
1136 "arch-x86/bionic/libgcc_compat.c",
1137 "arch-x86/bionic/__restore.S",
1138 "arch-x86/bionic/setjmp.S",
1139 "arch-x86/bionic/syscall.S",
1140 "arch-x86/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001141 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001142
1143 exclude_srcs: [
1144 "bionic/strchr.cpp",
1145 "bionic/strnlen.c",
1146 "bionic/strrchr.cpp",
1147 ],
Colin Cross6ab8f892015-11-23 14:12:15 -08001148 atom: {
1149 srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -08001150 "arch-x86/atom/string/sse2-memset-atom.S",
1151 "arch-x86/atom/string/sse2-strlen-atom.S",
Colin Cross6ab8f892015-11-23 14:12:15 -08001152 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Dan Willemsen701b5452016-01-12 19:35:40 -08001153 "arch-x86/atom/string/ssse3-memcpy-atom.S",
Dan Willemsen701b5452016-01-12 19:35:40 -08001154 "arch-x86/atom/string/ssse3-strcpy-atom.S",
Colin Cross6ab8f892015-11-23 14:12:15 -08001155 "arch-x86/atom/string/ssse3-strncpy-atom.S",
1156 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
1157 ],
1158 exclude_srcs: [
1159 "arch-x86/generic/string/memcmp.S",
Colin Cross6ab8f892015-11-23 14:12:15 -08001160 "arch-x86/silvermont/string/sse2-memmove-slm.S",
1161 "arch-x86/silvermont/string/sse2-memset-slm.S",
1162 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
1163 "arch-x86/silvermont/string/sse2-strlen-slm.S",
1164 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
1165 ],
1166 },
1167 ssse3: {
1168 srcs: [
1169 "arch-x86/atom/string/ssse3-strncat-atom.S",
1170 "arch-x86/atom/string/ssse3-strlcat-atom.S",
1171 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
1172 "arch-x86/atom/string/ssse3-strcat-atom.S",
1173 "arch-x86/atom/string/ssse3-strcmp-atom.S",
1174 "arch-x86/atom/string/ssse3-strncmp-atom.S",
1175 "arch-x86/atom/string/ssse3-wcscat-atom.S",
1176 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
1177 ],
1178 exclude_srcs: [
1179 "arch-x86/generic/string/strcmp.S",
1180 "arch-x86/generic/string/strncmp.S",
1181 "arch-x86/generic/string/strcat.S",
1182 ],
1183 },
1184 sse4: {
1185 srcs: [
1186 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
1187 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
1188 ],
1189 exclude_srcs: [
1190 "arch-x86/generic/string/memcmp.S",
1191 ],
1192 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001193 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001194 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001195 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001196 "arch-x86_64/string/sse2-memmove-slm.S",
1197 "arch-x86_64/string/sse2-memset-slm.S",
1198 "arch-x86_64/string/sse2-stpcpy-slm.S",
1199 "arch-x86_64/string/sse2-stpncpy-slm.S",
1200 "arch-x86_64/string/sse2-strcat-slm.S",
1201 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001202 "arch-x86_64/string/sse2-strlen-slm.S",
1203 "arch-x86_64/string/sse2-strncat-slm.S",
1204 "arch-x86_64/string/sse2-strncpy-slm.S",
1205 "arch-x86_64/string/sse4-memcmp-slm.S",
1206 "arch-x86_64/string/ssse3-strcmp-slm.S",
1207 "arch-x86_64/string/ssse3-strncmp-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001208
1209 "arch-x86_64/bionic/__bionic_clone.S",
1210 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1211 "arch-x86_64/bionic/__restore_rt.S",
1212 "arch-x86_64/bionic/setjmp.S",
1213 "arch-x86_64/bionic/syscall.S",
1214 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001215 ],
1216 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001217 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001218
Colin Cross50c21ab2015-10-31 23:03:05 -07001219 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001220 include_dirs: ["bionic/libstdc++/include"],
1221 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001222}
1223
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001224genrule {
1225 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001226 out: ["generated_android_ids.h"],
1227 srcs: [":android_filesystem_config_header"],
1228 tool_files: ["fs_config_generator.py"],
1229 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001230}
1231
Dan Willemsen268a6732015-10-15 14:49:45 -07001232// ========================================================
1233// libc_bionic_ndk.a- The portions of libc_bionic that can
1234// be safely used in libc_ndk.a (no troublesome global data
1235// or constructors).
1236// ========================================================
1237cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001238 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001239 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001240 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001241 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001242 "bionic/__cmsg_nxthdr.cpp",
1243 "bionic/__errno.cpp",
1244 "bionic/__gnu_basename.cpp",
1245 "bionic/__libc_current_sigrtmax.cpp",
1246 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001247 "bionic/abort.cpp",
1248 "bionic/accept.cpp",
1249 "bionic/accept4.cpp",
1250 "bionic/access.cpp",
1251 "bionic/arpa_inet.cpp",
1252 "bionic/assert.cpp",
1253 "bionic/atof.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001254 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001255 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001256 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001257 "bionic/bionic_systrace.cpp",
1258 "bionic/bionic_time_conversions.cpp",
1259 "bionic/brk.cpp",
1260 "bionic/c16rtomb.cpp",
1261 "bionic/c32rtomb.cpp",
1262 "bionic/chmod.cpp",
1263 "bionic/chown.cpp",
1264 "bionic/clearenv.cpp",
1265 "bionic/clock.cpp",
1266 "bionic/clock_getcpuclockid.cpp",
1267 "bionic/clock_nanosleep.cpp",
1268 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001269 "bionic/connect.cpp",
1270 "bionic/ctype.cpp",
1271 "bionic/dirent.cpp",
1272 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001273 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001274 "bionic/error.cpp",
1275 "bionic/eventfd_read.cpp",
1276 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001277 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001278 "bionic/faccessat.cpp",
1279 "bionic/fchmod.cpp",
1280 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001281 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001282 "bionic/ffs.cpp",
1283 "bionic/fgetxattr.cpp",
1284 "bionic/flistxattr.cpp",
1285 "bionic/flockfile.cpp",
1286 "bionic/fpclassify.cpp",
1287 "bionic/fsetxattr.cpp",
1288 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001289 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001290 "bionic/futimens.cpp",
1291 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001292 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001293 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001294 "bionic/gethostname.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001295 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001296 "bionic/getpgrp.cpp",
1297 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001298 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001299 "bionic/gettid.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001300 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001301 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001302 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001303 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001304 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001305 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001306 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001307 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001308 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001309 "bionic/lchown.cpp",
1310 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001311 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001312 "bionic/libgen.cpp",
1313 "bionic/link.cpp",
1314 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001315 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001316 "bionic/lstat.cpp",
1317 "bionic/malloc_info.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001318 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001319 "bionic/mbrtoc16.cpp",
1320 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001321 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001322 "bionic/mempcpy.cpp",
1323 "bionic/mkdir.cpp",
1324 "bionic/mkfifo.cpp",
1325 "bionic/mknod.cpp",
1326 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001327 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001328 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001329 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001330 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001331 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001332 "bionic/open.cpp",
1333 "bionic/pathconf.cpp",
1334 "bionic/pause.cpp",
1335 "bionic/pipe.cpp",
1336 "bionic/poll.cpp",
1337 "bionic/posix_fadvise.cpp",
1338 "bionic/posix_fallocate.cpp",
1339 "bionic/posix_madvise.cpp",
1340 "bionic/posix_timers.cpp",
1341 "bionic/ptrace.cpp",
1342 "bionic/pty.cpp",
1343 "bionic/raise.cpp",
1344 "bionic/rand.cpp",
1345 "bionic/readlink.cpp",
1346 "bionic/reboot.cpp",
1347 "bionic/recv.cpp",
1348 "bionic/rename.cpp",
1349 "bionic/rmdir.cpp",
1350 "bionic/scandir.cpp",
1351 "bionic/sched_getaffinity.cpp",
1352 "bionic/sched_getcpu.cpp",
1353 "bionic/semaphore.cpp",
1354 "bionic/send.cpp",
1355 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001356 "bionic/seteuid.cpp",
1357 "bionic/setpgrp.cpp",
1358 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001359 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001360 "bionic/sigprocmask.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001361 "bionic/socket.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001362 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001363 "bionic/stat.cpp",
1364 "bionic/statvfs.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001365 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001366 "bionic/strchrnul.cpp",
1367 "bionic/strerror.cpp",
1368 "bionic/strerror_r.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001369 "bionic/string_l.cpp",
1370 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001371 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001372 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001373 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001374 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001375 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001376 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001377 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001378 "bionic/sys_msg.cpp",
1379 "bionic/sys_sem.cpp",
1380 "bionic/sys_shm.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001381 "bionic/sys_siglist.c",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001382 "bionic/sys_signalfd.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001383 "bionic/sys_signame.c",
Elliott Hughes449eff02016-06-08 19:51:20 -07001384 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001385 "bionic/sysinfo.cpp",
1386 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001387 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001388 "bionic/system_property_api.cpp",
1389 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001390 "bionic/tdestroy.cpp",
1391 "bionic/termios.cpp",
1392 "bionic/thread_private.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001393 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001394 "bionic/tmpfile.cpp",
1395 "bionic/umount.cpp",
1396 "bionic/unlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001397 "bionic/wait.cpp",
1398 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001399 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001400 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001401 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001402 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001403 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001404
1405 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1406 // which will be overridden by the actual one in libc.so.
1407 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001408 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001409
Dan Willemsen208ae172015-09-16 16:33:27 -07001410 multilib: {
1411 lib32: {
1412 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001413 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001414 },
1415 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001416 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001417 treble_linker_namespaces: {
1418 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001419 },
1420 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001421 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001422 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001423 local_include_dirs: ["stdio"],
1424 include_dirs: ["bionic/libstdc++/include"],
1425 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001426 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001427}
1428
Dan Willemsen208ae172015-09-16 16:33:27 -07001429// ========================================================
1430// libc_pthread.a - pthreads parts that previously lived in
1431// libc_bionic.a. Relocated to their own library because
1432// they can't be included in libc_ndk.a (as they layout of
1433// pthread_t has changed over the years and has ABI
1434// compatibility issues).
1435// ========================================================
1436
1437cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001438 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001439 srcs: [
1440 "bionic/pthread_atfork.cpp",
1441 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001442 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001443 "bionic/pthread_cond.cpp",
1444 "bionic/pthread_create.cpp",
1445 "bionic/pthread_detach.cpp",
1446 "bionic/pthread_equal.cpp",
1447 "bionic/pthread_exit.cpp",
1448 "bionic/pthread_getcpuclockid.cpp",
1449 "bionic/pthread_getschedparam.cpp",
1450 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001451 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001452 "bionic/pthread_join.cpp",
1453 "bionic/pthread_key.cpp",
1454 "bionic/pthread_kill.cpp",
1455 "bionic/pthread_mutex.cpp",
1456 "bionic/pthread_once.cpp",
1457 "bionic/pthread_rwlock.cpp",
1458 "bionic/pthread_self.cpp",
1459 "bionic/pthread_setname_np.cpp",
1460 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001461 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001462
1463 // The following implementations depend on pthread data or implementation,
1464 // so we can't include them in libc_ndk.a.
1465 "bionic/__cxa_thread_atexit_impl.cpp",
1466 "stdlib/atexit.c",
1467 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001468 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001469
Colin Cross50c21ab2015-10-31 23:03:05 -07001470 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001471 include_dirs: ["bionic/libstdc++/include"],
1472 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001473}
1474
1475// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001476// libc_syscalls.a
1477// ========================================================
1478
1479cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001480 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001481 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001482 arch: {
1483 arm: {
1484 srcs: ["arch-arm/syscalls/**/*.S"],
1485 },
1486 arm64: {
1487 srcs: ["arch-arm64/syscalls/**/*.S"],
1488 },
1489 mips: {
1490 srcs: ["arch-mips/syscalls/**/*.S"],
1491 },
1492 mips64: {
1493 srcs: ["arch-mips64/syscalls/**/*.S"],
1494 },
1495 x86: {
1496 srcs: ["arch-x86/syscalls/**/*.S"],
1497 },
1498 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001499 srcs: ["arch-x86_64/syscalls/**/*.S"],
1500 },
1501 },
1502 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001503}
1504
1505// ========================================================
1506// libc_aeabi.a
1507// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1508// to avoid infinite recursion. For the other architectures we just build an
1509// empty library to keep this makefile simple.
1510// ========================================================
1511
1512cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001513 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001514 arch: {
1515 arm: {
1516 srcs: ["arch-arm/bionic/__aeabi.c"],
1517 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001518 },
1519 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001520 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001521}
1522
1523// ========================================================
1524// libc_ndk.a
1525// Compatibility library for the NDK. This library contains
1526// all the parts of libc that are safe to statically link.
1527// We can't safely statically link things that can only run
1528// on a certain version of the OS. Examples include
1529// anything that talks to netd (a large portion of the DNS
1530// code) and anything that is dependent on the layout of a
1531// data structure that has changed across releases (such as
1532// pthread_t).
1533// ========================================================
1534
1535cc_library_static {
1536 name: "libc_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001537 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001538 srcs: libc_common_src_files + ["bionic/malloc_common.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001539 multilib: {
1540 lib32: {
1541 srcs: libc_common_src_files_32,
1542 },
1543 },
1544 arch: {
1545 arm: {
1546 srcs: [
1547 "arch-arm/bionic/exidx_dynamic.c",
1548 "arch-common/bionic/crtbegin_so.c",
1549 "arch-arm/bionic/atexit_legacy.c",
1550 "arch-common/bionic/crtend_so.S",
1551 ],
1552 whole_static_libs: ["libc_aeabi"],
1553 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001554 },
1555
Colin Cross50c21ab2015-10-31 23:03:05 -07001556 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001557 "-fvisibility=hidden",
1558 "-DLIBC_STATIC",
1559 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001560
1561 whole_static_libs: [
1562 "libc_bionic_ndk",
George Burgess IV6cb06872017-07-21 13:28:42 -07001563 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001564 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001565 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001566 "libc_gdtoa",
1567 "libc_malloc",
1568 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001569 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001570 "libc_openbsd_ndk",
1571 "libc_stack_protector",
1572 "libc_syscalls",
1573 "libc_tzcode",
1574 "libm",
Dan Willemsen3e621712016-02-03 21:48:08 -08001575 "libjemalloc",
Elliott Hughes816fab92016-05-27 17:57:46 -07001576 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001577 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001578}
1579
1580// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001581// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001582// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001583cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001584 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001585 srcs: libc_common_src_files,
1586 multilib: {
1587 lib32: {
1588 srcs: libc_common_src_files_32,
1589 },
1590 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001591 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001592
1593 whole_static_libs: [
1594 "libc_bionic",
1595 "libc_bionic_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001596 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001597 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001598 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001599 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001600 "libc_gdtoa",
1601 "libc_malloc",
1602 "libc_netbsd",
1603 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001604 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001605 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001606 "libc_stack_protector",
1607 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001608 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001609 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001610 ],
1611
1612 arch: {
1613 arm: {
1614 whole_static_libs: ["libc_aeabi"],
1615 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001616 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001617}
1618
1619// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001620// libc_common.a
1621// ========================================================
1622
1623cc_library_static {
1624 defaults: ["libc_defaults"],
1625 name: "libc_common",
1626
1627 whole_static_libs: [
1628 "libc_nopthread",
1629 "libc_pthread",
1630 ],
1631}
1632
1633// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001634// libc_nomalloc.a
1635// ========================================================
1636//
1637// This is a version of the static C library that does not
1638// include malloc. It's useful in situations when the user wants
1639// to provide their own malloc implementation, or wants to
1640// explicitly disallow the use of malloc, such as in the
1641// dynamic linker.
1642
1643cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001644 name: "libc_nomalloc",
1645
Colin Cross50c21ab2015-10-31 23:03:05 -07001646 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001647
1648 arch: {
1649 arm: {
1650 srcs: ["arch-arm/bionic/exidx_static.c"],
1651 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001652 },
1653
Colin Cross50c21ab2015-10-31 23:03:05 -07001654 cflags: ["-DLIBC_STATIC"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001655
Colin Crossa3f9fca2016-01-11 13:20:55 -08001656 whole_static_libs: [
1657 "libc_common",
1658 "libc_init_static",
1659 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001660}
1661
1662// ========================================================
1663// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1664// ========================================================
1665cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001666 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001667 srcs: ["bionic/jemalloc_wrapper.cpp"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001668 cflags: ["-fvisibility=hidden"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001669
Dan Willemsen208ae172015-09-16 16:33:27 -07001670 name: "libc_malloc",
Dan Willemsen208ae172015-09-16 16:33:27 -07001671}
1672
1673// ========================================================
1674// libc.a + libc.so
1675// ========================================================
1676cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001677 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001678 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001679 static_ndk_lib: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001680 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001681 platform_sdk_version: {
1682 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1683 },
1684 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001685 static: {
1686 srcs: [
1687 "bionic/dl_iterate_phdr_static.cpp",
Dan Willemsen0c657082016-05-12 01:43:07 -07001688 "bionic/malloc_common.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001689 ],
1690 cflags: ["-DLIBC_STATIC"],
Christopher Ferris7a3681e2017-04-24 17:48:32 -07001691 whole_static_libs: ["libc_init_static"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001692 },
1693 shared: {
1694 srcs: [
1695 "arch-common/bionic/crtbegin_so.c",
1696 "arch-common/bionic/crtbrand.S",
Elliott Hughesa57ca0d2016-11-17 18:18:08 -08001697 "bionic/icu.cpp",
Dan Willemsen0c657082016-05-12 01:43:07 -07001698 "bionic/malloc_common.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001699 "bionic/NetdClient.cpp",
1700 "arch-common/bionic/crtend_so.S",
1701 ],
Stephen Cranef4b1cbd2017-05-09 14:27:43 -07001702 whole_static_libs: ["libc_init_dynamic"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001703 },
1704
1705 required: ["tzdata"],
1706
1707 // Leave the symbols in the shared library so that stack unwinders can produce
1708 // meaningful name resolution.
Colin Cross37f36322016-04-25 14:09:13 -07001709 strip: {
1710 keep_symbols: true,
1711 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001712
Colin Cross4ce94d22016-11-15 13:15:43 -08001713 // Do not pack libc.so relocations; see http://b/20645321 for details.
1714 pack_relocations: false,
1715
dimitry06016f22018-01-05 11:39:28 +01001716 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1717 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1718 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1719 // those new libraries from libgcc.a are not declared external; if that were the case,
1720 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1721 // on the external symbols from the dependent libraries. That would create a "cloaked"
1722 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001723
dimitry06016f22018-01-05 11:39:28 +01001724 shared_libs: [
1725 "ld-android",
1726 "libdl",
1727 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001728 whole_static_libs: [
1729 "libc_common",
1730 "libjemalloc",
1731 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001732
1733 nocrt: true,
1734
Dan Willemsen208ae172015-09-16 16:33:27 -07001735 arch: {
1736 arm: {
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001737 //TODO: This is to work around b/24465209. Remove after root cause is fixed
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001738 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001739 ldflags: ["-Wl,--hash-style=both"],
1740
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001741 // Don't re-export new/delete and friends, even if the compiler really wants to.
1742 version_script: "libc.arm.map",
1743
Dan Willemsen208ae172015-09-16 16:33:27 -07001744 shared: {
Dan Willemsen0c657082016-05-12 01:43:07 -07001745 srcs: [
1746 "arch-arm/bionic/exidx_dynamic.c",
1747
1748 // special for arm
1749 "arch-arm/bionic/atexit_legacy.c",
1750 ],
1751 // special for arm
1752 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001753 },
1754 static: {
1755 srcs: ["arch-arm/bionic/exidx_static.c"],
1756 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001757 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001758 arm64: {
1759 // Don't re-export new/delete and friends, even if the compiler really wants to.
1760 version_script: "libc.arm64.map",
1761 },
1762 mips: {
1763 // Don't re-export new/delete and friends, even if the compiler really wants to.
1764 version_script: "libc.mips.map",
1765 },
1766 mips64: {
1767 // Don't re-export new/delete and friends, even if the compiler really wants to.
1768 version_script: "libc.mips64.map",
1769 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001770 x86: {
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001771 //TODO: This is to work around b/24465209. Remove after root cause is fixed
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001772 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001773 ldflags: ["-Wl,--hash-style=both"],
1774
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001775 // Don't re-export new/delete and friends, even if the compiler really wants to.
1776 version_script: "libc.x86.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001777 },
1778 x86_64: {
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001779 // Don't re-export new/delete and friends, even if the compiler really wants to.
1780 version_script: "libc.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001781 },
1782 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001783}
1784
Dan Willemsen208ae172015-09-16 16:33:27 -07001785// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001786// libstdc++.so + libstdc++.a
1787// ========================================================
1788cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001789 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001790 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001791 srcs: [
1792 "bionic/__cxa_guard.cpp",
1793 "bionic/__cxa_pure_virtual.cpp",
1794 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001795 ],
1796 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001797 static_ndk_lib: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001798 system_shared_libs: ["libc"],
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001799 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001800
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001801 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001802 arch: {
1803 arm: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001804 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001805 ldflags: ["-Wl,--hash-style=both"],
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001806 version_script: "libstdc++.arm.map",
1807 },
1808 arm64: {
1809 version_script: "libstdc++.arm64.map",
1810 },
1811 mips: {
1812 version_script: "libstdc++.mips.map",
1813 },
1814 mips64: {
1815 version_script: "libstdc++.mips64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001816 },
1817 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001818 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001819 ldflags: ["-Wl,--hash-style=both"],
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001820 version_script: "libstdc++.x86.map",
1821 },
1822 x86_64: {
1823 version_script: "libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001824 },
1825 },
1826}
1827
Colin Cross50c21ab2015-10-31 23:03:05 -07001828cc_defaults {
1829 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001830 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001831 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001832 recovery_available: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001833
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001834 cflags: [
1835 "-Wno-gcc-compat",
1836 "-Wall",
1837 "-Werror",
1838 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001839}
1840
Colin Cross50c21ab2015-10-31 23:03:05 -07001841cc_defaults {
1842 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001843 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001844
1845 arch: {
1846 mips: {
1847 cflags: ["-fPIC"],
1848 },
1849 mips64: {
1850 cflags: ["-fPIC"],
1851 },
1852 x86: {
1853 cflags: ["-fPIC"],
1854 },
1855 x86_64: {
1856 cflags: ["-fPIC"],
1857 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001858 },
1859}
1860
Dan Willemsena3ed9012017-04-04 15:51:26 -07001861// crt obj files
Dan Willemsen208ae172015-09-16 16:33:27 -07001862cc_object {
1863 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001864 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001865 local_include_dirs: ["include"],
1866 product_variables: {
1867 platform_sdk_version: {
1868 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1869 },
1870 },
1871 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001872
Colin Cross7d7b3682017-11-03 13:38:40 -07001873 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001874}
1875
Dan Willemsen208ae172015-09-16 16:33:27 -07001876cc_object {
1877 name: "crtbegin_so1",
1878 local_include_dirs: ["include"],
1879 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001880
Colin Cross7d7b3682017-11-03 13:38:40 -07001881 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001882}
1883
Dan Willemsen208ae172015-09-16 16:33:27 -07001884cc_object {
1885 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07001886
Colin Cross7d7b3682017-11-03 13:38:40 -07001887 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07001888 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001889 "crtbegin_so1",
1890 "crtbrand",
1891 ],
1892}
1893
Dan Willemsen208ae172015-09-16 16:33:27 -07001894cc_object {
1895 name: "crtend_so",
1896 local_include_dirs: ["include"],
1897 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001898
Colin Cross7d7b3682017-11-03 13:38:40 -07001899 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001900}
1901
Dan Willemsen208ae172015-09-16 16:33:27 -07001902cc_object {
1903 name: "crtbegin_static1",
1904 local_include_dirs: ["include"],
1905 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001906
Colin Cross50c21ab2015-10-31 23:03:05 -07001907 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001908 mips: {
1909 srcs: [
1910 "arch-mips/bionic/crtbegin.c",
1911 ],
1912 exclude_srcs: [
1913 "arch-common/bionic/crtbegin.c",
1914 ],
1915 },
1916 mips64: {
1917 srcs: [
1918 "arch-mips64/bionic/crtbegin.c",
1919 ],
1920 exclude_srcs: [
1921 "arch-common/bionic/crtbegin.c",
1922 ],
1923 },
1924 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001925
1926 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001927}
1928
Dan Willemsen208ae172015-09-16 16:33:27 -07001929cc_object {
1930 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07001931
Colin Cross77d57bf2016-04-11 14:34:18 -07001932 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001933 "crtbegin_static1",
1934 "crtbrand",
1935 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001936 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001937}
1938
Dan Willemsen208ae172015-09-16 16:33:27 -07001939cc_object {
1940 name: "crtbegin_dynamic1",
1941 local_include_dirs: ["include"],
1942 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001943
Colin Cross50c21ab2015-10-31 23:03:05 -07001944 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001945 mips: {
1946 srcs: [
1947 "arch-mips/bionic/crtbegin.c",
1948 ],
1949 exclude_srcs: [
1950 "arch-common/bionic/crtbegin.c",
1951 ],
1952 },
1953 mips64: {
1954 srcs: [
1955 "arch-mips64/bionic/crtbegin.c",
1956 ],
1957 exclude_srcs: [
1958 "arch-common/bionic/crtbegin.c",
1959 ],
1960 },
1961 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001962 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001963}
1964
Dan Willemsen208ae172015-09-16 16:33:27 -07001965cc_object {
1966 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07001967
Colin Cross77d57bf2016-04-11 14:34:18 -07001968 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001969 "crtbegin_dynamic1",
1970 "crtbrand",
1971 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07001972 target: {
1973 linux_bionic: {
1974 generated_sources: ["host_bionic_linker_asm"],
1975 objs: [
1976 "linker_wrapper",
1977 ],
1978 },
1979 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001980 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001981}
1982
Dan Willemsen208ae172015-09-16 16:33:27 -07001983cc_object {
1984 // We rename crtend.o to crtend_android.o to avoid a
1985 // name clash between gcc and bionic.
1986 name: "crtend_android",
1987 local_include_dirs: ["include"],
1988 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001989
Colin Cross50c21ab2015-10-31 23:03:05 -07001990 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001991}
Colin Crossbaa48992016-07-13 11:15:21 -07001992
Dan Albert26e1c412018-05-24 14:56:46 -07001993versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07001994 name: "common_libc",
1995 from: "include",
1996 to: "",
1997 license: "NOTICE",
1998}
Dan Albert4238a352016-06-28 11:18:05 -07001999
2000ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002001 name: "libc_uapi",
2002 from: "kernel/uapi",
2003 to: "",
2004 srcs: [
2005 "kernel/uapi/asm-generic/**/*.h",
2006 "kernel/uapi/drm/**/*.h",
2007 "kernel/uapi/linux/**/*.h",
2008 "kernel/uapi/misc/**/*.h",
2009 "kernel/uapi/mtd/**/*.h",
2010 "kernel/uapi/rdma/**/*.h",
2011 "kernel/uapi/scsi/**/*.h",
2012 "kernel/uapi/sound/**/*.h",
2013 "kernel/uapi/video/**/*.h",
2014 "kernel/uapi/xen/**/*.h",
2015 ],
Dan Albert92592652016-10-20 01:42:54 -07002016 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002017}
2018
2019ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002020 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002021 from: "kernel/android/uapi/linux",
2022 to: "linux",
2023 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002024 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002025}
2026
2027ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002028 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002029 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002030 to: "scsi",
2031 srcs: ["kernel/android/scsi/**/*.h"],
2032 license: "NOTICE",
2033}
2034
2035ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002036 name: "libc_asm_arm",
2037 from: "kernel/uapi/asm-arm",
2038 to: "arm-linux-androideabi",
2039 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002040 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002041}
2042
2043ndk_headers {
2044 name: "libc_asm_arm64",
2045 from: "kernel/uapi/asm-arm64",
2046 to: "aarch64-linux-android",
2047 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002048 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002049}
2050
Elliott Hughesee291c02017-12-11 11:32:34 -08002051// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002052ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002053 name: "libc_asm_mips",
2054 from: "kernel/uapi/asm-mips",
2055 to: "mipsel-linux-android",
2056 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2057 license: "NOTICE",
2058}
2059
Elliott Hughesee291c02017-12-11 11:32:34 -08002060// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002061ndk_headers {
2062 name: "libc_asm_mips64",
2063 from: "kernel/uapi/asm-mips",
2064 to: "mips64el-linux-android",
2065 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2066 license: "NOTICE",
2067}
2068
2069ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002070 name: "libc_asm_x86",
2071 from: "kernel/uapi/asm-x86",
2072 to: "i686-linux-android",
2073 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002074 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002075}
2076
2077ndk_headers {
2078 name: "libc_asm_x86_64",
2079 from: "kernel/uapi/asm-x86",
2080 to: "x86_64-linux-android",
2081 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002082 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002083}
2084
Dan Albert4238a352016-06-28 11:18:05 -07002085ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002086 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002087 symbol_file: "libc.map.txt",
2088 first_version: "9",
2089}
2090
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002091llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002092 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002093 symbol_file: "libc.map.txt",
2094 export_headers_as_system: true,
2095 export_preprocessed_headers: ["include"],
2096 arch: {
2097 arm: {
2098 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002099 "kernel/uapi",
2100 "kernel/uapi/asm-arm",
2101 "kernel/android/uapi",
2102 ],
2103 },
2104 arm64: {
2105 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002106 "kernel/uapi",
2107 "kernel/uapi/asm-arm64",
2108 "kernel/android/uapi",
2109 ],
2110 },
2111 mips: {
2112 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002113 "kernel/uapi",
2114 "kernel/uapi/asm-mips",
2115 "kernel/android/uapi",
2116 ],
2117 },
2118 mips64: {
2119 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002120 "kernel/uapi",
2121 "kernel/uapi/asm-mips",
2122 "kernel/android/uapi",
2123 ],
2124 },
2125 x86: {
2126 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002127 "kernel/uapi",
2128 "kernel/uapi/asm-x86",
2129 "kernel/android/uapi",
2130 ],
2131 },
2132 x86_64: {
2133 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002134 "kernel/uapi",
2135 "kernel/uapi/asm-x86",
2136 "kernel/android/uapi",
2137 ],
2138 },
2139 },
2140}
2141
Dan Albertdf31aff2016-10-06 15:50:41 -07002142ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002143 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002144 symbol_file: "libstdc++.map.txt",
2145 first_version: "9",
2146}
2147
Dan Willemsenca056d72018-01-08 14:00:24 -08002148// Export these headers for toolbox to process
2149filegroup {
2150 name: "kernel_input_headers",
2151 srcs: [
2152 "kernel/uapi/linux/input.h",
2153 "kernel/uapi/linux/input-event-codes.h",
2154 ],
2155}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002156
2157// Generate a syscall name / number mapping. These objects are text files
2158// (thanks to the -dD -E flags) and not binary files. They will then be
2159// consumed by the genseccomp.py script and converted into C++ code.
2160cc_defaults {
2161 name: "libseccomp_gen_syscall_nrs_defaults",
2162 recovery_available: true,
2163 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2164 cflags: [
2165 "-dD",
2166 "-E",
2167 "-Wall",
2168 "-Werror",
2169 "-nostdinc",
2170 ],
2171}
2172
2173cc_object {
2174 name: "libseccomp_gen_syscall_nrs_arm",
2175 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2176 local_include_dirs: [
2177 "kernel/uapi/asm-arm",
2178 "kernel/uapi",
2179 ],
2180}
2181
2182cc_object {
2183 name: "libseccomp_gen_syscall_nrs_arm64",
2184 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2185 local_include_dirs: [
2186 "kernel/uapi/asm-arm64",
2187 "kernel/uapi",
2188 ],
2189}
2190
2191cc_object {
2192 name: "libseccomp_gen_syscall_nrs_x86",
2193 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2194 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2195 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2196 local_include_dirs: [
2197 "kernel/uapi/asm-x86",
2198 "kernel/uapi",
2199 ],
2200}
2201
2202cc_object {
2203 name: "libseccomp_gen_syscall_nrs_x86_64",
2204 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2205 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2206 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2207 local_include_dirs: [
2208 "kernel/uapi/asm-x86",
2209 "kernel/uapi",
2210 ],
2211}
2212
2213cc_object {
2214 name: "libseccomp_gen_syscall_nrs_mips",
2215 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2216 cflags: [
2217 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2218 ],
2219 local_include_dirs: [
2220 "kernel/uapi/asm-mips",
2221 "kernel/uapi",
2222 ],
2223}
2224
2225cc_object {
2226 name: "libseccomp_gen_syscall_nrs_mips64",
2227 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2228 cflags: [
2229 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2230 ],
2231 local_include_dirs: [
2232 "kernel/uapi/asm-mips",
2233 "kernel/uapi",
2234 ],
2235}
2236
2237// Generate the C++ policy sources for app, system, and global seccomp-bpf
2238// filters.
2239python_binary_host {
2240 name: "genseccomp",
2241 main: "tools/genseccomp.py",
2242
2243 srcs: [
2244 "tools/genseccomp.py",
2245 "tools/gensyscalls.py",
2246 ],
2247
2248 data: [
2249 "kernel/uapi/**/*.h",
2250 ],
2251
2252 version: {
2253 py2: {
2254 enabled: true,
2255 },
2256 py3: {
2257 enabled: false,
2258 },
2259 },
2260}
2261
2262cc_genrule {
2263 name: "libseccomp_policy_app_sources",
2264 recovery_available: true,
2265 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2266
2267 tools: [ "genseccomp" ],
2268
2269 srcs: [
2270 "SYSCALLS.TXT",
2271 "SECCOMP_WHITELIST_COMMON.TXT",
2272 "SECCOMP_WHITELIST_APP.TXT",
2273 "SECCOMP_BLACKLIST_COMMON.TXT",
2274 "SECCOMP_BLACKLIST_APP.TXT",
2275 ":libseccomp_gen_syscall_nrs_arm",
2276 ":libseccomp_gen_syscall_nrs_arm64",
2277 ":libseccomp_gen_syscall_nrs_mips",
2278 ":libseccomp_gen_syscall_nrs_mips64",
2279 ":libseccomp_gen_syscall_nrs_x86",
2280 ":libseccomp_gen_syscall_nrs_x86_64",
2281 ],
2282
2283 out: [
2284 "arm64_app_policy.cpp",
2285 "arm_app_policy.cpp",
2286 "mips64_app_policy.cpp",
2287 "mips_app_policy.cpp",
2288 "x86_64_app_policy.cpp",
2289 "x86_app_policy.cpp",
2290 ],
2291}
2292
2293cc_genrule {
2294 name: "libseccomp_policy_system_sources",
2295 recovery_available: true,
2296 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2297
2298 tools: [ "genseccomp" ],
2299
2300 srcs: [
2301 "SYSCALLS.TXT",
2302 "SECCOMP_WHITELIST_COMMON.TXT",
2303 "SECCOMP_WHITELIST_SYSTEM.TXT",
2304 "SECCOMP_BLACKLIST_COMMON.TXT",
2305 ":libseccomp_gen_syscall_nrs_arm",
2306 ":libseccomp_gen_syscall_nrs_arm64",
2307 ":libseccomp_gen_syscall_nrs_mips",
2308 ":libseccomp_gen_syscall_nrs_mips64",
2309 ":libseccomp_gen_syscall_nrs_x86",
2310 ":libseccomp_gen_syscall_nrs_x86_64",
2311 ],
2312
2313 out: [
2314 "arm64_system_policy.cpp",
2315 "arm_system_policy.cpp",
2316 "mips64_system_policy.cpp",
2317 "mips_system_policy.cpp",
2318 "x86_64_system_policy.cpp",
2319 "x86_system_policy.cpp",
2320 ],
2321}
2322
2323cc_genrule {
2324 name: "libseccomp_policy_global_sources",
2325 recovery_available: true,
2326 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=global $(in)",
2327
2328 tools: [ "genseccomp" ],
2329
2330 srcs: [
2331 "SYSCALLS.TXT",
2332 "SECCOMP_WHITELIST_COMMON.TXT",
2333 "SECCOMP_WHITELIST_SYSTEM.TXT",
2334 "SECCOMP_WHITELIST_APP.TXT",
2335 "SECCOMP_WHITELIST_GLOBAL.TXT",
2336 "SECCOMP_BLACKLIST_COMMON.TXT",
2337 ":libseccomp_gen_syscall_nrs_arm",
2338 ":libseccomp_gen_syscall_nrs_arm64",
2339 ":libseccomp_gen_syscall_nrs_mips",
2340 ":libseccomp_gen_syscall_nrs_mips64",
2341 ":libseccomp_gen_syscall_nrs_x86",
2342 ":libseccomp_gen_syscall_nrs_x86_64",
2343 ],
2344
2345 out: [
2346 "arm64_global_policy.cpp",
2347 "arm_global_policy.cpp",
2348 "mips64_global_policy.cpp",
2349 "mips_global_policy.cpp",
2350 "x86_64_global_policy.cpp",
2351 "x86_global_policy.cpp",
2352 ],
2353}
2354
2355cc_library {
2356 name: "libseccomp_policy",
2357 recovery_available: true,
2358 generated_sources: [
2359 "libseccomp_policy_app_sources",
2360 "libseccomp_policy_global_sources",
2361 "libseccomp_policy_system_sources",
2362 ],
2363
2364 srcs: [
2365 "seccomp/seccomp_policy.cpp",
2366 ],
2367
2368 export_include_dirs: ["seccomp/include"],
2369 cflags: [
2370 "-Wall",
2371 "-Werror",
2372 ],
2373 shared: {
2374 shared_libs: ["libbase"],
2375 },
2376 static: {
2377 static_libs: ["libbase"],
2378 },
2379}