1// Define the common source files for all the libc instances 2// ========================================================= 3libc_common_src_files = [ 4 "async_safe/async_safe_log.cpp", 5 "bionic/ether_aton.c", 6 "bionic/ether_ntoa.c", 7 "bionic/fts.c", 8 "bionic/initgroups.c", 9 "bionic/isatty.c", 10 "bionic/pututline.c", 11 "bionic/sched_cpualloc.c", 12 "bionic/sched_cpucount.c", 13 "stdio/fmemopen.cpp", 14 "stdio/parsefloat.c", 15 "stdio/refill.c", 16 "stdio/stdio.cpp", 17 "stdio/stdio_ext.cpp", 18 "stdio/vfscanf.cpp", 19 "stdio/vfwscanf.c", 20 "stdlib/exit.c", 21] 22 23// off64_t/time64_t support on LP32. 24// ======================================================== 25libc_common_src_files_32 = [ 26 "bionic/legacy_32_bit_support.cpp", 27 "bionic/time64.c", 28] 29 30libc_common_flags = [ 31 "-D_LIBC=1", 32 "-D__BIONIC_LP32_USE_STAT64", 33 "-Wall", 34 "-Wextra", 35 "-Wunused", 36 "-Wno-char-subscripts", 37 "-Wno-deprecated-declarations", 38 "-Wno-gcc-compat", 39 "-Wframe-larger-than=2048", 40 41 // Try to catch typical 32-bit assumptions that break with 64-bit pointers. 42 "-Werror=pointer-to-int-cast", 43 "-Werror=int-to-pointer-cast", 44 "-Werror=type-limits", 45 "-Werror", 46 47 // Clang's exit-time destructor registration hides __dso_handle, but 48 // __dso_handle needs to have default visibility on ARM32. See b/73485611. 49 "-Wexit-time-destructors", 50 51 // GWP-ASan requires platform TLS. 52 "-fno-emulated-tls", 53] 54 55// Define some common cflags 56// ======================================================== 57cc_defaults { 58 name: "libc_defaults", 59 defaults: ["linux_bionic_supported"], 60 cflags: libc_common_flags, 61 asflags: libc_common_flags, 62 conlyflags: ["-std=gnu99"], 63 cppflags: [], 64 include_dirs: [ 65 "bionic/libc/async_safe/include", 66 ], 67 68 header_libs: ["gwp_asan_headers"], 69 70 stl: "none", 71 system_shared_libs: [], 72 sanitize: { 73 address: false, 74 integer_overflow: false, 75 // TODO(b/132640749): Fix broken fuzzer support. 76 fuzzer: false, 77 }, 78 native_coverage: false, 79 ramdisk_available: true, 80 recovery_available: true, 81 native_bridge_supported: true, 82 83 // lld complains about duplicate symbols in libcrt and libgcc. Suppress the 84 // warning since this is intended right now. 85 ldflags: ["-Wl,-z,muldefs"], 86 87 product_variables: { 88 experimental_mte: { 89 cflags: ["-DANDROID_EXPERIMENTAL_MTE"], 90 }, 91 }, 92} 93 94libc_scudo_product_variables = { 95 malloc_not_svelte: { 96 cflags: ["-DUSE_SCUDO"], 97 whole_static_libs: ["libscudo"], 98 exclude_static_libs: [ 99 "libjemalloc5", 100 "libc_jemalloc_wrapper", 101 ], 102 }, 103} 104 105// Defaults for native allocator libs/includes to make it 106// easier to change. 107// To disable scudo for the non-svelte config remove the line: 108// product_variables: libc_scudo_product_variables, 109// in the cc_defaults below. 110// ======================================================== 111cc_defaults { 112 name: "libc_native_allocator_defaults", 113 114 whole_static_libs: [ 115 "libjemalloc5", 116 "libc_jemalloc_wrapper", 117 ], 118 header_libs: ["gwp_asan_headers"], 119 product_variables: libc_scudo_product_variables, 120} 121 122// Functions not implemented by jemalloc directly, or that need to 123// be modified for Android. 124cc_library_static { 125 name: "libc_jemalloc_wrapper", 126 defaults: ["libc_defaults"], 127 srcs: ["bionic/jemalloc_wrapper.cpp"], 128 cflags: ["-fvisibility=hidden"], 129 130 // Used to pull in the jemalloc include directory so that if the 131 // library is removed, the include directory is also removed. 132 static_libs: ["libjemalloc5"], 133} 134 135// ======================================================== 136// libc_bootstrap.a - -fno-stack-protector and -ffreestanding 137// ======================================================== 138// 139// Code that implements the stack protector (or that runs before TLS has been set up) needs to be 140// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker, 141// some of this code runs before ifunc resolvers have made string.h functions work, so compile with 142// -ffreestanding. 143 144cc_library_static { 145 146 srcs: [ 147 "bionic/__libc_init_main_thread.cpp", 148 "bionic/__stack_chk_fail.cpp", 149 "bionic/bionic_call_ifunc_resolver.cpp", 150 "bionic/getauxval.cpp", 151 ], 152 arch: { 153 arm64: { 154 srcs: ["arch-arm64/bionic/__set_tls.c"], 155 }, 156 x86: { 157 srcs: [ 158 "arch-x86/bionic/__libc_init_sysinfo.cpp", 159 "arch-x86/bionic/__set_tls.cpp", 160 ], 161 }, 162 x86_64: { 163 srcs: ["arch-x86_64/bionic/__set_tls.c"], 164 }, 165 }, 166 167 defaults: ["libc_defaults"], 168 cflags: ["-fno-stack-protector", "-ffreestanding"], 169 name: "libc_bootstrap", 170} 171 172// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector. 173// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes 174// the stack protector global variable. 175 176cc_library_static { 177 name: "libc_init_static", 178 defaults: ["libc_defaults"], 179 srcs: ["bionic/libc_init_static.cpp"], 180 cflags: [ 181 "-fno-stack-protector", 182 183 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called 184 // from the linker before ifunc resolvers have made string.h functions available. 185 "-ffreestanding", 186 ], 187} 188 189cc_library_static { 190 name: "libc_init_dynamic", 191 defaults: ["libc_defaults"], 192 srcs: ["bionic/libc_init_dynamic.cpp"], 193 cflags: ["-fno-stack-protector"], 194} 195 196// ======================================================== 197// libc_tzcode.a - upstream 'tzcode' code 198// ======================================================== 199 200cc_library_static { 201 202 defaults: ["libc_defaults"], 203 srcs: [ 204 "tzcode/**/*.c", 205 "tzcode/bionic.cpp", 206 "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one. 207 ], 208 209 cflags: [ 210 "-Wno-unused-parameter", 211 // Don't use ridiculous amounts of stack. 212 "-DALL_STATE", 213 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time. 214 "-DSTD_INSPIRED", 215 // Obviously, we want to be thread-safe. 216 "-DTHREAD_SAFE", 217 // The name of the tm_gmtoff field in our struct tm. 218 "-DTM_GMTOFF=tm_gmtoff", 219 // Where we store our tzdata. 220 "-DTZDIR=\"/system/usr/share/zoneinfo\"", 221 // Include `tzname`, `timezone`, and `daylight` globals. 222 "-DHAVE_POSIX_DECLS=0", 223 "-DUSG_COMPAT=1", 224 // Use the empty string (instead of " ") as the timezone abbreviation 225 // fallback. 226 "-DWILDABBR=\"\"", 227 "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU", 228 "-Dlint", 229 ], 230 231 local_include_dirs: ["tzcode/"], 232 name: "libc_tzcode", 233} 234 235// ======================================================== 236// libc_dns.a - modified NetBSD DNS code 237// ======================================================== 238 239cc_library_static { 240 241 defaults: ["libc_defaults"], 242 srcs: [ 243 "dns/**/*.c", 244 245 "upstream-netbsd/lib/libc/isc/ev_streams.c", 246 "upstream-netbsd/lib/libc/isc/ev_timers.c", 247 ], 248 249 cflags: [ 250 "-DANDROID_CHANGES", 251 "-DINET6", 252 "-Wno-unused-parameter", 253 "-include netbsd-compat.h", 254 "-Wframe-larger-than=66000", 255 ], 256 257 local_include_dirs: [ 258 "dns/include", 259 "private", 260 "upstream-netbsd/lib/libc/include", 261 "upstream-netbsd/android/include", 262 ], 263 264 name: "libc_dns", 265} 266 267// ======================================================== 268// libc_freebsd.a - upstream FreeBSD C library code 269// ======================================================== 270// 271// These files are built with the freebsd-compat.h header file 272// automatically included. 273 274cc_library_static { 275 defaults: ["libc_defaults"], 276 srcs: [ 277 "upstream-freebsd/lib/libc/gen/ldexp.c", 278 "upstream-freebsd/lib/libc/stdlib/getopt_long.c", 279 "upstream-freebsd/lib/libc/stdlib/hcreate.c", 280 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c", 281 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c", 282 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c", 283 "upstream-freebsd/lib/libc/stdlib/qsort.c", 284 "upstream-freebsd/lib/libc/stdlib/quick_exit.c", 285 "upstream-freebsd/lib/libc/string/wcpcpy.c", 286 "upstream-freebsd/lib/libc/string/wcpncpy.c", 287 "upstream-freebsd/lib/libc/string/wcscasecmp.c", 288 "upstream-freebsd/lib/libc/string/wcscat.c", 289 "upstream-freebsd/lib/libc/string/wcschr.c", 290 "upstream-freebsd/lib/libc/string/wcscmp.c", 291 "upstream-freebsd/lib/libc/string/wcscpy.c", 292 "upstream-freebsd/lib/libc/string/wcscspn.c", 293 "upstream-freebsd/lib/libc/string/wcsdup.c", 294 "upstream-freebsd/lib/libc/string/wcslcat.c", 295 "upstream-freebsd/lib/libc/string/wcslen.c", 296 "upstream-freebsd/lib/libc/string/wcsncasecmp.c", 297 "upstream-freebsd/lib/libc/string/wcsncat.c", 298 "upstream-freebsd/lib/libc/string/wcsncmp.c", 299 "upstream-freebsd/lib/libc/string/wcsncpy.c", 300 "upstream-freebsd/lib/libc/string/wcsnlen.c", 301 "upstream-freebsd/lib/libc/string/wcspbrk.c", 302 "upstream-freebsd/lib/libc/string/wcsrchr.c", 303 "upstream-freebsd/lib/libc/string/wcsspn.c", 304 "upstream-freebsd/lib/libc/string/wcsstr.c", 305 "upstream-freebsd/lib/libc/string/wcstok.c", 306 "upstream-freebsd/lib/libc/string/wmemchr.c", 307 "upstream-freebsd/lib/libc/string/wmemcmp.c", 308 "upstream-freebsd/lib/libc/string/wmemcpy.c", 309 "upstream-freebsd/lib/libc/string/wmemmove.c", 310 "upstream-freebsd/lib/libc/string/wmemset.c", 311 ], 312 arch: { 313 arm64: { 314 exclude_srcs: [ 315 "upstream-freebsd/lib/libc/string/wmemmove.c", 316 ], 317 }, 318 x86: { 319 exclude_srcs: [ 320 "upstream-freebsd/lib/libc/string/wcschr.c", 321 "upstream-freebsd/lib/libc/string/wcscmp.c", 322 "upstream-freebsd/lib/libc/string/wcslen.c", 323 "upstream-freebsd/lib/libc/string/wcsrchr.c", 324 "upstream-freebsd/lib/libc/string/wmemcmp.c", 325 "upstream-freebsd/lib/libc/string/wcscat.c", 326 "upstream-freebsd/lib/libc/string/wcscpy.c", 327 "upstream-freebsd/lib/libc/string/wmemcmp.c", 328 "upstream-freebsd/lib/libc/string/wmemset.c", 329 ], 330 }, 331 }, 332 333 cflags: [ 334 "-Wno-sign-compare", 335 "-Wno-unused-parameter", 336 "-include freebsd-compat.h", 337 ], 338 339 local_include_dirs: [ 340 "upstream-freebsd/android/include", 341 ], 342 343 name: "libc_freebsd", 344} 345 346cc_library_static { 347 defaults: ["libc_defaults"], 348 srcs: [ 349 "upstream-freebsd/lib/libc/gen/glob.c", 350 ], 351 352 cflags: [ 353 "-Wno-sign-compare", 354 "-include freebsd-compat.h", 355 "-Wframe-larger-than=66000", 356 ], 357 358 local_include_dirs: [ 359 "upstream-freebsd/android/include", 360 ], 361 362 name: "libc_freebsd_large_stack", 363} 364 365// ======================================================== 366// libc_netbsd.a - upstream NetBSD C library code 367// ======================================================== 368// 369// These files are built with the netbsd-compat.h header file 370// automatically included. 371 372cc_library_static { 373 374 defaults: ["libc_defaults"], 375 srcs: [ 376 "upstream-netbsd/common/lib/libc/stdlib/random.c", 377 "upstream-netbsd/lib/libc/gen/nice.c", 378 "upstream-netbsd/lib/libc/gen/psignal.c", 379 "upstream-netbsd/lib/libc/gen/utime.c", 380 "upstream-netbsd/lib/libc/gen/utmp.c", 381 "upstream-netbsd/lib/libc/inet/nsap_addr.c", 382 "upstream-netbsd/lib/libc/regex/regcomp.c", 383 "upstream-netbsd/lib/libc/regex/regerror.c", 384 "upstream-netbsd/lib/libc/regex/regexec.c", 385 "upstream-netbsd/lib/libc/regex/regfree.c", 386 "upstream-netbsd/lib/libc/stdlib/bsearch.c", 387 "upstream-netbsd/lib/libc/stdlib/drand48.c", 388 "upstream-netbsd/lib/libc/stdlib/erand48.c", 389 "upstream-netbsd/lib/libc/stdlib/jrand48.c", 390 "upstream-netbsd/lib/libc/stdlib/lcong48.c", 391 "upstream-netbsd/lib/libc/stdlib/lrand48.c", 392 "upstream-netbsd/lib/libc/stdlib/mrand48.c", 393 "upstream-netbsd/lib/libc/stdlib/nrand48.c", 394 "upstream-netbsd/lib/libc/stdlib/_rand48.c", 395 "upstream-netbsd/lib/libc/stdlib/rand_r.c", 396 "upstream-netbsd/lib/libc/stdlib/reallocarr.c", 397 "upstream-netbsd/lib/libc/stdlib/seed48.c", 398 "upstream-netbsd/lib/libc/stdlib/srand48.c", 399 ], 400 multilib: { 401 lib32: { 402 // LP32 cruft 403 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"], 404 }, 405 }, 406 cflags: [ 407 "-Wno-sign-compare", 408 "-Wno-unused-parameter", 409 "-DPOSIX_MISTAKE", 410 "-include netbsd-compat.h", 411 ], 412 413 local_include_dirs: [ 414 "upstream-netbsd/android/include", 415 "upstream-netbsd/lib/libc/include", 416 ], 417 418 name: "libc_netbsd", 419} 420 421// ======================================================== 422// libc_openbsd_ndk.a - upstream OpenBSD C library code 423// that can be safely included in the libc_ndk.a (doesn't 424// contain any troublesome global data or constructors). 425// ======================================================== 426// 427// These files are built with the openbsd-compat.h header file 428// automatically included. 429 430cc_library_static { 431 name: "libc_openbsd_ndk", 432 defaults: ["libc_defaults"], 433 srcs: [ 434 "upstream-openbsd/lib/libc/gen/alarm.c", 435 "upstream-openbsd/lib/libc/gen/ctype_.c", 436 "upstream-openbsd/lib/libc/gen/daemon.c", 437 "upstream-openbsd/lib/libc/gen/err.c", 438 "upstream-openbsd/lib/libc/gen/errx.c", 439 "upstream-openbsd/lib/libc/gen/fnmatch.c", 440 "upstream-openbsd/lib/libc/gen/ftok.c", 441 "upstream-openbsd/lib/libc/gen/getprogname.c", 442 "upstream-openbsd/lib/libc/gen/setprogname.c", 443 "upstream-openbsd/lib/libc/gen/verr.c", 444 "upstream-openbsd/lib/libc/gen/verrx.c", 445 "upstream-openbsd/lib/libc/gen/vwarn.c", 446 "upstream-openbsd/lib/libc/gen/vwarnx.c", 447 "upstream-openbsd/lib/libc/gen/warn.c", 448 "upstream-openbsd/lib/libc/gen/warnx.c", 449 "upstream-openbsd/lib/libc/locale/btowc.c", 450 "upstream-openbsd/lib/libc/locale/mbrlen.c", 451 "upstream-openbsd/lib/libc/locale/mbstowcs.c", 452 "upstream-openbsd/lib/libc/locale/mbtowc.c", 453 "upstream-openbsd/lib/libc/locale/wcscoll.c", 454 "upstream-openbsd/lib/libc/locale/wcstoimax.c", 455 "upstream-openbsd/lib/libc/locale/wcstol.c", 456 "upstream-openbsd/lib/libc/locale/wcstoll.c", 457 "upstream-openbsd/lib/libc/locale/wcstombs.c", 458 "upstream-openbsd/lib/libc/locale/wcstoul.c", 459 "upstream-openbsd/lib/libc/locale/wcstoull.c", 460 "upstream-openbsd/lib/libc/locale/wcstoumax.c", 461 "upstream-openbsd/lib/libc/locale/wcsxfrm.c", 462 "upstream-openbsd/lib/libc/locale/wctob.c", 463 "upstream-openbsd/lib/libc/locale/wctomb.c", 464 "upstream-openbsd/lib/libc/net/base64.c", 465 "upstream-openbsd/lib/libc/net/htonl.c", 466 "upstream-openbsd/lib/libc/net/htons.c", 467 "upstream-openbsd/lib/libc/net/inet_lnaof.c", 468 "upstream-openbsd/lib/libc/net/inet_makeaddr.c", 469 "upstream-openbsd/lib/libc/net/inet_netof.c", 470 "upstream-openbsd/lib/libc/net/inet_ntoa.c", 471 "upstream-openbsd/lib/libc/net/inet_ntop.c", 472 "upstream-openbsd/lib/libc/net/inet_pton.c", 473 "upstream-openbsd/lib/libc/net/ntohl.c", 474 "upstream-openbsd/lib/libc/net/ntohs.c", 475 "upstream-openbsd/lib/libc/net/res_random.c", 476 "upstream-openbsd/lib/libc/stdio/fgetln.c", 477 "upstream-openbsd/lib/libc/stdio/fgetwc.c", 478 "upstream-openbsd/lib/libc/stdio/fgetws.c", 479 "upstream-openbsd/lib/libc/stdio/flags.c", 480 "upstream-openbsd/lib/libc/stdio/fpurge.c", 481 "upstream-openbsd/lib/libc/stdio/fputwc.c", 482 "upstream-openbsd/lib/libc/stdio/fputws.c", 483 "upstream-openbsd/lib/libc/stdio/fvwrite.c", 484 "upstream-openbsd/lib/libc/stdio/fwide.c", 485 "upstream-openbsd/lib/libc/stdio/getdelim.c", 486 "upstream-openbsd/lib/libc/stdio/gets.c", 487 "upstream-openbsd/lib/libc/stdio/makebuf.c", 488 "upstream-openbsd/lib/libc/stdio/mktemp.c", 489 "upstream-openbsd/lib/libc/stdio/open_memstream.c", 490 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c", 491 "upstream-openbsd/lib/libc/stdio/rget.c", 492 "upstream-openbsd/lib/libc/stdio/setvbuf.c", 493 "upstream-openbsd/lib/libc/stdio/tempnam.c", 494 "upstream-openbsd/lib/libc/stdio/tmpnam.c", 495 "upstream-openbsd/lib/libc/stdio/ungetc.c", 496 "upstream-openbsd/lib/libc/stdio/ungetwc.c", 497 "upstream-openbsd/lib/libc/stdio/vasprintf.c", 498 "upstream-openbsd/lib/libc/stdio/vdprintf.c", 499 "upstream-openbsd/lib/libc/stdio/vsscanf.c", 500 "upstream-openbsd/lib/libc/stdio/vswprintf.c", 501 "upstream-openbsd/lib/libc/stdio/vswscanf.c", 502 "upstream-openbsd/lib/libc/stdio/wbuf.c", 503 "upstream-openbsd/lib/libc/stdio/wsetup.c", 504 "upstream-openbsd/lib/libc/stdlib/abs.c", 505 "upstream-openbsd/lib/libc/stdlib/div.c", 506 "upstream-openbsd/lib/libc/stdlib/getenv.c", 507 "upstream-openbsd/lib/libc/stdlib/getsubopt.c", 508 "upstream-openbsd/lib/libc/stdlib/insque.c", 509 "upstream-openbsd/lib/libc/stdlib/imaxabs.c", 510 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c", 511 "upstream-openbsd/lib/libc/stdlib/labs.c", 512 "upstream-openbsd/lib/libc/stdlib/ldiv.c", 513 "upstream-openbsd/lib/libc/stdlib/llabs.c", 514 "upstream-openbsd/lib/libc/stdlib/lldiv.c", 515 "upstream-openbsd/lib/libc/stdlib/lsearch.c", 516 "upstream-openbsd/lib/libc/stdlib/remque.c", 517 "upstream-openbsd/lib/libc/stdlib/setenv.c", 518 "upstream-openbsd/lib/libc/stdlib/tfind.c", 519 "upstream-openbsd/lib/libc/stdlib/tsearch.c", 520 "upstream-openbsd/lib/libc/string/memccpy.c", 521 "upstream-openbsd/lib/libc/string/strcasecmp.c", 522 "upstream-openbsd/lib/libc/string/strcasestr.c", 523 "upstream-openbsd/lib/libc/string/strcoll.c", 524 "upstream-openbsd/lib/libc/string/strcspn.c", 525 "upstream-openbsd/lib/libc/string/strdup.c", 526 "upstream-openbsd/lib/libc/string/strndup.c", 527 "upstream-openbsd/lib/libc/string/strpbrk.c", 528 "upstream-openbsd/lib/libc/string/strsep.c", 529 "upstream-openbsd/lib/libc/string/strspn.c", 530 "upstream-openbsd/lib/libc/string/strtok.c", 531 "upstream-openbsd/lib/libc/string/strxfrm.c", 532 "upstream-openbsd/lib/libc/string/wcslcpy.c", 533 "upstream-openbsd/lib/libc/string/wcswidth.c", 534 ], 535 536 cflags: [ 537 "-Wno-sign-compare", 538 "-Wno-unused-parameter", 539 "-include openbsd-compat.h", 540 ], 541 542 local_include_dirs: [ 543 "private", 544 "stdio", 545 "upstream-openbsd/android/include", 546 "upstream-openbsd/lib/libc/include", 547 "upstream-openbsd/lib/libc/gdtoa/", 548 ], 549} 550 551cc_library_static { 552 name: "libc_openbsd_large_stack", 553 defaults: ["libc_defaults"], 554 srcs: [ 555 "stdio/vfprintf.cpp", 556 "stdio/vfwprintf.cpp", 557 "upstream-openbsd/lib/libc/string/strstr.c", 558 ], 559 cflags: [ 560 "-include openbsd-compat.h", 561 "-Wno-sign-compare", 562 "-Wframe-larger-than=5000", 563 ], 564 565 local_include_dirs: [ 566 "upstream-openbsd/android/include/", 567 "upstream-openbsd/lib/libc/include/", 568 "upstream-openbsd/lib/libc/gdtoa/", 569 "upstream-openbsd/lib/libc/stdio/", 570 ], 571} 572 573// ======================================================== 574// libc_openbsd.a - upstream OpenBSD C library code 575// ======================================================== 576// 577// These files are built with the openbsd-compat.h header file 578// automatically included. 579cc_library_static { 580 defaults: ["libc_defaults"], 581 srcs: [ 582 // These two depend on getentropy, which isn't in libc_ndk.a. 583 "upstream-openbsd/lib/libc/crypt/arc4random.c", 584 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c", 585 586 // May be overriden by per-arch optimized versions 587 "upstream-openbsd/lib/libc/string/memchr.c", 588 "upstream-openbsd/lib/libc/string/memrchr.c", 589 "upstream-openbsd/lib/libc/string/stpcpy.c", 590 "upstream-openbsd/lib/libc/string/stpncpy.c", 591 "upstream-openbsd/lib/libc/string/strcat.c", 592 "upstream-openbsd/lib/libc/string/strcpy.c", 593 "upstream-openbsd/lib/libc/string/strlcat.c", 594 "upstream-openbsd/lib/libc/string/strlcpy.c", 595 "upstream-openbsd/lib/libc/string/strncat.c", 596 "upstream-openbsd/lib/libc/string/strncmp.c", 597 "upstream-openbsd/lib/libc/string/strncpy.c", 598 ], 599 600 arch: { 601 arm: { 602 exclude_srcs: [ 603 "upstream-openbsd/lib/libc/string/strcpy.c", 604 "upstream-openbsd/lib/libc/string/stpcpy.c", 605 "upstream-openbsd/lib/libc/string/strcat.c", 606 ], 607 }, 608 arm64: { 609 exclude_srcs: [ 610 "upstream-openbsd/lib/libc/string/memchr.c", 611 "upstream-openbsd/lib/libc/string/stpcpy.c", 612 "upstream-openbsd/lib/libc/string/strcpy.c", 613 "upstream-openbsd/lib/libc/string/strncmp.c", 614 ], 615 }, 616 x86: { 617 exclude_srcs: [ 618 "upstream-openbsd/lib/libc/string/memchr.c", 619 "upstream-openbsd/lib/libc/string/memrchr.c", 620 "upstream-openbsd/lib/libc/string/stpcpy.c", 621 "upstream-openbsd/lib/libc/string/stpncpy.c", 622 "upstream-openbsd/lib/libc/string/strcat.c", 623 "upstream-openbsd/lib/libc/string/strcpy.c", 624 "upstream-openbsd/lib/libc/string/strncmp.c", 625 "upstream-openbsd/lib/libc/string/strncpy.c", 626 "upstream-openbsd/lib/libc/string/strlcat.c", 627 "upstream-openbsd/lib/libc/string/strlcpy.c", 628 "upstream-openbsd/lib/libc/string/strncat.c", 629 ], 630 }, 631 632 x86_64: { 633 exclude_srcs: [ 634 "upstream-openbsd/lib/libc/string/stpcpy.c", 635 "upstream-openbsd/lib/libc/string/stpncpy.c", 636 "upstream-openbsd/lib/libc/string/strcat.c", 637 "upstream-openbsd/lib/libc/string/strcpy.c", 638 "upstream-openbsd/lib/libc/string/strncat.c", 639 "upstream-openbsd/lib/libc/string/strncmp.c", 640 "upstream-openbsd/lib/libc/string/strncpy.c", 641 ], 642 }, 643 }, 644 645 cflags: [ 646 "-Wno-sign-compare", 647 "-Wno-unused-parameter", 648 "-include openbsd-compat.h", 649 ], 650 651 local_include_dirs: [ 652 "private", 653 "upstream-openbsd/android/include", 654 ], 655 656 name: "libc_openbsd", 657} 658 659// ======================================================== 660// libc_gdtoa.a - upstream OpenBSD C library gdtoa code 661// ======================================================== 662// 663// These files are built with the openbsd-compat.h header file 664// automatically included. 665 666cc_library_static { 667 defaults: ["libc_defaults"], 668 srcs: [ 669 "upstream-openbsd/android/gdtoa_support.cpp", 670 "upstream-openbsd/lib/libc/gdtoa/dmisc.c", 671 "upstream-openbsd/lib/libc/gdtoa/dtoa.c", 672 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c", 673 "upstream-openbsd/lib/libc/gdtoa/gethex.c", 674 "upstream-openbsd/lib/libc/gdtoa/gmisc.c", 675 "upstream-openbsd/lib/libc/gdtoa/hd_init.c", 676 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c", 677 "upstream-openbsd/lib/libc/gdtoa/hexnan.c", 678 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c", 679 "upstream-openbsd/lib/libc/gdtoa/misc.c", 680 "upstream-openbsd/lib/libc/gdtoa/smisc.c", 681 "upstream-openbsd/lib/libc/gdtoa/strtod.c", 682 "upstream-openbsd/lib/libc/gdtoa/strtodg.c", 683 "upstream-openbsd/lib/libc/gdtoa/strtof.c", 684 "upstream-openbsd/lib/libc/gdtoa/strtord.c", 685 "upstream-openbsd/lib/libc/gdtoa/sum.c", 686 "upstream-openbsd/lib/libc/gdtoa/ulp.c", 687 ], 688 multilib: { 689 lib64: { 690 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"], 691 }, 692 }, 693 694 cflags: [ 695 "-Wno-sign-compare", 696 "-include openbsd-compat.h", 697 ], 698 699 local_include_dirs: [ 700 "private", 701 "upstream-openbsd/android/include", 702 "upstream-openbsd/lib/libc/include", 703 ], 704 705 name: "libc_gdtoa", 706} 707 708// ======================================================== 709// libc_fortify.a - container for our FORITFY 710// implementation details 711// ======================================================== 712cc_library_static { 713 defaults: ["libc_defaults"], 714 srcs: ["bionic/fortify.cpp"], 715 716 name: "libc_fortify", 717 718 // Disable FORTIFY for the compilation of these, so we don't end up having 719 // FORTIFY silently call itself. 720 cflags: [ 721 "-U_FORTIFY_SOURCE", 722 "-D__BIONIC_DECLARE_FORTIFY_HELPERS", 723 ], 724 725 arch: { 726 arm: { 727 cflags: [ 728 "-DNO___MEMCPY_CHK", 729 "-DRENAME___STRCAT_CHK", 730 "-DRENAME___STRCPY_CHK", 731 ], 732 srcs: [ 733 "arch-arm/generic/bionic/__memcpy_chk.S", 734 735 "arch-arm/cortex-a15/bionic/__strcat_chk.S", 736 "arch-arm/cortex-a15/bionic/__strcpy_chk.S", 737 738 "arch-arm/cortex-a7/bionic/__strcat_chk.S", 739 "arch-arm/cortex-a7/bionic/__strcpy_chk.S", 740 741 "arch-arm/cortex-a9/bionic/__strcat_chk.S", 742 "arch-arm/cortex-a9/bionic/__strcpy_chk.S", 743 744 "arch-arm/krait/bionic/__strcat_chk.S", 745 "arch-arm/krait/bionic/__strcpy_chk.S", 746 747 "arch-arm/cortex-a53/bionic/__strcat_chk.S", 748 "arch-arm/cortex-a53/bionic/__strcpy_chk.S", 749 750 "arch-arm/cortex-a55/bionic/__strcat_chk.S", 751 "arch-arm/cortex-a55/bionic/__strcpy_chk.S", 752 ], 753 }, 754 arm64: { 755 cflags: ["-DNO___MEMCPY_CHK"], 756 srcs: [ 757 "arch-arm64/generic/bionic/__memcpy_chk.S", 758 ], 759 }, 760 }, 761} 762 763// ======================================================== 764// libc_bionic.a - home-grown C library code 765// ======================================================== 766 767cc_library_static { 768 defaults: ["libc_defaults"], 769 srcs: [ 770 // These require getauxval, which isn't available on older platforms. 771 "bionic/sysconf.cpp", 772 "bionic/vdso.cpp", 773 "bionic/setjmp_cookie.cpp", 774 775 // The following must not be statically linked into libc_ndk.a, because 776 // debuggerd will look for the abort message in libc.so's copy. 777 "bionic/android_set_abort_message.cpp", 778 779 "bionic/strchr.cpp", 780 "bionic/strnlen.c", 781 "bionic/strrchr.cpp", 782 ], 783 784 arch: { 785 arm: { 786 asflags: libc_common_flags + ["-mno-restrict-it"], 787 srcs: [ 788 "arch-arm/generic/bionic/memcmp.S", 789 "arch-arm/generic/bionic/memmove.S", 790 "arch-arm/generic/bionic/memset.S", 791 "arch-arm/generic/bionic/stpcpy.c", 792 "arch-arm/generic/bionic/strcat.c", 793 "arch-arm/generic/bionic/strcmp.S", 794 "arch-arm/generic/bionic/strcpy.S", 795 "arch-arm/generic/bionic/strlen.c", 796 797 "arch-arm/bionic/__aeabi_read_tp.S", 798 "arch-arm/bionic/__bionic_clone.S", 799 "arch-arm/bionic/__restore.S", 800 "arch-arm/bionic/_exit_with_stack_teardown.S", 801 "arch-arm/bionic/atomics_arm.c", 802 "arch-arm/bionic/bpabi.c", 803 "arch-arm/bionic/libcrt_compat.c", 804 "arch-arm/bionic/popcount_tab.c", 805 "arch-arm/bionic/setjmp.S", 806 "arch-arm/bionic/syscall.S", 807 "arch-arm/bionic/vfork.S", 808 809 "arch-arm/cortex-a15/bionic/memcpy.S", 810 "arch-arm/cortex-a15/bionic/memmove.S", 811 "arch-arm/cortex-a15/bionic/memset.S", 812 "arch-arm/cortex-a15/bionic/stpcpy.S", 813 "arch-arm/cortex-a15/bionic/strcat.S", 814 "arch-arm/cortex-a15/bionic/strcmp.S", 815 "arch-arm/cortex-a15/bionic/strcpy.S", 816 "arch-arm/cortex-a15/bionic/strlen.S", 817 818 "arch-arm/cortex-a7/bionic/memcpy.S", 819 "arch-arm/cortex-a7/bionic/memset.S", 820 821 "arch-arm/cortex-a9/bionic/memcpy.S", 822 "arch-arm/cortex-a9/bionic/memset.S", 823 "arch-arm/cortex-a9/bionic/stpcpy.S", 824 "arch-arm/cortex-a9/bionic/strcat.S", 825 "arch-arm/cortex-a9/bionic/strcpy.S", 826 "arch-arm/cortex-a9/bionic/strlen.S", 827 828 "arch-arm/krait/bionic/memcpy.S", 829 "arch-arm/krait/bionic/memset.S", 830 831 "arch-arm/cortex-a53/bionic/memcpy.S", 832 833 "arch-arm/cortex-a55/bionic/memcpy.S", 834 835 "arch-arm/kryo/bionic/memcpy.S", 836 ], 837 }, 838 arm64: { 839 srcs: [ 840 "arch-arm64/generic/bionic/memcmp.S", 841 "arch-arm64/generic/bionic/memcpy.S", 842 "arch-arm64/generic/bionic/memmove.S", 843 "arch-arm64/generic/bionic/memset.S", 844 "arch-arm64/generic/bionic/stpcpy.S", 845 "arch-arm64/generic/bionic/strcpy.S", 846 "arch-arm64/generic/bionic/wmemmove.S", 847 848 "arch-arm64/default/bionic/memchr.S", 849 "arch-arm64/default/bionic/strchr.S", 850 "arch-arm64/default/bionic/strcmp.S", 851 "arch-arm64/default/bionic/strlen.S", 852 "arch-arm64/default/bionic/strncmp.S", 853 "arch-arm64/default/bionic/strnlen.S", 854 855 "arch-arm64/mte/bionic/memchr.c", 856 "arch-arm64/mte/bionic/strchr.cpp", 857 "arch-arm64/mte/bionic/strcmp.c", 858 "arch-arm64/mte/bionic/strlen.c", 859 "arch-arm64/mte/bionic/strncmp.c", 860 "arch-arm64/mte/bionic/strnlen.c", 861 862 "arch-arm64/bionic/__bionic_clone.S", 863 "arch-arm64/bionic/_exit_with_stack_teardown.S", 864 "arch-arm64/bionic/setjmp.S", 865 "arch-arm64/bionic/syscall.S", 866 "arch-arm64/bionic/vfork.S", 867 ], 868 exclude_srcs: [ 869 "bionic/__memcpy_chk.cpp", 870 "bionic/strchr.cpp", 871 "bionic/strnlen.c", 872 ], 873 }, 874 875 x86: { 876 srcs: [ 877 "arch-x86/generic/string/memcmp.S", 878 "arch-x86/generic/string/strcmp.S", 879 "arch-x86/generic/string/strncmp.S", 880 "arch-x86/generic/string/strcat.S", 881 882 "arch-x86/generic/string/strlcat.c", 883 "arch-x86/generic/string/strlcpy.c", 884 "arch-x86/generic/string/strncat.c", 885 "arch-x86/generic/string/wcscat.c", 886 "arch-x86/generic/string/wcscpy.c", 887 "arch-x86/generic/string/wmemcmp.c", 888 "arch-x86/generic/string/wmemset.c", 889 890 "arch-x86/atom/string/sse2-memchr-atom.S", 891 "arch-x86/atom/string/sse2-memrchr-atom.S", 892 "arch-x86/atom/string/sse2-strchr-atom.S", 893 "arch-x86/atom/string/sse2-strnlen-atom.S", 894 "arch-x86/atom/string/sse2-strrchr-atom.S", 895 "arch-x86/atom/string/sse2-wcschr-atom.S", 896 "arch-x86/atom/string/sse2-wcsrchr-atom.S", 897 "arch-x86/atom/string/sse2-wcslen-atom.S", 898 "arch-x86/atom/string/sse2-wcscmp-atom.S", 899 "arch-x86/silvermont/string/sse2-memmove-slm.S", 900 "arch-x86/silvermont/string/sse2-memset-slm.S", 901 "arch-x86/silvermont/string/sse2-stpcpy-slm.S", 902 "arch-x86/silvermont/string/sse2-stpncpy-slm.S", 903 "arch-x86/silvermont/string/sse2-strcpy-slm.S", 904 "arch-x86/silvermont/string/sse2-strlen-slm.S", 905 "arch-x86/silvermont/string/sse2-strncpy-slm.S", 906 907 "arch-x86/bionic/__bionic_clone.S", 908 "arch-x86/bionic/_exit_with_stack_teardown.S", 909 "arch-x86/bionic/libcrt_compat.c", 910 "arch-x86/bionic/__restore.S", 911 "arch-x86/bionic/setjmp.S", 912 "arch-x86/bionic/syscall.S", 913 "arch-x86/bionic/vfork.S", 914 915 // ssse3 functions 916 "arch-x86/atom/string/ssse3-strcat-atom.S", 917 "arch-x86/atom/string/ssse3-strcmp-atom.S", 918 "arch-x86/atom/string/ssse3-strlcat-atom.S", 919 "arch-x86/atom/string/ssse3-strlcpy-atom.S", 920 "arch-x86/atom/string/ssse3-strncat-atom.S", 921 "arch-x86/atom/string/ssse3-strncmp-atom.S", 922 "arch-x86/atom/string/ssse3-wcscat-atom.S", 923 "arch-x86/atom/string/ssse3-wcscpy-atom.S", 924 925 // sse4 functions 926 "arch-x86/silvermont/string/sse4-memcmp-slm.S", 927 "arch-x86/silvermont/string/sse4-wmemcmp-slm.S", 928 929 // atom functions 930 "arch-x86/atom/string/sse2-memset-atom.S", 931 "arch-x86/atom/string/sse2-strlen-atom.S", 932 "arch-x86/atom/string/ssse3-memcmp-atom.S", 933 "arch-x86/atom/string/ssse3-memmove-atom.S", 934 "arch-x86/atom/string/ssse3-strcpy-atom.S", 935 "arch-x86/atom/string/ssse3-strncpy-atom.S", 936 "arch-x86/atom/string/ssse3-wmemcmp-atom.S", 937 938 // avx2 functions 939 "arch-x86/kabylake/string/avx2-wmemset-kbl.S", 940 ], 941 942 exclude_srcs: [ 943 "bionic/strchr.cpp", 944 "bionic/strnlen.c", 945 "bionic/strrchr.cpp", 946 ], 947 }, 948 x86_64: { 949 srcs: [ 950 "arch-x86_64/string/sse2-memmove-slm.S", 951 "arch-x86_64/string/sse2-memset-slm.S", 952 "arch-x86_64/string/sse2-stpcpy-slm.S", 953 "arch-x86_64/string/sse2-stpncpy-slm.S", 954 "arch-x86_64/string/sse2-strcat-slm.S", 955 "arch-x86_64/string/sse2-strcpy-slm.S", 956 "arch-x86_64/string/sse2-strlen-slm.S", 957 "arch-x86_64/string/sse2-strncat-slm.S", 958 "arch-x86_64/string/sse2-strncpy-slm.S", 959 "arch-x86_64/string/sse4-memcmp-slm.S", 960 "arch-x86_64/string/ssse3-strcmp-slm.S", 961 "arch-x86_64/string/ssse3-strncmp-slm.S", 962 "arch-x86_64/string/avx2-wmemset-kbl.S", 963 964 "arch-x86_64/bionic/__bionic_clone.S", 965 "arch-x86_64/bionic/_exit_with_stack_teardown.S", 966 "arch-x86_64/bionic/__restore_rt.S", 967 "arch-x86_64/bionic/setjmp.S", 968 "arch-x86_64/bionic/syscall.S", 969 "arch-x86_64/bionic/vfork.S", 970 ], 971 }, 972 }, 973 974 cppflags: ["-Wold-style-cast"], 975 include_dirs: ["bionic/libstdc++/include"], 976 name: "libc_bionic", 977} 978 979genrule { 980 name: "generated_android_ids", 981 out: ["generated_android_ids.h"], 982 srcs: [":android_filesystem_config_header"], 983 tool_files: ["fs_config_generator.py"], 984 cmd: "$(location fs_config_generator.py) aidarray $(in) > $(out)", 985} 986 987// ======================================================== 988// libc_bionic_ndk.a- The portions of libc_bionic that can 989// be safely used in libc_ndk.a (no troublesome global data 990// or constructors). 991// ======================================================== 992cc_library_static { 993 defaults: ["libc_defaults"], 994 srcs: [ 995 "bionic/NetdClientDispatch.cpp", 996 "bionic/__bionic_get_shell_path.cpp", 997 "bionic/__cmsg_nxthdr.cpp", 998 "bionic/__errno.cpp", 999 "bionic/__gnu_basename.cpp", 1000 "bionic/__libc_current_sigrtmax.cpp", 1001 "bionic/__libc_current_sigrtmin.cpp", 1002 "bionic/abort.cpp", 1003 "bionic/accept.cpp", 1004 "bionic/access.cpp", 1005 "bionic/arpa_inet.cpp", 1006 "bionic/assert.cpp", 1007 "bionic/atof.cpp", 1008 "bionic/bionic_allocator.cpp", 1009 "bionic/bionic_arc4random.cpp", 1010 "bionic/bionic_futex.cpp", 1011 "bionic/bionic_netlink.cpp", 1012 "bionic/bionic_systrace.cpp", 1013 "bionic/bionic_time_conversions.cpp", 1014 "bionic/brk.cpp", 1015 "bionic/c16rtomb.cpp", 1016 "bionic/c32rtomb.cpp", 1017 "bionic/chmod.cpp", 1018 "bionic/chown.cpp", 1019 "bionic/clearenv.cpp", 1020 "bionic/clock.cpp", 1021 "bionic/clock_getcpuclockid.cpp", 1022 "bionic/clock_nanosleep.cpp", 1023 "bionic/clone.cpp", 1024 "bionic/ctype.cpp", 1025 "bionic/dirent.cpp", 1026 "bionic/dup.cpp", 1027 "bionic/environ.cpp", 1028 "bionic/error.cpp", 1029 "bionic/eventfd.cpp", 1030 "bionic/exec.cpp", 1031 "bionic/faccessat.cpp", 1032 "bionic/fchmod.cpp", 1033 "bionic/fchmodat.cpp", 1034 "bionic/fcntl.cpp", 1035 "bionic/fdsan.cpp", 1036 "bionic/fdtrack.cpp", 1037 "bionic/ffs.cpp", 1038 "bionic/fgetxattr.cpp", 1039 "bionic/flistxattr.cpp", 1040 "bionic/flockfile.cpp", 1041 "bionic/fpclassify.cpp", 1042 "bionic/fsetxattr.cpp", 1043 "bionic/ftruncate.cpp", 1044 "bionic/ftw.cpp", 1045 "bionic/futimens.cpp", 1046 "bionic/getcwd.cpp", 1047 "bionic/getdomainname.cpp", 1048 "bionic/getentropy.cpp", 1049 "bionic/gethostname.cpp", 1050 "bionic/getloadavg.cpp", 1051 "bionic/getpagesize.cpp", 1052 "bionic/getpgrp.cpp", 1053 "bionic/getpid.cpp", 1054 "bionic/getpriority.cpp", 1055 "bionic/gettid.cpp", 1056 "bionic/get_device_api_level.cpp", 1057 "bionic/grp_pwd.cpp", 1058 "bionic/grp_pwd_file.cpp", 1059 "bionic/iconv.cpp", 1060 "bionic/icu_wrappers.cpp", 1061 "bionic/ifaddrs.cpp", 1062 "bionic/inotify_init.cpp", 1063 "bionic/ioctl.cpp", 1064 "bionic/killpg.cpp", 1065 "bionic/langinfo.cpp", 1066 "bionic/lchown.cpp", 1067 "bionic/lfs64_support.cpp", 1068 "bionic/libc_init_common.cpp", 1069 "bionic/libgen.cpp", 1070 "bionic/link.cpp", 1071 "bionic/locale.cpp", 1072 "bionic/lockf.cpp", 1073 "bionic/lstat.cpp", 1074 "bionic/mblen.cpp", 1075 "bionic/mbrtoc16.cpp", 1076 "bionic/mbrtoc32.cpp", 1077 "bionic/memmem.cpp", 1078 "bionic/mempcpy.cpp", 1079 "bionic/mkdir.cpp", 1080 "bionic/mkfifo.cpp", 1081 "bionic/mknod.cpp", 1082 "bionic/mntent.cpp", 1083 "bionic/mremap.cpp", 1084 "bionic/net_if.cpp", 1085 "bionic/netdb.cpp", 1086 "bionic/netinet_in.cpp", 1087 "bionic/nl_types.cpp", 1088 "bionic/open.cpp", 1089 "bionic/pathconf.cpp", 1090 "bionic/pause.cpp", 1091 "bionic/pipe.cpp", 1092 "bionic/poll.cpp", 1093 "bionic/posix_fadvise.cpp", 1094 "bionic/posix_fallocate.cpp", 1095 "bionic/posix_madvise.cpp", 1096 "bionic/posix_timers.cpp", 1097 "bionic/ptrace.cpp", 1098 "bionic/pty.cpp", 1099 "bionic/raise.cpp", 1100 "bionic/rand.cpp", 1101 "bionic/readlink.cpp", 1102 "bionic/realpath.cpp", 1103 "bionic/reboot.cpp", 1104 "bionic/recv.cpp", 1105 "bionic/recvmsg.cpp", 1106 "bionic/rename.cpp", 1107 "bionic/rmdir.cpp", 1108 "bionic/scandir.cpp", 1109 "bionic/sched_getaffinity.cpp", 1110 "bionic/sched_getcpu.cpp", 1111 "bionic/semaphore.cpp", 1112 "bionic/send.cpp", 1113 "bionic/setegid.cpp", 1114 "bionic/seteuid.cpp", 1115 "bionic/setpgrp.cpp", 1116 "bionic/sigaction.cpp", 1117 "bionic/signal.cpp", 1118 "bionic/sigprocmask.cpp", 1119 "bionic/sleep.cpp", 1120 "bionic/socketpair.cpp", 1121 "bionic/spawn.cpp", 1122 "bionic/stat.cpp", 1123 "bionic/stdlib_l.cpp", 1124 "bionic/strchrnul.cpp", 1125 "bionic/strerror.cpp", 1126 "bionic/string_l.cpp", 1127 "bionic/strings_l.cpp", 1128 "bionic/strsignal.cpp", 1129 "bionic/strtol.cpp", 1130 "bionic/strtold.cpp", 1131 "bionic/swab.cpp", 1132 "bionic/symlink.cpp", 1133 "bionic/sync_file_range.cpp", 1134 "bionic/sys_epoll.cpp", 1135 "bionic/sys_msg.cpp", 1136 "bionic/sys_sem.cpp", 1137 "bionic/sys_shm.cpp", 1138 "bionic/sys_signalfd.cpp", 1139 "bionic/sys_statfs.cpp", 1140 "bionic/sys_statvfs.cpp", 1141 "bionic/sys_time.cpp", 1142 "bionic/sysinfo.cpp", 1143 "bionic/syslog.cpp", 1144 "bionic/system.cpp", 1145 "bionic/system_property_api.cpp", 1146 "bionic/system_property_set.cpp", 1147 "bionic/tdestroy.cpp", 1148 "bionic/termios.cpp", 1149 "bionic/thread_private.cpp", 1150 "bionic/threads.cpp", 1151 "bionic/timespec_get.cpp", 1152 "bionic/tmpfile.cpp", 1153 "bionic/umount.cpp", 1154 "bionic/unlink.cpp", 1155 "bionic/usleep.cpp", 1156 "bionic/wait.cpp", 1157 "bionic/wchar.cpp", 1158 "bionic/wchar_l.cpp", 1159 "bionic/wcstod.cpp", 1160 "bionic/wctype.cpp", 1161 "bionic/wcwidth.cpp", 1162 "bionic/wmempcpy.cpp", 1163 1164 // This contains a weak stub implementation of __find_icu_symbol for wctype.cpp, 1165 // which will be overridden by the actual one in libc.so. 1166 "bionic/icu_static.cpp", 1167 ], 1168 1169 multilib: { 1170 lib32: { 1171 // LP32 cruft 1172 srcs: ["bionic/mmap.cpp"], 1173 }, 1174 }, 1175 product_variables: { 1176 treble_linker_namespaces: { 1177 cflags: ["-DTREBLE_LINKER_NAMESPACES"], 1178 }, 1179 }, 1180 whole_static_libs: ["libsystemproperties"], 1181 cppflags: ["-Wold-style-cast"], 1182 local_include_dirs: ["stdio"], 1183 include_dirs: ["bionic/libstdc++/include"], 1184 name: "libc_bionic_ndk", 1185 generated_headers: ["generated_android_ids"], 1186} 1187 1188// ======================================================== 1189// libc_pthread.a - pthreads parts that previously lived in 1190// libc_bionic.a. Relocated to their own library because 1191// they can't be included in libc_ndk.a (as the layout of 1192// pthread_t has changed over the years and has ABI 1193// compatibility issues). 1194// ======================================================== 1195 1196cc_library_static { 1197 defaults: ["libc_defaults"], 1198 srcs: [ 1199 "bionic/bionic_elf_tls.cpp", 1200 "bionic/pthread_atfork.cpp", 1201 "bionic/pthread_attr.cpp", 1202 "bionic/pthread_barrier.cpp", 1203 "bionic/pthread_cond.cpp", 1204 "bionic/pthread_create.cpp", 1205 "bionic/pthread_detach.cpp", 1206 "bionic/pthread_equal.cpp", 1207 "bionic/pthread_exit.cpp", 1208 "bionic/pthread_getcpuclockid.cpp", 1209 "bionic/pthread_getschedparam.cpp", 1210 "bionic/pthread_gettid_np.cpp", 1211 "bionic/pthread_internal.cpp", 1212 "bionic/pthread_join.cpp", 1213 "bionic/pthread_key.cpp", 1214 "bionic/pthread_kill.cpp", 1215 "bionic/pthread_mutex.cpp", 1216 "bionic/pthread_once.cpp", 1217 "bionic/pthread_rwlock.cpp", 1218 "bionic/pthread_sigqueue.cpp", 1219 "bionic/pthread_self.cpp", 1220 "bionic/pthread_setname_np.cpp", 1221 "bionic/pthread_setschedparam.cpp", 1222 "bionic/pthread_spinlock.cpp", 1223 1224 // The following implementations depend on pthread data or implementation, 1225 // so we can't include them in libc_ndk.a. 1226 "bionic/__cxa_thread_atexit_impl.cpp", 1227 "bionic/android_unsafe_frame_pointer_chase.cpp", 1228 "bionic/atexit.cpp", 1229 "bionic/fork.cpp", 1230 ], 1231 1232 cppflags: ["-Wold-style-cast"], 1233 include_dirs: ["bionic/libstdc++/include"], 1234 header_libs: ["bionic_libc_platform_headers"], 1235 name: "libc_pthread", 1236} 1237 1238// ======================================================== 1239// libc_syscalls.a 1240// ======================================================== 1241 1242genrule { 1243 name: "syscalls-arm.S", 1244 out: ["syscalls-arm.S"], 1245 srcs: ["SYSCALLS.TXT"], 1246 tool_files: [":bionic-gensyscalls"], 1247 cmd: "$(location :bionic-gensyscalls) arm $(in) > $(out)", 1248} 1249 1250genrule { 1251 name: "syscalls-arm64.S", 1252 out: ["syscalls-arm64.S"], 1253 srcs: ["SYSCALLS.TXT"], 1254 tool_files: [":bionic-gensyscalls"], 1255 cmd: "$(location :bionic-gensyscalls) arm64 $(in) > $(out)", 1256} 1257 1258genrule { 1259 name: "syscalls-x86.S", 1260 out: ["syscalls-x86.S"], 1261 srcs: ["SYSCALLS.TXT"], 1262 tool_files: [":bionic-gensyscalls"], 1263 cmd: "$(location :bionic-gensyscalls) x86 $(in) > $(out)", 1264} 1265 1266genrule { 1267 name: "syscalls-x86_64.S", 1268 out: ["syscalls-x86_64.S"], 1269 srcs: ["SYSCALLS.TXT"], 1270 tool_files: [":bionic-gensyscalls"], 1271 cmd: "$(location :bionic-gensyscalls) x86_64 $(in) > $(out)", 1272} 1273 1274cc_library_static { 1275 defaults: ["libc_defaults"], 1276 srcs: ["bionic/__set_errno.cpp"], 1277 arch: { 1278 arm: { 1279 srcs: [":syscalls-arm.S"], 1280 }, 1281 arm64: { 1282 srcs: [":syscalls-arm64.S"], 1283 }, 1284 x86: { 1285 srcs: [":syscalls-x86.S"], 1286 }, 1287 x86_64: { 1288 srcs: [":syscalls-x86_64.S"], 1289 }, 1290 }, 1291 name: "libc_syscalls", 1292} 1293 1294// ======================================================== 1295// libc_aeabi.a 1296// This is an LP32 ARM-only library that needs to be built with -fno-builtin 1297// to avoid infinite recursion. For the other architectures we just build an 1298// empty library to keep this makefile simple. 1299// ======================================================== 1300 1301cc_library_static { 1302 defaults: ["libc_defaults"], 1303 arch: { 1304 arm: { 1305 srcs: ["arch-arm/bionic/__aeabi.c"], 1306 }, 1307 }, 1308 name: "libc_aeabi", 1309 cflags: ["-fno-builtin"], 1310} 1311 1312// ======================================================== 1313// libc_ndk.a 1314// Compatibility library for the NDK. This library contains 1315// all the parts of libc that are safe to statically link. 1316// We can't safely statically link things that can only run 1317// on a certain version of the OS. Examples include 1318// anything that talks to netd (a large portion of the DNS 1319// code) and anything that is dependent on the layout of a 1320// data structure that has changed across releases (such as 1321// pthread_t). 1322// ======================================================== 1323 1324cc_library_static { 1325 name: "libc_ndk", 1326 defaults: [ 1327 "libc_defaults", 1328 "libc_native_allocator_defaults", 1329 ], 1330 ramdisk_available: false, 1331 srcs: libc_common_src_files + [ 1332 "bionic/gwp_asan_wrappers.cpp", 1333 "bionic/heap_tagging.cpp", 1334 "bionic/malloc_common.cpp", 1335 "bionic/malloc_limit.cpp", 1336 ], 1337 multilib: { 1338 lib32: { 1339 srcs: libc_common_src_files_32, 1340 }, 1341 }, 1342 arch: { 1343 arm: { 1344 srcs: [ 1345 "arch-arm/bionic/exidx_dynamic.c", 1346 "arch-common/bionic/crtbegin_so.c", 1347 "arch-arm/bionic/atexit_legacy.c", 1348 "arch-common/bionic/crtend_so.S", 1349 ], 1350 whole_static_libs: ["libc_aeabi"], 1351 }, 1352 }, 1353 1354 cflags: [ 1355 "-fvisibility=hidden", 1356 "-DLIBC_STATIC", 1357 ], 1358 1359 whole_static_libs: [ 1360 "gwp_asan", 1361 "libc_bionic_ndk", 1362 "libc_bootstrap", 1363 "libc_fortify", 1364 "libc_freebsd", 1365 "libc_freebsd_large_stack", 1366 "libc_gdtoa", 1367 "libc_netbsd", 1368 "libc_openbsd_large_stack", 1369 "libc_openbsd_ndk", 1370 "libc_syscalls", 1371 "libc_tzcode", 1372 "libm", 1373 "libstdc++", 1374 ], 1375} 1376 1377// ======================================================== 1378// libc_nopthread.a 1379// ======================================================== 1380cc_library_static { 1381 defaults: ["libc_defaults"], 1382 srcs: libc_common_src_files, 1383 multilib: { 1384 lib32: { 1385 srcs: libc_common_src_files_32, 1386 }, 1387 }, 1388 name: "libc_nopthread", 1389 1390 whole_static_libs: [ 1391 "libc_bionic", 1392 "libc_bionic_ndk", 1393 "libc_bootstrap", 1394 "libc_dns", 1395 "libc_fortify", 1396 "libc_freebsd", 1397 "libc_freebsd_large_stack", 1398 "libc_gdtoa", 1399 "libc_netbsd", 1400 "libc_openbsd", 1401 "libc_openbsd_large_stack", 1402 "libc_openbsd_ndk", 1403 "libc_syscalls", 1404 "libc_tzcode", 1405 "libstdc++", 1406 ], 1407 1408 arch: { 1409 arm: { 1410 whole_static_libs: ["libc_aeabi"], 1411 }, 1412 }, 1413} 1414 1415// ======================================================== 1416// libc_common.a 1417// ======================================================== 1418 1419cc_library_static { 1420 defaults: ["libc_defaults"], 1421 name: "libc_common", 1422 1423 whole_static_libs: [ 1424 "libc_nopthread", 1425 "libc_pthread", 1426 ], 1427} 1428 1429// ======================================================== 1430// libc_static_dispatch.a 1431// ======================================================== 1432cc_library_static { 1433 defaults: ["libc_defaults"], 1434 name: "libc_static_dispatch", 1435 1436 arch: { 1437 x86: { 1438 srcs: ["arch-x86/static_function_dispatch.S"], 1439 }, 1440 arm: { 1441 srcs: ["arch-arm/static_function_dispatch.S"], 1442 }, 1443 arm64: { 1444 srcs: ["arch-arm64/static_function_dispatch.S"], 1445 }, 1446 }, 1447} 1448 1449// ======================================================== 1450// libc_dynamic_dispatch.a 1451// ======================================================== 1452cc_library_static { 1453 defaults: ["libc_defaults"], 1454 name: "libc_dynamic_dispatch", 1455 1456 cflags: [ 1457 "-ffreestanding", 1458 "-fno-stack-protector", 1459 "-fno-jump-tables", 1460 ], 1461 arch: { 1462 x86: { 1463 srcs: ["arch-x86/dynamic_function_dispatch.cpp"], 1464 }, 1465 arm: { 1466 srcs: ["arch-arm/dynamic_function_dispatch.cpp"], 1467 }, 1468 arm64: { 1469 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"], 1470 }, 1471 }, 1472} 1473 1474// ======================================================== 1475// libc_common_static.a For static binaries. 1476// ======================================================== 1477cc_library_static { 1478 defaults: ["libc_defaults"], 1479 name: "libc_common_static", 1480 1481 whole_static_libs: [ 1482 "libc_common", 1483 "libc_static_dispatch", 1484 ], 1485} 1486 1487// ======================================================== 1488// libc_common_shared.a For shared libraries. 1489// ======================================================== 1490cc_library_static { 1491 defaults: ["libc_defaults"], 1492 name: "libc_common_shared", 1493 1494 whole_static_libs: [ 1495 "libc_common", 1496 "libc_dynamic_dispatch", 1497 ], 1498} 1499 1500// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static 1501// executable. 1502cc_library_static { 1503 name: "libc_unwind_static", 1504 defaults: ["libc_defaults"], 1505 cflags: ["-DLIBC_STATIC"], 1506 1507 srcs: ["bionic/dl_iterate_phdr_static.cpp"], 1508 arch: { 1509 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs 1510 arm: { 1511 srcs: ["arch-arm/bionic/exidx_static.c"], 1512 }, 1513 }, 1514} 1515 1516// ======================================================== 1517// libc_nomalloc.a 1518// ======================================================== 1519// 1520// This is a version of the static C library used by the dynamic linker that exclude malloc. It also 1521// excludes functions selected using ifunc's (e.g. for string.h). Link in either 1522// libc_static_dispatch or libc_dynamic_dispatch to provide those functions. 1523 1524cc_library_static { 1525 name: "libc_nomalloc", 1526 defaults: ["libc_defaults"], 1527 1528 whole_static_libs: [ 1529 "libc_common", 1530 "libc_init_static", 1531 "libc_unwind_static", 1532 ], 1533} 1534 1535filegroup { 1536 name: "libc_sources_shared", 1537 srcs: [ 1538 "arch-common/bionic/crtbegin_so.c", 1539 "arch-common/bionic/crtbrand.S", 1540 "bionic/gwp_asan_wrappers.cpp", 1541 "bionic/heap_tagging.cpp", 1542 "bionic/icu.cpp", 1543 "bionic/malloc_common.cpp", 1544 "bionic/malloc_common_dynamic.cpp", 1545 "bionic/android_profiling_dynamic.cpp", 1546 "bionic/malloc_heapprofd.cpp", 1547 "bionic/malloc_limit.cpp", 1548 "bionic/ndk_cruft.cpp", 1549 "bionic/ndk_cruft_data.cpp", 1550 "bionic/NetdClient.cpp", 1551 "arch-common/bionic/crtend_so.S", 1552 ], 1553} 1554 1555filegroup { 1556 name: "libc_sources_static", 1557 srcs: [ 1558 "bionic/gwp_asan_wrappers.cpp", 1559 "bionic/heap_tagging.cpp", 1560 "bionic/malloc_common.cpp", 1561 "bionic/malloc_limit.cpp", 1562 ], 1563} 1564 1565filegroup { 1566 name: "libc_sources_shared_arm", 1567 srcs: [ 1568 "arch-arm/bionic/exidx_dynamic.c", 1569 "arch-arm/bionic/atexit_legacy.c", 1570 ], 1571} 1572 1573// ======================================================== 1574// libc.a + libc.so 1575// ======================================================== 1576cc_library { 1577 defaults: [ 1578 "libc_defaults", 1579 "libc_native_allocator_defaults", 1580 ], 1581 name: "libc", 1582 static_ndk_lib: true, 1583 export_include_dirs: ["include"], 1584 product_variables: { 1585 platform_sdk_version: { 1586 asflags: ["-DPLATFORM_SDK_VERSION=%d"], 1587 }, 1588 }, 1589 static: { 1590 srcs: [ ":libc_sources_static" ], 1591 cflags: ["-DLIBC_STATIC"], 1592 whole_static_libs: [ 1593 "gwp_asan", 1594 "libc_init_static", 1595 "libc_common_static", 1596 "libc_unwind_static", 1597 ], 1598 }, 1599 shared: { 1600 srcs: [ ":libc_sources_shared" ], 1601 whole_static_libs: [ 1602 "gwp_asan", 1603 "libc_init_dynamic", 1604 "libc_common_shared", 1605 ], 1606 }, 1607 1608 required: [ 1609 "tzdata", 1610 "tz_version", // Version metadata for tzdata to help debugging. 1611 ], 1612 1613 // Do not pack libc.so relocations; see http://b/20645321 for details. 1614 pack_relocations: false, 1615 1616 // WARNING: The only libraries libc.so should depend on are libdl.so and ld-android.so! 1617 // If you add other libraries, make sure to add -Wl,--exclude-libs=libgcc.a to the 1618 // LOCAL_LDFLAGS for those libraries. This ensures that symbols that are pulled into 1619 // those new libraries from libgcc.a are not declared external; if that were the case, 1620 // then libc would not pull those symbols from libgcc.a as it should, instead relying 1621 // on the external symbols from the dependent libraries. That would create a "cloaked" 1622 // dependency on libgcc.a in libc though the libraries, which is not what you wanted! 1623 1624 shared_libs: [ 1625 "ld-android", 1626 "libdl", 1627 ], 1628 static_libs: [ 1629 "libdl_android", 1630 ], 1631 1632 nocrt: true, 1633 1634 arch: { 1635 arm: { 1636 // TODO: This is to work around b/24465209. Remove after root cause is fixed. 1637 pack_relocations: false, 1638 ldflags: ["-Wl,--hash-style=both"], 1639 1640 version_script: ":libc.arm.map", 1641 1642 shared: { 1643 srcs: [":libc_sources_shared_arm"], 1644 // special for arm 1645 cflags: ["-DCRT_LEGACY_WORKAROUND"], 1646 }, 1647 1648 // Arm 32 bit does not produce complete exidx unwind information 1649 // so keep the .debug_frame which is relatively small and does 1650 // include needed unwind information. 1651 // See b/132992102 for details. 1652 strip: { 1653 keep_symbols_and_debug_frame: true, 1654 }, 1655 1656 whole_static_libs: [ "libunwind_llvm" ], 1657 }, 1658 arm64: { 1659 version_script: ":libc.arm64.map", 1660 1661 // Leave the symbols in the shared library so that stack unwinders can produce 1662 // meaningful name resolution. 1663 strip: { 1664 keep_symbols: true, 1665 }, 1666 1667 whole_static_libs: [ "libgcc_stripped" ], 1668 }, 1669 x86: { 1670 // TODO: This is to work around b/24465209. Remove after root cause is fixed. 1671 pack_relocations: false, 1672 ldflags: ["-Wl,--hash-style=both"], 1673 1674 version_script: ":libc.x86.map", 1675 1676 // Leave the symbols in the shared library so that stack unwinders can produce 1677 // meaningful name resolution. 1678 strip: { 1679 keep_symbols: true, 1680 }, 1681 1682 whole_static_libs: [ "libgcc_stripped" ], 1683 }, 1684 x86_64: { 1685 version_script: ":libc.x86_64.map", 1686 1687 // Leave the symbols in the shared library so that stack unwinders can produce 1688 // meaningful name resolution. 1689 strip: { 1690 keep_symbols: true, 1691 }, 1692 1693 whole_static_libs: [ "libgcc_stripped" ], 1694 }, 1695 }, 1696 1697 stubs: { 1698 symbol_file: "libc.map.txt", 1699 versions: [ 1700 "29", 1701 "R", 1702 "10000", 1703 ], 1704 }, 1705 1706 apex_available: [ 1707 "//apex_available:platform", 1708 "com.android.runtime", 1709 ], 1710 1711 // Sorting bss symbols by size usually results in less dirty pages at run 1712 // time, because small symbols are grouped together. 1713 sort_bss_symbols_by_size: true, 1714} 1715 1716genrule { 1717 name: "libc.arm.map", 1718 out: ["libc.arm.map"], 1719 srcs: ["libc.map.txt"], 1720 tool_files: [":bionic-generate-version-script"], 1721 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)", 1722} 1723 1724genrule { 1725 name: "libc.arm64.map", 1726 out: ["libc.arm64.map"], 1727 srcs: ["libc.map.txt"], 1728 tool_files: [":bionic-generate-version-script"], 1729 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)", 1730} 1731 1732genrule { 1733 name: "libc.x86.map", 1734 out: ["libc.x86.map"], 1735 srcs: ["libc.map.txt"], 1736 tool_files: [":bionic-generate-version-script"], 1737 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)", 1738} 1739 1740genrule { 1741 name: "libc.x86_64.map", 1742 out: ["libc.x86_64.map"], 1743 srcs: ["libc.map.txt"], 1744 tool_files: [":bionic-generate-version-script"], 1745 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)", 1746} 1747 1748// Headers that only other parts of the platform can include. 1749cc_library_headers { 1750 name: "bionic_libc_platform_headers", 1751 visibility: [ 1752 "//art:__subpackages__", 1753 "//bionic:__subpackages__", 1754 "//frameworks:__subpackages__", 1755 "//device/generic/goldfish-opengl:__subpackages__", 1756 "//external/gwp_asan:__subpackages__", 1757 "//external/perfetto:__subpackages__", 1758 "//external/scudo:__subpackages__", 1759 "//system/core/debuggerd:__subpackages__", 1760 "//system/memory/libmemunreachable:__subpackages__", 1761 ], 1762 host_supported: true, 1763 vendor_available: true, 1764 ramdisk_available: true, 1765 recovery_available: true, 1766 native_bridge_supported: true, 1767 export_include_dirs: [ 1768 "platform", 1769 ], 1770 system_shared_libs: [], 1771 stl: "none", 1772 sdk_version: "current", 1773 1774 apex_available: [ 1775 "//apex_available:platform", 1776 "com.android.runtime", 1777 "com.android.art.release", // from libdexfile_external 1778 "com.android.art.debug", // from libdexfile_external 1779 ], 1780} 1781 1782// libc_headers for libasync_safe and libpropertyinfoparser 1783cc_library_headers { 1784 name: "libc_headers", 1785 1786 host_supported: true, 1787 vendor_available: true, 1788 ramdisk_available: true, 1789 recovery_available: true, 1790 native_bridge_supported: true, 1791 apex_available: [ 1792 "//apex_available:platform", 1793 "//apex_available:anyapex", 1794 ], 1795 // used by most APEXes indirectly via libunwind_llvm 1796 min_sdk_version: "apex_inherit", 1797 visibility: [ 1798 ":__subpackages__", // visible to bionic 1799 // ... and only to these places (b/152668052) 1800 "//external/gwp_asan", 1801 "//external/libunwind_llvm", 1802 "//system/core/property_service/libpropertyinfoparser", 1803 "//system/extras/toolchain-extras", 1804 ], 1805 1806 no_libcrt: true, 1807 stl: "none", 1808 system_shared_libs: [], 1809 1810 // The build system generally requires that any dependencies of a target 1811 // with an sdk_version must have a lower sdk_version. By setting sdk_version 1812 // to 1 we let targets with an sdk_version that need to depend on the libc 1813 // headers but cannot depend on libc itself due to circular dependencies 1814 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1 1815 // is correct because the headers can support any sdk_version. 1816 sdk_version: "1", 1817 1818 export_include_dirs: [ 1819 "include", 1820 "kernel/uapi", 1821 "kernel/android/uapi", 1822 ], 1823 1824 arch: { 1825 arm: { 1826 export_include_dirs: [ 1827 "kernel/uapi/asm-arm", 1828 ], 1829 }, 1830 arm64: { 1831 export_include_dirs: [ 1832 "kernel/uapi/asm-arm64", 1833 ], 1834 }, 1835 x86: { 1836 export_include_dirs: [ 1837 "kernel/uapi/asm-x86", 1838 ], 1839 }, 1840 x86_64: { 1841 export_include_dirs: [ 1842 "kernel/uapi/asm-x86", 1843 ], 1844 }, 1845 }, 1846} 1847 1848// ======================================================== 1849// libstdc++.so and libstdc++.a. 1850// ======================================================== 1851 1852cc_library { 1853 defaults: ["libc_defaults"], 1854 include_dirs: ["bionic/libstdc++/include"], 1855 srcs: [ 1856 "bionic/__cxa_guard.cpp", 1857 "bionic/__cxa_pure_virtual.cpp", 1858 "bionic/new.cpp", 1859 ], 1860 name: "libstdc++", 1861 static_ndk_lib: true, 1862 static_libs: ["libasync_safe"], 1863 1864 static: { 1865 system_shared_libs: [], 1866 }, 1867 shared: { 1868 system_shared_libs: ["libc"], 1869 }, 1870 1871 //TODO (dimitry): This is to work around b/24465209. Remove after root cause is fixed 1872 arch: { 1873 arm: { 1874 // TODO: This is to work around b/24465209. Remove after root cause is fixed. 1875 pack_relocations: false, 1876 ldflags: ["-Wl,--hash-style=both"], 1877 version_script: ":libstdc++.arm.map", 1878 }, 1879 arm64: { 1880 version_script: ":libstdc++.arm64.map", 1881 }, 1882 x86: { 1883 pack_relocations: false, 1884 ldflags: ["-Wl,--hash-style=both"], 1885 version_script: ":libstdc++.x86.map", 1886 }, 1887 x86_64: { 1888 version_script: ":libstdc++.x86_64.map", 1889 }, 1890 }, 1891} 1892 1893genrule { 1894 name: "libstdc++.arm.map", 1895 out: ["libstdc++.arm.map"], 1896 srcs: ["libstdc++.map.txt"], 1897 tool_files: [":bionic-generate-version-script"], 1898 cmd: "$(location :bionic-generate-version-script) arm $(in) $(out)", 1899} 1900 1901genrule { 1902 name: "libstdc++.arm64.map", 1903 out: ["libstdc++.arm64.map"], 1904 srcs: ["libstdc++.map.txt"], 1905 tool_files: [":bionic-generate-version-script"], 1906 cmd: "$(location :bionic-generate-version-script) arm64 $(in) $(out)", 1907} 1908 1909genrule { 1910 name: "libstdc++.x86.map", 1911 out: ["libstdc++.x86.map"], 1912 srcs: ["libstdc++.map.txt"], 1913 tool_files: [":bionic-generate-version-script"], 1914 cmd: "$(location :bionic-generate-version-script) x86 $(in) $(out)", 1915} 1916 1917genrule { 1918 name: "libstdc++.x86_64.map", 1919 out: ["libstdc++.x86_64.map"], 1920 srcs: ["libstdc++.map.txt"], 1921 tool_files: [":bionic-generate-version-script"], 1922 cmd: "$(location :bionic-generate-version-script) x86_64 $(in) $(out)", 1923} 1924 1925// ======================================================== 1926// crt object files. 1927// ======================================================== 1928 1929cc_defaults { 1930 name: "crt_defaults", 1931 defaults: ["linux_bionic_supported"], 1932 vendor_available: true, 1933 ramdisk_available: true, 1934 recovery_available: true, 1935 native_bridge_supported: true, 1936 apex_available: [ 1937 "//apex_available:platform", 1938 "//apex_available:anyapex", 1939 ], 1940 // crt* objects are used by most cc_binary/cc_library in "anyapex" 1941 min_sdk_version: "apex_inherit", 1942 cflags: [ 1943 "-Wno-gcc-compat", 1944 "-Wall", 1945 "-Werror", 1946 ], 1947 sanitize: { 1948 never: true, 1949 }, 1950} 1951 1952cc_defaults { 1953 name: "crt_so_defaults", 1954 defaults: ["crt_defaults"], 1955 1956 arch: { 1957 x86: { 1958 cflags: ["-fPIC"], 1959 }, 1960 x86_64: { 1961 cflags: ["-fPIC"], 1962 }, 1963 }, 1964 stl: "none", 1965} 1966 1967cc_object { 1968 name: "crtbrand", 1969 // crtbrand.c needs <stdint.h> and a #define for the platform SDK version. 1970 local_include_dirs: ["include"], 1971 product_variables: { 1972 platform_sdk_version: { 1973 asflags: ["-DPLATFORM_SDK_VERSION=%d"], 1974 }, 1975 }, 1976 srcs: ["arch-common/bionic/crtbrand.S"], 1977 1978 defaults: ["crt_so_defaults"], 1979} 1980 1981cc_object { 1982 name: "crtbegin_so1", 1983 local_include_dirs: ["include"], 1984 srcs: ["arch-common/bionic/crtbegin_so.c"], 1985 1986 defaults: ["crt_so_defaults"], 1987} 1988 1989cc_object { 1990 name: "crtbegin_so", 1991 1992 defaults: ["crt_so_defaults"], 1993 objs: [ 1994 "crtbegin_so1", 1995 "crtbrand", 1996 ], 1997} 1998 1999cc_object { 2000 name: "crtend_so", 2001 local_include_dirs: ["include"], 2002 srcs: ["arch-common/bionic/crtend_so.S"], 2003 2004 defaults: ["crt_so_defaults"], 2005} 2006 2007cc_object { 2008 name: "crtbegin_static1", 2009 local_include_dirs: ["include"], 2010 srcs: ["arch-common/bionic/crtbegin.c"], 2011 defaults: ["crt_defaults"], 2012} 2013 2014cc_object { 2015 name: "crtbegin_static", 2016 2017 objs: [ 2018 "crtbegin_static1", 2019 "crtbrand", 2020 ], 2021 defaults: ["crt_defaults"], 2022} 2023 2024cc_object { 2025 name: "crtbegin_dynamic1", 2026 local_include_dirs: ["include"], 2027 srcs: ["arch-common/bionic/crtbegin.c"], 2028 defaults: ["crt_defaults"], 2029} 2030 2031cc_object { 2032 name: "crtbegin_dynamic", 2033 2034 objs: [ 2035 "crtbegin_dynamic1", 2036 "crtbrand", 2037 ], 2038 target: { 2039 linux_bionic: { 2040 generated_sources: ["host_bionic_linker_asm"], 2041 objs: [ 2042 "linker_wrapper", 2043 ], 2044 }, 2045 }, 2046 defaults: ["crt_defaults"], 2047} 2048 2049cc_object { 2050 // We rename crtend.o to crtend_android.o to avoid a 2051 // name clash between gcc and bionic. 2052 name: "crtend_android", 2053 local_include_dirs: ["include"], 2054 srcs: ["arch-common/bionic/crtend.S"], 2055 2056 defaults: ["crt_defaults"], 2057} 2058 2059// ======================================================== 2060// NDK headers. 2061// ======================================================== 2062 2063versioned_ndk_headers { 2064 name: "common_libc", 2065 from: "include", 2066 to: "", 2067 license: "NOTICE", 2068} 2069 2070ndk_headers { 2071 name: "libc_uapi", 2072 from: "kernel/uapi", 2073 to: "", 2074 srcs: [ 2075 "kernel/uapi/asm-generic/**/*.h", 2076 "kernel/uapi/drm/**/*.h", 2077 "kernel/uapi/linux/**/*.h", 2078 "kernel/uapi/misc/**/*.h", 2079 "kernel/uapi/mtd/**/*.h", 2080 "kernel/uapi/rdma/**/*.h", 2081 "kernel/uapi/scsi/**/*.h", 2082 "kernel/uapi/sound/**/*.h", 2083 "kernel/uapi/video/**/*.h", 2084 "kernel/uapi/xen/**/*.h", 2085 ], 2086 license: "NOTICE", 2087} 2088 2089ndk_headers { 2090 name: "libc_kernel_android_uapi_linux", 2091 from: "kernel/android/uapi/linux", 2092 to: "linux", 2093 srcs: ["kernel/android/uapi/linux/**/*.h"], 2094 license: "NOTICE", 2095} 2096 2097ndk_headers { 2098 name: "libc_kernel_android_scsi", 2099 from: "kernel/android/scsi/scsi", 2100 to: "scsi", 2101 srcs: ["kernel/android/scsi/**/*.h"], 2102 license: "NOTICE", 2103} 2104 2105ndk_headers { 2106 name: "libc_asm_arm", 2107 from: "kernel/uapi/asm-arm", 2108 to: "arm-linux-androideabi", 2109 srcs: ["kernel/uapi/asm-arm/**/*.h"], 2110 license: "NOTICE", 2111} 2112 2113ndk_headers { 2114 name: "libc_asm_arm64", 2115 from: "kernel/uapi/asm-arm64", 2116 to: "aarch64-linux-android", 2117 srcs: ["kernel/uapi/asm-arm64/**/*.h"], 2118 license: "NOTICE", 2119} 2120 2121ndk_headers { 2122 name: "libc_asm_x86", 2123 from: "kernel/uapi/asm-x86", 2124 to: "i686-linux-android", 2125 srcs: ["kernel/uapi/asm-x86/**/*.h"], 2126 license: "NOTICE", 2127} 2128 2129ndk_headers { 2130 name: "libc_asm_x86_64", 2131 from: "kernel/uapi/asm-x86", 2132 to: "x86_64-linux-android", 2133 srcs: ["kernel/uapi/asm-x86/**/*.h"], 2134 license: "NOTICE", 2135} 2136 2137ndk_library { 2138 name: "libc", 2139 native_bridge_supported: true, 2140 symbol_file: "libc.map.txt", 2141 first_version: "9", 2142} 2143 2144llndk_library { 2145 name: "libc", 2146 symbol_file: "libc.map.txt", 2147 export_headers_as_system: true, 2148 export_preprocessed_headers: ["include"], 2149 native_bridge_supported: true, 2150 export_include_dirs: [ 2151 "kernel/android/scsi", 2152 "kernel/android/uapi", 2153 "kernel/uapi", 2154 ], 2155 arch: { 2156 arm: { 2157 export_include_dirs: [ 2158 "kernel/uapi/asm-arm", 2159 ], 2160 }, 2161 arm64: { 2162 export_include_dirs: [ 2163 "kernel/uapi/asm-arm64", 2164 ], 2165 }, 2166 x86: { 2167 export_include_dirs: [ 2168 "kernel/uapi/asm-x86", 2169 ], 2170 }, 2171 x86_64: { 2172 export_include_dirs: [ 2173 "kernel/uapi/asm-x86", 2174 ], 2175 }, 2176 }, 2177} 2178 2179ndk_library { 2180 name: "libstdc++", 2181 symbol_file: "libstdc++.map.txt", 2182 first_version: "9", 2183} 2184 2185// Export these headers for toolbox to process 2186filegroup { 2187 name: "kernel_input_headers", 2188 srcs: [ 2189 "kernel/uapi/linux/input.h", 2190 "kernel/uapi/linux/input-event-codes.h", 2191 ], 2192} 2193 2194// Generate a syscall name / number mapping. These objects are text files 2195// (thanks to the -dD -E flags) and not binary files. They will then be 2196// consumed by the genseccomp.py script and converted into C++ code. 2197cc_defaults { 2198 name: "libseccomp_gen_syscall_nrs_defaults", 2199 recovery_available: true, 2200 srcs: ["seccomp/gen_syscall_nrs.cpp"], 2201 cflags: [ 2202 "-dD", 2203 "-E", 2204 "-Wall", 2205 "-Werror", 2206 "-nostdinc", 2207 ], 2208} 2209 2210cc_object { 2211 name: "libseccomp_gen_syscall_nrs_arm", 2212 defaults: ["libseccomp_gen_syscall_nrs_defaults"], 2213 local_include_dirs: [ 2214 "kernel/uapi/asm-arm", 2215 "kernel/uapi", 2216 ], 2217} 2218 2219cc_object { 2220 name: "libseccomp_gen_syscall_nrs_arm64", 2221 defaults: ["libseccomp_gen_syscall_nrs_defaults"], 2222 local_include_dirs: [ 2223 "kernel/uapi/asm-arm64", 2224 "kernel/uapi", 2225 ], 2226} 2227 2228cc_object { 2229 name: "libseccomp_gen_syscall_nrs_x86", 2230 defaults: ["libseccomp_gen_syscall_nrs_defaults"], 2231 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"], 2232 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"], 2233 local_include_dirs: [ 2234 "kernel/uapi/asm-x86", 2235 "kernel/uapi", 2236 ], 2237} 2238 2239cc_object { 2240 name: "libseccomp_gen_syscall_nrs_x86_64", 2241 defaults: ["libseccomp_gen_syscall_nrs_defaults"], 2242 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"], 2243 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"], 2244 local_include_dirs: [ 2245 "kernel/uapi/asm-x86", 2246 "kernel/uapi", 2247 ], 2248} 2249 2250// Generate the C++ policy sources for app and system seccomp-bpf filters. 2251python_binary_host { 2252 name: "genseccomp", 2253 main: "tools/genseccomp.py", 2254 2255 srcs: [ 2256 "tools/genseccomp.py", 2257 "tools/gensyscalls.py", 2258 ], 2259 2260 data: [ 2261 "kernel/uapi/**/*.h", 2262 ], 2263 2264 version: { 2265 py2: { 2266 enabled: true, 2267 }, 2268 py3: { 2269 enabled: false, 2270 }, 2271 }, 2272} 2273 2274python_binary_host { 2275 name: "genfunctosyscallnrs", 2276 main: "tools/genfunctosyscallnrs.py", 2277 2278 srcs: [ 2279 "tools/genseccomp.py", 2280 "tools/genfunctosyscallnrs.py", 2281 "tools/gensyscalls.py", 2282 ], 2283 2284 data: [ 2285 "kernel/uapi/**/*.h", 2286 ], 2287 2288 version: { 2289 py2: { 2290 enabled: true, 2291 }, 2292 py3: { 2293 enabled: false, 2294 }, 2295 }, 2296} 2297 2298cc_genrule { 2299 name: "func_to_syscall_nrs", 2300 recovery_available: true, 2301 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)", 2302 2303 tools: [ "genfunctosyscallnrs" ], 2304 2305 srcs: [ 2306 "SYSCALLS.TXT", 2307 ":libseccomp_gen_syscall_nrs_arm", 2308 ":libseccomp_gen_syscall_nrs_arm64", 2309 ":libseccomp_gen_syscall_nrs_x86", 2310 ":libseccomp_gen_syscall_nrs_x86_64", 2311 ], 2312 2313 out: [ 2314 "func_to_syscall_nrs.h", 2315 ], 2316} 2317 2318// SECCOMP_BLACKLIST_APP_ZYGOTE.TXT = SECCOMP_BLACKLIST_APP.txt - setresgid* 2319genrule { 2320 name: "generate_app_zygote_blacklist", 2321 out: ["SECCOMP_BLACKLIST_APP_ZYGOTE.TXT"], 2322 srcs: ["SECCOMP_BLACKLIST_APP.TXT"], 2323 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)", 2324} 2325 2326cc_genrule { 2327 name: "libseccomp_policy_app_zygote_sources", 2328 recovery_available: true, 2329 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)", 2330 2331 tools: [ "genseccomp" ], 2332 2333 srcs: [ 2334 "SYSCALLS.TXT", 2335 "SECCOMP_WHITELIST_COMMON.TXT", 2336 "SECCOMP_WHITELIST_APP.TXT", 2337 "SECCOMP_BLACKLIST_COMMON.TXT", 2338 "SECCOMP_PRIORITY.TXT", 2339 ":generate_app_zygote_blacklist", 2340 ":libseccomp_gen_syscall_nrs_arm", 2341 ":libseccomp_gen_syscall_nrs_arm64", 2342 ":libseccomp_gen_syscall_nrs_x86", 2343 ":libseccomp_gen_syscall_nrs_x86_64", 2344 ], 2345 2346 out: [ 2347 "arm64_app_zygote_policy.cpp", 2348 "arm_app_zygote_policy.cpp", 2349 "x86_64_app_zygote_policy.cpp", 2350 "x86_app_zygote_policy.cpp", 2351 ], 2352} 2353 2354cc_genrule { 2355 name: "libseccomp_policy_app_sources", 2356 recovery_available: true, 2357 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)", 2358 2359 tools: [ "genseccomp" ], 2360 2361 srcs: [ 2362 "SYSCALLS.TXT", 2363 "SECCOMP_WHITELIST_COMMON.TXT", 2364 "SECCOMP_WHITELIST_APP.TXT", 2365 "SECCOMP_BLACKLIST_COMMON.TXT", 2366 "SECCOMP_BLACKLIST_APP.TXT", 2367 "SECCOMP_PRIORITY.TXT", 2368 ":libseccomp_gen_syscall_nrs_arm", 2369 ":libseccomp_gen_syscall_nrs_arm64", 2370 ":libseccomp_gen_syscall_nrs_x86", 2371 ":libseccomp_gen_syscall_nrs_x86_64", 2372 ], 2373 2374 out: [ 2375 "arm64_app_policy.cpp", 2376 "arm_app_policy.cpp", 2377 "x86_64_app_policy.cpp", 2378 "x86_app_policy.cpp", 2379 ], 2380} 2381 2382cc_genrule { 2383 name: "libseccomp_policy_system_sources", 2384 recovery_available: true, 2385 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)", 2386 2387 tools: [ "genseccomp" ], 2388 2389 srcs: [ 2390 "SYSCALLS.TXT", 2391 "SECCOMP_WHITELIST_COMMON.TXT", 2392 "SECCOMP_WHITELIST_SYSTEM.TXT", 2393 "SECCOMP_BLACKLIST_COMMON.TXT", 2394 "SECCOMP_PRIORITY.TXT", 2395 ":libseccomp_gen_syscall_nrs_arm", 2396 ":libseccomp_gen_syscall_nrs_arm64", 2397 ":libseccomp_gen_syscall_nrs_x86", 2398 ":libseccomp_gen_syscall_nrs_x86_64", 2399 ], 2400 2401 out: [ 2402 "arm64_system_policy.cpp", 2403 "arm_system_policy.cpp", 2404 "x86_64_system_policy.cpp", 2405 "x86_system_policy.cpp", 2406 ], 2407} 2408 2409cc_library { 2410 name: "libseccomp_policy", 2411 recovery_available: true, 2412 generated_headers: ["func_to_syscall_nrs"], 2413 generated_sources: [ 2414 "libseccomp_policy_app_sources", 2415 "libseccomp_policy_app_zygote_sources", 2416 "libseccomp_policy_system_sources", 2417 ], 2418 2419 srcs: [ 2420 "seccomp/seccomp_policy.cpp", 2421 ], 2422 2423 export_include_dirs: ["seccomp/include"], 2424 cflags: [ 2425 "-Wall", 2426 "-Werror", 2427 ], 2428 shared: { 2429 shared_libs: ["libbase"], 2430 }, 2431 static: { 2432 static_libs: ["libbase"], 2433 }, 2434} 2435 2436// This is a temporary library that will use scudo as the native memory 2437// allocator. To use it, add it as the first shared library. 2438cc_defaults { 2439 name: "libc_scudo_wrapper_defaults", 2440 srcs: [ 2441 "bionic/gwp_asan_wrappers.cpp", 2442 "bionic/heap_tagging.cpp", 2443 "bionic/malloc_common.cpp", 2444 "bionic/malloc_common_dynamic.cpp", 2445 "bionic/malloc_heapprofd.cpp", 2446 "bionic/malloc_limit.cpp", 2447 "bionic/scudo_wrapper.cpp", 2448 "bionic/__set_errno.cpp", 2449 ], 2450 cflags: [ 2451 "-DUSE_SCUDO", 2452 "-fno-emulated-tls", // Required for GWP-ASan. 2453 ], 2454 shared_libs: ["libscudo_wrapper"], 2455 2456 header_libs: [ 2457 "libc_headers", 2458 "gwp_asan_headers", 2459 ], 2460 2461 static_libs: [ 2462 "libasync_safe", 2463 "gwp_asan", 2464 ], 2465 2466 arch: { 2467 arm: { 2468 srcs: [":syscalls-arm.S"], 2469 }, 2470 arm64: { 2471 srcs: [":syscalls-arm64.S"], 2472 }, 2473 x86: { 2474 srcs: [ 2475 "arch-x86/bionic/__libc_init_sysinfo.cpp", 2476 ":syscalls-x86.S", 2477 ], 2478 }, 2479 x86_64: { 2480 srcs: [":syscalls-x86_64.S"], 2481 }, 2482 }, 2483 2484 // Mark this library as global so it overrides all the allocation 2485 // definitions properly. 2486 ldflags: ["-Wl,-z,global"], 2487} 2488 2489cc_library_shared { 2490 name: "libc_scudo", 2491 vendor_available: true, 2492 stl: "none", 2493 system_shared_libs: [], 2494 2495 allow_undefined_symbols: true, 2496 // Like libc, disable native coverage for libc_scudo. 2497 native_coverage: false, 2498 apex_available: [ 2499 "//apex_available:platform", 2500 "com.android.media.swcodec", 2501 ], 2502 min_sdk_version: "apex_inherit", 2503} 2504 2505subdirs = [ 2506 "bionic/scudo", 2507] 2508