blob: d002e50d5a3f296cfe07eef5e34d0095cd71d3b4 [file] [log] [blame]
Dan Willemsen208ae172015-09-16 16:33:27 -07001// Define the common source files for all the libc instances
2// =========================================================
3libc_common_src_files = [
Christopher Ferris7a3681e2017-04-24 17:48:32 -07004 "async_safe/async_safe_log.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07005 "bionic/ether_aton.c",
6 "bionic/ether_ntoa.c",
7 "bionic/fts.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07008 "bionic/initgroups.c",
Dan Willemsen208ae172015-09-16 16:33:27 -07009 "bionic/isatty.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070010 "bionic/pututline.c",
11 "bionic/sched_cpualloc.c",
12 "bionic/sched_cpucount.c",
Elliott Hughes3a4c4542017-07-19 17:20:24 -070013 "stdio/fmemopen.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070014 "stdio/parsefloat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -070015 "stdio/refill.c",
Dan Willemsen3e621712016-02-03 21:48:08 -080016 "stdio/stdio.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070017 "stdio/stdio_ext.cpp",
Elliott Hughes38e4aef2018-01-18 10:21:29 -080018 "stdio/vfscanf.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -070019 "stdio/vfwscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070020 "stdlib/exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -070021]
22
23// Various kinds of cruft.
24// ========================================================
25libc_common_src_files += [
26 "bionic/ndk_cruft.cpp",
Elliott Hughes1c8a2a92019-09-27 14:42:39 -070027 "bionic/ndk_cruft_data.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -070028]
29
30libc_common_src_files_32 = [
31 "bionic/legacy_32_bit_support.cpp",
32 "bionic/time64.c",
33]
34
Elliott Hughes53cf3482016-08-09 13:06:41 -070035libc_common_flags = [
36 "-D_LIBC=1",
Elliott Hughes25f17e42018-02-12 15:48:01 -080037 "-D__BIONIC_LP32_USE_STAT64",
Elliott Hughes53cf3482016-08-09 13:06:41 -070038 "-Wall",
39 "-Wextra",
40 "-Wunused",
Elliott Hughes3048a362018-01-19 17:58:07 -080041 "-Wno-char-subscripts",
Elliott Hughes53cf3482016-08-09 13:06:41 -070042 "-Wno-deprecated-declarations",
Elliott Hughesb348d5c2017-07-24 16:53:11 -070043 "-Wno-gcc-compat",
Elliott Hughes8e547bd2016-08-16 15:57:47 -070044 "-Wframe-larger-than=2048",
George Burgess IVfa5410f2018-08-13 17:44:06 -070045 "-Wimplicit-fallthrough",
Elliott Hughes53cf3482016-08-09 13:06:41 -070046
47 // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
48 "-Werror=pointer-to-int-cast",
49 "-Werror=int-to-pointer-cast",
50 "-Werror=type-limits",
51 "-Werror",
Ryan Prichard8f419572018-02-20 17:09:05 -080052
53 // Clang's exit-time destructor registration hides __dso_handle, but
54 // __dso_handle needs to have default visibility on ARM32. See b/73485611.
55 "-Wexit-time-destructors",
Elliott Hughes53cf3482016-08-09 13:06:41 -070056]
57
Dan Willemsen208ae172015-09-16 16:33:27 -070058// Define some common cflags
59// ========================================================
Colin Cross50c21ab2015-10-31 23:03:05 -070060cc_defaults {
61 name: "libc_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -080062 defaults: ["linux_bionic_supported"],
Elliott Hughes53cf3482016-08-09 13:06:41 -070063 cflags: libc_common_flags,
64 asflags: libc_common_flags,
Colin Cross50c21ab2015-10-31 23:03:05 -070065 conlyflags: ["-std=gnu99"],
66 cppflags: [],
Christopher Ferris7a3681e2017-04-24 17:48:32 -070067 include_dirs: [
68 "bionic/libc/async_safe/include",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070069 ],
Colin Cross50c21ab2015-10-31 23:03:05 -070070
Colin Cross50c21ab2015-10-31 23:03:05 -070071 stl: "none",
72 system_shared_libs: [],
Colin Cross27c43c52016-04-07 13:27:24 -070073 sanitize: {
Evgenii Stepanovbe551f52018-08-13 16:46:15 -070074 address: false,
75 integer_overflow: false,
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -070076 // TODO(b/132640749): Fix broken fuzzer support.
77 fuzzer: false,
Colin Cross27c43c52016-04-07 13:27:24 -070078 },
Colin Cross50c21ab2015-10-31 23:03:05 -070079 native_coverage: false,
Jiyong Park5603c6e2018-04-27 21:53:11 +090080 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +020081 native_bridge_supported: true,
Ivan Lozanof17fd1d2018-11-27 07:56:17 -080082
Yi Konge3d90de2019-02-20 14:28:56 -080083 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the
84 // warning since this is intended right now.
85 ldflags: ["-Wl,-z,muldefs"],
Peter Collingbournee99912f2019-11-01 15:37:00 -070086
87 product_variables: {
88 experimental_mte: {
89 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
90 },
91 },
Dan Willemsen208ae172015-09-16 16:33:27 -070092}
93
Christopher Ferrise55e5ee2019-10-01 17:54:42 -070094// Defaults for native allocator libs/includes to make it
95// easier to change.
96// To enable scudo, change the below to libc_scudo_defaults
97// and comment out the defaults line in libc_scudo shared
98// library.
99// ========================================================
100cc_defaults {
101 name: "libc_native_allocator_defaults",
102
103 defaults: ["libc_jemalloc5_defaults"],
104}
105
106cc_defaults {
107 name: "libc_jemalloc5_defaults",
108
109 include_dirs: [
110 "external/jemalloc_new/include",
111 ],
112
113 whole_static_libs: [
114 "libjemalloc5",
115 "libc_jemalloc_wrapper",
116 ],
117}
118
119// Functions not implemented by jemalloc directly, or that need to
120// be modified for Android.
121cc_library_static {
122 name: "libc_jemalloc_wrapper",
123 defaults: ["libc_defaults"],
124 srcs: ["bionic/jemalloc_wrapper.cpp"],
125 cflags: ["-fvisibility=hidden"],
126
127 include_dirs: [
128 "external/jemalloc_new/include",
129 ],
130}
131
132cc_defaults {
133 name: "libc_scudo_defaults",
134
135 cflags: [
136 "-DUSE_SCUDO",
137 ],
138
139 whole_static_libs: [
140 "libscudo",
141 ],
142}
143
Dan Willemsen208ae172015-09-16 16:33:27 -0700144// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -0700145// libc_bootstrap.a - -fno-stack-protector and -ffreestanding
Dan Willemsen208ae172015-09-16 16:33:27 -0700146// ========================================================
147//
Ryan Prichard249757b2019-11-01 17:18:28 -0700148// Code that implements the stack protector (or that runs before TLS has been set up) needs to be
149// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker,
150// some of this code runs before ifunc resolvers have made string.h functions work, so compile with
151// -ffreestanding.
Dan Willemsen208ae172015-09-16 16:33:27 -0700152
153cc_library_static {
154
Colin Crossa3f9fca2016-01-11 13:20:55 -0800155 srcs: [
156 "bionic/__libc_init_main_thread.cpp",
157 "bionic/__stack_chk_fail.cpp",
Ryan Prichard249757b2019-11-01 17:18:28 -0700158 "bionic/bionic_call_ifunc_resolver.cpp",
159 "bionic/getauxval.cpp",
Colin Crossa3f9fca2016-01-11 13:20:55 -0800160 ],
161 arch: {
162 arm64: {
163 srcs: ["arch-arm64/bionic/__set_tls.c"],
164 },
165 x86: {
Ryan Prichard27475b52018-05-17 17:14:18 -0700166 srcs: [
167 "arch-x86/bionic/__libc_init_sysinfo.cpp",
168 "arch-x86/bionic/__set_tls.cpp",
169 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800170 },
171 x86_64: {
172 srcs: ["arch-x86_64/bionic/__set_tls.c"],
173 },
174 },
175
Colin Cross50c21ab2015-10-31 23:03:05 -0700176 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700177 cflags: ["-fno-stack-protector", "-ffreestanding"],
178 name: "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -0700179}
180
Ryan Prichard249757b2019-11-01 17:18:28 -0700181// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector.
182// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes
183// the stack protector global variable.
Colin Crossa3f9fca2016-01-11 13:20:55 -0800184
185cc_library_static {
186 name: "libc_init_static",
187 defaults: ["libc_defaults"],
188 srcs: ["bionic/libc_init_static.cpp"],
Ryan Prichard249757b2019-11-01 17:18:28 -0700189 cflags: [
190 "-fno-stack-protector",
191
192 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called
193 // from the linker before ifunc resolvers have made string.h functions available.
194 "-ffreestanding",
195 ],
Colin Crossa3f9fca2016-01-11 13:20:55 -0800196}
197
Stephen Cranef4b1cbd2017-05-09 14:27:43 -0700198cc_library_static {
199 name: "libc_init_dynamic",
200 defaults: ["libc_defaults"],
201 srcs: ["bionic/libc_init_dynamic.cpp"],
202 cflags: ["-fno-stack-protector"],
203}
Colin Crossa3f9fca2016-01-11 13:20:55 -0800204
Dan Willemsen208ae172015-09-16 16:33:27 -0700205// ========================================================
206// libc_tzcode.a - upstream 'tzcode' code
207// ========================================================
208
209cc_library_static {
210
Colin Cross50c21ab2015-10-31 23:03:05 -0700211 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700212 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800213 "tzcode/**/*.c",
Elliott Hughes0e8616a2017-04-11 14:44:51 -0700214 "tzcode/bionic.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700215 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
216 ],
217
Colin Cross50c21ab2015-10-31 23:03:05 -0700218 cflags: [
Dan Willemsen268a6732015-10-15 14:49:45 -0700219 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700220 // Don't use ridiculous amounts of stack.
221 "-DALL_STATE",
222 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
223 "-DSTD_INSPIRED",
Colin Crossa35d23d2015-11-19 13:32:49 -0800224 // Obviously, we want to be thread-safe.
Dan Willemsen268a6732015-10-15 14:49:45 -0700225 "-DTHREAD_SAFE",
Dan Willemsen208ae172015-09-16 16:33:27 -0700226 // The name of the tm_gmtoff field in our struct tm.
227 "-DTM_GMTOFF=tm_gmtoff",
228 // Where we store our tzdata.
Colin Cross7b294952016-09-29 14:08:13 -0700229 "-DTZDIR=\"/system/usr/share/zoneinfo\"",
Elliott Hughes0a610d02016-07-29 14:04:17 -0700230 // Include `tzname`, `timezone`, and `daylight` globals.
231 "-DHAVE_POSIX_DECLS=0",
Dan Willemsen208ae172015-09-16 16:33:27 -0700232 "-DUSG_COMPAT=1",
Colin Crossa35d23d2015-11-19 13:32:49 -0800233 // Use the empty string (instead of " ") as the timezone abbreviation
234 // fallback.
Colin Cross7b294952016-09-29 14:08:13 -0700235 "-DWILDABBR=\"\"",
Dan Willemsen208ae172015-09-16 16:33:27 -0700236 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
237 "-Dlint",
238 ],
239
Dan Willemsen208ae172015-09-16 16:33:27 -0700240 local_include_dirs: ["tzcode/"],
241 name: "libc_tzcode",
Dan Willemsen208ae172015-09-16 16:33:27 -0700242}
243
244// ========================================================
245// libc_dns.a - modified NetBSD DNS code
246// ========================================================
247
248cc_library_static {
249
Colin Cross50c21ab2015-10-31 23:03:05 -0700250 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700251 srcs: [
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800252 "dns/**/*.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700253
254 "upstream-netbsd/lib/libc/isc/ev_streams.c",
255 "upstream-netbsd/lib/libc/isc/ev_timers.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700256 ],
257
Colin Cross50c21ab2015-10-31 23:03:05 -0700258 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700259 "-DANDROID_CHANGES",
260 "-DINET6",
Dan Willemsen208ae172015-09-16 16:33:27 -0700261 "-Wno-unused-parameter",
262 "-include netbsd-compat.h",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700263 "-Wframe-larger-than=66000",
Dan Willemsen208ae172015-09-16 16:33:27 -0700264 ],
265
Dan Willemsen208ae172015-09-16 16:33:27 -0700266 local_include_dirs: [
267 "dns/include",
268 "private",
269 "upstream-netbsd/lib/libc/include",
270 "upstream-netbsd/android/include",
271 ],
272
273 name: "libc_dns",
Dan Willemsen208ae172015-09-16 16:33:27 -0700274}
275
276// ========================================================
277// libc_freebsd.a - upstream FreeBSD C library code
278// ========================================================
279//
280// These files are built with the freebsd-compat.h header file
281// automatically included.
282
283cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700284 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700285 srcs: [
286 "upstream-freebsd/lib/libc/gen/ldexp.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700287 "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700288 "upstream-freebsd/lib/libc/stdlib/hcreate.c",
289 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c",
290 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c",
291 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700292 "upstream-freebsd/lib/libc/stdlib/qsort.c",
293 "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700294 "upstream-freebsd/lib/libc/string/wcpcpy.c",
295 "upstream-freebsd/lib/libc/string/wcpncpy.c",
296 "upstream-freebsd/lib/libc/string/wcscasecmp.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700297 "upstream-freebsd/lib/libc/string/wcscat.c",
298 "upstream-freebsd/lib/libc/string/wcschr.c",
299 "upstream-freebsd/lib/libc/string/wcscmp.c",
300 "upstream-freebsd/lib/libc/string/wcscpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700301 "upstream-freebsd/lib/libc/string/wcscspn.c",
302 "upstream-freebsd/lib/libc/string/wcsdup.c",
303 "upstream-freebsd/lib/libc/string/wcslcat.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700304 "upstream-freebsd/lib/libc/string/wcslen.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700305 "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
306 "upstream-freebsd/lib/libc/string/wcsncat.c",
307 "upstream-freebsd/lib/libc/string/wcsncmp.c",
308 "upstream-freebsd/lib/libc/string/wcsncpy.c",
309 "upstream-freebsd/lib/libc/string/wcsnlen.c",
310 "upstream-freebsd/lib/libc/string/wcspbrk.c",
Dan Willemsen268a6732015-10-15 14:49:45 -0700311 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700312 "upstream-freebsd/lib/libc/string/wcsspn.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700313 "upstream-freebsd/lib/libc/string/wcsstr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700314 "upstream-freebsd/lib/libc/string/wcstok.c",
315 "upstream-freebsd/lib/libc/string/wmemchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700316 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Elliott Hughes20f33992017-07-13 09:45:00 -0700317 "upstream-freebsd/lib/libc/string/wmemcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700318 "upstream-freebsd/lib/libc/string/wmemmove.c",
Dan Willemsen9c9aa742016-01-15 16:00:57 -0800319 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700320 ],
321 arch: {
322 arm64: {
323 exclude_srcs: [
324 "upstream-freebsd/lib/libc/string/wmemmove.c",
325 ],
326 },
327 x86: {
328 exclude_srcs: [
329 "upstream-freebsd/lib/libc/string/wcschr.c",
330 "upstream-freebsd/lib/libc/string/wcscmp.c",
331 "upstream-freebsd/lib/libc/string/wcslen.c",
332 "upstream-freebsd/lib/libc/string/wcsrchr.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700333 "upstream-freebsd/lib/libc/string/wmemcmp.c",
334 "upstream-freebsd/lib/libc/string/wcscat.c",
335 "upstream-freebsd/lib/libc/string/wcscpy.c",
336 "upstream-freebsd/lib/libc/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530337 "upstream-freebsd/lib/libc/string/wmemset.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700338 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700339 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700340 },
341
Colin Cross50c21ab2015-10-31 23:03:05 -0700342 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700343 "-Wno-sign-compare",
Elliott Hughes5702c6f2017-08-31 17:27:05 -0700344 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700345 "-include freebsd-compat.h",
346 ],
347
Dan Willemsen208ae172015-09-16 16:33:27 -0700348 local_include_dirs: [
349 "upstream-freebsd/android/include",
350 ],
351
352 name: "libc_freebsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700353}
354
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700355cc_library_static {
356 defaults: ["libc_defaults"],
357 srcs: [
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700358 "upstream-freebsd/lib/libc/gen/glob.c",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700359 "upstream-freebsd/lib/libc/stdlib/realpath.c",
360 ],
361
362 cflags: [
363 "-Wno-sign-compare",
364 "-include freebsd-compat.h",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700365 "-Wframe-larger-than=66000",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700366 ],
367
368 local_include_dirs: [
369 "upstream-freebsd/android/include",
370 ],
371
372 name: "libc_freebsd_large_stack",
373}
374
Dan Willemsen208ae172015-09-16 16:33:27 -0700375// ========================================================
376// libc_netbsd.a - upstream NetBSD C library code
377// ========================================================
378//
379// These files are built with the netbsd-compat.h header file
380// automatically included.
381
382cc_library_static {
383
Colin Cross50c21ab2015-10-31 23:03:05 -0700384 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700385 srcs: [
386 "upstream-netbsd/common/lib/libc/stdlib/random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700387 "upstream-netbsd/lib/libc/gen/nice.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700388 "upstream-netbsd/lib/libc/gen/psignal.c",
389 "upstream-netbsd/lib/libc/gen/utime.c",
390 "upstream-netbsd/lib/libc/gen/utmp.c",
391 "upstream-netbsd/lib/libc/inet/nsap_addr.c",
392 "upstream-netbsd/lib/libc/regex/regcomp.c",
393 "upstream-netbsd/lib/libc/regex/regerror.c",
394 "upstream-netbsd/lib/libc/regex/regexec.c",
395 "upstream-netbsd/lib/libc/regex/regfree.c",
396 "upstream-netbsd/lib/libc/stdlib/bsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700397 "upstream-netbsd/lib/libc/stdlib/drand48.c",
398 "upstream-netbsd/lib/libc/stdlib/erand48.c",
399 "upstream-netbsd/lib/libc/stdlib/jrand48.c",
400 "upstream-netbsd/lib/libc/stdlib/lcong48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700401 "upstream-netbsd/lib/libc/stdlib/lrand48.c",
402 "upstream-netbsd/lib/libc/stdlib/mrand48.c",
403 "upstream-netbsd/lib/libc/stdlib/nrand48.c",
404 "upstream-netbsd/lib/libc/stdlib/_rand48.c",
405 "upstream-netbsd/lib/libc/stdlib/rand_r.c",
406 "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
407 "upstream-netbsd/lib/libc/stdlib/seed48.c",
408 "upstream-netbsd/lib/libc/stdlib/srand48.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700409 ],
410 multilib: {
411 lib32: {
412 // LP32 cruft
413 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
414 },
415 },
Colin Cross50c21ab2015-10-31 23:03:05 -0700416 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700417 "-Wno-sign-compare",
Dan Willemsen879cec22016-02-29 10:37:56 -0800418 "-Wno-unused-parameter",
Dan Willemsen208ae172015-09-16 16:33:27 -0700419 "-DPOSIX_MISTAKE",
420 "-include netbsd-compat.h",
421 ],
422
Dan Willemsen208ae172015-09-16 16:33:27 -0700423 local_include_dirs: [
424 "upstream-netbsd/android/include",
425 "upstream-netbsd/lib/libc/include",
426 ],
427
428 name: "libc_netbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700429}
430
431// ========================================================
432// libc_openbsd_ndk.a - upstream OpenBSD C library code
433// that can be safely included in the libc_ndk.a (doesn't
434// contain any troublesome global data or constructors).
435// ========================================================
436//
437// These files are built with the openbsd-compat.h header file
438// automatically included.
439
440cc_library_static {
441 name: "libc_openbsd_ndk",
Colin Cross50c21ab2015-10-31 23:03:05 -0700442 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700443 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700444 "upstream-openbsd/lib/libc/gen/alarm.c",
445 "upstream-openbsd/lib/libc/gen/ctype_.c",
446 "upstream-openbsd/lib/libc/gen/daemon.c",
447 "upstream-openbsd/lib/libc/gen/err.c",
448 "upstream-openbsd/lib/libc/gen/errx.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700449 "upstream-openbsd/lib/libc/gen/fnmatch.c",
450 "upstream-openbsd/lib/libc/gen/ftok.c",
451 "upstream-openbsd/lib/libc/gen/getprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700452 "upstream-openbsd/lib/libc/gen/setprogname.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700453 "upstream-openbsd/lib/libc/gen/verr.c",
454 "upstream-openbsd/lib/libc/gen/verrx.c",
455 "upstream-openbsd/lib/libc/gen/vwarn.c",
456 "upstream-openbsd/lib/libc/gen/vwarnx.c",
457 "upstream-openbsd/lib/libc/gen/warn.c",
458 "upstream-openbsd/lib/libc/gen/warnx.c",
459 "upstream-openbsd/lib/libc/locale/btowc.c",
460 "upstream-openbsd/lib/libc/locale/mbrlen.c",
461 "upstream-openbsd/lib/libc/locale/mbstowcs.c",
462 "upstream-openbsd/lib/libc/locale/mbtowc.c",
463 "upstream-openbsd/lib/libc/locale/wcscoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700464 "upstream-openbsd/lib/libc/locale/wcstoimax.c",
465 "upstream-openbsd/lib/libc/locale/wcstol.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700466 "upstream-openbsd/lib/libc/locale/wcstoll.c",
467 "upstream-openbsd/lib/libc/locale/wcstombs.c",
468 "upstream-openbsd/lib/libc/locale/wcstoul.c",
469 "upstream-openbsd/lib/libc/locale/wcstoull.c",
470 "upstream-openbsd/lib/libc/locale/wcstoumax.c",
471 "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
472 "upstream-openbsd/lib/libc/locale/wctob.c",
473 "upstream-openbsd/lib/libc/locale/wctomb.c",
Elliott Hughes26fda772016-04-06 11:56:41 -0700474 "upstream-openbsd/lib/libc/net/base64.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700475 "upstream-openbsd/lib/libc/net/htonl.c",
476 "upstream-openbsd/lib/libc/net/htons.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700477 "upstream-openbsd/lib/libc/net/inet_lnaof.c",
478 "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
479 "upstream-openbsd/lib/libc/net/inet_netof.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700480 "upstream-openbsd/lib/libc/net/inet_ntoa.c",
481 "upstream-openbsd/lib/libc/net/inet_ntop.c",
482 "upstream-openbsd/lib/libc/net/inet_pton.c",
483 "upstream-openbsd/lib/libc/net/ntohl.c",
484 "upstream-openbsd/lib/libc/net/ntohs.c",
Colin Cross8ce38af2016-01-19 12:50:20 -0800485 "upstream-openbsd/lib/libc/net/res_random.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700486 "upstream-openbsd/lib/libc/stdio/fgetln.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700487 "upstream-openbsd/lib/libc/stdio/fgetwc.c",
488 "upstream-openbsd/lib/libc/stdio/fgetws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700489 "upstream-openbsd/lib/libc/stdio/flags.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700490 "upstream-openbsd/lib/libc/stdio/fpurge.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700491 "upstream-openbsd/lib/libc/stdio/fputwc.c",
492 "upstream-openbsd/lib/libc/stdio/fputws.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700493 "upstream-openbsd/lib/libc/stdio/fvwrite.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700494 "upstream-openbsd/lib/libc/stdio/fwide.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700495 "upstream-openbsd/lib/libc/stdio/getdelim.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700496 "upstream-openbsd/lib/libc/stdio/gets.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700497 "upstream-openbsd/lib/libc/stdio/makebuf.c",
498 "upstream-openbsd/lib/libc/stdio/mktemp.c",
499 "upstream-openbsd/lib/libc/stdio/open_memstream.c",
500 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700501 "upstream-openbsd/lib/libc/stdio/rget.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700502 "upstream-openbsd/lib/libc/stdio/setvbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700503 "upstream-openbsd/lib/libc/stdio/tempnam.c",
504 "upstream-openbsd/lib/libc/stdio/tmpnam.c",
505 "upstream-openbsd/lib/libc/stdio/ungetc.c",
506 "upstream-openbsd/lib/libc/stdio/ungetwc.c",
507 "upstream-openbsd/lib/libc/stdio/vasprintf.c",
508 "upstream-openbsd/lib/libc/stdio/vdprintf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700509 "upstream-openbsd/lib/libc/stdio/vsscanf.c",
510 "upstream-openbsd/lib/libc/stdio/vswprintf.c",
511 "upstream-openbsd/lib/libc/stdio/vswscanf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700512 "upstream-openbsd/lib/libc/stdio/wbuf.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700513 "upstream-openbsd/lib/libc/stdio/wsetup.c",
514 "upstream-openbsd/lib/libc/stdlib/abs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800515 "upstream-openbsd/lib/libc/stdlib/div.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700516 "upstream-openbsd/lib/libc/stdlib/getenv.c",
Colin Crossb8396102016-04-07 13:24:50 -0700517 "upstream-openbsd/lib/libc/stdlib/getsubopt.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700518 "upstream-openbsd/lib/libc/stdlib/insque.c",
519 "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
520 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
521 "upstream-openbsd/lib/libc/stdlib/labs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800522 "upstream-openbsd/lib/libc/stdlib/ldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700523 "upstream-openbsd/lib/libc/stdlib/llabs.c",
Elliott Hughes01809e12019-02-05 16:48:22 -0800524 "upstream-openbsd/lib/libc/stdlib/lldiv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700525 "upstream-openbsd/lib/libc/stdlib/lsearch.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700526 "upstream-openbsd/lib/libc/stdlib/remque.c",
527 "upstream-openbsd/lib/libc/stdlib/setenv.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700528 "upstream-openbsd/lib/libc/stdlib/tfind.c",
529 "upstream-openbsd/lib/libc/stdlib/tsearch.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800530 "upstream-openbsd/lib/libc/string/memccpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700531 "upstream-openbsd/lib/libc/string/strcasecmp.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800532 "upstream-openbsd/lib/libc/string/strcasestr.c",
533 "upstream-openbsd/lib/libc/string/strcoll.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700534 "upstream-openbsd/lib/libc/string/strcspn.c",
535 "upstream-openbsd/lib/libc/string/strdup.c",
536 "upstream-openbsd/lib/libc/string/strndup.c",
537 "upstream-openbsd/lib/libc/string/strpbrk.c",
538 "upstream-openbsd/lib/libc/string/strsep.c",
539 "upstream-openbsd/lib/libc/string/strspn.c",
540 "upstream-openbsd/lib/libc/string/strstr.c",
541 "upstream-openbsd/lib/libc/string/strtok.c",
Elliott Hughesfbac97a2019-02-04 16:46:24 -0800542 "upstream-openbsd/lib/libc/string/strxfrm.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700543 "upstream-openbsd/lib/libc/string/wcslcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700544 "upstream-openbsd/lib/libc/string/wcswidth.c",
545 ],
546
Colin Cross50c21ab2015-10-31 23:03:05 -0700547 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700548 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700549 "-Wno-unused-parameter",
550 "-include openbsd-compat.h",
551 ],
552
Dan Willemsen208ae172015-09-16 16:33:27 -0700553 local_include_dirs: [
554 "private",
555 "stdio",
556 "upstream-openbsd/android/include",
557 "upstream-openbsd/lib/libc/include",
558 "upstream-openbsd/lib/libc/gdtoa/",
559 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700560}
561
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700562cc_library_static {
563 name: "libc_openbsd_large_stack",
564 defaults: ["libc_defaults"],
565 srcs: [
Elliott Hughes2f9c8ce2017-11-01 13:54:47 -0700566 "stdio/vfprintf.cpp",
567 "stdio/vfwprintf.cpp",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700568 ],
569 cflags: [
570 "-include openbsd-compat.h",
571 "-Wno-sign-compare",
572 "-Wframe-larger-than=5000",
573 ],
574
575 local_include_dirs: [
Elliott Hughes3a589c22017-10-30 11:43:58 -0700576 "upstream-openbsd/android/include/",
577 "upstream-openbsd/lib/libc/include/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700578 "upstream-openbsd/lib/libc/gdtoa/",
Elliott Hughes3a589c22017-10-30 11:43:58 -0700579 "upstream-openbsd/lib/libc/stdio/",
Elliott Hughes8e547bd2016-08-16 15:57:47 -0700580 ],
581}
582
Dan Willemsen208ae172015-09-16 16:33:27 -0700583// ========================================================
584// libc_openbsd.a - upstream OpenBSD C library code
585// ========================================================
586//
587// These files are built with the openbsd-compat.h header file
588// automatically included.
589cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700590 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700591 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800592 // These two depend on getentropy, which isn't in libc_ndk.a.
Dan Willemsen208ae172015-09-16 16:33:27 -0700593 "upstream-openbsd/lib/libc/crypt/arc4random.c",
594 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
595
596 // May be overriden by per-arch optimized versions
597 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700598 "upstream-openbsd/lib/libc/string/memrchr.c",
599 "upstream-openbsd/lib/libc/string/stpcpy.c",
600 "upstream-openbsd/lib/libc/string/stpncpy.c",
601 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700602 "upstream-openbsd/lib/libc/string/strcpy.c",
603 "upstream-openbsd/lib/libc/string/strlcat.c",
604 "upstream-openbsd/lib/libc/string/strlcpy.c",
605 "upstream-openbsd/lib/libc/string/strncat.c",
606 "upstream-openbsd/lib/libc/string/strncmp.c",
607 "upstream-openbsd/lib/libc/string/strncpy.c",
608 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700609
610 arch: {
611 arm: {
612 exclude_srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700613 "upstream-openbsd/lib/libc/string/strcpy.c",
Haibo Huangea9957a2018-11-19 11:00:32 -0800614 "upstream-openbsd/lib/libc/string/stpcpy.c",
615 "upstream-openbsd/lib/libc/string/strcat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700616 ],
617 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700618 arm64: {
619 exclude_srcs: [
620 "upstream-openbsd/lib/libc/string/memchr.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700621 "upstream-openbsd/lib/libc/string/stpcpy.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700622 "upstream-openbsd/lib/libc/string/strcpy.c",
623 "upstream-openbsd/lib/libc/string/strncmp.c",
624 ],
625 },
Prashant Patilfcb877a2017-03-16 18:07:00 +0530626 mips: {
627 exclude_srcs: [
628 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530629 "upstream-openbsd/lib/libc/string/strcpy.c",
630 "upstream-openbsd/lib/libc/string/strncmp.c",
631 ],
632 },
633 mips64: {
634 exclude_srcs: [
635 "upstream-openbsd/lib/libc/string/memchr.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530636 "upstream-openbsd/lib/libc/string/strcpy.c",
637 "upstream-openbsd/lib/libc/string/strncmp.c",
638 ],
639 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700640 x86: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800641 exclude_srcs: [
642 "upstream-openbsd/lib/libc/string/memchr.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800643 "upstream-openbsd/lib/libc/string/memrchr.c",
644 "upstream-openbsd/lib/libc/string/stpcpy.c",
645 "upstream-openbsd/lib/libc/string/stpncpy.c",
646 "upstream-openbsd/lib/libc/string/strcat.c",
647 "upstream-openbsd/lib/libc/string/strcpy.c",
648 "upstream-openbsd/lib/libc/string/strncmp.c",
649 "upstream-openbsd/lib/libc/string/strncpy.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700650 "upstream-openbsd/lib/libc/string/strlcat.c",
651 "upstream-openbsd/lib/libc/string/strlcpy.c",
652 "upstream-openbsd/lib/libc/string/strncat.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800653 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700654 },
655
656 x86_64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800657 exclude_srcs: [
Colin Cross6ab8f892015-11-23 14:12:15 -0800658 "upstream-openbsd/lib/libc/string/stpcpy.c",
659 "upstream-openbsd/lib/libc/string/stpncpy.c",
660 "upstream-openbsd/lib/libc/string/strcat.c",
661 "upstream-openbsd/lib/libc/string/strcpy.c",
Colin Cross6ab8f892015-11-23 14:12:15 -0800662 "upstream-openbsd/lib/libc/string/strncat.c",
663 "upstream-openbsd/lib/libc/string/strncmp.c",
664 "upstream-openbsd/lib/libc/string/strncpy.c",
665 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700666 },
667 },
668
Colin Cross50c21ab2015-10-31 23:03:05 -0700669 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700670 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700671 "-Wno-unused-parameter",
672 "-include openbsd-compat.h",
673 ],
674
Dan Willemsen208ae172015-09-16 16:33:27 -0700675 local_include_dirs: [
676 "private",
Dan Willemsen208ae172015-09-16 16:33:27 -0700677 "upstream-openbsd/android/include",
Dan Willemsen208ae172015-09-16 16:33:27 -0700678 ],
679
680 name: "libc_openbsd",
Dan Willemsen208ae172015-09-16 16:33:27 -0700681}
682
683// ========================================================
684// libc_gdtoa.a - upstream OpenBSD C library gdtoa code
685// ========================================================
686//
687// These files are built with the openbsd-compat.h header file
688// automatically included.
689
690cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700691 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700692 srcs: [
693 "upstream-openbsd/android/gdtoa_support.cpp",
694 "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
695 "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
696 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
697 "upstream-openbsd/lib/libc/gdtoa/gethex.c",
698 "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
699 "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
700 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
701 "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
702 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
703 "upstream-openbsd/lib/libc/gdtoa/misc.c",
704 "upstream-openbsd/lib/libc/gdtoa/smisc.c",
705 "upstream-openbsd/lib/libc/gdtoa/strtod.c",
706 "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
707 "upstream-openbsd/lib/libc/gdtoa/strtof.c",
708 "upstream-openbsd/lib/libc/gdtoa/strtord.c",
709 "upstream-openbsd/lib/libc/gdtoa/sum.c",
710 "upstream-openbsd/lib/libc/gdtoa/ulp.c",
711 ],
712 multilib: {
713 lib64: {
Colin Cross6ab8f892015-11-23 14:12:15 -0800714 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700715 },
716 },
717
Colin Cross50c21ab2015-10-31 23:03:05 -0700718 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700719 "-Wno-sign-compare",
Dan Willemsen208ae172015-09-16 16:33:27 -0700720 "-include openbsd-compat.h",
721 ],
722
Dan Willemsen208ae172015-09-16 16:33:27 -0700723 local_include_dirs: [
724 "private",
725 "upstream-openbsd/android/include",
726 "upstream-openbsd/lib/libc/include",
727 ],
728
729 name: "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -0700730}
731
732// ========================================================
George Burgess IV6cb06872017-07-21 13:28:42 -0700733// libc_fortify.a - container for our FORITFY
734// implementation details
735// ========================================================
736cc_library_static {
737 defaults: ["libc_defaults"],
George Burgess IVd34b0a92017-07-25 11:43:39 -0700738 srcs: ["bionic/fortify.cpp"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700739
740 name: "libc_fortify",
741
742 // Disable FORTIFY for the compilation of these, so we don't end up having
743 // FORTIFY silently call itself.
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800744 cflags: [
745 "-U_FORTIFY_SOURCE",
746 "-D__BIONIC_DECLARE_FORTIFY_HELPERS",
747 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700748
749 arch: {
750 arm: {
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800751 cflags: [
752 "-DNO___MEMCPY_CHK",
753 "-DRENAME___STRCAT_CHK",
754 "-DRENAME___STRCPY_CHK",
755 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700756 srcs: [
757 "arch-arm/generic/bionic/__memcpy_chk.S",
Haibo Huangf1c8d1a2018-11-27 15:38:47 -0800758
759 "arch-arm/cortex-a15/bionic/__strcat_chk.S",
760 "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
761
762 "arch-arm/cortex-a7/bionic/__strcat_chk.S",
763 "arch-arm/cortex-a7/bionic/__strcpy_chk.S",
764
765 "arch-arm/cortex-a9/bionic/__strcat_chk.S",
766 "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
767
768 "arch-arm/krait/bionic/__strcat_chk.S",
769 "arch-arm/krait/bionic/__strcpy_chk.S",
770
771 "arch-arm/cortex-a53/bionic/__strcat_chk.S",
772 "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
773
Haibo Huang01bfd892018-12-03 15:05:16 -0800774 "arch-arm/cortex-a55/bionic/__strcat_chk.S",
775 "arch-arm/cortex-a55/bionic/__strcpy_chk.S",
George Burgess IV6cb06872017-07-21 13:28:42 -0700776 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700777 },
778 arm64: {
George Burgess IVd34b0a92017-07-25 11:43:39 -0700779 cflags: ["-DNO___MEMCPY_CHK"],
George Burgess IV6cb06872017-07-21 13:28:42 -0700780 srcs: [
781 "arch-arm64/generic/bionic/__memcpy_chk.S",
782 ],
George Burgess IV6cb06872017-07-21 13:28:42 -0700783 },
784 },
785}
786
787// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -0700788// libc_bionic.a - home-grown C library code
789// ========================================================
790
791cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -0700792 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700793 srcs: [
Elliott Hughes211c4d32018-02-02 15:10:32 -0800794 // These require getauxval, which isn't available on older platforms.
Dan Willemsen208ae172015-09-16 16:33:27 -0700795 "bionic/sysconf.cpp",
796 "bionic/vdso.cpp",
Dan Willemsen35e91a12015-09-17 15:28:45 -0700797 "bionic/setjmp_cookie.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700798
Josh Gao10ec9282017-04-03 15:13:29 -0700799 // The following must not be statically linked into libc_ndk.a, because
800 // debuggerd will look for the abort message in libc.so's copy.
801 "bionic/android_set_abort_message.cpp",
802
Dan Willemsen208ae172015-09-16 16:33:27 -0700803 "bionic/strchr.cpp",
804 "bionic/strnlen.c",
805 "bionic/strrchr.cpp",
806 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700807
808 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -0700809 arm: {
Elliott Hughes1b61d782019-06-04 10:38:34 -0700810 asflags: libc_common_flags + ["-mno-restrict-it"],
Dan Willemsen208ae172015-09-16 16:33:27 -0700811 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800812 "arch-arm/generic/bionic/memcmp.S",
Elliott Hughesda46cae2018-05-24 14:40:32 -0700813 "arch-arm/generic/bionic/memmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800814 "arch-arm/generic/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800815 "arch-arm/generic/bionic/stpcpy.c",
816 "arch-arm/generic/bionic/strcat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800817 "arch-arm/generic/bionic/strcmp.S",
818 "arch-arm/generic/bionic/strcpy.S",
819 "arch-arm/generic/bionic/strlen.c",
820
Ryan Prichard45024fe2018-12-30 21:10:26 -0800821 "arch-arm/bionic/__aeabi_read_tp.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700822 "arch-arm/bionic/__bionic_clone.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700823 "arch-arm/bionic/__restore.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700824 "arch-arm/bionic/_exit_with_stack_teardown.S",
Yi Kongb410d0e2019-04-22 16:00:46 -0700825 "arch-arm/bionic/atomics_arm.c",
826 "arch-arm/bionic/bpabi.c",
Yi Kong165b1cf2019-02-13 14:10:10 -0800827 "arch-arm/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700828 "arch-arm/bionic/popcount_tab.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700829 "arch-arm/bionic/setjmp.S",
830 "arch-arm/bionic/syscall.S",
831 "arch-arm/bionic/vfork.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800832
833 "arch-arm/cortex-a15/bionic/memcpy.S",
834 "arch-arm/cortex-a15/bionic/memmove.S",
835 "arch-arm/cortex-a15/bionic/memset.S",
836 "arch-arm/cortex-a15/bionic/stpcpy.S",
837 "arch-arm/cortex-a15/bionic/strcat.S",
838 "arch-arm/cortex-a15/bionic/strcmp.S",
839 "arch-arm/cortex-a15/bionic/strcpy.S",
840 "arch-arm/cortex-a15/bionic/strlen.S",
841
842 "arch-arm/cortex-a7/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800843 "arch-arm/cortex-a7/bionic/memset.S",
844
845 "arch-arm/cortex-a9/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800846 "arch-arm/cortex-a9/bionic/memset.S",
847 "arch-arm/cortex-a9/bionic/stpcpy.S",
848 "arch-arm/cortex-a9/bionic/strcat.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800849 "arch-arm/cortex-a9/bionic/strcpy.S",
850 "arch-arm/cortex-a9/bionic/strlen.S",
851
852 "arch-arm/krait/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800853 "arch-arm/krait/bionic/memset.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800854
855 "arch-arm/cortex-a53/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800856
Haibo Huang01bfd892018-12-03 15:05:16 -0800857 "arch-arm/cortex-a55/bionic/memcpy.S",
Haibo Huangea9957a2018-11-19 11:00:32 -0800858
859 "arch-arm/kryo/bionic/memcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700860 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700861 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700862 arm64: {
863 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700864 "arch-arm64/generic/bionic/memcmp.S",
865 "arch-arm64/generic/bionic/memcpy.S",
866 "arch-arm64/generic/bionic/memmove.S",
867 "arch-arm64/generic/bionic/memset.S",
868 "arch-arm64/generic/bionic/stpcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700869 "arch-arm64/generic/bionic/strcpy.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700870 "arch-arm64/generic/bionic/wmemmove.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800871
Peter Collingbourne900d07d2019-10-28 13:11:00 -0700872 "arch-arm64/default/bionic/memchr.S",
873 "arch-arm64/default/bionic/strchr.S",
874 "arch-arm64/default/bionic/strcmp.S",
875 "arch-arm64/default/bionic/strlen.S",
876 "arch-arm64/default/bionic/strncmp.S",
877 "arch-arm64/default/bionic/strnlen.S",
878
879 "arch-arm64/mte/bionic/memchr.c",
880 "arch-arm64/mte/bionic/strchr.cpp",
881 "arch-arm64/mte/bionic/strcmp.c",
882 "arch-arm64/mte/bionic/strlen.c",
883 "arch-arm64/mte/bionic/strncmp.c",
884 "arch-arm64/mte/bionic/strnlen.c",
885
Dan Willemsen3e621712016-02-03 21:48:08 -0800886 "arch-arm64/bionic/__bionic_clone.S",
887 "arch-arm64/bionic/_exit_with_stack_teardown.S",
888 "arch-arm64/bionic/setjmp.S",
889 "arch-arm64/bionic/syscall.S",
890 "arch-arm64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700891 ],
892 exclude_srcs: [
893 "bionic/__memcpy_chk.cpp",
894 "bionic/strchr.cpp",
895 "bionic/strnlen.c",
896 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700897 },
898
899 mips: {
900 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800901 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530902 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800903 "arch-mips/string/memset.S",
904 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530905 "arch-mips/string/strncmp.S",
906 "arch-mips/string/strlen.c",
907 "arch-mips/string/strnlen.c",
908 "arch-mips/string/strchr.c",
909 "arch-mips/string/strcpy.c",
910 "arch-mips/string/memchr.c",
911 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800912
Dan Willemsen208ae172015-09-16 16:33:27 -0700913 "arch-mips/bionic/__bionic_clone.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700914 "arch-mips/bionic/cacheflush.cpp",
915 "arch-mips/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800916 "arch-mips/bionic/libcrt_compat.c",
Dan Willemsen208ae172015-09-16 16:33:27 -0700917 "arch-mips/bionic/setjmp.S",
918 "arch-mips/bionic/syscall.S",
919 "arch-mips/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700920 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530921 exclude_srcs: [
922 "bionic/strchr.cpp",
923 "bionic/strnlen.c",
924 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700925 },
Dan Willemsen208ae172015-09-16 16:33:27 -0700926 mips64: {
927 srcs: [
Dan Willemsen3e621712016-02-03 21:48:08 -0800928 "arch-mips/string/memcmp.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530929 "arch-mips/string/memcpy.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800930 "arch-mips/string/memset.S",
931 "arch-mips/string/strcmp.S",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530932 "arch-mips/string/strncmp.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800933 "arch-mips/string/strlen.c",
Prashant Patilfcb877a2017-03-16 18:07:00 +0530934 "arch-mips/string/strnlen.c",
935 "arch-mips/string/strchr.c",
936 "arch-mips/string/strcpy.c",
937 "arch-mips/string/memchr.c",
938 "arch-mips/string/memmove.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800939
Dan Willemsen208ae172015-09-16 16:33:27 -0700940 "arch-mips64/bionic/__bionic_clone.S",
941 "arch-mips64/bionic/_exit_with_stack_teardown.S",
942 "arch-mips64/bionic/setjmp.S",
943 "arch-mips64/bionic/syscall.S",
944 "arch-mips64/bionic/vfork.S",
945 "arch-mips64/bionic/stat.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -0700946 ],
Prashant Patilfcb877a2017-03-16 18:07:00 +0530947 exclude_srcs: [
948 "bionic/strchr.cpp",
949 "bionic/strnlen.c",
950 ],
Dan Willemsen208ae172015-09-16 16:33:27 -0700951 },
952
953 x86: {
954 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -0700955 "arch-x86/generic/string/memcmp.S",
956 "arch-x86/generic/string/strcmp.S",
957 "arch-x86/generic/string/strncmp.S",
958 "arch-x86/generic/string/strcat.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700959
960 "arch-x86/generic/string/strlcat.c",
961 "arch-x86/generic/string/strlcpy.c",
962 "arch-x86/generic/string/strncat.c",
963 "arch-x86/generic/string/wcscat.c",
964 "arch-x86/generic/string/wcscpy.c",
965 "arch-x86/generic/string/wmemcmp.c",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +0530966 "arch-x86/generic/string/wmemset.c",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700967
Dan Willemsen208ae172015-09-16 16:33:27 -0700968 "arch-x86/atom/string/sse2-memchr-atom.S",
969 "arch-x86/atom/string/sse2-memrchr-atom.S",
970 "arch-x86/atom/string/sse2-strchr-atom.S",
971 "arch-x86/atom/string/sse2-strnlen-atom.S",
972 "arch-x86/atom/string/sse2-strrchr-atom.S",
973 "arch-x86/atom/string/sse2-wcschr-atom.S",
974 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
975 "arch-x86/atom/string/sse2-wcslen-atom.S",
976 "arch-x86/atom/string/sse2-wcscmp-atom.S",
Dan Willemsen208ae172015-09-16 16:33:27 -0700977 "arch-x86/silvermont/string/sse2-memmove-slm.S",
978 "arch-x86/silvermont/string/sse2-memset-slm.S",
979 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
980 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
981 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
982 "arch-x86/silvermont/string/sse2-strlen-slm.S",
983 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
Dan Willemsen3e621712016-02-03 21:48:08 -0800984
985 "arch-x86/bionic/__bionic_clone.S",
986 "arch-x86/bionic/_exit_with_stack_teardown.S",
Yi Kong165b1cf2019-02-13 14:10:10 -0800987 "arch-x86/bionic/libcrt_compat.c",
Dan Willemsen3e621712016-02-03 21:48:08 -0800988 "arch-x86/bionic/__restore.S",
989 "arch-x86/bionic/setjmp.S",
990 "arch-x86/bionic/syscall.S",
991 "arch-x86/bionic/vfork.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -0700992
993 // ssse3 functions
994 "arch-x86/atom/string/ssse3-strcat-atom.S",
995 "arch-x86/atom/string/ssse3-strcmp-atom.S",
996 "arch-x86/atom/string/ssse3-strlcat-atom.S",
997 "arch-x86/atom/string/ssse3-strlcpy-atom.S",
998 "arch-x86/atom/string/ssse3-strncat-atom.S",
999 "arch-x86/atom/string/ssse3-strncmp-atom.S",
1000 "arch-x86/atom/string/ssse3-wcscat-atom.S",
1001 "arch-x86/atom/string/ssse3-wcscpy-atom.S",
1002
1003 // sse4 functions
1004 "arch-x86/silvermont/string/sse4-memcmp-slm.S",
1005 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
1006
1007 // atom functions
1008 "arch-x86/atom/string/sse2-memset-atom.S",
1009 "arch-x86/atom/string/sse2-strlen-atom.S",
1010 "arch-x86/atom/string/ssse3-memcmp-atom.S",
Haibo Huange1413622018-11-13 14:20:43 -08001011 "arch-x86/atom/string/ssse3-memmove-atom.S",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001012 "arch-x86/atom/string/ssse3-strcpy-atom.S",
1013 "arch-x86/atom/string/ssse3-strncpy-atom.S",
1014 "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +05301015
1016 // avx2 functions
1017 "arch-x86/kabylake/string/avx2-wmemset-kbl.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001018 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001019
1020 exclude_srcs: [
1021 "bionic/strchr.cpp",
1022 "bionic/strnlen.c",
1023 "bionic/strrchr.cpp",
1024 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001025 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001026 x86_64: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001027 srcs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001028 "arch-x86_64/string/sse2-memmove-slm.S",
1029 "arch-x86_64/string/sse2-memset-slm.S",
1030 "arch-x86_64/string/sse2-stpcpy-slm.S",
1031 "arch-x86_64/string/sse2-stpncpy-slm.S",
1032 "arch-x86_64/string/sse2-strcat-slm.S",
1033 "arch-x86_64/string/sse2-strcpy-slm.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001034 "arch-x86_64/string/sse2-strlen-slm.S",
1035 "arch-x86_64/string/sse2-strncat-slm.S",
1036 "arch-x86_64/string/sse2-strncpy-slm.S",
1037 "arch-x86_64/string/sse4-memcmp-slm.S",
1038 "arch-x86_64/string/ssse3-strcmp-slm.S",
1039 "arch-x86_64/string/ssse3-strncmp-slm.S",
Shalini Salomi Bodapati4ed2f472019-06-13 09:54:08 +05301040 "arch-x86_64/string/avx2-wmemset-kbl.S",
Dan Willemsen3e621712016-02-03 21:48:08 -08001041
1042 "arch-x86_64/bionic/__bionic_clone.S",
1043 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
1044 "arch-x86_64/bionic/__restore_rt.S",
1045 "arch-x86_64/bionic/setjmp.S",
1046 "arch-x86_64/bionic/syscall.S",
1047 "arch-x86_64/bionic/vfork.S",
Dan Willemsen208ae172015-09-16 16:33:27 -07001048 ],
1049 },
Dan Willemsen268a6732015-10-15 14:49:45 -07001050 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001051
Colin Cross50c21ab2015-10-31 23:03:05 -07001052 cppflags: ["-Wold-style-cast"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001053 include_dirs: ["bionic/libstdc++/include"],
1054 name: "libc_bionic",
Dan Willemsen268a6732015-10-15 14:49:45 -07001055}
1056
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001057genrule {
1058 name: "generated_android_ids",
Colin Cross35bbed82017-01-17 18:16:07 -08001059 out: ["generated_android_ids.h"],
1060 srcs: [":android_filesystem_config_header"],
1061 tool_files: ["fs_config_generator.py"],
1062 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001063}
1064
Dan Willemsen268a6732015-10-15 14:49:45 -07001065// ========================================================
1066// libc_bionic_ndk.a- The portions of libc_bionic that can
1067// be safely used in libc_ndk.a (no troublesome global data
1068// or constructors).
1069// ========================================================
1070cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001071 defaults: ["libc_defaults"],
Dan Willemsen268a6732015-10-15 14:49:45 -07001072 srcs: [
Dan Alberte2fd0102017-07-11 14:27:07 -07001073 "bionic/NetdClientDispatch.cpp",
Sandeep Patil9b1ca562017-08-21 12:17:19 -07001074 "bionic/__bionic_get_shell_path.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001075 "bionic/__cmsg_nxthdr.cpp",
1076 "bionic/__errno.cpp",
1077 "bionic/__gnu_basename.cpp",
1078 "bionic/__libc_current_sigrtmax.cpp",
1079 "bionic/__libc_current_sigrtmin.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001080 "bionic/abort.cpp",
1081 "bionic/accept.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001082 "bionic/access.cpp",
1083 "bionic/arpa_inet.cpp",
1084 "bionic/assert.cpp",
1085 "bionic/atof.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001086 "bionic/bionic_allocator.cpp",
Josh Gaoa170d9b2016-11-10 16:08:29 -08001087 "bionic/bionic_arc4random.cpp",
Tom Cherryac49ced2017-08-17 13:18:52 -07001088 "bionic/bionic_futex.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001089 "bionic/bionic_netlink.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001090 "bionic/bionic_systrace.cpp",
1091 "bionic/bionic_time_conversions.cpp",
1092 "bionic/brk.cpp",
1093 "bionic/c16rtomb.cpp",
1094 "bionic/c32rtomb.cpp",
1095 "bionic/chmod.cpp",
1096 "bionic/chown.cpp",
1097 "bionic/clearenv.cpp",
1098 "bionic/clock.cpp",
1099 "bionic/clock_getcpuclockid.cpp",
1100 "bionic/clock_nanosleep.cpp",
1101 "bionic/clone.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001102 "bionic/ctype.cpp",
1103 "bionic/dirent.cpp",
1104 "bionic/dup2.cpp",
Victor Khimenko0a0743f2017-07-10 21:15:37 +02001105 "bionic/environ.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001106 "bionic/error.cpp",
1107 "bionic/eventfd_read.cpp",
1108 "bionic/eventfd_write.cpp",
Elliott Hughese19c6722016-08-26 16:15:57 +00001109 "bionic/exec.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001110 "bionic/faccessat.cpp",
1111 "bionic/fchmod.cpp",
1112 "bionic/fchmodat.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -07001113 "bionic/fdsan.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001114 "bionic/ffs.cpp",
1115 "bionic/fgetxattr.cpp",
1116 "bionic/flistxattr.cpp",
1117 "bionic/flockfile.cpp",
1118 "bionic/fpclassify.cpp",
1119 "bionic/fsetxattr.cpp",
1120 "bionic/ftruncate.cpp",
Elliott Hughes13d79ab2016-04-15 17:40:33 -07001121 "bionic/ftw.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001122 "bionic/futimens.cpp",
1123 "bionic/getcwd.cpp",
Dan Willemsen23aae1c2016-03-29 15:21:38 -07001124 "bionic/getdomainname.cpp",
Elliott Hughes211c4d32018-02-02 15:10:32 -08001125 "bionic/getentropy.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001126 "bionic/gethostname.cpp",
Elliott Hughes2d0b28b2018-10-23 11:23:00 -07001127 "bionic/getloadavg.cpp",
Elliott Hughese4510a22016-04-06 08:34:58 -07001128 "bionic/getpagesize.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001129 "bionic/getpgrp.cpp",
1130 "bionic/getpid.cpp",
Elliott Hughes8f0e42f2016-11-29 15:10:29 -08001131 "bionic/getpriority.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001132 "bionic/gettid.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -07001133 "bionic/get_device_api_level.cpp",
Mark Salyzynb38347a2016-04-05 09:09:46 -07001134 "bionic/grp_pwd.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -08001135 "bionic/grp_pwd_file.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -07001136 "bionic/iconv.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001137 "bionic/icu_wrappers.cpp",
Dan Willemsen9b59acc2016-01-05 14:32:06 -08001138 "bionic/ifaddrs.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001139 "bionic/inotify_init.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001140 "bionic/ioctl.cpp",
Elliott Hughes7532b322017-07-11 15:00:17 -07001141 "bionic/killpg.cpp",
Elliott Hughesfc8e6882016-11-18 16:27:29 -08001142 "bionic/langinfo.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001143 "bionic/lchown.cpp",
1144 "bionic/lfs64_support.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001145 "bionic/libc_init_common.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001146 "bionic/libgen.cpp",
1147 "bionic/link.cpp",
1148 "bionic/locale.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001149 "bionic/lockf.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001150 "bionic/lstat.cpp",
Colin Crossee847862016-04-29 14:06:07 -07001151 "bionic/mblen.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001152 "bionic/mbrtoc16.cpp",
1153 "bionic/mbrtoc32.cpp",
Elliott Hughescae33ad2016-08-15 14:14:40 -07001154 "bionic/memmem.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001155 "bionic/mempcpy.cpp",
1156 "bionic/mkdir.cpp",
1157 "bionic/mkfifo.cpp",
1158 "bionic/mknod.cpp",
1159 "bionic/mntent.cpp",
Dan Willemsendc6b0a72015-11-09 14:03:46 -08001160 "bionic/mremap.cpp",
Colin Cross8ce38af2016-01-19 12:50:20 -08001161 "bionic/net_if.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001162 "bionic/netdb.cpp",
Dan Willemsen3e621712016-02-03 21:48:08 -08001163 "bionic/netinet_in.cpp",
Elliott Hughes6cfb84b2016-04-06 17:14:45 -07001164 "bionic/nl_types.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001165 "bionic/open.cpp",
1166 "bionic/pathconf.cpp",
1167 "bionic/pause.cpp",
1168 "bionic/pipe.cpp",
1169 "bionic/poll.cpp",
1170 "bionic/posix_fadvise.cpp",
1171 "bionic/posix_fallocate.cpp",
1172 "bionic/posix_madvise.cpp",
1173 "bionic/posix_timers.cpp",
1174 "bionic/ptrace.cpp",
1175 "bionic/pty.cpp",
1176 "bionic/raise.cpp",
1177 "bionic/rand.cpp",
1178 "bionic/readlink.cpp",
1179 "bionic/reboot.cpp",
1180 "bionic/recv.cpp",
1181 "bionic/rename.cpp",
1182 "bionic/rmdir.cpp",
1183 "bionic/scandir.cpp",
1184 "bionic/sched_getaffinity.cpp",
1185 "bionic/sched_getcpu.cpp",
1186 "bionic/semaphore.cpp",
1187 "bionic/send.cpp",
1188 "bionic/setegid.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001189 "bionic/seteuid.cpp",
1190 "bionic/setpgrp.cpp",
1191 "bionic/sigaction.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001192 "bionic/signal.cpp",
Elliott Hughes7ae39122018-02-26 16:49:43 -08001193 "bionic/sigprocmask.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001194 "bionic/sleep.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -07001195 "bionic/spawn.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001196 "bionic/stat.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001197 "bionic/stdlib_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001198 "bionic/strchrnul.cpp",
1199 "bionic/strerror.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001200 "bionic/string_l.cpp",
1201 "bionic/strings_l.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001202 "bionic/strsignal.cpp",
Elliott Hughes1921dce2017-12-19 10:27:27 -08001203 "bionic/strtol.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001204 "bionic/strtold.cpp",
Elliott Hughesfa386e02017-10-18 13:34:32 -07001205 "bionic/swab.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001206 "bionic/symlink.cpp",
Colin Crossfc8ed2f2016-04-11 14:51:38 -07001207 "bionic/sync_file_range.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -08001208 "bionic/sys_epoll.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -07001209 "bionic/sys_msg.cpp",
1210 "bionic/sys_sem.cpp",
1211 "bionic/sys_shm.cpp",
Elliott Hughes6dafb4a2018-01-26 17:47:56 -08001212 "bionic/sys_signalfd.cpp",
Elliott Hughes261bd742019-08-29 20:45:14 -07001213 "bionic/sys_statfs.cpp",
1214 "bionic/sys_statvfs.cpp",
Elliott Hughes449eff02016-06-08 19:51:20 -07001215 "bionic/sys_time.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001216 "bionic/sysinfo.cpp",
1217 "bionic/syslog.cpp",
Elliott Hughes71ba5892018-02-07 12:44:45 -08001218 "bionic/system.cpp",
Tom Cherrye275d6d2017-12-11 23:31:33 -08001219 "bionic/system_property_api.cpp",
1220 "bionic/system_property_set.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001221 "bionic/tdestroy.cpp",
1222 "bionic/termios.cpp",
1223 "bionic/thread_private.cpp",
Elliott Hughes42067112019-04-18 14:27:24 -07001224 "bionic/threads.cpp",
Elliott Hughesf98d87b2018-07-17 13:21:05 -07001225 "bionic/timespec_get.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001226 "bionic/tmpfile.cpp",
1227 "bionic/umount.cpp",
1228 "bionic/unlink.cpp",
Elliott Hughesca3f8e42019-10-28 15:59:38 -07001229 "bionic/usleep.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001230 "bionic/wait.cpp",
1231 "bionic/wchar.cpp",
Dan Alberte2fd0102017-07-11 14:27:07 -07001232 "bionic/wchar_l.cpp",
Elliott Hughes7f0849f2016-08-26 16:17:17 -07001233 "bionic/wcstod.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001234 "bionic/wctype.cpp",
Elliott Hughesc41b5602017-07-27 17:08:08 -07001235 "bionic/wcwidth.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001236 "bionic/wmempcpy.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001237
1238 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp,
1239 // which will be overridden by the actual one in libc.so.
1240 "bionic/icu_static.cpp",
Dan Willemsen268a6732015-10-15 14:49:45 -07001241 ],
Dan Willemsen268a6732015-10-15 14:49:45 -07001242
Dan Willemsen208ae172015-09-16 16:33:27 -07001243 multilib: {
1244 lib32: {
1245 // LP32 cruft
Colin Cross6ab8f892015-11-23 14:12:15 -08001246 srcs: ["bionic/mmap.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001247 },
1248 },
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001249 product_variables: {
Steven Moreland96bbc5c2017-12-13 14:11:26 -08001250 treble_linker_namespaces: {
1251 cflags: ["-DTREBLE_LINKER_NAMESPACES"],
Jayant Chowdharyab2f79c2017-09-01 16:29:44 -07001252 },
1253 },
Tom Cherrye275d6d2017-12-11 23:31:33 -08001254 whole_static_libs: ["libsystemproperties"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001255 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001256 local_include_dirs: ["stdio"],
1257 include_dirs: ["bionic/libstdc++/include"],
1258 name: "libc_bionic_ndk",
Elliott Hughes3f6eee92016-12-13 23:47:25 +00001259 generated_headers: ["generated_android_ids"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001260}
1261
Dan Willemsen208ae172015-09-16 16:33:27 -07001262// ========================================================
1263// libc_pthread.a - pthreads parts that previously lived in
1264// libc_bionic.a. Relocated to their own library because
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001265// they can't be included in libc_ndk.a (as the layout of
Dan Willemsen208ae172015-09-16 16:33:27 -07001266// pthread_t has changed over the years and has ABI
1267// compatibility issues).
1268// ========================================================
1269
1270cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001271 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001272 srcs: [
Ryan Prichard45d13492019-01-03 02:51:30 -08001273 "bionic/bionic_elf_tls.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001274 "bionic/pthread_atfork.cpp",
1275 "bionic/pthread_attr.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001276 "bionic/pthread_barrier.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001277 "bionic/pthread_cond.cpp",
1278 "bionic/pthread_create.cpp",
1279 "bionic/pthread_detach.cpp",
1280 "bionic/pthread_equal.cpp",
1281 "bionic/pthread_exit.cpp",
1282 "bionic/pthread_getcpuclockid.cpp",
1283 "bionic/pthread_getschedparam.cpp",
1284 "bionic/pthread_gettid_np.cpp",
Elliott Hughes7484c212017-02-02 02:41:38 +00001285 "bionic/pthread_internal.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001286 "bionic/pthread_join.cpp",
1287 "bionic/pthread_key.cpp",
1288 "bionic/pthread_kill.cpp",
1289 "bionic/pthread_mutex.cpp",
1290 "bionic/pthread_once.cpp",
1291 "bionic/pthread_rwlock.cpp",
Josh Gao726b63f2018-08-27 16:00:58 -07001292 "bionic/pthread_sigqueue.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001293 "bionic/pthread_self.cpp",
1294 "bionic/pthread_setname_np.cpp",
1295 "bionic/pthread_setschedparam.cpp",
Colin Crossa35d23d2015-11-19 13:32:49 -08001296 "bionic/pthread_spinlock.cpp",
Josh Gao0e0e3702017-10-12 13:34:42 -07001297
1298 // The following implementations depend on pthread data or implementation,
1299 // so we can't include them in libc_ndk.a.
1300 "bionic/__cxa_thread_atexit_impl.cpp",
1301 "stdlib/atexit.c",
1302 "bionic/fork.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001303 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001304
Colin Cross50c21ab2015-10-31 23:03:05 -07001305 cppflags: ["-Wold-style-cast"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001306 include_dirs: ["bionic/libstdc++/include"],
1307 name: "libc_pthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001308}
1309
1310// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001311// libc_syscalls.a
1312// ========================================================
1313
Elliott Hughes782c4852019-04-16 12:31:00 -07001314genrule {
1315 name: "syscalls-arm.S",
1316 out: ["syscalls-arm.S"],
1317 srcs: ["SYSCALLS.TXT"],
1318 tool_files: [":bionic-gensyscalls"],
1319 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)",
1320}
1321
1322genrule {
1323 name: "syscalls-arm64.S",
1324 out: ["syscalls-arm64.S"],
1325 srcs: ["SYSCALLS.TXT"],
1326 tool_files: [":bionic-gensyscalls"],
1327 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)",
1328}
1329
1330genrule {
1331 name: "syscalls-x86.S",
1332 out: ["syscalls-x86.S"],
1333 srcs: ["SYSCALLS.TXT"],
1334 tool_files: [":bionic-gensyscalls"],
1335 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)",
1336}
1337
1338genrule {
1339 name: "syscalls-x86_64.S",
1340 out: ["syscalls-x86_64.S"],
1341 srcs: ["SYSCALLS.TXT"],
1342 tool_files: [":bionic-gensyscalls"],
1343 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)",
1344}
1345
Dan Willemsen208ae172015-09-16 16:33:27 -07001346cc_library_static {
Colin Cross27c43c52016-04-07 13:27:24 -07001347 defaults: ["libc_defaults"],
Josh Gao0e0e3702017-10-12 13:34:42 -07001348 srcs: ["bionic/__set_errno.cpp"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001349 arch: {
1350 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001351 srcs: [":syscalls-arm.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001352 },
1353 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001354 srcs: [":syscalls-arm64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001355 },
1356 x86: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001357 srcs: [":syscalls-x86.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001358 },
1359 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07001360 srcs: [":syscalls-x86_64.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001361 },
1362 },
1363 name: "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001364}
1365
1366// ========================================================
1367// libc_aeabi.a
1368// This is an LP32 ARM-only library that needs to be built with -fno-builtin
1369// to avoid infinite recursion. For the other architectures we just build an
1370// empty library to keep this makefile simple.
1371// ========================================================
1372
1373cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001374 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001375 arch: {
1376 arm: {
1377 srcs: ["arch-arm/bionic/__aeabi.c"],
1378 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001379 },
1380 name: "libc_aeabi",
Colin Cross50c21ab2015-10-31 23:03:05 -07001381 cflags: ["-fno-builtin"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001382}
1383
1384// ========================================================
1385// libc_ndk.a
1386// Compatibility library for the NDK. This library contains
1387// all the parts of libc that are safe to statically link.
1388// We can't safely statically link things that can only run
1389// on a certain version of the OS. Examples include
1390// anything that talks to netd (a large portion of the DNS
1391// code) and anything that is dependent on the layout of a
1392// data structure that has changed across releases (such as
1393// pthread_t).
1394// ========================================================
1395
1396cc_library_static {
1397 name: "libc_ndk",
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001398 defaults: [
1399 "libc_defaults",
1400 "libc_native_allocator_defaults",
1401 ],
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001402 srcs: libc_common_src_files + [
1403 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001404 "bionic/malloc_limit.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001405 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001406 multilib: {
1407 lib32: {
1408 srcs: libc_common_src_files_32,
1409 },
1410 },
1411 arch: {
1412 arm: {
1413 srcs: [
1414 "arch-arm/bionic/exidx_dynamic.c",
1415 "arch-common/bionic/crtbegin_so.c",
1416 "arch-arm/bionic/atexit_legacy.c",
1417 "arch-common/bionic/crtend_so.S",
1418 ],
1419 whole_static_libs: ["libc_aeabi"],
1420 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001421 },
1422
Colin Cross50c21ab2015-10-31 23:03:05 -07001423 cflags: [
Dan Willemsen208ae172015-09-16 16:33:27 -07001424 "-fvisibility=hidden",
1425 "-DLIBC_STATIC",
1426 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001427
1428 whole_static_libs: [
1429 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001430 "libc_bootstrap",
George Burgess IV6cb06872017-07-21 13:28:42 -07001431 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001432 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001433 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001434 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001435 "libc_netbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001436 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001437 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001438 "libc_syscalls",
1439 "libc_tzcode",
1440 "libm",
Elliott Hughes816fab92016-05-27 17:57:46 -07001441 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001442 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001443}
1444
1445// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001446// libc_nopthread.a
Dan Willemsen208ae172015-09-16 16:33:27 -07001447// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001448cc_library_static {
Colin Cross50c21ab2015-10-31 23:03:05 -07001449 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001450 srcs: libc_common_src_files,
1451 multilib: {
1452 lib32: {
1453 srcs: libc_common_src_files_32,
1454 },
1455 },
Josh Gao0e0e3702017-10-12 13:34:42 -07001456 name: "libc_nopthread",
Dan Willemsen208ae172015-09-16 16:33:27 -07001457
1458 whole_static_libs: [
1459 "libc_bionic",
1460 "libc_bionic_ndk",
Ryan Prichard249757b2019-11-01 17:18:28 -07001461 "libc_bootstrap",
Dan Willemsen208ae172015-09-16 16:33:27 -07001462 "libc_dns",
George Burgess IV6cb06872017-07-21 13:28:42 -07001463 "libc_fortify",
Dan Willemsen208ae172015-09-16 16:33:27 -07001464 "libc_freebsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001465 "libc_freebsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001466 "libc_gdtoa",
Dan Willemsen208ae172015-09-16 16:33:27 -07001467 "libc_netbsd",
1468 "libc_openbsd",
Elliott Hughes8e547bd2016-08-16 15:57:47 -07001469 "libc_openbsd_large_stack",
Dan Willemsen208ae172015-09-16 16:33:27 -07001470 "libc_openbsd_ndk",
Dan Willemsen208ae172015-09-16 16:33:27 -07001471 "libc_syscalls",
Dan Willemsen208ae172015-09-16 16:33:27 -07001472 "libc_tzcode",
Elliott Hughes816fab92016-05-27 17:57:46 -07001473 "libstdc++",
Dan Willemsen208ae172015-09-16 16:33:27 -07001474 ],
1475
1476 arch: {
1477 arm: {
1478 whole_static_libs: ["libc_aeabi"],
1479 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001480 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001481}
1482
1483// ========================================================
Josh Gao0e0e3702017-10-12 13:34:42 -07001484// libc_common.a
1485// ========================================================
1486
1487cc_library_static {
1488 defaults: ["libc_defaults"],
1489 name: "libc_common",
1490
1491 whole_static_libs: [
1492 "libc_nopthread",
1493 "libc_pthread",
1494 ],
1495}
1496
1497// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001498// libc_static_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001499// ========================================================
1500cc_library_static {
1501 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001502 name: "libc_static_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001503
Haibo Huangb9244ff2018-08-11 10:12:13 -07001504 arch: {
1505 x86: {
1506 srcs: ["arch-x86/static_function_dispatch.S"],
1507 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001508 arm: {
1509 srcs: ["arch-arm/static_function_dispatch.S"],
1510 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001511 arm64: {
1512 srcs: ["arch-arm64/static_function_dispatch.S"],
1513 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001514 },
Haibo Huangf71edfa2018-11-12 10:06:56 -08001515}
1516
1517// ========================================================
Ryan Prichard249757b2019-11-01 17:18:28 -07001518// libc_dynamic_dispatch.a
Haibo Huangf71edfa2018-11-12 10:06:56 -08001519// ========================================================
1520cc_library_static {
1521 defaults: ["libc_defaults"],
Ryan Prichard249757b2019-11-01 17:18:28 -07001522 name: "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001523
Haibo Huangb9244ff2018-08-11 10:12:13 -07001524 cflags: [
Peter Collingbourne36a56442019-10-31 17:11:54 -07001525 "-ffreestanding",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001526 "-fno-stack-protector",
1527 "-fno-jump-tables",
1528 ],
1529 arch: {
1530 x86: {
1531 srcs: ["arch-x86/dynamic_function_dispatch.cpp"],
1532 },
Haibo Huangea9957a2018-11-19 11:00:32 -08001533 arm: {
Elliott Hughes927fe992019-01-31 22:29:22 +00001534 srcs: ["arch-arm/dynamic_function_dispatch.cpp"],
Haibo Huangea9957a2018-11-19 11:00:32 -08001535 },
Peter Collingbourne900d07d2019-10-28 13:11:00 -07001536 arm64: {
1537 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"],
1538 },
Haibo Huangb9244ff2018-08-11 10:12:13 -07001539 },
Ryan Prichard249757b2019-11-01 17:18:28 -07001540}
1541
1542// ========================================================
1543// libc_common_static.a For static binaries.
1544// ========================================================
1545cc_library_static {
1546 defaults: ["libc_defaults"],
1547 name: "libc_common_static",
Haibo Huangb9244ff2018-08-11 10:12:13 -07001548
Haibo Huangf71edfa2018-11-12 10:06:56 -08001549 whole_static_libs: [
1550 "libc_common",
Ryan Prichard249757b2019-11-01 17:18:28 -07001551 "libc_static_dispatch",
1552 ],
1553}
1554
1555// ========================================================
1556// libc_common_shared.a For shared libraries.
1557// ========================================================
1558cc_library_static {
1559 defaults: ["libc_defaults"],
1560 name: "libc_common_shared",
1561
1562 whole_static_libs: [
1563 "libc_common",
1564 "libc_dynamic_dispatch",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001565 ],
1566}
1567
Ryan Prichard22a6a052019-10-10 23:59:30 -07001568// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static
1569// executable.
1570cc_library_static {
1571 name: "libc_unwind_static",
1572 defaults: ["libc_defaults"],
1573 cflags: ["-DLIBC_STATIC"],
1574
1575 srcs: ["bionic/dl_iterate_phdr_static.cpp"],
1576 arch: {
1577 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs
1578 arm: {
1579 srcs: ["arch-arm/bionic/exidx_static.c"],
1580 },
1581 },
1582}
1583
Haibo Huangf71edfa2018-11-12 10:06:56 -08001584// ========================================================
Dan Willemsen208ae172015-09-16 16:33:27 -07001585// libc_nomalloc.a
1586// ========================================================
1587//
Ryan Prichard249757b2019-11-01 17:18:28 -07001588// This is a version of the static C library used by the dynamic linker that exclude malloc. It also
1589// excludes functions selected using ifunc's (e.g. for string.h). Link in either
1590// libc_static_dispatch or libc_dynamic_dispatch to provide those functions.
Dan Willemsen208ae172015-09-16 16:33:27 -07001591
1592cc_library_static {
Dimitry Ivanovfc0d4802016-12-06 11:10:09 -08001593 name: "libc_nomalloc",
Colin Cross50c21ab2015-10-31 23:03:05 -07001594 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001595
Colin Crossa3f9fca2016-01-11 13:20:55 -08001596 whole_static_libs: [
Ryan Prichard249757b2019-11-01 17:18:28 -07001597 "libc_common",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001598 "libc_init_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001599 "libc_unwind_static",
Colin Crossa3f9fca2016-01-11 13:20:55 -08001600 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001601}
1602
dimitryc0c0ef62018-12-05 16:33:52 +01001603filegroup {
1604 name: "libc_sources_shared",
1605 srcs: [
1606 "arch-common/bionic/crtbegin_so.c",
1607 "arch-common/bionic/crtbrand.S",
1608 "bionic/icu.cpp",
1609 "bionic/malloc_common.cpp",
Christopher Ferrise4cdbc42019-02-08 17:30:58 -08001610 "bionic/malloc_common_dynamic.cpp",
1611 "bionic/malloc_heapprofd.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001612 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001613 "bionic/NetdClient.cpp",
1614 "arch-common/bionic/crtend_so.S",
1615 ],
1616}
1617
1618filegroup {
1619 name: "libc_sources_static",
1620 srcs: [
dimitryc0c0ef62018-12-05 16:33:52 +01001621 "bionic/malloc_common.cpp",
Christopher Ferris1fc5ccf2019-02-15 18:06:15 -08001622 "bionic/malloc_limit.cpp",
dimitryc0c0ef62018-12-05 16:33:52 +01001623 ],
1624}
1625
1626filegroup {
1627 name: "libc_sources_shared_arm",
1628 srcs: [
1629 "arch-arm/bionic/exidx_dynamic.c",
1630 "arch-arm/bionic/atexit_legacy.c",
1631 ],
1632}
1633
Dan Willemsen208ae172015-09-16 16:33:27 -07001634// ========================================================
1635// libc.a + libc.so
1636// ========================================================
1637cc_library {
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07001638 defaults: [
1639 "libc_defaults",
1640 "libc_native_allocator_defaults",
1641 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001642 name: "libc",
Dan Albert40f15ec2017-10-27 11:21:20 -07001643 static_ndk_lib: true,
Logan Chien833cbe42018-10-19 17:57:54 +08001644 export_include_dirs: ["include"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001645 product_variables: {
Dan Willemsen208ae172015-09-16 16:33:27 -07001646 platform_sdk_version: {
1647 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1648 },
1649 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001650 static: {
dimitryc0c0ef62018-12-05 16:33:52 +01001651 srcs: [ ":libc_sources_static" ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001652 cflags: ["-DLIBC_STATIC"],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001653 whole_static_libs: [
1654 "libc_init_static",
1655 "libc_common_static",
Ryan Prichard22a6a052019-10-10 23:59:30 -07001656 "libc_unwind_static",
Haibo Huangf71edfa2018-11-12 10:06:56 -08001657 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001658 },
1659 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001660 srcs: [ ":libc_sources_shared" ],
Haibo Huangf71edfa2018-11-12 10:06:56 -08001661 whole_static_libs: [
1662 "libc_init_dynamic",
1663 "libc_common_shared",
1664 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001665 },
1666
Neil Fullera7db90f2019-04-25 09:28:27 +01001667 required: [
1668 "tzdata",
1669 "tz_version", // Version metadata for tzdata to help debugging.
1670 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001671
Colin Cross4ce94d22016-11-15 13:15:43 -08001672 // Do not pack libc.so relocations; see http://b/20645321 for details.
1673 pack_relocations: false,
1674
dimitry06016f22018-01-05 11:39:28 +01001675 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so!
1676 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the
1677 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into
1678 // those new libraries from libgcc.a are not declared external; if that were the case,
1679 // then libc would not pull those symbols from libgcc.a as it should, instead relying
1680 // on the external symbols from the dependent libraries. That would create a "cloaked"
1681 // dependency on libgcc.a in libc though the libraries, which is not what you wanted!
Dan Willemsen208ae172015-09-16 16:33:27 -07001682
dimitry06016f22018-01-05 11:39:28 +01001683 shared_libs: [
1684 "ld-android",
1685 "libdl",
1686 ],
Jiyong Park3ff116a2019-04-02 23:04:52 +09001687 static_libs: [
1688 "libdl_android",
1689 ],
Dan Willemsen208ae172015-09-16 16:33:27 -07001690
1691 nocrt: true,
1692
Dan Willemsen208ae172015-09-16 16:33:27 -07001693 arch: {
1694 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001695 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001696 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001697 ldflags: ["-Wl,--hash-style=both"],
1698
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001699 version_script: ":libc.arm.map",
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001700
Dan Willemsen208ae172015-09-16 16:33:27 -07001701 shared: {
dimitryc0c0ef62018-12-05 16:33:52 +01001702 srcs: [":libc_sources_shared_arm"],
Dan Willemsen0c657082016-05-12 01:43:07 -07001703 // special for arm
1704 cflags: ["-DCRT_LEGACY_WORKAROUND"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001705 },
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001706
1707 // Arm 32 bit does not produce complete exidx unwind information
1708 // so keep the .debug_frame which is relatively small and does
1709 // include needed unwind information.
1710 // See b/132992102 for details.
1711 strip: {
1712 keep_symbols_and_debug_frame: true,
1713 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001714 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001715 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001716 version_script: ":libc.arm64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001717
1718 // Leave the symbols in the shared library so that stack unwinders can produce
1719 // meaningful name resolution.
1720 strip: {
1721 keep_symbols: true,
1722 },
Dan Willemsen9e6f98f2015-11-03 14:30:57 -08001723 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001724 x86: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001725 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001726 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001727 ldflags: ["-Wl,--hash-style=both"],
1728
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001729 version_script: ":libc.x86.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001730
1731 // Leave the symbols in the shared library so that stack unwinders can produce
1732 // meaningful name resolution.
1733 strip: {
1734 keep_symbols: true,
1735 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001736 },
1737 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001738 version_script: ":libc.x86_64.map",
Christopher Ferris0c0f6fb2019-05-17 16:22:56 -07001739
1740 // Leave the symbols in the shared library so that stack unwinders can produce
1741 // meaningful name resolution.
1742 strip: {
1743 keep_symbols: true,
1744 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001745 },
1746 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +09001747
1748 stubs: {
1749 symbol_file: "libc.map.txt",
1750 versions: ["10000"],
1751 },
Vic Yang6903fb82019-01-14 11:34:39 -08001752
Jiyong Parke87e0dc2019-10-02 17:09:33 +09001753 apex_available: [
1754 "//apex_available:platform",
1755 "com.android.runtime",
1756 ],
1757
Vic Yang03ff4362019-06-24 16:11:37 -07001758 // Sorting bss symbols by size usually results in less dirty pages at run
1759 // time, because small symbols are grouped together.
1760 sort_bss_symbols_by_size: true,
Dan Willemsen208ae172015-09-16 16:33:27 -07001761}
1762
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001763genrule {
1764 name: "libc.arm.map",
1765 out: ["libc.arm.map"],
1766 srcs: ["libc.map.txt"],
1767 tool_files: [":bionic-generate-version-script"],
1768 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1769}
1770
1771genrule {
1772 name: "libc.arm64.map",
1773 out: ["libc.arm64.map"],
1774 srcs: ["libc.map.txt"],
1775 tool_files: [":bionic-generate-version-script"],
1776 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1777}
1778
1779genrule {
1780 name: "libc.x86.map",
1781 out: ["libc.x86.map"],
1782 srcs: ["libc.map.txt"],
1783 tool_files: [":bionic-generate-version-script"],
1784 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1785}
1786
1787genrule {
1788 name: "libc.x86_64.map",
1789 out: ["libc.x86_64.map"],
1790 srcs: ["libc.map.txt"],
1791 tool_files: [":bionic-generate-version-script"],
1792 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1793}
1794
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001795// Headers that only other parts of the platform can include.
1796cc_library_headers {
1797 name: "bionic_libc_platform_headers",
1798 visibility: [
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001799 "//art:__subpackages__",
1800 "//bionic/libc:__subpackages__",
1801 "//frameworks:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001802 "//external/perfetto:__subpackages__",
Christopher Ferrisc5d3a432019-09-25 17:50:36 -07001803 "//external/scudo:__subpackages__",
Christopher Ferris2b0638e2019-09-11 19:05:29 -07001804 ],
1805 host_supported: 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",
1814}
1815
Logan Chien17af91b2019-01-15 21:19:56 +08001816// libc_headers for libasync_safe and libpropertyinfoparser
1817cc_library_headers {
1818 name: "libc_headers",
1819
1820 host_supported: true,
1821 vendor_available: true,
1822 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001823 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001824
1825 no_libcrt: true,
Logan Chien17af91b2019-01-15 21:19:56 +08001826 stl: "none",
1827 system_shared_libs: [],
1828
1829 export_include_dirs: [
1830 "include",
1831 "kernel/uapi",
1832 "kernel/android/uapi",
1833 ],
1834
1835 arch: {
1836 arm: {
1837 export_include_dirs: [
1838 "kernel/uapi/asm-arm",
1839 ],
1840 },
1841 arm64: {
1842 export_include_dirs: [
1843 "kernel/uapi/asm-arm64",
1844 ],
1845 },
1846 mips: {
1847 export_include_dirs: [
1848 "kernel/uapi/asm-mips",
1849 ],
1850 },
1851 mips64: {
1852 export_include_dirs: [
1853 "kernel/uapi/asm-mips",
1854 ],
1855 },
1856 x86: {
1857 export_include_dirs: [
1858 "kernel/uapi/asm-x86",
1859 ],
1860 },
1861 x86_64: {
1862 export_include_dirs: [
1863 "kernel/uapi/asm-x86",
1864 ],
1865 },
1866 },
1867}
1868
Dan Willemsen208ae172015-09-16 16:33:27 -07001869// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001870// libstdc++.so and libstdc++.a.
Dan Willemsen208ae172015-09-16 16:33:27 -07001871// ========================================================
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001872
Dan Willemsen208ae172015-09-16 16:33:27 -07001873cc_library {
Colin Cross50c21ab2015-10-31 23:03:05 -07001874 defaults: ["libc_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001875 include_dirs: ["bionic/libstdc++/include"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001876 srcs: [
1877 "bionic/__cxa_guard.cpp",
1878 "bionic/__cxa_pure_virtual.cpp",
1879 "bionic/new.cpp",
Dan Willemsen208ae172015-09-16 16:33:27 -07001880 ],
1881 name: "libstdc++",
Dan Albert40f15ec2017-10-27 11:21:20 -07001882 static_ndk_lib: true,
Isaac Chen5e7c90b2017-09-20 14:44:42 +08001883 static_libs: ["libasync_safe"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001884
Dan Willemsen6b3be172018-12-03 13:57:20 -08001885 static: {
1886 system_shared_libs: [],
1887 },
1888 shared: {
1889 system_shared_libs: ["libc"],
1890 },
1891
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001892 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed
Dan Willemsen208ae172015-09-16 16:33:27 -07001893 arch: {
1894 arm: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001895 // TODO: This is to work around b/24465209. Remove after root cause is fixed.
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001896 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001897 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001898 version_script: ":libstdc++.arm.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001899 },
1900 arm64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001901 version_script: ":libstdc++.arm64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001902 },
1903 x86: {
Chih-Hung Hsiehecbff832018-05-23 18:45:53 -07001904 pack_relocations: false,
Ian Pedowitzb6310c22018-01-18 16:26:19 -08001905 ldflags: ["-Wl,--hash-style=both"],
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001906 version_script: ":libstdc++.x86.map",
Dimitry Ivanov6cc8d472016-07-28 13:52:17 -07001907 },
1908 x86_64: {
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001909 version_script: ":libstdc++.x86_64.map",
Dan Willemsen208ae172015-09-16 16:33:27 -07001910 },
1911 },
1912}
1913
Elliott Hughesd19b3c52018-09-06 16:04:08 -07001914genrule {
1915 name: "libstdc++.arm.map",
1916 out: ["libstdc++.arm.map"],
1917 srcs: ["libstdc++.map.txt"],
1918 tool_files: [":bionic-generate-version-script"],
1919 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)",
1920}
1921
1922genrule {
1923 name: "libstdc++.arm64.map",
1924 out: ["libstdc++.arm64.map"],
1925 srcs: ["libstdc++.map.txt"],
1926 tool_files: [":bionic-generate-version-script"],
1927 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)",
1928}
1929
1930genrule {
1931 name: "libstdc++.x86.map",
1932 out: ["libstdc++.x86.map"],
1933 srcs: ["libstdc++.map.txt"],
1934 tool_files: [":bionic-generate-version-script"],
1935 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)",
1936}
1937
1938genrule {
1939 name: "libstdc++.x86_64.map",
1940 out: ["libstdc++.x86_64.map"],
1941 srcs: ["libstdc++.map.txt"],
1942 tool_files: [":bionic-generate-version-script"],
1943 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)",
1944}
1945
1946// ========================================================
1947// crt object files.
1948// ========================================================
1949
Colin Cross50c21ab2015-10-31 23:03:05 -07001950cc_defaults {
1951 name: "crt_defaults",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08001952 defaults: ["linux_bionic_supported"],
Dan Willemsen230a7a42017-04-07 14:09:05 -07001953 vendor_available: true,
Jiyong Park5603c6e2018-04-27 21:53:11 +09001954 recovery_available: true,
dimitry7f048802019-05-03 15:57:34 +02001955 native_bridge_supported: true,
Colin Cross50c21ab2015-10-31 23:03:05 -07001956
Elliott Hughesd50a1de2018-02-05 17:30:57 -08001957 cflags: [
1958 "-Wno-gcc-compat",
1959 "-Wall",
1960 "-Werror",
1961 ],
Peter Collingbourne7eb851c2019-09-26 12:16:06 -07001962 sanitize: {
1963 never: true,
1964 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001965}
1966
Colin Cross50c21ab2015-10-31 23:03:05 -07001967cc_defaults {
1968 name: "crt_so_defaults",
Colin Cross7d7b3682017-11-03 13:38:40 -07001969 defaults: ["crt_defaults"],
Colin Cross50c21ab2015-10-31 23:03:05 -07001970
1971 arch: {
1972 mips: {
1973 cflags: ["-fPIC"],
1974 },
1975 mips64: {
1976 cflags: ["-fPIC"],
1977 },
1978 x86: {
1979 cflags: ["-fPIC"],
1980 },
1981 x86_64: {
1982 cflags: ["-fPIC"],
1983 },
Dan Willemsen208ae172015-09-16 16:33:27 -07001984 },
Colin Crossab179442018-09-27 11:03:22 -07001985 stl: "none",
Dan Willemsen208ae172015-09-16 16:33:27 -07001986}
1987
Dan Willemsen208ae172015-09-16 16:33:27 -07001988cc_object {
1989 name: "crtbrand",
Dan Willemsena3ed9012017-04-04 15:51:26 -07001990 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
Dan Willemsen208ae172015-09-16 16:33:27 -07001991 local_include_dirs: ["include"],
1992 product_variables: {
1993 platform_sdk_version: {
1994 asflags: ["-DPLATFORM_SDK_VERSION=%d"],
1995 },
1996 },
1997 srcs: ["arch-common/bionic/crtbrand.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07001998
Colin Cross7d7b3682017-11-03 13:38:40 -07001999 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002000}
2001
Dan Willemsen208ae172015-09-16 16:33:27 -07002002cc_object {
2003 name: "crtbegin_so1",
2004 local_include_dirs: ["include"],
2005 srcs: ["arch-common/bionic/crtbegin_so.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002006
Colin Cross7d7b3682017-11-03 13:38:40 -07002007 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002008}
2009
Dan Willemsen208ae172015-09-16 16:33:27 -07002010cc_object {
2011 name: "crtbegin_so",
Dan Willemsen208ae172015-09-16 16:33:27 -07002012
Colin Cross7d7b3682017-11-03 13:38:40 -07002013 defaults: ["crt_so_defaults"],
Colin Cross77d57bf2016-04-11 14:34:18 -07002014 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002015 "crtbegin_so1",
2016 "crtbrand",
2017 ],
2018}
2019
Dan Willemsen208ae172015-09-16 16:33:27 -07002020cc_object {
2021 name: "crtend_so",
2022 local_include_dirs: ["include"],
2023 srcs: ["arch-common/bionic/crtend_so.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002024
Colin Cross7d7b3682017-11-03 13:38:40 -07002025 defaults: ["crt_so_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002026}
2027
Dan Willemsen208ae172015-09-16 16:33:27 -07002028cc_object {
2029 name: "crtbegin_static1",
2030 local_include_dirs: ["include"],
2031 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002032
Colin Cross50c21ab2015-10-31 23:03:05 -07002033 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002034 mips: {
2035 srcs: [
2036 "arch-mips/bionic/crtbegin.c",
2037 ],
2038 exclude_srcs: [
2039 "arch-common/bionic/crtbegin.c",
2040 ],
2041 },
2042 mips64: {
2043 srcs: [
2044 "arch-mips64/bionic/crtbegin.c",
2045 ],
2046 exclude_srcs: [
2047 "arch-common/bionic/crtbegin.c",
2048 ],
2049 },
2050 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002051
2052 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002053}
2054
Dan Willemsen208ae172015-09-16 16:33:27 -07002055cc_object {
2056 name: "crtbegin_static",
Dan Willemsen208ae172015-09-16 16:33:27 -07002057
Colin Cross77d57bf2016-04-11 14:34:18 -07002058 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002059 "crtbegin_static1",
2060 "crtbrand",
2061 ],
Colin Cross50c21ab2015-10-31 23:03:05 -07002062 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002063}
2064
Dan Willemsen208ae172015-09-16 16:33:27 -07002065cc_object {
2066 name: "crtbegin_dynamic1",
2067 local_include_dirs: ["include"],
2068 srcs: ["arch-common/bionic/crtbegin.c"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002069
Colin Cross50c21ab2015-10-31 23:03:05 -07002070 arch: {
Dan Willemsen208ae172015-09-16 16:33:27 -07002071 mips: {
2072 srcs: [
2073 "arch-mips/bionic/crtbegin.c",
2074 ],
2075 exclude_srcs: [
2076 "arch-common/bionic/crtbegin.c",
2077 ],
2078 },
2079 mips64: {
2080 srcs: [
2081 "arch-mips64/bionic/crtbegin.c",
2082 ],
2083 exclude_srcs: [
2084 "arch-common/bionic/crtbegin.c",
2085 ],
2086 },
2087 },
Colin Cross50c21ab2015-10-31 23:03:05 -07002088 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002089}
2090
Dan Willemsen208ae172015-09-16 16:33:27 -07002091cc_object {
2092 name: "crtbegin_dynamic",
Dan Willemsen208ae172015-09-16 16:33:27 -07002093
Colin Cross77d57bf2016-04-11 14:34:18 -07002094 objs: [
Dan Willemsen208ae172015-09-16 16:33:27 -07002095 "crtbegin_dynamic1",
2096 "crtbrand",
2097 ],
Dan Willemsen7ccc50d2017-09-18 21:28:14 -07002098 target: {
2099 linux_bionic: {
2100 generated_sources: ["host_bionic_linker_asm"],
2101 objs: [
2102 "linker_wrapper",
2103 ],
2104 },
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 // We rename crtend.o to crtend_android.o to avoid a
2111 // name clash between gcc and bionic.
2112 name: "crtend_android",
2113 local_include_dirs: ["include"],
2114 srcs: ["arch-common/bionic/crtend.S"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002115
Colin Cross50c21ab2015-10-31 23:03:05 -07002116 defaults: ["crt_defaults"],
Dan Willemsen208ae172015-09-16 16:33:27 -07002117}
Colin Crossbaa48992016-07-13 11:15:21 -07002118
Elliott Hughesd19b3c52018-09-06 16:04:08 -07002119// ========================================================
2120// NDK headers.
2121// ========================================================
2122
Dan Albert26e1c412018-05-24 14:56:46 -07002123versioned_ndk_headers {
Dan Albert22805ea2017-03-22 15:28:05 -07002124 name: "common_libc",
2125 from: "include",
2126 to: "",
2127 license: "NOTICE",
2128}
Dan Albert4238a352016-06-28 11:18:05 -07002129
2130ndk_headers {
Dan Albert063e86a2016-11-29 11:09:12 -08002131 name: "libc_uapi",
2132 from: "kernel/uapi",
2133 to: "",
2134 srcs: [
2135 "kernel/uapi/asm-generic/**/*.h",
2136 "kernel/uapi/drm/**/*.h",
2137 "kernel/uapi/linux/**/*.h",
2138 "kernel/uapi/misc/**/*.h",
2139 "kernel/uapi/mtd/**/*.h",
2140 "kernel/uapi/rdma/**/*.h",
2141 "kernel/uapi/scsi/**/*.h",
2142 "kernel/uapi/sound/**/*.h",
2143 "kernel/uapi/video/**/*.h",
2144 "kernel/uapi/xen/**/*.h",
2145 ],
Dan Albert92592652016-10-20 01:42:54 -07002146 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002147}
2148
2149ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002150 name: "libc_kernel_android_uapi_linux",
Dan Albertbae16ef2016-09-14 17:15:48 -07002151 from: "kernel/android/uapi/linux",
2152 to: "linux",
2153 srcs: ["kernel/android/uapi/linux/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002154 license: "NOTICE",
Dan Albertbae16ef2016-09-14 17:15:48 -07002155}
2156
2157ndk_headers {
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002158 name: "libc_kernel_android_scsi",
Elliott Hughes50599392017-05-25 17:13:32 -07002159 from: "kernel/android/scsi/scsi",
Elliott Hughes2fad0d52017-04-27 16:26:55 -07002160 to: "scsi",
2161 srcs: ["kernel/android/scsi/**/*.h"],
2162 license: "NOTICE",
2163}
2164
2165ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002166 name: "libc_asm_arm",
2167 from: "kernel/uapi/asm-arm",
2168 to: "arm-linux-androideabi",
2169 srcs: ["kernel/uapi/asm-arm/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002170 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002171}
2172
2173ndk_headers {
2174 name: "libc_asm_arm64",
2175 from: "kernel/uapi/asm-arm64",
2176 to: "aarch64-linux-android",
2177 srcs: ["kernel/uapi/asm-arm64/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002178 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002179}
2180
Elliott Hughesee291c02017-12-11 11:32:34 -08002181// Not actually used in the NDK, but needed to build AOSP for mips.
Dan Albert4238a352016-06-28 11:18:05 -07002182ndk_headers {
Lazar Trsic790d2f72017-11-27 11:54:11 +01002183 name: "libc_asm_mips",
2184 from: "kernel/uapi/asm-mips",
2185 to: "mipsel-linux-android",
2186 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2187 license: "NOTICE",
2188}
2189
Elliott Hughesee291c02017-12-11 11:32:34 -08002190// Not actually used in the NDK, but needed to build AOSP for mips64.
Lazar Trsic790d2f72017-11-27 11:54:11 +01002191ndk_headers {
2192 name: "libc_asm_mips64",
2193 from: "kernel/uapi/asm-mips",
2194 to: "mips64el-linux-android",
2195 srcs: ["kernel/uapi/asm-mips/**/*.h"],
2196 license: "NOTICE",
2197}
2198
2199ndk_headers {
Dan Albert4238a352016-06-28 11:18:05 -07002200 name: "libc_asm_x86",
2201 from: "kernel/uapi/asm-x86",
2202 to: "i686-linux-android",
2203 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002204 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002205}
2206
2207ndk_headers {
2208 name: "libc_asm_x86_64",
2209 from: "kernel/uapi/asm-x86",
2210 to: "x86_64-linux-android",
2211 srcs: ["kernel/uapi/asm-x86/**/*.h"],
Dan Albert92592652016-10-20 01:42:54 -07002212 license: "NOTICE",
Dan Albert4238a352016-06-28 11:18:05 -07002213}
2214
Dan Albert4238a352016-06-28 11:18:05 -07002215ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002216 name: "libc",
dimitry7f048802019-05-03 15:57:34 +02002217 native_bridge_supported: true,
Dan Albert4238a352016-06-28 11:18:05 -07002218 symbol_file: "libc.map.txt",
2219 first_version: "9",
2220}
2221
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002222llndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002223 name: "libc",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002224 symbol_file: "libc.map.txt",
2225 export_headers_as_system: true,
2226 export_preprocessed_headers: ["include"],
dimitry7f048802019-05-03 15:57:34 +02002227 native_bridge_supported: true,
Logan Chien17af91b2019-01-15 21:19:56 +08002228 export_include_dirs: [
Wenhao Wang69537f12019-12-17 13:54:04 -08002229 "kernel/android/scsi",
Logan Chien17af91b2019-01-15 21:19:56 +08002230 "kernel/android/uapi",
2231 "kernel/uapi",
2232 ],
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002233 arch: {
2234 arm: {
2235 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002236 "kernel/uapi/asm-arm",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002237 ],
2238 },
2239 arm64: {
2240 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002241 "kernel/uapi/asm-arm64",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002242 ],
2243 },
2244 mips: {
2245 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002246 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002247 ],
2248 },
2249 mips64: {
2250 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002251 "kernel/uapi/asm-mips",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002252 ],
2253 },
2254 x86: {
2255 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002256 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002257 ],
2258 },
2259 x86_64: {
2260 export_include_dirs: [
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002261 "kernel/uapi/asm-x86",
Dan Willemsenb8f7fde2017-03-20 14:07:47 -07002262 ],
2263 },
2264 },
2265}
2266
Dan Albertdf31aff2016-10-06 15:50:41 -07002267ndk_library {
Dan Willemsen51a9bf12017-04-07 14:09:18 -07002268 name: "libstdc++",
Dan Albertdf31aff2016-10-06 15:50:41 -07002269 symbol_file: "libstdc++.map.txt",
2270 first_version: "9",
2271}
2272
Dan Willemsenca056d72018-01-08 14:00:24 -08002273// Export these headers for toolbox to process
2274filegroup {
2275 name: "kernel_input_headers",
2276 srcs: [
2277 "kernel/uapi/linux/input.h",
2278 "kernel/uapi/linux/input-event-codes.h",
2279 ],
2280}
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002281
2282// Generate a syscall name / number mapping. These objects are text files
2283// (thanks to the -dD -E flags) and not binary files. They will then be
2284// consumed by the genseccomp.py script and converted into C++ code.
2285cc_defaults {
2286 name: "libseccomp_gen_syscall_nrs_defaults",
2287 recovery_available: true,
2288 srcs: ["seccomp/gen_syscall_nrs.cpp"],
2289 cflags: [
2290 "-dD",
2291 "-E",
2292 "-Wall",
2293 "-Werror",
2294 "-nostdinc",
2295 ],
2296}
2297
2298cc_object {
2299 name: "libseccomp_gen_syscall_nrs_arm",
2300 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2301 local_include_dirs: [
2302 "kernel/uapi/asm-arm",
2303 "kernel/uapi",
2304 ],
2305}
2306
2307cc_object {
2308 name: "libseccomp_gen_syscall_nrs_arm64",
2309 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2310 local_include_dirs: [
2311 "kernel/uapi/asm-arm64",
2312 "kernel/uapi",
2313 ],
2314}
2315
2316cc_object {
2317 name: "libseccomp_gen_syscall_nrs_x86",
2318 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2319 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"],
2320 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2321 local_include_dirs: [
2322 "kernel/uapi/asm-x86",
2323 "kernel/uapi",
2324 ],
2325}
2326
2327cc_object {
2328 name: "libseccomp_gen_syscall_nrs_x86_64",
2329 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2330 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"],
2331 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"],
2332 local_include_dirs: [
2333 "kernel/uapi/asm-x86",
2334 "kernel/uapi",
2335 ],
2336}
2337
2338cc_object {
2339 name: "libseccomp_gen_syscall_nrs_mips",
2340 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2341 cflags: [
2342 "-D_MIPS_SIM=_MIPS_SIM_ABI32",
2343 ],
2344 local_include_dirs: [
2345 "kernel/uapi/asm-mips",
2346 "kernel/uapi",
2347 ],
2348}
2349
2350cc_object {
2351 name: "libseccomp_gen_syscall_nrs_mips64",
2352 defaults: ["libseccomp_gen_syscall_nrs_defaults"],
2353 cflags: [
2354 "-D_MIPS_SIM=_MIPS_SIM_ABI64",
2355 ],
2356 local_include_dirs: [
2357 "kernel/uapi/asm-mips",
2358 "kernel/uapi",
2359 ],
2360}
2361
Elliott Hughesae03b122019-09-17 16:37:05 -07002362// Generate the C++ policy sources for app and system seccomp-bpf filters.
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002363python_binary_host {
2364 name: "genseccomp",
2365 main: "tools/genseccomp.py",
2366
2367 srcs: [
2368 "tools/genseccomp.py",
2369 "tools/gensyscalls.py",
2370 ],
2371
2372 data: [
2373 "kernel/uapi/**/*.h",
2374 ],
2375
2376 version: {
2377 py2: {
2378 enabled: true,
2379 },
2380 py3: {
2381 enabled: false,
2382 },
2383 },
2384}
2385
Martijn Coenen0c6de752019-01-02 12:52:51 +01002386python_binary_host {
2387 name: "genfunctosyscallnrs",
2388 main: "tools/genfunctosyscallnrs.py",
2389
2390 srcs: [
2391 "tools/genseccomp.py",
2392 "tools/genfunctosyscallnrs.py",
2393 "tools/gensyscalls.py",
2394 ],
2395
2396 data: [
2397 "kernel/uapi/**/*.h",
2398 ],
2399
2400 version: {
2401 py2: {
2402 enabled: true,
2403 },
2404 py3: {
2405 enabled: false,
2406 },
2407 },
2408}
2409
2410cc_genrule {
2411 name: "func_to_syscall_nrs",
2412 recovery_available: true,
2413 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)",
2414
2415 tools: [ "genfunctosyscallnrs" ],
2416
2417 srcs: [
2418 "SYSCALLS.TXT",
2419 ":libseccomp_gen_syscall_nrs_arm",
2420 ":libseccomp_gen_syscall_nrs_arm64",
2421 ":libseccomp_gen_syscall_nrs_mips",
2422 ":libseccomp_gen_syscall_nrs_mips64",
2423 ":libseccomp_gen_syscall_nrs_x86",
2424 ":libseccomp_gen_syscall_nrs_x86_64",
2425 ],
2426
2427 out: [
2428 "func_to_syscall_nrs.h",
2429 ],
2430}
2431
Martijn Coenenc3752be2019-01-09 16:19:57 +01002432// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid*
2433genrule {
2434 name: "generate_app_zygote_blacklist",
2435 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"],
2436 srcs: ["SECCOMP_BLACKLIST_APP.TXT"],
2437 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)",
2438}
2439
2440cc_genrule {
2441 name: "libseccomp_policy_app_zygote_sources",
2442 recovery_available: true,
2443 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)",
2444
2445 tools: [ "genseccomp" ],
2446
2447 srcs: [
2448 "SYSCALLS.TXT",
2449 "SECCOMP_WHITELIST_COMMON.TXT",
2450 "SECCOMP_WHITELIST_APP.TXT",
2451 "SECCOMP_BLACKLIST_COMMON.TXT",
2452 ":generate_app_zygote_blacklist",
2453 ":libseccomp_gen_syscall_nrs_arm",
2454 ":libseccomp_gen_syscall_nrs_arm64",
2455 ":libseccomp_gen_syscall_nrs_mips",
2456 ":libseccomp_gen_syscall_nrs_mips64",
2457 ":libseccomp_gen_syscall_nrs_x86",
2458 ":libseccomp_gen_syscall_nrs_x86_64",
2459 ],
2460
2461 out: [
2462 "arm64_app_zygote_policy.cpp",
2463 "arm_app_zygote_policy.cpp",
2464 "mips64_app_zygote_policy.cpp",
2465 "mips_app_zygote_policy.cpp",
2466 "x86_64_app_zygote_policy.cpp",
2467 "x86_app_zygote_policy.cpp",
2468 ],
2469}
2470
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002471cc_genrule {
2472 name: "libseccomp_policy_app_sources",
2473 recovery_available: true,
2474 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)",
2475
2476 tools: [ "genseccomp" ],
2477
2478 srcs: [
2479 "SYSCALLS.TXT",
2480 "SECCOMP_WHITELIST_COMMON.TXT",
2481 "SECCOMP_WHITELIST_APP.TXT",
2482 "SECCOMP_BLACKLIST_COMMON.TXT",
2483 "SECCOMP_BLACKLIST_APP.TXT",
2484 ":libseccomp_gen_syscall_nrs_arm",
2485 ":libseccomp_gen_syscall_nrs_arm64",
2486 ":libseccomp_gen_syscall_nrs_mips",
2487 ":libseccomp_gen_syscall_nrs_mips64",
2488 ":libseccomp_gen_syscall_nrs_x86",
2489 ":libseccomp_gen_syscall_nrs_x86_64",
2490 ],
2491
2492 out: [
2493 "arm64_app_policy.cpp",
2494 "arm_app_policy.cpp",
2495 "mips64_app_policy.cpp",
2496 "mips_app_policy.cpp",
2497 "x86_64_app_policy.cpp",
2498 "x86_app_policy.cpp",
2499 ],
2500}
2501
2502cc_genrule {
2503 name: "libseccomp_policy_system_sources",
2504 recovery_available: true,
2505 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)",
2506
2507 tools: [ "genseccomp" ],
2508
2509 srcs: [
2510 "SYSCALLS.TXT",
2511 "SECCOMP_WHITELIST_COMMON.TXT",
2512 "SECCOMP_WHITELIST_SYSTEM.TXT",
2513 "SECCOMP_BLACKLIST_COMMON.TXT",
2514 ":libseccomp_gen_syscall_nrs_arm",
2515 ":libseccomp_gen_syscall_nrs_arm64",
2516 ":libseccomp_gen_syscall_nrs_mips",
2517 ":libseccomp_gen_syscall_nrs_mips64",
2518 ":libseccomp_gen_syscall_nrs_x86",
2519 ":libseccomp_gen_syscall_nrs_x86_64",
2520 ],
2521
2522 out: [
2523 "arm64_system_policy.cpp",
2524 "arm_system_policy.cpp",
2525 "mips64_system_policy.cpp",
2526 "mips_system_policy.cpp",
2527 "x86_64_system_policy.cpp",
2528 "x86_system_policy.cpp",
2529 ],
2530}
2531
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002532cc_library {
2533 name: "libseccomp_policy",
2534 recovery_available: true,
Martijn Coenend269d9b2018-11-08 16:41:42 +01002535 generated_headers: ["func_to_syscall_nrs"],
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002536 generated_sources: [
2537 "libseccomp_policy_app_sources",
Martijn Coenenc3752be2019-01-09 16:19:57 +01002538 "libseccomp_policy_app_zygote_sources",
Luis Hector Chavezfa09b3c2018-08-03 20:53:28 -07002539 "libseccomp_policy_system_sources",
2540 ],
2541
2542 srcs: [
2543 "seccomp/seccomp_policy.cpp",
2544 ],
2545
2546 export_include_dirs: ["seccomp/include"],
2547 cflags: [
2548 "-Wall",
2549 "-Werror",
2550 ],
2551 shared: {
2552 shared_libs: ["libbase"],
2553 },
2554 static: {
2555 static_libs: ["libbase"],
2556 },
2557}
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002558
2559// This is a temporary library that will use scudo as the native memory
2560// allocator. To use it, add it as the first shared library.
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002561cc_defaults {
2562 name: "libc_scudo_wrapper_defaults",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002563 srcs: [
2564 "bionic/malloc_common.cpp",
2565 "bionic/malloc_common_dynamic.cpp",
2566 "bionic/malloc_heapprofd.cpp",
2567 "bionic/malloc_limit.cpp",
2568 "bionic/scudo_wrapper.cpp",
2569 "bionic/__set_errno.cpp",
2570 ],
2571 cflags: ["-DUSE_SCUDO"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002572 shared_libs: ["libscudo_wrapper"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002573
2574 header_libs: ["libc_headers"],
2575
2576 static_libs: ["libasync_safe"],
2577
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002578 arch: {
2579 arm: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002580 srcs: [":syscalls-arm.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002581 },
2582 arm64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002583 srcs: [":syscalls-arm64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002584 },
2585 x86: {
2586 srcs: [
2587 "arch-x86/bionic/__libc_init_sysinfo.cpp",
Elliott Hughes782c4852019-04-16 12:31:00 -07002588 ":syscalls-x86.S",
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002589 ],
2590 },
2591 x86_64: {
Elliott Hughes782c4852019-04-16 12:31:00 -07002592 srcs: [":syscalls-x86_64.S"],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002593 },
2594 },
2595
2596 // Mark this library as global so it overrides all the allocation
2597 // definitions properly.
2598 ldflags: ["-Wl,-z,global"],
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002599}
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002600
Christopher Ferrise55e5ee2019-10-01 17:54:42 -07002601cc_library_shared {
2602 name: "libc_scudo",
2603 defaults: ["libc_scudo_wrapper_defaults"],
2604 vendor_available: true,
2605 stl: "none",
2606 system_shared_libs: [],
2607
2608 allow_undefined_symbols: true,
Pirama Arumuga Nainar17e7c752019-05-22 22:14:57 -07002609 // Like libc, disable native coverage for libc_scudo.
2610 native_coverage: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -08002611}
2612
2613subdirs = [
2614 "bionic/scudo",
2615]