blob: 8284174bb18547299772f2d26f795bdc3eb9d0cb [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",
1616 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001617 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001618 "bionic/ndk_cruft.cpp",
1619 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001620 "bionic/NetdClient.cpp",
1621 "arch-common/bionic/crtend_so.S",
1622 ],
1623}
1624
1625filegroup {
1626 name: "libc_sources_static",
1627 srcs: [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001628 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001629 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001630 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001631 ],
1632}
1633
1634filegroup {
1635 name: "libc_sources_shared_arm",
1636 srcs: [
1637 "arch-arm/bionic/exidx_dynamic.c",
1638 "arch-arm/bionic/atexit_legacy.c",
1639 ],
1640}
1641
Dan Willemsen208ae172015-09-16 16:33:27 -07001642// ========================================================
1643// libc.a + libc.so
1644// ========================================================
1645cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001646 defaults: [
1647 "libc_defaults",
1648 "libc_native_allocator_defaults",
1649 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001650 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001651 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001652 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001653 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001654 platform_sdk_version: {
1655 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1656 },
1657 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001658 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001659 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001660 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001661 whole_static_libs: [
1662 "libc_init_static",
1663 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001664 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001665 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001666 },
1667 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001668 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001669 whole_static_libs: [
1670 "libc_init_dynamic",
1671 "libc_common_shared",
1672 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001673 },
1674
Neil Fullera7db90f2019-04-25 09:28:27 +01001675 required: [
1676 "tzdata",
1677 "tz_version", // Version metadata for tzdata to help debugging.
1678 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001679
Colin Cross4ce94d22016-11-15 13:15:43 -08001680 // Do not pack libc.so relocations; see http://b/20645321 for details.
1681 pack_relocations: false,
1682
dimitry06016f22018-01-05 11:39:28 +01001683 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1684 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1685 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1686 // those new libraries from libgcc.a are not declared external; if that were the case,
1687 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1688 // on the external symbols from the dependent libraries. That would create a "cloaked"
1689 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001690
dimitry06016f22018-01-05 11:39:28 +01001691 shared_libs: [
1692 "ld-android",
1693 "libdl",
1694 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001695 static_libs: [
1696 "libdl_android",
1697 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001698
1699 nocrt: true,
1700
Dan Willemsen208ae172015-09-16 16:33:27 -07001701 arch: {
1702 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001703 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001704 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001705 ldflags: ["-Wl,--hash-style=both"],
1706
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001707 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001708
Dan Willemsen208ae172015-09-16 16:33:27 -07001709 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001710 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001711 // special for arm
1712 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001713 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001714
1715 // Arm 32 bit does not produce complete exidx unwind information
1716 // so keep the .debug_frame which is relatively small and does
1717 // include needed unwind information.
1718 // See b/132992102 for details.
1719 strip: {
1720 keep_symbols_and_debug_frame: true,
1721 },
Peter Collingbourneb061e772019-11-12 14:26:21 -08001722
1723 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001724 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001725 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001726 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001727
1728 // Leave the symbols in the shared library so that stack unwinders can produce
1729 // meaningful name resolution.
1730 strip: {
1731 keep_symbols: true,
1732 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001733 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001734 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001735 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001736 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001737 ldflags: ["-Wl,--hash-style=both"],
1738
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001739 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001740
1741 // Leave the symbols in the shared library so that stack unwinders can produce
1742 // meaningful name resolution.
1743 strip: {
1744 keep_symbols: true,
1745 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001746 },
1747 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001748 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001749
1750 // Leave the symbols in the shared library so that stack unwinders can produce
1751 // meaningful name resolution.
1752 strip: {
1753 keep_symbols: true,
1754 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001755 },
1756 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001757
1758 stubs: {
1759 symbol_file: "libc.map.txt",
1760 versions: ["10000"],
1761 },
Vic Yang6903fb82019-01-14 11:34:39 -08001762
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001763 apex_available: [
1764 "//apex_available:platform",
1765 "com.android.runtime",
1766 ],
1767
Vic Yang03ff4362019-06-24 16:11:37 -07001768 // Sorting bss symbols by size usually results in less dirty pages at run
1769 // time, because small symbols are grouped together.
1770 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001771}
1772
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001773genrule {
1774 name: "libc.arm.map",
1775 out: ["libc.arm.map"],
1776 srcs: ["libc.map.txt"],
1777 tool_files: [":bionic-generate-version-script"],
1778 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1779}
1780
1781genrule {
1782 name: "libc.arm64.map",
1783 out: ["libc.arm64.map"],
1784 srcs: ["libc.map.txt"],
1785 tool_files: [":bionic-generate-version-script"],
1786 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1787}
1788
1789genrule {
1790 name: "libc.x86.map",
1791 out: ["libc.x86.map"],
1792 srcs: ["libc.map.txt"],
1793 tool_files: [":bionic-generate-version-script"],
1794 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1795}
1796
1797genrule {
1798 name: "libc.x86_64.map",
1799 out: ["libc.x86_64.map"],
1800 srcs: ["libc.map.txt"],
1801 tool_files: [":bionic-generate-version-script"],
1802 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1803}
1804
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001805// Headers that only other parts of the platform can include.
1806cc_library_headers {
1807 name: "bionic_libc_platform_headers",
1808 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001809 "//art:__subpackages__",
1810 "//bionic/libc:__subpackages__",
1811 "//frameworks:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001812 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001813 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001814 "//system/core/debuggerd:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001815 ],
1816 host_supported: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001817 recovery_available: true,
1818 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001819 export_include_dirs: [
1820 "platform",
1821 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001822 system_shared_libs: [],
1823 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001824 sdk_version: "current",
1825}
1826
Logan Chien17af91b2019-01-15 21:19:56 +08001827// libc_headers for libasync_safe and libpropertyinfoparser
1828cc_library_headers {
1829 name: "libc_headers",
1830
1831 host_supported: true,
1832 vendor_available: true,
1833 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001834 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001835
1836 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001837 stl: "none",
1838 system_shared_libs: [],
1839
1840 export_include_dirs: [
1841 "include",
1842 "kernel/uapi",
1843 "kernel/android/uapi",
1844 ],
1845
1846 arch: {
1847 arm: {
1848 export_include_dirs: [
1849 "kernel/uapi/asm-arm",
1850 ],
1851 },
1852 arm64: {
1853 export_include_dirs: [
1854 "kernel/uapi/asm-arm64",
1855 ],
1856 },
1857 mips: {
1858 export_include_dirs: [
1859 "kernel/uapi/asm-mips",
1860 ],
1861 },
1862 mips64: {
1863 export_include_dirs: [
1864 "kernel/uapi/asm-mips",
1865 ],
1866 },
1867 x86: {
1868 export_include_dirs: [
1869 "kernel/uapi/asm-x86",
1870 ],
1871 },
1872 x86_64: {
1873 export_include_dirs: [
1874 "kernel/uapi/asm-x86",
1875 ],
1876 },
1877 },
1878}
1879
Dan Willemsen208ae172015-09-16 16:33:27 -07001880// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001881// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001882// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001883
Dan Willemsen208ae172015-09-16 16:33:27 -07001884cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001885 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001886 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001887 srcs: [
1888 "bionic/__cxa_guard.cpp",
1889 "bionic/__cxa_pure_virtual.cpp",
1890 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001891 ],
1892 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001893 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001894 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001895
Dan Willemsen6b3be172018-12-03 13:57:20 -08001896 static: {
1897 system_shared_libs: [],
1898 },
1899 shared: {
1900 system_shared_libs: ["libc"],
1901 },
1902
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001903 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001904 arch: {
1905 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001906 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001907 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001908 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001909 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001910 },
1911 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001912 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001913 },
1914 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001915 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001916 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001917 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001918 },
1919 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001920 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001921 },
1922 },
1923}
1924
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001925genrule {
1926 name: "libstdc++.arm.map",
1927 out: ["libstdc++.arm.map"],
1928 srcs: ["libstdc++.map.txt"],
1929 tool_files: [":bionic-generate-version-script"],
1930 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1931}
1932
1933genrule {
1934 name: "libstdc++.arm64.map",
1935 out: ["libstdc++.arm64.map"],
1936 srcs: ["libstdc++.map.txt"],
1937 tool_files: [":bionic-generate-version-script"],
1938 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1939}
1940
1941genrule {
1942 name: "libstdc++.x86.map",
1943 out: ["libstdc++.x86.map"],
1944 srcs: ["libstdc++.map.txt"],
1945 tool_files: [":bionic-generate-version-script"],
1946 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1947}
1948
1949genrule {
1950 name: "libstdc++.x86_64.map",
1951 out: ["libstdc++.x86_64.map"],
1952 srcs: ["libstdc++.map.txt"],
1953 tool_files: [":bionic-generate-version-script"],
1954 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1955}
1956
1957// ========================================================
1958// crt object files.
1959// ========================================================
1960
Colin Cross50c21ab2015-10-31 23:03:05 -07001961cc_defaults {
1962 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001963 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001964 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001965 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001966 native_bridge_supported: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001967
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001968 cflags: [
1969 "-Wno-gcc-compat",
1970 "-Wall",
1971 "-Werror",
1972 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07001973 sanitize: {
1974 never: true,
1975 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001976}
1977
Colin Cross50c21ab2015-10-31 23:03:05 -07001978cc_defaults {
1979 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001980 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001981
1982 arch: {
1983 mips: {
1984 cflags: ["-fPIC"],
1985 },
1986 mips64: {
1987 cflags: ["-fPIC"],
1988 },
1989 x86: {
1990 cflags: ["-fPIC"],
1991 },
1992 x86_64: {
1993 cflags: ["-fPIC"],
1994 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001995 },
Colin Crossab179442018-09-27 11:03:22 -07001996 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001997}
1998
Dan Willemsen208ae172015-09-16 16:33:27 -07001999cc_object {
2000 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002001 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002002 local_include_dirs: ["include"],
2003 product_variables: {
2004 platform_sdk_version: {
2005 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2006 },
2007 },
2008 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002009
Colin Cross7d7b3682017-11-03 13:38:40 -07002010 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002011}
2012
Dan Willemsen208ae172015-09-16 16:33:27 -07002013cc_object {
2014 name: "crtbegin_so1",
2015 local_include_dirs: ["include"],
2016 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002017
Colin Cross7d7b3682017-11-03 13:38:40 -07002018 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002019}
2020
Dan Willemsen208ae172015-09-16 16:33:27 -07002021cc_object {
2022 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002023
Colin Cross7d7b3682017-11-03 13:38:40 -07002024 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002025 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002026 "crtbegin_so1",
2027 "crtbrand",
2028 ],
2029}
2030
Dan Willemsen208ae172015-09-16 16:33:27 -07002031cc_object {
2032 name: "crtend_so",
2033 local_include_dirs: ["include"],
2034 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002035
Colin Cross7d7b3682017-11-03 13:38:40 -07002036 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002037}
2038
Dan Willemsen208ae172015-09-16 16:33:27 -07002039cc_object {
2040 name: "crtbegin_static1",
2041 local_include_dirs: ["include"],
2042 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002043
Colin Cross50c21ab2015-10-31 23:03:05 -07002044 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002045 mips: {
2046 srcs: [
2047 "arch-mips/bionic/crtbegin.c",
2048 ],
2049 exclude_srcs: [
2050 "arch-common/bionic/crtbegin.c",
2051 ],
2052 },
2053 mips64: {
2054 srcs: [
2055 "arch-mips64/bionic/crtbegin.c",
2056 ],
2057 exclude_srcs: [
2058 "arch-common/bionic/crtbegin.c",
2059 ],
2060 },
2061 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002062
2063 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002064}
2065
Dan Willemsen208ae172015-09-16 16:33:27 -07002066cc_object {
2067 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002068
Colin Cross77d57bf2016-04-11 14:34:18 -07002069 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002070 "crtbegin_static1",
2071 "crtbrand",
2072 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002073 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002074}
2075
Dan Willemsen208ae172015-09-16 16:33:27 -07002076cc_object {
2077 name: "crtbegin_dynamic1",
2078 local_include_dirs: ["include"],
2079 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002080
Colin Cross50c21ab2015-10-31 23:03:05 -07002081 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002082 mips: {
2083 srcs: [
2084 "arch-mips/bionic/crtbegin.c",
2085 ],
2086 exclude_srcs: [
2087 "arch-common/bionic/crtbegin.c",
2088 ],
2089 },
2090 mips64: {
2091 srcs: [
2092 "arch-mips64/bionic/crtbegin.c",
2093 ],
2094 exclude_srcs: [
2095 "arch-common/bionic/crtbegin.c",
2096 ],
2097 },
2098 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002099 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002100}
2101
Dan Willemsen208ae172015-09-16 16:33:27 -07002102cc_object {
2103 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002104
Colin Cross77d57bf2016-04-11 14:34:18 -07002105 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002106 "crtbegin_dynamic1",
2107 "crtbrand",
2108 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002109 target: {
2110 linux_bionic: {
2111 generated_sources: ["host_bionic_linker_asm"],
2112 objs: [
2113 "linker_wrapper",
2114 ],
2115 },
2116 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002117 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002118}
2119
Dan Willemsen208ae172015-09-16 16:33:27 -07002120cc_object {
2121 // We rename crtend.o to crtend_android.o to avoid a
2122 // name clash between gcc and bionic.
2123 name: "crtend_android",
2124 local_include_dirs: ["include"],
2125 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002126
Colin Cross50c21ab2015-10-31 23:03:05 -07002127 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002128}
Colin Crossbaa48992016-07-13 11:15:21 -07002129
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002130// ========================================================
2131// NDK headers.
2132// ========================================================
2133
Dan Albert26e1c412018-05-24 14:56:46 -07002134versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002135 name: "common_libc",
2136 from: "include",
2137 to: "",
2138 license: "NOTICE",
2139}
Dan Albert4238a352016-06-28 11:18:05 -07002140
2141ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002142 name: "libc_uapi",
2143 from: "kernel/uapi",
2144 to: "",
2145 srcs: [
2146 "kernel/uapi/asm-generic/**/*.h",
2147 "kernel/uapi/drm/**/*.h",
2148 "kernel/uapi/linux/**/*.h",
2149 "kernel/uapi/misc/**/*.h",
2150 "kernel/uapi/mtd/**/*.h",
2151 "kernel/uapi/rdma/**/*.h",
2152 "kernel/uapi/scsi/**/*.h",
2153 "kernel/uapi/sound/**/*.h",
2154 "kernel/uapi/video/**/*.h",
2155 "kernel/uapi/xen/**/*.h",
2156 ],
Dan Albert92592652016-10-20 01:42:54 -07002157 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002158}
2159
2160ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002161 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002162 from: "kernel/android/uapi/linux",
2163 to: "linux",
2164 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002165 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002166}
2167
2168ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002169 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002170 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002171 to: "scsi",
2172 srcs: ["kernel/android/scsi/**/*.h"],
2173 license: "NOTICE",
2174}
2175
2176ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002177 name: "libc_asm_arm",
2178 from: "kernel/uapi/asm-arm",
2179 to: "arm-linux-androideabi",
2180 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002181 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002182}
2183
2184ndk_headers {
2185 name: "libc_asm_arm64",
2186 from: "kernel/uapi/asm-arm64",
2187 to: "aarch64-linux-android",
2188 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002189 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002190}
2191
Elliott Hughesee291c02017-12-11 11:32:34 -08002192// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002193ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002194 name: "libc_asm_mips",
2195 from: "kernel/uapi/asm-mips",
2196 to: "mipsel-linux-android",
2197 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2198 license: "NOTICE",
2199}
2200
Elliott Hughesee291c02017-12-11 11:32:34 -08002201// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002202ndk_headers {
2203 name: "libc_asm_mips64",
2204 from: "kernel/uapi/asm-mips",
2205 to: "mips64el-linux-android",
2206 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2207 license: "NOTICE",
2208}
2209
2210ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002211 name: "libc_asm_x86",
2212 from: "kernel/uapi/asm-x86",
2213 to: "i686-linux-android",
2214 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002215 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002216}
2217
2218ndk_headers {
2219 name: "libc_asm_x86_64",
2220 from: "kernel/uapi/asm-x86",
2221 to: "x86_64-linux-android",
2222 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002223 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002224}
2225
Dan Albert4238a352016-06-28 11:18:05 -07002226ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002227 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002228 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002229 symbol_file: "libc.map.txt",
2230 first_version: "9",
2231}
2232
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002233llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002234 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002235 symbol_file: "libc.map.txt",
2236 export_headers_as_system: true,
2237 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002238 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002239 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002240 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002241 "kernel/android/uapi",
2242 "kernel/uapi",
2243 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002244 arch: {
2245 arm: {
2246 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002247 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002248 ],
2249 },
2250 arm64: {
2251 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002252 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002253 ],
2254 },
2255 mips: {
2256 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002257 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002258 ],
2259 },
2260 mips64: {
2261 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002262 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002263 ],
2264 },
2265 x86: {
2266 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002267 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002268 ],
2269 },
2270 x86_64: {
2271 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002272 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002273 ],
2274 },
2275 },
2276}
2277
Dan Albertdf31aff2016-10-06 15:50:41 -07002278ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002279 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002280 symbol_file: "libstdc++.map.txt",
2281 first_version: "9",
2282}
2283
Dan Willemsenca056d72018-01-08 14:00:24 -08002284// Export these headers for toolbox to process
2285filegroup {
2286 name: "kernel_input_headers",
2287 srcs: [
2288 "kernel/uapi/linux/input.h",
2289 "kernel/uapi/linux/input-event-codes.h",
2290 ],
2291}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002292
2293// Generate a syscall name / number mapping. These objects are text files
2294// (thanks to the -dD -E flags) and not binary files. They will then be
2295// consumed by the genseccomp.py script and converted into C++ code.
2296cc_defaults {
2297 name: "libseccomp_gen_syscall_nrs_defaults",
2298 recovery_available: true,
2299 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2300 cflags: [
2301 "-dD",
2302 "-E",
2303 "-Wall",
2304 "-Werror",
2305 "-nostdinc",
2306 ],
2307}
2308
2309cc_object {
2310 name: "libseccomp_gen_syscall_nrs_arm",
2311 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2312 local_include_dirs: [
2313 "kernel/uapi/asm-arm",
2314 "kernel/uapi",
2315 ],
2316}
2317
2318cc_object {
2319 name: "libseccomp_gen_syscall_nrs_arm64",
2320 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2321 local_include_dirs: [
2322 "kernel/uapi/asm-arm64",
2323 "kernel/uapi",
2324 ],
2325}
2326
2327cc_object {
2328 name: "libseccomp_gen_syscall_nrs_x86",
2329 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2330 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2331 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2332 local_include_dirs: [
2333 "kernel/uapi/asm-x86",
2334 "kernel/uapi",
2335 ],
2336}
2337
2338cc_object {
2339 name: "libseccomp_gen_syscall_nrs_x86_64",
2340 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2341 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2342 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2343 local_include_dirs: [
2344 "kernel/uapi/asm-x86",
2345 "kernel/uapi",
2346 ],
2347}
2348
2349cc_object {
2350 name: "libseccomp_gen_syscall_nrs_mips",
2351 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2352 cflags: [
2353 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2354 ],
2355 local_include_dirs: [
2356 "kernel/uapi/asm-mips",
2357 "kernel/uapi",
2358 ],
2359}
2360
2361cc_object {
2362 name: "libseccomp_gen_syscall_nrs_mips64",
2363 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2364 cflags: [
2365 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2366 ],
2367 local_include_dirs: [
2368 "kernel/uapi/asm-mips",
2369 "kernel/uapi",
2370 ],
2371}
2372
Elliott Hughesae03b122019-09-17 16:37:05 -07002373// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002374python_binary_host {
2375 name: "genseccomp",
2376 main: "tools/genseccomp.py",
2377
2378 srcs: [
2379 "tools/genseccomp.py",
2380 "tools/gensyscalls.py",
2381 ],
2382
2383 data: [
2384 "kernel/uapi/**/*.h",
2385 ],
2386
2387 version: {
2388 py2: {
2389 enabled: true,
2390 },
2391 py3: {
2392 enabled: false,
2393 },
2394 },
2395}
2396
Martijn Coenen0c6de752019-01-02 12:52:51 +01002397python_binary_host {
2398 name: "genfunctosyscallnrs",
2399 main: "tools/genfunctosyscallnrs.py",
2400
2401 srcs: [
2402 "tools/genseccomp.py",
2403 "tools/genfunctosyscallnrs.py",
2404 "tools/gensyscalls.py",
2405 ],
2406
2407 data: [
2408 "kernel/uapi/**/*.h",
2409 ],
2410
2411 version: {
2412 py2: {
2413 enabled: true,
2414 },
2415 py3: {
2416 enabled: false,
2417 },
2418 },
2419}
2420
2421cc_genrule {
2422 name: "func_to_syscall_nrs",
2423 recovery_available: true,
2424 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2425
2426 tools: [ "genfunctosyscallnrs" ],
2427
2428 srcs: [
2429 "SYSCALLS.TXT",
2430 ":libseccomp_gen_syscall_nrs_arm",
2431 ":libseccomp_gen_syscall_nrs_arm64",
2432 ":libseccomp_gen_syscall_nrs_mips",
2433 ":libseccomp_gen_syscall_nrs_mips64",
2434 ":libseccomp_gen_syscall_nrs_x86",
2435 ":libseccomp_gen_syscall_nrs_x86_64",
2436 ],
2437
2438 out: [
2439 "func_to_syscall_nrs.h",
2440 ],
2441}
2442
Martijn Coenenc3752be2019-01-09 16:19:57 +01002443// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2444genrule {
2445 name: "generate_app_zygote_blacklist",
2446 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2447 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2448 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2449}
2450
2451cc_genrule {
2452 name: "libseccomp_policy_app_zygote_sources",
2453 recovery_available: true,
2454 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2455
2456 tools: [ "genseccomp" ],
2457
2458 srcs: [
2459 "SYSCALLS.TXT",
2460 "SECCOMP_WHITELIST_COMMON.TXT",
2461 "SECCOMP_WHITELIST_APP.TXT",
2462 "SECCOMP_BLACKLIST_COMMON.TXT",
2463 ":generate_app_zygote_blacklist",
2464 ":libseccomp_gen_syscall_nrs_arm",
2465 ":libseccomp_gen_syscall_nrs_arm64",
2466 ":libseccomp_gen_syscall_nrs_mips",
2467 ":libseccomp_gen_syscall_nrs_mips64",
2468 ":libseccomp_gen_syscall_nrs_x86",
2469 ":libseccomp_gen_syscall_nrs_x86_64",
2470 ],
2471
2472 out: [
2473 "arm64_app_zygote_policy.cpp",
2474 "arm_app_zygote_policy.cpp",
2475 "mips64_app_zygote_policy.cpp",
2476 "mips_app_zygote_policy.cpp",
2477 "x86_64_app_zygote_policy.cpp",
2478 "x86_app_zygote_policy.cpp",
2479 ],
2480}
2481
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002482cc_genrule {
2483 name: "libseccomp_policy_app_sources",
2484 recovery_available: true,
2485 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2486
2487 tools: [ "genseccomp" ],
2488
2489 srcs: [
2490 "SYSCALLS.TXT",
2491 "SECCOMP_WHITELIST_COMMON.TXT",
2492 "SECCOMP_WHITELIST_APP.TXT",
2493 "SECCOMP_BLACKLIST_COMMON.TXT",
2494 "SECCOMP_BLACKLIST_APP.TXT",
2495 ":libseccomp_gen_syscall_nrs_arm",
2496 ":libseccomp_gen_syscall_nrs_arm64",
2497 ":libseccomp_gen_syscall_nrs_mips",
2498 ":libseccomp_gen_syscall_nrs_mips64",
2499 ":libseccomp_gen_syscall_nrs_x86",
2500 ":libseccomp_gen_syscall_nrs_x86_64",
2501 ],
2502
2503 out: [
2504 "arm64_app_policy.cpp",
2505 "arm_app_policy.cpp",
2506 "mips64_app_policy.cpp",
2507 "mips_app_policy.cpp",
2508 "x86_64_app_policy.cpp",
2509 "x86_app_policy.cpp",
2510 ],
2511}
2512
2513cc_genrule {
2514 name: "libseccomp_policy_system_sources",
2515 recovery_available: true,
2516 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2517
2518 tools: [ "genseccomp" ],
2519
2520 srcs: [
2521 "SYSCALLS.TXT",
2522 "SECCOMP_WHITELIST_COMMON.TXT",
2523 "SECCOMP_WHITELIST_SYSTEM.TXT",
2524 "SECCOMP_BLACKLIST_COMMON.TXT",
2525 ":libseccomp_gen_syscall_nrs_arm",
2526 ":libseccomp_gen_syscall_nrs_arm64",
2527 ":libseccomp_gen_syscall_nrs_mips",
2528 ":libseccomp_gen_syscall_nrs_mips64",
2529 ":libseccomp_gen_syscall_nrs_x86",
2530 ":libseccomp_gen_syscall_nrs_x86_64",
2531 ],
2532
2533 out: [
2534 "arm64_system_policy.cpp",
2535 "arm_system_policy.cpp",
2536 "mips64_system_policy.cpp",
2537 "mips_system_policy.cpp",
2538 "x86_64_system_policy.cpp",
2539 "x86_system_policy.cpp",
2540 ],
2541}
2542
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002543cc_library {
2544 name: "libseccomp_policy",
2545 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002546 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002547 generated_sources: [
2548 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002549 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002550 "libseccomp_policy_system_sources",
2551 ],
2552
2553 srcs: [
2554 "seccomp/seccomp_policy.cpp",
2555 ],
2556
2557 export_include_dirs: ["seccomp/include"],
2558 cflags: [
2559 "-Wall",
2560 "-Werror",
2561 ],
2562 shared: {
2563 shared_libs: ["libbase"],
2564 },
2565 static: {
2566 static_libs: ["libbase"],
2567 },
2568}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002569
2570// This is a temporary library that will use scudo as the native memory
2571// allocator. To use it, add it as the first shared library.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002572cc_defaults {
2573 name: "libc_scudo_wrapper_defaults",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002574 srcs: [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08002575 "bionic/heap_tagging.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002576 "bionic/malloc_common.cpp",
2577 "bionic/malloc_common_dynamic.cpp",
2578 "bionic/malloc_heapprofd.cpp",
2579 "bionic/malloc_limit.cpp",
2580 "bionic/scudo_wrapper.cpp",
2581 "bionic/__set_errno.cpp",
2582 ],
2583 cflags: ["-DUSE_SCUDO"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002584 shared_libs: ["libscudo_wrapper"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002585
2586 header_libs: ["libc_headers"],
2587
2588 static_libs: ["libasync_safe"],
2589
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002590 arch: {
2591 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002592 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002593 },
2594 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002595 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002596 },
2597 x86: {
2598 srcs: [
2599 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002600 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002601 ],
2602 },
2603 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002604 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002605 },
2606 },
2607
2608 // Mark this library as global so it overrides all the allocation
2609 // definitions properly.
2610 ldflags: ["-Wl,-z,global"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002611}
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002612
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002613cc_library_shared {
2614 name: "libc_scudo",
Ytai Ben-tsvi5105ece2019-12-19 19:08:58 +00002615 defaults: ["libc_scudo_wrapper_defaults"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002616 vendor_available: true,
2617 stl: "none",
2618 system_shared_libs: [],
2619
2620 allow_undefined_symbols: true,
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002621 // Like libc, disable native coverage for libc_scudo.
2622 native_coverage: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002623}
2624
2625subdirs = [
2626 "bionic/scudo",
2627]