blob: c08df9d9bc20e0fbb2a64152d90320e94c058c54 [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001// Define the common source files for all the libc instances
2// =========================================================
3libc_common_src_files = [
Christopher Ferris7a3681e2017-04-24 17:48:32 -07004 "async_safe/async_safe_log.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07005 "bionic/ether_aton.c",
6 "bionic/ether_ntoa.c",
7 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/pututline.c",
11 "bionic/sched_cpualloc.c",
12 "bionic/sched_cpucount.c",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070013 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070014 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070015 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080016 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070017 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080018 "stdio/vfscanf.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070019 "stdio/vfwscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070020 "stdlib/exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070021]
22
23// Various kinds of cruft.
24// ========================================================
25libc_common_src_files += [
26 "bionic/ndk_cruft.cpp",
27]
28
29libc_common_src_files_32 = [
30 "bionic/legacy_32_bit_support.cpp",
31 "bionic/time64.c",
32]
33
Elliott Hughes53cf3482016-08-09 13:06:41 -070034libc_common_flags = [
35 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080036 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070037 "-Wall",
38 "-Wextra",
39 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080040 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070041 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070042 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070043 "-Wframe-larger-than=2048",
George Burgess IVfa5410f2018-08-13 17:44:06 -070044 "-Wimplicit-fallthrough",
Elliott Hughes53cf3482016-08-09 13:06:41 -070045
46 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
47 "-Werror=pointer-to-int-cast",
48 "-Werror=int-to-pointer-cast",
49 "-Werror=type-limits",
50 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080051
52 // Clang's exit-time destructor registration hides __dso_handle, but
53 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
54 "-Wexit-time-destructors",
Elliott Hughes53cf3482016-08-09 13:06:41 -070055]
56
Dan Willemsen208ae172015-09-16 16:33:27 -070057// Define some common cflags
58// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070059cc_defaults {
60 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080061 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070062 cflags: libc_common_flags,
63 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070064 conlyflags: ["-std=gnu99"],
65 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070066 include_dirs: [
67 "bionic/libc/async_safe/include",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -070068 "external/jemalloc_new/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070069 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070070
Colin Cross50c21ab2015-10-31 23:03:05 -070071 stl: "none",
72 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070073 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070074 address: false,
75 integer_overflow: false,
Colin Cross27c43c52016-04-07 13:27:24 -070076 },
Colin Cross50c21ab2015-10-31 23:03:05 -070077 native_coverage: false,
Jiyong Park5603c6e2018-04-27 21:53:11 +090078 recovery_available: true,
Dan Willemsen208ae172015-09-16 16:33:27 -070079}
80
Dan Willemsen208ae172015-09-16 16:33:27 -070081// ANDROIDMK TRANSLATION ERROR: unsupported directive
82// ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
83//libc_common_cflags += ["-DDEBUG"]
84// ANDROIDMK TRANSLATION ERROR: unsupported directive
85// endif
86
Dan Willemsen208ae172015-09-16 16:33:27 -070087// ========================================================
88// libc_stack_protector.a - stack protector code
89// ========================================================
90//
Colin Crossa3f9fca2016-01-11 13:20:55 -080091// Code that implements the stack protector (or that runs
92// before TLS has been set up) needs to be compiled with
93// -fno-stack-protector, since it accesses the stack canary
94// TLS slot.
Dan Willemsen208ae172015-09-16 16:33:27 -070095
96cc_library_static {
97
Colin Crossa3f9fca2016-01-11 13:20:55 -080098 srcs: [
99 "bionic/__libc_init_main_thread.cpp",
100 "bionic/__stack_chk_fail.cpp",
101 ],
102 arch: {
103 arm64: {
104 srcs: ["arch-arm64/bionic/__set_tls.c"],
105 },
106 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700107 srcs: [
108 "arch-x86/bionic/__libc_init_sysinfo.cpp",
109 "arch-x86/bionic/__set_tls.cpp",
110 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800111 },
112 x86_64: {
113 srcs: ["arch-x86_64/bionic/__set_tls.c"],
114 },
115 },
116
Colin Cross50c21ab2015-10-31 23:03:05 -0700117 defaults: ["libc_defaults"],
118 cflags: ["-fno-stack-protector"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700119 name: "libc_stack_protector",
Dan Willemsen208ae172015-09-16 16:33:27 -0700120}
121
Colin Crossa3f9fca2016-01-11 13:20:55 -0800122// libc_init_static.cpp also needs to be built without stack protector,
123// because it's responsible for setting up TLS for static executables.
124// This isn't the case for dynamic executables because the dynamic linker
125// has already set up the main thread's TLS.
126
127cc_library_static {
128 name: "libc_init_static",
129 defaults: ["libc_defaults"],
130 srcs: ["bionic/libc_init_static.cpp"],
131 cflags: ["-fno-stack-protector"],
132}
133
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700134cc_library_static {
135 name: "libc_init_dynamic",
136 defaults: ["libc_defaults"],
137 srcs: ["bionic/libc_init_dynamic.cpp"],
138 cflags: ["-fno-stack-protector"],
139}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800140
Dan Willemsen208ae172015-09-16 16:33:27 -0700141// ========================================================
142// libc_tzcode.a - upstream 'tzcode' code
143// ========================================================
144
145cc_library_static {
146
Colin Cross50c21ab2015-10-31 23:03:05 -0700147 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700148 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800149 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700150 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700151 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
152 ],
153
Colin Cross50c21ab2015-10-31 23:03:05 -0700154 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700155 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700156 // Don't use ridiculous amounts of stack.
157 "-DALL_STATE",
158 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
159 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800160 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700161 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700162 // The name of the tm_gmtoff field in our struct tm.
163 "-DTM_GMTOFF=tm_gmtoff",
164 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700165 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700166 // Include `tzname`, `timezone`, and `daylight` globals.
167 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700168 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800169 // Use the empty string (instead of " ") as the timezone abbreviation
170 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700171 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700172 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
173 "-Dlint",
174 ],
175
Dan Willemsen208ae172015-09-16 16:33:27 -0700176 local_include_dirs: ["tzcode/"],
177 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700178}
179
180// ========================================================
181// libc_dns.a - modified NetBSD DNS code
182// ========================================================
183
184cc_library_static {
185
Colin Cross50c21ab2015-10-31 23:03:05 -0700186 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700187 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800188 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700189
190 "upstream-netbsd/lib/libc/isc/ev_streams.c",
191 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700192 ],
193
Colin Cross50c21ab2015-10-31 23:03:05 -0700194 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700195 "-DANDROID_CHANGES",
196 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700197 "-Wno-unused-parameter",
198 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700199 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700200 ],
201
Dan Willemsen208ae172015-09-16 16:33:27 -0700202 local_include_dirs: [
203 "dns/include",
204 "private",
205 "upstream-netbsd/lib/libc/include",
206 "upstream-netbsd/android/include",
207 ],
208
209 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700210}
211
212// ========================================================
213// libc_freebsd.a - upstream FreeBSD C library code
214// ========================================================
215//
216// These files are built with the freebsd-compat.h header file
217// automatically included.
218
219cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700220 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700221 srcs: [
222 "upstream-freebsd/lib/libc/gen/ldexp.c",
223 "upstream-freebsd/lib/libc/gen/sleep.c",
224 "upstream-freebsd/lib/libc/gen/usleep.c",
225 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700226 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
227 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
228 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
229 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700230 "upstream-freebsd/lib/libc/stdlib/qsort.c",
231 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700232 "upstream-freebsd/lib/libc/string/wcpcpy.c",
233 "upstream-freebsd/lib/libc/string/wcpncpy.c",
234 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700235 "upstream-freebsd/lib/libc/string/wcscat.c",
236 "upstream-freebsd/lib/libc/string/wcschr.c",
237 "upstream-freebsd/lib/libc/string/wcscmp.c",
238 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700239 "upstream-freebsd/lib/libc/string/wcscspn.c",
240 "upstream-freebsd/lib/libc/string/wcsdup.c",
241 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700242 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700243 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
244 "upstream-freebsd/lib/libc/string/wcsncat.c",
245 "upstream-freebsd/lib/libc/string/wcsncmp.c",
246 "upstream-freebsd/lib/libc/string/wcsncpy.c",
247 "upstream-freebsd/lib/libc/string/wcsnlen.c",
248 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700249 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700250 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700251 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700252 "upstream-freebsd/lib/libc/string/wcstok.c",
253 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700254 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700255 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700256 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800257 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700258 ],
259 arch: {
260 arm64: {
261 exclude_srcs: [
262 "upstream-freebsd/lib/libc/string/wmemmove.c",
263 ],
264 },
265 x86: {
266 exclude_srcs: [
267 "upstream-freebsd/lib/libc/string/wcschr.c",
268 "upstream-freebsd/lib/libc/string/wcscmp.c",
269 "upstream-freebsd/lib/libc/string/wcslen.c",
270 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700271 "upstream-freebsd/lib/libc/string/wmemcmp.c",
272 "upstream-freebsd/lib/libc/string/wcscat.c",
273 "upstream-freebsd/lib/libc/string/wcscpy.c",
274 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700275 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700276 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700277 },
278
Colin Cross50c21ab2015-10-31 23:03:05 -0700279 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700280 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700281 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700282 "-include freebsd-compat.h",
283 ],
284
Dan Willemsen208ae172015-09-16 16:33:27 -0700285 local_include_dirs: [
286 "upstream-freebsd/android/include",
287 ],
288
289 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700290}
291
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700292cc_library_static {
293 defaults: ["libc_defaults"],
294 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700295 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700296 "upstream-freebsd/lib/libc/stdlib/realpath.c",
297 ],
298
299 cflags: [
300 "-Wno-sign-compare",
301 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700302 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700303 ],
304
305 local_include_dirs: [
306 "upstream-freebsd/android/include",
307 ],
308
309 name: "libc_freebsd_large_stack",
310}
311
Dan Willemsen208ae172015-09-16 16:33:27 -0700312// ========================================================
313// libc_netbsd.a - upstream NetBSD C library code
314// ========================================================
315//
316// These files are built with the netbsd-compat.h header file
317// automatically included.
318
319cc_library_static {
320
Colin Cross50c21ab2015-10-31 23:03:05 -0700321 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700322 srcs: [
323 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700324 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700325 "upstream-netbsd/lib/libc/gen/psignal.c",
326 "upstream-netbsd/lib/libc/gen/utime.c",
327 "upstream-netbsd/lib/libc/gen/utmp.c",
328 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
329 "upstream-netbsd/lib/libc/regex/regcomp.c",
330 "upstream-netbsd/lib/libc/regex/regerror.c",
331 "upstream-netbsd/lib/libc/regex/regexec.c",
332 "upstream-netbsd/lib/libc/regex/regfree.c",
333 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
334 "upstream-netbsd/lib/libc/stdlib/div.c",
335 "upstream-netbsd/lib/libc/stdlib/drand48.c",
336 "upstream-netbsd/lib/libc/stdlib/erand48.c",
337 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
338 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
339 "upstream-netbsd/lib/libc/stdlib/ldiv.c",
340 "upstream-netbsd/lib/libc/stdlib/lldiv.c",
341 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
342 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
343 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
344 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
345 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
346 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
347 "upstream-netbsd/lib/libc/stdlib/seed48.c",
348 "upstream-netbsd/lib/libc/stdlib/srand48.c",
349 "upstream-netbsd/lib/libc/string/memccpy.c",
350 "upstream-netbsd/lib/libc/string/strcasestr.c",
351 "upstream-netbsd/lib/libc/string/strcoll.c",
352 "upstream-netbsd/lib/libc/string/strxfrm.c",
353 ],
354 multilib: {
355 lib32: {
356 // LP32 cruft
357 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
358 },
359 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700360 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700361 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800362 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700363 "-DPOSIX_MISTAKE",
364 "-include netbsd-compat.h",
365 ],
366
Dan Willemsen208ae172015-09-16 16:33:27 -0700367 local_include_dirs: [
368 "upstream-netbsd/android/include",
369 "upstream-netbsd/lib/libc/include",
370 ],
371
372 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700373}
374
375// ========================================================
376// libc_openbsd_ndk.a - upstream OpenBSD C library code
377// that can be safely included in the libc_ndk.a (doesn't
378// contain any troublesome global data or constructors).
379// ========================================================
380//
381// These files are built with the openbsd-compat.h header file
382// automatically included.
383
384cc_library_static {
385 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700386 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700387 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700388 "upstream-openbsd/lib/libc/gen/alarm.c",
389 "upstream-openbsd/lib/libc/gen/ctype_.c",
390 "upstream-openbsd/lib/libc/gen/daemon.c",
391 "upstream-openbsd/lib/libc/gen/err.c",
392 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700393 "upstream-openbsd/lib/libc/gen/fnmatch.c",
394 "upstream-openbsd/lib/libc/gen/ftok.c",
395 "upstream-openbsd/lib/libc/gen/getprogname.c",
396 "upstream-openbsd/lib/libc/gen/isctype.c",
397 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700398 "upstream-openbsd/lib/libc/gen/tolower_.c",
399 "upstream-openbsd/lib/libc/gen/toupper_.c",
400 "upstream-openbsd/lib/libc/gen/verr.c",
401 "upstream-openbsd/lib/libc/gen/verrx.c",
402 "upstream-openbsd/lib/libc/gen/vwarn.c",
403 "upstream-openbsd/lib/libc/gen/vwarnx.c",
404 "upstream-openbsd/lib/libc/gen/warn.c",
405 "upstream-openbsd/lib/libc/gen/warnx.c",
406 "upstream-openbsd/lib/libc/locale/btowc.c",
407 "upstream-openbsd/lib/libc/locale/mbrlen.c",
408 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
409 "upstream-openbsd/lib/libc/locale/mbtowc.c",
410 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700411 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
412 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700413 "upstream-openbsd/lib/libc/locale/wcstoll.c",
414 "upstream-openbsd/lib/libc/locale/wcstombs.c",
415 "upstream-openbsd/lib/libc/locale/wcstoul.c",
416 "upstream-openbsd/lib/libc/locale/wcstoull.c",
417 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
418 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
419 "upstream-openbsd/lib/libc/locale/wctob.c",
420 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700421 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700422 "upstream-openbsd/lib/libc/net/htonl.c",
423 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700424 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
425 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
426 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700427 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
428 "upstream-openbsd/lib/libc/net/inet_ntop.c",
429 "upstream-openbsd/lib/libc/net/inet_pton.c",
430 "upstream-openbsd/lib/libc/net/ntohl.c",
431 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800432 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700433 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700434 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
435 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700436 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700437 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700438 "upstream-openbsd/lib/libc/stdio/fputwc.c",
439 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700440 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700441 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700442 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700443 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700444 "upstream-openbsd/lib/libc/stdio/makebuf.c",
445 "upstream-openbsd/lib/libc/stdio/mktemp.c",
446 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
447 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700448 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700449 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700450 "upstream-openbsd/lib/libc/stdio/tempnam.c",
451 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
452 "upstream-openbsd/lib/libc/stdio/ungetc.c",
453 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
454 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
455 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700456 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
457 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
458 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700459 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700460 "upstream-openbsd/lib/libc/stdio/wsetup.c",
461 "upstream-openbsd/lib/libc/stdlib/abs.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700462 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700463 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700464 "upstream-openbsd/lib/libc/stdlib/insque.c",
465 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
466 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
467 "upstream-openbsd/lib/libc/stdlib/labs.c",
468 "upstream-openbsd/lib/libc/stdlib/llabs.c",
469 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700470 "upstream-openbsd/lib/libc/stdlib/remque.c",
471 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700472 "upstream-openbsd/lib/libc/stdlib/tfind.c",
473 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
474 "upstream-openbsd/lib/libc/string/strcasecmp.c",
475 "upstream-openbsd/lib/libc/string/strcspn.c",
476 "upstream-openbsd/lib/libc/string/strdup.c",
477 "upstream-openbsd/lib/libc/string/strndup.c",
478 "upstream-openbsd/lib/libc/string/strpbrk.c",
479 "upstream-openbsd/lib/libc/string/strsep.c",
480 "upstream-openbsd/lib/libc/string/strspn.c",
481 "upstream-openbsd/lib/libc/string/strstr.c",
482 "upstream-openbsd/lib/libc/string/strtok.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700483 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700484 "upstream-openbsd/lib/libc/string/wcswidth.c",
485 ],
486
Colin Cross50c21ab2015-10-31 23:03:05 -0700487 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700488 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700489 "-Wno-unused-parameter",
490 "-include openbsd-compat.h",
491 ],
492
Dan Willemsen208ae172015-09-16 16:33:27 -0700493 local_include_dirs: [
494 "private",
495 "stdio",
496 "upstream-openbsd/android/include",
497 "upstream-openbsd/lib/libc/include",
498 "upstream-openbsd/lib/libc/gdtoa/",
499 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700500}
501
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700502cc_library_static {
503 name: "libc_openbsd_large_stack",
504 defaults: ["libc_defaults"],
505 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700506 "stdio/vfprintf.cpp",
507 "stdio/vfwprintf.cpp",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700508 ],
509 cflags: [
510 "-include openbsd-compat.h",
511 "-Wno-sign-compare",
512 "-Wframe-larger-than=5000",
513 ],
514
515 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700516 "upstream-openbsd/android/include/",
517 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700518 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700519 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700520 ],
521}
522
Dan Willemsen208ae172015-09-16 16:33:27 -0700523// ========================================================
524// libc_openbsd.a - upstream OpenBSD C library code
525// ========================================================
526//
527// These files are built with the openbsd-compat.h header file
528// automatically included.
529cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700530 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700531 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800532 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700533 "upstream-openbsd/lib/libc/crypt/arc4random.c",
534 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
535
536 // May be overriden by per-arch optimized versions
537 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700538 "upstream-openbsd/lib/libc/string/memrchr.c",
539 "upstream-openbsd/lib/libc/string/stpcpy.c",
540 "upstream-openbsd/lib/libc/string/stpncpy.c",
541 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700542 "upstream-openbsd/lib/libc/string/strcpy.c",
543 "upstream-openbsd/lib/libc/string/strlcat.c",
544 "upstream-openbsd/lib/libc/string/strlcpy.c",
545 "upstream-openbsd/lib/libc/string/strncat.c",
546 "upstream-openbsd/lib/libc/string/strncmp.c",
547 "upstream-openbsd/lib/libc/string/strncpy.c",
548 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700549
550 arch: {
551 arm: {
552 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700553 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800554 "upstream-openbsd/lib/libc/string/stpcpy.c",
555 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700556 ],
557 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700558 arm64: {
559 exclude_srcs: [
560 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700561 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700562 "upstream-openbsd/lib/libc/string/strcpy.c",
563 "upstream-openbsd/lib/libc/string/strncmp.c",
564 ],
565 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530566 mips: {
567 exclude_srcs: [
568 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530569 "upstream-openbsd/lib/libc/string/strcpy.c",
570 "upstream-openbsd/lib/libc/string/strncmp.c",
571 ],
572 },
573 mips64: {
574 exclude_srcs: [
575 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530576 "upstream-openbsd/lib/libc/string/strcpy.c",
577 "upstream-openbsd/lib/libc/string/strncmp.c",
578 ],
579 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700580 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800581 exclude_srcs: [
582 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800583 "upstream-openbsd/lib/libc/string/memrchr.c",
584 "upstream-openbsd/lib/libc/string/stpcpy.c",
585 "upstream-openbsd/lib/libc/string/stpncpy.c",
586 "upstream-openbsd/lib/libc/string/strcat.c",
587 "upstream-openbsd/lib/libc/string/strcpy.c",
588 "upstream-openbsd/lib/libc/string/strncmp.c",
589 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700590 "upstream-openbsd/lib/libc/string/strlcat.c",
591 "upstream-openbsd/lib/libc/string/strlcpy.c",
592 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800593 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700594 },
595
596 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800597 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800598 "upstream-openbsd/lib/libc/string/stpcpy.c",
599 "upstream-openbsd/lib/libc/string/stpncpy.c",
600 "upstream-openbsd/lib/libc/string/strcat.c",
601 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800602 "upstream-openbsd/lib/libc/string/strncat.c",
603 "upstream-openbsd/lib/libc/string/strncmp.c",
604 "upstream-openbsd/lib/libc/string/strncpy.c",
605 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700606 },
607 },
608
Colin Cross50c21ab2015-10-31 23:03:05 -0700609 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700610 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700611 "-Wno-unused-parameter",
612 "-include openbsd-compat.h",
613 ],
614
Dan Willemsen208ae172015-09-16 16:33:27 -0700615 local_include_dirs: [
616 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700617 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700618 ],
619
620 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700621}
622
623// ========================================================
624// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
625// ========================================================
626//
627// These files are built with the openbsd-compat.h header file
628// automatically included.
629
630cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700631 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700632 srcs: [
633 "upstream-openbsd/android/gdtoa_support.cpp",
634 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
635 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
636 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
637 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
638 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
639 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
640 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
641 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
642 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
643 "upstream-openbsd/lib/libc/gdtoa/misc.c",
644 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
645 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
646 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
647 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
648 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
649 "upstream-openbsd/lib/libc/gdtoa/sum.c",
650 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
651 ],
652 multilib: {
653 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800654 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700655 },
656 },
657
Colin Cross50c21ab2015-10-31 23:03:05 -0700658 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700659 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700660 "-include openbsd-compat.h",
661 ],
662
Dan Willemsen208ae172015-09-16 16:33:27 -0700663 local_include_dirs: [
664 "private",
665 "upstream-openbsd/android/include",
666 "upstream-openbsd/lib/libc/include",
667 ],
668
669 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700670}
671
672// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700673// libc_fortify.a - container for our FORITFY
674// implementation details
675// ========================================================
676cc_library_static {
677 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700678 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700679
680 name: "libc_fortify",
681
682 // Disable FORTIFY for the compilation of these, so we don't end up having
683 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800684 cflags: [
685 "-U_FORTIFY_SOURCE",
686 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
687 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700688
689 arch: {
690 arm: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700691 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700692 srcs: [
693 "arch-arm/generic/bionic/__memcpy_chk.S",
694 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800695 neon: {
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800696 cflags: [
697 "-DNO___STRCAT_CHK",
698 "-DNO___STRCPY_CHK",
699 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700700 srcs: [
701 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
702 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
703 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700704 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800705 cortex_a7: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700706 srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800707 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
708 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
709 ],
710 exclude_srcs: [
George Burgess IV6cb06872017-07-21 13:28:42 -0700711 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
712 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
713 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700714 },
715 cortex_a9: {
716 srcs: [
717 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
718 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
719 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800720 exclude_srcs: [
721 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
722 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
723 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700724 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800725 krait: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700726 srcs: [
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800727 "arch-arm/krait/bionic/__strcat_chk.S",
728 "arch-arm/krait/bionic/__strcpy_chk.S",
729 ],
730 exclude_srcs: [
731 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
732 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
733 ],
734 },
735 cortex_a53: {
736 srcs: [
737 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
738 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
739 ],
740 exclude_srcs: [
George Burgess IV6cb06872017-07-21 13:28:42 -0700741 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
742 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
743 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700744 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700745 cortex_a55: {
746 srcs: [
747 "arch-arm/denver/bionic/__strcat_chk.S",
748 "arch-arm/denver/bionic/__strcpy_chk.S",
749 ],
750 exclude_srcs: [
751 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
752 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
753 ],
754 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700755 cortex_a73: {
756 srcs: [
757 "arch-arm/denver/bionic/__strcat_chk.S",
758 "arch-arm/denver/bionic/__strcpy_chk.S",
759 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800760 exclude_srcs: [
761 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
762 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
763 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700764 },
Christopher Ferris4da58cf2018-04-27 16:57:51 -0700765 cortex_a75: {
766 srcs: [
767 "arch-arm/denver/bionic/__strcat_chk.S",
768 "arch-arm/denver/bionic/__strcpy_chk.S",
769 ],
770 exclude_srcs: [
771 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
772 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
773 ],
774 },
Haibo Huangbc4f4112018-10-10 13:46:48 -0700775 cortex_a76: {
776 srcs: [
777 "arch-arm/denver/bionic/__strcat_chk.S",
778 "arch-arm/denver/bionic/__strcpy_chk.S",
779 ],
780 exclude_srcs: [
781 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
782 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
783 ],
784 },
George Burgess IV6cb06872017-07-21 13:28:42 -0700785 denver: {
786 srcs: [
787 "arch-arm/denver/bionic/__strcat_chk.S",
788 "arch-arm/denver/bionic/__strcpy_chk.S",
789 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800790 exclude_srcs: [
791 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
792 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
793 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700794 },
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800795 kryo: {
George Burgess IV6cb06872017-07-21 13:28:42 -0700796 srcs: [
797 "arch-arm/krait/bionic/__strcat_chk.S",
798 "arch-arm/krait/bionic/__strcpy_chk.S",
799 ],
Isaac Chen5e7c90b2017-09-20 14:44:42 +0800800 exclude_srcs: [
801 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
802 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700803 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700804 },
805 },
806 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700807 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700808 srcs: [
809 "arch-arm64/generic/bionic/__memcpy_chk.S",
810 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700811 },
812 },
813}
814
815// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700816// libc_bionic.a - home-grown C library code
817// ========================================================
818
819cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700820 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700821 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700822 // The data that backs getauxval is initialized in the libc init
823 // functions which are invoked by the linker. If this file is included
824 // in libc_ndk.a, only one of the copies of the global data will be
825 // initialized, resulting in nullptr dereferences.
826 "bionic/getauxval.cpp",
827
Elliott Hughes211c4d32018-02-02 15:10:32 -0800828 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700829 "bionic/sysconf.cpp",
830 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700831 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700832
Josh Gao10ec9282017-04-03 15:13:29 -0700833 // The following must not be statically linked into libc_ndk.a, because
834 // debuggerd will look for the abort message in libc.so's copy.
835 "bionic/android_set_abort_message.cpp",
836
Dan Willemsen208ae172015-09-16 16:33:27 -0700837 "bionic/strchr.cpp",
838 "bionic/strnlen.c",
839 "bionic/strrchr.cpp",
840 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700841
842 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700843 arm: {
844 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800845 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700846 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800847 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800848 "arch-arm/generic/bionic/stpcpy.c",
849 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800850 "arch-arm/generic/bionic/strcmp.S",
851 "arch-arm/generic/bionic/strcpy.S",
852 "arch-arm/generic/bionic/strlen.c",
853
Dan Willemsen208ae172015-09-16 16:33:27 -0700854 "arch-arm/bionic/atomics_arm.c",
855 "arch-arm/bionic/__bionic_clone.S",
856 "arch-arm/bionic/_exit_with_stack_teardown.S",
857 "arch-arm/bionic/libgcc_compat.c",
858 "arch-arm/bionic/popcount_tab.c",
859 "arch-arm/bionic/__restore.S",
860 "arch-arm/bionic/setjmp.S",
861 "arch-arm/bionic/syscall.S",
862 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800863
864 "arch-arm/cortex-a15/bionic/memcpy.S",
865 "arch-arm/cortex-a15/bionic/memmove.S",
866 "arch-arm/cortex-a15/bionic/memset.S",
867 "arch-arm/cortex-a15/bionic/stpcpy.S",
868 "arch-arm/cortex-a15/bionic/strcat.S",
869 "arch-arm/cortex-a15/bionic/strcmp.S",
870 "arch-arm/cortex-a15/bionic/strcpy.S",
871 "arch-arm/cortex-a15/bionic/strlen.S",
872
873 "arch-arm/cortex-a7/bionic/memcpy.S",
874 "arch-arm/cortex-a7/bionic/memmove.S",
875 "arch-arm/cortex-a7/bionic/memset.S",
876
877 "arch-arm/cortex-a9/bionic/memcpy.S",
878 "arch-arm/cortex-a9/bionic/memmove.S",
879 "arch-arm/cortex-a9/bionic/memset.S",
880 "arch-arm/cortex-a9/bionic/stpcpy.S",
881 "arch-arm/cortex-a9/bionic/strcat.S",
882 "arch-arm/cortex-a9/bionic/strcmp.S",
883 "arch-arm/cortex-a9/bionic/strcpy.S",
884 "arch-arm/cortex-a9/bionic/strlen.S",
885
886 "arch-arm/krait/bionic/memcpy.S",
887 "arch-arm/krait/bionic/memmove.S",
888 "arch-arm/krait/bionic/memset.S",
889 "arch-arm/krait/bionic/strcmp.S",
890
891 "arch-arm/cortex-a53/bionic/memcpy.S",
892 "arch-arm/cortex-a53/bionic/memmove.S",
893
894 "arch-arm/denver/bionic/memcpy.S",
895 "arch-arm/denver/bionic/memmove.S",
896 "arch-arm/denver/bionic/memset.S",
897
898 "arch-arm/kryo/bionic/memcpy.S",
899 "arch-arm/kryo/bionic/memmove.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700900 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700901 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700902 arm64: {
903 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700904 "arch-arm64/generic/bionic/memchr.S",
905 "arch-arm64/generic/bionic/memcmp.S",
906 "arch-arm64/generic/bionic/memcpy.S",
907 "arch-arm64/generic/bionic/memmove.S",
908 "arch-arm64/generic/bionic/memset.S",
909 "arch-arm64/generic/bionic/stpcpy.S",
910 "arch-arm64/generic/bionic/strchr.S",
911 "arch-arm64/generic/bionic/strcmp.S",
912 "arch-arm64/generic/bionic/strcpy.S",
913 "arch-arm64/generic/bionic/strlen.S",
914 "arch-arm64/generic/bionic/strncmp.S",
915 "arch-arm64/generic/bionic/strnlen.S",
916 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800917
918 "arch-arm64/bionic/__bionic_clone.S",
919 "arch-arm64/bionic/_exit_with_stack_teardown.S",
920 "arch-arm64/bionic/setjmp.S",
921 "arch-arm64/bionic/syscall.S",
922 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700923 ],
924 exclude_srcs: [
925 "bionic/__memcpy_chk.cpp",
926 "bionic/strchr.cpp",
927 "bionic/strnlen.c",
928 ],
Colin Cross6ab8f892015-11-23 14:12:15 -0800929 denver64: {
930 srcs: [
931 "arch-arm64/denver64/bionic/memcpy.S",
Haibo Huangece43e12018-05-26 13:07:43 -0700932 "arch-arm64/denver64/bionic/memmove.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800933 "arch-arm64/denver64/bionic/memset.S",
934 ],
935 exclude_srcs: [
936 "arch-arm64/generic/bionic/memcpy.S",
Haibo Huangece43e12018-05-26 13:07:43 -0700937 "arch-arm64/generic/bionic/memmove.S",
Colin Cross6ab8f892015-11-23 14:12:15 -0800938 "arch-arm64/generic/bionic/memset.S",
939 ],
940 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700941 },
942
943 mips: {
944 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800945 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530946 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800947 "arch-mips/string/memset.S",
948 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530949 "arch-mips/string/strncmp.S",
950 "arch-mips/string/strlen.c",
951 "arch-mips/string/strnlen.c",
952 "arch-mips/string/strchr.c",
953 "arch-mips/string/strcpy.c",
954 "arch-mips/string/memchr.c",
955 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800956
Dan Willemsen208ae172015-09-16 16:33:27 -0700957 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700958 "arch-mips/bionic/cacheflush.cpp",
959 "arch-mips/bionic/_exit_with_stack_teardown.S",
Dan Willemsen879cec22016-02-29 10:37:56 -0800960 "arch-mips/bionic/libgcc_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700961 "arch-mips/bionic/setjmp.S",
962 "arch-mips/bionic/syscall.S",
963 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700964 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530965 exclude_srcs: [
966 "bionic/strchr.cpp",
967 "bionic/strnlen.c",
968 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700969 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700970 mips64: {
971 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800972 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530973 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800974 "arch-mips/string/memset.S",
975 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530976 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800977 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530978 "arch-mips/string/strnlen.c",
979 "arch-mips/string/strchr.c",
980 "arch-mips/string/strcpy.c",
981 "arch-mips/string/memchr.c",
982 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800983
Dan Willemsen208ae172015-09-16 16:33:27 -0700984 "arch-mips64/bionic/__bionic_clone.S",
985 "arch-mips64/bionic/_exit_with_stack_teardown.S",
986 "arch-mips64/bionic/setjmp.S",
987 "arch-mips64/bionic/syscall.S",
988 "arch-mips64/bionic/vfork.S",
989 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700990 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530991 exclude_srcs: [
992 "bionic/strchr.cpp",
993 "bionic/strnlen.c",
994 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700995 },
996
997 x86: {
998 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700999 "arch-x86/generic/string/memcmp.S",
1000 "arch-x86/generic/string/strcmp.S",
1001 "arch-x86/generic/string/strncmp.S",
1002 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001003
1004 "arch-x86/generic/string/strlcat.c",
1005 "arch-x86/generic/string/strlcpy.c",
1006 "arch-x86/generic/string/strncat.c",
1007 "arch-x86/generic/string/wcscat.c",
1008 "arch-x86/generic/string/wcscpy.c",
1009 "arch-x86/generic/string/wmemcmp.c",
1010
Dan Willemsen208ae172015-09-16 16:33:27 -07001011 "arch-x86/atom/string/sse2-memchr-atom.S",
1012 "arch-x86/atom/string/sse2-memrchr-atom.S",
1013 "arch-x86/atom/string/sse2-strchr-atom.S",
1014 "arch-x86/atom/string/sse2-strnlen-atom.S",
1015 "arch-x86/atom/string/sse2-strrchr-atom.S",
1016 "arch-x86/atom/string/sse2-wcschr-atom.S",
1017 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
1018 "arch-x86/atom/string/sse2-wcslen-atom.S",
1019 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001020 "arch-x86/silvermont/string/sse2-memmove-slm.S",
1021 "arch-x86/silvermont/string/sse2-memset-slm.S",
1022 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
1023 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
1024 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
1025 "arch-x86/silvermont/string/sse2-strlen-slm.S",
1026 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001027
1028 "arch-x86/bionic/__bionic_clone.S",
1029 "arch-x86/bionic/_exit_with_stack_teardown.S",
1030 "arch-x86/bionic/libgcc_compat.c",
1031 "arch-x86/bionic/__restore.S",
1032 "arch-x86/bionic/setjmp.S",
1033 "arch-x86/bionic/syscall.S",
1034 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001035
1036 // ssse3 functions
1037 "arch-x86/atom/string/ssse3-strcat-atom.S",
1038 "arch-x86/atom/string/ssse3-strcmp-atom.S",
1039 "arch-x86/atom/string/ssse3-strlcat-atom.S",
1040 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
1041 "arch-x86/atom/string/ssse3-strncat-atom.S",
1042 "arch-x86/atom/string/ssse3-strncmp-atom.S",
1043 "arch-x86/atom/string/ssse3-wcscat-atom.S",
1044 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
1045
1046 // sse4 functions
1047 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
1048 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
1049
1050 // atom functions
1051 "arch-x86/atom/string/sse2-memset-atom.S",
1052 "arch-x86/atom/string/sse2-strlen-atom.S",
1053 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -08001054 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001055 "arch-x86/atom/string/ssse3-strcpy-atom.S",
1056 "arch-x86/atom/string/ssse3-strncpy-atom.S",
1057 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001058 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001059
1060 exclude_srcs: [
1061 "bionic/strchr.cpp",
1062 "bionic/strnlen.c",
1063 "bionic/strrchr.cpp",
1064 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001065 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001066 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001067 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001068 "arch-x86_64/string/sse2-memmove-slm.S",
1069 "arch-x86_64/string/sse2-memset-slm.S",
1070 "arch-x86_64/string/sse2-stpcpy-slm.S",
1071 "arch-x86_64/string/sse2-stpncpy-slm.S",
1072 "arch-x86_64/string/sse2-strcat-slm.S",
1073 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001074 "arch-x86_64/string/sse2-strlen-slm.S",
1075 "arch-x86_64/string/sse2-strncat-slm.S",
1076 "arch-x86_64/string/sse2-strncpy-slm.S",
1077 "arch-x86_64/string/sse4-memcmp-slm.S",
1078 "arch-x86_64/string/ssse3-strcmp-slm.S",
1079 "arch-x86_64/string/ssse3-strncmp-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001080
1081 "arch-x86_64/bionic/__bionic_clone.S",
1082 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1083 "arch-x86_64/bionic/__restore_rt.S",
1084 "arch-x86_64/bionic/setjmp.S",
1085 "arch-x86_64/bionic/syscall.S",
1086 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001087 ],
1088 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001089 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001090
Colin Cross50c21ab2015-10-31 23:03:05 -07001091 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001092 include_dirs: ["bionic/libstdc++/include"],
1093 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001094}
1095
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001096genrule {
1097 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001098 out: ["generated_android_ids.h"],
1099 srcs: [":android_filesystem_config_header"],
1100 tool_files: ["fs_config_generator.py"],
1101 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001102}
1103
Dan Willemsen268a6732015-10-15 14:49:45 -07001104// ========================================================
1105// libc_bionic_ndk.a- The portions of libc_bionic that can
1106// be safely used in libc_ndk.a (no troublesome global data
1107// or constructors).
1108// ========================================================
1109cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001110 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001111 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001112 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001113 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001114 "bionic/__cmsg_nxthdr.cpp",
1115 "bionic/__errno.cpp",
1116 "bionic/__gnu_basename.cpp",
1117 "bionic/__libc_current_sigrtmax.cpp",
1118 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001119 "bionic/abort.cpp",
1120 "bionic/accept.cpp",
1121 "bionic/accept4.cpp",
1122 "bionic/access.cpp",
1123 "bionic/arpa_inet.cpp",
1124 "bionic/assert.cpp",
1125 "bionic/atof.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001126 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001127 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001128 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001129 "bionic/bionic_systrace.cpp",
1130 "bionic/bionic_time_conversions.cpp",
1131 "bionic/brk.cpp",
1132 "bionic/c16rtomb.cpp",
1133 "bionic/c32rtomb.cpp",
1134 "bionic/chmod.cpp",
1135 "bionic/chown.cpp",
1136 "bionic/clearenv.cpp",
1137 "bionic/clock.cpp",
1138 "bionic/clock_getcpuclockid.cpp",
1139 "bionic/clock_nanosleep.cpp",
1140 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001141 "bionic/connect.cpp",
1142 "bionic/ctype.cpp",
1143 "bionic/dirent.cpp",
1144 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001145 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001146 "bionic/error.cpp",
1147 "bionic/eventfd_read.cpp",
1148 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001149 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001150 "bionic/faccessat.cpp",
1151 "bionic/fchmod.cpp",
1152 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001153 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001154 "bionic/ffs.cpp",
1155 "bionic/fgetxattr.cpp",
1156 "bionic/flistxattr.cpp",
1157 "bionic/flockfile.cpp",
1158 "bionic/fpclassify.cpp",
1159 "bionic/fsetxattr.cpp",
1160 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001161 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001162 "bionic/futimens.cpp",
1163 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001164 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001165 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001166 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001167 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001168 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001169 "bionic/getpgrp.cpp",
1170 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001171 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001172 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001173 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001174 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001175 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001176 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001177 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001178 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001179 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001180 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001181 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001182 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001183 "bionic/lchown.cpp",
1184 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001185 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001186 "bionic/libgen.cpp",
1187 "bionic/link.cpp",
1188 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001189 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001190 "bionic/lstat.cpp",
1191 "bionic/malloc_info.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001192 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001193 "bionic/mbrtoc16.cpp",
1194 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001195 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001196 "bionic/mempcpy.cpp",
1197 "bionic/mkdir.cpp",
1198 "bionic/mkfifo.cpp",
1199 "bionic/mknod.cpp",
1200 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001201 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001202 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001203 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001204 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001205 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001206 "bionic/open.cpp",
1207 "bionic/pathconf.cpp",
1208 "bionic/pause.cpp",
1209 "bionic/pipe.cpp",
1210 "bionic/poll.cpp",
1211 "bionic/posix_fadvise.cpp",
1212 "bionic/posix_fallocate.cpp",
1213 "bionic/posix_madvise.cpp",
1214 "bionic/posix_timers.cpp",
1215 "bionic/ptrace.cpp",
1216 "bionic/pty.cpp",
1217 "bionic/raise.cpp",
1218 "bionic/rand.cpp",
1219 "bionic/readlink.cpp",
1220 "bionic/reboot.cpp",
1221 "bionic/recv.cpp",
1222 "bionic/rename.cpp",
1223 "bionic/rmdir.cpp",
1224 "bionic/scandir.cpp",
1225 "bionic/sched_getaffinity.cpp",
1226 "bionic/sched_getcpu.cpp",
1227 "bionic/semaphore.cpp",
1228 "bionic/send.cpp",
1229 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001230 "bionic/seteuid.cpp",
1231 "bionic/setpgrp.cpp",
1232 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001233 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001234 "bionic/sigprocmask.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001235 "bionic/socket.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001236 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001237 "bionic/stat.cpp",
1238 "bionic/statvfs.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001239 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001240 "bionic/strchrnul.cpp",
1241 "bionic/strerror.cpp",
1242 "bionic/strerror_r.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001243 "bionic/string_l.cpp",
1244 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001245 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001246 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001247 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001248 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001249 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001250 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001251 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001252 "bionic/sys_msg.cpp",
1253 "bionic/sys_sem.cpp",
1254 "bionic/sys_shm.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001255 "bionic/sys_siglist.c",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001256 "bionic/sys_signalfd.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001257 "bionic/sys_signame.c",
Elliott Hughes449eff02016-06-08 19:51:20 -07001258 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001259 "bionic/sysinfo.cpp",
1260 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001261 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001262 "bionic/system_property_api.cpp",
1263 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001264 "bionic/tdestroy.cpp",
1265 "bionic/termios.cpp",
1266 "bionic/thread_private.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001267 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001268 "bionic/tmpfile.cpp",
1269 "bionic/umount.cpp",
1270 "bionic/unlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001271 "bionic/wait.cpp",
1272 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001273 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001274 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001275 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001276 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001277 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001278
1279 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1280 // which will be overridden by the actual one in libc.so.
1281 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001282 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001283
Dan Willemsen208ae172015-09-16 16:33:27 -07001284 multilib: {
1285 lib32: {
1286 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001287 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001288 },
1289 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001290 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001291 treble_linker_namespaces: {
1292 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001293 },
1294 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001295 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001296 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001297 local_include_dirs: ["stdio"],
1298 include_dirs: ["bionic/libstdc++/include"],
1299 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001300 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001301}
1302
Dan Willemsen208ae172015-09-16 16:33:27 -07001303// ========================================================
1304// libc_pthread.a - pthreads parts that previously lived in
1305// libc_bionic.a. Relocated to their own library because
1306// they can't be included in libc_ndk.a (as they layout of
1307// pthread_t has changed over the years and has ABI
1308// compatibility issues).
1309// ========================================================
1310
1311cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001312 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001313 srcs: [
1314 "bionic/pthread_atfork.cpp",
1315 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001316 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001317 "bionic/pthread_cond.cpp",
1318 "bionic/pthread_create.cpp",
1319 "bionic/pthread_detach.cpp",
1320 "bionic/pthread_equal.cpp",
1321 "bionic/pthread_exit.cpp",
1322 "bionic/pthread_getcpuclockid.cpp",
1323 "bionic/pthread_getschedparam.cpp",
1324 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001325 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001326 "bionic/pthread_join.cpp",
1327 "bionic/pthread_key.cpp",
1328 "bionic/pthread_kill.cpp",
1329 "bionic/pthread_mutex.cpp",
1330 "bionic/pthread_once.cpp",
1331 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001332 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001333 "bionic/pthread_self.cpp",
1334 "bionic/pthread_setname_np.cpp",
1335 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001336 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001337
1338 // The following implementations depend on pthread data or implementation,
1339 // so we can't include them in libc_ndk.a.
1340 "bionic/__cxa_thread_atexit_impl.cpp",
1341 "stdlib/atexit.c",
1342 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001343 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001344
Colin Cross50c21ab2015-10-31 23:03:05 -07001345 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001346 include_dirs: ["bionic/libstdc++/include"],
1347 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001348}
1349
1350// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001351// libc_syscalls.a
1352// ========================================================
1353
1354cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001355 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001356 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001357 arch: {
1358 arm: {
1359 srcs: ["arch-arm/syscalls/**/*.S"],
1360 },
1361 arm64: {
1362 srcs: ["arch-arm64/syscalls/**/*.S"],
1363 },
1364 mips: {
1365 srcs: ["arch-mips/syscalls/**/*.S"],
1366 },
1367 mips64: {
1368 srcs: ["arch-mips64/syscalls/**/*.S"],
1369 },
1370 x86: {
1371 srcs: ["arch-x86/syscalls/**/*.S"],
1372 },
1373 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001374 srcs: ["arch-x86_64/syscalls/**/*.S"],
1375 },
1376 },
1377 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001378}
1379
1380// ========================================================
1381// libc_aeabi.a
1382// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1383// to avoid infinite recursion. For the other architectures we just build an
1384// empty library to keep this makefile simple.
1385// ========================================================
1386
1387cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001388 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001389 arch: {
1390 arm: {
1391 srcs: ["arch-arm/bionic/__aeabi.c"],
1392 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001393 },
1394 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001395 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001396}
1397
1398// ========================================================
1399// libc_ndk.a
1400// Compatibility library for the NDK. This library contains
1401// all the parts of libc that are safe to statically link.
1402// We can't safely statically link things that can only run
1403// on a certain version of the OS. Examples include
1404// anything that talks to netd (a large portion of the DNS
1405// code) and anything that is dependent on the layout of a
1406// data structure that has changed across releases (such as
1407// pthread_t).
1408// ========================================================
1409
1410cc_library_static {
1411 name: "libc_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001412 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001413 srcs: libc_common_src_files + ["bionic/malloc_common.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001414 multilib: {
1415 lib32: {
1416 srcs: libc_common_src_files_32,
1417 },
1418 },
1419 arch: {
1420 arm: {
1421 srcs: [
1422 "arch-arm/bionic/exidx_dynamic.c",
1423 "arch-common/bionic/crtbegin_so.c",
1424 "arch-arm/bionic/atexit_legacy.c",
1425 "arch-common/bionic/crtend_so.S",
1426 ],
1427 whole_static_libs: ["libc_aeabi"],
1428 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001429 },
1430
Colin Cross50c21ab2015-10-31 23:03:05 -07001431 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001432 "-fvisibility=hidden",
1433 "-DLIBC_STATIC",
1434 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001435
1436 whole_static_libs: [
1437 "libc_bionic_ndk",
George Burgess IV6cb06872017-07-21 13:28:42 -07001438 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001439 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001440 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001441 "libc_gdtoa",
1442 "libc_malloc",
1443 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001444 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001445 "libc_openbsd_ndk",
1446 "libc_stack_protector",
1447 "libc_syscalls",
1448 "libc_tzcode",
1449 "libm",
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001450 "libjemalloc5",
Elliott Hughes816fab92016-05-27 17:57:46 -07001451 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001452 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001453}
1454
1455// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001456// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001457// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001458cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001459 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001460 srcs: libc_common_src_files,
1461 multilib: {
1462 lib32: {
1463 srcs: libc_common_src_files_32,
1464 },
1465 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001466 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001467
1468 whole_static_libs: [
1469 "libc_bionic",
1470 "libc_bionic_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001471 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001472 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001473 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001474 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001475 "libc_gdtoa",
1476 "libc_malloc",
1477 "libc_netbsd",
1478 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001479 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001480 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001481 "libc_stack_protector",
1482 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001483 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001484 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001485 ],
1486
1487 arch: {
1488 arm: {
1489 whole_static_libs: ["libc_aeabi"],
1490 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001491 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001492}
1493
1494// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001495// libc_common.a
1496// ========================================================
1497
1498cc_library_static {
1499 defaults: ["libc_defaults"],
1500 name: "libc_common",
1501
1502 whole_static_libs: [
1503 "libc_nopthread",
1504 "libc_pthread",
1505 ],
1506}
1507
1508// ========================================================
Haibo Huangf71edfa2018-11-12 10:06:56 -08001509// libc_common_static.a For static binaries.
1510// ========================================================
1511cc_library_static {
1512 defaults: ["libc_defaults"],
1513 name: "libc_common_static",
1514
Haibo Huangb9244ff2018-08-11 10:12:13 -07001515 arch: {
1516 x86: {
1517 srcs: ["arch-x86/static_function_dispatch.S"],
1518 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001519 arm: {
1520 srcs: ["arch-arm/static_function_dispatch.S"],
1521 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001522 },
1523
Haibo Huangf71edfa2018-11-12 10:06:56 -08001524 whole_static_libs: [
1525 "libc_common",
1526 ],
1527}
1528
1529// ========================================================
1530// libc_common_shared.a For shared libraries.
1531// ========================================================
1532cc_library_static {
1533 defaults: ["libc_defaults"],
1534 name: "libc_common_shared",
1535
Haibo Huangb9244ff2018-08-11 10:12:13 -07001536 cflags: [
1537 "-fno-stack-protector",
1538 "-fno-jump-tables",
1539 ],
1540 arch: {
1541 x86: {
1542 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1543 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001544 arm: {
1545 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
1546 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001547 },
1548
Haibo Huangf71edfa2018-11-12 10:06:56 -08001549 whole_static_libs: [
1550 "libc_common",
1551 ],
1552}
1553
1554// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001555// libc_nomalloc.a
1556// ========================================================
1557//
1558// This is a version of the static C library that does not
1559// include malloc. It's useful in situations when the user wants
1560// to provide their own malloc implementation, or wants to
1561// explicitly disallow the use of malloc, such as in the
1562// dynamic linker.
1563
1564cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001565 name: "libc_nomalloc",
1566
Colin Cross50c21ab2015-10-31 23:03:05 -07001567 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001568
1569 arch: {
1570 arm: {
1571 srcs: ["arch-arm/bionic/exidx_static.c"],
1572 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001573 },
1574
Colin Cross50c21ab2015-10-31 23:03:05 -07001575 cflags: ["-DLIBC_STATIC"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001576
Colin Crossa3f9fca2016-01-11 13:20:55 -08001577 whole_static_libs: [
Haibo Huangf71edfa2018-11-12 10:06:56 -08001578 "libc_common_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001579 "libc_init_static",
1580 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001581}
1582
1583// ========================================================
1584// libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1585// ========================================================
1586cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001587 defaults: ["libc_defaults"],
Dan Willemsen3e621712016-02-03 21:48:08 -08001588 srcs: ["bionic/jemalloc_wrapper.cpp"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001589 cflags: ["-fvisibility=hidden"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001590
Dan Willemsen208ae172015-09-16 16:33:27 -07001591 name: "libc_malloc",
Dan Willemsen208ae172015-09-16 16:33:27 -07001592}
1593
1594// ========================================================
1595// libc.a + libc.so
1596// ========================================================
1597cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001598 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001599 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001600 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001601 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001602 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001603 platform_sdk_version: {
1604 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1605 },
1606 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001607 static: {
1608 srcs: [
1609 "bionic/dl_iterate_phdr_static.cpp",
Dan Willemsen0c657082016-05-12 01:43:07 -07001610 "bionic/malloc_common.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001611 ],
1612 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001613 whole_static_libs: [
1614 "libc_init_static",
1615 "libc_common_static",
1616 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001617 },
1618 shared: {
1619 srcs: [
1620 "arch-common/bionic/crtbegin_so.c",
1621 "arch-common/bionic/crtbrand.S",
Elliott Hughesa57ca0d2016-11-17 18:18:08 -08001622 "bionic/icu.cpp",
Dan Willemsen0c657082016-05-12 01:43:07 -07001623 "bionic/malloc_common.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001624 "bionic/NetdClient.cpp",
1625 "arch-common/bionic/crtend_so.S",
1626 ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001627 whole_static_libs: [
1628 "libc_init_dynamic",
1629 "libc_common_shared",
1630 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001631 },
1632
1633 required: ["tzdata"],
1634
1635 // Leave the symbols in the shared library so that stack unwinders can produce
1636 // meaningful name resolution.
Colin Cross37f36322016-04-25 14:09:13 -07001637 strip: {
1638 keep_symbols: true,
1639 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001640
Colin Cross4ce94d22016-11-15 13:15:43 -08001641 // Do not pack libc.so relocations; see http://b/20645321 for details.
1642 pack_relocations: false,
1643
dimitry06016f22018-01-05 11:39:28 +01001644 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1645 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1646 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1647 // those new libraries from libgcc.a are not declared external; if that were the case,
1648 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1649 // on the external symbols from the dependent libraries. That would create a "cloaked"
1650 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001651
dimitry06016f22018-01-05 11:39:28 +01001652 shared_libs: [
1653 "ld-android",
1654 "libdl",
1655 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001656 whole_static_libs: [
Christopher Ferrisd73a49e2018-10-19 16:03:44 -07001657 "libjemalloc5",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001658 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001659
1660 nocrt: true,
1661
Dan Willemsen208ae172015-09-16 16:33:27 -07001662 arch: {
1663 arm: {
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001664 //TODO: This is to work around b/24465209. Remove after root cause is fixed
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001665 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001666 ldflags: ["-Wl,--hash-style=both"],
1667
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001668 // Don't re-export new/delete and friends, even if the compiler really wants to.
1669 version_script: "libc.arm.map",
1670
Dan Willemsen208ae172015-09-16 16:33:27 -07001671 shared: {
Dan Willemsen0c657082016-05-12 01:43:07 -07001672 srcs: [
1673 "arch-arm/bionic/exidx_dynamic.c",
1674
1675 // special for arm
1676 "arch-arm/bionic/atexit_legacy.c",
1677 ],
1678 // special for arm
1679 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001680 },
1681 static: {
1682 srcs: ["arch-arm/bionic/exidx_static.c"],
1683 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001684 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001685 arm64: {
1686 // Don't re-export new/delete and friends, even if the compiler really wants to.
1687 version_script: "libc.arm64.map",
1688 },
1689 mips: {
1690 // Don't re-export new/delete and friends, even if the compiler really wants to.
1691 version_script: "libc.mips.map",
1692 },
1693 mips64: {
1694 // Don't re-export new/delete and friends, even if the compiler really wants to.
1695 version_script: "libc.mips64.map",
1696 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001697 x86: {
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001698 //TODO: This is to work around b/24465209. Remove after root cause is fixed
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001699 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001700 ldflags: ["-Wl,--hash-style=both"],
1701
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001702 // Don't re-export new/delete and friends, even if the compiler really wants to.
1703 version_script: "libc.x86.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001704 },
1705 x86_64: {
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001706 // Don't re-export new/delete and friends, even if the compiler really wants to.
1707 version_script: "libc.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001708 },
1709 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001710}
1711
Dan Willemsen208ae172015-09-16 16:33:27 -07001712// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001713// libstdc++.so + libstdc++.a
1714// ========================================================
1715cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001716 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001717 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001718 srcs: [
1719 "bionic/__cxa_guard.cpp",
1720 "bionic/__cxa_pure_virtual.cpp",
1721 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001722 ],
1723 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001724 static_ndk_lib: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001725 system_shared_libs: ["libc"],
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001726 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001727
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001728 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001729 arch: {
1730 arm: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001731 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001732 ldflags: ["-Wl,--hash-style=both"],
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001733 version_script: "libstdc++.arm.map",
1734 },
1735 arm64: {
1736 version_script: "libstdc++.arm64.map",
1737 },
1738 mips: {
1739 version_script: "libstdc++.mips.map",
1740 },
1741 mips64: {
1742 version_script: "libstdc++.mips64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001743 },
1744 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001745 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001746 ldflags: ["-Wl,--hash-style=both"],
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001747 version_script: "libstdc++.x86.map",
1748 },
1749 x86_64: {
1750 version_script: "libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001751 },
1752 },
1753}
1754
Colin Cross50c21ab2015-10-31 23:03:05 -07001755cc_defaults {
1756 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001757 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001758 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001759 recovery_available: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001760
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001761 cflags: [
1762 "-Wno-gcc-compat",
1763 "-Wall",
1764 "-Werror",
1765 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001766}
1767
Colin Cross50c21ab2015-10-31 23:03:05 -07001768cc_defaults {
1769 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001770 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001771
1772 arch: {
1773 mips: {
1774 cflags: ["-fPIC"],
1775 },
1776 mips64: {
1777 cflags: ["-fPIC"],
1778 },
1779 x86: {
1780 cflags: ["-fPIC"],
1781 },
1782 x86_64: {
1783 cflags: ["-fPIC"],
1784 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001785 },
Colin Crossab179442018-09-27 11:03:22 -07001786 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001787}
1788
Dan Willemsena3ed9012017-04-04 15:51:26 -07001789// crt obj files
Dan Willemsen208ae172015-09-16 16:33:27 -07001790cc_object {
1791 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001792 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001793 local_include_dirs: ["include"],
1794 product_variables: {
1795 platform_sdk_version: {
1796 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1797 },
1798 },
1799 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001800
Colin Cross7d7b3682017-11-03 13:38:40 -07001801 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001802}
1803
Dan Willemsen208ae172015-09-16 16:33:27 -07001804cc_object {
1805 name: "crtbegin_so1",
1806 local_include_dirs: ["include"],
1807 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001808
Colin Cross7d7b3682017-11-03 13:38:40 -07001809 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001810}
1811
Dan Willemsen208ae172015-09-16 16:33:27 -07001812cc_object {
1813 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07001814
Colin Cross7d7b3682017-11-03 13:38:40 -07001815 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07001816 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001817 "crtbegin_so1",
1818 "crtbrand",
1819 ],
1820}
1821
Dan Willemsen208ae172015-09-16 16:33:27 -07001822cc_object {
1823 name: "crtend_so",
1824 local_include_dirs: ["include"],
1825 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001826
Colin Cross7d7b3682017-11-03 13:38:40 -07001827 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001828}
1829
Dan Willemsen208ae172015-09-16 16:33:27 -07001830cc_object {
1831 name: "crtbegin_static1",
1832 local_include_dirs: ["include"],
1833 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001834
Colin Cross50c21ab2015-10-31 23:03:05 -07001835 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001836 mips: {
1837 srcs: [
1838 "arch-mips/bionic/crtbegin.c",
1839 ],
1840 exclude_srcs: [
1841 "arch-common/bionic/crtbegin.c",
1842 ],
1843 },
1844 mips64: {
1845 srcs: [
1846 "arch-mips64/bionic/crtbegin.c",
1847 ],
1848 exclude_srcs: [
1849 "arch-common/bionic/crtbegin.c",
1850 ],
1851 },
1852 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001853
1854 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001855}
1856
Dan Willemsen208ae172015-09-16 16:33:27 -07001857cc_object {
1858 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07001859
Colin Cross77d57bf2016-04-11 14:34:18 -07001860 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001861 "crtbegin_static1",
1862 "crtbrand",
1863 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001864 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001865}
1866
Dan Willemsen208ae172015-09-16 16:33:27 -07001867cc_object {
1868 name: "crtbegin_dynamic1",
1869 local_include_dirs: ["include"],
1870 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001871
Colin Cross50c21ab2015-10-31 23:03:05 -07001872 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001873 mips: {
1874 srcs: [
1875 "arch-mips/bionic/crtbegin.c",
1876 ],
1877 exclude_srcs: [
1878 "arch-common/bionic/crtbegin.c",
1879 ],
1880 },
1881 mips64: {
1882 srcs: [
1883 "arch-mips64/bionic/crtbegin.c",
1884 ],
1885 exclude_srcs: [
1886 "arch-common/bionic/crtbegin.c",
1887 ],
1888 },
1889 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001890 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001891}
1892
Dan Willemsen208ae172015-09-16 16:33:27 -07001893cc_object {
1894 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07001895
Colin Cross77d57bf2016-04-11 14:34:18 -07001896 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001897 "crtbegin_dynamic1",
1898 "crtbrand",
1899 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07001900 target: {
1901 linux_bionic: {
1902 generated_sources: ["host_bionic_linker_asm"],
1903 objs: [
1904 "linker_wrapper",
1905 ],
1906 },
1907 },
Colin Cross50c21ab2015-10-31 23:03:05 -07001908 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001909}
1910
Dan Willemsen208ae172015-09-16 16:33:27 -07001911cc_object {
1912 // We rename crtend.o to crtend_android.o to avoid a
1913 // name clash between gcc and bionic.
1914 name: "crtend_android",
1915 local_include_dirs: ["include"],
1916 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001917
Colin Cross50c21ab2015-10-31 23:03:05 -07001918 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001919}
Colin Crossbaa48992016-07-13 11:15:21 -07001920
Dan Albert26e1c412018-05-24 14:56:46 -07001921versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07001922 name: "common_libc",
1923 from: "include",
1924 to: "",
1925 license: "NOTICE",
1926}
Dan Albert4238a352016-06-28 11:18:05 -07001927
1928ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08001929 name: "libc_uapi",
1930 from: "kernel/uapi",
1931 to: "",
1932 srcs: [
1933 "kernel/uapi/asm-generic/**/*.h",
1934 "kernel/uapi/drm/**/*.h",
1935 "kernel/uapi/linux/**/*.h",
1936 "kernel/uapi/misc/**/*.h",
1937 "kernel/uapi/mtd/**/*.h",
1938 "kernel/uapi/rdma/**/*.h",
1939 "kernel/uapi/scsi/**/*.h",
1940 "kernel/uapi/sound/**/*.h",
1941 "kernel/uapi/video/**/*.h",
1942 "kernel/uapi/xen/**/*.h",
1943 ],
Dan Albert92592652016-10-20 01:42:54 -07001944 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07001945}
1946
1947ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07001948 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07001949 from: "kernel/android/uapi/linux",
1950 to: "linux",
1951 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07001952 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07001953}
1954
1955ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07001956 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07001957 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07001958 to: "scsi",
1959 srcs: ["kernel/android/scsi/**/*.h"],
1960 license: "NOTICE",
1961}
1962
1963ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07001964 name: "libc_asm_arm",
1965 from: "kernel/uapi/asm-arm",
1966 to: "arm-linux-androideabi",
1967 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07001968 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07001969}
1970
1971ndk_headers {
1972 name: "libc_asm_arm64",
1973 from: "kernel/uapi/asm-arm64",
1974 to: "aarch64-linux-android",
1975 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07001976 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07001977}
1978
Elliott Hughesee291c02017-12-11 11:32:34 -08001979// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07001980ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01001981 name: "libc_asm_mips",
1982 from: "kernel/uapi/asm-mips",
1983 to: "mipsel-linux-android",
1984 srcs: ["kernel/uapi/asm-mips/**/*.h"],
1985 license: "NOTICE",
1986}
1987
Elliott Hughesee291c02017-12-11 11:32:34 -08001988// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01001989ndk_headers {
1990 name: "libc_asm_mips64",
1991 from: "kernel/uapi/asm-mips",
1992 to: "mips64el-linux-android",
1993 srcs: ["kernel/uapi/asm-mips/**/*.h"],
1994 license: "NOTICE",
1995}
1996
1997ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07001998 name: "libc_asm_x86",
1999 from: "kernel/uapi/asm-x86",
2000 to: "i686-linux-android",
2001 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002002 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002003}
2004
2005ndk_headers {
2006 name: "libc_asm_x86_64",
2007 from: "kernel/uapi/asm-x86",
2008 to: "x86_64-linux-android",
2009 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002010 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002011}
2012
Dan Albert4238a352016-06-28 11:18:05 -07002013ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002014 name: "libc",
Dan Albert4238a352016-06-28 11:18:05 -07002015 symbol_file: "libc.map.txt",
2016 first_version: "9",
2017}
2018
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002019llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002020 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002021 symbol_file: "libc.map.txt",
2022 export_headers_as_system: true,
2023 export_preprocessed_headers: ["include"],
2024 arch: {
2025 arm: {
2026 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002027 "kernel/uapi",
2028 "kernel/uapi/asm-arm",
2029 "kernel/android/uapi",
2030 ],
2031 },
2032 arm64: {
2033 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002034 "kernel/uapi",
2035 "kernel/uapi/asm-arm64",
2036 "kernel/android/uapi",
2037 ],
2038 },
2039 mips: {
2040 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002041 "kernel/uapi",
2042 "kernel/uapi/asm-mips",
2043 "kernel/android/uapi",
2044 ],
2045 },
2046 mips64: {
2047 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002048 "kernel/uapi",
2049 "kernel/uapi/asm-mips",
2050 "kernel/android/uapi",
2051 ],
2052 },
2053 x86: {
2054 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002055 "kernel/uapi",
2056 "kernel/uapi/asm-x86",
2057 "kernel/android/uapi",
2058 ],
2059 },
2060 x86_64: {
2061 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002062 "kernel/uapi",
2063 "kernel/uapi/asm-x86",
2064 "kernel/android/uapi",
2065 ],
2066 },
2067 },
2068}
2069
Dan Albertdf31aff2016-10-06 15:50:41 -07002070ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002071 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002072 symbol_file: "libstdc++.map.txt",
2073 first_version: "9",
2074}
2075
Dan Willemsenca056d72018-01-08 14:00:24 -08002076// Export these headers for toolbox to process
2077filegroup {
2078 name: "kernel_input_headers",
2079 srcs: [
2080 "kernel/uapi/linux/input.h",
2081 "kernel/uapi/linux/input-event-codes.h",
2082 ],
2083}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002084
2085// Generate a syscall name / number mapping. These objects are text files
2086// (thanks to the -dD -E flags) and not binary files. They will then be
2087// consumed by the genseccomp.py script and converted into C++ code.
2088cc_defaults {
2089 name: "libseccomp_gen_syscall_nrs_defaults",
2090 recovery_available: true,
2091 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2092 cflags: [
2093 "-dD",
2094 "-E",
2095 "-Wall",
2096 "-Werror",
2097 "-nostdinc",
2098 ],
2099}
2100
2101cc_object {
2102 name: "libseccomp_gen_syscall_nrs_arm",
2103 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2104 local_include_dirs: [
2105 "kernel/uapi/asm-arm",
2106 "kernel/uapi",
2107 ],
2108}
2109
2110cc_object {
2111 name: "libseccomp_gen_syscall_nrs_arm64",
2112 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2113 local_include_dirs: [
2114 "kernel/uapi/asm-arm64",
2115 "kernel/uapi",
2116 ],
2117}
2118
2119cc_object {
2120 name: "libseccomp_gen_syscall_nrs_x86",
2121 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2122 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2123 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2124 local_include_dirs: [
2125 "kernel/uapi/asm-x86",
2126 "kernel/uapi",
2127 ],
2128}
2129
2130cc_object {
2131 name: "libseccomp_gen_syscall_nrs_x86_64",
2132 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2133 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2134 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2135 local_include_dirs: [
2136 "kernel/uapi/asm-x86",
2137 "kernel/uapi",
2138 ],
2139}
2140
2141cc_object {
2142 name: "libseccomp_gen_syscall_nrs_mips",
2143 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2144 cflags: [
2145 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2146 ],
2147 local_include_dirs: [
2148 "kernel/uapi/asm-mips",
2149 "kernel/uapi",
2150 ],
2151}
2152
2153cc_object {
2154 name: "libseccomp_gen_syscall_nrs_mips64",
2155 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2156 cflags: [
2157 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2158 ],
2159 local_include_dirs: [
2160 "kernel/uapi/asm-mips",
2161 "kernel/uapi",
2162 ],
2163}
2164
2165// Generate the C++ policy sources for app, system, and global seccomp-bpf
2166// filters.
2167python_binary_host {
2168 name: "genseccomp",
2169 main: "tools/genseccomp.py",
2170
2171 srcs: [
2172 "tools/genseccomp.py",
2173 "tools/gensyscalls.py",
2174 ],
2175
2176 data: [
2177 "kernel/uapi/**/*.h",
2178 ],
2179
2180 version: {
2181 py2: {
2182 enabled: true,
2183 },
2184 py3: {
2185 enabled: false,
2186 },
2187 },
2188}
2189
2190cc_genrule {
2191 name: "libseccomp_policy_app_sources",
2192 recovery_available: true,
2193 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2194
2195 tools: [ "genseccomp" ],
2196
2197 srcs: [
2198 "SYSCALLS.TXT",
2199 "SECCOMP_WHITELIST_COMMON.TXT",
2200 "SECCOMP_WHITELIST_APP.TXT",
2201 "SECCOMP_BLACKLIST_COMMON.TXT",
2202 "SECCOMP_BLACKLIST_APP.TXT",
2203 ":libseccomp_gen_syscall_nrs_arm",
2204 ":libseccomp_gen_syscall_nrs_arm64",
2205 ":libseccomp_gen_syscall_nrs_mips",
2206 ":libseccomp_gen_syscall_nrs_mips64",
2207 ":libseccomp_gen_syscall_nrs_x86",
2208 ":libseccomp_gen_syscall_nrs_x86_64",
2209 ],
2210
2211 out: [
2212 "arm64_app_policy.cpp",
2213 "arm_app_policy.cpp",
2214 "mips64_app_policy.cpp",
2215 "mips_app_policy.cpp",
2216 "x86_64_app_policy.cpp",
2217 "x86_app_policy.cpp",
2218 ],
2219}
2220
2221cc_genrule {
2222 name: "libseccomp_policy_system_sources",
2223 recovery_available: true,
2224 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2225
2226 tools: [ "genseccomp" ],
2227
2228 srcs: [
2229 "SYSCALLS.TXT",
2230 "SECCOMP_WHITELIST_COMMON.TXT",
2231 "SECCOMP_WHITELIST_SYSTEM.TXT",
2232 "SECCOMP_BLACKLIST_COMMON.TXT",
2233 ":libseccomp_gen_syscall_nrs_arm",
2234 ":libseccomp_gen_syscall_nrs_arm64",
2235 ":libseccomp_gen_syscall_nrs_mips",
2236 ":libseccomp_gen_syscall_nrs_mips64",
2237 ":libseccomp_gen_syscall_nrs_x86",
2238 ":libseccomp_gen_syscall_nrs_x86_64",
2239 ],
2240
2241 out: [
2242 "arm64_system_policy.cpp",
2243 "arm_system_policy.cpp",
2244 "mips64_system_policy.cpp",
2245 "mips_system_policy.cpp",
2246 "x86_64_system_policy.cpp",
2247 "x86_system_policy.cpp",
2248 ],
2249}
2250
2251cc_genrule {
2252 name: "libseccomp_policy_global_sources",
2253 recovery_available: true,
2254 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=global $(in)",
2255
2256 tools: [ "genseccomp" ],
2257
2258 srcs: [
2259 "SYSCALLS.TXT",
2260 "SECCOMP_WHITELIST_COMMON.TXT",
2261 "SECCOMP_WHITELIST_SYSTEM.TXT",
2262 "SECCOMP_WHITELIST_APP.TXT",
2263 "SECCOMP_WHITELIST_GLOBAL.TXT",
2264 "SECCOMP_BLACKLIST_COMMON.TXT",
2265 ":libseccomp_gen_syscall_nrs_arm",
2266 ":libseccomp_gen_syscall_nrs_arm64",
2267 ":libseccomp_gen_syscall_nrs_mips",
2268 ":libseccomp_gen_syscall_nrs_mips64",
2269 ":libseccomp_gen_syscall_nrs_x86",
2270 ":libseccomp_gen_syscall_nrs_x86_64",
2271 ],
2272
2273 out: [
2274 "arm64_global_policy.cpp",
2275 "arm_global_policy.cpp",
2276 "mips64_global_policy.cpp",
2277 "mips_global_policy.cpp",
2278 "x86_64_global_policy.cpp",
2279 "x86_global_policy.cpp",
2280 ],
2281}
2282
2283cc_library {
2284 name: "libseccomp_policy",
2285 recovery_available: true,
2286 generated_sources: [
2287 "libseccomp_policy_app_sources",
2288 "libseccomp_policy_global_sources",
2289 "libseccomp_policy_system_sources",
2290 ],
2291
2292 srcs: [
2293 "seccomp/seccomp_policy.cpp",
2294 ],
2295
2296 export_include_dirs: ["seccomp/include"],
2297 cflags: [
2298 "-Wall",
2299 "-Werror",
2300 ],
2301 shared: {
2302 shared_libs: ["libbase"],
2303 },
2304 static: {
2305 static_libs: ["libbase"],
2306 },
2307}