blob: 1cfcf2185583def23d003bfdadb4e6fd19a813d4 [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
Anna Trostanetski9981a1d2020-01-20 20:16:29 +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 ],
363
364 cflags: [
365 "-Wno-sign-compare",
366 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700367 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700368 ],
369
370 local_include_dirs: [
371 "upstream-freebsd/android/include",
372 ],
373
374 name: "libc_freebsd_large_stack",
375}
376
Dan Willemsen208ae172015-09-16 16:33:27 -0700377// ========================================================
378// libc_netbsd.a - upstream NetBSD C library code
379// ========================================================
380//
381// These files are built with the netbsd-compat.h header file
382// automatically included.
383
384cc_library_static {
385
Colin Cross50c21ab2015-10-31 23:03:05 -0700386 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700387 srcs: [
388 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700389 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700390 "upstream-netbsd/lib/libc/gen/psignal.c",
391 "upstream-netbsd/lib/libc/gen/utime.c",
392 "upstream-netbsd/lib/libc/gen/utmp.c",
393 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
394 "upstream-netbsd/lib/libc/regex/regcomp.c",
395 "upstream-netbsd/lib/libc/regex/regerror.c",
396 "upstream-netbsd/lib/libc/regex/regexec.c",
397 "upstream-netbsd/lib/libc/regex/regfree.c",
398 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700399 "upstream-netbsd/lib/libc/stdlib/drand48.c",
400 "upstream-netbsd/lib/libc/stdlib/erand48.c",
401 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
402 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700403 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
404 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
405 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
406 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
407 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
408 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
409 "upstream-netbsd/lib/libc/stdlib/seed48.c",
410 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700411 ],
412 multilib: {
413 lib32: {
414 // LP32 cruft
415 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
416 },
417 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700418 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700419 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800420 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700421 "-DPOSIX_MISTAKE",
422 "-include netbsd-compat.h",
423 ],
424
Dan Willemsen208ae172015-09-16 16:33:27 -0700425 local_include_dirs: [
426 "upstream-netbsd/android/include",
427 "upstream-netbsd/lib/libc/include",
428 ],
429
430 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700431}
432
433// ========================================================
434// libc_openbsd_ndk.a - upstream OpenBSD C library code
435// that can be safely included in the libc_ndk.a (doesn't
436// contain any troublesome global data or constructors).
437// ========================================================
438//
439// These files are built with the openbsd-compat.h header file
440// automatically included.
441
442cc_library_static {
443 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700444 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700445 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700446 "upstream-openbsd/lib/libc/gen/alarm.c",
447 "upstream-openbsd/lib/libc/gen/ctype_.c",
448 "upstream-openbsd/lib/libc/gen/daemon.c",
449 "upstream-openbsd/lib/libc/gen/err.c",
450 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700451 "upstream-openbsd/lib/libc/gen/fnmatch.c",
452 "upstream-openbsd/lib/libc/gen/ftok.c",
453 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700454 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700455 "upstream-openbsd/lib/libc/gen/verr.c",
456 "upstream-openbsd/lib/libc/gen/verrx.c",
457 "upstream-openbsd/lib/libc/gen/vwarn.c",
458 "upstream-openbsd/lib/libc/gen/vwarnx.c",
459 "upstream-openbsd/lib/libc/gen/warn.c",
460 "upstream-openbsd/lib/libc/gen/warnx.c",
461 "upstream-openbsd/lib/libc/locale/btowc.c",
462 "upstream-openbsd/lib/libc/locale/mbrlen.c",
463 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
464 "upstream-openbsd/lib/libc/locale/mbtowc.c",
465 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700466 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
467 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700468 "upstream-openbsd/lib/libc/locale/wcstoll.c",
469 "upstream-openbsd/lib/libc/locale/wcstombs.c",
470 "upstream-openbsd/lib/libc/locale/wcstoul.c",
471 "upstream-openbsd/lib/libc/locale/wcstoull.c",
472 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
473 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
474 "upstream-openbsd/lib/libc/locale/wctob.c",
475 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700476 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700477 "upstream-openbsd/lib/libc/net/htonl.c",
478 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700479 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
480 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
481 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700482 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
483 "upstream-openbsd/lib/libc/net/inet_ntop.c",
484 "upstream-openbsd/lib/libc/net/inet_pton.c",
485 "upstream-openbsd/lib/libc/net/ntohl.c",
486 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800487 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700488 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700489 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
490 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700491 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700492 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700493 "upstream-openbsd/lib/libc/stdio/fputwc.c",
494 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700495 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700496 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700497 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700498 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 "upstream-openbsd/lib/libc/stdio/makebuf.c",
500 "upstream-openbsd/lib/libc/stdio/mktemp.c",
501 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
502 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700503 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700504 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700505 "upstream-openbsd/lib/libc/stdio/tempnam.c",
506 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
507 "upstream-openbsd/lib/libc/stdio/ungetc.c",
508 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
509 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
510 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700511 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
512 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
513 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700514 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700515 "upstream-openbsd/lib/libc/stdio/wsetup.c",
516 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800517 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700518 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700519 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700520 "upstream-openbsd/lib/libc/stdlib/insque.c",
521 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
522 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
523 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800524 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700525 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800526 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700527 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700528 "upstream-openbsd/lib/libc/stdlib/remque.c",
529 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700530 "upstream-openbsd/lib/libc/stdlib/tfind.c",
531 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800532 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700533 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800534 "upstream-openbsd/lib/libc/string/strcasestr.c",
535 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700536 "upstream-openbsd/lib/libc/string/strcspn.c",
537 "upstream-openbsd/lib/libc/string/strdup.c",
538 "upstream-openbsd/lib/libc/string/strndup.c",
539 "upstream-openbsd/lib/libc/string/strpbrk.c",
540 "upstream-openbsd/lib/libc/string/strsep.c",
541 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700542 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800543 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700544 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/string/wcswidth.c",
546 ],
547
Colin Cross50c21ab2015-10-31 23:03:05 -0700548 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700549 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700550 "-Wno-unused-parameter",
551 "-include openbsd-compat.h",
552 ],
553
Dan Willemsen208ae172015-09-16 16:33:27 -0700554 local_include_dirs: [
555 "private",
556 "stdio",
557 "upstream-openbsd/android/include",
558 "upstream-openbsd/lib/libc/include",
559 "upstream-openbsd/lib/libc/gdtoa/",
560 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700561}
562
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700563cc_library_static {
564 name: "libc_openbsd_large_stack",
565 defaults: ["libc_defaults"],
566 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700567 "stdio/vfprintf.cpp",
568 "stdio/vfwprintf.cpp",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800569 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700570 ],
571 cflags: [
572 "-include openbsd-compat.h",
573 "-Wno-sign-compare",
574 "-Wframe-larger-than=5000",
575 ],
576
577 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700578 "upstream-openbsd/android/include/",
579 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700580 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700581 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700582 ],
583}
584
Dan Willemsen208ae172015-09-16 16:33:27 -0700585// ========================================================
586// libc_openbsd.a - upstream OpenBSD C library code
587// ========================================================
588//
589// These files are built with the openbsd-compat.h header file
590// automatically included.
591cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700592 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700593 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800594 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700595 "upstream-openbsd/lib/libc/crypt/arc4random.c",
596 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
597
598 // May be overriden by per-arch optimized versions
599 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700600 "upstream-openbsd/lib/libc/string/memrchr.c",
601 "upstream-openbsd/lib/libc/string/stpcpy.c",
602 "upstream-openbsd/lib/libc/string/stpncpy.c",
603 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700604 "upstream-openbsd/lib/libc/string/strcpy.c",
605 "upstream-openbsd/lib/libc/string/strlcat.c",
606 "upstream-openbsd/lib/libc/string/strlcpy.c",
607 "upstream-openbsd/lib/libc/string/strncat.c",
608 "upstream-openbsd/lib/libc/string/strncmp.c",
609 "upstream-openbsd/lib/libc/string/strncpy.c",
610 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700611
612 arch: {
613 arm: {
614 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700615 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800616 "upstream-openbsd/lib/libc/string/stpcpy.c",
617 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700618 ],
619 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700620 arm64: {
621 exclude_srcs: [
622 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700623 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700624 "upstream-openbsd/lib/libc/string/strcpy.c",
625 "upstream-openbsd/lib/libc/string/strncmp.c",
626 ],
627 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530628 mips: {
629 exclude_srcs: [
630 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530631 "upstream-openbsd/lib/libc/string/strcpy.c",
632 "upstream-openbsd/lib/libc/string/strncmp.c",
633 ],
634 },
635 mips64: {
636 exclude_srcs: [
637 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530638 "upstream-openbsd/lib/libc/string/strcpy.c",
639 "upstream-openbsd/lib/libc/string/strncmp.c",
640 ],
641 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700642 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800643 exclude_srcs: [
644 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800645 "upstream-openbsd/lib/libc/string/memrchr.c",
646 "upstream-openbsd/lib/libc/string/stpcpy.c",
647 "upstream-openbsd/lib/libc/string/stpncpy.c",
648 "upstream-openbsd/lib/libc/string/strcat.c",
649 "upstream-openbsd/lib/libc/string/strcpy.c",
650 "upstream-openbsd/lib/libc/string/strncmp.c",
651 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700652 "upstream-openbsd/lib/libc/string/strlcat.c",
653 "upstream-openbsd/lib/libc/string/strlcpy.c",
654 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800655 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700656 },
657
658 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800659 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800660 "upstream-openbsd/lib/libc/string/stpcpy.c",
661 "upstream-openbsd/lib/libc/string/stpncpy.c",
662 "upstream-openbsd/lib/libc/string/strcat.c",
663 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800664 "upstream-openbsd/lib/libc/string/strncat.c",
665 "upstream-openbsd/lib/libc/string/strncmp.c",
666 "upstream-openbsd/lib/libc/string/strncpy.c",
667 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700668 },
669 },
670
Colin Cross50c21ab2015-10-31 23:03:05 -0700671 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700672 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700673 "-Wno-unused-parameter",
674 "-include openbsd-compat.h",
675 ],
676
Dan Willemsen208ae172015-09-16 16:33:27 -0700677 local_include_dirs: [
678 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700679 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700680 ],
681
682 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700683}
684
685// ========================================================
686// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
687// ========================================================
688//
689// These files are built with the openbsd-compat.h header file
690// automatically included.
691
692cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700693 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700694 srcs: [
695 "upstream-openbsd/android/gdtoa_support.cpp",
696 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
697 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
698 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
699 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
700 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
701 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
702 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
703 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
704 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
705 "upstream-openbsd/lib/libc/gdtoa/misc.c",
706 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
707 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
708 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
709 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
710 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
711 "upstream-openbsd/lib/libc/gdtoa/sum.c",
712 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
713 ],
714 multilib: {
715 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800716 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700717 },
718 },
719
Colin Cross50c21ab2015-10-31 23:03:05 -0700720 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700721 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700722 "-include openbsd-compat.h",
723 ],
724
Dan Willemsen208ae172015-09-16 16:33:27 -0700725 local_include_dirs: [
726 "private",
727 "upstream-openbsd/android/include",
728 "upstream-openbsd/lib/libc/include",
729 ],
730
731 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700732}
733
734// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700735// libc_fortify.a - container for our FORITFY
736// implementation details
737// ========================================================
738cc_library_static {
739 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700740 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700741
742 name: "libc_fortify",
743
744 // Disable FORTIFY for the compilation of these, so we don't end up having
745 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800746 cflags: [
747 "-U_FORTIFY_SOURCE",
748 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
749 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700750
751 arch: {
752 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800753 cflags: [
754 "-DNO___MEMCPY_CHK",
755 "-DRENAME___STRCAT_CHK",
756 "-DRENAME___STRCPY_CHK",
757 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700758 srcs: [
759 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800760
761 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
762 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
763
764 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
765 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
766
767 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
768 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
769
770 "arch-arm/krait/bionic/__strcat_chk.S",
771 "arch-arm/krait/bionic/__strcpy_chk.S",
772
773 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
774 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
775
Haibo Huang01bfd892018-12-03 15:05:16 -0800776 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
777 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700778 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700779 },
780 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700781 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700782 srcs: [
783 "arch-arm64/generic/bionic/__memcpy_chk.S",
784 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700785 },
786 },
787}
788
789// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700790// libc_bionic.a - home-grown C library code
791// ========================================================
792
793cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700794 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700795 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800796 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700797 "bionic/sysconf.cpp",
798 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700799 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700800
Josh Gao10ec9282017-04-03 15:13:29 -0700801 // The following must not be statically linked into libc_ndk.a, because
802 // debuggerd will look for the abort message in libc.so's copy.
803 "bionic/android_set_abort_message.cpp",
804
Dan Willemsen208ae172015-09-16 16:33:27 -0700805 "bionic/strchr.cpp",
806 "bionic/strnlen.c",
807 "bionic/strrchr.cpp",
808 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700809
810 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700811 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700812 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700813 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800814 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700815 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800816 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800817 "arch-arm/generic/bionic/stpcpy.c",
818 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800819 "arch-arm/generic/bionic/strcmp.S",
820 "arch-arm/generic/bionic/strcpy.S",
821 "arch-arm/generic/bionic/strlen.c",
822
Ryan Prichard45024fe2018-12-30 21:10:26 -0800823 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700824 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700825 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700826 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700827 "arch-arm/bionic/atomics_arm.c",
828 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800829 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700830 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700831 "arch-arm/bionic/setjmp.S",
832 "arch-arm/bionic/syscall.S",
833 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800834
835 "arch-arm/cortex-a15/bionic/memcpy.S",
836 "arch-arm/cortex-a15/bionic/memmove.S",
837 "arch-arm/cortex-a15/bionic/memset.S",
838 "arch-arm/cortex-a15/bionic/stpcpy.S",
839 "arch-arm/cortex-a15/bionic/strcat.S",
840 "arch-arm/cortex-a15/bionic/strcmp.S",
841 "arch-arm/cortex-a15/bionic/strcpy.S",
842 "arch-arm/cortex-a15/bionic/strlen.S",
843
844 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800845 "arch-arm/cortex-a7/bionic/memset.S",
846
847 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800848 "arch-arm/cortex-a9/bionic/memset.S",
849 "arch-arm/cortex-a9/bionic/stpcpy.S",
850 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800851 "arch-arm/cortex-a9/bionic/strcpy.S",
852 "arch-arm/cortex-a9/bionic/strlen.S",
853
854 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800855 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800856
857 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800858
Haibo Huang01bfd892018-12-03 15:05:16 -0800859 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800860
861 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700862 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700863 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700864 arm64: {
865 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700866 "arch-arm64/generic/bionic/memcmp.S",
867 "arch-arm64/generic/bionic/memcpy.S",
868 "arch-arm64/generic/bionic/memmove.S",
869 "arch-arm64/generic/bionic/memset.S",
870 "arch-arm64/generic/bionic/stpcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700871 "arch-arm64/generic/bionic/strcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700872 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800873
Peter Collingbourne900d07d2019-10-28 13:11:00 -0700874 "arch-arm64/default/bionic/memchr.S",
875 "arch-arm64/default/bionic/strchr.S",
876 "arch-arm64/default/bionic/strcmp.S",
877 "arch-arm64/default/bionic/strlen.S",
878 "arch-arm64/default/bionic/strncmp.S",
879 "arch-arm64/default/bionic/strnlen.S",
880
881 "arch-arm64/mte/bionic/memchr.c",
882 "arch-arm64/mte/bionic/strchr.cpp",
883 "arch-arm64/mte/bionic/strcmp.c",
884 "arch-arm64/mte/bionic/strlen.c",
885 "arch-arm64/mte/bionic/strncmp.c",
886 "arch-arm64/mte/bionic/strnlen.c",
887
Dan Willemsen3e621712016-02-03 21:48:08 -0800888 "arch-arm64/bionic/__bionic_clone.S",
889 "arch-arm64/bionic/_exit_with_stack_teardown.S",
890 "arch-arm64/bionic/setjmp.S",
891 "arch-arm64/bionic/syscall.S",
892 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700893 ],
894 exclude_srcs: [
895 "bionic/__memcpy_chk.cpp",
896 "bionic/strchr.cpp",
897 "bionic/strnlen.c",
898 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700899 },
900
901 mips: {
902 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800903 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530904 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800905 "arch-mips/string/memset.S",
906 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530907 "arch-mips/string/strncmp.S",
908 "arch-mips/string/strlen.c",
909 "arch-mips/string/strnlen.c",
910 "arch-mips/string/strchr.c",
911 "arch-mips/string/strcpy.c",
912 "arch-mips/string/memchr.c",
913 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800914
Dan Willemsen208ae172015-09-16 16:33:27 -0700915 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700916 "arch-mips/bionic/cacheflush.cpp",
917 "arch-mips/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800918 "arch-mips/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700919 "arch-mips/bionic/setjmp.S",
920 "arch-mips/bionic/syscall.S",
921 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700922 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530923 exclude_srcs: [
924 "bionic/strchr.cpp",
925 "bionic/strnlen.c",
926 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700927 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700928 mips64: {
929 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800930 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530931 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800932 "arch-mips/string/memset.S",
933 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530934 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800935 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530936 "arch-mips/string/strnlen.c",
937 "arch-mips/string/strchr.c",
938 "arch-mips/string/strcpy.c",
939 "arch-mips/string/memchr.c",
940 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800941
Dan Willemsen208ae172015-09-16 16:33:27 -0700942 "arch-mips64/bionic/__bionic_clone.S",
943 "arch-mips64/bionic/_exit_with_stack_teardown.S",
944 "arch-mips64/bionic/setjmp.S",
945 "arch-mips64/bionic/syscall.S",
946 "arch-mips64/bionic/vfork.S",
947 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700948 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530949 exclude_srcs: [
950 "bionic/strchr.cpp",
951 "bionic/strnlen.c",
952 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700953 },
954
955 x86: {
956 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700957 "arch-x86/generic/string/memcmp.S",
958 "arch-x86/generic/string/strcmp.S",
959 "arch-x86/generic/string/strncmp.S",
960 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700961
962 "arch-x86/generic/string/strlcat.c",
963 "arch-x86/generic/string/strlcpy.c",
964 "arch-x86/generic/string/strncat.c",
965 "arch-x86/generic/string/wcscat.c",
966 "arch-x86/generic/string/wcscpy.c",
967 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530968 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700969
Dan Willemsen208ae172015-09-16 16:33:27 -0700970 "arch-x86/atom/string/sse2-memchr-atom.S",
971 "arch-x86/atom/string/sse2-memrchr-atom.S",
972 "arch-x86/atom/string/sse2-strchr-atom.S",
973 "arch-x86/atom/string/sse2-strnlen-atom.S",
974 "arch-x86/atom/string/sse2-strrchr-atom.S",
975 "arch-x86/atom/string/sse2-wcschr-atom.S",
976 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
977 "arch-x86/atom/string/sse2-wcslen-atom.S",
978 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700979 "arch-x86/silvermont/string/sse2-memmove-slm.S",
980 "arch-x86/silvermont/string/sse2-memset-slm.S",
981 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
982 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
983 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
984 "arch-x86/silvermont/string/sse2-strlen-slm.S",
985 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800986
987 "arch-x86/bionic/__bionic_clone.S",
988 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800989 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800990 "arch-x86/bionic/__restore.S",
991 "arch-x86/bionic/setjmp.S",
992 "arch-x86/bionic/syscall.S",
993 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700994
995 // ssse3 functions
996 "arch-x86/atom/string/ssse3-strcat-atom.S",
997 "arch-x86/atom/string/ssse3-strcmp-atom.S",
998 "arch-x86/atom/string/ssse3-strlcat-atom.S",
999 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
1000 "arch-x86/atom/string/ssse3-strncat-atom.S",
1001 "arch-x86/atom/string/ssse3-strncmp-atom.S",
1002 "arch-x86/atom/string/ssse3-wcscat-atom.S",
1003 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
1004
1005 // sse4 functions
1006 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
1007 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
1008
1009 // atom functions
1010 "arch-x86/atom/string/sse2-memset-atom.S",
1011 "arch-x86/atom/string/sse2-strlen-atom.S",
1012 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -08001013 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001014 "arch-x86/atom/string/ssse3-strcpy-atom.S",
1015 "arch-x86/atom/string/ssse3-strncpy-atom.S",
1016 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +05301017
1018 // avx2 functions
1019 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001020 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001021
1022 exclude_srcs: [
1023 "bionic/strchr.cpp",
1024 "bionic/strnlen.c",
1025 "bionic/strrchr.cpp",
1026 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001027 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001028 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001029 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001030 "arch-x86_64/string/sse2-memmove-slm.S",
1031 "arch-x86_64/string/sse2-memset-slm.S",
1032 "arch-x86_64/string/sse2-stpcpy-slm.S",
1033 "arch-x86_64/string/sse2-stpncpy-slm.S",
1034 "arch-x86_64/string/sse2-strcat-slm.S",
1035 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001036 "arch-x86_64/string/sse2-strlen-slm.S",
1037 "arch-x86_64/string/sse2-strncat-slm.S",
1038 "arch-x86_64/string/sse2-strncpy-slm.S",
1039 "arch-x86_64/string/sse4-memcmp-slm.S",
1040 "arch-x86_64/string/ssse3-strcmp-slm.S",
1041 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +05301042 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001043
1044 "arch-x86_64/bionic/__bionic_clone.S",
1045 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1046 "arch-x86_64/bionic/__restore_rt.S",
1047 "arch-x86_64/bionic/setjmp.S",
1048 "arch-x86_64/bionic/syscall.S",
1049 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001050 ],
1051 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001052 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001053
Colin Cross50c21ab2015-10-31 23:03:05 -07001054 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001055 include_dirs: ["bionic/libstdc++/include"],
1056 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001057}
1058
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001059genrule {
1060 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001061 out: ["generated_android_ids.h"],
1062 srcs: [":android_filesystem_config_header"],
1063 tool_files: ["fs_config_generator.py"],
1064 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001065}
1066
Dan Willemsen268a6732015-10-15 14:49:45 -07001067// ========================================================
1068// libc_bionic_ndk.a- The portions of libc_bionic that can
1069// be safely used in libc_ndk.a (no troublesome global data
1070// or constructors).
1071// ========================================================
1072cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001073 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001074 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001075 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001076 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001077 "bionic/__cmsg_nxthdr.cpp",
1078 "bionic/__errno.cpp",
1079 "bionic/__gnu_basename.cpp",
1080 "bionic/__libc_current_sigrtmax.cpp",
1081 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001082 "bionic/abort.cpp",
1083 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001084 "bionic/access.cpp",
1085 "bionic/arpa_inet.cpp",
1086 "bionic/assert.cpp",
1087 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001088 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001089 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001090 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001091 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001092 "bionic/bionic_systrace.cpp",
1093 "bionic/bionic_time_conversions.cpp",
1094 "bionic/brk.cpp",
1095 "bionic/c16rtomb.cpp",
1096 "bionic/c32rtomb.cpp",
1097 "bionic/chmod.cpp",
1098 "bionic/chown.cpp",
1099 "bionic/clearenv.cpp",
1100 "bionic/clock.cpp",
1101 "bionic/clock_getcpuclockid.cpp",
1102 "bionic/clock_nanosleep.cpp",
1103 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001104 "bionic/ctype.cpp",
1105 "bionic/dirent.cpp",
Josh Gaob7eccd42019-11-06 13:15:00 -08001106 "bionic/dup.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001107 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001108 "bionic/error.cpp",
1109 "bionic/eventfd_read.cpp",
1110 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001111 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001112 "bionic/faccessat.cpp",
1113 "bionic/fchmod.cpp",
1114 "bionic/fchmodat.cpp",
Josh Gaob7eccd42019-11-06 13:15:00 -08001115 "bionic/fcntl.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001116 "bionic/fdsan.cpp",
Josh Gaob7eccd42019-11-06 13:15:00 -08001117 "bionic/fdtrack.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001118 "bionic/ffs.cpp",
1119 "bionic/fgetxattr.cpp",
1120 "bionic/flistxattr.cpp",
1121 "bionic/flockfile.cpp",
1122 "bionic/fpclassify.cpp",
1123 "bionic/fsetxattr.cpp",
1124 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001125 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001126 "bionic/futimens.cpp",
1127 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001128 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001129 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001130 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001131 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001132 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001133 "bionic/getpgrp.cpp",
1134 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001135 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001136 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001137 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001138 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001139 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001140 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001141 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001142 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001143 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001144 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001145 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001146 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001147 "bionic/lchown.cpp",
1148 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001149 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001150 "bionic/libgen.cpp",
1151 "bionic/link.cpp",
1152 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001153 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001154 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001155 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001156 "bionic/mbrtoc16.cpp",
1157 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001158 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001159 "bionic/mempcpy.cpp",
1160 "bionic/mkdir.cpp",
1161 "bionic/mkfifo.cpp",
1162 "bionic/mknod.cpp",
1163 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001164 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001165 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001166 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001167 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001168 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001169 "bionic/open.cpp",
1170 "bionic/pathconf.cpp",
1171 "bionic/pause.cpp",
1172 "bionic/pipe.cpp",
1173 "bionic/poll.cpp",
1174 "bionic/posix_fadvise.cpp",
1175 "bionic/posix_fallocate.cpp",
1176 "bionic/posix_madvise.cpp",
1177 "bionic/posix_timers.cpp",
1178 "bionic/ptrace.cpp",
1179 "bionic/pty.cpp",
1180 "bionic/raise.cpp",
1181 "bionic/rand.cpp",
1182 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001183 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001184 "bionic/reboot.cpp",
1185 "bionic/recv.cpp",
Josh Gaob7eccd42019-11-06 13:15:00 -08001186 "bionic/recvmsg.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001187 "bionic/rename.cpp",
1188 "bionic/rmdir.cpp",
1189 "bionic/scandir.cpp",
1190 "bionic/sched_getaffinity.cpp",
1191 "bionic/sched_getcpu.cpp",
1192 "bionic/semaphore.cpp",
1193 "bionic/send.cpp",
1194 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001195 "bionic/seteuid.cpp",
1196 "bionic/setpgrp.cpp",
1197 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001198 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001199 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001200 "bionic/sleep.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001201 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001202 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001203 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001204 "bionic/strchrnul.cpp",
1205 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001206 "bionic/string_l.cpp",
1207 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001208 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001209 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001210 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001211 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001212 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001213 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001214 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001215 "bionic/sys_msg.cpp",
1216 "bionic/sys_sem.cpp",
1217 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001218 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001219 "bionic/sys_statfs.cpp",
1220 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001221 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001222 "bionic/sysinfo.cpp",
1223 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001224 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001225 "bionic/system_property_api.cpp",
1226 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001227 "bionic/tdestroy.cpp",
1228 "bionic/termios.cpp",
1229 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001230 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001231 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001232 "bionic/tmpfile.cpp",
1233 "bionic/umount.cpp",
1234 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001235 "bionic/usleep.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001236 "bionic/wait.cpp",
1237 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001238 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001239 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001240 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001241 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001242 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001243
1244 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1245 // which will be overridden by the actual one in libc.so.
1246 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001247 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001248
Dan Willemsen208ae172015-09-16 16:33:27 -07001249 multilib: {
1250 lib32: {
1251 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001252 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001253 },
1254 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001255 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001256 treble_linker_namespaces: {
1257 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001258 },
1259 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001260 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001261 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001262 local_include_dirs: ["stdio"],
1263 include_dirs: ["bionic/libstdc++/include"],
1264 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001265 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001266}
1267
Dan Willemsen208ae172015-09-16 16:33:27 -07001268// ========================================================
1269// libc_pthread.a - pthreads parts that previously lived in
1270// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001271// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001272// pthread_t has changed over the years and has ABI
1273// compatibility issues).
1274// ========================================================
1275
1276cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001277 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001278 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001279 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001280 "bionic/pthread_atfork.cpp",
1281 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001282 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001283 "bionic/pthread_cond.cpp",
1284 "bionic/pthread_create.cpp",
1285 "bionic/pthread_detach.cpp",
1286 "bionic/pthread_equal.cpp",
1287 "bionic/pthread_exit.cpp",
1288 "bionic/pthread_getcpuclockid.cpp",
1289 "bionic/pthread_getschedparam.cpp",
1290 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001291 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001292 "bionic/pthread_join.cpp",
1293 "bionic/pthread_key.cpp",
1294 "bionic/pthread_kill.cpp",
1295 "bionic/pthread_mutex.cpp",
1296 "bionic/pthread_once.cpp",
1297 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001298 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001299 "bionic/pthread_self.cpp",
1300 "bionic/pthread_setname_np.cpp",
1301 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001302 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001303
1304 // The following implementations depend on pthread data or implementation,
1305 // so we can't include them in libc_ndk.a.
1306 "bionic/__cxa_thread_atexit_impl.cpp",
1307 "stdlib/atexit.c",
1308 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001309 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001310
Colin Cross50c21ab2015-10-31 23:03:05 -07001311 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001312 include_dirs: ["bionic/libstdc++/include"],
1313 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001314}
1315
1316// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001317// libc_syscalls.a
1318// ========================================================
1319
Elliott Hughes782c4852019-04-16 12:31:00 -07001320genrule {
1321 name: "syscalls-arm.S",
1322 out: ["syscalls-arm.S"],
1323 srcs: ["SYSCALLS.TXT"],
1324 tool_files: [":bionic-gensyscalls"],
1325 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1326}
1327
1328genrule {
1329 name: "syscalls-arm64.S",
1330 out: ["syscalls-arm64.S"],
1331 srcs: ["SYSCALLS.TXT"],
1332 tool_files: [":bionic-gensyscalls"],
1333 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1334}
1335
1336genrule {
1337 name: "syscalls-x86.S",
1338 out: ["syscalls-x86.S"],
1339 srcs: ["SYSCALLS.TXT"],
1340 tool_files: [":bionic-gensyscalls"],
1341 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1342}
1343
1344genrule {
1345 name: "syscalls-x86_64.S",
1346 out: ["syscalls-x86_64.S"],
1347 srcs: ["SYSCALLS.TXT"],
1348 tool_files: [":bionic-gensyscalls"],
1349 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1350}
1351
Dan Willemsen208ae172015-09-16 16:33:27 -07001352cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001353 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001354 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001355 arch: {
1356 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001357 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001358 },
1359 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001360 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001361 },
1362 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001363 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001364 },
1365 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001366 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001367 },
1368 },
1369 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001370}
1371
1372// ========================================================
1373// libc_aeabi.a
1374// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1375// to avoid infinite recursion. For the other architectures we just build an
1376// empty library to keep this makefile simple.
1377// ========================================================
1378
1379cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001380 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001381 arch: {
1382 arm: {
1383 srcs: ["arch-arm/bionic/__aeabi.c"],
1384 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001385 },
1386 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001387 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001388}
1389
1390// ========================================================
1391// libc_ndk.a
1392// Compatibility library for the NDK. This library contains
1393// all the parts of libc that are safe to statically link.
1394// We can't safely statically link things that can only run
1395// on a certain version of the OS. Examples include
1396// anything that talks to netd (a large portion of the DNS
1397// code) and anything that is dependent on the layout of a
1398// data structure that has changed across releases (such as
1399// pthread_t).
1400// ========================================================
1401
1402cc_library_static {
1403 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001404 defaults: [
1405 "libc_defaults",
1406 "libc_native_allocator_defaults",
1407 ],
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001408 srcs: libc_common_src_files + [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001409 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001410 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001411 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001412 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001413 multilib: {
1414 lib32: {
1415 srcs: libc_common_src_files_32,
1416 },
1417 },
1418 arch: {
1419 arm: {
1420 srcs: [
1421 "arch-arm/bionic/exidx_dynamic.c",
1422 "arch-common/bionic/crtbegin_so.c",
1423 "arch-arm/bionic/atexit_legacy.c",
1424 "arch-common/bionic/crtend_so.S",
1425 ],
1426 whole_static_libs: ["libc_aeabi"],
1427 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001428 },
1429
Colin Cross50c21ab2015-10-31 23:03:05 -07001430 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001431 "-fvisibility=hidden",
1432 "-DLIBC_STATIC",
1433 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001434
1435 whole_static_libs: [
1436 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001437 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001438 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001439 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001440 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001441 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001442 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001443 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001444 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001445 "libc_syscalls",
1446 "libc_tzcode",
1447 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001448 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001449 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001450}
1451
1452// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001453// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001454// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001455cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001456 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001457 srcs: libc_common_src_files,
1458 multilib: {
1459 lib32: {
1460 srcs: libc_common_src_files_32,
1461 },
1462 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001463 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001464
1465 whole_static_libs: [
1466 "libc_bionic",
1467 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001468 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001469 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001470 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001471 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001472 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001473 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001474 "libc_netbsd",
1475 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001476 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001477 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001478 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001479 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001480 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001481 ],
1482
1483 arch: {
1484 arm: {
1485 whole_static_libs: ["libc_aeabi"],
1486 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001487 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001488}
1489
1490// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001491// libc_common.a
1492// ========================================================
1493
1494cc_library_static {
1495 defaults: ["libc_defaults"],
1496 name: "libc_common",
1497
1498 whole_static_libs: [
1499 "libc_nopthread",
1500 "libc_pthread",
1501 ],
1502}
1503
1504// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001505// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001506// ========================================================
1507cc_library_static {
1508 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001509 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001510
Haibo Huangb9244ff2018-08-11 10:12:13 -07001511 arch: {
1512 x86: {
1513 srcs: ["arch-x86/static_function_dispatch.S"],
1514 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001515 arm: {
1516 srcs: ["arch-arm/static_function_dispatch.S"],
1517 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001518 arm64: {
1519 srcs: ["arch-arm64/static_function_dispatch.S"],
1520 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001521 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001522}
1523
1524// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001525// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001526// ========================================================
1527cc_library_static {
1528 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001529 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001530
Haibo Huangb9244ff2018-08-11 10:12:13 -07001531 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001532 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001533 "-fno-stack-protector",
1534 "-fno-jump-tables",
1535 ],
1536 arch: {
1537 x86: {
1538 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1539 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001540 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001541 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001542 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001543 arm64: {
1544 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1545 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001546 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001547}
1548
1549// ========================================================
1550// libc_common_static.a For static binaries.
1551// ========================================================
1552cc_library_static {
1553 defaults: ["libc_defaults"],
1554 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001555
Haibo Huangf71edfa2018-11-12 10:06:56 -08001556 whole_static_libs: [
1557 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001558 "libc_static_dispatch",
1559 ],
1560}
1561
1562// ========================================================
1563// libc_common_shared.a For shared libraries.
1564// ========================================================
1565cc_library_static {
1566 defaults: ["libc_defaults"],
1567 name: "libc_common_shared",
1568
1569 whole_static_libs: [
1570 "libc_common",
1571 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001572 ],
1573}
1574
Ryan Prichard22a6a052019-10-10 23:59:30 -07001575// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1576// executable.
1577cc_library_static {
1578 name: "libc_unwind_static",
1579 defaults: ["libc_defaults"],
1580 cflags: ["-DLIBC_STATIC"],
1581
1582 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1583 arch: {
1584 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1585 arm: {
1586 srcs: ["arch-arm/bionic/exidx_static.c"],
1587 },
1588 },
1589}
1590
Haibo Huangf71edfa2018-11-12 10:06:56 -08001591// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001592// libc_nomalloc.a
1593// ========================================================
1594//
Ryan Prichard249757b2019-11-01 17:18:28 -07001595// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1596// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1597// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001598
1599cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001600 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001601 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001602
Colin Crossa3f9fca2016-01-11 13:20:55 -08001603 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001604 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001605 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001606 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001607 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001608}
1609
dimitryc0c0ef62018-12-05 16:33:52 +01001610filegroup {
1611 name: "libc_sources_shared",
1612 srcs: [
1613 "arch-common/bionic/crtbegin_so.c",
1614 "arch-common/bionic/crtbrand.S",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001615 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001616 "bionic/icu.cpp",
1617 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001618 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001619 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001620 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001621 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001622 "bionic/ndk_cruft.cpp",
1623 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001624 "bionic/NetdClient.cpp",
1625 "arch-common/bionic/crtend_so.S",
1626 ],
1627}
1628
1629filegroup {
1630 name: "libc_sources_static",
1631 srcs: [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001632 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001633 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001634 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001635 ],
1636}
1637
1638filegroup {
1639 name: "libc_sources_shared_arm",
1640 srcs: [
1641 "arch-arm/bionic/exidx_dynamic.c",
1642 "arch-arm/bionic/atexit_legacy.c",
1643 ],
1644}
1645
Dan Willemsen208ae172015-09-16 16:33:27 -07001646// ========================================================
1647// libc.a + libc.so
1648// ========================================================
1649cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001650 defaults: [
1651 "libc_defaults",
1652 "libc_native_allocator_defaults",
1653 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001654 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001655 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001656 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001657 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001658 platform_sdk_version: {
1659 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1660 },
1661 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001662 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001663 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001664 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001665 whole_static_libs: [
1666 "libc_init_static",
1667 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001668 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001669 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001670 },
1671 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001672 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001673 whole_static_libs: [
1674 "libc_init_dynamic",
1675 "libc_common_shared",
1676 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001677 },
1678
Neil Fullera7db90f2019-04-25 09:28:27 +01001679 required: [
1680 "tzdata",
1681 "tz_version", // Version metadata for tzdata to help debugging.
1682 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001683
Colin Cross4ce94d22016-11-15 13:15:43 -08001684 // Do not pack libc.so relocations; see http://b/20645321 for details.
1685 pack_relocations: false,
1686
dimitry06016f22018-01-05 11:39:28 +01001687 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1688 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1689 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1690 // those new libraries from libgcc.a are not declared external; if that were the case,
1691 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1692 // on the external symbols from the dependent libraries. That would create a "cloaked"
1693 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001694
dimitry06016f22018-01-05 11:39:28 +01001695 shared_libs: [
1696 "ld-android",
1697 "libdl",
1698 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001699 static_libs: [
1700 "libdl_android",
1701 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001702
1703 nocrt: true,
1704
Dan Willemsen208ae172015-09-16 16:33:27 -07001705 arch: {
1706 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001707 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001708 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001709 ldflags: ["-Wl,--hash-style=both"],
1710
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001711 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001712
Dan Willemsen208ae172015-09-16 16:33:27 -07001713 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001714 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001715 // special for arm
1716 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001717 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001718
1719 // Arm 32 bit does not produce complete exidx unwind information
1720 // so keep the .debug_frame which is relatively small and does
1721 // include needed unwind information.
1722 // See b/132992102 for details.
1723 strip: {
1724 keep_symbols_and_debug_frame: true,
1725 },
Peter Collingbourneb061e772019-11-12 14:26:21 -08001726
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001727 whole_static_libs: [ "libunwind_llvm" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001728 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001729 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001730 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001731
1732 // Leave the symbols in the shared library so that stack unwinders can produce
1733 // meaningful name resolution.
1734 strip: {
1735 keep_symbols: true,
1736 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001737
1738 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001739 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001740 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001741 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001742 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001743 ldflags: ["-Wl,--hash-style=both"],
1744
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001745 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001746
1747 // Leave the symbols in the shared library so that stack unwinders can produce
1748 // meaningful name resolution.
1749 strip: {
1750 keep_symbols: true,
1751 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001752
1753 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001754 },
1755 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001756 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001757
1758 // Leave the symbols in the shared library so that stack unwinders can produce
1759 // meaningful name resolution.
1760 strip: {
1761 keep_symbols: true,
1762 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001763
1764 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001765 },
1766 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001767
1768 stubs: {
1769 symbol_file: "libc.map.txt",
1770 versions: ["10000"],
1771 },
Vic Yang6903fb82019-01-14 11:34:39 -08001772
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001773 apex_available: [
1774 "//apex_available:platform",
1775 "com.android.runtime",
1776 ],
1777
Vic Yang03ff4362019-06-24 16:11:37 -07001778 // Sorting bss symbols by size usually results in less dirty pages at run
1779 // time, because small symbols are grouped together.
1780 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001781}
1782
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001783genrule {
1784 name: "libc.arm.map",
1785 out: ["libc.arm.map"],
1786 srcs: ["libc.map.txt"],
1787 tool_files: [":bionic-generate-version-script"],
1788 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1789}
1790
1791genrule {
1792 name: "libc.arm64.map",
1793 out: ["libc.arm64.map"],
1794 srcs: ["libc.map.txt"],
1795 tool_files: [":bionic-generate-version-script"],
1796 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1797}
1798
1799genrule {
1800 name: "libc.x86.map",
1801 out: ["libc.x86.map"],
1802 srcs: ["libc.map.txt"],
1803 tool_files: [":bionic-generate-version-script"],
1804 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1805}
1806
1807genrule {
1808 name: "libc.x86_64.map",
1809 out: ["libc.x86_64.map"],
1810 srcs: ["libc.map.txt"],
1811 tool_files: [":bionic-generate-version-script"],
1812 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1813}
1814
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001815// Headers that only other parts of the platform can include.
1816cc_library_headers {
1817 name: "bionic_libc_platform_headers",
1818 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001819 "//art:__subpackages__",
Josh Gaob7eccd42019-11-06 13:15:00 -08001820 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001821 "//frameworks:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001822 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001823 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001824 "//system/core/debuggerd:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001825 "//system/memory/libmemunreachable:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001826 ],
1827 host_supported: true,
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001828 vendor_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001829 recovery_available: true,
1830 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001831 export_include_dirs: [
1832 "platform",
1833 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001834 system_shared_libs: [],
1835 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001836 sdk_version: "current",
1837}
1838
Logan Chien17af91b2019-01-15 21:19:56 +08001839// libc_headers for libasync_safe and libpropertyinfoparser
1840cc_library_headers {
1841 name: "libc_headers",
1842
1843 host_supported: true,
1844 vendor_available: true,
1845 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001846 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001847
1848 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001849 stl: "none",
1850 system_shared_libs: [],
1851
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001852 // The build system generally requires that any dependencies of a target
1853 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1854 // to 1 we let targets with an sdk_version that need to depend on the libc
1855 // headers but cannot depend on libc itself due to circular dependencies
1856 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1857 // is correct because the headers can support any sdk_version.
1858 sdk_version: "1",
1859
Logan Chien17af91b2019-01-15 21:19:56 +08001860 export_include_dirs: [
1861 "include",
1862 "kernel/uapi",
1863 "kernel/android/uapi",
1864 ],
1865
1866 arch: {
1867 arm: {
1868 export_include_dirs: [
1869 "kernel/uapi/asm-arm",
1870 ],
1871 },
1872 arm64: {
1873 export_include_dirs: [
1874 "kernel/uapi/asm-arm64",
1875 ],
1876 },
1877 mips: {
1878 export_include_dirs: [
1879 "kernel/uapi/asm-mips",
1880 ],
1881 },
1882 mips64: {
1883 export_include_dirs: [
1884 "kernel/uapi/asm-mips",
1885 ],
1886 },
1887 x86: {
1888 export_include_dirs: [
1889 "kernel/uapi/asm-x86",
1890 ],
1891 },
1892 x86_64: {
1893 export_include_dirs: [
1894 "kernel/uapi/asm-x86",
1895 ],
1896 },
1897 },
1898}
1899
Dan Willemsen208ae172015-09-16 16:33:27 -07001900// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001901// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001902// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001903
Dan Willemsen208ae172015-09-16 16:33:27 -07001904cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001905 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001906 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001907 srcs: [
1908 "bionic/__cxa_guard.cpp",
1909 "bionic/__cxa_pure_virtual.cpp",
1910 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001911 ],
1912 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001913 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001914 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001915
Dan Willemsen6b3be172018-12-03 13:57:20 -08001916 static: {
1917 system_shared_libs: [],
1918 },
1919 shared: {
1920 system_shared_libs: ["libc"],
1921 },
1922
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001923 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001924 arch: {
1925 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001926 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001927 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001928 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001929 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001930 },
1931 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001932 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001933 },
1934 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001935 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001936 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001937 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001938 },
1939 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001940 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001941 },
1942 },
1943}
1944
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001945genrule {
1946 name: "libstdc++.arm.map",
1947 out: ["libstdc++.arm.map"],
1948 srcs: ["libstdc++.map.txt"],
1949 tool_files: [":bionic-generate-version-script"],
1950 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1951}
1952
1953genrule {
1954 name: "libstdc++.arm64.map",
1955 out: ["libstdc++.arm64.map"],
1956 srcs: ["libstdc++.map.txt"],
1957 tool_files: [":bionic-generate-version-script"],
1958 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1959}
1960
1961genrule {
1962 name: "libstdc++.x86.map",
1963 out: ["libstdc++.x86.map"],
1964 srcs: ["libstdc++.map.txt"],
1965 tool_files: [":bionic-generate-version-script"],
1966 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1967}
1968
1969genrule {
1970 name: "libstdc++.x86_64.map",
1971 out: ["libstdc++.x86_64.map"],
1972 srcs: ["libstdc++.map.txt"],
1973 tool_files: [":bionic-generate-version-script"],
1974 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1975}
1976
1977// ========================================================
1978// crt object files.
1979// ========================================================
1980
Colin Cross50c21ab2015-10-31 23:03:05 -07001981cc_defaults {
1982 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001983 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001984 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001985 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001986 native_bridge_supported: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001987
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001988 cflags: [
1989 "-Wno-gcc-compat",
1990 "-Wall",
1991 "-Werror",
1992 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07001993 sanitize: {
1994 never: true,
1995 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001996}
1997
Colin Cross50c21ab2015-10-31 23:03:05 -07001998cc_defaults {
1999 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002000 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002001
2002 arch: {
2003 mips: {
2004 cflags: ["-fPIC"],
2005 },
2006 mips64: {
2007 cflags: ["-fPIC"],
2008 },
2009 x86: {
2010 cflags: ["-fPIC"],
2011 },
2012 x86_64: {
2013 cflags: ["-fPIC"],
2014 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002015 },
Colin Crossab179442018-09-27 11:03:22 -07002016 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002017}
2018
Dan Willemsen208ae172015-09-16 16:33:27 -07002019cc_object {
2020 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002021 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002022 local_include_dirs: ["include"],
2023 product_variables: {
2024 platform_sdk_version: {
2025 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2026 },
2027 },
2028 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002029
Colin Cross7d7b3682017-11-03 13:38:40 -07002030 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002031}
2032
Dan Willemsen208ae172015-09-16 16:33:27 -07002033cc_object {
2034 name: "crtbegin_so1",
2035 local_include_dirs: ["include"],
2036 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002037
Colin Cross7d7b3682017-11-03 13:38:40 -07002038 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002039}
2040
Dan Willemsen208ae172015-09-16 16:33:27 -07002041cc_object {
2042 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002043
Colin Cross7d7b3682017-11-03 13:38:40 -07002044 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002045 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002046 "crtbegin_so1",
2047 "crtbrand",
2048 ],
2049}
2050
Dan Willemsen208ae172015-09-16 16:33:27 -07002051cc_object {
2052 name: "crtend_so",
2053 local_include_dirs: ["include"],
2054 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002055
Colin Cross7d7b3682017-11-03 13:38:40 -07002056 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002057}
2058
Dan Willemsen208ae172015-09-16 16:33:27 -07002059cc_object {
2060 name: "crtbegin_static1",
2061 local_include_dirs: ["include"],
2062 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002063
Colin Cross50c21ab2015-10-31 23:03:05 -07002064 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002065 mips: {
2066 srcs: [
2067 "arch-mips/bionic/crtbegin.c",
2068 ],
2069 exclude_srcs: [
2070 "arch-common/bionic/crtbegin.c",
2071 ],
2072 },
2073 mips64: {
2074 srcs: [
2075 "arch-mips64/bionic/crtbegin.c",
2076 ],
2077 exclude_srcs: [
2078 "arch-common/bionic/crtbegin.c",
2079 ],
2080 },
2081 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002082
2083 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002084}
2085
Dan Willemsen208ae172015-09-16 16:33:27 -07002086cc_object {
2087 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002088
Colin Cross77d57bf2016-04-11 14:34:18 -07002089 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002090 "crtbegin_static1",
2091 "crtbrand",
2092 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002093 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002094}
2095
Dan Willemsen208ae172015-09-16 16:33:27 -07002096cc_object {
2097 name: "crtbegin_dynamic1",
2098 local_include_dirs: ["include"],
2099 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002100
Colin Cross50c21ab2015-10-31 23:03:05 -07002101 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002102 mips: {
2103 srcs: [
2104 "arch-mips/bionic/crtbegin.c",
2105 ],
2106 exclude_srcs: [
2107 "arch-common/bionic/crtbegin.c",
2108 ],
2109 },
2110 mips64: {
2111 srcs: [
2112 "arch-mips64/bionic/crtbegin.c",
2113 ],
2114 exclude_srcs: [
2115 "arch-common/bionic/crtbegin.c",
2116 ],
2117 },
2118 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002119 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002120}
2121
Dan Willemsen208ae172015-09-16 16:33:27 -07002122cc_object {
2123 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002124
Colin Cross77d57bf2016-04-11 14:34:18 -07002125 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002126 "crtbegin_dynamic1",
2127 "crtbrand",
2128 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002129 target: {
2130 linux_bionic: {
2131 generated_sources: ["host_bionic_linker_asm"],
2132 objs: [
2133 "linker_wrapper",
2134 ],
2135 },
2136 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002137 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002138}
2139
Dan Willemsen208ae172015-09-16 16:33:27 -07002140cc_object {
2141 // We rename crtend.o to crtend_android.o to avoid a
2142 // name clash between gcc and bionic.
2143 name: "crtend_android",
2144 local_include_dirs: ["include"],
2145 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002146
Colin Cross50c21ab2015-10-31 23:03:05 -07002147 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002148}
Colin Crossbaa48992016-07-13 11:15:21 -07002149
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002150// ========================================================
2151// NDK headers.
2152// ========================================================
2153
Dan Albert26e1c412018-05-24 14:56:46 -07002154versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002155 name: "common_libc",
2156 from: "include",
2157 to: "",
2158 license: "NOTICE",
2159}
Dan Albert4238a352016-06-28 11:18:05 -07002160
2161ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002162 name: "libc_uapi",
2163 from: "kernel/uapi",
2164 to: "",
2165 srcs: [
2166 "kernel/uapi/asm-generic/**/*.h",
2167 "kernel/uapi/drm/**/*.h",
2168 "kernel/uapi/linux/**/*.h",
2169 "kernel/uapi/misc/**/*.h",
2170 "kernel/uapi/mtd/**/*.h",
2171 "kernel/uapi/rdma/**/*.h",
2172 "kernel/uapi/scsi/**/*.h",
2173 "kernel/uapi/sound/**/*.h",
2174 "kernel/uapi/video/**/*.h",
2175 "kernel/uapi/xen/**/*.h",
2176 ],
Dan Albert92592652016-10-20 01:42:54 -07002177 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002178}
2179
2180ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002181 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002182 from: "kernel/android/uapi/linux",
2183 to: "linux",
2184 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002185 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002186}
2187
2188ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002189 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002190 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002191 to: "scsi",
2192 srcs: ["kernel/android/scsi/**/*.h"],
2193 license: "NOTICE",
2194}
2195
2196ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002197 name: "libc_asm_arm",
2198 from: "kernel/uapi/asm-arm",
2199 to: "arm-linux-androideabi",
2200 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002201 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002202}
2203
2204ndk_headers {
2205 name: "libc_asm_arm64",
2206 from: "kernel/uapi/asm-arm64",
2207 to: "aarch64-linux-android",
2208 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002209 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002210}
2211
Elliott Hughesee291c02017-12-11 11:32:34 -08002212// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002213ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002214 name: "libc_asm_mips",
2215 from: "kernel/uapi/asm-mips",
2216 to: "mipsel-linux-android",
2217 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2218 license: "NOTICE",
2219}
2220
Elliott Hughesee291c02017-12-11 11:32:34 -08002221// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002222ndk_headers {
2223 name: "libc_asm_mips64",
2224 from: "kernel/uapi/asm-mips",
2225 to: "mips64el-linux-android",
2226 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2227 license: "NOTICE",
2228}
2229
2230ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002231 name: "libc_asm_x86",
2232 from: "kernel/uapi/asm-x86",
2233 to: "i686-linux-android",
2234 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002235 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002236}
2237
2238ndk_headers {
2239 name: "libc_asm_x86_64",
2240 from: "kernel/uapi/asm-x86",
2241 to: "x86_64-linux-android",
2242 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002243 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002244}
2245
Dan Albert4238a352016-06-28 11:18:05 -07002246ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002247 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002248 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002249 symbol_file: "libc.map.txt",
2250 first_version: "9",
2251}
2252
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002253llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002254 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002255 symbol_file: "libc.map.txt",
2256 export_headers_as_system: true,
2257 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002258 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002259 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002260 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002261 "kernel/android/uapi",
2262 "kernel/uapi",
2263 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002264 arch: {
2265 arm: {
2266 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002267 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002268 ],
2269 },
2270 arm64: {
2271 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002272 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002273 ],
2274 },
2275 mips: {
2276 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002277 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002278 ],
2279 },
2280 mips64: {
2281 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002282 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002283 ],
2284 },
2285 x86: {
2286 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002287 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002288 ],
2289 },
2290 x86_64: {
2291 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002292 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002293 ],
2294 },
2295 },
2296}
2297
Dan Albertdf31aff2016-10-06 15:50:41 -07002298ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002299 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002300 symbol_file: "libstdc++.map.txt",
2301 first_version: "9",
2302}
2303
Dan Willemsenca056d72018-01-08 14:00:24 -08002304// Export these headers for toolbox to process
2305filegroup {
2306 name: "kernel_input_headers",
2307 srcs: [
2308 "kernel/uapi/linux/input.h",
2309 "kernel/uapi/linux/input-event-codes.h",
2310 ],
2311}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002312
2313// Generate a syscall name / number mapping. These objects are text files
2314// (thanks to the -dD -E flags) and not binary files. They will then be
2315// consumed by the genseccomp.py script and converted into C++ code.
2316cc_defaults {
2317 name: "libseccomp_gen_syscall_nrs_defaults",
2318 recovery_available: true,
2319 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2320 cflags: [
2321 "-dD",
2322 "-E",
2323 "-Wall",
2324 "-Werror",
2325 "-nostdinc",
2326 ],
2327}
2328
2329cc_object {
2330 name: "libseccomp_gen_syscall_nrs_arm",
2331 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2332 local_include_dirs: [
2333 "kernel/uapi/asm-arm",
2334 "kernel/uapi",
2335 ],
2336}
2337
2338cc_object {
2339 name: "libseccomp_gen_syscall_nrs_arm64",
2340 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2341 local_include_dirs: [
2342 "kernel/uapi/asm-arm64",
2343 "kernel/uapi",
2344 ],
2345}
2346
2347cc_object {
2348 name: "libseccomp_gen_syscall_nrs_x86",
2349 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2350 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2351 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2352 local_include_dirs: [
2353 "kernel/uapi/asm-x86",
2354 "kernel/uapi",
2355 ],
2356}
2357
2358cc_object {
2359 name: "libseccomp_gen_syscall_nrs_x86_64",
2360 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2361 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2362 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2363 local_include_dirs: [
2364 "kernel/uapi/asm-x86",
2365 "kernel/uapi",
2366 ],
2367}
2368
2369cc_object {
2370 name: "libseccomp_gen_syscall_nrs_mips",
2371 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2372 cflags: [
2373 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2374 ],
2375 local_include_dirs: [
2376 "kernel/uapi/asm-mips",
2377 "kernel/uapi",
2378 ],
2379}
2380
2381cc_object {
2382 name: "libseccomp_gen_syscall_nrs_mips64",
2383 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2384 cflags: [
2385 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2386 ],
2387 local_include_dirs: [
2388 "kernel/uapi/asm-mips",
2389 "kernel/uapi",
2390 ],
2391}
2392
Elliott Hughesae03b122019-09-17 16:37:05 -07002393// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002394python_binary_host {
2395 name: "genseccomp",
2396 main: "tools/genseccomp.py",
2397
2398 srcs: [
2399 "tools/genseccomp.py",
2400 "tools/gensyscalls.py",
2401 ],
2402
2403 data: [
2404 "kernel/uapi/**/*.h",
2405 ],
2406
2407 version: {
2408 py2: {
2409 enabled: true,
2410 },
2411 py3: {
2412 enabled: false,
2413 },
2414 },
2415}
2416
Martijn Coenen0c6de752019-01-02 12:52:51 +01002417python_binary_host {
2418 name: "genfunctosyscallnrs",
2419 main: "tools/genfunctosyscallnrs.py",
2420
2421 srcs: [
2422 "tools/genseccomp.py",
2423 "tools/genfunctosyscallnrs.py",
2424 "tools/gensyscalls.py",
2425 ],
2426
2427 data: [
2428 "kernel/uapi/**/*.h",
2429 ],
2430
2431 version: {
2432 py2: {
2433 enabled: true,
2434 },
2435 py3: {
2436 enabled: false,
2437 },
2438 },
2439}
2440
2441cc_genrule {
2442 name: "func_to_syscall_nrs",
2443 recovery_available: true,
2444 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2445
2446 tools: [ "genfunctosyscallnrs" ],
2447
2448 srcs: [
2449 "SYSCALLS.TXT",
2450 ":libseccomp_gen_syscall_nrs_arm",
2451 ":libseccomp_gen_syscall_nrs_arm64",
2452 ":libseccomp_gen_syscall_nrs_mips",
2453 ":libseccomp_gen_syscall_nrs_mips64",
2454 ":libseccomp_gen_syscall_nrs_x86",
2455 ":libseccomp_gen_syscall_nrs_x86_64",
2456 ],
2457
2458 out: [
2459 "func_to_syscall_nrs.h",
2460 ],
2461}
2462
Martijn Coenenc3752be2019-01-09 16:19:57 +01002463// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2464genrule {
2465 name: "generate_app_zygote_blacklist",
2466 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2467 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2468 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2469}
2470
2471cc_genrule {
2472 name: "libseccomp_policy_app_zygote_sources",
2473 recovery_available: true,
2474 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2475
2476 tools: [ "genseccomp" ],
2477
2478 srcs: [
2479 "SYSCALLS.TXT",
2480 "SECCOMP_WHITELIST_COMMON.TXT",
2481 "SECCOMP_WHITELIST_APP.TXT",
2482 "SECCOMP_BLACKLIST_COMMON.TXT",
2483 ":generate_app_zygote_blacklist",
2484 ":libseccomp_gen_syscall_nrs_arm",
2485 ":libseccomp_gen_syscall_nrs_arm64",
2486 ":libseccomp_gen_syscall_nrs_mips",
2487 ":libseccomp_gen_syscall_nrs_mips64",
2488 ":libseccomp_gen_syscall_nrs_x86",
2489 ":libseccomp_gen_syscall_nrs_x86_64",
2490 ],
2491
2492 out: [
2493 "arm64_app_zygote_policy.cpp",
2494 "arm_app_zygote_policy.cpp",
2495 "mips64_app_zygote_policy.cpp",
2496 "mips_app_zygote_policy.cpp",
2497 "x86_64_app_zygote_policy.cpp",
2498 "x86_app_zygote_policy.cpp",
2499 ],
2500}
2501
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002502cc_genrule {
2503 name: "libseccomp_policy_app_sources",
2504 recovery_available: true,
2505 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2506
2507 tools: [ "genseccomp" ],
2508
2509 srcs: [
2510 "SYSCALLS.TXT",
2511 "SECCOMP_WHITELIST_COMMON.TXT",
2512 "SECCOMP_WHITELIST_APP.TXT",
2513 "SECCOMP_BLACKLIST_COMMON.TXT",
2514 "SECCOMP_BLACKLIST_APP.TXT",
2515 ":libseccomp_gen_syscall_nrs_arm",
2516 ":libseccomp_gen_syscall_nrs_arm64",
2517 ":libseccomp_gen_syscall_nrs_mips",
2518 ":libseccomp_gen_syscall_nrs_mips64",
2519 ":libseccomp_gen_syscall_nrs_x86",
2520 ":libseccomp_gen_syscall_nrs_x86_64",
2521 ],
2522
2523 out: [
2524 "arm64_app_policy.cpp",
2525 "arm_app_policy.cpp",
2526 "mips64_app_policy.cpp",
2527 "mips_app_policy.cpp",
2528 "x86_64_app_policy.cpp",
2529 "x86_app_policy.cpp",
2530 ],
2531}
2532
2533cc_genrule {
2534 name: "libseccomp_policy_system_sources",
2535 recovery_available: true,
2536 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2537
2538 tools: [ "genseccomp" ],
2539
2540 srcs: [
2541 "SYSCALLS.TXT",
2542 "SECCOMP_WHITELIST_COMMON.TXT",
2543 "SECCOMP_WHITELIST_SYSTEM.TXT",
2544 "SECCOMP_BLACKLIST_COMMON.TXT",
2545 ":libseccomp_gen_syscall_nrs_arm",
2546 ":libseccomp_gen_syscall_nrs_arm64",
2547 ":libseccomp_gen_syscall_nrs_mips",
2548 ":libseccomp_gen_syscall_nrs_mips64",
2549 ":libseccomp_gen_syscall_nrs_x86",
2550 ":libseccomp_gen_syscall_nrs_x86_64",
2551 ],
2552
2553 out: [
2554 "arm64_system_policy.cpp",
2555 "arm_system_policy.cpp",
2556 "mips64_system_policy.cpp",
2557 "mips_system_policy.cpp",
2558 "x86_64_system_policy.cpp",
2559 "x86_system_policy.cpp",
2560 ],
2561}
2562
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002563cc_library {
2564 name: "libseccomp_policy",
2565 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002566 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002567 generated_sources: [
2568 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002569 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002570 "libseccomp_policy_system_sources",
2571 ],
2572
2573 srcs: [
2574 "seccomp/seccomp_policy.cpp",
2575 ],
2576
2577 export_include_dirs: ["seccomp/include"],
2578 cflags: [
2579 "-Wall",
2580 "-Werror",
2581 ],
2582 shared: {
2583 shared_libs: ["libbase"],
2584 },
2585 static: {
2586 static_libs: ["libbase"],
2587 },
2588}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002589
2590// This is a temporary library that will use scudo as the native memory
2591// allocator. To use it, add it as the first shared library.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002592cc_defaults {
2593 name: "libc_scudo_wrapper_defaults",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002594 srcs: [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08002595 "bionic/heap_tagging.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002596 "bionic/malloc_common.cpp",
2597 "bionic/malloc_common_dynamic.cpp",
2598 "bionic/malloc_heapprofd.cpp",
2599 "bionic/malloc_limit.cpp",
2600 "bionic/scudo_wrapper.cpp",
2601 "bionic/__set_errno.cpp",
2602 ],
2603 cflags: ["-DUSE_SCUDO"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002604 shared_libs: ["libscudo_wrapper"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002605
2606 header_libs: ["libc_headers"],
2607
2608 static_libs: ["libasync_safe"],
2609
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002610 arch: {
2611 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002612 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002613 },
2614 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002615 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002616 },
2617 x86: {
2618 srcs: [
2619 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002620 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002621 ],
2622 },
2623 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002624 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002625 },
2626 },
2627
2628 // Mark this library as global so it overrides all the allocation
2629 // definitions properly.
2630 ldflags: ["-Wl,-z,global"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002631}
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002632
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002633cc_library_shared {
2634 name: "libc_scudo",
Anna Trostanetski9981a1d2020-01-20 20:16:29 +00002635 defaults: ["libc_scudo_wrapper_defaults"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002636 vendor_available: true,
2637 stl: "none",
2638 system_shared_libs: [],
2639
2640 allow_undefined_symbols: true,
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002641 // Like libc, disable native coverage for libc_scudo.
2642 native_coverage: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002643}
2644
2645subdirs = [
2646 "bionic/scudo",
2647]