blob: 626afd972a628d1d3bf4271fa2db5211e73f0151 [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
Peter Collingbourne570de332019-12-11 10:00:58 -080023// off64_t/time64_t support on LP32.
Dan Willemsen208ae172015-09-16 16:33:27 -070024// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -070025libc_common_src_files_32 = [
26 "bionic/legacy_32_bit_support.cpp",
27 "bionic/time64.c",
28]
29
Elliott Hughes53cf3482016-08-09 13:06:41 -070030libc_common_flags = [
31 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080032 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070033 "-Wall",
34 "-Wextra",
35 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080036 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070037 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070038 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070039 "-Wframe-larger-than=2048",
Elliott Hughes53cf3482016-08-09 13:06:41 -070040
41 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
42 "-Werror=pointer-to-int-cast",
43 "-Werror=int-to-pointer-cast",
44 "-Werror=type-limits",
45 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080046
47 // Clang's exit-time destructor registration hides __dso_handle, but
48 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
49 "-Wexit-time-destructors",
Elliott Hughes53cf3482016-08-09 13:06:41 -070050]
51
Dan Willemsen208ae172015-09-16 16:33:27 -070052// Define some common cflags
53// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070054cc_defaults {
55 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080056 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070057 cflags: libc_common_flags,
58 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070059 conlyflags: ["-std=gnu99"],
60 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070061 include_dirs: [
62 "bionic/libc/async_safe/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070063 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070064
Colin Cross50c21ab2015-10-31 23:03:05 -070065 stl: "none",
66 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070067 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070068 address: false,
69 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070070 // TODO(b/132640749): Fix broken fuzzer support.
71 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070072 },
Colin Cross50c21ab2015-10-31 23:03:05 -070073 native_coverage: false,
Jiyong Park5603c6e2018-04-27 21:53:11 +090074 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020075 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080076
Yi Konge3d90de2019-02-20 14:28:56 -080077 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
78 // warning since this is intended right now.
79 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070080
81 product_variables: {
82 experimental_mte: {
83 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
84 },
85 },
Dan Willemsen208ae172015-09-16 16:33:27 -070086}
87
Christopher Ferrise55e5ee2019-10-01 17:54:42 -070088// Defaults for native allocator libs/includes to make it
89// easier to change.
90// To enable scudo, change the below to libc_scudo_defaults
91// and comment out the defaults line in libc_scudo shared
92// library.
93// ========================================================
94cc_defaults {
95 name: "libc_native_allocator_defaults",
96
Ytai Ben-tsvi5105ece2019-12-19 19:08:58 +000097 defaults: ["libc_jemalloc5_defaults"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -070098}
99
100cc_defaults {
101 name: "libc_jemalloc5_defaults",
102
103 include_dirs: [
104 "external/jemalloc_new/include",
105 ],
106
107 whole_static_libs: [
108 "libjemalloc5",
109 "libc_jemalloc_wrapper",
110 ],
111}
112
113// Functions not implemented by jemalloc directly, or that need to
114// be modified for Android.
115cc_library_static {
116 name: "libc_jemalloc_wrapper",
117 defaults: ["libc_defaults"],
118 srcs: ["bionic/jemalloc_wrapper.cpp"],
119 cflags: ["-fvisibility=hidden"],
120
121 include_dirs: [
122 "external/jemalloc_new/include",
123 ],
124}
125
126cc_defaults {
127 name: "libc_scudo_defaults",
128
129 cflags: [
Christopher Ferrise1fd4092019-12-16 16:22:55 -0800130 "-DUSE_SCUDO_SVELTE",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700131 ],
132
Christopher Ferrise1fd4092019-12-16 16:22:55 -0800133 product_variables: {
134 malloc_not_svelte: {
135 cflags: [
136 "-UUSE_SCUDO_SVELTE",
137 "-DUSE_SCUDO",
138 ],
139 },
140 },
141
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700142 whole_static_libs: [
143 "libscudo",
144 ],
145}
146
Dan Willemsen208ae172015-09-16 16:33:27 -0700147// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700148// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700149// ========================================================
150//
Ryan Prichard249757b2019-11-01 17:18:28 -0700151// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
152// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
153// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
154// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700155
156cc_library_static {
157
Colin Crossa3f9fca2016-01-11 13:20:55 -0800158 srcs: [
159 "bionic/__libc_init_main_thread.cpp",
160 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700161 "bionic/bionic_call_ifunc_resolver.cpp",
162 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800163 ],
164 arch: {
165 arm64: {
166 srcs: ["arch-arm64/bionic/__set_tls.c"],
167 },
168 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700169 srcs: [
170 "arch-x86/bionic/__libc_init_sysinfo.cpp",
171 "arch-x86/bionic/__set_tls.cpp",
172 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800173 },
174 x86_64: {
175 srcs: ["arch-x86_64/bionic/__set_tls.c"],
176 },
177 },
178
Colin Cross50c21ab2015-10-31 23:03:05 -0700179 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700180 cflags: ["-fno-stack-protector", "-ffreestanding"],
181 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700182}
183
Ryan Prichard249757b2019-11-01 17:18:28 -0700184// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
185// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
186// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800187
188cc_library_static {
189 name: "libc_init_static",
190 defaults: ["libc_defaults"],
191 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700192 cflags: [
193 "-fno-stack-protector",
194
195 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
196 // from the linker before ifunc resolvers have made string.h functions available.
197 "-ffreestanding",
198 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800199}
200
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700201cc_library_static {
202 name: "libc_init_dynamic",
203 defaults: ["libc_defaults"],
204 srcs: ["bionic/libc_init_dynamic.cpp"],
205 cflags: ["-fno-stack-protector"],
206}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800207
Dan Willemsen208ae172015-09-16 16:33:27 -0700208// ========================================================
209// libc_tzcode.a - upstream 'tzcode' code
210// ========================================================
211
212cc_library_static {
213
Colin Cross50c21ab2015-10-31 23:03:05 -0700214 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700215 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800216 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700217 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700218 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
219 ],
220
Colin Cross50c21ab2015-10-31 23:03:05 -0700221 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700222 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700223 // Don't use ridiculous amounts of stack.
224 "-DALL_STATE",
225 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
226 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800227 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700228 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700229 // The name of the tm_gmtoff field in our struct tm.
230 "-DTM_GMTOFF=tm_gmtoff",
231 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700232 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700233 // Include `tzname`, `timezone`, and `daylight` globals.
234 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700235 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800236 // Use the empty string (instead of " ") as the timezone abbreviation
237 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700238 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700239 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
240 "-Dlint",
241 ],
242
Dan Willemsen208ae172015-09-16 16:33:27 -0700243 local_include_dirs: ["tzcode/"],
244 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700245}
246
247// ========================================================
248// libc_dns.a - modified NetBSD DNS code
249// ========================================================
250
251cc_library_static {
252
Colin Cross50c21ab2015-10-31 23:03:05 -0700253 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700254 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800255 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700256
257 "upstream-netbsd/lib/libc/isc/ev_streams.c",
258 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700259 ],
260
Colin Cross50c21ab2015-10-31 23:03:05 -0700261 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700262 "-DANDROID_CHANGES",
263 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700264 "-Wno-unused-parameter",
265 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700266 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700267 ],
268
Dan Willemsen208ae172015-09-16 16:33:27 -0700269 local_include_dirs: [
270 "dns/include",
271 "private",
272 "upstream-netbsd/lib/libc/include",
273 "upstream-netbsd/android/include",
274 ],
275
276 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700277}
278
279// ========================================================
280// libc_freebsd.a - upstream FreeBSD C library code
281// ========================================================
282//
283// These files are built with the freebsd-compat.h header file
284// automatically included.
285
286cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700287 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700288 srcs: [
289 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700290 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700291 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
292 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
293 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
294 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700295 "upstream-freebsd/lib/libc/stdlib/qsort.c",
296 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700297 "upstream-freebsd/lib/libc/string/wcpcpy.c",
298 "upstream-freebsd/lib/libc/string/wcpncpy.c",
299 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700300 "upstream-freebsd/lib/libc/string/wcscat.c",
301 "upstream-freebsd/lib/libc/string/wcschr.c",
302 "upstream-freebsd/lib/libc/string/wcscmp.c",
303 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700304 "upstream-freebsd/lib/libc/string/wcscspn.c",
305 "upstream-freebsd/lib/libc/string/wcsdup.c",
306 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700307 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700308 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
309 "upstream-freebsd/lib/libc/string/wcsncat.c",
310 "upstream-freebsd/lib/libc/string/wcsncmp.c",
311 "upstream-freebsd/lib/libc/string/wcsncpy.c",
312 "upstream-freebsd/lib/libc/string/wcsnlen.c",
313 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700314 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700315 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700316 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700317 "upstream-freebsd/lib/libc/string/wcstok.c",
318 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700319 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700320 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700321 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800322 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700323 ],
324 arch: {
325 arm64: {
326 exclude_srcs: [
327 "upstream-freebsd/lib/libc/string/wmemmove.c",
328 ],
329 },
330 x86: {
331 exclude_srcs: [
332 "upstream-freebsd/lib/libc/string/wcschr.c",
333 "upstream-freebsd/lib/libc/string/wcscmp.c",
334 "upstream-freebsd/lib/libc/string/wcslen.c",
335 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700336 "upstream-freebsd/lib/libc/string/wmemcmp.c",
337 "upstream-freebsd/lib/libc/string/wcscat.c",
338 "upstream-freebsd/lib/libc/string/wcscpy.c",
339 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530340 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700341 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700342 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700343 },
344
Colin Cross50c21ab2015-10-31 23:03:05 -0700345 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700346 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700347 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700348 "-include freebsd-compat.h",
349 ],
350
Dan Willemsen208ae172015-09-16 16:33:27 -0700351 local_include_dirs: [
352 "upstream-freebsd/android/include",
353 ],
354
355 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700356}
357
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700358cc_library_static {
359 defaults: ["libc_defaults"],
360 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700361 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700362 "upstream-freebsd/lib/libc/stdlib/realpath.c",
363 ],
364
365 cflags: [
366 "-Wno-sign-compare",
367 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700368 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700369 ],
370
371 local_include_dirs: [
372 "upstream-freebsd/android/include",
373 ],
374
375 name: "libc_freebsd_large_stack",
376}
377
Dan Willemsen208ae172015-09-16 16:33:27 -0700378// ========================================================
379// libc_netbsd.a - upstream NetBSD C library code
380// ========================================================
381//
382// These files are built with the netbsd-compat.h header file
383// automatically included.
384
385cc_library_static {
386
Colin Cross50c21ab2015-10-31 23:03:05 -0700387 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700388 srcs: [
389 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700390 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700391 "upstream-netbsd/lib/libc/gen/psignal.c",
392 "upstream-netbsd/lib/libc/gen/utime.c",
393 "upstream-netbsd/lib/libc/gen/utmp.c",
394 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
395 "upstream-netbsd/lib/libc/regex/regcomp.c",
396 "upstream-netbsd/lib/libc/regex/regerror.c",
397 "upstream-netbsd/lib/libc/regex/regexec.c",
398 "upstream-netbsd/lib/libc/regex/regfree.c",
399 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700400 "upstream-netbsd/lib/libc/stdlib/drand48.c",
401 "upstream-netbsd/lib/libc/stdlib/erand48.c",
402 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
403 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700404 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
405 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
406 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
407 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
408 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
409 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
410 "upstream-netbsd/lib/libc/stdlib/seed48.c",
411 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700412 ],
413 multilib: {
414 lib32: {
415 // LP32 cruft
416 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
417 },
418 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700419 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700420 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800421 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700422 "-DPOSIX_MISTAKE",
423 "-include netbsd-compat.h",
424 ],
425
Dan Willemsen208ae172015-09-16 16:33:27 -0700426 local_include_dirs: [
427 "upstream-netbsd/android/include",
428 "upstream-netbsd/lib/libc/include",
429 ],
430
431 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700432}
433
434// ========================================================
435// libc_openbsd_ndk.a - upstream OpenBSD C library code
436// that can be safely included in the libc_ndk.a (doesn't
437// contain any troublesome global data or constructors).
438// ========================================================
439//
440// These files are built with the openbsd-compat.h header file
441// automatically included.
442
443cc_library_static {
444 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700445 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700446 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700447 "upstream-openbsd/lib/libc/gen/alarm.c",
448 "upstream-openbsd/lib/libc/gen/ctype_.c",
449 "upstream-openbsd/lib/libc/gen/daemon.c",
450 "upstream-openbsd/lib/libc/gen/err.c",
451 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700452 "upstream-openbsd/lib/libc/gen/fnmatch.c",
453 "upstream-openbsd/lib/libc/gen/ftok.c",
454 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700455 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700456 "upstream-openbsd/lib/libc/gen/verr.c",
457 "upstream-openbsd/lib/libc/gen/verrx.c",
458 "upstream-openbsd/lib/libc/gen/vwarn.c",
459 "upstream-openbsd/lib/libc/gen/vwarnx.c",
460 "upstream-openbsd/lib/libc/gen/warn.c",
461 "upstream-openbsd/lib/libc/gen/warnx.c",
462 "upstream-openbsd/lib/libc/locale/btowc.c",
463 "upstream-openbsd/lib/libc/locale/mbrlen.c",
464 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
465 "upstream-openbsd/lib/libc/locale/mbtowc.c",
466 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700467 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
468 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700469 "upstream-openbsd/lib/libc/locale/wcstoll.c",
470 "upstream-openbsd/lib/libc/locale/wcstombs.c",
471 "upstream-openbsd/lib/libc/locale/wcstoul.c",
472 "upstream-openbsd/lib/libc/locale/wcstoull.c",
473 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
474 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
475 "upstream-openbsd/lib/libc/locale/wctob.c",
476 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700477 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700478 "upstream-openbsd/lib/libc/net/htonl.c",
479 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700480 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
481 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
482 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700483 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
484 "upstream-openbsd/lib/libc/net/inet_ntop.c",
485 "upstream-openbsd/lib/libc/net/inet_pton.c",
486 "upstream-openbsd/lib/libc/net/ntohl.c",
487 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800488 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700489 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700490 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
491 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700492 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700493 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700494 "upstream-openbsd/lib/libc/stdio/fputwc.c",
495 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700496 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700497 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700498 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700500 "upstream-openbsd/lib/libc/stdio/makebuf.c",
501 "upstream-openbsd/lib/libc/stdio/mktemp.c",
502 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
503 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700504 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700505 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700506 "upstream-openbsd/lib/libc/stdio/tempnam.c",
507 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
508 "upstream-openbsd/lib/libc/stdio/ungetc.c",
509 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
510 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
511 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700512 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
513 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
514 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700515 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700516 "upstream-openbsd/lib/libc/stdio/wsetup.c",
517 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800518 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700519 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700520 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700521 "upstream-openbsd/lib/libc/stdlib/insque.c",
522 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
523 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
524 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800525 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700526 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800527 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700528 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700529 "upstream-openbsd/lib/libc/stdlib/remque.c",
530 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700531 "upstream-openbsd/lib/libc/stdlib/tfind.c",
532 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800533 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700534 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800535 "upstream-openbsd/lib/libc/string/strcasestr.c",
536 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700537 "upstream-openbsd/lib/libc/string/strcspn.c",
538 "upstream-openbsd/lib/libc/string/strdup.c",
539 "upstream-openbsd/lib/libc/string/strndup.c",
540 "upstream-openbsd/lib/libc/string/strpbrk.c",
541 "upstream-openbsd/lib/libc/string/strsep.c",
542 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700543 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800544 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700546 "upstream-openbsd/lib/libc/string/wcswidth.c",
547 ],
548
Colin Cross50c21ab2015-10-31 23:03:05 -0700549 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700550 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700551 "-Wno-unused-parameter",
552 "-include openbsd-compat.h",
553 ],
554
Dan Willemsen208ae172015-09-16 16:33:27 -0700555 local_include_dirs: [
556 "private",
557 "stdio",
558 "upstream-openbsd/android/include",
559 "upstream-openbsd/lib/libc/include",
560 "upstream-openbsd/lib/libc/gdtoa/",
561 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700562}
563
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700564cc_library_static {
565 name: "libc_openbsd_large_stack",
566 defaults: ["libc_defaults"],
567 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700568 "stdio/vfprintf.cpp",
569 "stdio/vfwprintf.cpp",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800570 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700571 ],
572 cflags: [
573 "-include openbsd-compat.h",
574 "-Wno-sign-compare",
575 "-Wframe-larger-than=5000",
576 ],
577
578 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700579 "upstream-openbsd/android/include/",
580 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700581 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700582 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700583 ],
584}
585
Dan Willemsen208ae172015-09-16 16:33:27 -0700586// ========================================================
587// libc_openbsd.a - upstream OpenBSD C library code
588// ========================================================
589//
590// These files are built with the openbsd-compat.h header file
591// automatically included.
592cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700593 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700594 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800595 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700596 "upstream-openbsd/lib/libc/crypt/arc4random.c",
597 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
598
599 // May be overriden by per-arch optimized versions
600 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700601 "upstream-openbsd/lib/libc/string/memrchr.c",
602 "upstream-openbsd/lib/libc/string/stpcpy.c",
603 "upstream-openbsd/lib/libc/string/stpncpy.c",
604 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700605 "upstream-openbsd/lib/libc/string/strcpy.c",
606 "upstream-openbsd/lib/libc/string/strlcat.c",
607 "upstream-openbsd/lib/libc/string/strlcpy.c",
608 "upstream-openbsd/lib/libc/string/strncat.c",
609 "upstream-openbsd/lib/libc/string/strncmp.c",
610 "upstream-openbsd/lib/libc/string/strncpy.c",
611 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700612
613 arch: {
614 arm: {
615 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700616 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800617 "upstream-openbsd/lib/libc/string/stpcpy.c",
618 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700619 ],
620 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700621 arm64: {
622 exclude_srcs: [
623 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700624 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700625 "upstream-openbsd/lib/libc/string/strcpy.c",
626 "upstream-openbsd/lib/libc/string/strncmp.c",
627 ],
628 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530629 mips: {
630 exclude_srcs: [
631 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530632 "upstream-openbsd/lib/libc/string/strcpy.c",
633 "upstream-openbsd/lib/libc/string/strncmp.c",
634 ],
635 },
636 mips64: {
637 exclude_srcs: [
638 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530639 "upstream-openbsd/lib/libc/string/strcpy.c",
640 "upstream-openbsd/lib/libc/string/strncmp.c",
641 ],
642 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700643 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800644 exclude_srcs: [
645 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800646 "upstream-openbsd/lib/libc/string/memrchr.c",
647 "upstream-openbsd/lib/libc/string/stpcpy.c",
648 "upstream-openbsd/lib/libc/string/stpncpy.c",
649 "upstream-openbsd/lib/libc/string/strcat.c",
650 "upstream-openbsd/lib/libc/string/strcpy.c",
651 "upstream-openbsd/lib/libc/string/strncmp.c",
652 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700653 "upstream-openbsd/lib/libc/string/strlcat.c",
654 "upstream-openbsd/lib/libc/string/strlcpy.c",
655 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800656 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700657 },
658
659 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800660 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800661 "upstream-openbsd/lib/libc/string/stpcpy.c",
662 "upstream-openbsd/lib/libc/string/stpncpy.c",
663 "upstream-openbsd/lib/libc/string/strcat.c",
664 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800665 "upstream-openbsd/lib/libc/string/strncat.c",
666 "upstream-openbsd/lib/libc/string/strncmp.c",
667 "upstream-openbsd/lib/libc/string/strncpy.c",
668 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700669 },
670 },
671
Colin Cross50c21ab2015-10-31 23:03:05 -0700672 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700673 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700674 "-Wno-unused-parameter",
675 "-include openbsd-compat.h",
676 ],
677
Dan Willemsen208ae172015-09-16 16:33:27 -0700678 local_include_dirs: [
679 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700680 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700681 ],
682
683 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700684}
685
686// ========================================================
687// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
688// ========================================================
689//
690// These files are built with the openbsd-compat.h header file
691// automatically included.
692
693cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700694 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700695 srcs: [
696 "upstream-openbsd/android/gdtoa_support.cpp",
697 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
698 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
699 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
700 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
701 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
702 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
703 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
704 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
705 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
706 "upstream-openbsd/lib/libc/gdtoa/misc.c",
707 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
708 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
709 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
710 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
711 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
712 "upstream-openbsd/lib/libc/gdtoa/sum.c",
713 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
714 ],
715 multilib: {
716 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800717 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700718 },
719 },
720
Colin Cross50c21ab2015-10-31 23:03:05 -0700721 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700722 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700723 "-include openbsd-compat.h",
724 ],
725
Dan Willemsen208ae172015-09-16 16:33:27 -0700726 local_include_dirs: [
727 "private",
728 "upstream-openbsd/android/include",
729 "upstream-openbsd/lib/libc/include",
730 ],
731
732 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700733}
734
735// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700736// libc_fortify.a - container for our FORITFY
737// implementation details
738// ========================================================
739cc_library_static {
740 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700741 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700742
743 name: "libc_fortify",
744
745 // Disable FORTIFY for the compilation of these, so we don't end up having
746 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800747 cflags: [
748 "-U_FORTIFY_SOURCE",
749 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
750 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700751
752 arch: {
753 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800754 cflags: [
755 "-DNO___MEMCPY_CHK",
756 "-DRENAME___STRCAT_CHK",
757 "-DRENAME___STRCPY_CHK",
758 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700759 srcs: [
760 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800761
762 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
763 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
764
765 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
766 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
767
768 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
769 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
770
771 "arch-arm/krait/bionic/__strcat_chk.S",
772 "arch-arm/krait/bionic/__strcpy_chk.S",
773
774 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
775 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
776
Haibo Huang01bfd892018-12-03 15:05:16 -0800777 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
778 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700779 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700780 },
781 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700782 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700783 srcs: [
784 "arch-arm64/generic/bionic/__memcpy_chk.S",
785 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700786 },
787 },
788}
789
790// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700791// libc_bionic.a - home-grown C library code
792// ========================================================
793
794cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700795 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700796 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800797 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700798 "bionic/sysconf.cpp",
799 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700800 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700801
Josh Gao10ec9282017-04-03 15:13:29 -0700802 // The following must not be statically linked into libc_ndk.a, because
803 // debuggerd will look for the abort message in libc.so's copy.
804 "bionic/android_set_abort_message.cpp",
805
Dan Willemsen208ae172015-09-16 16:33:27 -0700806 "bionic/strchr.cpp",
807 "bionic/strnlen.c",
808 "bionic/strrchr.cpp",
809 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700810
811 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700812 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700813 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700814 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800815 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700816 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800817 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800818 "arch-arm/generic/bionic/stpcpy.c",
819 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800820 "arch-arm/generic/bionic/strcmp.S",
821 "arch-arm/generic/bionic/strcpy.S",
822 "arch-arm/generic/bionic/strlen.c",
823
Ryan Prichard45024fe2018-12-30 21:10:26 -0800824 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700825 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700826 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700827 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700828 "arch-arm/bionic/atomics_arm.c",
829 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800830 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700831 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700832 "arch-arm/bionic/setjmp.S",
833 "arch-arm/bionic/syscall.S",
834 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800835
836 "arch-arm/cortex-a15/bionic/memcpy.S",
837 "arch-arm/cortex-a15/bionic/memmove.S",
838 "arch-arm/cortex-a15/bionic/memset.S",
839 "arch-arm/cortex-a15/bionic/stpcpy.S",
840 "arch-arm/cortex-a15/bionic/strcat.S",
841 "arch-arm/cortex-a15/bionic/strcmp.S",
842 "arch-arm/cortex-a15/bionic/strcpy.S",
843 "arch-arm/cortex-a15/bionic/strlen.S",
844
845 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800846 "arch-arm/cortex-a7/bionic/memset.S",
847
848 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800849 "arch-arm/cortex-a9/bionic/memset.S",
850 "arch-arm/cortex-a9/bionic/stpcpy.S",
851 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800852 "arch-arm/cortex-a9/bionic/strcpy.S",
853 "arch-arm/cortex-a9/bionic/strlen.S",
854
855 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800856 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800857
858 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800859
Haibo Huang01bfd892018-12-03 15:05:16 -0800860 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800861
862 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700863 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700864 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700865 arm64: {
866 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700867 "arch-arm64/generic/bionic/memcmp.S",
868 "arch-arm64/generic/bionic/memcpy.S",
869 "arch-arm64/generic/bionic/memmove.S",
870 "arch-arm64/generic/bionic/memset.S",
871 "arch-arm64/generic/bionic/stpcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700872 "arch-arm64/generic/bionic/strcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700873 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800874
Peter Collingbourne900d07d2019-10-28 13:11:00 -0700875 "arch-arm64/default/bionic/memchr.S",
876 "arch-arm64/default/bionic/strchr.S",
877 "arch-arm64/default/bionic/strcmp.S",
878 "arch-arm64/default/bionic/strlen.S",
879 "arch-arm64/default/bionic/strncmp.S",
880 "arch-arm64/default/bionic/strnlen.S",
881
882 "arch-arm64/mte/bionic/memchr.c",
883 "arch-arm64/mte/bionic/strchr.cpp",
884 "arch-arm64/mte/bionic/strcmp.c",
885 "arch-arm64/mte/bionic/strlen.c",
886 "arch-arm64/mte/bionic/strncmp.c",
887 "arch-arm64/mte/bionic/strnlen.c",
888
Dan Willemsen3e621712016-02-03 21:48:08 -0800889 "arch-arm64/bionic/__bionic_clone.S",
890 "arch-arm64/bionic/_exit_with_stack_teardown.S",
891 "arch-arm64/bionic/setjmp.S",
892 "arch-arm64/bionic/syscall.S",
893 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700894 ],
895 exclude_srcs: [
896 "bionic/__memcpy_chk.cpp",
897 "bionic/strchr.cpp",
898 "bionic/strnlen.c",
899 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700900 },
901
902 mips: {
903 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800904 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530905 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800906 "arch-mips/string/memset.S",
907 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530908 "arch-mips/string/strncmp.S",
909 "arch-mips/string/strlen.c",
910 "arch-mips/string/strnlen.c",
911 "arch-mips/string/strchr.c",
912 "arch-mips/string/strcpy.c",
913 "arch-mips/string/memchr.c",
914 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800915
Dan Willemsen208ae172015-09-16 16:33:27 -0700916 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700917 "arch-mips/bionic/cacheflush.cpp",
918 "arch-mips/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800919 "arch-mips/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700920 "arch-mips/bionic/setjmp.S",
921 "arch-mips/bionic/syscall.S",
922 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700923 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530924 exclude_srcs: [
925 "bionic/strchr.cpp",
926 "bionic/strnlen.c",
927 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700928 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700929 mips64: {
930 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800931 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530932 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800933 "arch-mips/string/memset.S",
934 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530935 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800936 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530937 "arch-mips/string/strnlen.c",
938 "arch-mips/string/strchr.c",
939 "arch-mips/string/strcpy.c",
940 "arch-mips/string/memchr.c",
941 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800942
Dan Willemsen208ae172015-09-16 16:33:27 -0700943 "arch-mips64/bionic/__bionic_clone.S",
944 "arch-mips64/bionic/_exit_with_stack_teardown.S",
945 "arch-mips64/bionic/setjmp.S",
946 "arch-mips64/bionic/syscall.S",
947 "arch-mips64/bionic/vfork.S",
948 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700949 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530950 exclude_srcs: [
951 "bionic/strchr.cpp",
952 "bionic/strnlen.c",
953 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700954 },
955
956 x86: {
957 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700958 "arch-x86/generic/string/memcmp.S",
959 "arch-x86/generic/string/strcmp.S",
960 "arch-x86/generic/string/strncmp.S",
961 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700962
963 "arch-x86/generic/string/strlcat.c",
964 "arch-x86/generic/string/strlcpy.c",
965 "arch-x86/generic/string/strncat.c",
966 "arch-x86/generic/string/wcscat.c",
967 "arch-x86/generic/string/wcscpy.c",
968 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530969 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700970
Dan Willemsen208ae172015-09-16 16:33:27 -0700971 "arch-x86/atom/string/sse2-memchr-atom.S",
972 "arch-x86/atom/string/sse2-memrchr-atom.S",
973 "arch-x86/atom/string/sse2-strchr-atom.S",
974 "arch-x86/atom/string/sse2-strnlen-atom.S",
975 "arch-x86/atom/string/sse2-strrchr-atom.S",
976 "arch-x86/atom/string/sse2-wcschr-atom.S",
977 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
978 "arch-x86/atom/string/sse2-wcslen-atom.S",
979 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700980 "arch-x86/silvermont/string/sse2-memmove-slm.S",
981 "arch-x86/silvermont/string/sse2-memset-slm.S",
982 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
983 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
984 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
985 "arch-x86/silvermont/string/sse2-strlen-slm.S",
986 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800987
988 "arch-x86/bionic/__bionic_clone.S",
989 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800990 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800991 "arch-x86/bionic/__restore.S",
992 "arch-x86/bionic/setjmp.S",
993 "arch-x86/bionic/syscall.S",
994 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700995
996 // ssse3 functions
997 "arch-x86/atom/string/ssse3-strcat-atom.S",
998 "arch-x86/atom/string/ssse3-strcmp-atom.S",
999 "arch-x86/atom/string/ssse3-strlcat-atom.S",
1000 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
1001 "arch-x86/atom/string/ssse3-strncat-atom.S",
1002 "arch-x86/atom/string/ssse3-strncmp-atom.S",
1003 "arch-x86/atom/string/ssse3-wcscat-atom.S",
1004 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
1005
1006 // sse4 functions
1007 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
1008 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
1009
1010 // atom functions
1011 "arch-x86/atom/string/sse2-memset-atom.S",
1012 "arch-x86/atom/string/sse2-strlen-atom.S",
1013 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -08001014 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001015 "arch-x86/atom/string/ssse3-strcpy-atom.S",
1016 "arch-x86/atom/string/ssse3-strncpy-atom.S",
1017 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +05301018
1019 // avx2 functions
1020 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001021 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001022
1023 exclude_srcs: [
1024 "bionic/strchr.cpp",
1025 "bionic/strnlen.c",
1026 "bionic/strrchr.cpp",
1027 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001028 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001029 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001030 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001031 "arch-x86_64/string/sse2-memmove-slm.S",
1032 "arch-x86_64/string/sse2-memset-slm.S",
1033 "arch-x86_64/string/sse2-stpcpy-slm.S",
1034 "arch-x86_64/string/sse2-stpncpy-slm.S",
1035 "arch-x86_64/string/sse2-strcat-slm.S",
1036 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001037 "arch-x86_64/string/sse2-strlen-slm.S",
1038 "arch-x86_64/string/sse2-strncat-slm.S",
1039 "arch-x86_64/string/sse2-strncpy-slm.S",
1040 "arch-x86_64/string/sse4-memcmp-slm.S",
1041 "arch-x86_64/string/ssse3-strcmp-slm.S",
1042 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +05301043 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001044
1045 "arch-x86_64/bionic/__bionic_clone.S",
1046 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1047 "arch-x86_64/bionic/__restore_rt.S",
1048 "arch-x86_64/bionic/setjmp.S",
1049 "arch-x86_64/bionic/syscall.S",
1050 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001051 ],
1052 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001053 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001054
Colin Cross50c21ab2015-10-31 23:03:05 -07001055 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001056 include_dirs: ["bionic/libstdc++/include"],
1057 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001058}
1059
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001060genrule {
1061 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001062 out: ["generated_android_ids.h"],
1063 srcs: [":android_filesystem_config_header"],
1064 tool_files: ["fs_config_generator.py"],
1065 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001066}
1067
Dan Willemsen268a6732015-10-15 14:49:45 -07001068// ========================================================
1069// libc_bionic_ndk.a- The portions of libc_bionic that can
1070// be safely used in libc_ndk.a (no troublesome global data
1071// or constructors).
1072// ========================================================
1073cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001074 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001075 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001076 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001077 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001078 "bionic/__cmsg_nxthdr.cpp",
1079 "bionic/__errno.cpp",
1080 "bionic/__gnu_basename.cpp",
1081 "bionic/__libc_current_sigrtmax.cpp",
1082 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001083 "bionic/abort.cpp",
1084 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001085 "bionic/access.cpp",
1086 "bionic/arpa_inet.cpp",
1087 "bionic/assert.cpp",
1088 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001089 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001090 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001091 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001092 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001093 "bionic/bionic_systrace.cpp",
1094 "bionic/bionic_time_conversions.cpp",
1095 "bionic/brk.cpp",
1096 "bionic/c16rtomb.cpp",
1097 "bionic/c32rtomb.cpp",
1098 "bionic/chmod.cpp",
1099 "bionic/chown.cpp",
1100 "bionic/clearenv.cpp",
1101 "bionic/clock.cpp",
1102 "bionic/clock_getcpuclockid.cpp",
1103 "bionic/clock_nanosleep.cpp",
1104 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001105 "bionic/ctype.cpp",
1106 "bionic/dirent.cpp",
1107 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001108 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001109 "bionic/error.cpp",
1110 "bionic/eventfd_read.cpp",
1111 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001112 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001113 "bionic/faccessat.cpp",
1114 "bionic/fchmod.cpp",
1115 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001116 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001117 "bionic/ffs.cpp",
1118 "bionic/fgetxattr.cpp",
1119 "bionic/flistxattr.cpp",
1120 "bionic/flockfile.cpp",
1121 "bionic/fpclassify.cpp",
1122 "bionic/fsetxattr.cpp",
1123 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001124 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001125 "bionic/futimens.cpp",
1126 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001127 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001128 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001129 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001130 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001131 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001132 "bionic/getpgrp.cpp",
1133 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001134 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001135 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001136 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001137 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001138 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001139 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001140 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001141 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001142 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001143 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001144 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001145 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001146 "bionic/lchown.cpp",
1147 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001148 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001149 "bionic/libgen.cpp",
1150 "bionic/link.cpp",
1151 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001152 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001153 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001154 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001155 "bionic/mbrtoc16.cpp",
1156 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001157 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001158 "bionic/mempcpy.cpp",
1159 "bionic/mkdir.cpp",
1160 "bionic/mkfifo.cpp",
1161 "bionic/mknod.cpp",
1162 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001163 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001164 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001165 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001166 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001167 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001168 "bionic/open.cpp",
1169 "bionic/pathconf.cpp",
1170 "bionic/pause.cpp",
1171 "bionic/pipe.cpp",
1172 "bionic/poll.cpp",
1173 "bionic/posix_fadvise.cpp",
1174 "bionic/posix_fallocate.cpp",
1175 "bionic/posix_madvise.cpp",
1176 "bionic/posix_timers.cpp",
1177 "bionic/ptrace.cpp",
1178 "bionic/pty.cpp",
1179 "bionic/raise.cpp",
1180 "bionic/rand.cpp",
1181 "bionic/readlink.cpp",
1182 "bionic/reboot.cpp",
1183 "bionic/recv.cpp",
1184 "bionic/rename.cpp",
1185 "bionic/rmdir.cpp",
1186 "bionic/scandir.cpp",
1187 "bionic/sched_getaffinity.cpp",
1188 "bionic/sched_getcpu.cpp",
1189 "bionic/semaphore.cpp",
1190 "bionic/send.cpp",
1191 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001192 "bionic/seteuid.cpp",
1193 "bionic/setpgrp.cpp",
1194 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001195 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001196 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001197 "bionic/sleep.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001198 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001199 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001200 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001201 "bionic/strchrnul.cpp",
1202 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001203 "bionic/string_l.cpp",
1204 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001205 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001206 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001207 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001208 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001209 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001210 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001211 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001212 "bionic/sys_msg.cpp",
1213 "bionic/sys_sem.cpp",
1214 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001215 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001216 "bionic/sys_statfs.cpp",
1217 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001218 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001219 "bionic/sysinfo.cpp",
1220 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001221 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001222 "bionic/system_property_api.cpp",
1223 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001224 "bionic/tdestroy.cpp",
1225 "bionic/termios.cpp",
1226 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001227 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001228 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001229 "bionic/tmpfile.cpp",
1230 "bionic/umount.cpp",
1231 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001232 "bionic/usleep.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001233 "bionic/wait.cpp",
1234 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001235 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001236 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001237 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001238 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001239 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001240
1241 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1242 // which will be overridden by the actual one in libc.so.
1243 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001244 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001245
Dan Willemsen208ae172015-09-16 16:33:27 -07001246 multilib: {
1247 lib32: {
1248 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001249 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001250 },
1251 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001252 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001253 treble_linker_namespaces: {
1254 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001255 },
1256 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001257 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001258 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001259 local_include_dirs: ["stdio"],
1260 include_dirs: ["bionic/libstdc++/include"],
1261 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001262 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001263}
1264
Dan Willemsen208ae172015-09-16 16:33:27 -07001265// ========================================================
1266// libc_pthread.a - pthreads parts that previously lived in
1267// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001268// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001269// pthread_t has changed over the years and has ABI
1270// compatibility issues).
1271// ========================================================
1272
1273cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001274 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001275 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001276 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001277 "bionic/pthread_atfork.cpp",
1278 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001279 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001280 "bionic/pthread_cond.cpp",
1281 "bionic/pthread_create.cpp",
1282 "bionic/pthread_detach.cpp",
1283 "bionic/pthread_equal.cpp",
1284 "bionic/pthread_exit.cpp",
1285 "bionic/pthread_getcpuclockid.cpp",
1286 "bionic/pthread_getschedparam.cpp",
1287 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001288 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001289 "bionic/pthread_join.cpp",
1290 "bionic/pthread_key.cpp",
1291 "bionic/pthread_kill.cpp",
1292 "bionic/pthread_mutex.cpp",
1293 "bionic/pthread_once.cpp",
1294 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001295 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001296 "bionic/pthread_self.cpp",
1297 "bionic/pthread_setname_np.cpp",
1298 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001299 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001300
1301 // The following implementations depend on pthread data or implementation,
1302 // so we can't include them in libc_ndk.a.
1303 "bionic/__cxa_thread_atexit_impl.cpp",
1304 "stdlib/atexit.c",
1305 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001306 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001307
Colin Cross50c21ab2015-10-31 23:03:05 -07001308 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001309 include_dirs: ["bionic/libstdc++/include"],
1310 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001311}
1312
1313// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001314// libc_syscalls.a
1315// ========================================================
1316
Elliott Hughes782c4852019-04-16 12:31:00 -07001317genrule {
1318 name: "syscalls-arm.S",
1319 out: ["syscalls-arm.S"],
1320 srcs: ["SYSCALLS.TXT"],
1321 tool_files: [":bionic-gensyscalls"],
1322 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1323}
1324
1325genrule {
1326 name: "syscalls-arm64.S",
1327 out: ["syscalls-arm64.S"],
1328 srcs: ["SYSCALLS.TXT"],
1329 tool_files: [":bionic-gensyscalls"],
1330 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1331}
1332
1333genrule {
1334 name: "syscalls-x86.S",
1335 out: ["syscalls-x86.S"],
1336 srcs: ["SYSCALLS.TXT"],
1337 tool_files: [":bionic-gensyscalls"],
1338 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1339}
1340
1341genrule {
1342 name: "syscalls-x86_64.S",
1343 out: ["syscalls-x86_64.S"],
1344 srcs: ["SYSCALLS.TXT"],
1345 tool_files: [":bionic-gensyscalls"],
1346 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1347}
1348
Dan Willemsen208ae172015-09-16 16:33:27 -07001349cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001350 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001351 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001352 arch: {
1353 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001354 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001355 },
1356 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001357 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001358 },
1359 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001360 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001361 },
1362 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001363 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001364 },
1365 },
1366 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001367}
1368
1369// ========================================================
1370// libc_aeabi.a
1371// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1372// to avoid infinite recursion. For the other architectures we just build an
1373// empty library to keep this makefile simple.
1374// ========================================================
1375
1376cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001377 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001378 arch: {
1379 arm: {
1380 srcs: ["arch-arm/bionic/__aeabi.c"],
1381 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001382 },
1383 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001384 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001385}
1386
1387// ========================================================
1388// libc_ndk.a
1389// Compatibility library for the NDK. This library contains
1390// all the parts of libc that are safe to statically link.
1391// We can't safely statically link things that can only run
1392// on a certain version of the OS. Examples include
1393// anything that talks to netd (a large portion of the DNS
1394// code) and anything that is dependent on the layout of a
1395// data structure that has changed across releases (such as
1396// pthread_t).
1397// ========================================================
1398
1399cc_library_static {
1400 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001401 defaults: [
1402 "libc_defaults",
1403 "libc_native_allocator_defaults",
1404 ],
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001405 srcs: libc_common_src_files + [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001406 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001407 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001408 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001409 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001410 multilib: {
1411 lib32: {
1412 srcs: libc_common_src_files_32,
1413 },
1414 },
1415 arch: {
1416 arm: {
1417 srcs: [
1418 "arch-arm/bionic/exidx_dynamic.c",
1419 "arch-common/bionic/crtbegin_so.c",
1420 "arch-arm/bionic/atexit_legacy.c",
1421 "arch-common/bionic/crtend_so.S",
1422 ],
1423 whole_static_libs: ["libc_aeabi"],
1424 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001425 },
1426
Colin Cross50c21ab2015-10-31 23:03:05 -07001427 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001428 "-fvisibility=hidden",
1429 "-DLIBC_STATIC",
1430 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001431
1432 whole_static_libs: [
1433 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001434 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001435 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001436 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001437 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001438 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001439 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001440 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001441 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001442 "libc_syscalls",
1443 "libc_tzcode",
1444 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001445 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001446 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001447}
1448
1449// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001450// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001451// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001452cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001453 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001454 srcs: libc_common_src_files,
1455 multilib: {
1456 lib32: {
1457 srcs: libc_common_src_files_32,
1458 },
1459 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001460 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001461
1462 whole_static_libs: [
1463 "libc_bionic",
1464 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001465 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001466 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001467 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001468 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001469 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001470 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001471 "libc_netbsd",
1472 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001473 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001474 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001475 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001476 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001477 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001478 ],
1479
1480 arch: {
1481 arm: {
1482 whole_static_libs: ["libc_aeabi"],
1483 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001484 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001485}
1486
1487// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001488// libc_common.a
1489// ========================================================
1490
1491cc_library_static {
1492 defaults: ["libc_defaults"],
1493 name: "libc_common",
1494
1495 whole_static_libs: [
1496 "libc_nopthread",
1497 "libc_pthread",
1498 ],
1499}
1500
1501// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001502// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001503// ========================================================
1504cc_library_static {
1505 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001506 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001507
Haibo Huangb9244ff2018-08-11 10:12:13 -07001508 arch: {
1509 x86: {
1510 srcs: ["arch-x86/static_function_dispatch.S"],
1511 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001512 arm: {
1513 srcs: ["arch-arm/static_function_dispatch.S"],
1514 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001515 arm64: {
1516 srcs: ["arch-arm64/static_function_dispatch.S"],
1517 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001518 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001519}
1520
1521// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001522// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001523// ========================================================
1524cc_library_static {
1525 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001526 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001527
Haibo Huangb9244ff2018-08-11 10:12:13 -07001528 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001529 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001530 "-fno-stack-protector",
1531 "-fno-jump-tables",
1532 ],
1533 arch: {
1534 x86: {
1535 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1536 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001537 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001538 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001539 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001540 arm64: {
1541 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1542 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001543 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001544}
1545
1546// ========================================================
1547// libc_common_static.a For static binaries.
1548// ========================================================
1549cc_library_static {
1550 defaults: ["libc_defaults"],
1551 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001552
Haibo Huangf71edfa2018-11-12 10:06:56 -08001553 whole_static_libs: [
1554 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001555 "libc_static_dispatch",
1556 ],
1557}
1558
1559// ========================================================
1560// libc_common_shared.a For shared libraries.
1561// ========================================================
1562cc_library_static {
1563 defaults: ["libc_defaults"],
1564 name: "libc_common_shared",
1565
1566 whole_static_libs: [
1567 "libc_common",
1568 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001569 ],
1570}
1571
Ryan Prichard22a6a052019-10-10 23:59:30 -07001572// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1573// executable.
1574cc_library_static {
1575 name: "libc_unwind_static",
1576 defaults: ["libc_defaults"],
1577 cflags: ["-DLIBC_STATIC"],
1578
1579 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1580 arch: {
1581 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1582 arm: {
1583 srcs: ["arch-arm/bionic/exidx_static.c"],
1584 },
1585 },
1586}
1587
Haibo Huangf71edfa2018-11-12 10:06:56 -08001588// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001589// libc_nomalloc.a
1590// ========================================================
1591//
Ryan Prichard249757b2019-11-01 17:18:28 -07001592// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1593// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1594// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001595
1596cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001597 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001598 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001599
Colin Crossa3f9fca2016-01-11 13:20:55 -08001600 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001601 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001602 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001603 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001604 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001605}
1606
dimitryc0c0ef62018-12-05 16:33:52 +01001607filegroup {
1608 name: "libc_sources_shared",
1609 srcs: [
1610 "arch-common/bionic/crtbegin_so.c",
1611 "arch-common/bionic/crtbrand.S",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001612 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001613 "bionic/icu.cpp",
1614 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001615 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001616 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001617 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001618 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001619 "bionic/ndk_cruft.cpp",
1620 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001621 "bionic/NetdClient.cpp",
1622 "arch-common/bionic/crtend_so.S",
1623 ],
1624}
1625
1626filegroup {
1627 name: "libc_sources_static",
1628 srcs: [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001629 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001630 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001631 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001632 ],
1633}
1634
1635filegroup {
1636 name: "libc_sources_shared_arm",
1637 srcs: [
1638 "arch-arm/bionic/exidx_dynamic.c",
1639 "arch-arm/bionic/atexit_legacy.c",
1640 ],
1641}
1642
Dan Willemsen208ae172015-09-16 16:33:27 -07001643// ========================================================
1644// libc.a + libc.so
1645// ========================================================
1646cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001647 defaults: [
1648 "libc_defaults",
1649 "libc_native_allocator_defaults",
1650 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001651 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001652 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001653 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001654 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001655 platform_sdk_version: {
1656 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1657 },
1658 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001659 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001660 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001661 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001662 whole_static_libs: [
1663 "libc_init_static",
1664 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001665 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001666 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001667 },
1668 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001669 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001670 whole_static_libs: [
1671 "libc_init_dynamic",
1672 "libc_common_shared",
1673 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001674 },
1675
Neil Fullera7db90f2019-04-25 09:28:27 +01001676 required: [
1677 "tzdata",
1678 "tz_version", // Version metadata for tzdata to help debugging.
1679 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001680
Colin Cross4ce94d22016-11-15 13:15:43 -08001681 // Do not pack libc.so relocations; see http://b/20645321 for details.
1682 pack_relocations: false,
1683
dimitry06016f22018-01-05 11:39:28 +01001684 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1685 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1686 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1687 // those new libraries from libgcc.a are not declared external; if that were the case,
1688 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1689 // on the external symbols from the dependent libraries. That would create a "cloaked"
1690 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001691
dimitry06016f22018-01-05 11:39:28 +01001692 shared_libs: [
1693 "ld-android",
1694 "libdl",
1695 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001696 static_libs: [
1697 "libdl_android",
1698 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001699
1700 nocrt: true,
1701
Dan Willemsen208ae172015-09-16 16:33:27 -07001702 arch: {
1703 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001704 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001705 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001706 ldflags: ["-Wl,--hash-style=both"],
1707
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001708 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001709
Dan Willemsen208ae172015-09-16 16:33:27 -07001710 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001711 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001712 // special for arm
1713 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001714 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001715
1716 // Arm 32 bit does not produce complete exidx unwind information
1717 // so keep the .debug_frame which is relatively small and does
1718 // include needed unwind information.
1719 // See b/132992102 for details.
1720 strip: {
1721 keep_symbols_and_debug_frame: true,
1722 },
Peter Collingbourneb061e772019-11-12 14:26:21 -08001723
1724 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001725 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001726 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001727 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001728
1729 // Leave the symbols in the shared library so that stack unwinders can produce
1730 // meaningful name resolution.
1731 strip: {
1732 keep_symbols: true,
1733 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001734 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001735 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001736 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001737 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001738 ldflags: ["-Wl,--hash-style=both"],
1739
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001740 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001741
1742 // Leave the symbols in the shared library so that stack unwinders can produce
1743 // meaningful name resolution.
1744 strip: {
1745 keep_symbols: true,
1746 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001747 },
1748 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001749 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001750
1751 // Leave the symbols in the shared library so that stack unwinders can produce
1752 // meaningful name resolution.
1753 strip: {
1754 keep_symbols: true,
1755 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001756 },
1757 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001758
1759 stubs: {
1760 symbol_file: "libc.map.txt",
1761 versions: ["10000"],
1762 },
Vic Yang6903fb82019-01-14 11:34:39 -08001763
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001764 apex_available: [
1765 "//apex_available:platform",
1766 "com.android.runtime",
1767 ],
1768
Vic Yang03ff4362019-06-24 16:11:37 -07001769 // Sorting bss symbols by size usually results in less dirty pages at run
1770 // time, because small symbols are grouped together.
1771 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001772}
1773
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001774genrule {
1775 name: "libc.arm.map",
1776 out: ["libc.arm.map"],
1777 srcs: ["libc.map.txt"],
1778 tool_files: [":bionic-generate-version-script"],
1779 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1780}
1781
1782genrule {
1783 name: "libc.arm64.map",
1784 out: ["libc.arm64.map"],
1785 srcs: ["libc.map.txt"],
1786 tool_files: [":bionic-generate-version-script"],
1787 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1788}
1789
1790genrule {
1791 name: "libc.x86.map",
1792 out: ["libc.x86.map"],
1793 srcs: ["libc.map.txt"],
1794 tool_files: [":bionic-generate-version-script"],
1795 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1796}
1797
1798genrule {
1799 name: "libc.x86_64.map",
1800 out: ["libc.x86_64.map"],
1801 srcs: ["libc.map.txt"],
1802 tool_files: [":bionic-generate-version-script"],
1803 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1804}
1805
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001806// Headers that only other parts of the platform can include.
1807cc_library_headers {
1808 name: "bionic_libc_platform_headers",
1809 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001810 "//art:__subpackages__",
1811 "//bionic/libc:__subpackages__",
1812 "//frameworks:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001813 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001814 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001815 "//system/core/debuggerd:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001816 ],
1817 host_supported: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001818 recovery_available: true,
1819 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001820 export_include_dirs: [
1821 "platform",
1822 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001823 system_shared_libs: [],
1824 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001825 sdk_version: "current",
1826}
1827
Logan Chien17af91b2019-01-15 21:19:56 +08001828// libc_headers for libasync_safe and libpropertyinfoparser
1829cc_library_headers {
1830 name: "libc_headers",
1831
1832 host_supported: true,
1833 vendor_available: true,
1834 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001835 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001836
1837 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001838 stl: "none",
1839 system_shared_libs: [],
1840
1841 export_include_dirs: [
1842 "include",
1843 "kernel/uapi",
1844 "kernel/android/uapi",
1845 ],
1846
1847 arch: {
1848 arm: {
1849 export_include_dirs: [
1850 "kernel/uapi/asm-arm",
1851 ],
1852 },
1853 arm64: {
1854 export_include_dirs: [
1855 "kernel/uapi/asm-arm64",
1856 ],
1857 },
1858 mips: {
1859 export_include_dirs: [
1860 "kernel/uapi/asm-mips",
1861 ],
1862 },
1863 mips64: {
1864 export_include_dirs: [
1865 "kernel/uapi/asm-mips",
1866 ],
1867 },
1868 x86: {
1869 export_include_dirs: [
1870 "kernel/uapi/asm-x86",
1871 ],
1872 },
1873 x86_64: {
1874 export_include_dirs: [
1875 "kernel/uapi/asm-x86",
1876 ],
1877 },
1878 },
1879}
1880
Dan Willemsen208ae172015-09-16 16:33:27 -07001881// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001882// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001883// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001884
Dan Willemsen208ae172015-09-16 16:33:27 -07001885cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001886 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001887 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001888 srcs: [
1889 "bionic/__cxa_guard.cpp",
1890 "bionic/__cxa_pure_virtual.cpp",
1891 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001892 ],
1893 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001894 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001895 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001896
Dan Willemsen6b3be172018-12-03 13:57:20 -08001897 static: {
1898 system_shared_libs: [],
1899 },
1900 shared: {
1901 system_shared_libs: ["libc"],
1902 },
1903
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001904 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001905 arch: {
1906 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001907 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001908 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001909 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001910 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001911 },
1912 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001913 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001914 },
1915 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001916 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001917 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001918 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001919 },
1920 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001921 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001922 },
1923 },
1924}
1925
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001926genrule {
1927 name: "libstdc++.arm.map",
1928 out: ["libstdc++.arm.map"],
1929 srcs: ["libstdc++.map.txt"],
1930 tool_files: [":bionic-generate-version-script"],
1931 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1932}
1933
1934genrule {
1935 name: "libstdc++.arm64.map",
1936 out: ["libstdc++.arm64.map"],
1937 srcs: ["libstdc++.map.txt"],
1938 tool_files: [":bionic-generate-version-script"],
1939 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1940}
1941
1942genrule {
1943 name: "libstdc++.x86.map",
1944 out: ["libstdc++.x86.map"],
1945 srcs: ["libstdc++.map.txt"],
1946 tool_files: [":bionic-generate-version-script"],
1947 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1948}
1949
1950genrule {
1951 name: "libstdc++.x86_64.map",
1952 out: ["libstdc++.x86_64.map"],
1953 srcs: ["libstdc++.map.txt"],
1954 tool_files: [":bionic-generate-version-script"],
1955 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1956}
1957
1958// ========================================================
1959// crt object files.
1960// ========================================================
1961
Colin Cross50c21ab2015-10-31 23:03:05 -07001962cc_defaults {
1963 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001964 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001965 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001966 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001967 native_bridge_supported: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001968
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001969 cflags: [
1970 "-Wno-gcc-compat",
1971 "-Wall",
1972 "-Werror",
1973 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07001974 sanitize: {
1975 never: true,
1976 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001977}
1978
Colin Cross50c21ab2015-10-31 23:03:05 -07001979cc_defaults {
1980 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001981 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001982
1983 arch: {
1984 mips: {
1985 cflags: ["-fPIC"],
1986 },
1987 mips64: {
1988 cflags: ["-fPIC"],
1989 },
1990 x86: {
1991 cflags: ["-fPIC"],
1992 },
1993 x86_64: {
1994 cflags: ["-fPIC"],
1995 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001996 },
Colin Crossab179442018-09-27 11:03:22 -07001997 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001998}
1999
Dan Willemsen208ae172015-09-16 16:33:27 -07002000cc_object {
2001 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002002 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002003 local_include_dirs: ["include"],
2004 product_variables: {
2005 platform_sdk_version: {
2006 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2007 },
2008 },
2009 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002010
Colin Cross7d7b3682017-11-03 13:38:40 -07002011 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002012}
2013
Dan Willemsen208ae172015-09-16 16:33:27 -07002014cc_object {
2015 name: "crtbegin_so1",
2016 local_include_dirs: ["include"],
2017 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002018
Colin Cross7d7b3682017-11-03 13:38:40 -07002019 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002020}
2021
Dan Willemsen208ae172015-09-16 16:33:27 -07002022cc_object {
2023 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002024
Colin Cross7d7b3682017-11-03 13:38:40 -07002025 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002026 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002027 "crtbegin_so1",
2028 "crtbrand",
2029 ],
2030}
2031
Dan Willemsen208ae172015-09-16 16:33:27 -07002032cc_object {
2033 name: "crtend_so",
2034 local_include_dirs: ["include"],
2035 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002036
Colin Cross7d7b3682017-11-03 13:38:40 -07002037 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002038}
2039
Dan Willemsen208ae172015-09-16 16:33:27 -07002040cc_object {
2041 name: "crtbegin_static1",
2042 local_include_dirs: ["include"],
2043 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002044
Colin Cross50c21ab2015-10-31 23:03:05 -07002045 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002046 mips: {
2047 srcs: [
2048 "arch-mips/bionic/crtbegin.c",
2049 ],
2050 exclude_srcs: [
2051 "arch-common/bionic/crtbegin.c",
2052 ],
2053 },
2054 mips64: {
2055 srcs: [
2056 "arch-mips64/bionic/crtbegin.c",
2057 ],
2058 exclude_srcs: [
2059 "arch-common/bionic/crtbegin.c",
2060 ],
2061 },
2062 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002063
2064 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002065}
2066
Dan Willemsen208ae172015-09-16 16:33:27 -07002067cc_object {
2068 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002069
Colin Cross77d57bf2016-04-11 14:34:18 -07002070 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002071 "crtbegin_static1",
2072 "crtbrand",
2073 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002074 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002075}
2076
Dan Willemsen208ae172015-09-16 16:33:27 -07002077cc_object {
2078 name: "crtbegin_dynamic1",
2079 local_include_dirs: ["include"],
2080 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002081
Colin Cross50c21ab2015-10-31 23:03:05 -07002082 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002083 mips: {
2084 srcs: [
2085 "arch-mips/bionic/crtbegin.c",
2086 ],
2087 exclude_srcs: [
2088 "arch-common/bionic/crtbegin.c",
2089 ],
2090 },
2091 mips64: {
2092 srcs: [
2093 "arch-mips64/bionic/crtbegin.c",
2094 ],
2095 exclude_srcs: [
2096 "arch-common/bionic/crtbegin.c",
2097 ],
2098 },
2099 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002100 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002101}
2102
Dan Willemsen208ae172015-09-16 16:33:27 -07002103cc_object {
2104 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002105
Colin Cross77d57bf2016-04-11 14:34:18 -07002106 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002107 "crtbegin_dynamic1",
2108 "crtbrand",
2109 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002110 target: {
2111 linux_bionic: {
2112 generated_sources: ["host_bionic_linker_asm"],
2113 objs: [
2114 "linker_wrapper",
2115 ],
2116 },
2117 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002118 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002119}
2120
Dan Willemsen208ae172015-09-16 16:33:27 -07002121cc_object {
2122 // We rename crtend.o to crtend_android.o to avoid a
2123 // name clash between gcc and bionic.
2124 name: "crtend_android",
2125 local_include_dirs: ["include"],
2126 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002127
Colin Cross50c21ab2015-10-31 23:03:05 -07002128 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002129}
Colin Crossbaa48992016-07-13 11:15:21 -07002130
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002131// ========================================================
2132// NDK headers.
2133// ========================================================
2134
Dan Albert26e1c412018-05-24 14:56:46 -07002135versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002136 name: "common_libc",
2137 from: "include",
2138 to: "",
2139 license: "NOTICE",
2140}
Dan Albert4238a352016-06-28 11:18:05 -07002141
2142ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002143 name: "libc_uapi",
2144 from: "kernel/uapi",
2145 to: "",
2146 srcs: [
2147 "kernel/uapi/asm-generic/**/*.h",
2148 "kernel/uapi/drm/**/*.h",
2149 "kernel/uapi/linux/**/*.h",
2150 "kernel/uapi/misc/**/*.h",
2151 "kernel/uapi/mtd/**/*.h",
2152 "kernel/uapi/rdma/**/*.h",
2153 "kernel/uapi/scsi/**/*.h",
2154 "kernel/uapi/sound/**/*.h",
2155 "kernel/uapi/video/**/*.h",
2156 "kernel/uapi/xen/**/*.h",
2157 ],
Dan Albert92592652016-10-20 01:42:54 -07002158 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002159}
2160
2161ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002162 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002163 from: "kernel/android/uapi/linux",
2164 to: "linux",
2165 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002166 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002167}
2168
2169ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002170 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002171 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002172 to: "scsi",
2173 srcs: ["kernel/android/scsi/**/*.h"],
2174 license: "NOTICE",
2175}
2176
2177ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002178 name: "libc_asm_arm",
2179 from: "kernel/uapi/asm-arm",
2180 to: "arm-linux-androideabi",
2181 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002182 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002183}
2184
2185ndk_headers {
2186 name: "libc_asm_arm64",
2187 from: "kernel/uapi/asm-arm64",
2188 to: "aarch64-linux-android",
2189 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002190 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002191}
2192
Elliott Hughesee291c02017-12-11 11:32:34 -08002193// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002194ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002195 name: "libc_asm_mips",
2196 from: "kernel/uapi/asm-mips",
2197 to: "mipsel-linux-android",
2198 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2199 license: "NOTICE",
2200}
2201
Elliott Hughesee291c02017-12-11 11:32:34 -08002202// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002203ndk_headers {
2204 name: "libc_asm_mips64",
2205 from: "kernel/uapi/asm-mips",
2206 to: "mips64el-linux-android",
2207 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2208 license: "NOTICE",
2209}
2210
2211ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002212 name: "libc_asm_x86",
2213 from: "kernel/uapi/asm-x86",
2214 to: "i686-linux-android",
2215 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002216 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002217}
2218
2219ndk_headers {
2220 name: "libc_asm_x86_64",
2221 from: "kernel/uapi/asm-x86",
2222 to: "x86_64-linux-android",
2223 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002224 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002225}
2226
Dan Albert4238a352016-06-28 11:18:05 -07002227ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002228 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002229 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002230 symbol_file: "libc.map.txt",
2231 first_version: "9",
2232}
2233
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002234llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002235 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002236 symbol_file: "libc.map.txt",
2237 export_headers_as_system: true,
2238 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002239 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002240 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002241 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002242 "kernel/android/uapi",
2243 "kernel/uapi",
2244 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002245 arch: {
2246 arm: {
2247 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002248 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002249 ],
2250 },
2251 arm64: {
2252 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002253 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002254 ],
2255 },
2256 mips: {
2257 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002258 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002259 ],
2260 },
2261 mips64: {
2262 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002263 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002264 ],
2265 },
2266 x86: {
2267 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002268 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002269 ],
2270 },
2271 x86_64: {
2272 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002273 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002274 ],
2275 },
2276 },
2277}
2278
Dan Albertdf31aff2016-10-06 15:50:41 -07002279ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002280 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002281 symbol_file: "libstdc++.map.txt",
2282 first_version: "9",
2283}
2284
Dan Willemsenca056d72018-01-08 14:00:24 -08002285// Export these headers for toolbox to process
2286filegroup {
2287 name: "kernel_input_headers",
2288 srcs: [
2289 "kernel/uapi/linux/input.h",
2290 "kernel/uapi/linux/input-event-codes.h",
2291 ],
2292}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002293
2294// Generate a syscall name / number mapping. These objects are text files
2295// (thanks to the -dD -E flags) and not binary files. They will then be
2296// consumed by the genseccomp.py script and converted into C++ code.
2297cc_defaults {
2298 name: "libseccomp_gen_syscall_nrs_defaults",
2299 recovery_available: true,
2300 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2301 cflags: [
2302 "-dD",
2303 "-E",
2304 "-Wall",
2305 "-Werror",
2306 "-nostdinc",
2307 ],
2308}
2309
2310cc_object {
2311 name: "libseccomp_gen_syscall_nrs_arm",
2312 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2313 local_include_dirs: [
2314 "kernel/uapi/asm-arm",
2315 "kernel/uapi",
2316 ],
2317}
2318
2319cc_object {
2320 name: "libseccomp_gen_syscall_nrs_arm64",
2321 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2322 local_include_dirs: [
2323 "kernel/uapi/asm-arm64",
2324 "kernel/uapi",
2325 ],
2326}
2327
2328cc_object {
2329 name: "libseccomp_gen_syscall_nrs_x86",
2330 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2331 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2332 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2333 local_include_dirs: [
2334 "kernel/uapi/asm-x86",
2335 "kernel/uapi",
2336 ],
2337}
2338
2339cc_object {
2340 name: "libseccomp_gen_syscall_nrs_x86_64",
2341 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2342 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2343 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2344 local_include_dirs: [
2345 "kernel/uapi/asm-x86",
2346 "kernel/uapi",
2347 ],
2348}
2349
2350cc_object {
2351 name: "libseccomp_gen_syscall_nrs_mips",
2352 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2353 cflags: [
2354 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2355 ],
2356 local_include_dirs: [
2357 "kernel/uapi/asm-mips",
2358 "kernel/uapi",
2359 ],
2360}
2361
2362cc_object {
2363 name: "libseccomp_gen_syscall_nrs_mips64",
2364 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2365 cflags: [
2366 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2367 ],
2368 local_include_dirs: [
2369 "kernel/uapi/asm-mips",
2370 "kernel/uapi",
2371 ],
2372}
2373
Elliott Hughesae03b122019-09-17 16:37:05 -07002374// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002375python_binary_host {
2376 name: "genseccomp",
2377 main: "tools/genseccomp.py",
2378
2379 srcs: [
2380 "tools/genseccomp.py",
2381 "tools/gensyscalls.py",
2382 ],
2383
2384 data: [
2385 "kernel/uapi/**/*.h",
2386 ],
2387
2388 version: {
2389 py2: {
2390 enabled: true,
2391 },
2392 py3: {
2393 enabled: false,
2394 },
2395 },
2396}
2397
Martijn Coenen0c6de752019-01-02 12:52:51 +01002398python_binary_host {
2399 name: "genfunctosyscallnrs",
2400 main: "tools/genfunctosyscallnrs.py",
2401
2402 srcs: [
2403 "tools/genseccomp.py",
2404 "tools/genfunctosyscallnrs.py",
2405 "tools/gensyscalls.py",
2406 ],
2407
2408 data: [
2409 "kernel/uapi/**/*.h",
2410 ],
2411
2412 version: {
2413 py2: {
2414 enabled: true,
2415 },
2416 py3: {
2417 enabled: false,
2418 },
2419 },
2420}
2421
2422cc_genrule {
2423 name: "func_to_syscall_nrs",
2424 recovery_available: true,
2425 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2426
2427 tools: [ "genfunctosyscallnrs" ],
2428
2429 srcs: [
2430 "SYSCALLS.TXT",
2431 ":libseccomp_gen_syscall_nrs_arm",
2432 ":libseccomp_gen_syscall_nrs_arm64",
2433 ":libseccomp_gen_syscall_nrs_mips",
2434 ":libseccomp_gen_syscall_nrs_mips64",
2435 ":libseccomp_gen_syscall_nrs_x86",
2436 ":libseccomp_gen_syscall_nrs_x86_64",
2437 ],
2438
2439 out: [
2440 "func_to_syscall_nrs.h",
2441 ],
2442}
2443
Martijn Coenenc3752be2019-01-09 16:19:57 +01002444// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2445genrule {
2446 name: "generate_app_zygote_blacklist",
2447 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2448 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2449 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2450}
2451
2452cc_genrule {
2453 name: "libseccomp_policy_app_zygote_sources",
2454 recovery_available: true,
2455 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2456
2457 tools: [ "genseccomp" ],
2458
2459 srcs: [
2460 "SYSCALLS.TXT",
2461 "SECCOMP_WHITELIST_COMMON.TXT",
2462 "SECCOMP_WHITELIST_APP.TXT",
2463 "SECCOMP_BLACKLIST_COMMON.TXT",
2464 ":generate_app_zygote_blacklist",
2465 ":libseccomp_gen_syscall_nrs_arm",
2466 ":libseccomp_gen_syscall_nrs_arm64",
2467 ":libseccomp_gen_syscall_nrs_mips",
2468 ":libseccomp_gen_syscall_nrs_mips64",
2469 ":libseccomp_gen_syscall_nrs_x86",
2470 ":libseccomp_gen_syscall_nrs_x86_64",
2471 ],
2472
2473 out: [
2474 "arm64_app_zygote_policy.cpp",
2475 "arm_app_zygote_policy.cpp",
2476 "mips64_app_zygote_policy.cpp",
2477 "mips_app_zygote_policy.cpp",
2478 "x86_64_app_zygote_policy.cpp",
2479 "x86_app_zygote_policy.cpp",
2480 ],
2481}
2482
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002483cc_genrule {
2484 name: "libseccomp_policy_app_sources",
2485 recovery_available: true,
2486 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2487
2488 tools: [ "genseccomp" ],
2489
2490 srcs: [
2491 "SYSCALLS.TXT",
2492 "SECCOMP_WHITELIST_COMMON.TXT",
2493 "SECCOMP_WHITELIST_APP.TXT",
2494 "SECCOMP_BLACKLIST_COMMON.TXT",
2495 "SECCOMP_BLACKLIST_APP.TXT",
2496 ":libseccomp_gen_syscall_nrs_arm",
2497 ":libseccomp_gen_syscall_nrs_arm64",
2498 ":libseccomp_gen_syscall_nrs_mips",
2499 ":libseccomp_gen_syscall_nrs_mips64",
2500 ":libseccomp_gen_syscall_nrs_x86",
2501 ":libseccomp_gen_syscall_nrs_x86_64",
2502 ],
2503
2504 out: [
2505 "arm64_app_policy.cpp",
2506 "arm_app_policy.cpp",
2507 "mips64_app_policy.cpp",
2508 "mips_app_policy.cpp",
2509 "x86_64_app_policy.cpp",
2510 "x86_app_policy.cpp",
2511 ],
2512}
2513
2514cc_genrule {
2515 name: "libseccomp_policy_system_sources",
2516 recovery_available: true,
2517 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2518
2519 tools: [ "genseccomp" ],
2520
2521 srcs: [
2522 "SYSCALLS.TXT",
2523 "SECCOMP_WHITELIST_COMMON.TXT",
2524 "SECCOMP_WHITELIST_SYSTEM.TXT",
2525 "SECCOMP_BLACKLIST_COMMON.TXT",
2526 ":libseccomp_gen_syscall_nrs_arm",
2527 ":libseccomp_gen_syscall_nrs_arm64",
2528 ":libseccomp_gen_syscall_nrs_mips",
2529 ":libseccomp_gen_syscall_nrs_mips64",
2530 ":libseccomp_gen_syscall_nrs_x86",
2531 ":libseccomp_gen_syscall_nrs_x86_64",
2532 ],
2533
2534 out: [
2535 "arm64_system_policy.cpp",
2536 "arm_system_policy.cpp",
2537 "mips64_system_policy.cpp",
2538 "mips_system_policy.cpp",
2539 "x86_64_system_policy.cpp",
2540 "x86_system_policy.cpp",
2541 ],
2542}
2543
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002544cc_library {
2545 name: "libseccomp_policy",
2546 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002547 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002548 generated_sources: [
2549 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002550 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002551 "libseccomp_policy_system_sources",
2552 ],
2553
2554 srcs: [
2555 "seccomp/seccomp_policy.cpp",
2556 ],
2557
2558 export_include_dirs: ["seccomp/include"],
2559 cflags: [
2560 "-Wall",
2561 "-Werror",
2562 ],
2563 shared: {
2564 shared_libs: ["libbase"],
2565 },
2566 static: {
2567 static_libs: ["libbase"],
2568 },
2569}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002570
2571// This is a temporary library that will use scudo as the native memory
2572// allocator. To use it, add it as the first shared library.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002573cc_defaults {
2574 name: "libc_scudo_wrapper_defaults",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002575 srcs: [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08002576 "bionic/heap_tagging.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002577 "bionic/malloc_common.cpp",
2578 "bionic/malloc_common_dynamic.cpp",
2579 "bionic/malloc_heapprofd.cpp",
2580 "bionic/malloc_limit.cpp",
2581 "bionic/scudo_wrapper.cpp",
2582 "bionic/__set_errno.cpp",
2583 ],
2584 cflags: ["-DUSE_SCUDO"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002585 shared_libs: ["libscudo_wrapper"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002586
2587 header_libs: ["libc_headers"],
2588
2589 static_libs: ["libasync_safe"],
2590
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002591 arch: {
2592 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002593 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002594 },
2595 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002596 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002597 },
2598 x86: {
2599 srcs: [
2600 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002601 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002602 ],
2603 },
2604 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002605 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002606 },
2607 },
2608
2609 // Mark this library as global so it overrides all the allocation
2610 // definitions properly.
2611 ldflags: ["-Wl,-z,global"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002612}
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002613
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002614cc_library_shared {
2615 name: "libc_scudo",
Ytai Ben-tsvi5105ece2019-12-19 19:08:58 +00002616 defaults: ["libc_scudo_wrapper_defaults"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002617 vendor_available: true,
2618 stl: "none",
2619 system_shared_libs: [],
2620
2621 allow_undefined_symbols: true,
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002622 // Like libc, disable native coverage for libc_scudo.
2623 native_coverage: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002624}
2625
2626subdirs = [
2627 "bionic/scudo",
2628]