blob: 4d63751f6c8c57fe4e4e4a19204600a9797e04a3 [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",
Peter Collingbourne5d3aa862020-09-11 15:05:17 -070065 "bionic/libc/platform",
Tom Cherry379ed1e2020-09-17 09:36:25 -070066 // For android_filesystem_config.h.
67 "system/core/libcutils/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070068 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070069
Martin Stjernholm82d84bc2020-04-06 20:32:09 +010070 header_libs: [
71 "libc_headers",
72 "gwp_asan_headers",
73 ],
74 export_header_lib_headers: [
75 "libc_headers",
76 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -080077
Colin Cross50c21ab2015-10-31 23:03:05 -070078 stl: "none",
79 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070080 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070081 address: false,
82 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070083 // TODO(b/132640749): Fix broken fuzzer support.
84 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070085 },
Yifan Hong5a39cee2020-01-21 16:43:56 -080086 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -070087 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +090088 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020089 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080090
Yi Konge3d90de2019-02-20 14:28:56 -080091 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
92 // warning since this is intended right now.
93 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070094
95 product_variables: {
96 experimental_mte: {
97 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
98 },
Evgenii Stepanov5a73e032020-04-29 14:59:44 -070099 malloc_zero_contents: {
100 cflags: ["-DSCUDO_ZERO_CONTENTS"],
101 },
102 malloc_pattern_fill_contents: {
103 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
104 },
Steven Morelandfb65ee42020-07-31 00:18:38 +0000105 malloc_not_svelte: {
106 cflags: ["-DUSE_SCUDO"],
107 },
Peter Collingbournee99912f2019-11-01 15:37:00 -0700108 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700109}
110
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800111libc_scudo_product_variables = {
112 malloc_not_svelte: {
113 cflags: ["-DUSE_SCUDO"],
114 whole_static_libs: ["libscudo"],
115 exclude_static_libs: [
116 "libjemalloc5",
117 "libc_jemalloc_wrapper",
118 ],
119 },
120}
121
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700122// Defaults for native allocator libs/includes to make it
123// easier to change.
Christopher Ferris062eba22020-01-31 22:40:45 -0800124// To disable scudo for the non-svelte config remove the line:
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800125// product_variables: libc_scudo_product_variables,
Christopher Ferris062eba22020-01-31 22:40:45 -0800126// in the cc_defaults below.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700127// ========================================================
128cc_defaults {
129 name: "libc_native_allocator_defaults",
130
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700131 whole_static_libs: [
132 "libjemalloc5",
133 "libc_jemalloc_wrapper",
134 ],
Mitch Phillipsf3968e82020-01-31 19:57:04 -0800135 header_libs: ["gwp_asan_headers"],
Christopher Ferris062eba22020-01-31 22:40:45 -0800136 product_variables: libc_scudo_product_variables,
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700137}
138
139// Functions not implemented by jemalloc directly, or that need to
140// be modified for Android.
141cc_library_static {
142 name: "libc_jemalloc_wrapper",
143 defaults: ["libc_defaults"],
144 srcs: ["bionic/jemalloc_wrapper.cpp"],
145 cflags: ["-fvisibility=hidden"],
146
Christopher Ferris4df29ed2020-01-24 18:06:42 -0800147 // Used to pull in the jemalloc include directory so that if the
148 // library is removed, the include directory is also removed.
149 static_libs: ["libjemalloc5"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -0700150}
151
Dan Willemsen208ae172015-09-16 16:33:27 -0700152// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700153// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700154// ========================================================
155//
Ryan Prichard249757b2019-11-01 17:18:28 -0700156// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
157// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
158// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
159// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700160
161cc_library_static {
162
Colin Crossa3f9fca2016-01-11 13:20:55 -0800163 srcs: [
164 "bionic/__libc_init_main_thread.cpp",
165 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700166 "bionic/bionic_call_ifunc_resolver.cpp",
167 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800168 ],
169 arch: {
170 arm64: {
171 srcs: ["arch-arm64/bionic/__set_tls.c"],
172 },
173 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700174 srcs: [
175 "arch-x86/bionic/__libc_init_sysinfo.cpp",
176 "arch-x86/bionic/__set_tls.cpp",
177 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800178 },
179 x86_64: {
180 srcs: ["arch-x86_64/bionic/__set_tls.c"],
181 },
182 },
183
Colin Cross50c21ab2015-10-31 23:03:05 -0700184 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700185 cflags: ["-fno-stack-protector", "-ffreestanding"],
186 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700187}
188
Ryan Prichard249757b2019-11-01 17:18:28 -0700189// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
190// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
191// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800192
193cc_library_static {
194 name: "libc_init_static",
195 defaults: ["libc_defaults"],
196 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700197 cflags: [
198 "-fno-stack-protector",
199
200 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
201 // from the linker before ifunc resolvers have made string.h functions available.
202 "-ffreestanding",
203 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800204}
205
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700206cc_library_static {
207 name: "libc_init_dynamic",
208 defaults: ["libc_defaults"],
209 srcs: ["bionic/libc_init_dynamic.cpp"],
210 cflags: ["-fno-stack-protector"],
211}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800212
Dan Willemsen208ae172015-09-16 16:33:27 -0700213// ========================================================
214// libc_tzcode.a - upstream 'tzcode' code
215// ========================================================
216
217cc_library_static {
218
Colin Cross50c21ab2015-10-31 23:03:05 -0700219 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700220 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800221 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700222 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700223 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
224 ],
225
Colin Cross50c21ab2015-10-31 23:03:05 -0700226 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700227 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700228 // Don't use ridiculous amounts of stack.
229 "-DALL_STATE",
230 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
231 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800232 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700233 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700234 // The name of the tm_gmtoff field in our struct tm.
235 "-DTM_GMTOFF=tm_gmtoff",
236 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700237 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700238 // Include `tzname`, `timezone`, and `daylight` globals.
239 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700240 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800241 // Use the empty string (instead of " ") as the timezone abbreviation
242 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700243 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700244 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
245 "-Dlint",
246 ],
247
Dan Willemsen208ae172015-09-16 16:33:27 -0700248 local_include_dirs: ["tzcode/"],
249 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700250}
251
252// ========================================================
253// libc_dns.a - modified NetBSD DNS code
254// ========================================================
255
256cc_library_static {
257
Colin Cross50c21ab2015-10-31 23:03:05 -0700258 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700259 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800260 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700261
262 "upstream-netbsd/lib/libc/isc/ev_streams.c",
263 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700264 ],
265
Colin Cross50c21ab2015-10-31 23:03:05 -0700266 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700267 "-DANDROID_CHANGES",
268 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700269 "-Wno-unused-parameter",
270 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700271 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700272 ],
273
Dan Willemsen208ae172015-09-16 16:33:27 -0700274 local_include_dirs: [
275 "dns/include",
276 "private",
277 "upstream-netbsd/lib/libc/include",
278 "upstream-netbsd/android/include",
279 ],
280
281 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700282}
283
284// ========================================================
285// libc_freebsd.a - upstream FreeBSD C library code
286// ========================================================
287//
288// These files are built with the freebsd-compat.h header file
289// automatically included.
290
291cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700292 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700293 srcs: [
294 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700295 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700296 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
297 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
298 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
299 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700300 "upstream-freebsd/lib/libc/stdlib/qsort.c",
301 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700302 "upstream-freebsd/lib/libc/string/wcpcpy.c",
303 "upstream-freebsd/lib/libc/string/wcpncpy.c",
304 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700305 "upstream-freebsd/lib/libc/string/wcscat.c",
306 "upstream-freebsd/lib/libc/string/wcschr.c",
307 "upstream-freebsd/lib/libc/string/wcscmp.c",
308 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700309 "upstream-freebsd/lib/libc/string/wcscspn.c",
310 "upstream-freebsd/lib/libc/string/wcsdup.c",
311 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700312 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700313 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
314 "upstream-freebsd/lib/libc/string/wcsncat.c",
315 "upstream-freebsd/lib/libc/string/wcsncmp.c",
316 "upstream-freebsd/lib/libc/string/wcsncpy.c",
317 "upstream-freebsd/lib/libc/string/wcsnlen.c",
318 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700319 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700320 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700321 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700322 "upstream-freebsd/lib/libc/string/wcstok.c",
323 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700324 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700325 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700326 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800327 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700328 ],
329 arch: {
330 arm64: {
331 exclude_srcs: [
332 "upstream-freebsd/lib/libc/string/wmemmove.c",
333 ],
334 },
335 x86: {
336 exclude_srcs: [
337 "upstream-freebsd/lib/libc/string/wcschr.c",
338 "upstream-freebsd/lib/libc/string/wcscmp.c",
339 "upstream-freebsd/lib/libc/string/wcslen.c",
340 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700341 "upstream-freebsd/lib/libc/string/wmemcmp.c",
342 "upstream-freebsd/lib/libc/string/wcscat.c",
343 "upstream-freebsd/lib/libc/string/wcscpy.c",
344 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530345 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700346 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700347 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700348 },
349
Colin Cross50c21ab2015-10-31 23:03:05 -0700350 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700351 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700352 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700353 "-include freebsd-compat.h",
354 ],
355
Dan Willemsen208ae172015-09-16 16:33:27 -0700356 local_include_dirs: [
357 "upstream-freebsd/android/include",
358 ],
359
360 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700361}
362
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700363cc_library_static {
364 defaults: ["libc_defaults"],
365 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700366 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700367 ],
368
369 cflags: [
370 "-Wno-sign-compare",
371 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700372 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700373 ],
374
375 local_include_dirs: [
376 "upstream-freebsd/android/include",
377 ],
378
379 name: "libc_freebsd_large_stack",
380}
381
Dan Willemsen208ae172015-09-16 16:33:27 -0700382// ========================================================
383// libc_netbsd.a - upstream NetBSD C library code
384// ========================================================
385//
386// These files are built with the netbsd-compat.h header file
387// automatically included.
388
389cc_library_static {
390
Colin Cross50c21ab2015-10-31 23:03:05 -0700391 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700392 srcs: [
393 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700394 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700395 "upstream-netbsd/lib/libc/gen/psignal.c",
396 "upstream-netbsd/lib/libc/gen/utime.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700397 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
398 "upstream-netbsd/lib/libc/regex/regcomp.c",
399 "upstream-netbsd/lib/libc/regex/regerror.c",
400 "upstream-netbsd/lib/libc/regex/regexec.c",
401 "upstream-netbsd/lib/libc/regex/regfree.c",
402 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700403 "upstream-netbsd/lib/libc/stdlib/drand48.c",
404 "upstream-netbsd/lib/libc/stdlib/erand48.c",
405 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
406 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700407 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
408 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
409 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
410 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
411 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
412 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
413 "upstream-netbsd/lib/libc/stdlib/seed48.c",
414 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700415 ],
416 multilib: {
417 lib32: {
418 // LP32 cruft
419 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
420 },
421 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700422 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700423 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800424 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700425 "-DPOSIX_MISTAKE",
426 "-include netbsd-compat.h",
427 ],
428
Dan Willemsen208ae172015-09-16 16:33:27 -0700429 local_include_dirs: [
430 "upstream-netbsd/android/include",
431 "upstream-netbsd/lib/libc/include",
432 ],
433
434 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700435}
436
437// ========================================================
438// libc_openbsd_ndk.a - upstream OpenBSD C library code
439// that can be safely included in the libc_ndk.a (doesn't
440// contain any troublesome global data or constructors).
441// ========================================================
442//
443// These files are built with the openbsd-compat.h header file
444// automatically included.
445
446cc_library_static {
447 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700448 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700449 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700450 "upstream-openbsd/lib/libc/gen/alarm.c",
451 "upstream-openbsd/lib/libc/gen/ctype_.c",
452 "upstream-openbsd/lib/libc/gen/daemon.c",
453 "upstream-openbsd/lib/libc/gen/err.c",
454 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700455 "upstream-openbsd/lib/libc/gen/fnmatch.c",
456 "upstream-openbsd/lib/libc/gen/ftok.c",
457 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700458 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700459 "upstream-openbsd/lib/libc/gen/verr.c",
460 "upstream-openbsd/lib/libc/gen/verrx.c",
461 "upstream-openbsd/lib/libc/gen/vwarn.c",
462 "upstream-openbsd/lib/libc/gen/vwarnx.c",
463 "upstream-openbsd/lib/libc/gen/warn.c",
464 "upstream-openbsd/lib/libc/gen/warnx.c",
465 "upstream-openbsd/lib/libc/locale/btowc.c",
466 "upstream-openbsd/lib/libc/locale/mbrlen.c",
467 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
468 "upstream-openbsd/lib/libc/locale/mbtowc.c",
469 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700470 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
471 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700472 "upstream-openbsd/lib/libc/locale/wcstoll.c",
473 "upstream-openbsd/lib/libc/locale/wcstombs.c",
474 "upstream-openbsd/lib/libc/locale/wcstoul.c",
475 "upstream-openbsd/lib/libc/locale/wcstoull.c",
476 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
477 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
478 "upstream-openbsd/lib/libc/locale/wctob.c",
479 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700480 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700481 "upstream-openbsd/lib/libc/net/htonl.c",
482 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700483 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
484 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
485 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700486 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
487 "upstream-openbsd/lib/libc/net/inet_ntop.c",
488 "upstream-openbsd/lib/libc/net/inet_pton.c",
489 "upstream-openbsd/lib/libc/net/ntohl.c",
490 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800491 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700492 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700493 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
494 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700495 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700496 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700497 "upstream-openbsd/lib/libc/stdio/fputwc.c",
498 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700499 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700500 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700501 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700502 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700503 "upstream-openbsd/lib/libc/stdio/makebuf.c",
504 "upstream-openbsd/lib/libc/stdio/mktemp.c",
505 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
506 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700507 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700508 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700509 "upstream-openbsd/lib/libc/stdio/tempnam.c",
510 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
511 "upstream-openbsd/lib/libc/stdio/ungetc.c",
512 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
513 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
514 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700515 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
516 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
517 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700518 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700519 "upstream-openbsd/lib/libc/stdio/wsetup.c",
520 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800521 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700522 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700523 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700524 "upstream-openbsd/lib/libc/stdlib/insque.c",
525 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
526 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
527 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800528 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700529 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800530 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700531 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Elliott Hughes26b06072020-07-31 11:00:10 -0700532 "upstream-openbsd/lib/libc/stdlib/recallocarray.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700533 "upstream-openbsd/lib/libc/stdlib/remque.c",
534 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700535 "upstream-openbsd/lib/libc/stdlib/tfind.c",
536 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800537 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700538 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800539 "upstream-openbsd/lib/libc/string/strcasestr.c",
540 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700541 "upstream-openbsd/lib/libc/string/strcspn.c",
542 "upstream-openbsd/lib/libc/string/strdup.c",
543 "upstream-openbsd/lib/libc/string/strndup.c",
544 "upstream-openbsd/lib/libc/string/strpbrk.c",
545 "upstream-openbsd/lib/libc/string/strsep.c",
546 "upstream-openbsd/lib/libc/string/strspn.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700547 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800548 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700549 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700550 "upstream-openbsd/lib/libc/string/wcswidth.c",
551 ],
552
Colin Cross50c21ab2015-10-31 23:03:05 -0700553 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700554 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700555 "-Wno-unused-parameter",
556 "-include openbsd-compat.h",
557 ],
558
Dan Willemsen208ae172015-09-16 16:33:27 -0700559 local_include_dirs: [
560 "private",
561 "stdio",
562 "upstream-openbsd/android/include",
563 "upstream-openbsd/lib/libc/include",
564 "upstream-openbsd/lib/libc/gdtoa/",
565 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700566}
567
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700568cc_library_static {
569 name: "libc_openbsd_large_stack",
570 defaults: ["libc_defaults"],
571 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700572 "stdio/vfprintf.cpp",
573 "stdio/vfwprintf.cpp",
Elliott Hughes5633caa2020-08-06 14:32:43 -0700574 "upstream-openbsd/lib/libc/string/memmem.c",
Elliott Hughesc6b38ae2019-11-22 11:15:42 -0800575 "upstream-openbsd/lib/libc/string/strstr.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700576 ],
577 cflags: [
578 "-include openbsd-compat.h",
579 "-Wno-sign-compare",
580 "-Wframe-larger-than=5000",
581 ],
582
583 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700584 "upstream-openbsd/android/include/",
585 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700586 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700587 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700588 ],
589}
590
Dan Willemsen208ae172015-09-16 16:33:27 -0700591// ========================================================
592// libc_openbsd.a - upstream OpenBSD C library code
593// ========================================================
594//
595// These files are built with the openbsd-compat.h header file
596// automatically included.
597cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700598 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700599 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800600 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700601 "upstream-openbsd/lib/libc/crypt/arc4random.c",
602 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
603
604 // May be overriden by per-arch optimized versions
605 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700606 "upstream-openbsd/lib/libc/string/memrchr.c",
607 "upstream-openbsd/lib/libc/string/stpcpy.c",
608 "upstream-openbsd/lib/libc/string/stpncpy.c",
609 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700610 "upstream-openbsd/lib/libc/string/strcpy.c",
611 "upstream-openbsd/lib/libc/string/strlcat.c",
612 "upstream-openbsd/lib/libc/string/strlcpy.c",
613 "upstream-openbsd/lib/libc/string/strncat.c",
614 "upstream-openbsd/lib/libc/string/strncmp.c",
615 "upstream-openbsd/lib/libc/string/strncpy.c",
616 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700617
618 arch: {
619 arm: {
620 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700621 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800622 "upstream-openbsd/lib/libc/string/stpcpy.c",
623 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700624 ],
625 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700626 arm64: {
627 exclude_srcs: [
628 "upstream-openbsd/lib/libc/string/memchr.c",
Peter Collingbourne2361d4e2020-06-03 16:55:37 -0700629 "upstream-openbsd/lib/libc/string/memrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700630 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700631 "upstream-openbsd/lib/libc/string/strcpy.c",
632 "upstream-openbsd/lib/libc/string/strncmp.c",
633 ],
634 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700635 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800636 exclude_srcs: [
637 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800638 "upstream-openbsd/lib/libc/string/memrchr.c",
639 "upstream-openbsd/lib/libc/string/stpcpy.c",
640 "upstream-openbsd/lib/libc/string/stpncpy.c",
641 "upstream-openbsd/lib/libc/string/strcat.c",
642 "upstream-openbsd/lib/libc/string/strcpy.c",
643 "upstream-openbsd/lib/libc/string/strncmp.c",
644 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700645 "upstream-openbsd/lib/libc/string/strlcat.c",
646 "upstream-openbsd/lib/libc/string/strlcpy.c",
647 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800648 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700649 },
650
651 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800652 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800653 "upstream-openbsd/lib/libc/string/stpcpy.c",
654 "upstream-openbsd/lib/libc/string/stpncpy.c",
655 "upstream-openbsd/lib/libc/string/strcat.c",
656 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800657 "upstream-openbsd/lib/libc/string/strncat.c",
658 "upstream-openbsd/lib/libc/string/strncmp.c",
659 "upstream-openbsd/lib/libc/string/strncpy.c",
660 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700661 },
662 },
663
Colin Cross50c21ab2015-10-31 23:03:05 -0700664 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700665 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700666 "-Wno-unused-parameter",
667 "-include openbsd-compat.h",
668 ],
669
Dan Willemsen208ae172015-09-16 16:33:27 -0700670 local_include_dirs: [
671 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700672 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700673 ],
674
675 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700676}
677
678// ========================================================
679// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
680// ========================================================
681//
682// These files are built with the openbsd-compat.h header file
683// automatically included.
684
685cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700686 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700687 srcs: [
688 "upstream-openbsd/android/gdtoa_support.cpp",
689 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
690 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
691 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
692 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
693 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
694 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
695 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
696 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
697 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
698 "upstream-openbsd/lib/libc/gdtoa/misc.c",
699 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
700 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
701 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
702 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
703 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
704 "upstream-openbsd/lib/libc/gdtoa/sum.c",
705 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
706 ],
707 multilib: {
708 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800709 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700710 },
711 },
712
Colin Cross50c21ab2015-10-31 23:03:05 -0700713 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700714 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700715 "-include openbsd-compat.h",
716 ],
717
Dan Willemsen208ae172015-09-16 16:33:27 -0700718 local_include_dirs: [
719 "private",
720 "upstream-openbsd/android/include",
721 "upstream-openbsd/lib/libc/include",
722 ],
723
724 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700725}
726
727// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700728// libc_fortify.a - container for our FORITFY
729// implementation details
730// ========================================================
731cc_library_static {
732 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700733 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700734
735 name: "libc_fortify",
736
737 // Disable FORTIFY for the compilation of these, so we don't end up having
738 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800739 cflags: [
740 "-U_FORTIFY_SOURCE",
741 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
742 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700743
744 arch: {
745 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800746 cflags: [
747 "-DNO___MEMCPY_CHK",
748 "-DRENAME___STRCAT_CHK",
749 "-DRENAME___STRCPY_CHK",
750 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700751 srcs: [
752 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800753
754 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
755 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
756
757 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
758 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
759
760 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
761 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
762
763 "arch-arm/krait/bionic/__strcat_chk.S",
764 "arch-arm/krait/bionic/__strcpy_chk.S",
765
766 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
767 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
768
Haibo Huang01bfd892018-12-03 15:05:16 -0800769 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
770 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700771 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700772 },
773 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700774 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700775 srcs: [
776 "arch-arm64/generic/bionic/__memcpy_chk.S",
777 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700778 },
779 },
780}
781
782// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700783// libc_bionic.a - home-grown C library code
784// ========================================================
785
786cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700787 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700788 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800789 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700790 "bionic/sysconf.cpp",
791 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700792 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700793
Josh Gao10ec9282017-04-03 15:13:29 -0700794 // The following must not be statically linked into libc_ndk.a, because
795 // debuggerd will look for the abort message in libc.so's copy.
796 "bionic/android_set_abort_message.cpp",
797
Dan Willemsen208ae172015-09-16 16:33:27 -0700798 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800799 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700800 "bionic/strnlen.c",
801 "bionic/strrchr.cpp",
802 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700803
804 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700805 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700806 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700807 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800808 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700809 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800810 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800811 "arch-arm/generic/bionic/stpcpy.c",
812 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800813 "arch-arm/generic/bionic/strcmp.S",
814 "arch-arm/generic/bionic/strcpy.S",
815 "arch-arm/generic/bionic/strlen.c",
816
Ryan Prichard45024fe2018-12-30 21:10:26 -0800817 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700818 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700819 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700820 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700821 "arch-arm/bionic/atomics_arm.c",
822 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800823 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700824 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700825 "arch-arm/bionic/setjmp.S",
826 "arch-arm/bionic/syscall.S",
827 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800828
829 "arch-arm/cortex-a15/bionic/memcpy.S",
830 "arch-arm/cortex-a15/bionic/memmove.S",
831 "arch-arm/cortex-a15/bionic/memset.S",
832 "arch-arm/cortex-a15/bionic/stpcpy.S",
833 "arch-arm/cortex-a15/bionic/strcat.S",
834 "arch-arm/cortex-a15/bionic/strcmp.S",
835 "arch-arm/cortex-a15/bionic/strcpy.S",
836 "arch-arm/cortex-a15/bionic/strlen.S",
837
838 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800839 "arch-arm/cortex-a7/bionic/memset.S",
840
841 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800842 "arch-arm/cortex-a9/bionic/memset.S",
843 "arch-arm/cortex-a9/bionic/stpcpy.S",
844 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800845 "arch-arm/cortex-a9/bionic/strcpy.S",
846 "arch-arm/cortex-a9/bionic/strlen.S",
847
848 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800849 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800850
851 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800852
Haibo Huang01bfd892018-12-03 15:05:16 -0800853 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800854
855 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700856 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700857 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700858 arm64: {
859 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700860 "arch-arm64/generic/bionic/memcpy.S",
861 "arch-arm64/generic/bionic/memmove.S",
862 "arch-arm64/generic/bionic/memset.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700863 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800864
865 "arch-arm64/bionic/__bionic_clone.S",
866 "arch-arm64/bionic/_exit_with_stack_teardown.S",
867 "arch-arm64/bionic/setjmp.S",
868 "arch-arm64/bionic/syscall.S",
869 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700870 ],
871 exclude_srcs: [
872 "bionic/__memcpy_chk.cpp",
873 "bionic/strchr.cpp",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800874 "bionic/strchrnul.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700875 "bionic/strnlen.c",
Peter Collingbourne337a5b32020-02-21 12:11:02 -0800876 "bionic/strrchr.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700877 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700878 },
879
Dan Willemsen208ae172015-09-16 16:33:27 -0700880 x86: {
881 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700882 "arch-x86/generic/string/memcmp.S",
883 "arch-x86/generic/string/strcmp.S",
884 "arch-x86/generic/string/strncmp.S",
885 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700886
887 "arch-x86/generic/string/strlcat.c",
888 "arch-x86/generic/string/strlcpy.c",
889 "arch-x86/generic/string/strncat.c",
890 "arch-x86/generic/string/wcscat.c",
891 "arch-x86/generic/string/wcscpy.c",
892 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530893 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700894
Dan Willemsen208ae172015-09-16 16:33:27 -0700895 "arch-x86/atom/string/sse2-memchr-atom.S",
896 "arch-x86/atom/string/sse2-memrchr-atom.S",
897 "arch-x86/atom/string/sse2-strchr-atom.S",
898 "arch-x86/atom/string/sse2-strnlen-atom.S",
899 "arch-x86/atom/string/sse2-strrchr-atom.S",
900 "arch-x86/atom/string/sse2-wcschr-atom.S",
901 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
902 "arch-x86/atom/string/sse2-wcslen-atom.S",
903 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700904 "arch-x86/silvermont/string/sse2-memmove-slm.S",
905 "arch-x86/silvermont/string/sse2-memset-slm.S",
906 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
907 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
908 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
909 "arch-x86/silvermont/string/sse2-strlen-slm.S",
910 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800911
912 "arch-x86/bionic/__bionic_clone.S",
913 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800914 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800915 "arch-x86/bionic/__restore.S",
916 "arch-x86/bionic/setjmp.S",
917 "arch-x86/bionic/syscall.S",
918 "arch-x86/bionic/vfork.S",
Ryan Pricharda992a062020-04-18 02:59:24 -0700919 "arch-x86/bionic/__x86.get_pc_thunk.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700920
921 // ssse3 functions
922 "arch-x86/atom/string/ssse3-strcat-atom.S",
923 "arch-x86/atom/string/ssse3-strcmp-atom.S",
924 "arch-x86/atom/string/ssse3-strlcat-atom.S",
925 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
926 "arch-x86/atom/string/ssse3-strncat-atom.S",
927 "arch-x86/atom/string/ssse3-strncmp-atom.S",
928 "arch-x86/atom/string/ssse3-wcscat-atom.S",
929 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
930
931 // sse4 functions
932 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
933 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
934
935 // atom functions
936 "arch-x86/atom/string/sse2-memset-atom.S",
937 "arch-x86/atom/string/sse2-strlen-atom.S",
938 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -0800939 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700940 "arch-x86/atom/string/ssse3-strcpy-atom.S",
941 "arch-x86/atom/string/ssse3-strncpy-atom.S",
942 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530943
944 // avx2 functions
945 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700946 ],
Dan Willemsen268a6732015-10-15 14:49:45 -0700947
948 exclude_srcs: [
949 "bionic/strchr.cpp",
950 "bionic/strnlen.c",
951 "bionic/strrchr.cpp",
952 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700953 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700954 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700955 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700956 "arch-x86_64/string/sse2-memmove-slm.S",
957 "arch-x86_64/string/sse2-memset-slm.S",
958 "arch-x86_64/string/sse2-stpcpy-slm.S",
959 "arch-x86_64/string/sse2-stpncpy-slm.S",
960 "arch-x86_64/string/sse2-strcat-slm.S",
961 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700962 "arch-x86_64/string/sse2-strlen-slm.S",
963 "arch-x86_64/string/sse2-strncat-slm.S",
964 "arch-x86_64/string/sse2-strncpy-slm.S",
965 "arch-x86_64/string/sse4-memcmp-slm.S",
966 "arch-x86_64/string/ssse3-strcmp-slm.S",
967 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530968 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800969
970 "arch-x86_64/bionic/__bionic_clone.S",
971 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
972 "arch-x86_64/bionic/__restore_rt.S",
973 "arch-x86_64/bionic/setjmp.S",
974 "arch-x86_64/bionic/syscall.S",
975 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700976 ],
977 },
Dan Willemsen268a6732015-10-15 14:49:45 -0700978 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700979
Colin Cross50c21ab2015-10-31 23:03:05 -0700980 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -0700981 include_dirs: ["bionic/libstdc++/include"],
982 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -0700983}
984
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000985genrule {
986 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -0800987 out: ["generated_android_ids.h"],
988 srcs: [":android_filesystem_config_header"],
989 tool_files: ["fs_config_generator.py"],
990 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000991}
992
Dan Willemsen268a6732015-10-15 14:49:45 -0700993// ========================================================
994// libc_bionic_ndk.a- The portions of libc_bionic that can
995// be safely used in libc_ndk.a (no troublesome global data
996// or constructors).
997// ========================================================
998cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700999 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001000 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001001 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001002 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001003 "bionic/__cmsg_nxthdr.cpp",
1004 "bionic/__errno.cpp",
1005 "bionic/__gnu_basename.cpp",
1006 "bionic/__libc_current_sigrtmax.cpp",
1007 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001008 "bionic/abort.cpp",
1009 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001010 "bionic/access.cpp",
1011 "bionic/arpa_inet.cpp",
1012 "bionic/assert.cpp",
1013 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001014 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001015 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001016 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001017 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001018 "bionic/bionic_time_conversions.cpp",
1019 "bionic/brk.cpp",
1020 "bionic/c16rtomb.cpp",
1021 "bionic/c32rtomb.cpp",
1022 "bionic/chmod.cpp",
1023 "bionic/chown.cpp",
1024 "bionic/clearenv.cpp",
1025 "bionic/clock.cpp",
1026 "bionic/clock_getcpuclockid.cpp",
1027 "bionic/clock_nanosleep.cpp",
1028 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001029 "bionic/ctype.cpp",
1030 "bionic/dirent.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001031 "bionic/dup.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001032 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001033 "bionic/error.cpp",
Josh Gao7de41242020-04-29 17:08:46 -07001034 "bionic/eventfd.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001035 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001036 "bionic/faccessat.cpp",
1037 "bionic/fchmod.cpp",
1038 "bionic/fchmodat.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001039 "bionic/fcntl.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001040 "bionic/fdsan.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001041 "bionic/fdtrack.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001042 "bionic/ffs.cpp",
1043 "bionic/fgetxattr.cpp",
1044 "bionic/flistxattr.cpp",
1045 "bionic/flockfile.cpp",
1046 "bionic/fpclassify.cpp",
1047 "bionic/fsetxattr.cpp",
1048 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001049 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001050 "bionic/futimens.cpp",
1051 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001052 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001053 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001054 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001055 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001056 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001057 "bionic/getpgrp.cpp",
1058 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001059 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001060 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001061 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001062 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001063 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001064 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001065 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001066 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001067 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001068 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001069 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001070 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001071 "bionic/lchown.cpp",
1072 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001073 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001074 "bionic/libgen.cpp",
1075 "bionic/link.cpp",
1076 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001077 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001078 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001079 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001080 "bionic/mbrtoc16.cpp",
1081 "bionic/mbrtoc32.cpp",
Peter Collingbourne5d3aa862020-09-11 15:05:17 -07001082 "bionic/memory_mitigation_state.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001083 "bionic/mempcpy.cpp",
1084 "bionic/mkdir.cpp",
1085 "bionic/mkfifo.cpp",
1086 "bionic/mknod.cpp",
1087 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001088 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001089 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001090 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001091 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001092 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001093 "bionic/open.cpp",
1094 "bionic/pathconf.cpp",
1095 "bionic/pause.cpp",
1096 "bionic/pipe.cpp",
1097 "bionic/poll.cpp",
1098 "bionic/posix_fadvise.cpp",
1099 "bionic/posix_fallocate.cpp",
1100 "bionic/posix_madvise.cpp",
1101 "bionic/posix_timers.cpp",
1102 "bionic/ptrace.cpp",
1103 "bionic/pty.cpp",
1104 "bionic/raise.cpp",
1105 "bionic/rand.cpp",
1106 "bionic/readlink.cpp",
Elliott Hughes22fb2672019-11-01 08:07:25 -07001107 "bionic/realpath.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001108 "bionic/reboot.cpp",
1109 "bionic/recv.cpp",
Josh Gao97271922019-11-06 13:15:00 -08001110 "bionic/recvmsg.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001111 "bionic/rename.cpp",
1112 "bionic/rmdir.cpp",
1113 "bionic/scandir.cpp",
1114 "bionic/sched_getaffinity.cpp",
1115 "bionic/sched_getcpu.cpp",
1116 "bionic/semaphore.cpp",
1117 "bionic/send.cpp",
1118 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001119 "bionic/seteuid.cpp",
1120 "bionic/setpgrp.cpp",
1121 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001122 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001123 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001124 "bionic/sleep.cpp",
Josh Gaob107eab2020-04-29 17:17:56 -07001125 "bionic/socketpair.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001126 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001127 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001128 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001129 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001130 "bionic/string_l.cpp",
1131 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001132 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001133 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001134 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001135 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001136 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001137 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001138 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001139 "bionic/sys_msg.cpp",
1140 "bionic/sys_sem.cpp",
1141 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001142 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001143 "bionic/sys_statfs.cpp",
1144 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001145 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001146 "bionic/sysinfo.cpp",
1147 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001148 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001149 "bionic/system_property_api.cpp",
1150 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001151 "bionic/tdestroy.cpp",
1152 "bionic/termios.cpp",
1153 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001154 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001155 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001156 "bionic/tmpfile.cpp",
1157 "bionic/umount.cpp",
1158 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001159 "bionic/usleep.cpp",
Elliott Hughes9a1d3972020-08-07 15:55:02 -07001160 "bionic/utmp.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001161 "bionic/wait.cpp",
1162 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001163 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001164 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001165 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001166 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001167 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001168
1169 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1170 // which will be overridden by the actual one in libc.so.
1171 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001172 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001173
Dan Willemsen208ae172015-09-16 16:33:27 -07001174 multilib: {
1175 lib32: {
1176 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001177 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001178 },
1179 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001180 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001181 treble_linker_namespaces: {
1182 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001183 },
1184 },
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001185 whole_static_libs: [
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001186 "libsystemproperties",
1187 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07001188 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001189 local_include_dirs: ["stdio"],
1190 include_dirs: ["bionic/libstdc++/include"],
1191 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001192 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001193}
1194
Dan Willemsen208ae172015-09-16 16:33:27 -07001195// ========================================================
Bowgo Tsaia9208f32020-07-24 17:29:52 +08001196// libc_bionic_systrace.a
1197// ========================================================
1198
1199cc_library_static {
1200 name: "libc_bionic_systrace",
1201 defaults: ["libc_defaults"],
1202 srcs: [
1203 "bionic/bionic_systrace.cpp",
1204 ],
1205 apex_available: [
1206 "com.android.runtime",
1207 ],
1208}
1209
1210// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001211// libc_pthread.a - pthreads parts that previously lived in
1212// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001213// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001214// pthread_t has changed over the years and has ABI
1215// compatibility issues).
1216// ========================================================
1217
1218cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001219 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001220 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001221 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001222 "bionic/pthread_atfork.cpp",
1223 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001224 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001225 "bionic/pthread_cond.cpp",
1226 "bionic/pthread_create.cpp",
1227 "bionic/pthread_detach.cpp",
1228 "bionic/pthread_equal.cpp",
1229 "bionic/pthread_exit.cpp",
1230 "bionic/pthread_getcpuclockid.cpp",
1231 "bionic/pthread_getschedparam.cpp",
1232 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001233 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001234 "bionic/pthread_join.cpp",
1235 "bionic/pthread_key.cpp",
1236 "bionic/pthread_kill.cpp",
1237 "bionic/pthread_mutex.cpp",
1238 "bionic/pthread_once.cpp",
1239 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001240 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001241 "bionic/pthread_self.cpp",
1242 "bionic/pthread_setname_np.cpp",
1243 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001244 "bionic/pthread_spinlock.cpp",
Vy Nguyend5007512020-07-14 17:37:04 -04001245 "bionic/sys_thread_properties.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001246
1247 // The following implementations depend on pthread data or implementation,
1248 // so we can't include them in libc_ndk.a.
1249 "bionic/__cxa_thread_atexit_impl.cpp",
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001250 "bionic/android_unsafe_frame_pointer_chase.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -08001251 "bionic/atexit.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001252 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001253 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001254
Colin Cross50c21ab2015-10-31 23:03:05 -07001255 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001256 include_dirs: ["bionic/libstdc++/include"],
Peter Collingbourne5f45c182020-01-14 17:59:41 -08001257 header_libs: ["bionic_libc_platform_headers"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001258 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001259}
1260
1261// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001262// libc_syscalls.a
1263// ========================================================
1264
Elliott Hughes782c4852019-04-16 12:31:00 -07001265genrule {
1266 name: "syscalls-arm.S",
1267 out: ["syscalls-arm.S"],
1268 srcs: ["SYSCALLS.TXT"],
1269 tool_files: [":bionic-gensyscalls"],
1270 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1271}
1272
1273genrule {
1274 name: "syscalls-arm64.S",
1275 out: ["syscalls-arm64.S"],
1276 srcs: ["SYSCALLS.TXT"],
1277 tool_files: [":bionic-gensyscalls"],
1278 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1279}
1280
1281genrule {
1282 name: "syscalls-x86.S",
1283 out: ["syscalls-x86.S"],
1284 srcs: ["SYSCALLS.TXT"],
1285 tool_files: [":bionic-gensyscalls"],
1286 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1287}
1288
1289genrule {
1290 name: "syscalls-x86_64.S",
1291 out: ["syscalls-x86_64.S"],
1292 srcs: ["SYSCALLS.TXT"],
1293 tool_files: [":bionic-gensyscalls"],
1294 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1295}
1296
Dan Willemsen208ae172015-09-16 16:33:27 -07001297cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001298 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001299 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001300 arch: {
1301 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001302 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001303 },
1304 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001305 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001306 },
1307 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001308 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001309 },
1310 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001311 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001312 },
1313 },
1314 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001315}
1316
1317// ========================================================
1318// libc_aeabi.a
1319// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1320// to avoid infinite recursion. For the other architectures we just build an
1321// empty library to keep this makefile simple.
1322// ========================================================
1323
1324cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001325 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001326 arch: {
1327 arm: {
1328 srcs: ["arch-arm/bionic/__aeabi.c"],
1329 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001330 },
1331 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001332 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001333}
1334
1335// ========================================================
1336// libc_ndk.a
1337// Compatibility library for the NDK. This library contains
1338// all the parts of libc that are safe to statically link.
1339// We can't safely statically link things that can only run
1340// on a certain version of the OS. Examples include
1341// anything that talks to netd (a large portion of the DNS
1342// code) and anything that is dependent on the layout of a
1343// data structure that has changed across releases (such as
1344// pthread_t).
1345// ========================================================
1346
1347cc_library_static {
1348 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001349 defaults: [
1350 "libc_defaults",
1351 "libc_native_allocator_defaults",
1352 ],
Yifan Hong5a39cee2020-01-21 16:43:56 -08001353 ramdisk_available: false,
Yifan Hongb04490d2020-10-21 18:36:36 -07001354 vendor_ramdisk_available: false,
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001355 srcs: libc_common_src_files + [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001356 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001357 "bionic/heap_tagging.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001358 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001359 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001360 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001361 multilib: {
1362 lib32: {
1363 srcs: libc_common_src_files_32,
1364 },
1365 },
1366 arch: {
1367 arm: {
1368 srcs: [
1369 "arch-arm/bionic/exidx_dynamic.c",
1370 "arch-common/bionic/crtbegin_so.c",
1371 "arch-arm/bionic/atexit_legacy.c",
1372 "arch-common/bionic/crtend_so.S",
1373 ],
1374 whole_static_libs: ["libc_aeabi"],
1375 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001376 },
1377
Colin Cross50c21ab2015-10-31 23:03:05 -07001378 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001379 "-fvisibility=hidden",
1380 "-DLIBC_STATIC",
1381 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001382
1383 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001384 "gwp_asan",
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001385 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001386 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001387 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001388 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001389 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001390 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001391 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001392 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001393 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001394 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001395 "libc_syscalls",
1396 "libc_tzcode",
1397 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001398 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001399 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001400}
1401
1402// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001403// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001404// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001405cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001406 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001407 srcs: libc_common_src_files,
1408 multilib: {
1409 lib32: {
1410 srcs: libc_common_src_files_32,
1411 },
1412 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001413 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001414
1415 whole_static_libs: [
Peter Collingbourne337a5b32020-02-21 12:11:02 -08001416 "libarm-optimized-routines-string",
Dan Willemsen208ae172015-09-16 16:33:27 -07001417 "libc_bionic",
1418 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001419 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001420 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001421 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001422 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001423 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001424 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001425 "libc_netbsd",
1426 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001427 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001428 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001429 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001430 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001431 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001432 ],
1433
1434 arch: {
1435 arm: {
1436 whole_static_libs: ["libc_aeabi"],
1437 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001438 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001439}
1440
1441// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001442// libc_common.a
1443// ========================================================
1444
1445cc_library_static {
1446 defaults: ["libc_defaults"],
1447 name: "libc_common",
1448
1449 whole_static_libs: [
1450 "libc_nopthread",
1451 "libc_pthread",
1452 ],
1453}
1454
1455// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001456// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001457// ========================================================
1458cc_library_static {
1459 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001460 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001461
Haibo Huangb9244ff2018-08-11 10:12:13 -07001462 arch: {
1463 x86: {
1464 srcs: ["arch-x86/static_function_dispatch.S"],
1465 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001466 arm: {
1467 srcs: ["arch-arm/static_function_dispatch.S"],
1468 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001469 arm64: {
1470 srcs: ["arch-arm64/static_function_dispatch.S"],
1471 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001472 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001473}
1474
1475// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001476// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001477// ========================================================
1478cc_library_static {
1479 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001480 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001481
Haibo Huangb9244ff2018-08-11 10:12:13 -07001482 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001483 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001484 "-fno-stack-protector",
1485 "-fno-jump-tables",
1486 ],
1487 arch: {
1488 x86: {
1489 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1490 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001491 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001492 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001493 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001494 arm64: {
1495 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1496 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001497 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001498}
1499
1500// ========================================================
1501// libc_common_static.a For static binaries.
1502// ========================================================
1503cc_library_static {
1504 defaults: ["libc_defaults"],
1505 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001506
Haibo Huangf71edfa2018-11-12 10:06:56 -08001507 whole_static_libs: [
1508 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001509 "libc_static_dispatch",
1510 ],
1511}
1512
1513// ========================================================
1514// libc_common_shared.a For shared libraries.
1515// ========================================================
1516cc_library_static {
1517 defaults: ["libc_defaults"],
1518 name: "libc_common_shared",
1519
1520 whole_static_libs: [
1521 "libc_common",
1522 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001523 ],
1524}
1525
Ryan Prichard22a6a052019-10-10 23:59:30 -07001526// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1527// executable.
1528cc_library_static {
1529 name: "libc_unwind_static",
1530 defaults: ["libc_defaults"],
1531 cflags: ["-DLIBC_STATIC"],
1532
1533 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1534 arch: {
1535 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1536 arm: {
1537 srcs: ["arch-arm/bionic/exidx_static.c"],
1538 },
1539 },
1540}
1541
Haibo Huangf71edfa2018-11-12 10:06:56 -08001542// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001543// libc_nomalloc.a
1544// ========================================================
1545//
Ryan Prichard249757b2019-11-01 17:18:28 -07001546// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1547// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1548// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001549
1550cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001551 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001552 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001553
Colin Crossa3f9fca2016-01-11 13:20:55 -08001554 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001555 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001556 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001557 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001558 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001559}
1560
dimitryc0c0ef62018-12-05 16:33:52 +01001561filegroup {
1562 name: "libc_sources_shared",
1563 srcs: [
1564 "arch-common/bionic/crtbegin_so.c",
1565 "arch-common/bionic/crtbrand.S",
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001566 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001567 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001568 "bionic/icu.cpp",
1569 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001570 "bionic/malloc_common_dynamic.cpp",
Ryan Savitski175c8862020-01-02 19:54:57 +00001571 "bionic/android_profiling_dynamic.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001572 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001573 "bionic/malloc_limit.cpp",
Peter Collingbourne570de332019-12-11 10:00:58 -08001574 "bionic/ndk_cruft.cpp",
1575 "bionic/ndk_cruft_data.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001576 "bionic/NetdClient.cpp",
1577 "arch-common/bionic/crtend_so.S",
1578 ],
1579}
1580
1581filegroup {
1582 name: "libc_sources_static",
1583 srcs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001584 "bionic/gwp_asan_wrappers.cpp",
Peter Collingbourne1e110fb2020-01-09 10:48:22 -08001585 "bionic/heap_tagging.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001586 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001587 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001588 ],
1589}
1590
1591filegroup {
1592 name: "libc_sources_shared_arm",
1593 srcs: [
1594 "arch-arm/bionic/exidx_dynamic.c",
1595 "arch-arm/bionic/atexit_legacy.c",
1596 ],
1597}
1598
Dan Willemsen208ae172015-09-16 16:33:27 -07001599// ========================================================
1600// libc.a + libc.so
1601// ========================================================
1602cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001603 defaults: [
1604 "libc_defaults",
1605 "libc_native_allocator_defaults",
1606 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001607 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001608 static_ndk_lib: true,
Colin Cross8393a8b2020-10-19 13:37:49 -07001609 llndk_stubs: "libc.llndk",
Colin Cross50c21ab2015-10-31 23:03:05 -07001610 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001611 platform_sdk_version: {
1612 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1613 },
1614 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001615 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001616 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001617 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001618 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001619 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001620 "libc_init_static",
1621 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001622 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001623 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001624 },
1625 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001626 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001627 whole_static_libs: [
Mitch Phillipsf3968e82020-01-31 19:57:04 -08001628 "gwp_asan",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001629 "libc_init_dynamic",
1630 "libc_common_shared",
1631 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001632 },
1633
Neil Fullera7db90f2019-04-25 09:28:27 +01001634 required: [
1635 "tzdata",
1636 "tz_version", // Version metadata for tzdata to help debugging.
1637 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001638
Colin Cross4ce94d22016-11-15 13:15:43 -08001639 // Do not pack libc.so relocations; see http://b/20645321 for details.
1640 pack_relocations: false,
1641
dimitry06016f22018-01-05 11:39:28 +01001642 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1643 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1644 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1645 // those new libraries from libgcc.a are not declared external; if that were the case,
1646 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1647 // on the external symbols from the dependent libraries. That would create a "cloaked"
1648 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001649
dimitry06016f22018-01-05 11:39:28 +01001650 shared_libs: [
1651 "ld-android",
1652 "libdl",
1653 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001654 static_libs: [
1655 "libdl_android",
1656 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001657
1658 nocrt: true,
1659
Dan Willemsen208ae172015-09-16 16:33:27 -07001660 arch: {
1661 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001662 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001663 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001664 ldflags: ["-Wl,--hash-style=both"],
1665
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001666 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001667
Dan Willemsen208ae172015-09-16 16:33:27 -07001668 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001669 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001670 // special for arm
1671 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Ryan Prichard379e05f2020-04-01 20:10:07 -07001672
1673 whole_static_libs: [ "libunwind_llvm" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001674 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001675
1676 // Arm 32 bit does not produce complete exidx unwind information
1677 // so keep the .debug_frame which is relatively small and does
1678 // include needed unwind information.
1679 // See b/132992102 for details.
1680 strip: {
1681 keep_symbols_and_debug_frame: true,
1682 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001683 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001684 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001685 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001686
1687 // Leave the symbols in the shared library so that stack unwinders can produce
1688 // meaningful name resolution.
1689 strip: {
1690 keep_symbols: true,
1691 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001692
Ryan Prichard379e05f2020-04-01 20:10:07 -07001693 shared: {
1694 whole_static_libs: [ "libgcc_stripped" ],
1695 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001696 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001697 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001698 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001699 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001700 ldflags: ["-Wl,--hash-style=both"],
1701
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001702 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001703
1704 // Leave the symbols in the shared library so that stack unwinders can produce
1705 // meaningful name resolution.
1706 strip: {
1707 keep_symbols: true,
1708 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001709
Ryan Prichard379e05f2020-04-01 20:10:07 -07001710 shared: {
1711 whole_static_libs: [ "libgcc_stripped" ],
1712 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001713 },
1714 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001715 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001716
1717 // Leave the symbols in the shared library so that stack unwinders can produce
1718 // meaningful name resolution.
1719 strip: {
1720 keep_symbols: true,
1721 },
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001722
Ryan Prichard379e05f2020-04-01 20:10:07 -07001723 shared: {
1724 whole_static_libs: [ "libgcc_stripped" ],
1725 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001726 },
1727 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001728
1729 stubs: {
1730 symbol_file: "libc.map.txt",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001731 versions: [
1732 "29",
Jooyung Handbfa0742020-03-30 13:18:44 +09001733 "R",
Dan Albert48943b22020-07-27 13:28:56 -07001734 "current",
Jooyung Han26ddc4d2020-02-27 18:33:25 +09001735 ],
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001736 },
Vic Yang6903fb82019-01-14 11:34:39 -08001737
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001738 apex_available: [
1739 "//apex_available:platform",
1740 "com.android.runtime",
1741 ],
1742
Vic Yang03ff4362019-06-24 16:11:37 -07001743 // Sorting bss symbols by size usually results in less dirty pages at run
1744 // time, because small symbols are grouped together.
1745 sort_bss_symbols_by_size: true,
Yi Kong15a05a72020-09-22 00:56:13 +08001746
1747 lto: {
1748 never: true,
1749 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001750}
1751
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001752genrule {
1753 name: "libc.arm.map",
1754 out: ["libc.arm.map"],
1755 srcs: ["libc.map.txt"],
1756 tool_files: [":bionic-generate-version-script"],
1757 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1758}
1759
1760genrule {
1761 name: "libc.arm64.map",
1762 out: ["libc.arm64.map"],
1763 srcs: ["libc.map.txt"],
1764 tool_files: [":bionic-generate-version-script"],
1765 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1766}
1767
1768genrule {
1769 name: "libc.x86.map",
1770 out: ["libc.x86.map"],
1771 srcs: ["libc.map.txt"],
1772 tool_files: [":bionic-generate-version-script"],
1773 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1774}
1775
1776genrule {
1777 name: "libc.x86_64.map",
1778 out: ["libc.x86_64.map"],
1779 srcs: ["libc.map.txt"],
1780 tool_files: [":bionic-generate-version-script"],
1781 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1782}
1783
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001784// Headers that only other parts of the platform can include.
1785cc_library_headers {
1786 name: "bionic_libc_platform_headers",
Martin Stjernholma2763432020-04-23 16:47:19 +01001787 defaults: ["linux_bionic_supported"],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001788 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001789 "//art:__subpackages__",
Josh Gao97271922019-11-06 13:15:00 -08001790 "//bionic:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001791 "//frameworks:__subpackages__",
Roman Kiryanov067f5182020-05-07 14:58:30 -07001792 "//device/generic/goldfish-opengl:__subpackages__",
Mitch Phillips3309b3d2020-03-25 15:05:48 -07001793 "//external/gwp_asan:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001794 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001795 "//external/scudo:__subpackages__",
Josh Gao5074e7d2019-12-13 13:55:53 -08001796 "//system/core/debuggerd:__subpackages__",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001797 "//system/core/libcutils:__subpackages__",
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001798 "//system/memory/libmemunreachable:__subpackages__",
Baligh Uddindb0c6de2020-10-15 04:49:00 +00001799 "//system/unwinding/libunwindstack:__subpackages__",
Peter Collingbourne15418002020-05-12 16:02:50 -07001800 "//tools/security/sanitizer-status:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001801 ],
Peter Collingbourne6a363f72020-01-13 10:39:33 -08001802 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001803 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001804 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001805 vendor_ramdisk_available: true,
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001806 recovery_available: true,
1807 native_bridge_supported: true,
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001808 export_include_dirs: [
1809 "platform",
1810 ],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001811 system_shared_libs: [],
1812 stl: "none",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001813 sdk_version: "current",
Jiyong Park4ede1602020-04-28 18:21:08 +09001814
Steven Moreland0cdf1322020-10-05 21:55:26 +00001815 min_sdk_version: "29",
Jiyong Park4ede1602020-04-28 18:21:08 +09001816 apex_available: [
1817 "//apex_available:platform",
Steven Moreland0cdf1322020-10-05 21:55:26 +00001818 "//apex_available:anyapex",
Jiyong Park4ede1602020-04-28 18:21:08 +09001819 ],
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001820}
1821
Logan Chien17af91b2019-01-15 21:19:56 +08001822cc_library_headers {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001823 // Internal lib for use in libc_headers. Since we cannot intersect arch{}
1824 // and target{} in the same module, this one specifies the arch-dependent
1825 // include paths, and then libc_headers filters by target so that the
1826 // headers only are included for Bionic targets.
1827 name: "libc_headers_arch",
1828 visibility: ["//visibility:private"],
Logan Chien17af91b2019-01-15 21:19:56 +08001829
1830 host_supported: true,
1831 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001832 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08001833 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001834 vendor_ramdisk_available: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001835 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001836 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09001837 apex_available: [
1838 "//apex_available:platform",
Jiyong Parkad9946c2020-03-30 18:36:07 +09001839 "//apex_available:anyapex",
1840 ],
Jooyung Han15c32a82020-04-16 18:26:45 +09001841 // used by most APEXes indirectly via libunwind_llvm
1842 min_sdk_version: "apex_inherit",
Logan Chien17af91b2019-01-15 21:19:56 +08001843
1844 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001845 stl: "none",
1846 system_shared_libs: [],
1847
Peter Collingbournef2b1e032019-12-10 17:41:16 -08001848 // The build system generally requires that any dependencies of a target
1849 // with an sdk_version must have a lower sdk_version. By setting sdk_version
1850 // to 1 we let targets with an sdk_version that need to depend on the libc
1851 // headers but cannot depend on libc itself due to circular dependencies
1852 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1
1853 // is correct because the headers can support any sdk_version.
1854 sdk_version: "1",
1855
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001856 export_system_include_dirs: [
Logan Chien17af91b2019-01-15 21:19:56 +08001857 "include",
1858 "kernel/uapi",
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001859 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08001860 "kernel/android/uapi",
1861 ],
1862
1863 arch: {
1864 arm: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001865 export_system_include_dirs: ["kernel/uapi/asm-arm"],
Logan Chien17af91b2019-01-15 21:19:56 +08001866 },
1867 arm64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001868 export_system_include_dirs: ["kernel/uapi/asm-arm64"],
Logan Chien17af91b2019-01-15 21:19:56 +08001869 },
Logan Chien17af91b2019-01-15 21:19:56 +08001870 x86: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001871 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001872 },
1873 x86_64: {
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001874 export_system_include_dirs: ["kernel/uapi/asm-x86"],
Logan Chien17af91b2019-01-15 21:19:56 +08001875 },
1876 },
1877}
1878
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001879cc_library_headers {
1880 name: "libc_headers",
1881 host_supported: true,
1882 native_bridge_supported: true,
1883 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09001884 product_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001885 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07001886 vendor_ramdisk_available: true,
Martin Stjernholm82d84bc2020-04-06 20:32:09 +01001887 recovery_available: true,
1888 sdk_version: "1",
1889
1890 apex_available: [
1891 "//apex_available:platform",
1892 "//apex_available:anyapex",
1893 ],
1894 // used by most APEXes indirectly via libunwind_llvm
1895 min_sdk_version: "apex_inherit",
1896 visibility: [
1897 "//bionic:__subpackages__", // visible to bionic
1898 // ... and only to these places (b/152668052)
1899 "//external/arm-optimized-routines",
1900 "//external/gwp_asan",
1901 "//external/jemalloc_new",
1902 "//external/libunwind_llvm",
1903 "//external/scudo",
1904 "//system/core/property_service/libpropertyinfoparser",
1905 "//system/extras/toolchain-extras",
1906 // TODO(b/153662223): Clean up these users that needed visibility when
1907 // the implicit addition of system Bionic paths was removed.
1908 "//art/tools/cpp-define-generator",
1909 "//external/boringssl",
1910 "//external/minijail",
1911 ],
1912
1913 stl: "none",
1914 no_libcrt: true,
1915 system_shared_libs: [],
1916
1917 target: {
1918 android: {
1919 header_libs: ["libc_headers_arch"],
1920 export_header_lib_headers: ["libc_headers_arch"],
1921 },
1922 linux_bionic: {
1923 header_libs: ["libc_headers_arch"],
1924 export_header_lib_headers: ["libc_headers_arch"],
1925 },
1926 }
1927}
1928
Dan Willemsen208ae172015-09-16 16:33:27 -07001929// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001930// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001931// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001932
Dan Willemsen208ae172015-09-16 16:33:27 -07001933cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001934 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001935 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001936 srcs: [
1937 "bionic/__cxa_guard.cpp",
1938 "bionic/__cxa_pure_virtual.cpp",
1939 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001940 ],
1941 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001942 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001943 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001944
Dan Willemsen6b3be172018-12-03 13:57:20 -08001945 static: {
1946 system_shared_libs: [],
1947 },
1948 shared: {
1949 system_shared_libs: ["libc"],
1950 },
1951
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001952 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001953 arch: {
1954 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001955 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001956 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001957 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001958 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001959 },
1960 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001961 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001962 },
1963 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001964 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001965 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001966 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001967 },
1968 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001969 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001970 },
1971 },
1972}
1973
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001974genrule {
1975 name: "libstdc++.arm.map",
1976 out: ["libstdc++.arm.map"],
1977 srcs: ["libstdc++.map.txt"],
1978 tool_files: [":bionic-generate-version-script"],
1979 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1980}
1981
1982genrule {
1983 name: "libstdc++.arm64.map",
1984 out: ["libstdc++.arm64.map"],
1985 srcs: ["libstdc++.map.txt"],
1986 tool_files: [":bionic-generate-version-script"],
1987 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1988}
1989
1990genrule {
1991 name: "libstdc++.x86.map",
1992 out: ["libstdc++.x86.map"],
1993 srcs: ["libstdc++.map.txt"],
1994 tool_files: [":bionic-generate-version-script"],
1995 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1996}
1997
1998genrule {
1999 name: "libstdc++.x86_64.map",
2000 out: ["libstdc++.x86_64.map"],
2001 srcs: ["libstdc++.map.txt"],
2002 tool_files: [":bionic-generate-version-script"],
2003 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
2004}
2005
2006// ========================================================
2007// crt object files.
2008// ========================================================
2009
Colin Cross50c21ab2015-10-31 23:03:05 -07002010cc_defaults {
2011 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08002012 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07002013 vendor_available: true,
Justin Yun869a0fa2020-11-11 15:16:11 +09002014 product_available: true,
Yifan Hong5a39cee2020-01-21 16:43:56 -08002015 ramdisk_available: true,
Yifan Hongb04490d2020-10-21 18:36:36 -07002016 vendor_ramdisk_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09002017 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02002018 native_bridge_supported: true,
Jiyong Park922a5c72020-03-07 17:35:02 +09002019 apex_available: [
2020 "//apex_available:platform",
2021 "//apex_available:anyapex",
2022 ],
Dan Albertdc503f62020-07-15 17:22:18 -07002023 // Generate NDK variants of the CRT objects for every supported API level.
2024 min_sdk_version: "16",
2025 stl: "none",
2026 crt: true,
Elliott Hughesd50a1de2018-02-05 17:30:57 -08002027 cflags: [
2028 "-Wno-gcc-compat",
2029 "-Wall",
2030 "-Werror",
2031 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07002032 sanitize: {
2033 never: true,
2034 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002035}
2036
Colin Cross50c21ab2015-10-31 23:03:05 -07002037cc_defaults {
2038 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07002039 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002040
2041 arch: {
Colin Cross50c21ab2015-10-31 23:03:05 -07002042 x86: {
2043 cflags: ["-fPIC"],
2044 },
2045 x86_64: {
2046 cflags: ["-fPIC"],
2047 },
Dan Willemsen208ae172015-09-16 16:33:27 -07002048 },
Colin Crossab179442018-09-27 11:03:22 -07002049 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07002050}
2051
Dan Willemsen208ae172015-09-16 16:33:27 -07002052cc_object {
2053 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07002054 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07002055 local_include_dirs: ["include"],
2056 product_variables: {
2057 platform_sdk_version: {
2058 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
2059 },
2060 },
2061 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002062
Colin Cross7d7b3682017-11-03 13:38:40 -07002063 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002064}
2065
Dan Willemsen208ae172015-09-16 16:33:27 -07002066cc_object {
2067 name: "crtbegin_so1",
2068 local_include_dirs: ["include"],
2069 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002070
Colin Cross7d7b3682017-11-03 13:38:40 -07002071 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002072}
2073
Dan Willemsen208ae172015-09-16 16:33:27 -07002074cc_object {
2075 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002076
Colin Cross7d7b3682017-11-03 13:38:40 -07002077 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002078 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002079 "crtbegin_so1",
2080 "crtbrand",
2081 ],
2082}
2083
Dan Willemsen208ae172015-09-16 16:33:27 -07002084cc_object {
2085 name: "crtend_so",
2086 local_include_dirs: ["include"],
2087 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002088
Colin Cross7d7b3682017-11-03 13:38:40 -07002089 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002090}
2091
Dan Willemsen208ae172015-09-16 16:33:27 -07002092cc_object {
2093 name: "crtbegin_static1",
2094 local_include_dirs: ["include"],
2095 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002096 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002097}
2098
Dan Willemsen208ae172015-09-16 16:33:27 -07002099cc_object {
2100 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002101
Colin Cross77d57bf2016-04-11 14:34:18 -07002102 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002103 "crtbegin_static1",
2104 "crtbrand",
2105 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002106 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002107}
2108
Dan Willemsen208ae172015-09-16 16:33:27 -07002109cc_object {
2110 name: "crtbegin_dynamic1",
2111 local_include_dirs: ["include"],
2112 srcs: ["arch-common/bionic/crtbegin.c"],
Colin Cross50c21ab2015-10-31 23:03:05 -07002113 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002114}
2115
Dan Willemsen208ae172015-09-16 16:33:27 -07002116cc_object {
2117 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002118
Colin Cross77d57bf2016-04-11 14:34:18 -07002119 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002120 "crtbegin_dynamic1",
2121 "crtbrand",
2122 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002123 target: {
2124 linux_bionic: {
2125 generated_sources: ["host_bionic_linker_asm"],
2126 objs: [
2127 "linker_wrapper",
2128 ],
2129 },
2130 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002131 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002132}
2133
Dan Willemsen208ae172015-09-16 16:33:27 -07002134cc_object {
2135 // We rename crtend.o to crtend_android.o to avoid a
2136 // name clash between gcc and bionic.
2137 name: "crtend_android",
2138 local_include_dirs: ["include"],
2139 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002140
Colin Cross50c21ab2015-10-31 23:03:05 -07002141 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002142}
Colin Crossbaa48992016-07-13 11:15:21 -07002143
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002144// ========================================================
2145// NDK headers.
2146// ========================================================
2147
Dan Albert26e1c412018-05-24 14:56:46 -07002148versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002149 name: "common_libc",
2150 from: "include",
2151 to: "",
2152 license: "NOTICE",
2153}
Dan Albert4238a352016-06-28 11:18:05 -07002154
2155ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002156 name: "libc_uapi",
2157 from: "kernel/uapi",
2158 to: "",
2159 srcs: [
2160 "kernel/uapi/asm-generic/**/*.h",
2161 "kernel/uapi/drm/**/*.h",
2162 "kernel/uapi/linux/**/*.h",
2163 "kernel/uapi/misc/**/*.h",
2164 "kernel/uapi/mtd/**/*.h",
2165 "kernel/uapi/rdma/**/*.h",
2166 "kernel/uapi/scsi/**/*.h",
2167 "kernel/uapi/sound/**/*.h",
2168 "kernel/uapi/video/**/*.h",
2169 "kernel/uapi/xen/**/*.h",
2170 ],
Dan Albert92592652016-10-20 01:42:54 -07002171 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002172}
2173
2174ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002175 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002176 from: "kernel/android/uapi/linux",
2177 to: "linux",
2178 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002179 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002180}
2181
2182ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002183 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002184 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002185 to: "scsi",
2186 srcs: ["kernel/android/scsi/**/*.h"],
2187 license: "NOTICE",
2188}
2189
2190ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002191 name: "libc_asm_arm",
2192 from: "kernel/uapi/asm-arm",
2193 to: "arm-linux-androideabi",
2194 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002195 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002196}
2197
2198ndk_headers {
2199 name: "libc_asm_arm64",
2200 from: "kernel/uapi/asm-arm64",
2201 to: "aarch64-linux-android",
2202 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002203 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002204}
2205
Lazar Trsic790d2f72017-11-27 11:54:11 +01002206ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002207 name: "libc_asm_x86",
2208 from: "kernel/uapi/asm-x86",
2209 to: "i686-linux-android",
2210 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002211 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002212}
2213
2214ndk_headers {
2215 name: "libc_asm_x86_64",
2216 from: "kernel/uapi/asm-x86",
2217 to: "x86_64-linux-android",
2218 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002219 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002220}
2221
Dan Albert4238a352016-06-28 11:18:05 -07002222ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002223 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002224 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002225 symbol_file: "libc.map.txt",
2226 first_version: "9",
2227}
2228
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002229llndk_library {
Colin Cross8393a8b2020-10-19 13:37:49 -07002230 name: "libc.llndk",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002231 symbol_file: "libc.map.txt",
2232 export_headers_as_system: true,
2233 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002234 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002235 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002236 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002237 "kernel/android/uapi",
2238 "kernel/uapi",
2239 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002240 arch: {
2241 arm: {
2242 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002243 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002244 ],
2245 },
2246 arm64: {
2247 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002248 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002249 ],
2250 },
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002251 x86: {
2252 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002253 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002254 ],
2255 },
2256 x86_64: {
2257 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002258 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002259 ],
2260 },
2261 },
2262}
2263
Dan Albertdf31aff2016-10-06 15:50:41 -07002264ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002265 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002266 symbol_file: "libstdc++.map.txt",
2267 first_version: "9",
2268}
2269
Dan Willemsenca056d72018-01-08 14:00:24 -08002270// Export these headers for toolbox to process
2271filegroup {
2272 name: "kernel_input_headers",
2273 srcs: [
2274 "kernel/uapi/linux/input.h",
2275 "kernel/uapi/linux/input-event-codes.h",
2276 ],
2277}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002278
2279// Generate a syscall name / number mapping. These objects are text files
2280// (thanks to the -dD -E flags) and not binary files. They will then be
2281// consumed by the genseccomp.py script and converted into C++ code.
2282cc_defaults {
2283 name: "libseccomp_gen_syscall_nrs_defaults",
2284 recovery_available: true,
2285 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2286 cflags: [
2287 "-dD",
2288 "-E",
2289 "-Wall",
2290 "-Werror",
2291 "-nostdinc",
2292 ],
2293}
2294
2295cc_object {
2296 name: "libseccomp_gen_syscall_nrs_arm",
2297 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2298 local_include_dirs: [
2299 "kernel/uapi/asm-arm",
2300 "kernel/uapi",
2301 ],
2302}
2303
2304cc_object {
2305 name: "libseccomp_gen_syscall_nrs_arm64",
2306 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2307 local_include_dirs: [
2308 "kernel/uapi/asm-arm64",
2309 "kernel/uapi",
2310 ],
2311}
2312
2313cc_object {
2314 name: "libseccomp_gen_syscall_nrs_x86",
2315 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2316 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2317 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2318 local_include_dirs: [
2319 "kernel/uapi/asm-x86",
2320 "kernel/uapi",
2321 ],
2322}
2323
2324cc_object {
2325 name: "libseccomp_gen_syscall_nrs_x86_64",
2326 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2327 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2328 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2329 local_include_dirs: [
2330 "kernel/uapi/asm-x86",
2331 "kernel/uapi",
2332 ],
2333}
2334
Elliott Hughesae03b122019-09-17 16:37:05 -07002335// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002336python_binary_host {
2337 name: "genseccomp",
2338 main: "tools/genseccomp.py",
2339
2340 srcs: [
2341 "tools/genseccomp.py",
2342 "tools/gensyscalls.py",
2343 ],
2344
2345 data: [
2346 "kernel/uapi/**/*.h",
2347 ],
2348
2349 version: {
2350 py2: {
2351 enabled: true,
2352 },
2353 py3: {
2354 enabled: false,
2355 },
2356 },
2357}
2358
Martijn Coenen0c6de752019-01-02 12:52:51 +01002359python_binary_host {
2360 name: "genfunctosyscallnrs",
2361 main: "tools/genfunctosyscallnrs.py",
2362
2363 srcs: [
2364 "tools/genseccomp.py",
2365 "tools/genfunctosyscallnrs.py",
2366 "tools/gensyscalls.py",
2367 ],
2368
2369 data: [
2370 "kernel/uapi/**/*.h",
2371 ],
2372
2373 version: {
2374 py2: {
2375 enabled: true,
2376 },
2377 py3: {
2378 enabled: false,
2379 },
2380 },
2381}
2382
2383cc_genrule {
2384 name: "func_to_syscall_nrs",
2385 recovery_available: true,
2386 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2387
2388 tools: [ "genfunctosyscallnrs" ],
2389
2390 srcs: [
2391 "SYSCALLS.TXT",
2392 ":libseccomp_gen_syscall_nrs_arm",
2393 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenen0c6de752019-01-02 12:52:51 +01002394 ":libseccomp_gen_syscall_nrs_x86",
2395 ":libseccomp_gen_syscall_nrs_x86_64",
2396 ],
2397
2398 out: [
2399 "func_to_syscall_nrs.h",
2400 ],
2401}
2402
Victor Hsiehdbb86702020-06-15 09:29:07 -07002403// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid*
Martijn Coenenc3752be2019-01-09 16:19:57 +01002404genrule {
Victor Hsiehdbb86702020-06-15 09:29:07 -07002405 name: "generate_app_zygote_blocklist",
2406 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"],
2407 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"],
Martijn Coenenc3752be2019-01-09 16:19:57 +01002408 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2409}
2410
2411cc_genrule {
2412 name: "libseccomp_policy_app_zygote_sources",
2413 recovery_available: true,
2414 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2415
2416 tools: [ "genseccomp" ],
2417
2418 srcs: [
2419 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002420 "SECCOMP_ALLOWLIST_COMMON.TXT",
2421 "SECCOMP_ALLOWLIST_APP.TXT",
2422 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002423 "SECCOMP_PRIORITY.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002424 ":generate_app_zygote_blocklist",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002425 ":libseccomp_gen_syscall_nrs_arm",
2426 ":libseccomp_gen_syscall_nrs_arm64",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002427 ":libseccomp_gen_syscall_nrs_x86",
2428 ":libseccomp_gen_syscall_nrs_x86_64",
2429 ],
2430
2431 out: [
2432 "arm64_app_zygote_policy.cpp",
2433 "arm_app_zygote_policy.cpp",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002434 "x86_64_app_zygote_policy.cpp",
2435 "x86_app_zygote_policy.cpp",
2436 ],
2437}
2438
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002439cc_genrule {
2440 name: "libseccomp_policy_app_sources",
2441 recovery_available: true,
2442 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2443
2444 tools: [ "genseccomp" ],
2445
2446 srcs: [
2447 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002448 "SECCOMP_ALLOWLIST_COMMON.TXT",
2449 "SECCOMP_ALLOWLIST_APP.TXT",
2450 "SECCOMP_BLOCKLIST_COMMON.TXT",
2451 "SECCOMP_BLOCKLIST_APP.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002452 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002453 ":libseccomp_gen_syscall_nrs_arm",
2454 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002455 ":libseccomp_gen_syscall_nrs_x86",
2456 ":libseccomp_gen_syscall_nrs_x86_64",
2457 ],
2458
2459 out: [
2460 "arm64_app_policy.cpp",
2461 "arm_app_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002462 "x86_64_app_policy.cpp",
2463 "x86_app_policy.cpp",
2464 ],
2465}
2466
2467cc_genrule {
2468 name: "libseccomp_policy_system_sources",
2469 recovery_available: true,
2470 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2471
2472 tools: [ "genseccomp" ],
2473
2474 srcs: [
2475 "SYSCALLS.TXT",
Victor Hsiehdbb86702020-06-15 09:29:07 -07002476 "SECCOMP_ALLOWLIST_COMMON.TXT",
2477 "SECCOMP_ALLOWLIST_SYSTEM.TXT",
2478 "SECCOMP_BLOCKLIST_COMMON.TXT",
Bram Bonnéacadd092020-05-06 13:49:55 +02002479 "SECCOMP_PRIORITY.TXT",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002480 ":libseccomp_gen_syscall_nrs_arm",
2481 ":libseccomp_gen_syscall_nrs_arm64",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002482 ":libseccomp_gen_syscall_nrs_x86",
2483 ":libseccomp_gen_syscall_nrs_x86_64",
2484 ],
2485
2486 out: [
2487 "arm64_system_policy.cpp",
2488 "arm_system_policy.cpp",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002489 "x86_64_system_policy.cpp",
2490 "x86_system_policy.cpp",
2491 ],
2492}
2493
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002494cc_library {
2495 name: "libseccomp_policy",
2496 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002497 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002498 generated_sources: [
2499 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002500 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002501 "libseccomp_policy_system_sources",
2502 ],
2503
2504 srcs: [
2505 "seccomp/seccomp_policy.cpp",
2506 ],
2507
2508 export_include_dirs: ["seccomp/include"],
2509 cflags: [
2510 "-Wall",
2511 "-Werror",
2512 ],
2513 shared: {
2514 shared_libs: ["libbase"],
2515 },
2516 static: {
2517 static_libs: ["libbase"],
2518 },
2519}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002520
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002521subdirs = [
2522 "bionic/scudo",
2523]