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