blob: 8717f7b6f4259bd184f870583221b07b51ab9848 [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",
Victor Khimenko8e0707d2020-06-09 21:57:05 +02007 "bionic/exit.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070011 "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]
21
Peter Collingbourne570de332019-12-11 10:00:58 -080022// off64_t/time64_t support on LP32.
Dan Willemsen208ae172015-09-16 16:33:27 -070023// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -070024libc_common_src_files_32 = [
25 "bionic/legacy_32_bit_support.cpp",
26 "bionic/time64.c",
27]
28
Elliott Hughes53cf3482016-08-09 13:06:41 -070029libc_common_flags = [
30 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080031 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070032 "-Wall",
33 "-Wextra",
34 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080035 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070036 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070037 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070038 "-Wframe-larger-than=2048",
Elliott Hughes53cf3482016-08-09 13:06:41 -070039
40 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
41 "-Werror=pointer-to-int-cast",
42 "-Werror=int-to-pointer-cast",
43 "-Werror=type-limits",
44 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080045
46 // Clang's exit-time destructor registration hides __dso_handle, but
47 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
48 "-Wexit-time-destructors",
Mitch Phillipsf3968e82020-01-31 19:57:04 -080049
50 // GWP-ASan requires platform TLS.
51 "-fno-emulated-tls",
Elliott Hughes53cf3482016-08-09 13:06:41 -070052]
53
Dan Willemsen208ae172015-09-16 16:33:27 -070054// Define some common cflags
55// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070056cc_defaults {
57 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080058 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070059 cflags: libc_common_flags,
60 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070061 conlyflags: ["-std=gnu99"],
62 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070063 include_dirs: [
64 "bionic/libc/async_safe/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070065 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070066
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010067 header_libs: [
68 "libc_headers",
69 "gwp_asan_headers",
70 ],
71 export_header_lib_headers: [
72 "libc_headers",
73 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -080074
Colin Cross50c21ab2015-10-31 23:03:05 -070075 stl: "none",
76 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070077 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070078 address: false,
79 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070080 // TODO(b/132640749): Fix broken fuzzer support.
81 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070082 },
Yifan Hong5a39cee2020-01-21 16:43:56 -080083 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090084 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020085 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080086
Yi Konge3d90de2019-02-20 14:28:56 -080087 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
88 // warning since this is intended right now.
89 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070090
91 product_variables: {
92 experimental_mte: {
93 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
94 },
Evgenii Stepanov5a73e032020-04-29 14:59:44 -070095 malloc_zero_contents: {
96 cflags: ["-DSCUDO_ZERO_CONTENTS"],
97 },
98 malloc_pattern_fill_contents: {
99 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
100 },
Steven Morelandfb65ee42020-07-31 00:18:38 +0000101 malloc_not_svelte: {
102 cflags: ["-DUSE_SCUDO"],
103 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700104 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700105}
106
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800107libc_scudo_product_variables = {
108 malloc_not_svelte: {
109 cflags: ["-DUSE_SCUDO"],
110 whole_static_libs: ["libscudo"],
111 exclude_static_libs: [
112 "libjemalloc5",
113 "libc_jemalloc_wrapper",
114 ],
115 },
116}
117
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700118// Defaults for native allocator libs/includes to make it
119// easier to change.
Christopher Ferris062eba22020-01-31 22:40:45 -0800120// To disable scudo for the non-svelte config remove the line:
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800121// product_variables: libc_scudo_product_variables,
Christopher Ferris062eba22020-01-31 22:40:45 -0800122// in the cc_defaults below.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700123// ========================================================
124cc_defaults {
125 name: "libc_native_allocator_defaults",
126
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700127 whole_static_libs: [
128 "libjemalloc5",
129 "libc_jemalloc_wrapper",
130 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800131 header_libs: ["gwp_asan_headers"],
Christopher Ferris062eba22020-01-31 22:40:45 -0800132 product_variables: libc_scudo_product_variables,
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700133}
134
135// Functions not implemented by jemalloc directly, or that need to
136// be modified for Android.
137cc_library_static {
138 name: "libc_jemalloc_wrapper",
139 defaults: ["libc_defaults"],
140 srcs: ["bionic/jemalloc_wrapper.cpp"],
141 cflags: ["-fvisibility=hidden"],
142
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800143 // Used to pull in the jemalloc include directory so that if the
144 // library is removed, the include directory is also removed.
145 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700146}
147
Dan Willemsen208ae172015-09-16 16:33:27 -0700148// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700149// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700150// ========================================================
151//
Ryan Prichard249757b2019-11-01 17:18:28 -0700152// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
153// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
154// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
155// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700156
157cc_library_static {
158
Colin Crossa3f9fca2016-01-11 13:20:55 -0800159 srcs: [
160 "bionic/__libc_init_main_thread.cpp",
161 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700162 "bionic/bionic_call_ifunc_resolver.cpp",
163 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800164 ],
165 arch: {
166 arm64: {
167 srcs: ["arch-arm64/bionic/__set_tls.c"],
168 },
169 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700170 srcs: [
171 "arch-x86/bionic/__libc_init_sysinfo.cpp",
172 "arch-x86/bionic/__set_tls.cpp",
173 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800174 },
175 x86_64: {
176 srcs: ["arch-x86_64/bionic/__set_tls.c"],
177 },
178 },
179
Colin Cross50c21ab2015-10-31 23:03:05 -0700180 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700181 cflags: ["-fno-stack-protector", "-ffreestanding"],
182 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700183}
184
Ryan Prichard249757b2019-11-01 17:18:28 -0700185// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
186// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
187// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800188
189cc_library_static {
190 name: "libc_init_static",
191 defaults: ["libc_defaults"],
192 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700193 cflags: [
194 "-fno-stack-protector",
195
196 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
197 // from the linker before ifunc resolvers have made string.h functions available.
198 "-ffreestanding",
199 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800200}
201
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700202cc_library_static {
203 name: "libc_init_dynamic",
204 defaults: ["libc_defaults"],
205 srcs: ["bionic/libc_init_dynamic.cpp"],
206 cflags: ["-fno-stack-protector"],
207}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800208
Dan Willemsen208ae172015-09-16 16:33:27 -0700209// ========================================================
210// libc_tzcode.a - upstream 'tzcode' code
211// ========================================================
212
213cc_library_static {
214
Colin Cross50c21ab2015-10-31 23:03:05 -0700215 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700216 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800217 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700218 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700219 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
220 ],
221
Colin Cross50c21ab2015-10-31 23:03:05 -0700222 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700223 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700224 // Don't use ridiculous amounts of stack.
225 "-DALL_STATE",
226 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
227 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800228 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700229 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700230 // The name of the tm_gmtoff field in our struct tm.
231 "-DTM_GMTOFF=tm_gmtoff",
232 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700233 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700234 // Include `tzname`, `timezone`, and `daylight` globals.
235 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700236 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800237 // Use the empty string (instead of " ") as the timezone abbreviation
238 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700239 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700240 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
241 "-Dlint",
242 ],
243
Dan Willemsen208ae172015-09-16 16:33:27 -0700244 local_include_dirs: ["tzcode/"],
245 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700246}
247
248// ========================================================
249// libc_dns.a - modified NetBSD DNS code
250// ========================================================
251
252cc_library_static {
253
Colin Cross50c21ab2015-10-31 23:03:05 -0700254 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700255 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800256 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700257
258 "upstream-netbsd/lib/libc/isc/ev_streams.c",
259 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700260 ],
261
Colin Cross50c21ab2015-10-31 23:03:05 -0700262 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700263 "-DANDROID_CHANGES",
264 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700265 "-Wno-unused-parameter",
266 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700267 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700268 ],
269
Dan Willemsen208ae172015-09-16 16:33:27 -0700270 local_include_dirs: [
271 "dns/include",
272 "private",
273 "upstream-netbsd/lib/libc/include",
274 "upstream-netbsd/android/include",
275 ],
276
277 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700278}
279
280// ========================================================
281// libc_freebsd.a - upstream FreeBSD C library code
282// ========================================================
283//
284// These files are built with the freebsd-compat.h header file
285// automatically included.
286
287cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700288 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700289 srcs: [
290 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700291 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700292 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
293 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
294 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
295 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700296 "upstream-freebsd/lib/libc/stdlib/qsort.c",
297 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700298 "upstream-freebsd/lib/libc/string/wcpcpy.c",
299 "upstream-freebsd/lib/libc/string/wcpncpy.c",
300 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700301 "upstream-freebsd/lib/libc/string/wcscat.c",
302 "upstream-freebsd/lib/libc/string/wcschr.c",
303 "upstream-freebsd/lib/libc/string/wcscmp.c",
304 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700305 "upstream-freebsd/lib/libc/string/wcscspn.c",
306 "upstream-freebsd/lib/libc/string/wcsdup.c",
307 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700308 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700309 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
310 "upstream-freebsd/lib/libc/string/wcsncat.c",
311 "upstream-freebsd/lib/libc/string/wcsncmp.c",
312 "upstream-freebsd/lib/libc/string/wcsncpy.c",
313 "upstream-freebsd/lib/libc/string/wcsnlen.c",
314 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700315 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700316 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700317 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700318 "upstream-freebsd/lib/libc/string/wcstok.c",
319 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700320 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700321 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700322 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800323 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700324 ],
325 arch: {
326 arm64: {
327 exclude_srcs: [
328 "upstream-freebsd/lib/libc/string/wmemmove.c",
329 ],
330 },
331 x86: {
332 exclude_srcs: [
333 "upstream-freebsd/lib/libc/string/wcschr.c",
334 "upstream-freebsd/lib/libc/string/wcscmp.c",
335 "upstream-freebsd/lib/libc/string/wcslen.c",
336 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700337 "upstream-freebsd/lib/libc/string/wmemcmp.c",
338 "upstream-freebsd/lib/libc/string/wcscat.c",
339 "upstream-freebsd/lib/libc/string/wcscpy.c",
340 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530341 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700342 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700343 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700344 },
345
Colin Cross50c21ab2015-10-31 23:03:05 -0700346 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700347 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700348 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700349 "-include freebsd-compat.h",
350 ],
351
Dan Willemsen208ae172015-09-16 16:33:27 -0700352 local_include_dirs: [
353 "upstream-freebsd/android/include",
354 ],
355
356 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700357}
358
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700359cc_library_static {
360 defaults: ["libc_defaults"],
361 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700362 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700363 ],
364
365 cflags: [
366 "-Wno-sign-compare",
367 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700368 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700369 ],
370
371 local_include_dirs: [
372 "upstream-freebsd/android/include",
373 ],
374
375 name: "libc_freebsd_large_stack",
376}
377
Dan Willemsen208ae172015-09-16 16:33:27 -0700378// ========================================================
379// libc_netbsd.a - upstream NetBSD C library code
380// ========================================================
381//
382// These files are built with the netbsd-compat.h header file
383// automatically included.
384
385cc_library_static {
386
Colin Cross50c21ab2015-10-31 23:03:05 -0700387 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700388 srcs: [
389 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700390 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700391 "upstream-netbsd/lib/libc/gen/psignal.c",
392 "upstream-netbsd/lib/libc/gen/utime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700393 "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",
Elliott Hughes26b06072020-07-31 11:00:10 -0700528 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700529 "upstream-openbsd/lib/libc/stdlib/remque.c",
530 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700531 "upstream-openbsd/lib/libc/stdlib/tfind.c",
532 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800533 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700534 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800535 "upstream-openbsd/lib/libc/string/strcasestr.c",
536 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700537 "upstream-openbsd/lib/libc/string/strcspn.c",
538 "upstream-openbsd/lib/libc/string/strdup.c",
539 "upstream-openbsd/lib/libc/string/strndup.c",
540 "upstream-openbsd/lib/libc/string/strpbrk.c",
541 "upstream-openbsd/lib/libc/string/strsep.c",
542 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700543 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800544 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700545 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700546 "upstream-openbsd/lib/libc/string/wcswidth.c",
547 ],
548
Colin Cross50c21ab2015-10-31 23:03:05 -0700549 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700550 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700551 "-Wno-unused-parameter",
552 "-include openbsd-compat.h",
553 ],
554
Dan Willemsen208ae172015-09-16 16:33:27 -0700555 local_include_dirs: [
556 "private",
557 "stdio",
558 "upstream-openbsd/android/include",
559 "upstream-openbsd/lib/libc/include",
560 "upstream-openbsd/lib/libc/gdtoa/",
561 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700562}
563
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700564cc_library_static {
565 name: "libc_openbsd_large_stack",
566 defaults: ["libc_defaults"],
567 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700568 "stdio/vfprintf.cpp",
569 "stdio/vfwprintf.cpp",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800570 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700571 ],
572 cflags: [
573 "-include openbsd-compat.h",
574 "-Wno-sign-compare",
575 "-Wframe-larger-than=5000",
576 ],
577
578 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700579 "upstream-openbsd/android/include/",
580 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700581 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700582 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700583 ],
584}
585
Dan Willemsen208ae172015-09-16 16:33:27 -0700586// ========================================================
587// libc_openbsd.a - upstream OpenBSD C library code
588// ========================================================
589//
590// These files are built with the openbsd-compat.h header file
591// automatically included.
592cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700593 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700594 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800595 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700596 "upstream-openbsd/lib/libc/crypt/arc4random.c",
597 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
598
599 // May be overriden by per-arch optimized versions
600 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700601 "upstream-openbsd/lib/libc/string/memrchr.c",
602 "upstream-openbsd/lib/libc/string/stpcpy.c",
603 "upstream-openbsd/lib/libc/string/stpncpy.c",
604 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700605 "upstream-openbsd/lib/libc/string/strcpy.c",
606 "upstream-openbsd/lib/libc/string/strlcat.c",
607 "upstream-openbsd/lib/libc/string/strlcpy.c",
608 "upstream-openbsd/lib/libc/string/strncat.c",
609 "upstream-openbsd/lib/libc/string/strncmp.c",
610 "upstream-openbsd/lib/libc/string/strncpy.c",
611 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700612
613 arch: {
614 arm: {
615 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700616 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800617 "upstream-openbsd/lib/libc/string/stpcpy.c",
618 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700619 ],
620 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700621 arm64: {
622 exclude_srcs: [
623 "upstream-openbsd/lib/libc/string/memchr.c",
Peter Collingbourne2361d4e2020-06-03 16:55:37 -0700624 "upstream-openbsd/lib/libc/string/memrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700625 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700626 "upstream-openbsd/lib/libc/string/strcpy.c",
627 "upstream-openbsd/lib/libc/string/strncmp.c",
628 ],
629 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700630 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800631 exclude_srcs: [
632 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800633 "upstream-openbsd/lib/libc/string/memrchr.c",
634 "upstream-openbsd/lib/libc/string/stpcpy.c",
635 "upstream-openbsd/lib/libc/string/stpncpy.c",
636 "upstream-openbsd/lib/libc/string/strcat.c",
637 "upstream-openbsd/lib/libc/string/strcpy.c",
638 "upstream-openbsd/lib/libc/string/strncmp.c",
639 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700640 "upstream-openbsd/lib/libc/string/strlcat.c",
641 "upstream-openbsd/lib/libc/string/strlcpy.c",
642 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800643 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700644 },
645
646 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800647 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800648 "upstream-openbsd/lib/libc/string/stpcpy.c",
649 "upstream-openbsd/lib/libc/string/stpncpy.c",
650 "upstream-openbsd/lib/libc/string/strcat.c",
651 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800652 "upstream-openbsd/lib/libc/string/strncat.c",
653 "upstream-openbsd/lib/libc/string/strncmp.c",
654 "upstream-openbsd/lib/libc/string/strncpy.c",
655 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700656 },
657 },
658
Colin Cross50c21ab2015-10-31 23:03:05 -0700659 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700660 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700661 "-Wno-unused-parameter",
662 "-include openbsd-compat.h",
663 ],
664
Dan Willemsen208ae172015-09-16 16:33:27 -0700665 local_include_dirs: [
666 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700667 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700668 ],
669
670 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700671}
672
673// ========================================================
674// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
675// ========================================================
676//
677// These files are built with the openbsd-compat.h header file
678// automatically included.
679
680cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700681 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700682 srcs: [
683 "upstream-openbsd/android/gdtoa_support.cpp",
684 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
685 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
686 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
687 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
688 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
689 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
690 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
691 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
692 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
693 "upstream-openbsd/lib/libc/gdtoa/misc.c",
694 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
695 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
696 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
697 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
698 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
699 "upstream-openbsd/lib/libc/gdtoa/sum.c",
700 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
701 ],
702 multilib: {
703 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800704 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700705 },
706 },
707
Colin Cross50c21ab2015-10-31 23:03:05 -0700708 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700709 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700710 "-include openbsd-compat.h",
711 ],
712
Dan Willemsen208ae172015-09-16 16:33:27 -0700713 local_include_dirs: [
714 "private",
715 "upstream-openbsd/android/include",
716 "upstream-openbsd/lib/libc/include",
717 ],
718
719 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700720}
721
722// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700723// libc_fortify.a - container for our FORITFY
724// implementation details
725// ========================================================
726cc_library_static {
727 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700728 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700729
730 name: "libc_fortify",
731
732 // Disable FORTIFY for the compilation of these, so we don't end up having
733 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800734 cflags: [
735 "-U_FORTIFY_SOURCE",
736 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
737 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700738
739 arch: {
740 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800741 cflags: [
742 "-DNO___MEMCPY_CHK",
743 "-DRENAME___STRCAT_CHK",
744 "-DRENAME___STRCPY_CHK",
745 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700746 srcs: [
747 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800748
749 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
750 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
751
752 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
753 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
754
755 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
756 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
757
758 "arch-arm/krait/bionic/__strcat_chk.S",
759 "arch-arm/krait/bionic/__strcpy_chk.S",
760
761 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
762 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
763
Haibo Huang01bfd892018-12-03 15:05:16 -0800764 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
765 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700766 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700767 },
768 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700769 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700770 srcs: [
771 "arch-arm64/generic/bionic/__memcpy_chk.S",
772 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700773 },
774 },
775}
776
777// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700778// libc_bionic.a - home-grown C library code
779// ========================================================
780
781cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700782 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700783 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800784 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700785 "bionic/sysconf.cpp",
786 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700787 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700788
Josh Gao10ec9282017-04-03 15:13:29 -0700789 // The following must not be statically linked into libc_ndk.a, because
790 // debuggerd will look for the abort message in libc.so's copy.
791 "bionic/android_set_abort_message.cpp",
792
Dan Willemsen208ae172015-09-16 16:33:27 -0700793 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800794 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700795 "bionic/strnlen.c",
796 "bionic/strrchr.cpp",
797 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700798
799 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700800 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700801 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700802 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800803 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700804 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800805 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800806 "arch-arm/generic/bionic/stpcpy.c",
807 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800808 "arch-arm/generic/bionic/strcmp.S",
809 "arch-arm/generic/bionic/strcpy.S",
810 "arch-arm/generic/bionic/strlen.c",
811
Ryan Prichard45024fe2018-12-30 21:10:26 -0800812 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700813 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700814 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700815 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700816 "arch-arm/bionic/atomics_arm.c",
817 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800818 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700819 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700820 "arch-arm/bionic/setjmp.S",
821 "arch-arm/bionic/syscall.S",
822 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800823
824 "arch-arm/cortex-a15/bionic/memcpy.S",
825 "arch-arm/cortex-a15/bionic/memmove.S",
826 "arch-arm/cortex-a15/bionic/memset.S",
827 "arch-arm/cortex-a15/bionic/stpcpy.S",
828 "arch-arm/cortex-a15/bionic/strcat.S",
829 "arch-arm/cortex-a15/bionic/strcmp.S",
830 "arch-arm/cortex-a15/bionic/strcpy.S",
831 "arch-arm/cortex-a15/bionic/strlen.S",
832
833 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800834 "arch-arm/cortex-a7/bionic/memset.S",
835
836 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800837 "arch-arm/cortex-a9/bionic/memset.S",
838 "arch-arm/cortex-a9/bionic/stpcpy.S",
839 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800840 "arch-arm/cortex-a9/bionic/strcpy.S",
841 "arch-arm/cortex-a9/bionic/strlen.S",
842
843 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800844 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800845
846 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800847
Haibo Huang01bfd892018-12-03 15:05:16 -0800848 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800849
850 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700851 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700852 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700853 arm64: {
854 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700855 "arch-arm64/generic/bionic/memcpy.S",
856 "arch-arm64/generic/bionic/memmove.S",
857 "arch-arm64/generic/bionic/memset.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700858 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800859
860 "arch-arm64/bionic/__bionic_clone.S",
861 "arch-arm64/bionic/_exit_with_stack_teardown.S",
862 "arch-arm64/bionic/setjmp.S",
863 "arch-arm64/bionic/syscall.S",
864 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700865 ],
866 exclude_srcs: [
867 "bionic/__memcpy_chk.cpp",
868 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800869 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700870 "bionic/strnlen.c",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800871 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700872 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700873 },
874
Dan Willemsen208ae172015-09-16 16:33:27 -0700875 x86: {
876 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700877 "arch-x86/generic/string/memcmp.S",
878 "arch-x86/generic/string/strcmp.S",
879 "arch-x86/generic/string/strncmp.S",
880 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700881
882 "arch-x86/generic/string/strlcat.c",
883 "arch-x86/generic/string/strlcpy.c",
884 "arch-x86/generic/string/strncat.c",
885 "arch-x86/generic/string/wcscat.c",
886 "arch-x86/generic/string/wcscpy.c",
887 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530888 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700889
Dan Willemsen208ae172015-09-16 16:33:27 -0700890 "arch-x86/atom/string/sse2-memchr-atom.S",
891 "arch-x86/atom/string/sse2-memrchr-atom.S",
892 "arch-x86/atom/string/sse2-strchr-atom.S",
893 "arch-x86/atom/string/sse2-strnlen-atom.S",
894 "arch-x86/atom/string/sse2-strrchr-atom.S",
895 "arch-x86/atom/string/sse2-wcschr-atom.S",
896 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
897 "arch-x86/atom/string/sse2-wcslen-atom.S",
898 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700899 "arch-x86/silvermont/string/sse2-memmove-slm.S",
900 "arch-x86/silvermont/string/sse2-memset-slm.S",
901 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
902 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
903 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
904 "arch-x86/silvermont/string/sse2-strlen-slm.S",
905 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800906
907 "arch-x86/bionic/__bionic_clone.S",
908 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800909 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800910 "arch-x86/bionic/__restore.S",
911 "arch-x86/bionic/setjmp.S",
912 "arch-x86/bionic/syscall.S",
913 "arch-x86/bionic/vfork.S",
Ryan Pricharda992a062020-04-18 02:59:24 -0700914 "arch-x86/bionic/__x86.get_pc_thunk.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700915
916 // ssse3 functions
917 "arch-x86/atom/string/ssse3-strcat-atom.S",
918 "arch-x86/atom/string/ssse3-strcmp-atom.S",
919 "arch-x86/atom/string/ssse3-strlcat-atom.S",
920 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
921 "arch-x86/atom/string/ssse3-strncat-atom.S",
922 "arch-x86/atom/string/ssse3-strncmp-atom.S",
923 "arch-x86/atom/string/ssse3-wcscat-atom.S",
924 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
925
926 // sse4 functions
927 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
928 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
929
930 // atom functions
931 "arch-x86/atom/string/sse2-memset-atom.S",
932 "arch-x86/atom/string/sse2-strlen-atom.S",
933 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800934 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700935 "arch-x86/atom/string/ssse3-strcpy-atom.S",
936 "arch-x86/atom/string/ssse3-strncpy-atom.S",
937 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530938
939 // avx2 functions
940 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700941 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700942
943 exclude_srcs: [
944 "bionic/strchr.cpp",
945 "bionic/strnlen.c",
946 "bionic/strrchr.cpp",
947 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700948 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700949 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700950 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700951 "arch-x86_64/string/sse2-memmove-slm.S",
952 "arch-x86_64/string/sse2-memset-slm.S",
953 "arch-x86_64/string/sse2-stpcpy-slm.S",
954 "arch-x86_64/string/sse2-stpncpy-slm.S",
955 "arch-x86_64/string/sse2-strcat-slm.S",
956 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700957 "arch-x86_64/string/sse2-strlen-slm.S",
958 "arch-x86_64/string/sse2-strncat-slm.S",
959 "arch-x86_64/string/sse2-strncpy-slm.S",
960 "arch-x86_64/string/sse4-memcmp-slm.S",
961 "arch-x86_64/string/ssse3-strcmp-slm.S",
962 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530963 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800964
965 "arch-x86_64/bionic/__bionic_clone.S",
966 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
967 "arch-x86_64/bionic/__restore_rt.S",
968 "arch-x86_64/bionic/setjmp.S",
969 "arch-x86_64/bionic/syscall.S",
970 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700971 ],
972 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700973 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700974
Colin Cross50c21ab2015-10-31 23:03:05 -0700975 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700976 include_dirs: ["bionic/libstdc++/include"],
977 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700978}
979
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000980genrule {
981 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -0800982 out: ["generated_android_ids.h"],
983 srcs: [":android_filesystem_config_header"],
984 tool_files: ["fs_config_generator.py"],
985 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000986}
987
Dan Willemsen268a6732015-10-15 14:49:45 -0700988// ========================================================
989// libc_bionic_ndk.a- The portions of libc_bionic that can
990// be safely used in libc_ndk.a (no troublesome global data
991// or constructors).
992// ========================================================
993cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700994 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700995 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -0700996 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -0700997 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -0700998 "bionic/__cmsg_nxthdr.cpp",
999 "bionic/__errno.cpp",
1000 "bionic/__gnu_basename.cpp",
1001 "bionic/__libc_current_sigrtmax.cpp",
1002 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001003 "bionic/abort.cpp",
1004 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001005 "bionic/access.cpp",
1006 "bionic/arpa_inet.cpp",
1007 "bionic/assert.cpp",
1008 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001009 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001010 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001011 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001012 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001013 "bionic/bionic_time_conversions.cpp",
1014 "bionic/brk.cpp",
1015 "bionic/c16rtomb.cpp",
1016 "bionic/c32rtomb.cpp",
1017 "bionic/chmod.cpp",
1018 "bionic/chown.cpp",
1019 "bionic/clearenv.cpp",
1020 "bionic/clock.cpp",
1021 "bionic/clock_getcpuclockid.cpp",
1022 "bionic/clock_nanosleep.cpp",
1023 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001024 "bionic/ctype.cpp",
1025 "bionic/dirent.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001026 "bionic/dup.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001027 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001028 "bionic/error.cpp",
Josh Gao7de41242020-04-29 17:08:46 -07001029 "bionic/eventfd.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001030 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001031 "bionic/faccessat.cpp",
1032 "bionic/fchmod.cpp",
1033 "bionic/fchmodat.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001034 "bionic/fcntl.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001035 "bionic/fdsan.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001036 "bionic/fdtrack.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001037 "bionic/ffs.cpp",
1038 "bionic/fgetxattr.cpp",
1039 "bionic/flistxattr.cpp",
1040 "bionic/flockfile.cpp",
1041 "bionic/fpclassify.cpp",
1042 "bionic/fsetxattr.cpp",
1043 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001044 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001045 "bionic/futimens.cpp",
1046 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001047 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001048 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001049 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001050 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001051 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001052 "bionic/getpgrp.cpp",
1053 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001054 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001055 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001056 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001057 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001058 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001059 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001060 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001061 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001062 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001063 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001064 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001065 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001066 "bionic/lchown.cpp",
1067 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001068 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001069 "bionic/libgen.cpp",
1070 "bionic/link.cpp",
1071 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001072 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001073 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001074 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001075 "bionic/mbrtoc16.cpp",
1076 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001077 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001078 "bionic/mempcpy.cpp",
1079 "bionic/mkdir.cpp",
1080 "bionic/mkfifo.cpp",
1081 "bionic/mknod.cpp",
1082 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001083 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001084 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001085 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001086 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001087 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001088 "bionic/open.cpp",
1089 "bionic/pathconf.cpp",
1090 "bionic/pause.cpp",
1091 "bionic/pipe.cpp",
1092 "bionic/poll.cpp",
1093 "bionic/posix_fadvise.cpp",
1094 "bionic/posix_fallocate.cpp",
1095 "bionic/posix_madvise.cpp",
1096 "bionic/posix_timers.cpp",
1097 "bionic/ptrace.cpp",
1098 "bionic/pty.cpp",
1099 "bionic/raise.cpp",
1100 "bionic/rand.cpp",
1101 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001102 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001103 "bionic/reboot.cpp",
1104 "bionic/recv.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001105 "bionic/recvmsg.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001106 "bionic/rename.cpp",
1107 "bionic/rmdir.cpp",
1108 "bionic/scandir.cpp",
1109 "bionic/sched_getaffinity.cpp",
1110 "bionic/sched_getcpu.cpp",
1111 "bionic/semaphore.cpp",
1112 "bionic/send.cpp",
1113 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001114 "bionic/seteuid.cpp",
1115 "bionic/setpgrp.cpp",
1116 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001117 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001118 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001119 "bionic/sleep.cpp",
Josh Gaob107eab2020-04-29 17:17:56 -07001120 "bionic/socketpair.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001121 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001122 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001123 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001124 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001125 "bionic/string_l.cpp",
1126 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001127 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001128 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001129 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001130 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001131 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001132 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001133 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001134 "bionic/sys_msg.cpp",
1135 "bionic/sys_sem.cpp",
1136 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001137 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001138 "bionic/sys_statfs.cpp",
1139 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001140 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001141 "bionic/sysinfo.cpp",
1142 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001143 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001144 "bionic/system_property_api.cpp",
1145 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001146 "bionic/tdestroy.cpp",
1147 "bionic/termios.cpp",
1148 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001149 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001150 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001151 "bionic/tmpfile.cpp",
1152 "bionic/umount.cpp",
1153 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001154 "bionic/usleep.cpp",
Elliott Hughes9a1d3972020-08-07 15:55:02 -07001155 "bionic/utmp.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001156 "bionic/wait.cpp",
1157 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001158 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001159 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001160 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001161 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001162 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001163
1164 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1165 // which will be overridden by the actual one in libc.so.
1166 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001167 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001168
Dan Willemsen208ae172015-09-16 16:33:27 -07001169 multilib: {
1170 lib32: {
1171 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001172 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001173 },
1174 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001175 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001176 treble_linker_namespaces: {
1177 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001178 },
1179 },
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001180 whole_static_libs: [
1181 "libc_bionic_systrace",
1182 "libsystemproperties",
1183 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001184 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001185 local_include_dirs: ["stdio"],
1186 include_dirs: ["bionic/libstdc++/include"],
1187 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001188 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001189}
1190
Dan Willemsen208ae172015-09-16 16:33:27 -07001191// ========================================================
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001192// libc_bionic_systrace.a
1193// ========================================================
1194
1195cc_library_static {
1196 name: "libc_bionic_systrace",
1197 defaults: ["libc_defaults"],
1198 srcs: [
1199 "bionic/bionic_systrace.cpp",
1200 ],
1201 apex_available: [
1202 "com.android.runtime",
1203 ],
1204}
1205
1206// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001207// libc_pthread.a - pthreads parts that previously lived in
1208// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001209// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001210// pthread_t has changed over the years and has ABI
1211// compatibility issues).
1212// ========================================================
1213
1214cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001215 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001216 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001217 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001218 "bionic/pthread_atfork.cpp",
1219 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001220 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001221 "bionic/pthread_cond.cpp",
1222 "bionic/pthread_create.cpp",
1223 "bionic/pthread_detach.cpp",
1224 "bionic/pthread_equal.cpp",
1225 "bionic/pthread_exit.cpp",
1226 "bionic/pthread_getcpuclockid.cpp",
1227 "bionic/pthread_getschedparam.cpp",
1228 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001229 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001230 "bionic/pthread_join.cpp",
1231 "bionic/pthread_key.cpp",
1232 "bionic/pthread_kill.cpp",
1233 "bionic/pthread_mutex.cpp",
1234 "bionic/pthread_once.cpp",
1235 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001236 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001237 "bionic/pthread_self.cpp",
1238 "bionic/pthread_setname_np.cpp",
1239 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001240 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001241
1242 // The following implementations depend on pthread data or implementation,
1243 // so we can't include them in libc_ndk.a.
1244 "bionic/__cxa_thread_atexit_impl.cpp",
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001245 "bionic/android_unsafe_frame_pointer_chase.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -08001246 "bionic/atexit.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001247 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001248 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001249
Colin Cross50c21ab2015-10-31 23:03:05 -07001250 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001251 include_dirs: ["bionic/libstdc++/include"],
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001252 header_libs: ["bionic_libc_platform_headers"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001253 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001254}
1255
1256// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001257// libc_syscalls.a
1258// ========================================================
1259
Elliott Hughes782c4852019-04-16 12:31:00 -07001260genrule {
1261 name: "syscalls-arm.S",
1262 out: ["syscalls-arm.S"],
1263 srcs: ["SYSCALLS.TXT"],
1264 tool_files: [":bionic-gensyscalls"],
1265 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1266}
1267
1268genrule {
1269 name: "syscalls-arm64.S",
1270 out: ["syscalls-arm64.S"],
1271 srcs: ["SYSCALLS.TXT"],
1272 tool_files: [":bionic-gensyscalls"],
1273 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1274}
1275
1276genrule {
1277 name: "syscalls-x86.S",
1278 out: ["syscalls-x86.S"],
1279 srcs: ["SYSCALLS.TXT"],
1280 tool_files: [":bionic-gensyscalls"],
1281 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1282}
1283
1284genrule {
1285 name: "syscalls-x86_64.S",
1286 out: ["syscalls-x86_64.S"],
1287 srcs: ["SYSCALLS.TXT"],
1288 tool_files: [":bionic-gensyscalls"],
1289 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1290}
1291
Dan Willemsen208ae172015-09-16 16:33:27 -07001292cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001293 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001294 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001295 arch: {
1296 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001297 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001298 },
1299 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001300 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001301 },
1302 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001303 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001304 },
1305 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001306 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001307 },
1308 },
1309 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001310}
1311
1312// ========================================================
1313// libc_aeabi.a
1314// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1315// to avoid infinite recursion. For the other architectures we just build an
1316// empty library to keep this makefile simple.
1317// ========================================================
1318
1319cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001320 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001321 arch: {
1322 arm: {
1323 srcs: ["arch-arm/bionic/__aeabi.c"],
1324 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001325 },
1326 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001327 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001328}
1329
1330// ========================================================
1331// libc_ndk.a
1332// Compatibility library for the NDK. This library contains
1333// all the parts of libc that are safe to statically link.
1334// We can't safely statically link things that can only run
1335// on a certain version of the OS. Examples include
1336// anything that talks to netd (a large portion of the DNS
1337// code) and anything that is dependent on the layout of a
1338// data structure that has changed across releases (such as
1339// pthread_t).
1340// ========================================================
1341
1342cc_library_static {
1343 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001344 defaults: [
1345 "libc_defaults",
1346 "libc_native_allocator_defaults",
1347 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -08001348 ramdisk_available: false,
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001349 srcs: libc_common_src_files + [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001350 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001351 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001352 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001353 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001354 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001355 multilib: {
1356 lib32: {
1357 srcs: libc_common_src_files_32,
1358 },
1359 },
1360 arch: {
1361 arm: {
1362 srcs: [
1363 "arch-arm/bionic/exidx_dynamic.c",
1364 "arch-common/bionic/crtbegin_so.c",
1365 "arch-arm/bionic/atexit_legacy.c",
1366 "arch-common/bionic/crtend_so.S",
1367 ],
1368 whole_static_libs: ["libc_aeabi"],
1369 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001370 },
1371
Colin Cross50c21ab2015-10-31 23:03:05 -07001372 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001373 "-fvisibility=hidden",
1374 "-DLIBC_STATIC",
1375 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001376
1377 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001378 "gwp_asan",
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001379 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001380 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001381 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001382 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001383 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001384 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001385 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001386 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001387 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001388 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001389 "libc_syscalls",
1390 "libc_tzcode",
1391 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001392 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001393 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001394}
1395
1396// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001397// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001398// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001399cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001400 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001401 srcs: libc_common_src_files,
1402 multilib: {
1403 lib32: {
1404 srcs: libc_common_src_files_32,
1405 },
1406 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001407 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001408
1409 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001410 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001411 "libc_bionic",
1412 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001413 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001414 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001415 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001416 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001417 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001418 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001419 "libc_netbsd",
1420 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001421 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001422 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001423 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001424 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001425 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001426 ],
1427
1428 arch: {
1429 arm: {
1430 whole_static_libs: ["libc_aeabi"],
1431 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001432 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001433}
1434
1435// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001436// libc_common.a
1437// ========================================================
1438
1439cc_library_static {
1440 defaults: ["libc_defaults"],
1441 name: "libc_common",
1442
1443 whole_static_libs: [
1444 "libc_nopthread",
1445 "libc_pthread",
1446 ],
1447}
1448
1449// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001450// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001451// ========================================================
1452cc_library_static {
1453 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001454 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001455
Haibo Huangb9244ff2018-08-11 10:12:13 -07001456 arch: {
1457 x86: {
1458 srcs: ["arch-x86/static_function_dispatch.S"],
1459 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001460 arm: {
1461 srcs: ["arch-arm/static_function_dispatch.S"],
1462 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001463 arm64: {
1464 srcs: ["arch-arm64/static_function_dispatch.S"],
1465 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001466 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001467}
1468
1469// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001470// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001471// ========================================================
1472cc_library_static {
1473 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001474 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001475
Haibo Huangb9244ff2018-08-11 10:12:13 -07001476 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001477 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001478 "-fno-stack-protector",
1479 "-fno-jump-tables",
1480 ],
1481 arch: {
1482 x86: {
1483 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1484 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001485 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001486 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001487 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001488 arm64: {
1489 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1490 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001491 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001492}
1493
1494// ========================================================
1495// libc_common_static.a For static binaries.
1496// ========================================================
1497cc_library_static {
1498 defaults: ["libc_defaults"],
1499 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001500
Haibo Huangf71edfa2018-11-12 10:06:56 -08001501 whole_static_libs: [
1502 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001503 "libc_static_dispatch",
1504 ],
1505}
1506
1507// ========================================================
1508// libc_common_shared.a For shared libraries.
1509// ========================================================
1510cc_library_static {
1511 defaults: ["libc_defaults"],
1512 name: "libc_common_shared",
1513
1514 whole_static_libs: [
1515 "libc_common",
1516 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001517 ],
1518}
1519
Ryan Prichard22a6a052019-10-10 23:59:30 -07001520// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1521// executable.
1522cc_library_static {
1523 name: "libc_unwind_static",
1524 defaults: ["libc_defaults"],
1525 cflags: ["-DLIBC_STATIC"],
1526
1527 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1528 arch: {
1529 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1530 arm: {
1531 srcs: ["arch-arm/bionic/exidx_static.c"],
1532 },
1533 },
1534}
1535
Haibo Huangf71edfa2018-11-12 10:06:56 -08001536// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001537// libc_nomalloc.a
1538// ========================================================
1539//
Ryan Prichard249757b2019-11-01 17:18:28 -07001540// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1541// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1542// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001543
1544cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001545 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001546 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001547
Colin Crossa3f9fca2016-01-11 13:20:55 -08001548 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001549 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001550 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001551 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001552 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001553}
1554
dimitryc0c0ef62018-12-05 16:33:52 +01001555filegroup {
1556 name: "libc_sources_shared",
1557 srcs: [
1558 "arch-common/bionic/crtbegin_so.c",
1559 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001560 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001561 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001562 "bionic/icu.cpp",
1563 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001564 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001565 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001566 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001567 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001568 "bionic/ndk_cruft.cpp",
1569 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001570 "bionic/NetdClient.cpp",
1571 "arch-common/bionic/crtend_so.S",
1572 ],
1573}
1574
1575filegroup {
1576 name: "libc_sources_static",
1577 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001578 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001579 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001580 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001581 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001582 ],
1583}
1584
1585filegroup {
1586 name: "libc_sources_shared_arm",
1587 srcs: [
1588 "arch-arm/bionic/exidx_dynamic.c",
1589 "arch-arm/bionic/atexit_legacy.c",
1590 ],
1591}
1592
Dan Willemsen208ae172015-09-16 16:33:27 -07001593// ========================================================
1594// libc.a + libc.so
1595// ========================================================
1596cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001597 defaults: [
1598 "libc_defaults",
1599 "libc_native_allocator_defaults",
1600 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001601 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001602 static_ndk_lib: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001603 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001604 platform_sdk_version: {
1605 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1606 },
1607 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001608 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001609 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001610 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001611 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001612 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001613 "libc_init_static",
1614 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001615 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001616 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001617 },
1618 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001619 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001620 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001621 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001622 "libc_init_dynamic",
1623 "libc_common_shared",
1624 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001625 },
1626
Neil Fullera7db90f2019-04-25 09:28:27 +01001627 required: [
1628 "tzdata",
1629 "tz_version", // Version metadata for tzdata to help debugging.
1630 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001631
Colin Cross4ce94d22016-11-15 13:15:43 -08001632 // Do not pack libc.so relocations; see http://b/20645321 for details.
1633 pack_relocations: false,
1634
dimitry06016f22018-01-05 11:39:28 +01001635 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1636 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1637 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1638 // those new libraries from libgcc.a are not declared external; if that were the case,
1639 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1640 // on the external symbols from the dependent libraries. That would create a "cloaked"
1641 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001642
dimitry06016f22018-01-05 11:39:28 +01001643 shared_libs: [
1644 "ld-android",
1645 "libdl",
1646 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001647 static_libs: [
1648 "libdl_android",
1649 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001650
1651 nocrt: true,
1652
Dan Willemsen208ae172015-09-16 16:33:27 -07001653 arch: {
1654 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001655 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001656 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001657 ldflags: ["-Wl,--hash-style=both"],
1658
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001659 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001660
Dan Willemsen208ae172015-09-16 16:33:27 -07001661 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001662 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001663 // special for arm
1664 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichard379e05f2020-04-01 20:10:07 -07001665
1666 whole_static_libs: [ "libunwind_llvm" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001667 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001668
1669 // Arm 32 bit does not produce complete exidx unwind information
1670 // so keep the .debug_frame which is relatively small and does
1671 // include needed unwind information.
1672 // See b/132992102 for details.
1673 strip: {
1674 keep_symbols_and_debug_frame: true,
1675 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001676 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001677 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001678 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001679
1680 // Leave the symbols in the shared library so that stack unwinders can produce
1681 // meaningful name resolution.
1682 strip: {
1683 keep_symbols: true,
1684 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001685
Ryan Prichard379e05f2020-04-01 20:10:07 -07001686 shared: {
1687 whole_static_libs: [ "libgcc_stripped" ],
1688 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001689 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001690 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001691 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001692 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001693 ldflags: ["-Wl,--hash-style=both"],
1694
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001695 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001696
1697 // Leave the symbols in the shared library so that stack unwinders can produce
1698 // meaningful name resolution.
1699 strip: {
1700 keep_symbols: true,
1701 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001702
Ryan Prichard379e05f2020-04-01 20:10:07 -07001703 shared: {
1704 whole_static_libs: [ "libgcc_stripped" ],
1705 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001706 },
1707 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001708 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001709
1710 // Leave the symbols in the shared library so that stack unwinders can produce
1711 // meaningful name resolution.
1712 strip: {
1713 keep_symbols: true,
1714 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001715
Ryan Prichard379e05f2020-04-01 20:10:07 -07001716 shared: {
1717 whole_static_libs: [ "libgcc_stripped" ],
1718 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001719 },
1720 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001721
1722 stubs: {
1723 symbol_file: "libc.map.txt",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001724 versions: [
1725 "29",
Jooyung Handbfa0742020-03-30 13:18:44 +09001726 "R",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001727 "10000",
1728 ],
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001729 },
Vic Yang6903fb82019-01-14 11:34:39 -08001730
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001731 apex_available: [
1732 "//apex_available:platform",
1733 "com.android.runtime",
1734 ],
1735
Vic Yang03ff4362019-06-24 16:11:37 -07001736 // Sorting bss symbols by size usually results in less dirty pages at run
1737 // time, because small symbols are grouped together.
1738 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001739}
1740
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001741genrule {
1742 name: "libc.arm.map",
1743 out: ["libc.arm.map"],
1744 srcs: ["libc.map.txt"],
1745 tool_files: [":bionic-generate-version-script"],
1746 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1747}
1748
1749genrule {
1750 name: "libc.arm64.map",
1751 out: ["libc.arm64.map"],
1752 srcs: ["libc.map.txt"],
1753 tool_files: [":bionic-generate-version-script"],
1754 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1755}
1756
1757genrule {
1758 name: "libc.x86.map",
1759 out: ["libc.x86.map"],
1760 srcs: ["libc.map.txt"],
1761 tool_files: [":bionic-generate-version-script"],
1762 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1763}
1764
1765genrule {
1766 name: "libc.x86_64.map",
1767 out: ["libc.x86_64.map"],
1768 srcs: ["libc.map.txt"],
1769 tool_files: [":bionic-generate-version-script"],
1770 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1771}
1772
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001773// Headers that only other parts of the platform can include.
1774cc_library_headers {
1775 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001776 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001777 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001778 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001779 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001780 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001781 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001782 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001783 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001784 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001785 "//system/core/debuggerd:__subpackages__",
Peter Collingbourne6e316e62020-04-07 14:09:52 -07001786 "//system/core/libunwindstack:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001787 "//system/memory/libmemunreachable:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001788 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001789 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001790 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001791 ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001792 recovery_available: true,
1793 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001794 export_include_dirs: [
1795 "platform",
1796 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001797 system_shared_libs: [],
1798 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001799 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001800
1801 apex_available: [
1802 "//apex_available:platform",
1803 "com.android.runtime",
1804 "com.android.art.release", // from libdexfile_external
1805 "com.android.art.debug", // from libdexfile_external
1806 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001807}
1808
Logan Chien17af91b2019-01-15 21:19:56 +08001809cc_library_headers {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001810 // Internal lib for use in libc_headers. Since we cannot intersect arch{}
1811 // and target{} in the same module, this one specifies the arch-dependent
1812 // include paths, and then libc_headers filters by target so that the
1813 // headers only are included for Bionic targets.
1814 name: "libc_headers_arch",
1815 visibility: ["//visibility:private"],
Logan Chien17af91b2019-01-15 21:19:56 +08001816
1817 host_supported: true,
1818 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001819 ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001820 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001821 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001822 apex_available: [
1823 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001824 "//apex_available:anyapex",
1825 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001826 // used by most APEXes indirectly via libunwind_llvm
1827 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001828
1829 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001830 stl: "none",
1831 system_shared_libs: [],
1832
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001833 // The build system generally requires that any dependencies of a target
1834 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1835 // to 1 we let targets with an sdk_version that need to depend on the libc
1836 // headers but cannot depend on libc itself due to circular dependencies
1837 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1838 // is correct because the headers can support any sdk_version.
1839 sdk_version: "1",
1840
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001841 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001842 "include",
1843 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001844 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001845 "kernel/android/uapi",
1846 ],
1847
1848 arch: {
1849 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001850 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001851 },
1852 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001853 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001854 },
Logan Chien17af91b2019-01-15 21:19:56 +08001855 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001856 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001857 },
1858 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001859 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001860 },
1861 },
1862}
1863
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001864cc_library_headers {
1865 name: "libc_headers",
1866 host_supported: true,
1867 native_bridge_supported: true,
1868 vendor_available: true,
1869 ramdisk_available: true,
1870 recovery_available: true,
1871 sdk_version: "1",
1872
1873 apex_available: [
1874 "//apex_available:platform",
1875 "//apex_available:anyapex",
1876 ],
1877 // used by most APEXes indirectly via libunwind_llvm
1878 min_sdk_version: "apex_inherit",
1879 visibility: [
1880 "//bionic:__subpackages__", // visible to bionic
1881 // ... and only to these places (b/152668052)
1882 "//external/arm-optimized-routines",
1883 "//external/gwp_asan",
1884 "//external/jemalloc_new",
1885 "//external/libunwind_llvm",
1886 "//external/scudo",
1887 "//system/core/property_service/libpropertyinfoparser",
1888 "//system/extras/toolchain-extras",
1889 // TODO(b/153662223): Clean up these users that needed visibility when
1890 // the implicit addition of system Bionic paths was removed.
1891 "//art/tools/cpp-define-generator",
1892 "//external/boringssl",
1893 "//external/minijail",
1894 ],
1895
1896 stl: "none",
1897 no_libcrt: true,
1898 system_shared_libs: [],
1899
1900 target: {
1901 android: {
1902 header_libs: ["libc_headers_arch"],
1903 export_header_lib_headers: ["libc_headers_arch"],
1904 },
1905 linux_bionic: {
1906 header_libs: ["libc_headers_arch"],
1907 export_header_lib_headers: ["libc_headers_arch"],
1908 },
1909 }
1910}
1911
Dan Willemsen208ae172015-09-16 16:33:27 -07001912// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001913// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001914// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001915
Dan Willemsen208ae172015-09-16 16:33:27 -07001916cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001917 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001918 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001919 srcs: [
1920 "bionic/__cxa_guard.cpp",
1921 "bionic/__cxa_pure_virtual.cpp",
1922 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001923 ],
1924 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001925 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001926 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001927
Dan Willemsen6b3be172018-12-03 13:57:20 -08001928 static: {
1929 system_shared_libs: [],
1930 },
1931 shared: {
1932 system_shared_libs: ["libc"],
1933 },
1934
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001935 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001936 arch: {
1937 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001938 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001939 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001940 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001941 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001942 },
1943 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001944 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001945 },
1946 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001947 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001948 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001949 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001950 },
1951 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001952 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001953 },
1954 },
1955}
1956
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001957genrule {
1958 name: "libstdc++.arm.map",
1959 out: ["libstdc++.arm.map"],
1960 srcs: ["libstdc++.map.txt"],
1961 tool_files: [":bionic-generate-version-script"],
1962 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1963}
1964
1965genrule {
1966 name: "libstdc++.arm64.map",
1967 out: ["libstdc++.arm64.map"],
1968 srcs: ["libstdc++.map.txt"],
1969 tool_files: [":bionic-generate-version-script"],
1970 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1971}
1972
1973genrule {
1974 name: "libstdc++.x86.map",
1975 out: ["libstdc++.x86.map"],
1976 srcs: ["libstdc++.map.txt"],
1977 tool_files: [":bionic-generate-version-script"],
1978 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1979}
1980
1981genrule {
1982 name: "libstdc++.x86_64.map",
1983 out: ["libstdc++.x86_64.map"],
1984 srcs: ["libstdc++.map.txt"],
1985 tool_files: [":bionic-generate-version-script"],
1986 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1987}
1988
1989// ========================================================
1990// crt object files.
1991// ========================================================
1992
Colin Cross50c21ab2015-10-31 23:03:05 -07001993cc_defaults {
1994 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001995 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001996 vendor_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001997 ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001998 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001999 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002000 apex_available: [
2001 "//apex_available:platform",
2002 "//apex_available:anyapex",
2003 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09002004 // crt* objects are used by most cc_binary/cc_library in "anyapex"
2005 min_sdk_version: "apex_inherit",
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002006 cflags: [
2007 "-Wno-gcc-compat",
2008 "-Wall",
2009 "-Werror",
2010 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002011 sanitize: {
2012 never: true,
2013 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002014}
2015
Colin Cross50c21ab2015-10-31 23:03:05 -07002016cc_defaults {
2017 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002018 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002019
2020 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002021 x86: {
2022 cflags: ["-fPIC"],
2023 },
2024 x86_64: {
2025 cflags: ["-fPIC"],
2026 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002027 },
Colin Crossab179442018-09-27 11:03:22 -07002028 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002029}
2030
Dan Willemsen208ae172015-09-16 16:33:27 -07002031cc_object {
2032 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002033 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002034 local_include_dirs: ["include"],
2035 product_variables: {
2036 platform_sdk_version: {
2037 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2038 },
2039 },
2040 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002041
Colin Cross7d7b3682017-11-03 13:38:40 -07002042 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002043}
2044
Dan Willemsen208ae172015-09-16 16:33:27 -07002045cc_object {
2046 name: "crtbegin_so1",
2047 local_include_dirs: ["include"],
2048 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002049
Colin Cross7d7b3682017-11-03 13:38:40 -07002050 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002051}
2052
Dan Willemsen208ae172015-09-16 16:33:27 -07002053cc_object {
2054 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002055
Colin Cross7d7b3682017-11-03 13:38:40 -07002056 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002057 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002058 "crtbegin_so1",
2059 "crtbrand",
2060 ],
2061}
2062
Dan Willemsen208ae172015-09-16 16:33:27 -07002063cc_object {
2064 name: "crtend_so",
2065 local_include_dirs: ["include"],
2066 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002067
Colin Cross7d7b3682017-11-03 13:38:40 -07002068 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002069}
2070
Dan Willemsen208ae172015-09-16 16:33:27 -07002071cc_object {
2072 name: "crtbegin_static1",
2073 local_include_dirs: ["include"],
2074 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002075 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002076}
2077
Dan Willemsen208ae172015-09-16 16:33:27 -07002078cc_object {
2079 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002080
Colin Cross77d57bf2016-04-11 14:34:18 -07002081 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002082 "crtbegin_static1",
2083 "crtbrand",
2084 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002085 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002086}
2087
Dan Willemsen208ae172015-09-16 16:33:27 -07002088cc_object {
2089 name: "crtbegin_dynamic1",
2090 local_include_dirs: ["include"],
2091 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002092 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002093}
2094
Dan Willemsen208ae172015-09-16 16:33:27 -07002095cc_object {
2096 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002097
Colin Cross77d57bf2016-04-11 14:34:18 -07002098 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002099 "crtbegin_dynamic1",
2100 "crtbrand",
2101 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002102 target: {
2103 linux_bionic: {
2104 generated_sources: ["host_bionic_linker_asm"],
2105 objs: [
2106 "linker_wrapper",
2107 ],
2108 },
2109 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002110 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002111}
2112
Dan Willemsen208ae172015-09-16 16:33:27 -07002113cc_object {
2114 // We rename crtend.o to crtend_android.o to avoid a
2115 // name clash between gcc and bionic.
2116 name: "crtend_android",
2117 local_include_dirs: ["include"],
2118 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002119
Colin Cross50c21ab2015-10-31 23:03:05 -07002120 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002121}
Colin Crossbaa48992016-07-13 11:15:21 -07002122
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002123// ========================================================
2124// NDK headers.
2125// ========================================================
2126
Dan Albert26e1c412018-05-24 14:56:46 -07002127versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002128 name: "common_libc",
2129 from: "include",
2130 to: "",
2131 license: "NOTICE",
2132}
Dan Albert4238a352016-06-28 11:18:05 -07002133
2134ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002135 name: "libc_uapi",
2136 from: "kernel/uapi",
2137 to: "",
2138 srcs: [
2139 "kernel/uapi/asm-generic/**/*.h",
2140 "kernel/uapi/drm/**/*.h",
2141 "kernel/uapi/linux/**/*.h",
2142 "kernel/uapi/misc/**/*.h",
2143 "kernel/uapi/mtd/**/*.h",
2144 "kernel/uapi/rdma/**/*.h",
2145 "kernel/uapi/scsi/**/*.h",
2146 "kernel/uapi/sound/**/*.h",
2147 "kernel/uapi/video/**/*.h",
2148 "kernel/uapi/xen/**/*.h",
2149 ],
Dan Albert92592652016-10-20 01:42:54 -07002150 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002151}
2152
2153ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002154 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002155 from: "kernel/android/uapi/linux",
2156 to: "linux",
2157 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002158 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002159}
2160
2161ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002162 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002163 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002164 to: "scsi",
2165 srcs: ["kernel/android/scsi/**/*.h"],
2166 license: "NOTICE",
2167}
2168
2169ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002170 name: "libc_asm_arm",
2171 from: "kernel/uapi/asm-arm",
2172 to: "arm-linux-androideabi",
2173 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002174 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002175}
2176
2177ndk_headers {
2178 name: "libc_asm_arm64",
2179 from: "kernel/uapi/asm-arm64",
2180 to: "aarch64-linux-android",
2181 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002182 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002183}
2184
Lazar Trsic790d2f72017-11-27 11:54:11 +01002185ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002186 name: "libc_asm_x86",
2187 from: "kernel/uapi/asm-x86",
2188 to: "i686-linux-android",
2189 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002190 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002191}
2192
2193ndk_headers {
2194 name: "libc_asm_x86_64",
2195 from: "kernel/uapi/asm-x86",
2196 to: "x86_64-linux-android",
2197 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002198 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002199}
2200
Dan Albert4238a352016-06-28 11:18:05 -07002201ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002202 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002203 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002204 symbol_file: "libc.map.txt",
2205 first_version: "9",
2206}
2207
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002208llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002209 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002210 symbol_file: "libc.map.txt",
2211 export_headers_as_system: true,
2212 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002213 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002214 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002215 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002216 "kernel/android/uapi",
2217 "kernel/uapi",
2218 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002219 arch: {
2220 arm: {
2221 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002222 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002223 ],
2224 },
2225 arm64: {
2226 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002227 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002228 ],
2229 },
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002230 x86: {
2231 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002232 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002233 ],
2234 },
2235 x86_64: {
2236 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002237 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002238 ],
2239 },
2240 },
2241}
2242
Dan Albertdf31aff2016-10-06 15:50:41 -07002243ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002244 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002245 symbol_file: "libstdc++.map.txt",
2246 first_version: "9",
2247}
2248
Dan Willemsenca056d72018-01-08 14:00:24 -08002249// Export these headers for toolbox to process
2250filegroup {
2251 name: "kernel_input_headers",
2252 srcs: [
2253 "kernel/uapi/linux/input.h",
2254 "kernel/uapi/linux/input-event-codes.h",
2255 ],
2256}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002257
2258// Generate a syscall name / number mapping. These objects are text files
2259// (thanks to the -dD -E flags) and not binary files. They will then be
2260// consumed by the genseccomp.py script and converted into C++ code.
2261cc_defaults {
2262 name: "libseccomp_gen_syscall_nrs_defaults",
2263 recovery_available: true,
2264 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2265 cflags: [
2266 "-dD",
2267 "-E",
2268 "-Wall",
2269 "-Werror",
2270 "-nostdinc",
2271 ],
2272}
2273
2274cc_object {
2275 name: "libseccomp_gen_syscall_nrs_arm",
2276 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2277 local_include_dirs: [
2278 "kernel/uapi/asm-arm",
2279 "kernel/uapi",
2280 ],
2281}
2282
2283cc_object {
2284 name: "libseccomp_gen_syscall_nrs_arm64",
2285 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2286 local_include_dirs: [
2287 "kernel/uapi/asm-arm64",
2288 "kernel/uapi",
2289 ],
2290}
2291
2292cc_object {
2293 name: "libseccomp_gen_syscall_nrs_x86",
2294 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2295 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2296 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2297 local_include_dirs: [
2298 "kernel/uapi/asm-x86",
2299 "kernel/uapi",
2300 ],
2301}
2302
2303cc_object {
2304 name: "libseccomp_gen_syscall_nrs_x86_64",
2305 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2306 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2307 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2308 local_include_dirs: [
2309 "kernel/uapi/asm-x86",
2310 "kernel/uapi",
2311 ],
2312}
2313
Elliott Hughesae03b122019-09-17 16:37:05 -07002314// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002315python_binary_host {
2316 name: "genseccomp",
2317 main: "tools/genseccomp.py",
2318
2319 srcs: [
2320 "tools/genseccomp.py",
2321 "tools/gensyscalls.py",
2322 ],
2323
2324 data: [
2325 "kernel/uapi/**/*.h",
2326 ],
2327
2328 version: {
2329 py2: {
2330 enabled: true,
2331 },
2332 py3: {
2333 enabled: false,
2334 },
2335 },
2336}
2337
Martijn Coenen0c6de752019-01-02 12:52:51 +01002338python_binary_host {
2339 name: "genfunctosyscallnrs",
2340 main: "tools/genfunctosyscallnrs.py",
2341
2342 srcs: [
2343 "tools/genseccomp.py",
2344 "tools/genfunctosyscallnrs.py",
2345 "tools/gensyscalls.py",
2346 ],
2347
2348 data: [
2349 "kernel/uapi/**/*.h",
2350 ],
2351
2352 version: {
2353 py2: {
2354 enabled: true,
2355 },
2356 py3: {
2357 enabled: false,
2358 },
2359 },
2360}
2361
2362cc_genrule {
2363 name: "func_to_syscall_nrs",
2364 recovery_available: true,
2365 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2366
2367 tools: [ "genfunctosyscallnrs" ],
2368
2369 srcs: [
2370 "SYSCALLS.TXT",
2371 ":libseccomp_gen_syscall_nrs_arm",
2372 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002373 ":libseccomp_gen_syscall_nrs_x86",
2374 ":libseccomp_gen_syscall_nrs_x86_64",
2375 ],
2376
2377 out: [
2378 "func_to_syscall_nrs.h",
2379 ],
2380}
2381
Victor Hsiehdbb86702020-06-15 09:29:07 -07002382// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002383genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002384 name: "generate_app_zygote_blocklist",
2385 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2386 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002387 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2388}
2389
2390cc_genrule {
2391 name: "libseccomp_policy_app_zygote_sources",
2392 recovery_available: true,
2393 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2394
2395 tools: [ "genseccomp" ],
2396
2397 srcs: [
2398 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002399 "SECCOMP_ALLOWLIST_COMMON.TXT",
2400 "SECCOMP_ALLOWLIST_APP.TXT",
2401 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002402 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002403 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002404 ":libseccomp_gen_syscall_nrs_arm",
2405 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002406 ":libseccomp_gen_syscall_nrs_x86",
2407 ":libseccomp_gen_syscall_nrs_x86_64",
2408 ],
2409
2410 out: [
2411 "arm64_app_zygote_policy.cpp",
2412 "arm_app_zygote_policy.cpp",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002413 "x86_64_app_zygote_policy.cpp",
2414 "x86_app_zygote_policy.cpp",
2415 ],
2416}
2417
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002418cc_genrule {
2419 name: "libseccomp_policy_app_sources",
2420 recovery_available: true,
2421 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2422
2423 tools: [ "genseccomp" ],
2424
2425 srcs: [
2426 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002427 "SECCOMP_ALLOWLIST_COMMON.TXT",
2428 "SECCOMP_ALLOWLIST_APP.TXT",
2429 "SECCOMP_BLOCKLIST_COMMON.TXT",
2430 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002431 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002432 ":libseccomp_gen_syscall_nrs_arm",
2433 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002434 ":libseccomp_gen_syscall_nrs_x86",
2435 ":libseccomp_gen_syscall_nrs_x86_64",
2436 ],
2437
2438 out: [
2439 "arm64_app_policy.cpp",
2440 "arm_app_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002441 "x86_64_app_policy.cpp",
2442 "x86_app_policy.cpp",
2443 ],
2444}
2445
2446cc_genrule {
2447 name: "libseccomp_policy_system_sources",
2448 recovery_available: true,
2449 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2450
2451 tools: [ "genseccomp" ],
2452
2453 srcs: [
2454 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002455 "SECCOMP_ALLOWLIST_COMMON.TXT",
2456 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2457 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002458 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002459 ":libseccomp_gen_syscall_nrs_arm",
2460 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002461 ":libseccomp_gen_syscall_nrs_x86",
2462 ":libseccomp_gen_syscall_nrs_x86_64",
2463 ],
2464
2465 out: [
2466 "arm64_system_policy.cpp",
2467 "arm_system_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002468 "x86_64_system_policy.cpp",
2469 "x86_system_policy.cpp",
2470 ],
2471}
2472
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002473cc_library {
2474 name: "libseccomp_policy",
2475 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002476 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002477 generated_sources: [
2478 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002479 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002480 "libseccomp_policy_system_sources",
2481 ],
2482
2483 srcs: [
2484 "seccomp/seccomp_policy.cpp",
2485 ],
2486
2487 export_include_dirs: ["seccomp/include"],
2488 cflags: [
2489 "-Wall",
2490 "-Werror",
2491 ],
2492 shared: {
2493 shared_libs: ["libbase"],
2494 },
2495 static: {
2496 static_libs: ["libbase"],
2497 },
2498}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002499
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002500subdirs = [
2501 "bionic/scudo",
2502]