1package { 2 default_applicable_licenses: ["bionic_libc_license"], 3} 4 5license { 6 name: "bionic_libc_license", 7 visibility: [":__subpackages__"], 8 license_kinds: [ 9 "SPDX-license-identifier-Apache-2.0", 10 "SPDX-license-identifier-BSD", 11 "SPDX-license-identifier-ISC", 12 "SPDX-license-identifier-MIT", 13 "legacy_notice", 14 "legacy_unencumbered", 15 ], 16 license_text: [ 17 "NOTICE", 18 ], 19} 20 21libc_common_flags = [ 22 "-D_LIBC=1", 23 "-D__BIONIC_LP32_USE_STAT64", 24 "-Wall", 25 "-Wextra", 26 "-Wunused", 27 "-Wno-char-subscripts", 28 "-Wno-deprecated-declarations", 29 "-Wno-gcc-compat", 30 "-Wframe-larger-than=2048", 31 "-Wno-reorder-init-list", 32 33 // Try to catch typical 32-bit assumptions that break with 64-bit pointers. 34 "-Werror=pointer-to-int-cast", 35 "-Werror=int-to-pointer-cast", 36 "-Werror=type-limits", 37 "-Werror", 38 39 // Clang's exit-time destructor registration hides __dso_handle, but 40 // __dso_handle needs to have default visibility on ARM32. See b/73485611. 41 "-Wexit-time-destructors", 42 43 // We know clang does a lot of harm by rewriting what we've said, and sadly 44 // never see any good it does, so let's just ask it to do what we say... 45 // (The specific motivating example was clang turning a loop that would only 46 // ever touch 0, 1, or 2 bytes into a call to memset, which was never going 47 // to amortize.) 48 "-fno-builtin", 49] 50 51// Define some common cflags 52// ======================================================== 53cc_defaults { 54 name: "libc_defaults", 55 defaults: ["linux_bionic_supported"], 56 cflags: libc_common_flags + [ 57 "-DUSE_SCUDO", 58 ], 59 asflags: libc_common_flags, 60 conlyflags: ["-std=gnu99"], 61 cppflags: [], 62 include_dirs: [ 63 "bionic/libc/async_safe/include", 64 "bionic/libc/platform", 65 // For android_filesystem_config.h. 66 "system/core/libcutils/include", 67 ], 68 69 header_libs: [ 70 "libc_headers", 71 "liblog_headers", // needed by bionic/libc/async_safe/include 72 ], 73 export_header_lib_headers: [ 74 "libc_headers", 75 ], 76 77 stl: "none", 78 system_shared_libs: [], 79 sanitize: { 80 address: false, 81 integer_overflow: false, 82 // TODO(b/132640749): Fix broken fuzzer support. 83 fuzzer: false, 84 }, 85 ramdisk_available: true, 86 vendor_ramdisk_available: true, 87 recovery_available: true, 88 native_bridge_supported: true, 89 90 product_variables: { 91 malloc_zero_contents: { 92 cflags: ["-DSCUDO_ZERO_CONTENTS"], 93 }, 94 malloc_pattern_fill_contents: { 95 cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"], 96 }, 97 malloc_low_memory: { 98 cflags: ["-UUSE_SCUDO"], 99 }, 100 }, 101 102 lto: { 103 never: true, 104 }, 105 106 apex_available: ["com.android.runtime"], 107 108 tidy_disabled_srcs: ["upstream-*/**/*.c"], 109} 110 111// Workaround for b/24465209. 112// We're unlikely to be able to remove this before we just 113// remove ILP32 support completely. 114// Note that we also still have `pack_relocations: false` 115// for both libc and libm, even on LP64. 116// ======================================================== 117cc_defaults { 118 name: "bug_24465209_workaround", 119 target: { 120 android_arm: { 121 pack_relocations: false, 122 ldflags: ["-Wl,--hash-style=both"], 123 }, 124 android_x86: { 125 pack_relocations: false, 126 ldflags: ["-Wl,--hash-style=both"], 127 }, 128 }, 129} 130 131// Leave the symbols in the shared library so that stack unwinders can produce 132// meaningful name resolution. This is a bit more ugly than it sounds because 133// arm32 is a bit broken. 134// ======================================================== 135cc_defaults { 136 name: "keep_symbols", 137 arch: { 138 arm: { 139 // arm32 does not produce complete exidx unwind information, 140 // so keep the .debug_frame which is relatively small and does 141 // include needed unwind information. 142 // See b/132992102 for details. 143 strip: { 144 keep_symbols_and_debug_frame: true, 145 }, 146 }, 147 arm64: { 148 strip: { 149 keep_symbols: true, 150 }, 151 }, 152 riscv64: { 153 strip: { 154 keep_symbols: true, 155 }, 156 }, 157 x86: { 158 strip: { 159 keep_symbols: true, 160 }, 161 }, 162 x86_64: { 163 strip: { 164 keep_symbols: true, 165 }, 166 }, 167 }, 168} 169 170// Defaults for native allocator libs/includes to make it 171// easier to change. 172// ======================================================== 173cc_defaults { 174 name: "libc_native_allocator_defaults", 175 176 whole_static_libs: [ 177 "libscudo", 178 ], 179 cflags: [ 180 "-DUSE_SCUDO", 181 ], 182 header_libs: ["gwp_asan_headers"], 183 product_variables: { 184 malloc_low_memory: { 185 cflags: ["-UUSE_SCUDO"], 186 whole_static_libs: [ 187 "libjemalloc5", 188 "libc_jemalloc_wrapper", 189 ], 190 exclude_static_libs: [ 191 "libscudo", 192 ], 193 }, 194 }, 195} 196 197// Functions not implemented by jemalloc directly, or that need to 198// be modified for Android. 199cc_library_static { 200 name: "libc_jemalloc_wrapper", 201 defaults: ["libc_defaults"], 202 srcs: ["bionic/jemalloc_wrapper.cpp"], 203 cflags: ["-fvisibility=hidden"], 204 205 // Used to pull in the jemalloc include directory so that if the 206 // library is removed, the include directory is also removed. 207 static_libs: ["libjemalloc5"], 208} 209 210// ======================================================== 211// libc_bootstrap.a - -fno-stack-protector and -ffreestanding 212// ======================================================== 213// 214// Code that implements the stack protector (or that runs before TLS has been set up) needs to be 215// compiled with -fno-stack-protector, since it accesses the stack canary TLS slot. In the linker, 216// some of this code runs before ifunc resolvers have made string.h functions work, so compile with 217// -ffreestanding. 218 219cc_library_static { 220 221 srcs: [ 222 "bionic/__libc_init_main_thread.cpp", 223 "bionic/__stack_chk_fail.cpp", 224 "bionic/bionic_call_ifunc_resolver.cpp", 225 "bionic/getauxval.cpp", 226 ], 227 arch: { 228 arm64: { 229 srcs: ["arch-arm64/bionic/__set_tls.c"], 230 }, 231 riscv64: { 232 srcs: ["arch-riscv64/bionic/__set_tls.c"], 233 }, 234 x86: { 235 srcs: [ 236 "arch-x86/bionic/__libc_init_sysinfo.cpp", 237 "arch-x86/bionic/__libc_int0x80.S", 238 "arch-x86/bionic/__set_tls.cpp", 239 ], 240 }, 241 x86_64: { 242 srcs: ["arch-x86_64/bionic/__set_tls.c"], 243 }, 244 }, 245 246 defaults: ["libc_defaults"], 247 cflags: [ 248 "-fno-stack-protector", 249 "-ffreestanding", 250 ], 251 name: "libc_bootstrap", 252} 253 254filegroup { 255 name: "elf_note_sources", 256 srcs: ["bionic/elf_note.cpp"], 257} 258 259// libc_init_static.cpp and libc_init_dynamic.cpp need to be built without stack protector. 260// libc_init_static.cpp sets up TLS for static executables, and libc_init_dynamic.cpp initializes 261// the stack protector global variable. 262 263cc_library_static { 264 name: "libc_init_static", 265 defaults: ["libc_defaults"], 266 srcs: [ 267 "bionic/libc_init_mte.cpp", 268 "bionic/libc_init_static.cpp", 269 ":elf_note_sources", 270 ], 271 cflags: [ 272 "-fno-stack-protector", 273 274 // Compile libc_init_static.cpp with -ffreestanding, because some of its code is called 275 // from the linker before ifunc resolvers have made string.h functions available. 276 "-ffreestanding", 277 ], 278} 279 280cc_library_static { 281 name: "libc_init_dynamic", 282 defaults: ["libc_defaults"], 283 srcs: ["bionic/libc_init_dynamic.cpp"], 284 cflags: ["-fno-stack-protector"], 285} 286 287// ======================================================== 288// libc_tzcode.a - upstream 'tzcode' code 289// ======================================================== 290 291cc_library_static { 292 293 defaults: ["libc_defaults"], 294 srcs: [ 295 "tzcode/**/*.c", 296 "tzcode/bionic.cpp", 297 // tzcode doesn't include strptime, so we use a fork of the 298 // OpenBSD code which needs this global data. 299 "upstream-openbsd/lib/libc/locale/_def_time.c", 300 // tzcode doesn't include wcsftime, so we use the FreeBSD code. 301 "upstream-freebsd/lib/libc/locale/wcsftime.c", 302 ], 303 304 cflags: [ 305 "-Wno-unused-parameter", 306 // Don't use ridiculous amounts of stack. 307 "-DALL_STATE", 308 // Include tzsetwall, timelocal, timegm, time2posix, and posix2time. 309 "-DSTD_INSPIRED", 310 // Obviously, we want to be thread-safe. 311 "-DTHREAD_SAFE=1", 312 // The name of the tm_gmtoff field in our struct tm. 313 "-DTM_GMTOFF=tm_gmtoff", 314 // Android uses a system property instead of /etc/localtime, so make callers crash. 315 "-DTZDEFAULT=NULL", 316 // Where we store our tzdata. 317 "-DTZDIR=\"/system/usr/share/zoneinfo\"", 318 // Include `tzname`, `timezone`, and `daylight` globals. 319 "-DHAVE_POSIX_DECLS=0", 320 "-DUSG_COMPAT=2", 321 "-DHAVE_TZNAME=2", 322 // stdbool.h is available 323 "-DHAVE_STDBOOL_H", 324 // Use the empty string (instead of " ") as the timezone abbreviation 325 // fallback. 326 "-DWILDABBR=\"\"", 327 "-Dlint", 328 ], 329 330 local_include_dirs: [ 331 "tzcode/", 332 "upstream-freebsd/android/include", 333 ], 334 name: "libc_tzcode", 335} 336 337// ======================================================== 338// libc_dns.a - modified NetBSD DNS code 339// ======================================================== 340 341cc_library_static { 342 343 defaults: ["libc_defaults"], 344 srcs: [ 345 "dns/**/*.c*", 346 347 "upstream-netbsd/lib/libc/isc/ev_streams.c", 348 "upstream-netbsd/lib/libc/isc/ev_timers.c", 349 ], 350 351 cflags: [ 352 "-DANDROID_CHANGES", 353 "-DINET6", 354 "-Wno-unused-parameter", 355 "-include netbsd-compat.h", 356 "-Wframe-larger-than=66000", 357 ], 358 359 local_include_dirs: [ 360 "dns/include", 361 "private", 362 "upstream-netbsd/lib/libc/include", 363 "upstream-netbsd/android/include", 364 ], 365 366 name: "libc_dns", 367} 368 369// ======================================================== 370// libc_freebsd.a - upstream FreeBSD C library code 371// ======================================================== 372// 373// These files are built with the freebsd-compat.h header file 374// automatically included. 375 376cc_library_static { 377 name: "libc_freebsd_ldexp", 378 defaults: ["libc_defaults"], 379 cflags: ["-Dscalbn=ldexp"], 380 srcs: [":libc_ldexp_srcs"], 381} 382 383cc_library_static { 384 defaults: ["libc_defaults"], 385 srcs: [ 386 "upstream-freebsd/lib/libc/stdlib/getopt_long.c", 387 "upstream-freebsd/lib/libc/stdlib/hcreate.c", 388 "upstream-freebsd/lib/libc/stdlib/hcreate_r.c", 389 "upstream-freebsd/lib/libc/stdlib/hdestroy_r.c", 390 "upstream-freebsd/lib/libc/stdlib/hsearch_r.c", 391 "upstream-freebsd/lib/libc/stdlib/qsort.c", 392 "upstream-freebsd/lib/libc/stdlib/qsort_r.c", 393 "upstream-freebsd/lib/libc/stdlib/quick_exit.c", 394 "upstream-freebsd/lib/libc/string/wcpcpy.c", 395 "upstream-freebsd/lib/libc/string/wcpncpy.c", 396 "upstream-freebsd/lib/libc/string/wcscasecmp.c", 397 "upstream-freebsd/lib/libc/string/wcscat.c", 398 "upstream-freebsd/lib/libc/string/wcschr.c", 399 "upstream-freebsd/lib/libc/string/wcscmp.c", 400 "upstream-freebsd/lib/libc/string/wcscpy.c", 401 "upstream-freebsd/lib/libc/string/wcscspn.c", 402 "upstream-freebsd/lib/libc/string/wcsdup.c", 403 "upstream-freebsd/lib/libc/string/wcslcat.c", 404 "upstream-freebsd/lib/libc/string/wcslen.c", 405 "upstream-freebsd/lib/libc/string/wcsncasecmp.c", 406 "upstream-freebsd/lib/libc/string/wcsncat.c", 407 "upstream-freebsd/lib/libc/string/wcsncmp.c", 408 "upstream-freebsd/lib/libc/string/wcsncpy.c", 409 "upstream-freebsd/lib/libc/string/wcsnlen.c", 410 "upstream-freebsd/lib/libc/string/wcspbrk.c", 411 "upstream-freebsd/lib/libc/string/wcsrchr.c", 412 "upstream-freebsd/lib/libc/string/wcsspn.c", 413 "upstream-freebsd/lib/libc/string/wcsstr.c", 414 "upstream-freebsd/lib/libc/string/wcstok.c", 415 "upstream-freebsd/lib/libc/string/wmemchr.c", 416 "upstream-freebsd/lib/libc/string/wmemcmp.c", 417 "upstream-freebsd/lib/libc/string/wmemcpy.c", 418 "upstream-freebsd/lib/libc/string/wmemmove.c", 419 "upstream-freebsd/lib/libc/string/wmemset.c", 420 ], 421 422 cflags: [ 423 "-Wno-sign-compare", 424 "-Wno-unused-parameter", 425 "-include freebsd-compat.h", 426 ], 427 428 local_include_dirs: [ 429 "upstream-freebsd/android/include", 430 ], 431 432 name: "libc_freebsd", 433} 434 435cc_library_static { 436 defaults: ["libc_defaults"], 437 srcs: [ 438 "upstream-freebsd/lib/libc/gen/glob.c", 439 ], 440 441 cflags: [ 442 "-Wno-sign-compare", 443 "-include freebsd-compat.h", 444 "-Wframe-larger-than=66000", 445 ], 446 447 local_include_dirs: [ 448 "upstream-freebsd/android/include", 449 ], 450 451 name: "libc_freebsd_large_stack", 452} 453 454// ======================================================== 455// libc_netbsd.a - upstream NetBSD C library code 456// ======================================================== 457// 458// These files are built with the netbsd-compat.h header file 459// automatically included. 460 461cc_library_static { 462 463 defaults: ["libc_defaults"], 464 srcs: [ 465 "upstream-netbsd/common/lib/libc/stdlib/random.c", 466 "upstream-netbsd/lib/libc/gen/nice.c", 467 "upstream-netbsd/lib/libc/gen/psignal.c", 468 "upstream-netbsd/lib/libc/gen/utime.c", 469 "upstream-netbsd/lib/libc/inet/nsap_addr.c", 470 "upstream-netbsd/lib/libc/regex/regcomp.c", 471 "upstream-netbsd/lib/libc/regex/regerror.c", 472 "upstream-netbsd/lib/libc/regex/regexec.c", 473 "upstream-netbsd/lib/libc/regex/regfree.c", 474 "upstream-netbsd/lib/libc/stdlib/drand48.c", 475 "upstream-netbsd/lib/libc/stdlib/erand48.c", 476 "upstream-netbsd/lib/libc/stdlib/jrand48.c", 477 "upstream-netbsd/lib/libc/stdlib/lcong48.c", 478 "upstream-netbsd/lib/libc/stdlib/lrand48.c", 479 "upstream-netbsd/lib/libc/stdlib/mrand48.c", 480 "upstream-netbsd/lib/libc/stdlib/nrand48.c", 481 "upstream-netbsd/lib/libc/stdlib/_rand48.c", 482 "upstream-netbsd/lib/libc/stdlib/rand_r.c", 483 "upstream-netbsd/lib/libc/stdlib/reallocarr.c", 484 "upstream-netbsd/lib/libc/stdlib/seed48.c", 485 "upstream-netbsd/lib/libc/stdlib/srand48.c", 486 ], 487 multilib: { 488 lib32: { 489 // LP32 cruft 490 srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"], 491 }, 492 }, 493 cflags: [ 494 "-Wno-sign-compare", 495 "-Wno-unused-parameter", 496 "-DPOSIX_MISTAKE", 497 "-include netbsd-compat.h", 498 ], 499 500 local_include_dirs: [ 501 "upstream-netbsd/android/include", 502 "upstream-netbsd/lib/libc/include", 503 ], 504 505 name: "libc_netbsd", 506} 507 508// ======================================================== 509// libc_openbsd.a - upstream OpenBSD C library code 510// ======================================================== 511// 512// These files are built with the openbsd-compat.h header file 513// automatically included. 514cc_library_static { 515 defaults: ["libc_defaults"], 516 srcs: [ 517 "upstream-openbsd/lib/libc/crypt/arc4random.c", 518 "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c", 519 "upstream-openbsd/lib/libc/gen/alarm.c", 520 "upstream-openbsd/lib/libc/gen/ctype_.c", 521 "upstream-openbsd/lib/libc/gen/daemon.c", 522 "upstream-openbsd/lib/libc/gen/err.c", 523 "upstream-openbsd/lib/libc/gen/errx.c", 524 "upstream-openbsd/lib/libc/gen/fnmatch.c", 525 "upstream-openbsd/lib/libc/gen/ftok.c", 526 "upstream-openbsd/lib/libc/gen/getprogname.c", 527 "upstream-openbsd/lib/libc/gen/setprogname.c", 528 "upstream-openbsd/lib/libc/gen/verr.c", 529 "upstream-openbsd/lib/libc/gen/verrx.c", 530 "upstream-openbsd/lib/libc/gen/vwarn.c", 531 "upstream-openbsd/lib/libc/gen/vwarnx.c", 532 "upstream-openbsd/lib/libc/gen/warn.c", 533 "upstream-openbsd/lib/libc/gen/warnx.c", 534 "upstream-openbsd/lib/libc/locale/btowc.c", 535 "upstream-openbsd/lib/libc/locale/mbrlen.c", 536 "upstream-openbsd/lib/libc/locale/mbstowcs.c", 537 "upstream-openbsd/lib/libc/locale/mbtowc.c", 538 "upstream-openbsd/lib/libc/locale/wcscoll.c", 539 "upstream-openbsd/lib/libc/locale/wcstombs.c", 540 "upstream-openbsd/lib/libc/locale/wcsxfrm.c", 541 "upstream-openbsd/lib/libc/locale/wctob.c", 542 "upstream-openbsd/lib/libc/locale/wctomb.c", 543 "upstream-openbsd/lib/libc/net/base64.c", 544 "upstream-openbsd/lib/libc/net/htonl.c", 545 "upstream-openbsd/lib/libc/net/htons.c", 546 "upstream-openbsd/lib/libc/net/inet_lnaof.c", 547 "upstream-openbsd/lib/libc/net/inet_makeaddr.c", 548 "upstream-openbsd/lib/libc/net/inet_netof.c", 549 "upstream-openbsd/lib/libc/net/inet_ntoa.c", 550 "upstream-openbsd/lib/libc/net/inet_ntop.c", 551 "upstream-openbsd/lib/libc/net/inet_pton.c", 552 "upstream-openbsd/lib/libc/net/ntohl.c", 553 "upstream-openbsd/lib/libc/net/ntohs.c", 554 "upstream-openbsd/lib/libc/net/res_random.c", 555 "upstream-openbsd/lib/libc/stdio/fgetln.c", 556 "upstream-openbsd/lib/libc/stdio/fgetwc.c", 557 "upstream-openbsd/lib/libc/stdio/fgetws.c", 558 "upstream-openbsd/lib/libc/stdio/flags.c", 559 "upstream-openbsd/lib/libc/stdio/fputwc.c", 560 "upstream-openbsd/lib/libc/stdio/fputws.c", 561 "upstream-openbsd/lib/libc/stdio/fvwrite.c", 562 "upstream-openbsd/lib/libc/stdio/fwide.c", 563 "upstream-openbsd/lib/libc/stdio/getdelim.c", 564 "upstream-openbsd/lib/libc/stdio/gets.c", 565 "upstream-openbsd/lib/libc/stdio/makebuf.c", 566 "upstream-openbsd/lib/libc/stdio/mktemp.c", 567 "upstream-openbsd/lib/libc/stdio/open_memstream.c", 568 "upstream-openbsd/lib/libc/stdio/open_wmemstream.c", 569 "upstream-openbsd/lib/libc/stdio/rget.c", 570 "upstream-openbsd/lib/libc/stdio/setvbuf.c", 571 "upstream-openbsd/lib/libc/stdio/ungetc.c", 572 "upstream-openbsd/lib/libc/stdio/ungetwc.c", 573 "upstream-openbsd/lib/libc/stdio/vasprintf.c", 574 "upstream-openbsd/lib/libc/stdio/vdprintf.c", 575 "upstream-openbsd/lib/libc/stdio/vsscanf.c", 576 "upstream-openbsd/lib/libc/stdio/vswprintf.c", 577 "upstream-openbsd/lib/libc/stdio/vswscanf.c", 578 "upstream-openbsd/lib/libc/stdio/wbuf.c", 579 "upstream-openbsd/lib/libc/stdio/wsetup.c", 580 "upstream-openbsd/lib/libc/stdlib/abs.c", 581 "upstream-openbsd/lib/libc/stdlib/div.c", 582 "upstream-openbsd/lib/libc/stdlib/getenv.c", 583 "upstream-openbsd/lib/libc/stdlib/getsubopt.c", 584 "upstream-openbsd/lib/libc/stdlib/insque.c", 585 "upstream-openbsd/lib/libc/stdlib/imaxabs.c", 586 "upstream-openbsd/lib/libc/stdlib/imaxdiv.c", 587 "upstream-openbsd/lib/libc/stdlib/labs.c", 588 "upstream-openbsd/lib/libc/stdlib/ldiv.c", 589 "upstream-openbsd/lib/libc/stdlib/llabs.c", 590 "upstream-openbsd/lib/libc/stdlib/lldiv.c", 591 "upstream-openbsd/lib/libc/stdlib/lsearch.c", 592 "upstream-openbsd/lib/libc/stdlib/recallocarray.c", 593 "upstream-openbsd/lib/libc/stdlib/remque.c", 594 "upstream-openbsd/lib/libc/stdlib/setenv.c", 595 "upstream-openbsd/lib/libc/stdlib/tfind.c", 596 "upstream-openbsd/lib/libc/stdlib/tsearch.c", 597 "upstream-openbsd/lib/libc/string/memccpy.c", 598 "upstream-openbsd/lib/libc/string/strcasecmp.c", 599 "upstream-openbsd/lib/libc/string/strcasestr.c", 600 "upstream-openbsd/lib/libc/string/strcoll.c", 601 "upstream-openbsd/lib/libc/string/strcspn.c", 602 "upstream-openbsd/lib/libc/string/strdup.c", 603 "upstream-openbsd/lib/libc/string/strndup.c", 604 "upstream-openbsd/lib/libc/string/strpbrk.c", 605 "upstream-openbsd/lib/libc/string/strsep.c", 606 "upstream-openbsd/lib/libc/string/strspn.c", 607 "upstream-openbsd/lib/libc/string/strtok.c", 608 "upstream-openbsd/lib/libc/string/strxfrm.c", 609 "upstream-openbsd/lib/libc/string/wcslcpy.c", 610 "upstream-openbsd/lib/libc/string/wcswidth.c", 611 612 // These files are originally from OpenBSD, 613 // and benefit from being compiled with openbsd-compat.h. 614 // TODO: clean them up instead. 615 "bionic/fts.c", 616 "stdio/vfprintf.cpp", 617 "stdio/vfwprintf.cpp", 618 ], 619 620 // Each architecture has optimized versions of some routines, 621 // and only includes the portable C versions of ones it's missing. 622 arch: { 623 arm: { 624 srcs: [ 625 "upstream-openbsd/lib/libc/string/memchr.c", 626 "upstream-openbsd/lib/libc/string/stpncpy.c", 627 "upstream-openbsd/lib/libc/string/strncat.c", 628 "upstream-openbsd/lib/libc/string/strncmp.c", 629 "upstream-openbsd/lib/libc/string/strncpy.c", 630 ], 631 }, 632 arm64: { 633 srcs: [ 634 "upstream-openbsd/lib/libc/string/strcat.c", 635 "upstream-openbsd/lib/libc/string/stpncpy.c", 636 "upstream-openbsd/lib/libc/string/strncat.c", 637 "upstream-openbsd/lib/libc/string/strncpy.c", 638 ], 639 }, 640 riscv64: { 641 srcs: [ 642 "upstream-openbsd/lib/libc/string/stpncpy.c", 643 ], 644 }, 645 x86: { 646 srcs: [ 647 // x86 has custom implementations of all of these. 648 ], 649 }, 650 x86_64: { 651 srcs: [ 652 // x86_64 has custom/llvm-libc implementations of all of these. 653 ], 654 }, 655 }, 656 657 cflags: [ 658 "-Wno-sign-compare", 659 "-Wno-unused-parameter", 660 "-include openbsd-compat.h", 661 ], 662 663 local_include_dirs: [ 664 "private", 665 "stdio", 666 "upstream-openbsd/android/include/", 667 "upstream-openbsd/lib/libc/gdtoa/", 668 "upstream-openbsd/lib/libc/include/", 669 "upstream-openbsd/lib/libc/stdio/", 670 ], 671 672 name: "libc_openbsd", 673} 674 675cc_library_static { 676 name: "libc_openbsd_large_stack", 677 defaults: ["libc_defaults"], 678 srcs: [ 679 "upstream-openbsd/lib/libc/string/memmem.c", 680 "upstream-openbsd/lib/libc/string/strstr.c", 681 ], 682 cflags: [ 683 "-include openbsd-compat.h", 684 "-Wno-sign-compare", 685 "-Wframe-larger-than=5000", 686 ], 687 688 local_include_dirs: [ 689 "upstream-openbsd/android/include/", 690 ], 691} 692 693// ======================================================== 694// libc_gdtoa.a - upstream OpenBSD C library gdtoa code 695// ======================================================== 696// 697// These files are built with the openbsd-compat.h header file 698// automatically included. 699 700cc_library_static { 701 defaults: ["libc_defaults"], 702 srcs: [ 703 "upstream-openbsd/android/gdtoa_support.cpp", 704 "upstream-openbsd/lib/libc/gdtoa/dmisc.c", 705 "upstream-openbsd/lib/libc/gdtoa/dtoa.c", 706 "upstream-openbsd/lib/libc/gdtoa/gdtoa.c", 707 "upstream-openbsd/lib/libc/gdtoa/gethex.c", 708 "upstream-openbsd/lib/libc/gdtoa/gmisc.c", 709 "upstream-openbsd/lib/libc/gdtoa/hd_init.c", 710 "upstream-openbsd/lib/libc/gdtoa/hdtoa.c", 711 "upstream-openbsd/lib/libc/gdtoa/hexnan.c", 712 "upstream-openbsd/lib/libc/gdtoa/ldtoa.c", 713 "upstream-openbsd/lib/libc/gdtoa/misc.c", 714 "upstream-openbsd/lib/libc/gdtoa/smisc.c", 715 "upstream-openbsd/lib/libc/gdtoa/strtod.c", 716 "upstream-openbsd/lib/libc/gdtoa/strtodg.c", 717 "upstream-openbsd/lib/libc/gdtoa/strtof.c", 718 "upstream-openbsd/lib/libc/gdtoa/strtord.c", 719 "upstream-openbsd/lib/libc/gdtoa/sum.c", 720 "upstream-openbsd/lib/libc/gdtoa/ulp.c", 721 ], 722 multilib: { 723 lib64: { 724 srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"], 725 }, 726 }, 727 728 cflags: [ 729 "-Wno-sign-compare", 730 "-include openbsd-compat.h", 731 ], 732 733 local_include_dirs: [ 734 "private", 735 "upstream-openbsd/android/include", 736 "upstream-openbsd/lib/libc/include", 737 ], 738 739 name: "libc_gdtoa", 740} 741 742// ======================================================== 743// libc_fortify.a - container for our FORTIFY 744// implementation details 745// ======================================================== 746cc_library_static { 747 defaults: ["libc_defaults"], 748 srcs: ["bionic/fortify.cpp"], 749 750 name: "libc_fortify", 751 752 // Disable FORTIFY for the compilation of these, so we don't end up having 753 // FORTIFY silently call itself. 754 cflags: [ 755 "-U_FORTIFY_SOURCE", 756 "-D__BIONIC_DECLARE_FORTIFY_HELPERS", 757 ], 758 759 arch: { 760 arm: { 761 cflags: [ 762 "-DRENAME___STRCAT_CHK", 763 "-DRENAME___STRCPY_CHK", 764 ], 765 srcs: [ 766 "arch-arm/generic/bionic/__memcpy_chk.S", 767 768 "arch-arm/cortex-a15/bionic/__strcat_chk.S", 769 "arch-arm/cortex-a15/bionic/__strcpy_chk.S", 770 771 "arch-arm/cortex-a7/bionic/__strcat_chk.S", 772 "arch-arm/cortex-a7/bionic/__strcpy_chk.S", 773 774 "arch-arm/cortex-a9/bionic/__strcat_chk.S", 775 "arch-arm/cortex-a9/bionic/__strcpy_chk.S", 776 777 "arch-arm/krait/bionic/__strcat_chk.S", 778 "arch-arm/krait/bionic/__strcpy_chk.S", 779 780 "arch-arm/cortex-a53/bionic/__strcat_chk.S", 781 "arch-arm/cortex-a53/bionic/__strcpy_chk.S", 782 783 "arch-arm/cortex-a55/bionic/__strcat_chk.S", 784 "arch-arm/cortex-a55/bionic/__strcpy_chk.S", 785 ], 786 }, 787 arm64: { 788 srcs: [ 789 "arch-arm64/string/__memcpy_chk.S", 790 "arch-arm64/string/__memset_chk.S", 791 ], 792 }, 793 riscv64: { 794 srcs: [ 795 "arch-riscv64/string/__memset_chk.S", 796 "arch-riscv64/string/__memcpy_chk.S", 797 ], 798 }, 799 }, 800} 801 802// ======================================================== 803// libc_bionic.a - home-grown C library code 804// ======================================================== 805 806cc_library_static { 807 defaults: ["libc_defaults"], 808 srcs: [ 809 "bionic/NetdClientDispatch.cpp", 810 "bionic/__bionic_get_shell_path.cpp", 811 "bionic/__cmsg_nxthdr.cpp", 812 "bionic/__cxa_thread_atexit_impl.cpp", 813 "bionic/__errno.cpp", 814 "bionic/__gnu_basename.cpp", 815 "bionic/__libc_current_sigrtmax.cpp", 816 "bionic/__libc_current_sigrtmin.cpp", 817 "bionic/abort.cpp", 818 "bionic/accept.cpp", 819 "bionic/access.cpp", 820 "bionic/android_crash_detail.cpp", 821 "bionic/android_set_abort_message.cpp", 822 "bionic/android_unsafe_frame_pointer_chase.cpp", 823 "bionic/arpa_inet.cpp", 824 "bionic/assert.cpp", 825 "bionic/atexit.cpp", 826 "bionic/atof.cpp", 827 "bionic/bionic_allocator.cpp", 828 "bionic/bionic_arc4random.cpp", 829 "bionic/bionic_elf_tls.cpp", 830 "bionic/bionic_futex.cpp", 831 "bionic/bionic_netlink.cpp", 832 "bionic/bionic_systrace.cpp", 833 "bionic/bionic_time_conversions.cpp", 834 "bionic/brk.cpp", 835 "bionic/c16rtomb.cpp", 836 "bionic/c32rtomb.cpp", 837 "bionic/chmod.cpp", 838 "bionic/chown.cpp", 839 "bionic/clearenv.cpp", 840 "bionic/clock.cpp", 841 "bionic/clock_getcpuclockid.cpp", 842 "bionic/clock_nanosleep.cpp", 843 "bionic/clone.cpp", 844 "bionic/ctype.cpp", 845 "bionic/dirent.cpp", 846 "bionic/dup.cpp", 847 "bionic/environ.cpp", 848 "bionic/error.cpp", 849 "bionic/eventfd.cpp", 850 "bionic/exec.cpp", 851 "bionic/execinfo.cpp", 852 "bionic/exit.cpp", 853 "bionic/faccessat.cpp", 854 "bionic/fchmod.cpp", 855 "bionic/fchmodat.cpp", 856 "bionic/fcntl.cpp", 857 "bionic/fdsan.cpp", 858 "bionic/fdtrack.cpp", 859 "bionic/ffs.cpp", 860 "bionic/fgetxattr.cpp", 861 "bionic/flistxattr.cpp", 862 "bionic/fork.cpp", 863 "bionic/fpclassify.cpp", 864 "bionic/fsetxattr.cpp", 865 "bionic/ftruncate.cpp", 866 "bionic/ftw.cpp", 867 "bionic/futimens.cpp", 868 "bionic/getcwd.cpp", 869 "bionic/getdomainname.cpp", 870 "bionic/getentropy.cpp", 871 "bionic/gethostname.cpp", 872 "bionic/getloadavg.cpp", 873 "bionic/getpagesize.cpp", 874 "bionic/getpgrp.cpp", 875 "bionic/getpid.cpp", 876 "bionic/getpriority.cpp", 877 "bionic/gettid.cpp", 878 "bionic/get_device_api_level.cpp", 879 "bionic/grp_pwd.cpp", 880 "bionic/grp_pwd_file.cpp", 881 "bionic/heap_zero_init.cpp", 882 "bionic/iconv.cpp", 883 "bionic/icu_wrappers.cpp", 884 "bionic/ifaddrs.cpp", 885 "bionic/inotify_init.cpp", 886 "bionic/ioctl.cpp", 887 "bionic/isatty.cpp", 888 "bionic/killpg.cpp", 889 "bionic/langinfo.cpp", 890 "bionic/lchmod.cpp", 891 "bionic/lchown.cpp", 892 "bionic/lfs64_support.cpp", 893 "bionic/libc_init_common.cpp", 894 "bionic/libgen.cpp", 895 "bionic/link.cpp", 896 "bionic/locale.cpp", 897 "bionic/lockf.cpp", 898 "bionic/lstat.cpp", 899 "bionic/mblen.cpp", 900 "bionic/mbrtoc16.cpp", 901 "bionic/mbrtoc32.cpp", 902 "bionic/mempcpy.cpp", 903 "bionic/memset_explicit.cpp", 904 "bionic/mkdir.cpp", 905 "bionic/mkfifo.cpp", 906 "bionic/mknod.cpp", 907 "bionic/mntent.cpp", 908 "bionic/netdb.cpp", 909 "bionic/net_if.cpp", 910 "bionic/netinet_ether.cpp", 911 "bionic/netinet_in.cpp", 912 "bionic/nl_types.cpp", 913 "bionic/open.cpp", 914 "bionic/pathconf.cpp", 915 "bionic/pause.cpp", 916 "bionic/pidfd.cpp", 917 "bionic/pipe.cpp", 918 "bionic/poll.cpp", 919 "bionic/posix_fadvise.cpp", 920 "bionic/posix_fallocate.cpp", 921 "bionic/posix_madvise.cpp", 922 "bionic/posix_timers.cpp", 923 "bionic/preadv_pwritev.cpp", 924 "bionic/pthread_atfork.cpp", 925 "bionic/pthread_attr.cpp", 926 "bionic/pthread_barrier.cpp", 927 "bionic/pthread_cond.cpp", 928 "bionic/pthread_create.cpp", 929 "bionic/pthread_detach.cpp", 930 "bionic/pthread_equal.cpp", 931 "bionic/pthread_exit.cpp", 932 "bionic/pthread_getaffinity.cpp", 933 "bionic/pthread_getcpuclockid.cpp", 934 "bionic/pthread_getschedparam.cpp", 935 "bionic/pthread_gettid_np.cpp", 936 "bionic/pthread_internal.cpp", 937 "bionic/pthread_join.cpp", 938 "bionic/pthread_key.cpp", 939 "bionic/pthread_kill.cpp", 940 "bionic/pthread_mutex.cpp", 941 "bionic/pthread_once.cpp", 942 "bionic/pthread_rwlock.cpp", 943 "bionic/pthread_sigqueue.cpp", 944 "bionic/pthread_self.cpp", 945 "bionic/pthread_setname_np.cpp", 946 "bionic/pthread_setaffinity.cpp", 947 "bionic/pthread_setschedparam.cpp", 948 "bionic/pthread_spinlock.cpp", 949 "bionic/ptrace.cpp", 950 "bionic/pty.cpp", 951 "bionic/raise.cpp", 952 "bionic/rand.cpp", 953 "bionic/readlink.cpp", 954 "bionic/realpath.cpp", 955 "bionic/reboot.cpp", 956 "bionic/recv.cpp", 957 "bionic/recvmsg.cpp", 958 "bionic/rename.cpp", 959 "bionic/rmdir.cpp", 960 "bionic/scandir.cpp", 961 "bionic/sched_cpualloc.cpp", 962 "bionic/sched_cpucount.cpp", 963 "bionic/sched_getaffinity.cpp", 964 "bionic/sched_getcpu.cpp", 965 "bionic/semaphore.cpp", 966 "bionic/send.cpp", 967 "bionic/setegid.cpp", 968 "bionic/seteuid.cpp", 969 "bionic/setjmp_cookie.cpp", 970 "bionic/setpgrp.cpp", 971 "bionic/sigaction.cpp", 972 "bionic/signal.cpp", 973 "bionic/sigprocmask.cpp", 974 "bionic/sleep.cpp", 975 "bionic/socketpair.cpp", 976 "bionic/spawn.cpp", 977 "bionic/stat.cpp", 978 "bionic/stdlib_l.cpp", 979 "bionic/strerror.cpp", 980 "bionic/string_l.cpp", 981 "bionic/strings_l.cpp", 982 "bionic/strsignal.cpp", 983 "bionic/strtol.cpp", 984 "bionic/strtold.cpp", 985 "bionic/swab.cpp", 986 "bionic/symlink.cpp", 987 "bionic/sync_file_range.cpp", 988 "bionic/sysconf.cpp", 989 "bionic/sys_epoll.cpp", 990 "bionic/sys_msg.cpp", 991 "bionic/sys_sem.cpp", 992 "bionic/sys_shm.cpp", 993 "bionic/sys_signalfd.cpp", 994 "bionic/sys_statfs.cpp", 995 "bionic/sys_statvfs.cpp", 996 "bionic/sys_thread_properties.cpp", 997 "bionic/sys_time.cpp", 998 "bionic/sysinfo.cpp", 999 "bionic/syslog.cpp", 1000 "bionic/sysprop_helpers.cpp", 1001 "bionic/system.cpp", 1002 "bionic/system_property_api.cpp", 1003 "bionic/system_property_set.cpp", 1004 "bionic/tdestroy.cpp", 1005 "bionic/termios.cpp", 1006 "bionic/thread_private.cpp", 1007 "bionic/threads.cpp", 1008 "bionic/time.cpp", 1009 "bionic/tmpfile.cpp", 1010 "bionic/umount.cpp", 1011 "bionic/unlink.cpp", 1012 "bionic/usleep.cpp", 1013 "bionic/utmp.cpp", 1014 "bionic/vdso.cpp", 1015 "bionic/wait.cpp", 1016 "bionic/wchar.cpp", 1017 "bionic/wchar_l.cpp", 1018 "bionic/wcstod.cpp", 1019 "bionic/wctype.cpp", 1020 "bionic/wcwidth.cpp", 1021 "bionic/wmempcpy.cpp", 1022 1023 // Forked but not yet cleaned up/rewritten stdio code. 1024 // TODO: finish cleanup. 1025 "stdio/fmemopen.cpp", 1026 "stdio/parsefloat.c", 1027 "stdio/refill.c", 1028 "stdio/stdio.cpp", 1029 "stdio/stdio_ext.cpp", 1030 "stdio/vfscanf.cpp", 1031 "stdio/vfwscanf.cpp", 1032 ], 1033 1034 arch: { 1035 arm: { 1036 asflags: libc_common_flags + ["-mno-restrict-it"], 1037 srcs: [ 1038 "arch-arm/bionic/__aeabi_read_tp.S", 1039 "arch-arm/bionic/__bionic_clone.S", 1040 "arch-arm/bionic/__restore.S", 1041 "arch-arm/bionic/_exit_with_stack_teardown.S", 1042 "arch-arm/bionic/atomics_arm.c", 1043 "arch-arm/bionic/bpabi.c", 1044 "arch-arm/bionic/libcrt_compat.c", 1045 "arch-arm/bionic/popcount_tab.c", 1046 "arch-arm/bionic/setjmp.S", 1047 "arch-arm/bionic/syscall.S", 1048 "arch-arm/bionic/vfork.S", 1049 1050 "arch-arm/cortex-a7/bionic/memcpy.S", 1051 "arch-arm/cortex-a7/bionic/memset.S", 1052 1053 "arch-arm/cortex-a9/bionic/memcpy.S", 1054 "arch-arm/cortex-a9/bionic/memset.S", 1055 "arch-arm/cortex-a9/bionic/stpcpy.S", 1056 "arch-arm/cortex-a9/bionic/strcat.S", 1057 "arch-arm/cortex-a9/bionic/strcpy.S", 1058 "arch-arm/cortex-a9/bionic/strlen.S", 1059 1060 "arch-arm/cortex-a15/bionic/memcpy.S", 1061 "arch-arm/cortex-a15/bionic/memmove.S", 1062 "arch-arm/cortex-a15/bionic/memset.S", 1063 "arch-arm/cortex-a15/bionic/stpcpy.S", 1064 "arch-arm/cortex-a15/bionic/strcat.S", 1065 "arch-arm/cortex-a15/bionic/strcmp.S", 1066 "arch-arm/cortex-a15/bionic/strcpy.S", 1067 "arch-arm/cortex-a15/bionic/strlen.S", 1068 1069 "arch-arm/cortex-a53/bionic/memcpy.S", 1070 1071 "arch-arm/cortex-a55/bionic/memcpy.S", 1072 1073 "arch-arm/generic/bionic/memcmp.S", 1074 "arch-arm/generic/bionic/memmove.S", 1075 "arch-arm/generic/bionic/memset.S", 1076 "arch-arm/generic/bionic/stpcpy.c", 1077 "arch-arm/generic/bionic/strcat.c", 1078 "arch-arm/generic/bionic/strcmp.S", 1079 "arch-arm/generic/bionic/strcpy.S", 1080 "arch-arm/generic/bionic/strlen.c", 1081 1082 "arch-arm/krait/bionic/memcpy.S", 1083 "arch-arm/krait/bionic/memset.S", 1084 1085 "arch-arm/kryo/bionic/memcpy.S", 1086 1087 "bionic/strchr.cpp", 1088 "bionic/strchrnul.cpp", 1089 "bionic/strnlen.cpp", 1090 "bionic/strrchr.cpp", 1091 ], 1092 }, 1093 arm64: { 1094 srcs: [ 1095 "arch-arm64/bionic/__bionic_clone.S", 1096 "arch-arm64/bionic/_exit_with_stack_teardown.S", 1097 "arch-arm64/bionic/setjmp.S", 1098 "arch-arm64/bionic/syscall.S", 1099 "arch-arm64/bionic/vfork.S", 1100 "arch-arm64/oryon/memcpy-nt.S", 1101 "arch-arm64/oryon/memset-nt.S", 1102 ], 1103 }, 1104 1105 riscv64: { 1106 srcs: [ 1107 "arch-riscv64/bionic/__bionic_clone.S", 1108 "arch-riscv64/bionic/_exit_with_stack_teardown.S", 1109 "arch-riscv64/bionic/setjmp.S", 1110 "arch-riscv64/bionic/syscall.S", 1111 "arch-riscv64/bionic/vfork.S", 1112 1113 "arch-riscv64/string/memchr_v.S", 1114 "arch-riscv64/string/memcmp_v.S", 1115 "arch-riscv64/string/memcpy_v.S", 1116 "arch-riscv64/string/memmove_v.S", 1117 "arch-riscv64/string/memset_v.S", 1118 "arch-riscv64/string/stpcpy_v.S", 1119 "arch-riscv64/string/strcat_v.S", 1120 "arch-riscv64/string/strchr_v.S", 1121 "arch-riscv64/string/strcmp_v.S", 1122 "arch-riscv64/string/strcpy_v.S", 1123 "arch-riscv64/string/strlen_v.S", 1124 "arch-riscv64/string/strncat_v.S", 1125 "arch-riscv64/string/strncmp_v.S", 1126 "arch-riscv64/string/strncpy_v.S", 1127 "arch-riscv64/string/strnlen_v.S", 1128 1129 "arch-riscv64/string/memchr.c", 1130 "arch-riscv64/string/memcmp.c", 1131 "arch-riscv64/string/memcpy.c", 1132 "arch-riscv64/string/memmove.c", 1133 "arch-riscv64/string/memset.c", 1134 "arch-riscv64/string/stpcpy.c", 1135 "arch-riscv64/string/strcat.c", 1136 "arch-riscv64/string/strchr.c", 1137 "arch-riscv64/string/strcmp.c", 1138 "arch-riscv64/string/strcpy.c", 1139 "arch-riscv64/string/strlen.c", 1140 "arch-riscv64/string/strncat.c", 1141 "arch-riscv64/string/strncmp.c", 1142 "arch-riscv64/string/strncpy.c", 1143 "arch-riscv64/string/strnlen.c", 1144 1145 "bionic/strchrnul.cpp", 1146 "bionic/strrchr.cpp", 1147 ], 1148 }, 1149 1150 x86: { 1151 srcs: [ 1152 "arch-x86/bionic/__bionic_clone.S", 1153 "arch-x86/bionic/_exit_with_stack_teardown.S", 1154 "arch-x86/bionic/libcrt_compat.c", 1155 "arch-x86/bionic/setjmp.S", 1156 "arch-x86/bionic/syscall.S", 1157 "arch-x86/bionic/vfork.S", 1158 "arch-x86/bionic/__x86.get_pc_thunk.S", 1159 1160 "arch-x86/string/sse2-memchr-atom.S", 1161 "arch-x86/string/sse2-memmove-slm.S", 1162 "arch-x86/string/sse2-memset-slm.S", 1163 "arch-x86/string/sse2-stpcpy-slm.S", 1164 "arch-x86/string/sse2-stpncpy-slm.S", 1165 "arch-x86/string/sse2-strchr-atom.S", 1166 "arch-x86/string/sse2-strcpy-slm.S", 1167 "arch-x86/string/sse2-strlen-slm.S", 1168 "arch-x86/string/sse2-strncpy-slm.S", 1169 "arch-x86/string/sse2-strnlen-atom.S", 1170 "arch-x86/string/sse2-strrchr-atom.S", 1171 1172 "arch-x86/string/ssse3-memcmp-atom.S", 1173 "arch-x86/string/ssse3-strcat-atom.S", 1174 "arch-x86/string/ssse3-strcmp-atom.S", 1175 "arch-x86/string/ssse3-strncat-atom.S", 1176 "arch-x86/string/ssse3-strncmp-atom.S", 1177 1178 "arch-x86/string/sse4-memcmp-slm.S", 1179 1180 "bionic/strchrnul.cpp", 1181 ], 1182 }, 1183 x86_64: { 1184 srcs: [ 1185 "arch-x86_64/bionic/__bionic_clone.S", 1186 "arch-x86_64/bionic/_exit_with_stack_teardown.S", 1187 "arch-x86_64/bionic/__restore_rt.S", 1188 "arch-x86_64/bionic/setjmp.S", 1189 "arch-x86_64/bionic/syscall.S", 1190 "arch-x86_64/bionic/vfork.S", 1191 1192 "arch-x86_64/string/avx2-memset-kbl.S", 1193 "arch-x86_64/string/sse2-memmove-slm.S", 1194 "arch-x86_64/string/sse2-memset-slm.S", 1195 "arch-x86_64/string/sse2-stpcpy-slm.S", 1196 "arch-x86_64/string/sse2-stpncpy-slm.S", 1197 "arch-x86_64/string/sse2-strcat-slm.S", 1198 "arch-x86_64/string/sse2-strcpy-slm.S", 1199 "arch-x86_64/string/sse2-strlen-slm.S", 1200 "arch-x86_64/string/sse2-strncat-slm.S", 1201 "arch-x86_64/string/sse2-strncpy-slm.S", 1202 "arch-x86_64/string/sse4-memcmp-slm.S", 1203 "arch-x86_64/string/ssse3-strcmp-slm.S", 1204 "arch-x86_64/string/ssse3-strncmp-slm.S", 1205 ], 1206 }, 1207 }, 1208 1209 multilib: { 1210 lib32: { 1211 srcs: [ 1212 // off64_t/time64_t support on LP32. 1213 "bionic/legacy_32_bit_support.cpp", 1214 "bionic/time64.c", 1215 ], 1216 }, 1217 }, 1218 1219 local_include_dirs: ["stdio"], 1220 generated_headers: ["generated_android_ids"], 1221 1222 whole_static_libs: [ 1223 "//external/llvm-libc:llvmlibc", 1224 "libsystemproperties", 1225 ], 1226 1227 cppflags: ["-Wold-style-cast"], 1228 include_dirs: ["bionic/libstdc++/include"], 1229 name: "libc_bionic", 1230} 1231 1232genrule { 1233 name: "generated_android_ids", 1234 out: ["generated_android_ids.h"], 1235 srcs: [":android_filesystem_config_header"], 1236 tools: ["fs_config_generator"], 1237 cmd: "$(location fs_config_generator) aidarray $(in) > $(out)", 1238} 1239 1240// ======================================================== 1241// libc_syscalls.a 1242// ======================================================== 1243 1244genrule { 1245 name: "syscalls-arm", 1246 out: ["syscalls-arm.S"], 1247 srcs: ["SYSCALLS.TXT"], 1248 tools: ["gensyscalls"], 1249 cmd: "$(location gensyscalls) arm $(in) > $(out)", 1250} 1251 1252genrule { 1253 name: "syscalls-arm64", 1254 out: ["syscalls-arm64.S"], 1255 srcs: ["SYSCALLS.TXT"], 1256 tools: ["gensyscalls"], 1257 cmd: "$(location gensyscalls) arm64 $(in) > $(out)", 1258} 1259 1260genrule { 1261 name: "syscalls-riscv64", 1262 out: ["syscalls-riscv64.S"], 1263 srcs: ["SYSCALLS.TXT"], 1264 tools: ["gensyscalls"], 1265 cmd: "$(location gensyscalls) riscv64 $(in) > $(out)", 1266} 1267 1268genrule { 1269 name: "syscalls-x86", 1270 out: ["syscalls-x86.S"], 1271 srcs: ["SYSCALLS.TXT"], 1272 tools: ["gensyscalls"], 1273 cmd: "$(location gensyscalls) x86 $(in) > $(out)", 1274} 1275 1276genrule { 1277 name: "syscalls-x86_64", 1278 out: ["syscalls-x86_64.S"], 1279 srcs: ["SYSCALLS.TXT"], 1280 tools: ["gensyscalls"], 1281 cmd: "$(location gensyscalls) x86_64 $(in) > $(out)", 1282} 1283 1284cc_library_static { 1285 defaults: ["libc_defaults"], 1286 srcs: ["bionic/__set_errno.cpp"], 1287 arch: { 1288 arm: { 1289 srcs: [":syscalls-arm"], 1290 }, 1291 arm64: { 1292 srcs: [":syscalls-arm64"], 1293 }, 1294 riscv64: { 1295 srcs: [":syscalls-riscv64"], 1296 }, 1297 x86: { 1298 srcs: [":syscalls-x86"], 1299 }, 1300 x86_64: { 1301 srcs: [":syscalls-x86_64"], 1302 }, 1303 }, 1304 name: "libc_syscalls", 1305} 1306 1307// ======================================================== 1308// libc_aeabi.a 1309// This is an LP32 ARM-only library that needs to be built with -fno-builtin 1310// to avoid infinite recursion. For the other architectures we just build an 1311// empty library to keep this makefile simple. 1312// ======================================================== 1313 1314cc_library_static { 1315 defaults: ["libc_defaults"], 1316 arch: { 1317 arm: { 1318 srcs: ["arch-arm/bionic/__aeabi.c"], 1319 }, 1320 }, 1321 name: "libc_aeabi", 1322 cflags: ["-fno-builtin"], 1323} 1324 1325// ======================================================== 1326// libc_common.a --- everything shared by libc.a and libc.so 1327// ======================================================== 1328 1329cc_library_static { 1330 defaults: ["libc_defaults"], 1331 name: "libc_common", 1332 1333 whole_static_libs: [ 1334 "libarm-optimized-routines-string", 1335 "libasync_safe", 1336 "libc_bionic", 1337 "libc_bootstrap", 1338 "libc_dns", 1339 "libc_fortify", 1340 "libc_freebsd", 1341 "libc_freebsd_large_stack", 1342 "libc_freebsd_ldexp", 1343 "libc_gdtoa", 1344 "libc_netbsd", 1345 "libc_openbsd", 1346 "libc_openbsd_large_stack", 1347 "libc_syscalls", 1348 "libc_tzcode", 1349 "libstdc++", 1350 ], 1351 1352 arch: { 1353 arm: { 1354 whole_static_libs: ["libc_aeabi"], 1355 }, 1356 }, 1357} 1358 1359// ======================================================== 1360// libc_static_dispatch.a/libc_dynamic_dispatch.a --- string/memory "ifuncs" 1361// (Actually ifuncs for libc.so, but a home-grown alternative for libc.a.) 1362// ======================================================== 1363 1364cc_defaults { 1365 name: "libc_dispatch_defaults", 1366 defaults: ["libc_defaults"], 1367 arch: { 1368 x86_64: { 1369 srcs: ["arch-x86_64/dynamic_function_dispatch.cpp"], 1370 }, 1371 x86: { 1372 srcs: ["arch-x86/dynamic_function_dispatch.cpp"], 1373 }, 1374 arm: { 1375 srcs: ["arch-arm/dynamic_function_dispatch.cpp"], 1376 }, 1377 arm64: { 1378 srcs: ["arch-arm64/dynamic_function_dispatch.cpp"], 1379 }, 1380 riscv64: { 1381 srcs: ["arch-riscv64/dynamic_function_dispatch.cpp"], 1382 }, 1383 }, 1384 // Prevent the compiler from inserting calls to libc/taking the address of 1385 // a jump table from within an ifunc (or, in the static case, code that 1386 // can be executed arbitrarily early). 1387 cflags: [ 1388 "-ffreestanding", 1389 "-fno-stack-protector", 1390 "-fno-jump-tables", 1391 ], 1392} 1393 1394cc_library_static { 1395 name: "libc_static_dispatch", 1396 defaults: ["libc_dispatch_defaults"], 1397 cflags: [ 1398 "-DBIONIC_STATIC_DISPATCH", 1399 ], 1400} 1401 1402cc_library_static { 1403 name: "libc_dynamic_dispatch", 1404 defaults: ["libc_dispatch_defaults"], 1405 cflags: [ 1406 "-DBIONIC_DYNAMIC_DISPATCH", 1407 ], 1408} 1409 1410// ======================================================== 1411// libc_common_static.a For static binaries. 1412// ======================================================== 1413cc_library_static { 1414 defaults: ["libc_defaults"], 1415 name: "libc_common_static", 1416 1417 whole_static_libs: [ 1418 "libc_common", 1419 "libc_static_dispatch", 1420 ], 1421} 1422 1423// ======================================================== 1424// libc_common_shared.a For shared libraries. 1425// ======================================================== 1426cc_library_static { 1427 defaults: ["libc_defaults"], 1428 name: "libc_common_shared", 1429 1430 whole_static_libs: [ 1431 "libc_common", 1432 "libc_dynamic_dispatch", 1433 ], 1434} 1435 1436// Versions of dl_iterate_phdr and similar APIs used to lookup unwinding information in a static 1437// executable. 1438cc_library_static { 1439 name: "libc_unwind_static", 1440 defaults: ["libc_defaults"], 1441 cflags: ["-DLIBC_STATIC"], 1442 1443 srcs: ["bionic/dl_iterate_phdr_static.cpp"], 1444 arch: { 1445 // arm32-specific dl_unwind_find_exidx and __gnu_Unwind_Find_exidx APIs 1446 arm: { 1447 srcs: ["arch-arm/bionic/exidx_static.c"], 1448 }, 1449 }, 1450} 1451 1452// ======================================================== 1453// libc_nomalloc.a 1454// ======================================================== 1455// 1456// This is a version of the static C library used by the dynamic linker that exclude malloc. It also 1457// excludes functions selected using ifunc's (e.g. for string.h). Link in either 1458// libc_static_dispatch or libc_dynamic_dispatch to provide those functions. 1459 1460cc_library_static { 1461 name: "libc_nomalloc", 1462 defaults: ["libc_defaults"], 1463 1464 whole_static_libs: [ 1465 "libc_common", 1466 "libc_init_static", 1467 "libc_unwind_static", 1468 ], 1469} 1470 1471filegroup { 1472 name: "libc_sources_shared", 1473 srcs: [ 1474 "arch-common/bionic/crtbegin_so.c", 1475 "arch-common/bionic/crtbrand.S", 1476 "bionic/android_mallopt.cpp", 1477 "bionic/gwp_asan_wrappers.cpp", 1478 "bionic/heap_tagging.cpp", 1479 "bionic/icu.cpp", 1480 "bionic/malloc_common.cpp", 1481 "bionic/malloc_common_dynamic.cpp", 1482 "bionic/android_profiling_dynamic.cpp", 1483 "bionic/malloc_heapprofd.cpp", 1484 "bionic/malloc_limit.cpp", 1485 "bionic/ndk_cruft.cpp", 1486 "bionic/ndk_cruft_data.cpp", 1487 "bionic/NetdClient.cpp", 1488 "arch-common/bionic/crtend_so.S", 1489 ], 1490} 1491 1492filegroup { 1493 name: "libc_sources_static", 1494 srcs: [ 1495 "bionic/android_mallopt.cpp", 1496 "bionic/gwp_asan_wrappers.cpp", 1497 "bionic/heap_tagging.cpp", 1498 "bionic/icu_static.cpp", 1499 "bionic/malloc_common.cpp", 1500 "bionic/malloc_limit.cpp", 1501 ], 1502} 1503 1504filegroup { 1505 name: "libc_sources_shared_arm", 1506 srcs: [ 1507 "arch-arm/bionic/exidx_dynamic.c", 1508 "arch-arm/bionic/atexit_legacy.c", 1509 ], 1510} 1511 1512// ======================================================== 1513// libc.a + libc.so 1514// ======================================================== 1515cc_defaults { 1516 defaults: [ 1517 "libc_defaults", 1518 "libc_native_allocator_defaults", 1519 "bug_24465209_workaround", 1520 "keep_symbols", 1521 ], 1522 name: "libc_library_defaults", 1523 product_variables: { 1524 platform_sdk_version: { 1525 asflags: ["-DPLATFORM_SDK_VERSION=%d"], 1526 }, 1527 }, 1528 static: { 1529 srcs: [":libc_sources_static"], 1530 cflags: ["-DLIBC_STATIC"], 1531 whole_static_libs: [ 1532 "gwp_asan", 1533 "libc_init_static", 1534 "libc_common_static", 1535 "libc_unwind_static", 1536 ], 1537 }, 1538 shared: { 1539 srcs: [":libc_sources_shared"], 1540 whole_static_libs: [ 1541 "gwp_asan", 1542 "libc_init_dynamic", 1543 "libc_common_shared", 1544 "libunwind-exported", 1545 ], 1546 }, 1547 1548 required: [ 1549 "tzdata_prebuilt", 1550 "tz_version_prebuilt", // Version metadata for tzdata to help debugging. 1551 ], 1552 1553 // Do not pack libc.so relocations; see http://b/20645321 for details. 1554 pack_relocations: false, 1555 1556 shared_libs: [ 1557 "ld-android", 1558 "libdl", 1559 ], 1560 static_libs: [ 1561 "libdl_android", 1562 ], 1563 1564 nocrt: true, 1565 1566 arch: { 1567 arm: { 1568 version_script: ":libc.arm.map", 1569 no_libcrt: true, 1570 1571 shared: { 1572 srcs: [":libc_sources_shared_arm"], 1573 // special for arm 1574 cflags: ["-DCRT_LEGACY_WORKAROUND"], 1575 // For backwards compatibility, some arm32 builtins are exported from libc.so. 1576 static_libs: ["libclang_rt.builtins-exported"], 1577 }, 1578 1579 ldflags: [ 1580 // Since we preserve the debug_frame for libc, do not compress 1581 // in this case to make unwinds as fast as possible. 1582 "-Wl,--compress-debug-sections=none", 1583 ], 1584 }, 1585 arm64: { 1586 version_script: ":libc.arm64.map", 1587 }, 1588 riscv64: { 1589 version_script: ":libc.riscv64.map", 1590 }, 1591 x86: { 1592 version_script: ":libc.x86.map", 1593 no_libcrt: true, 1594 1595 shared: { 1596 // For backwards compatibility, some x86 builtins are exported from libc.so. 1597 static_libs: ["libclang_rt.builtins-exported"], 1598 }, 1599 }, 1600 x86_64: { 1601 version_script: ":libc.x86_64.map", 1602 }, 1603 }, 1604 1605 apex_available: [ 1606 "com.android.runtime", 1607 ], 1608 1609 target: { 1610 native_bridge: { 1611 shared: { 1612 installable: false, 1613 }, 1614 }, 1615 }, 1616} 1617 1618cc_library { 1619 name: "libc", 1620 defaults: [ 1621 "libc_library_defaults", 1622 ], 1623 stubs: { 1624 symbol_file: "libc.map.txt", 1625 versions: [ 1626 "29", 1627 "R", 1628 "current", 1629 ], 1630 }, 1631 static_ndk_lib: true, 1632 llndk: { 1633 symbol_file: "libc.map.txt", 1634 export_headers_as_system: true, 1635 export_llndk_headers: ["libc_headers"], 1636 }, 1637} 1638 1639cc_library { 1640 name: "libc_hwasan", 1641 defaults: [ 1642 "libc_library_defaults", 1643 ], 1644 sanitize: { 1645 hwaddress: true, 1646 }, 1647 enabled: false, 1648 target: { 1649 android_arm64: { 1650 enabled: true, 1651 }, 1652 }, 1653 stem: "libc", 1654 relative_install_path: "hwasan", 1655 // We don't really need the stubs, but this needs to stay to trigger the 1656 // symlink logic in soong. 1657 stubs: { 1658 symbol_file: "libc.map.txt", 1659 }, 1660 native_bridge_supported: false, 1661 // It is never correct to depend on this directly. This is only 1662 // needed for the runtime apex, and in base_system.mk, and system_image_defaults 1663 // which is default module for soong-defined system image. 1664 visibility: [ 1665 "//bionic/apex", 1666 "//build/make/target/product/generic", 1667 //TODO(b/381985636) : Remove visibility to Soong-defined GSI once resolved 1668 "//build/make/target/product/gsi", 1669 ], 1670} 1671 1672genrule { 1673 name: "libc.arm.map", 1674 out: ["libc.arm.map.txt"], 1675 srcs: ["libc.map.txt"], 1676 tools: ["generate-version-script"], 1677 cmd: "$(location generate-version-script) arm $(in) $(out)", 1678} 1679 1680genrule { 1681 name: "libc.arm64.map", 1682 out: ["libc.arm64.map.txt"], 1683 srcs: ["libc.map.txt"], 1684 tools: ["generate-version-script"], 1685 cmd: "$(location generate-version-script) arm64 $(in) $(out)", 1686} 1687 1688genrule { 1689 name: "libc.riscv64.map", 1690 out: ["libc.riscv64.map.txt"], 1691 srcs: ["libc.map.txt"], 1692 tools: ["generate-version-script"], 1693 cmd: "$(location generate-version-script) riscv64 $(in) $(out)", 1694} 1695 1696genrule { 1697 name: "libc.x86.map", 1698 out: ["libc.x86.map.txt"], 1699 srcs: ["libc.map.txt"], 1700 tools: ["generate-version-script"], 1701 cmd: "$(location generate-version-script) x86 $(in) $(out)", 1702} 1703 1704genrule { 1705 name: "libc.x86_64.map", 1706 out: ["libc.x86_64.map.txt"], 1707 srcs: ["libc.map.txt"], 1708 tools: ["generate-version-script"], 1709 cmd: "$(location generate-version-script) x86_64 $(in) $(out)", 1710} 1711 1712// Headers that only other parts of the platform can include. 1713cc_library_headers { 1714 name: "bionic_libc_platform_headers", 1715 defaults: ["linux_bionic_supported"], 1716 visibility: [ 1717 "//art:__subpackages__", 1718 "//bionic:__subpackages__", 1719 "//frameworks:__subpackages__", 1720 "//device/generic/goldfish-opengl:__subpackages__", 1721 "//external/gwp_asan:__subpackages__", 1722 "//external/perfetto:__subpackages__", 1723 "//external/scudo:__subpackages__", 1724 "//system/core/debuggerd:__subpackages__", 1725 "//system/core/init:__subpackages__", 1726 "//system/core/libcutils:__subpackages__", 1727 "//system/memory/libmemunreachable:__subpackages__", 1728 "//system/unwinding/libunwindstack:__subpackages__", 1729 "//tools/security/sanitizer-status:__subpackages__", 1730 ], 1731 vendor_available: true, 1732 product_available: true, 1733 ramdisk_available: true, 1734 vendor_ramdisk_available: true, 1735 recovery_available: true, 1736 native_bridge_supported: true, 1737 export_include_dirs: [ 1738 "platform", 1739 ], 1740 system_shared_libs: [], 1741 stl: "none", 1742 sdk_version: "current", 1743 1744 min_sdk_version: "29", 1745 apex_available: [ 1746 "//apex_available:platform", 1747 "//apex_available:anyapex", 1748 ], 1749} 1750 1751cc_library_headers { 1752 name: "libc_uapi_headers", 1753 visibility: [ 1754 "//external/musl", 1755 "//external/rust/crates/v4l2r/android", 1756 ], 1757 llndk: { 1758 llndk_headers: true, 1759 }, 1760 host_supported: true, 1761 vendor_available: true, 1762 product_available: true, 1763 ramdisk_available: true, 1764 vendor_ramdisk_available: true, 1765 recovery_available: true, 1766 native_bridge_supported: true, 1767 apex_available: [ 1768 "//apex_available:platform", 1769 "//apex_available:anyapex", 1770 ], 1771 // used by most APEXes indirectly via libunwind_llvm 1772 min_sdk_version: "apex_inherit", 1773 1774 no_libcrt: true, 1775 stl: "none", 1776 system_shared_libs: [], 1777 1778 // The build system generally requires that any dependencies of a target 1779 // with an sdk_version must have a lower sdk_version. By setting sdk_version 1780 // to 1 we let targets with an sdk_version that need to depend on the libc 1781 // headers but cannot depend on libc itself due to circular dependencies 1782 // (such as libunwind_llvm) depend on the headers. Setting sdk_version to 1 1783 // is correct because the headers can support any sdk_version. 1784 sdk_version: "1", 1785 1786 export_system_include_dirs: [ 1787 "kernel/uapi", 1788 "kernel/android/scsi", 1789 "kernel/android/uapi", 1790 ], 1791 1792 arch: { 1793 arm: { 1794 export_system_include_dirs: ["kernel/uapi/asm-arm"], 1795 }, 1796 arm64: { 1797 export_system_include_dirs: ["kernel/uapi/asm-arm64"], 1798 }, 1799 riscv64: { 1800 export_system_include_dirs: ["kernel/uapi/asm-riscv"], 1801 }, 1802 x86: { 1803 export_system_include_dirs: ["kernel/uapi/asm-x86"], 1804 }, 1805 x86_64: { 1806 export_system_include_dirs: ["kernel/uapi/asm-x86"], 1807 }, 1808 }, 1809} 1810 1811cc_library_headers { 1812 name: "libc_headers", 1813 host_supported: true, 1814 native_bridge_supported: true, 1815 vendor_available: true, 1816 product_available: true, 1817 ramdisk_available: true, 1818 vendor_ramdisk_available: true, 1819 recovery_available: true, 1820 sdk_version: "1", 1821 1822 apex_available: [ 1823 "//apex_available:platform", 1824 "//apex_available:anyapex", 1825 ], 1826 // used by most APEXes indirectly via libunwind_llvm 1827 min_sdk_version: "apex_inherit", 1828 visibility: [ 1829 "//bionic:__subpackages__", // visible to bionic 1830 // ... and only to these places (b/152668052) 1831 "//external/arm-optimized-routines", 1832 "//external/gwp_asan", 1833 "//external/jemalloc_new", 1834 "//external/libunwind_llvm", 1835 "//external/llvm-libc", 1836 "//external/scudo", 1837 "//system/core/property_service/libpropertyinfoparser", 1838 "//system/extras/toolchain-extras", 1839 ], 1840 1841 stl: "none", 1842 no_libcrt: true, 1843 system_shared_libs: [], 1844 1845 target: { 1846 android: { 1847 export_system_include_dirs: ["include"], 1848 header_libs: ["libc_uapi_headers"], 1849 export_header_lib_headers: ["libc_uapi_headers"], 1850 }, 1851 linux_bionic: { 1852 export_system_include_dirs: ["include"], 1853 header_libs: ["libc_uapi_headers"], 1854 export_header_lib_headers: ["libc_uapi_headers"], 1855 }, 1856 }, 1857} 1858 1859// ======================================================== 1860// libstdc++.so and libstdc++.a. 1861// ======================================================== 1862 1863cc_library { 1864 defaults: [ 1865 "libc_defaults", 1866 "bug_24465209_workaround", 1867 ], 1868 include_dirs: ["bionic/libstdc++/include"], 1869 srcs: [ 1870 "bionic/__cxa_guard.cpp", 1871 "bionic/__cxa_pure_virtual.cpp", 1872 "bionic/new.cpp", 1873 ], 1874 name: "libstdc++", 1875 static_ndk_lib: true, 1876 static_libs: ["libasync_safe"], 1877 apex_available: [ 1878 "//apex_available:platform", 1879 ], 1880 1881 static: { 1882 system_shared_libs: [], 1883 }, 1884 target: { 1885 bionic: { 1886 shared: { 1887 system_shared_libs: ["libc"], 1888 }, 1889 }, 1890 }, 1891 1892 arch: { 1893 arm: { 1894 version_script: ":libstdc++.arm.map", 1895 }, 1896 arm64: { 1897 version_script: ":libstdc++.arm64.map", 1898 }, 1899 riscv64: { 1900 version_script: ":libstdc++.riscv64.map", 1901 }, 1902 x86: { 1903 version_script: ":libstdc++.x86.map", 1904 }, 1905 x86_64: { 1906 version_script: ":libstdc++.x86_64.map", 1907 }, 1908 }, 1909} 1910 1911genrule { 1912 name: "libstdc++.arm.map", 1913 out: ["libstdc++.arm.map.txt"], 1914 srcs: ["libstdc++.map.txt"], 1915 tools: ["generate-version-script"], 1916 cmd: "$(location generate-version-script) arm $(in) $(out)", 1917} 1918 1919genrule { 1920 name: "libstdc++.arm64.map", 1921 out: ["libstdc++.arm64.map.txt"], 1922 srcs: ["libstdc++.map.txt"], 1923 tools: ["generate-version-script"], 1924 cmd: "$(location generate-version-script) arm64 $(in) $(out)", 1925} 1926 1927genrule { 1928 name: "libstdc++.riscv64.map", 1929 out: ["libstdc++.riscv64.map.txt"], 1930 srcs: ["libstdc++.map.txt"], 1931 tools: ["generate-version-script"], 1932 cmd: "$(location generate-version-script) riscv64 $(in) $(out)", 1933} 1934 1935genrule { 1936 name: "libstdc++.x86.map", 1937 out: ["libstdc++.x86.map.txt"], 1938 srcs: ["libstdc++.map.txt"], 1939 tools: ["generate-version-script"], 1940 cmd: "$(location generate-version-script) x86 $(in) $(out)", 1941} 1942 1943genrule { 1944 name: "libstdc++.x86_64.map", 1945 out: ["libstdc++.x86_64.map.txt"], 1946 srcs: ["libstdc++.map.txt"], 1947 tools: ["generate-version-script"], 1948 cmd: "$(location generate-version-script) x86_64 $(in) $(out)", 1949} 1950 1951// ======================================================== 1952// crt object files. 1953// ======================================================== 1954 1955cc_defaults { 1956 name: "crt_and_memtag_defaults", 1957 defaults: ["linux_bionic_supported"], 1958 vendor_available: true, 1959 product_available: true, 1960 ramdisk_available: true, 1961 vendor_ramdisk_available: true, 1962 recovery_available: true, 1963 native_bridge_supported: true, 1964 apex_available: [ 1965 "//apex_available:platform", 1966 "//apex_available:anyapex", 1967 ], 1968 // Generate NDK variants of the CRT objects for every supported API level. 1969 min_sdk_version: "16", 1970 stl: "none", 1971 crt: true, 1972 cflags: [ 1973 "-Wno-gcc-compat", 1974 "-Wall", 1975 "-Werror", 1976 ], 1977 sanitize: { 1978 never: true, 1979 }, 1980} 1981 1982cc_defaults { 1983 name: "crt_defaults", 1984 defaults: ["crt_and_memtag_defaults"], 1985 system_shared_libs: [], 1986} 1987 1988cc_defaults { 1989 name: "crt_so_defaults", 1990 defaults: ["crt_defaults"], 1991 stl: "none", 1992} 1993 1994cc_object { 1995 name: "crtbrand", 1996 local_include_dirs: [ 1997 "private", // crtbrand.S depends on private/bionic_asm_note.h 1998 ], 1999 // crtbrand.S needs to know the platform SDK version. 2000 product_variables: { 2001 platform_sdk_version: { 2002 asflags: ["-DPLATFORM_SDK_VERSION=%d"], 2003 }, 2004 }, 2005 srcs: ["arch-common/bionic/crtbrand.S"], 2006 2007 defaults: ["crt_so_defaults"], 2008 // crtbrand is an intermediate artifact, not a final CRT object. 2009 exclude_from_ndk_sysroot: true, 2010} 2011 2012cc_object { 2013 name: "crtbegin_so", 2014 local_include_dirs: ["include"], 2015 srcs: ["arch-common/bionic/crtbegin_so.c"], 2016 2017 defaults: ["crt_so_defaults"], 2018 objs: [ 2019 "crtbrand", 2020 ], 2021} 2022 2023cc_object { 2024 name: "crtend_so", 2025 local_include_dirs: [ 2026 "private", // crtend_so.S depends on private/bionic_asm_arm64.h 2027 ], 2028 srcs: ["arch-common/bionic/crtend_so.S"], 2029 2030 defaults: ["crt_so_defaults"], 2031} 2032 2033cc_object { 2034 name: "crtbegin_static", 2035 2036 local_include_dirs: [ 2037 "include", 2038 "bionic", // crtbegin.c includes bionic/libc_init_common.h 2039 ], 2040 2041 cflags: ["-DCRTBEGIN_STATIC"], 2042 2043 srcs: ["arch-common/bionic/crtbegin.c"], 2044 objs: [ 2045 "crtbrand", 2046 ], 2047 defaults: ["crt_defaults"], 2048 // When using libc.a, we're using the latest library regardless of target API level. 2049 min_sdk_version: "current", 2050} 2051 2052cc_object { 2053 name: "crtbegin_dynamic", 2054 2055 local_include_dirs: [ 2056 "include", 2057 "bionic", // crtbegin.c includes bionic/libc_init_common.h 2058 ], 2059 srcs: ["arch-common/bionic/crtbegin.c"], 2060 objs: [ 2061 "crtbrand", 2062 ], 2063 target: { 2064 linux_bionic: { 2065 generated_sources: ["host_bionic_linker_asm"], 2066 objs: [ 2067 "linker_wrapper", 2068 ], 2069 }, 2070 }, 2071 defaults: ["crt_defaults"], 2072} 2073 2074cc_object { 2075 // We rename crtend.o to crtend_android.o to avoid a 2076 // name clash between gcc and bionic. 2077 name: "crtend_android", 2078 local_include_dirs: [ 2079 "private", // crtend.S depends on private/bionic_asm_arm64.h 2080 ], 2081 srcs: ["arch-common/bionic/crtend.S"], 2082 2083 defaults: ["crt_defaults"], 2084} 2085 2086cc_object { 2087 name: "crt_pad_segment", 2088 local_include_dirs: [ 2089 "private", // crt_pad_segment.S depends on private/bionic_asm_note.h 2090 ], 2091 srcs: ["arch-common/bionic/crt_pad_segment.S"], 2092 2093 defaults: ["crt_defaults"], 2094} 2095 2096cc_library_static { 2097 name: "note_memtag_heap_async", 2098 arch: { 2099 arm64: { 2100 srcs: ["arch-arm64/bionic/note_memtag_heap_async.S"], 2101 }, 2102 }, 2103 sdk_version: "minimum", 2104 2105 defaults: ["crt_and_memtag_defaults"], 2106} 2107 2108cc_library_static { 2109 name: "note_memtag_heap_sync", 2110 arch: { 2111 arm64: { 2112 srcs: ["arch-arm64/bionic/note_memtag_heap_sync.S"], 2113 }, 2114 }, 2115 sdk_version: "minimum", 2116 2117 defaults: ["crt_and_memtag_defaults"], 2118} 2119 2120// ======================================================== 2121// libc dependencies for baremetal Rust projects. 2122// ======================================================== 2123 2124// This library contains the following unresolved symbols: 2125// __errno 2126// abort 2127// async_safe_fatal_va_list 2128cc_library_static { 2129 name: "librust_baremetal", 2130 defaults: ["cc_baremetal_defaults"], 2131 header_libs: ["libc_headers"], 2132 include_dirs: [ 2133 "bionic/libc/async_safe/include", 2134 "bionic/libc/platform", 2135 ], 2136 cflags: [ 2137 "-Wall", 2138 "-Werror", 2139 ], 2140 srcs: [ 2141 "bionic/fortify.cpp", 2142 "bionic/strtol.cpp", 2143 ], 2144 arch: { 2145 arm64: { 2146 srcs: [ 2147 "arch-arm64/string/__memcpy_chk.S", 2148 ], 2149 }, 2150 riscv64: { 2151 srcs: [ 2152 "arch-riscv64/string/__memcpy_chk.S", 2153 ], 2154 }, 2155 }, 2156 whole_static_libs: [ 2157 "//external/llvm-libc:llvmlibc", 2158 "libarm-optimized-routines-mem", 2159 "libc_netbsd", 2160 ], 2161 system_shared_libs: [], 2162 nocrt: true, 2163 stl: "none", 2164 visibility: [ 2165 "//packages/modules/Virtualization/libs/libvmbase", 2166 ], 2167 2168 // b/358211032: This library gets linked into a rust rlib. Disable LTO 2169 // until cross-language lto is supported. 2170 lto: { 2171 never: true, 2172 }, 2173} 2174 2175// ======================================================== 2176// NDK headers. 2177// ======================================================== 2178 2179ndk_headers { 2180 name: "common_libc", 2181 from: "include", 2182 to: "", 2183 srcs: ["include/**/*.h"], 2184 license: "NOTICE", 2185 // These don't pass the bad verification we do because many of them are 2186 // arch-specific, and they aren't necessarily independently includable. 2187 // That's not much of a problem though, since C-incompaitibilities in the 2188 // UAPI headers should run into problems long before they reach us. 2189 skip_verification: true, 2190} 2191 2192ndk_headers { 2193 name: "libc_uapi", 2194 from: "kernel/uapi", 2195 to: "", 2196 srcs: [ 2197 "kernel/uapi/asm-generic/**/*.h", 2198 "kernel/uapi/drm/**/*.h", 2199 "kernel/uapi/linux/**/*.h", 2200 "kernel/uapi/misc/**/*.h", 2201 "kernel/uapi/mtd/**/*.h", 2202 "kernel/uapi/rdma/**/*.h", 2203 "kernel/uapi/scsi/**/*.h", 2204 "kernel/uapi/sound/**/*.h", 2205 "kernel/uapi/video/**/*.h", 2206 "kernel/uapi/xen/**/*.h", 2207 ], 2208 license: "NOTICE", 2209 skip_verification: true, 2210} 2211 2212ndk_headers { 2213 name: "libc_kernel_android_uapi_linux", 2214 from: "kernel/android/uapi/linux", 2215 to: "linux", 2216 srcs: ["kernel/android/uapi/linux/**/*.h"], 2217 license: "NOTICE", 2218} 2219 2220ndk_headers { 2221 name: "libc_kernel_android_scsi", 2222 from: "kernel/android/scsi/scsi", 2223 to: "scsi", 2224 srcs: ["kernel/android/scsi/**/*.h"], 2225 license: "NOTICE", 2226 skip_verification: true, 2227} 2228 2229ndk_headers { 2230 name: "libc_asm_arm", 2231 from: "kernel/uapi/asm-arm", 2232 to: "arm-linux-androideabi", 2233 srcs: ["kernel/uapi/asm-arm/**/*.h"], 2234 license: "NOTICE", 2235 skip_verification: true, 2236} 2237 2238ndk_headers { 2239 name: "libc_asm_arm64", 2240 from: "kernel/uapi/asm-arm64", 2241 to: "aarch64-linux-android", 2242 srcs: ["kernel/uapi/asm-arm64/**/*.h"], 2243 license: "NOTICE", 2244 skip_verification: true, 2245} 2246 2247ndk_headers { 2248 name: "libc_asm_riscv64", 2249 from: "kernel/uapi/asm-riscv", 2250 to: "riscv64-linux-android", 2251 srcs: ["kernel/uapi/asm-riscv/**/*.h"], 2252 license: "NOTICE", 2253 skip_verification: true, 2254} 2255 2256ndk_headers { 2257 name: "libc_asm_x86", 2258 from: "kernel/uapi/asm-x86", 2259 to: "i686-linux-android", 2260 srcs: ["kernel/uapi/asm-x86/**/*.h"], 2261 license: "NOTICE", 2262 skip_verification: true, 2263} 2264 2265ndk_headers { 2266 name: "libc_asm_x86_64", 2267 from: "kernel/uapi/asm-x86", 2268 to: "x86_64-linux-android", 2269 srcs: ["kernel/uapi/asm-x86/**/*.h"], 2270 license: "NOTICE", 2271 skip_verification: true, 2272} 2273 2274ndk_library { 2275 name: "libc", 2276 symbol_file: "libc.map.txt", 2277 first_version: "9", 2278} 2279 2280ndk_library { 2281 name: "libstdc++", 2282 symbol_file: "libstdc++.map.txt", 2283 first_version: "9", 2284} 2285 2286// Export these headers for toolbox to process 2287filegroup { 2288 name: "kernel_input_headers", 2289 srcs: [ 2290 "kernel/uapi/linux/input.h", 2291 "kernel/uapi/linux/input-event-codes.h", 2292 ], 2293} 2294 2295// Generate a syscall name / number mapping. These objects are text files 2296// (thanks to the -dD -E flags) and not binary files. They will then be 2297// consumed by the genseccomp.py script and converted into C++ code. 2298cc_defaults { 2299 name: "libseccomp_gen_syscall_nrs_defaults", 2300 recovery_available: true, 2301 srcs: ["seccomp/gen_syscall_nrs.cpp"], 2302 cflags: [ 2303 "-dD", 2304 "-E", 2305 "-Wall", 2306 "-Werror", 2307 "-nostdinc", 2308 ], 2309} 2310 2311cc_object { 2312 name: "libseccomp_gen_syscall_nrs_arm", 2313 defaults: ["libseccomp_gen_syscall_nrs_defaults"], 2314 local_include_dirs: [ 2315 "kernel/uapi/asm-arm", 2316 "kernel/uapi", 2317 ], 2318} 2319 2320cc_object { 2321 name: "libseccomp_gen_syscall_nrs_arm64", 2322 defaults: ["libseccomp_gen_syscall_nrs_defaults"], 2323 local_include_dirs: [ 2324 "kernel/uapi/asm-arm64", 2325 "kernel/uapi", 2326 ], 2327} 2328 2329cc_object { 2330 name: "libseccomp_gen_syscall_nrs_riscv64", 2331 defaults: ["libseccomp_gen_syscall_nrs_defaults"], 2332 local_include_dirs: [ 2333 "kernel/uapi/asm-riscv", 2334 "kernel/uapi", 2335 ], 2336} 2337 2338cc_object { 2339 name: "libseccomp_gen_syscall_nrs_x86", 2340 defaults: ["libseccomp_gen_syscall_nrs_defaults"], 2341 srcs: ["seccomp/gen_syscall_nrs_x86.cpp"], 2342 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"], 2343 local_include_dirs: [ 2344 "kernel/uapi/asm-x86", 2345 "kernel/uapi", 2346 ], 2347} 2348 2349cc_object { 2350 name: "libseccomp_gen_syscall_nrs_x86_64", 2351 defaults: ["libseccomp_gen_syscall_nrs_defaults"], 2352 srcs: ["seccomp/gen_syscall_nrs_x86_64.cpp"], 2353 exclude_srcs: ["seccomp/gen_syscall_nrs.cpp"], 2354 local_include_dirs: [ 2355 "kernel/uapi/asm-x86", 2356 "kernel/uapi", 2357 ], 2358} 2359 2360filegroup { 2361 name: "all_kernel_uapi_headers", 2362 srcs: ["kernel/uapi/**/*.h"], 2363} 2364 2365cc_genrule { 2366 name: "func_to_syscall_nrs", 2367 recovery_available: true, 2368 cmd: "$(location genfunctosyscallnrs) --out-dir=$(genDir) $(in)", 2369 2370 tools: ["genfunctosyscallnrs"], 2371 2372 srcs: [ 2373 "SYSCALLS.TXT", 2374 ], 2375 2376 arch: { 2377 arm: { 2378 srcs: [ 2379 ":libseccomp_gen_syscall_nrs_arm", 2380 ":libseccomp_gen_syscall_nrs_arm64", 2381 ], 2382 }, 2383 arm64: { 2384 srcs: [ 2385 ":libseccomp_gen_syscall_nrs_arm", 2386 ":libseccomp_gen_syscall_nrs_arm64", 2387 ], 2388 }, 2389 riscv64: { 2390 srcs: [":libseccomp_gen_syscall_nrs_riscv64"], 2391 }, 2392 x86: { 2393 srcs: [ 2394 ":libseccomp_gen_syscall_nrs_x86", 2395 ":libseccomp_gen_syscall_nrs_x86_64", 2396 ], 2397 }, 2398 x86_64: { 2399 srcs: [ 2400 ":libseccomp_gen_syscall_nrs_x86", 2401 ":libseccomp_gen_syscall_nrs_x86_64", 2402 ], 2403 }, 2404 }, 2405 2406 out: [ 2407 "func_to_syscall_nrs.h", 2408 ], 2409} 2410 2411// SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT = SECCOMP_BLOCKLIST_APP.txt - setresgid* 2412genrule { 2413 name: "generate_app_zygote_blocklist", 2414 out: ["SECCOMP_BLOCKLIST_APP_ZYGOTE.TXT"], 2415 srcs: ["SECCOMP_BLOCKLIST_APP.TXT"], 2416 cmd: "grep -v '^int[ \t]*setresgid' $(in) > $(out)", 2417} 2418 2419filegroup { 2420 name: "seccomp_syscalls_sources_zygote", 2421 srcs: [ 2422 "SYSCALLS.TXT", 2423 "SECCOMP_ALLOWLIST_COMMON.TXT", 2424 "SECCOMP_ALLOWLIST_APP.TXT", 2425 "SECCOMP_BLOCKLIST_COMMON.TXT", 2426 "SECCOMP_PRIORITY.TXT", 2427 ":generate_app_zygote_blocklist", 2428 ], 2429} 2430 2431filegroup { 2432 name: "seccomp_syscalls_sources_app", 2433 srcs: [ 2434 "SYSCALLS.TXT", 2435 "SECCOMP_ALLOWLIST_COMMON.TXT", 2436 "SECCOMP_ALLOWLIST_APP.TXT", 2437 "SECCOMP_BLOCKLIST_COMMON.TXT", 2438 "SECCOMP_BLOCKLIST_APP.TXT", 2439 "SECCOMP_PRIORITY.TXT", 2440 ], 2441} 2442 2443filegroup { 2444 name: "seccomp_syscalls_sources_system", 2445 srcs: [ 2446 "SYSCALLS.TXT", 2447 "SECCOMP_ALLOWLIST_COMMON.TXT", 2448 "SECCOMP_ALLOWLIST_SYSTEM.TXT", 2449 "SECCOMP_BLOCKLIST_COMMON.TXT", 2450 "SECCOMP_PRIORITY.TXT", 2451 ], 2452} 2453 2454cc_genrule { 2455 name: "libseccomp_policy_app_zygote_sources_x86", 2456 recovery_available: true, 2457 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)", 2458 tools: ["genseccomp"], 2459 srcs: [ 2460 ":seccomp_syscalls_sources_zygote", 2461 ":libseccomp_gen_syscall_nrs_x86", 2462 ":libseccomp_gen_syscall_nrs_x86_64", 2463 ], 2464 out: [ 2465 "x86_app_zygote_policy.cpp", 2466 "x86_64_app_zygote_policy.cpp", 2467 ], 2468 enabled: false, 2469 arch: { 2470 x86: { 2471 enabled: true, 2472 }, 2473 x86_64: { 2474 enabled: true, 2475 }, 2476 }, 2477} 2478 2479cc_genrule { 2480 name: "libseccomp_policy_app_zygote_sources_arm", 2481 recovery_available: true, 2482 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)", 2483 tools: ["genseccomp"], 2484 srcs: [ 2485 ":seccomp_syscalls_sources_zygote", 2486 ":libseccomp_gen_syscall_nrs_arm", 2487 ":libseccomp_gen_syscall_nrs_arm64", 2488 ], 2489 out: [ 2490 "arm_app_zygote_policy.cpp", 2491 "arm64_app_zygote_policy.cpp", 2492 ], 2493 enabled: false, 2494 arch: { 2495 arm: { 2496 enabled: true, 2497 }, 2498 arm64: { 2499 enabled: true, 2500 }, 2501 }, 2502} 2503 2504cc_genrule { 2505 name: "libseccomp_policy_app_zygote_sources_riscv64", 2506 recovery_available: true, 2507 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app_zygote $(in)", 2508 tools: ["genseccomp"], 2509 srcs: [ 2510 ":seccomp_syscalls_sources_zygote", 2511 ":libseccomp_gen_syscall_nrs_riscv64", 2512 ], 2513 out: [ 2514 "riscv64_app_zygote_policy.cpp", 2515 ], 2516 enabled: false, 2517 arch: { 2518 riscv64: { 2519 enabled: true, 2520 }, 2521 }, 2522} 2523 2524cc_genrule { 2525 name: "libseccomp_policy_app_sources_x86", 2526 recovery_available: true, 2527 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)", 2528 tools: ["genseccomp"], 2529 srcs: [ 2530 ":seccomp_syscalls_sources_app", 2531 ":libseccomp_gen_syscall_nrs_x86", 2532 ":libseccomp_gen_syscall_nrs_x86_64", 2533 ], 2534 out: [ 2535 "x86_app_policy.cpp", 2536 "x86_64_app_policy.cpp", 2537 ], 2538 enabled: false, 2539 arch: { 2540 x86: { 2541 enabled: true, 2542 }, 2543 x86_64: { 2544 enabled: true, 2545 }, 2546 }, 2547} 2548 2549cc_genrule { 2550 name: "libseccomp_policy_app_sources_arm", 2551 recovery_available: true, 2552 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)", 2553 tools: ["genseccomp"], 2554 srcs: [ 2555 ":seccomp_syscalls_sources_app", 2556 ":libseccomp_gen_syscall_nrs_arm", 2557 ":libseccomp_gen_syscall_nrs_arm64", 2558 ], 2559 out: [ 2560 "arm_app_policy.cpp", 2561 "arm64_app_policy.cpp", 2562 ], 2563 enabled: false, 2564 arch: { 2565 arm: { 2566 enabled: true, 2567 }, 2568 arm64: { 2569 enabled: true, 2570 }, 2571 }, 2572} 2573 2574cc_genrule { 2575 name: "libseccomp_policy_app_sources_riscv64", 2576 recovery_available: true, 2577 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=app $(in)", 2578 tools: ["genseccomp"], 2579 srcs: [ 2580 ":seccomp_syscalls_sources_app", 2581 ":libseccomp_gen_syscall_nrs_riscv64", 2582 ], 2583 out: [ 2584 "riscv64_app_policy.cpp", 2585 ], 2586 enabled: false, 2587 arch: { 2588 riscv64: { 2589 enabled: true, 2590 }, 2591 }, 2592} 2593 2594cc_genrule { 2595 name: "libseccomp_policy_system_sources_x86", 2596 recovery_available: true, 2597 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)", 2598 tools: ["genseccomp"], 2599 srcs: [ 2600 ":seccomp_syscalls_sources_system", 2601 ":libseccomp_gen_syscall_nrs_x86", 2602 ":libseccomp_gen_syscall_nrs_x86_64", 2603 ], 2604 out: [ 2605 "x86_system_policy.cpp", 2606 "x86_64_system_policy.cpp", 2607 ], 2608 enabled: false, 2609 arch: { 2610 x86: { 2611 enabled: true, 2612 }, 2613 x86_64: { 2614 enabled: true, 2615 }, 2616 }, 2617} 2618 2619cc_genrule { 2620 name: "libseccomp_policy_system_sources_arm", 2621 recovery_available: true, 2622 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)", 2623 tools: ["genseccomp"], 2624 srcs: [ 2625 ":seccomp_syscalls_sources_system", 2626 ":libseccomp_gen_syscall_nrs_arm", 2627 ":libseccomp_gen_syscall_nrs_arm64", 2628 ], 2629 out: [ 2630 "arm_system_policy.cpp", 2631 "arm64_system_policy.cpp", 2632 ], 2633 enabled: false, 2634 arch: { 2635 arm: { 2636 enabled: true, 2637 }, 2638 arm64: { 2639 enabled: true, 2640 }, 2641 }, 2642} 2643 2644cc_genrule { 2645 name: "libseccomp_policy_system_sources_riscv64", 2646 recovery_available: true, 2647 cmd: "$(location genseccomp) --out-dir=$(genDir) --name-modifier=system $(in)", 2648 tools: ["genseccomp"], 2649 srcs: [ 2650 ":seccomp_syscalls_sources_system", 2651 ":libseccomp_gen_syscall_nrs_riscv64", 2652 ], 2653 out: [ 2654 "riscv64_system_policy.cpp", 2655 ], 2656 enabled: false, 2657 arch: { 2658 riscv64: { 2659 enabled: true, 2660 }, 2661 }, 2662} 2663 2664cc_library { 2665 name: "libseccomp_policy", 2666 recovery_available: true, 2667 generated_headers: ["func_to_syscall_nrs"], 2668 2669 arch: { 2670 arm: { 2671 generated_sources: [ 2672 "libseccomp_policy_app_sources_arm", 2673 "libseccomp_policy_app_zygote_sources_arm", 2674 "libseccomp_policy_system_sources_arm", 2675 ], 2676 }, 2677 arm64: { 2678 generated_sources: [ 2679 "libseccomp_policy_app_sources_arm", 2680 "libseccomp_policy_app_zygote_sources_arm", 2681 "libseccomp_policy_system_sources_arm", 2682 ], 2683 }, 2684 riscv64: { 2685 generated_sources: [ 2686 "libseccomp_policy_app_sources_riscv64", 2687 "libseccomp_policy_app_zygote_sources_riscv64", 2688 "libseccomp_policy_system_sources_riscv64", 2689 ], 2690 }, 2691 x86: { 2692 generated_sources: [ 2693 "libseccomp_policy_app_sources_x86", 2694 "libseccomp_policy_app_zygote_sources_x86", 2695 "libseccomp_policy_system_sources_x86", 2696 ], 2697 }, 2698 x86_64: { 2699 generated_sources: [ 2700 "libseccomp_policy_app_sources_x86", 2701 "libseccomp_policy_app_zygote_sources_x86", 2702 "libseccomp_policy_system_sources_x86", 2703 ], 2704 }, 2705 }, 2706 2707 srcs: [ 2708 "seccomp/seccomp_policy.cpp", 2709 ], 2710 2711 export_include_dirs: ["seccomp/include"], 2712 cflags: [ 2713 "-Wall", 2714 "-Werror", 2715 ], 2716 shared: { 2717 shared_libs: ["libbase"], 2718 }, 2719 static: { 2720 static_libs: ["libbase"], 2721 }, 2722} 2723 2724cc_library_host_static { 2725 name: "libfts", 2726 srcs: [ 2727 "bionic/fts.c", 2728 "upstream-openbsd/lib/libc/stdlib/recallocarray.c", 2729 ], 2730 export_include_dirs: ["fts/include"], 2731 local_include_dirs: [ 2732 "private", 2733 "upstream-openbsd/android/include", 2734 ], 2735 cflags: [ 2736 "-include openbsd-compat.h", 2737 "-Wno-unused-parameter", 2738 ], 2739 enabled: false, 2740 target: { 2741 musl: { 2742 enabled: true, 2743 }, 2744 }, 2745 stl: "none", 2746} 2747 2748cc_library_host_static { 2749 name: "libexecinfo", 2750 visibility: ["//external/musl"], 2751 srcs: ["bionic/execinfo.cpp"], 2752 export_include_dirs: ["execinfo/include"], 2753 local_include_dirs: ["private"], 2754 enabled: false, 2755 target: { 2756 musl: { 2757 enabled: true, 2758 system_shared_libs: [], 2759 header_libs: ["libc_musl_headers"], 2760 }, 2761 }, 2762 stl: "none", 2763} 2764 2765cc_library_host_static { 2766 name: "libb64", 2767 visibility: ["//external/musl"], 2768 srcs: ["upstream-openbsd/lib/libc/net/base64.c"], 2769 export_include_dirs: ["b64/include"], 2770 local_include_dirs: [ 2771 "private", 2772 "upstream-openbsd/android/include", 2773 ], 2774 cflags: [ 2775 "-include openbsd-compat.h", 2776 ], 2777 enabled: false, 2778 target: { 2779 musl: { 2780 enabled: true, 2781 system_shared_libs: [], 2782 header_libs: ["libc_musl_headers"], 2783 }, 2784 }, 2785 stl: "none", 2786} 2787 2788// Export kernel uapi headers to be used in the musl sysroot. 2789// Also include the execinfo headers for the libexecinfo and the 2790// b64 headers for libb64 embedded in musl libc. 2791cc_genrule { 2792 name: "libc_musl_sysroot_bionic_headers", 2793 visibility: ["//external/musl"], 2794 host_supported: true, 2795 device_supported: false, 2796 enabled: false, 2797 target: { 2798 musl: { 2799 enabled: true, 2800 }, 2801 }, 2802 srcs: [ 2803 "kernel/uapi/**/*.h", 2804 "kernel/android/**/*.h", 2805 "execinfo/include/**/*.h", 2806 "b64/include/**/*.h", 2807 2808 "NOTICE", 2809 2810 ":libc_musl_sysroot_bionic_arch_headers", 2811 ], 2812 out: ["libc_musl_sysroot_bionic_headers.zip"], 2813 tools: [ 2814 "soong_zip", 2815 "merge_zips", 2816 "zip2zip", 2817 ], 2818 cmd: "BIONIC_LIBC_DIR=$$(dirname $(location NOTICE)) && " + 2819 "$(location soong_zip) -o $(genDir)/sysroot.zip -symlinks=false" + 2820 // NOTICE 2821 " -j -f $(location NOTICE) " + 2822 // headers 2823 " -P include " + 2824 " -C $${BIONIC_LIBC_DIR}/kernel/uapi " + 2825 " -D $${BIONIC_LIBC_DIR}/kernel/uapi " + 2826 " -C $${BIONIC_LIBC_DIR}/kernel/android/scsi " + 2827 " -D $${BIONIC_LIBC_DIR}/kernel/android/scsi " + 2828 " -C $${BIONIC_LIBC_DIR}/kernel/android/uapi " + 2829 " -D $${BIONIC_LIBC_DIR}/kernel/android/uapi " + 2830 " -C $${BIONIC_LIBC_DIR}/execinfo/include " + 2831 " -D $${BIONIC_LIBC_DIR}/execinfo/include " + 2832 " -C $${BIONIC_LIBC_DIR}/b64/include " + 2833 " -D $${BIONIC_LIBC_DIR}/b64/include " + 2834 " && " + 2835 "$(location zip2zip) -i $(genDir)/sysroot.zip -o $(genDir)/sysroot-renamed.zip " + 2836 " -x **/BUILD " + 2837 " include/**/*:include/ " + 2838 " NOTICE:NOTICE.bionic " + 2839 " && " + 2840 "$(location merge_zips) $(out) $(location :libc_musl_sysroot_bionic_arch_headers) $(genDir)/sysroot-renamed.zip", 2841} 2842 2843// The architecture-specific bits have to be handled separately because the label varies based 2844// on architecture, which prevents using $(locations) to find them and requires using $(in) 2845// instead, which would mix in all the other files if this were part of the main libc_musl_sysroot 2846// genrule. 2847cc_genrule { 2848 name: "libc_musl_sysroot_bionic_arch_headers", 2849 visibility: ["//visibility:private"], 2850 host_supported: true, 2851 device_supported: false, 2852 enabled: false, 2853 target: { 2854 musl: { 2855 enabled: true, 2856 }, 2857 }, 2858 arch: { 2859 arm: { 2860 srcs: ["kernel/uapi/asm-arm/**/*.h"], 2861 }, 2862 arm64: { 2863 srcs: ["kernel/uapi/asm-arm64/**/*.h"], 2864 }, 2865 x86: { 2866 srcs: ["kernel/uapi/asm-x86/**/*.h"], 2867 }, 2868 x86_64: { 2869 srcs: ["kernel/uapi/asm-x86/**/*.h"], 2870 }, 2871 }, 2872 out: ["libc_musl_sysroot_bionic_arch_headers.zip"], 2873 tools: ["soong_zip"], 2874 cmd: "includes=($(in)) && $(location soong_zip) -o $(out) -P include/asm -j -D $$(dirname $${includes[0]})", 2875} 2876 2877cc_genrule { 2878 name: "bionic_sysroot_crt_objects", 2879 visibility: ["//visibility:private"], 2880 out: ["bionic_sysroot_crt_objects.zip"], 2881 tools: ["soong_zip"], 2882 srcs: [ 2883 ":crtbegin_dynamic", 2884 ":crtbegin_so", 2885 ":crtbegin_static", 2886 ":crtend_android", 2887 ":crtend_so", 2888 ], 2889 cmd: "$(location soong_zip) -o $(out) -j " + 2890 "-f $(location :crtbegin_dynamic) " + 2891 "-f $(location :crtbegin_so) " + 2892 "-f $(location :crtbegin_static) " + 2893 "-f $(location :crtend_android) " + 2894 "-f $(location :crtend_so)", 2895 dist: { 2896 targets: ["bionic_sysroot_crt_objects"], 2897 }, 2898 arch: { 2899 arm: { 2900 dist: { 2901 suffix: "_arm", 2902 }, 2903 }, 2904 arm64: { 2905 dist: { 2906 suffix: "_arm64", 2907 }, 2908 }, 2909 riscv64: { 2910 dist: { 2911 suffix: "_riscv64", 2912 }, 2913 }, 2914 x86: { 2915 dist: { 2916 suffix: "_x86", 2917 }, 2918 }, 2919 x86_64: { 2920 dist: { 2921 suffix: "_x86_64", 2922 }, 2923 }, 2924 }, 2925} 2926 2927filegroup { 2928 name: "linux_capability_header", 2929 srcs: ["kernel/uapi/linux/capability.h"], 2930} 2931