blob: f1cca49c3861c14946b881ef2676470a26f02e0a [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",
1106 "bionic/dup2.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 Gaof6e5b582018-06-01 15:30:54 -07001115 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001116 "bionic/ffs.cpp",
1117 "bionic/fgetxattr.cpp",
1118 "bionic/flistxattr.cpp",
1119 "bionic/flockfile.cpp",
1120 "bionic/fpclassify.cpp",
1121 "bionic/fsetxattr.cpp",
1122 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001123 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001124 "bionic/futimens.cpp",
1125 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001126 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001127 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001128 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001129 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001130 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001131 "bionic/getpgrp.cpp",
1132 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001133 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001134 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001135 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001136 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001137 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001138 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001139 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001140 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001141 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001142 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001143 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001144 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001145 "bionic/lchown.cpp",
1146 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001147 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001148 "bionic/libgen.cpp",
1149 "bionic/link.cpp",
1150 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001151 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001152 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001153 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001154 "bionic/mbrtoc16.cpp",
1155 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001156 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001157 "bionic/mempcpy.cpp",
1158 "bionic/mkdir.cpp",
1159 "bionic/mkfifo.cpp",
1160 "bionic/mknod.cpp",
1161 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001162 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001163 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001164 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001165 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001166 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001167 "bionic/open.cpp",
1168 "bionic/pathconf.cpp",
1169 "bionic/pause.cpp",
1170 "bionic/pipe.cpp",
1171 "bionic/poll.cpp",
1172 "bionic/posix_fadvise.cpp",
1173 "bionic/posix_fallocate.cpp",
1174 "bionic/posix_madvise.cpp",
1175 "bionic/posix_timers.cpp",
1176 "bionic/ptrace.cpp",
1177 "bionic/pty.cpp",
1178 "bionic/raise.cpp",
1179 "bionic/rand.cpp",
1180 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001181 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001182 "bionic/reboot.cpp",
1183 "bionic/recv.cpp",
1184 "bionic/rename.cpp",
1185 "bionic/rmdir.cpp",
1186 "bionic/scandir.cpp",
1187 "bionic/sched_getaffinity.cpp",
1188 "bionic/sched_getcpu.cpp",
1189 "bionic/semaphore.cpp",
1190 "bionic/send.cpp",
1191 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001192 "bionic/seteuid.cpp",
1193 "bionic/setpgrp.cpp",
1194 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001195 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001196 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001197 "bionic/sleep.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001198 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001199 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001200 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001201 "bionic/strchrnul.cpp",
1202 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001203 "bionic/string_l.cpp",
1204 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001205 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001206 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001207 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001208 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001209 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001210 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001211 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001212 "bionic/sys_msg.cpp",
1213 "bionic/sys_sem.cpp",
1214 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001215 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001216 "bionic/sys_statfs.cpp",
1217 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001218 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001219 "bionic/sysinfo.cpp",
1220 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001221 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001222 "bionic/system_property_api.cpp",
1223 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001224 "bionic/tdestroy.cpp",
1225 "bionic/termios.cpp",
1226 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001227 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001228 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001229 "bionic/tmpfile.cpp",
1230 "bionic/umount.cpp",
1231 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001232 "bionic/usleep.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001233 "bionic/wait.cpp",
1234 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001235 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001236 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001237 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001238 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001239 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001240
1241 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1242 // which will be overridden by the actual one in libc.so.
1243 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001244 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001245
Dan Willemsen208ae172015-09-16 16:33:27 -07001246 multilib: {
1247 lib32: {
1248 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001249 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001250 },
1251 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001252 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001253 treble_linker_namespaces: {
1254 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001255 },
1256 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001257 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001258 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001259 local_include_dirs: ["stdio"],
1260 include_dirs: ["bionic/libstdc++/include"],
1261 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001262 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001263}
1264
Dan Willemsen208ae172015-09-16 16:33:27 -07001265// ========================================================
1266// libc_pthread.a - pthreads parts that previously lived in
1267// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001268// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001269// pthread_t has changed over the years and has ABI
1270// compatibility issues).
1271// ========================================================
1272
1273cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001274 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001275 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001276 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001277 "bionic/pthread_atfork.cpp",
1278 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001279 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001280 "bionic/pthread_cond.cpp",
1281 "bionic/pthread_create.cpp",
1282 "bionic/pthread_detach.cpp",
1283 "bionic/pthread_equal.cpp",
1284 "bionic/pthread_exit.cpp",
1285 "bionic/pthread_getcpuclockid.cpp",
1286 "bionic/pthread_getschedparam.cpp",
1287 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001288 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001289 "bionic/pthread_join.cpp",
1290 "bionic/pthread_key.cpp",
1291 "bionic/pthread_kill.cpp",
1292 "bionic/pthread_mutex.cpp",
1293 "bionic/pthread_once.cpp",
1294 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001295 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001296 "bionic/pthread_self.cpp",
1297 "bionic/pthread_setname_np.cpp",
1298 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001299 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001300
1301 // The following implementations depend on pthread data or implementation,
1302 // so we can't include them in libc_ndk.a.
1303 "bionic/__cxa_thread_atexit_impl.cpp",
1304 "stdlib/atexit.c",
1305 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001306 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001307
Colin Cross50c21ab2015-10-31 23:03:05 -07001308 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001309 include_dirs: ["bionic/libstdc++/include"],
1310 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001311}
1312
1313// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001314// libc_syscalls.a
1315// ========================================================
1316
Elliott Hughes782c4852019-04-16 12:31:00 -07001317genrule {
1318 name: "syscalls-arm.S",
1319 out: ["syscalls-arm.S"],
1320 srcs: ["SYSCALLS.TXT"],
1321 tool_files: [":bionic-gensyscalls"],
1322 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1323}
1324
1325genrule {
1326 name: "syscalls-arm64.S",
1327 out: ["syscalls-arm64.S"],
1328 srcs: ["SYSCALLS.TXT"],
1329 tool_files: [":bionic-gensyscalls"],
1330 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1331}
1332
1333genrule {
1334 name: "syscalls-x86.S",
1335 out: ["syscalls-x86.S"],
1336 srcs: ["SYSCALLS.TXT"],
1337 tool_files: [":bionic-gensyscalls"],
1338 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1339}
1340
1341genrule {
1342 name: "syscalls-x86_64.S",
1343 out: ["syscalls-x86_64.S"],
1344 srcs: ["SYSCALLS.TXT"],
1345 tool_files: [":bionic-gensyscalls"],
1346 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1347}
1348
Dan Willemsen208ae172015-09-16 16:33:27 -07001349cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001350 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001351 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001352 arch: {
1353 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001354 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001355 },
1356 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001357 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001358 },
1359 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001360 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001361 },
1362 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001363 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001364 },
1365 },
1366 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001367}
1368
1369// ========================================================
1370// libc_aeabi.a
1371// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1372// to avoid infinite recursion. For the other architectures we just build an
1373// empty library to keep this makefile simple.
1374// ========================================================
1375
1376cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001377 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001378 arch: {
1379 arm: {
1380 srcs: ["arch-arm/bionic/__aeabi.c"],
1381 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001382 },
1383 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001384 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001385}
1386
1387// ========================================================
1388// libc_ndk.a
1389// Compatibility library for the NDK. This library contains
1390// all the parts of libc that are safe to statically link.
1391// We can't safely statically link things that can only run
1392// on a certain version of the OS. Examples include
1393// anything that talks to netd (a large portion of the DNS
1394// code) and anything that is dependent on the layout of a
1395// data structure that has changed across releases (such as
1396// pthread_t).
1397// ========================================================
1398
1399cc_library_static {
1400 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001401 defaults: [
1402 "libc_defaults",
1403 "libc_native_allocator_defaults",
1404 ],
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001405 srcs: libc_common_src_files + [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001406 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001407 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001408 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001409 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001410 multilib: {
1411 lib32: {
1412 srcs: libc_common_src_files_32,
1413 },
1414 },
1415 arch: {
1416 arm: {
1417 srcs: [
1418 "arch-arm/bionic/exidx_dynamic.c",
1419 "arch-common/bionic/crtbegin_so.c",
1420 "arch-arm/bionic/atexit_legacy.c",
1421 "arch-common/bionic/crtend_so.S",
1422 ],
1423 whole_static_libs: ["libc_aeabi"],
1424 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001425 },
1426
Colin Cross50c21ab2015-10-31 23:03:05 -07001427 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001428 "-fvisibility=hidden",
1429 "-DLIBC_STATIC",
1430 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001431
1432 whole_static_libs: [
1433 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001434 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001435 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001436 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001437 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001438 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001439 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001440 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001441 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001442 "libc_syscalls",
1443 "libc_tzcode",
1444 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001445 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001446 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001447}
1448
1449// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001450// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001451// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001452cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001453 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001454 srcs: libc_common_src_files,
1455 multilib: {
1456 lib32: {
1457 srcs: libc_common_src_files_32,
1458 },
1459 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001460 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001461
1462 whole_static_libs: [
1463 "libc_bionic",
1464 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001465 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001466 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001467 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001468 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001469 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001470 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001471 "libc_netbsd",
1472 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001473 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001474 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001475 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001476 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001477 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001478 ],
1479
1480 arch: {
1481 arm: {
1482 whole_static_libs: ["libc_aeabi"],
1483 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001484 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001485}
1486
1487// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001488// libc_common.a
1489// ========================================================
1490
1491cc_library_static {
1492 defaults: ["libc_defaults"],
1493 name: "libc_common",
1494
1495 whole_static_libs: [
1496 "libc_nopthread",
1497 "libc_pthread",
1498 ],
1499}
1500
1501// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001502// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001503// ========================================================
1504cc_library_static {
1505 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001506 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001507
Haibo Huangb9244ff2018-08-11 10:12:13 -07001508 arch: {
1509 x86: {
1510 srcs: ["arch-x86/static_function_dispatch.S"],
1511 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001512 arm: {
1513 srcs: ["arch-arm/static_function_dispatch.S"],
1514 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001515 arm64: {
1516 srcs: ["arch-arm64/static_function_dispatch.S"],
1517 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001518 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001519}
1520
1521// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001522// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001523// ========================================================
1524cc_library_static {
1525 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001526 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001527
Haibo Huangb9244ff2018-08-11 10:12:13 -07001528 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001529 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001530 "-fno-stack-protector",
1531 "-fno-jump-tables",
1532 ],
1533 arch: {
1534 x86: {
1535 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1536 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001537 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001538 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001539 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001540 arm64: {
1541 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1542 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001543 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001544}
1545
1546// ========================================================
1547// libc_common_static.a For static binaries.
1548// ========================================================
1549cc_library_static {
1550 defaults: ["libc_defaults"],
1551 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001552
Haibo Huangf71edfa2018-11-12 10:06:56 -08001553 whole_static_libs: [
1554 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001555 "libc_static_dispatch",
1556 ],
1557}
1558
1559// ========================================================
1560// libc_common_shared.a For shared libraries.
1561// ========================================================
1562cc_library_static {
1563 defaults: ["libc_defaults"],
1564 name: "libc_common_shared",
1565
1566 whole_static_libs: [
1567 "libc_common",
1568 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001569 ],
1570}
1571
Ryan Prichard22a6a052019-10-10 23:59:30 -07001572// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1573// executable.
1574cc_library_static {
1575 name: "libc_unwind_static",
1576 defaults: ["libc_defaults"],
1577 cflags: ["-DLIBC_STATIC"],
1578
1579 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1580 arch: {
1581 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1582 arm: {
1583 srcs: ["arch-arm/bionic/exidx_static.c"],
1584 },
1585 },
1586}
1587
Haibo Huangf71edfa2018-11-12 10:06:56 -08001588// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001589// libc_nomalloc.a
1590// ========================================================
1591//
Ryan Prichard249757b2019-11-01 17:18:28 -07001592// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1593// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1594// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001595
1596cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001597 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001598 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001599
Colin Crossa3f9fca2016-01-11 13:20:55 -08001600 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001601 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001602 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001603 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001604 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001605}
1606
dimitryc0c0ef62018-12-05 16:33:52 +01001607filegroup {
1608 name: "libc_sources_shared",
1609 srcs: [
1610 "arch-common/bionic/crtbegin_so.c",
1611 "arch-common/bionic/crtbrand.S",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001612 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001613 "bionic/icu.cpp",
1614 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001615 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001616 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001617 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001618 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001619 "bionic/ndk_cruft.cpp",
1620 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001621 "bionic/NetdClient.cpp",
1622 "arch-common/bionic/crtend_so.S",
1623 ],
1624}
1625
1626filegroup {
1627 name: "libc_sources_static",
1628 srcs: [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001629 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001630 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001631 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001632 ],
1633}
1634
1635filegroup {
1636 name: "libc_sources_shared_arm",
1637 srcs: [
1638 "arch-arm/bionic/exidx_dynamic.c",
1639 "arch-arm/bionic/atexit_legacy.c",
1640 ],
1641}
1642
Dan Willemsen208ae172015-09-16 16:33:27 -07001643// ========================================================
1644// libc.a + libc.so
1645// ========================================================
1646cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001647 defaults: [
1648 "libc_defaults",
1649 "libc_native_allocator_defaults",
1650 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001651 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001652 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001653 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001654 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001655 platform_sdk_version: {
1656 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1657 },
1658 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001659 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001660 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001661 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001662 whole_static_libs: [
1663 "libc_init_static",
1664 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001665 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001666 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001667 },
1668 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001669 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001670 whole_static_libs: [
1671 "libc_init_dynamic",
1672 "libc_common_shared",
1673 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001674 },
1675
Neil Fullera7db90f2019-04-25 09:28:27 +01001676 required: [
1677 "tzdata",
1678 "tz_version", // Version metadata for tzdata to help debugging.
1679 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001680
Colin Cross4ce94d22016-11-15 13:15:43 -08001681 // Do not pack libc.so relocations; see http://b/20645321 for details.
1682 pack_relocations: false,
1683
dimitry06016f22018-01-05 11:39:28 +01001684 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1685 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1686 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1687 // those new libraries from libgcc.a are not declared external; if that were the case,
1688 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1689 // on the external symbols from the dependent libraries. That would create a "cloaked"
1690 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001691
dimitry06016f22018-01-05 11:39:28 +01001692 shared_libs: [
1693 "ld-android",
1694 "libdl",
1695 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001696 static_libs: [
1697 "libdl_android",
1698 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001699
1700 nocrt: true,
1701
Dan Willemsen208ae172015-09-16 16:33:27 -07001702 arch: {
1703 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001704 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001705 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001706 ldflags: ["-Wl,--hash-style=both"],
1707
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001708 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001709
Dan Willemsen208ae172015-09-16 16:33:27 -07001710 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001711 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001712 // special for arm
1713 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001714 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001715
1716 // Arm 32 bit does not produce complete exidx unwind information
1717 // so keep the .debug_frame which is relatively small and does
1718 // include needed unwind information.
1719 // See b/132992102 for details.
1720 strip: {
1721 keep_symbols_and_debug_frame: true,
1722 },
Peter Collingbourneb061e772019-11-12 14:26:21 -08001723
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001724 whole_static_libs: [ "libunwind_llvm" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001725 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001726 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001727 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001728
1729 // Leave the symbols in the shared library so that stack unwinders can produce
1730 // meaningful name resolution.
1731 strip: {
1732 keep_symbols: true,
1733 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001734
1735 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001736 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001737 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001738 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001739 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001740 ldflags: ["-Wl,--hash-style=both"],
1741
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001742 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001743
1744 // Leave the symbols in the shared library so that stack unwinders can produce
1745 // meaningful name resolution.
1746 strip: {
1747 keep_symbols: true,
1748 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001749
1750 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001751 },
1752 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001753 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001754
1755 // Leave the symbols in the shared library so that stack unwinders can produce
1756 // meaningful name resolution.
1757 strip: {
1758 keep_symbols: true,
1759 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001760
1761 whole_static_libs: [ "libgcc_stripped" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001762 },
1763 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001764
1765 stubs: {
1766 symbol_file: "libc.map.txt",
1767 versions: ["10000"],
1768 },
Vic Yang6903fb82019-01-14 11:34:39 -08001769
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001770 apex_available: [
1771 "//apex_available:platform",
1772 "com.android.runtime",
1773 ],
1774
Vic Yang03ff4362019-06-24 16:11:37 -07001775 // Sorting bss symbols by size usually results in less dirty pages at run
1776 // time, because small symbols are grouped together.
1777 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001778}
1779
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001780genrule {
1781 name: "libc.arm.map",
1782 out: ["libc.arm.map"],
1783 srcs: ["libc.map.txt"],
1784 tool_files: [":bionic-generate-version-script"],
1785 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1786}
1787
1788genrule {
1789 name: "libc.arm64.map",
1790 out: ["libc.arm64.map"],
1791 srcs: ["libc.map.txt"],
1792 tool_files: [":bionic-generate-version-script"],
1793 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1794}
1795
1796genrule {
1797 name: "libc.x86.map",
1798 out: ["libc.x86.map"],
1799 srcs: ["libc.map.txt"],
1800 tool_files: [":bionic-generate-version-script"],
1801 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1802}
1803
1804genrule {
1805 name: "libc.x86_64.map",
1806 out: ["libc.x86_64.map"],
1807 srcs: ["libc.map.txt"],
1808 tool_files: [":bionic-generate-version-script"],
1809 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1810}
1811
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001812// Headers that only other parts of the platform can include.
1813cc_library_headers {
1814 name: "bionic_libc_platform_headers",
1815 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001816 "//art:__subpackages__",
1817 "//bionic/libc:__subpackages__",
1818 "//frameworks:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001819 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001820 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001821 "//system/core/debuggerd:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001822 "//system/memory/libmemunreachable:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001823 ],
1824 host_supported: true,
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001825 vendor_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001826 recovery_available: true,
1827 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001828 export_include_dirs: [
1829 "platform",
1830 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001831 system_shared_libs: [],
1832 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001833 sdk_version: "current",
1834}
1835
Logan Chien17af91b2019-01-15 21:19:56 +08001836// libc_headers for libasync_safe and libpropertyinfoparser
1837cc_library_headers {
1838 name: "libc_headers",
1839
1840 host_supported: true,
1841 vendor_available: true,
1842 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001843 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001844
1845 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001846 stl: "none",
1847 system_shared_libs: [],
1848
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001849 // The build system generally requires that any dependencies of a target
1850 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1851 // to 1 we let targets with an sdk_version that need to depend on the libc
1852 // headers but cannot depend on libc itself due to circular dependencies
1853 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1854 // is correct because the headers can support any sdk_version.
1855 sdk_version: "1",
1856
Logan Chien17af91b2019-01-15 21:19:56 +08001857 export_include_dirs: [
1858 "include",
1859 "kernel/uapi",
1860 "kernel/android/uapi",
1861 ],
1862
1863 arch: {
1864 arm: {
1865 export_include_dirs: [
1866 "kernel/uapi/asm-arm",
1867 ],
1868 },
1869 arm64: {
1870 export_include_dirs: [
1871 "kernel/uapi/asm-arm64",
1872 ],
1873 },
1874 mips: {
1875 export_include_dirs: [
1876 "kernel/uapi/asm-mips",
1877 ],
1878 },
1879 mips64: {
1880 export_include_dirs: [
1881 "kernel/uapi/asm-mips",
1882 ],
1883 },
1884 x86: {
1885 export_include_dirs: [
1886 "kernel/uapi/asm-x86",
1887 ],
1888 },
1889 x86_64: {
1890 export_include_dirs: [
1891 "kernel/uapi/asm-x86",
1892 ],
1893 },
1894 },
1895}
1896
Dan Willemsen208ae172015-09-16 16:33:27 -07001897// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001898// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001899// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001900
Dan Willemsen208ae172015-09-16 16:33:27 -07001901cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001902 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001903 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001904 srcs: [
1905 "bionic/__cxa_guard.cpp",
1906 "bionic/__cxa_pure_virtual.cpp",
1907 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001908 ],
1909 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001910 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001911 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001912
Dan Willemsen6b3be172018-12-03 13:57:20 -08001913 static: {
1914 system_shared_libs: [],
1915 },
1916 shared: {
1917 system_shared_libs: ["libc"],
1918 },
1919
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001920 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001921 arch: {
1922 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001923 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001924 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001925 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001926 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001927 },
1928 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001929 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001930 },
1931 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001932 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001933 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001934 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001935 },
1936 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001937 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001938 },
1939 },
1940}
1941
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001942genrule {
1943 name: "libstdc++.arm.map",
1944 out: ["libstdc++.arm.map"],
1945 srcs: ["libstdc++.map.txt"],
1946 tool_files: [":bionic-generate-version-script"],
1947 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1948}
1949
1950genrule {
1951 name: "libstdc++.arm64.map",
1952 out: ["libstdc++.arm64.map"],
1953 srcs: ["libstdc++.map.txt"],
1954 tool_files: [":bionic-generate-version-script"],
1955 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1956}
1957
1958genrule {
1959 name: "libstdc++.x86.map",
1960 out: ["libstdc++.x86.map"],
1961 srcs: ["libstdc++.map.txt"],
1962 tool_files: [":bionic-generate-version-script"],
1963 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1964}
1965
1966genrule {
1967 name: "libstdc++.x86_64.map",
1968 out: ["libstdc++.x86_64.map"],
1969 srcs: ["libstdc++.map.txt"],
1970 tool_files: [":bionic-generate-version-script"],
1971 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1972}
1973
1974// ========================================================
1975// crt object files.
1976// ========================================================
1977
Colin Cross50c21ab2015-10-31 23:03:05 -07001978cc_defaults {
1979 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001980 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001981 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001982 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001983 native_bridge_supported: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001984
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001985 cflags: [
1986 "-Wno-gcc-compat",
1987 "-Wall",
1988 "-Werror",
1989 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07001990 sanitize: {
1991 never: true,
1992 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001993}
1994
Colin Cross50c21ab2015-10-31 23:03:05 -07001995cc_defaults {
1996 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001997 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001998
1999 arch: {
2000 mips: {
2001 cflags: ["-fPIC"],
2002 },
2003 mips64: {
2004 cflags: ["-fPIC"],
2005 },
2006 x86: {
2007 cflags: ["-fPIC"],
2008 },
2009 x86_64: {
2010 cflags: ["-fPIC"],
2011 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002012 },
Colin Crossab179442018-09-27 11:03:22 -07002013 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002014}
2015
Dan Willemsen208ae172015-09-16 16:33:27 -07002016cc_object {
2017 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002018 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002019 local_include_dirs: ["include"],
2020 product_variables: {
2021 platform_sdk_version: {
2022 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2023 },
2024 },
2025 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002026
Colin Cross7d7b3682017-11-03 13:38:40 -07002027 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002028}
2029
Dan Willemsen208ae172015-09-16 16:33:27 -07002030cc_object {
2031 name: "crtbegin_so1",
2032 local_include_dirs: ["include"],
2033 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002034
Colin Cross7d7b3682017-11-03 13:38:40 -07002035 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002036}
2037
Dan Willemsen208ae172015-09-16 16:33:27 -07002038cc_object {
2039 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002040
Colin Cross7d7b3682017-11-03 13:38:40 -07002041 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002042 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002043 "crtbegin_so1",
2044 "crtbrand",
2045 ],
2046}
2047
Dan Willemsen208ae172015-09-16 16:33:27 -07002048cc_object {
2049 name: "crtend_so",
2050 local_include_dirs: ["include"],
2051 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002052
Colin Cross7d7b3682017-11-03 13:38:40 -07002053 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002054}
2055
Dan Willemsen208ae172015-09-16 16:33:27 -07002056cc_object {
2057 name: "crtbegin_static1",
2058 local_include_dirs: ["include"],
2059 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002060
Colin Cross50c21ab2015-10-31 23:03:05 -07002061 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002062 mips: {
2063 srcs: [
2064 "arch-mips/bionic/crtbegin.c",
2065 ],
2066 exclude_srcs: [
2067 "arch-common/bionic/crtbegin.c",
2068 ],
2069 },
2070 mips64: {
2071 srcs: [
2072 "arch-mips64/bionic/crtbegin.c",
2073 ],
2074 exclude_srcs: [
2075 "arch-common/bionic/crtbegin.c",
2076 ],
2077 },
2078 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002079
2080 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002081}
2082
Dan Willemsen208ae172015-09-16 16:33:27 -07002083cc_object {
2084 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002085
Colin Cross77d57bf2016-04-11 14:34:18 -07002086 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002087 "crtbegin_static1",
2088 "crtbrand",
2089 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002090 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002091}
2092
Dan Willemsen208ae172015-09-16 16:33:27 -07002093cc_object {
2094 name: "crtbegin_dynamic1",
2095 local_include_dirs: ["include"],
2096 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002097
Colin Cross50c21ab2015-10-31 23:03:05 -07002098 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002099 mips: {
2100 srcs: [
2101 "arch-mips/bionic/crtbegin.c",
2102 ],
2103 exclude_srcs: [
2104 "arch-common/bionic/crtbegin.c",
2105 ],
2106 },
2107 mips64: {
2108 srcs: [
2109 "arch-mips64/bionic/crtbegin.c",
2110 ],
2111 exclude_srcs: [
2112 "arch-common/bionic/crtbegin.c",
2113 ],
2114 },
2115 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002116 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002117}
2118
Dan Willemsen208ae172015-09-16 16:33:27 -07002119cc_object {
2120 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002121
Colin Cross77d57bf2016-04-11 14:34:18 -07002122 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002123 "crtbegin_dynamic1",
2124 "crtbrand",
2125 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002126 target: {
2127 linux_bionic: {
2128 generated_sources: ["host_bionic_linker_asm"],
2129 objs: [
2130 "linker_wrapper",
2131 ],
2132 },
2133 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002134 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002135}
2136
Dan Willemsen208ae172015-09-16 16:33:27 -07002137cc_object {
2138 // We rename crtend.o to crtend_android.o to avoid a
2139 // name clash between gcc and bionic.
2140 name: "crtend_android",
2141 local_include_dirs: ["include"],
2142 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002143
Colin Cross50c21ab2015-10-31 23:03:05 -07002144 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002145}
Colin Crossbaa48992016-07-13 11:15:21 -07002146
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002147// ========================================================
2148// NDK headers.
2149// ========================================================
2150
Dan Albert26e1c412018-05-24 14:56:46 -07002151versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002152 name: "common_libc",
2153 from: "include",
2154 to: "",
2155 license: "NOTICE",
2156}
Dan Albert4238a352016-06-28 11:18:05 -07002157
2158ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002159 name: "libc_uapi",
2160 from: "kernel/uapi",
2161 to: "",
2162 srcs: [
2163 "kernel/uapi/asm-generic/**/*.h",
2164 "kernel/uapi/drm/**/*.h",
2165 "kernel/uapi/linux/**/*.h",
2166 "kernel/uapi/misc/**/*.h",
2167 "kernel/uapi/mtd/**/*.h",
2168 "kernel/uapi/rdma/**/*.h",
2169 "kernel/uapi/scsi/**/*.h",
2170 "kernel/uapi/sound/**/*.h",
2171 "kernel/uapi/video/**/*.h",
2172 "kernel/uapi/xen/**/*.h",
2173 ],
Dan Albert92592652016-10-20 01:42:54 -07002174 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002175}
2176
2177ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002178 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002179 from: "kernel/android/uapi/linux",
2180 to: "linux",
2181 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002182 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002183}
2184
2185ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002186 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002187 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002188 to: "scsi",
2189 srcs: ["kernel/android/scsi/**/*.h"],
2190 license: "NOTICE",
2191}
2192
2193ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002194 name: "libc_asm_arm",
2195 from: "kernel/uapi/asm-arm",
2196 to: "arm-linux-androideabi",
2197 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002198 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002199}
2200
2201ndk_headers {
2202 name: "libc_asm_arm64",
2203 from: "kernel/uapi/asm-arm64",
2204 to: "aarch64-linux-android",
2205 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002206 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002207}
2208
Elliott Hughesee291c02017-12-11 11:32:34 -08002209// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002210ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002211 name: "libc_asm_mips",
2212 from: "kernel/uapi/asm-mips",
2213 to: "mipsel-linux-android",
2214 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2215 license: "NOTICE",
2216}
2217
Elliott Hughesee291c02017-12-11 11:32:34 -08002218// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002219ndk_headers {
2220 name: "libc_asm_mips64",
2221 from: "kernel/uapi/asm-mips",
2222 to: "mips64el-linux-android",
2223 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2224 license: "NOTICE",
2225}
2226
2227ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002228 name: "libc_asm_x86",
2229 from: "kernel/uapi/asm-x86",
2230 to: "i686-linux-android",
2231 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002232 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002233}
2234
2235ndk_headers {
2236 name: "libc_asm_x86_64",
2237 from: "kernel/uapi/asm-x86",
2238 to: "x86_64-linux-android",
2239 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002240 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002241}
2242
Dan Albert4238a352016-06-28 11:18:05 -07002243ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002244 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002245 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002246 symbol_file: "libc.map.txt",
2247 first_version: "9",
2248}
2249
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002250llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002251 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002252 symbol_file: "libc.map.txt",
2253 export_headers_as_system: true,
2254 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002255 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002256 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002257 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002258 "kernel/android/uapi",
2259 "kernel/uapi",
2260 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002261 arch: {
2262 arm: {
2263 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002264 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002265 ],
2266 },
2267 arm64: {
2268 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002269 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002270 ],
2271 },
2272 mips: {
2273 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002274 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002275 ],
2276 },
2277 mips64: {
2278 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002279 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002280 ],
2281 },
2282 x86: {
2283 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002284 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002285 ],
2286 },
2287 x86_64: {
2288 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002289 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002290 ],
2291 },
2292 },
2293}
2294
Dan Albertdf31aff2016-10-06 15:50:41 -07002295ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002296 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002297 symbol_file: "libstdc++.map.txt",
2298 first_version: "9",
2299}
2300
Dan Willemsenca056d72018-01-08 14:00:24 -08002301// Export these headers for toolbox to process
2302filegroup {
2303 name: "kernel_input_headers",
2304 srcs: [
2305 "kernel/uapi/linux/input.h",
2306 "kernel/uapi/linux/input-event-codes.h",
2307 ],
2308}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002309
2310// Generate a syscall name / number mapping. These objects are text files
2311// (thanks to the -dD -E flags) and not binary files. They will then be
2312// consumed by the genseccomp.py script and converted into C++ code.
2313cc_defaults {
2314 name: "libseccomp_gen_syscall_nrs_defaults",
2315 recovery_available: true,
2316 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2317 cflags: [
2318 "-dD",
2319 "-E",
2320 "-Wall",
2321 "-Werror",
2322 "-nostdinc",
2323 ],
2324}
2325
2326cc_object {
2327 name: "libseccomp_gen_syscall_nrs_arm",
2328 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2329 local_include_dirs: [
2330 "kernel/uapi/asm-arm",
2331 "kernel/uapi",
2332 ],
2333}
2334
2335cc_object {
2336 name: "libseccomp_gen_syscall_nrs_arm64",
2337 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2338 local_include_dirs: [
2339 "kernel/uapi/asm-arm64",
2340 "kernel/uapi",
2341 ],
2342}
2343
2344cc_object {
2345 name: "libseccomp_gen_syscall_nrs_x86",
2346 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2347 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2348 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2349 local_include_dirs: [
2350 "kernel/uapi/asm-x86",
2351 "kernel/uapi",
2352 ],
2353}
2354
2355cc_object {
2356 name: "libseccomp_gen_syscall_nrs_x86_64",
2357 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2358 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2359 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2360 local_include_dirs: [
2361 "kernel/uapi/asm-x86",
2362 "kernel/uapi",
2363 ],
2364}
2365
2366cc_object {
2367 name: "libseccomp_gen_syscall_nrs_mips",
2368 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2369 cflags: [
2370 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2371 ],
2372 local_include_dirs: [
2373 "kernel/uapi/asm-mips",
2374 "kernel/uapi",
2375 ],
2376}
2377
2378cc_object {
2379 name: "libseccomp_gen_syscall_nrs_mips64",
2380 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2381 cflags: [
2382 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2383 ],
2384 local_include_dirs: [
2385 "kernel/uapi/asm-mips",
2386 "kernel/uapi",
2387 ],
2388}
2389
Elliott Hughesae03b122019-09-17 16:37:05 -07002390// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002391python_binary_host {
2392 name: "genseccomp",
2393 main: "tools/genseccomp.py",
2394
2395 srcs: [
2396 "tools/genseccomp.py",
2397 "tools/gensyscalls.py",
2398 ],
2399
2400 data: [
2401 "kernel/uapi/**/*.h",
2402 ],
2403
2404 version: {
2405 py2: {
2406 enabled: true,
2407 },
2408 py3: {
2409 enabled: false,
2410 },
2411 },
2412}
2413
Martijn Coenen0c6de752019-01-02 12:52:51 +01002414python_binary_host {
2415 name: "genfunctosyscallnrs",
2416 main: "tools/genfunctosyscallnrs.py",
2417
2418 srcs: [
2419 "tools/genseccomp.py",
2420 "tools/genfunctosyscallnrs.py",
2421 "tools/gensyscalls.py",
2422 ],
2423
2424 data: [
2425 "kernel/uapi/**/*.h",
2426 ],
2427
2428 version: {
2429 py2: {
2430 enabled: true,
2431 },
2432 py3: {
2433 enabled: false,
2434 },
2435 },
2436}
2437
2438cc_genrule {
2439 name: "func_to_syscall_nrs",
2440 recovery_available: true,
2441 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2442
2443 tools: [ "genfunctosyscallnrs" ],
2444
2445 srcs: [
2446 "SYSCALLS.TXT",
2447 ":libseccomp_gen_syscall_nrs_arm",
2448 ":libseccomp_gen_syscall_nrs_arm64",
2449 ":libseccomp_gen_syscall_nrs_mips",
2450 ":libseccomp_gen_syscall_nrs_mips64",
2451 ":libseccomp_gen_syscall_nrs_x86",
2452 ":libseccomp_gen_syscall_nrs_x86_64",
2453 ],
2454
2455 out: [
2456 "func_to_syscall_nrs.h",
2457 ],
2458}
2459
Martijn Coenenc3752be2019-01-09 16:19:57 +01002460// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2461genrule {
2462 name: "generate_app_zygote_blacklist",
2463 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2464 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2465 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2466}
2467
2468cc_genrule {
2469 name: "libseccomp_policy_app_zygote_sources",
2470 recovery_available: true,
2471 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2472
2473 tools: [ "genseccomp" ],
2474
2475 srcs: [
2476 "SYSCALLS.TXT",
2477 "SECCOMP_WHITELIST_COMMON.TXT",
2478 "SECCOMP_WHITELIST_APP.TXT",
2479 "SECCOMP_BLACKLIST_COMMON.TXT",
2480 ":generate_app_zygote_blacklist",
2481 ":libseccomp_gen_syscall_nrs_arm",
2482 ":libseccomp_gen_syscall_nrs_arm64",
2483 ":libseccomp_gen_syscall_nrs_mips",
2484 ":libseccomp_gen_syscall_nrs_mips64",
2485 ":libseccomp_gen_syscall_nrs_x86",
2486 ":libseccomp_gen_syscall_nrs_x86_64",
2487 ],
2488
2489 out: [
2490 "arm64_app_zygote_policy.cpp",
2491 "arm_app_zygote_policy.cpp",
2492 "mips64_app_zygote_policy.cpp",
2493 "mips_app_zygote_policy.cpp",
2494 "x86_64_app_zygote_policy.cpp",
2495 "x86_app_zygote_policy.cpp",
2496 ],
2497}
2498
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002499cc_genrule {
2500 name: "libseccomp_policy_app_sources",
2501 recovery_available: true,
2502 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2503
2504 tools: [ "genseccomp" ],
2505
2506 srcs: [
2507 "SYSCALLS.TXT",
2508 "SECCOMP_WHITELIST_COMMON.TXT",
2509 "SECCOMP_WHITELIST_APP.TXT",
2510 "SECCOMP_BLACKLIST_COMMON.TXT",
2511 "SECCOMP_BLACKLIST_APP.TXT",
2512 ":libseccomp_gen_syscall_nrs_arm",
2513 ":libseccomp_gen_syscall_nrs_arm64",
2514 ":libseccomp_gen_syscall_nrs_mips",
2515 ":libseccomp_gen_syscall_nrs_mips64",
2516 ":libseccomp_gen_syscall_nrs_x86",
2517 ":libseccomp_gen_syscall_nrs_x86_64",
2518 ],
2519
2520 out: [
2521 "arm64_app_policy.cpp",
2522 "arm_app_policy.cpp",
2523 "mips64_app_policy.cpp",
2524 "mips_app_policy.cpp",
2525 "x86_64_app_policy.cpp",
2526 "x86_app_policy.cpp",
2527 ],
2528}
2529
2530cc_genrule {
2531 name: "libseccomp_policy_system_sources",
2532 recovery_available: true,
2533 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2534
2535 tools: [ "genseccomp" ],
2536
2537 srcs: [
2538 "SYSCALLS.TXT",
2539 "SECCOMP_WHITELIST_COMMON.TXT",
2540 "SECCOMP_WHITELIST_SYSTEM.TXT",
2541 "SECCOMP_BLACKLIST_COMMON.TXT",
2542 ":libseccomp_gen_syscall_nrs_arm",
2543 ":libseccomp_gen_syscall_nrs_arm64",
2544 ":libseccomp_gen_syscall_nrs_mips",
2545 ":libseccomp_gen_syscall_nrs_mips64",
2546 ":libseccomp_gen_syscall_nrs_x86",
2547 ":libseccomp_gen_syscall_nrs_x86_64",
2548 ],
2549
2550 out: [
2551 "arm64_system_policy.cpp",
2552 "arm_system_policy.cpp",
2553 "mips64_system_policy.cpp",
2554 "mips_system_policy.cpp",
2555 "x86_64_system_policy.cpp",
2556 "x86_system_policy.cpp",
2557 ],
2558}
2559
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002560cc_library {
2561 name: "libseccomp_policy",
2562 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002563 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002564 generated_sources: [
2565 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002566 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002567 "libseccomp_policy_system_sources",
2568 ],
2569
2570 srcs: [
2571 "seccomp/seccomp_policy.cpp",
2572 ],
2573
2574 export_include_dirs: ["seccomp/include"],
2575 cflags: [
2576 "-Wall",
2577 "-Werror",
2578 ],
2579 shared: {
2580 shared_libs: ["libbase"],
2581 },
2582 static: {
2583 static_libs: ["libbase"],
2584 },
2585}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002586
2587// This is a temporary library that will use scudo as the native memory
2588// allocator. To use it, add it as the first shared library.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002589cc_defaults {
2590 name: "libc_scudo_wrapper_defaults",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002591 srcs: [
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08002592 "bionic/heap_tagging.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002593 "bionic/malloc_common.cpp",
2594 "bionic/malloc_common_dynamic.cpp",
2595 "bionic/malloc_heapprofd.cpp",
2596 "bionic/malloc_limit.cpp",
2597 "bionic/scudo_wrapper.cpp",
2598 "bionic/__set_errno.cpp",
2599 ],
2600 cflags: ["-DUSE_SCUDO"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002601 shared_libs: ["libscudo_wrapper"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002602
2603 header_libs: ["libc_headers"],
2604
2605 static_libs: ["libasync_safe"],
2606
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002607 arch: {
2608 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002609 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002610 },
2611 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002612 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002613 },
2614 x86: {
2615 srcs: [
2616 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002617 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002618 ],
2619 },
2620 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002621 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002622 },
2623 },
2624
2625 // Mark this library as global so it overrides all the allocation
2626 // definitions properly.
2627 ldflags: ["-Wl,-z,global"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002628}
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002629
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002630cc_library_shared {
2631 name: "libc_scudo",
Anna Trostanetski9981a1d2020-01-20 20:16:29 +00002632 defaults: ["libc_scudo_wrapper_defaults"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002633 vendor_available: true,
2634 stl: "none",
2635 system_shared_libs: [],
2636
2637 allow_undefined_symbols: true,
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002638 // Like libc, disable native coverage for libc_scudo.
2639 native_coverage: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002640}
2641
2642subdirs = [
2643 "bionic/scudo",
2644]