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