Home | History | Annotate | Download | only in libc
      1 // Define the common source files for all the libc instances
      2 // =========================================================
      3 libc_common_src_files = [
      4     "bionic/ether_aton.c",
      5     "bionic/ether_ntoa.c",
      6     "bionic/fts.c",
      7     "bionic/getpriority.c",
      8     "bionic/initgroups.c",
      9     "bionic/isatty.c",
     10     "bionic/memmem.c",
     11     "bionic/pututline.c",
     12     "bionic/sched_cpualloc.c",
     13     "bionic/sched_cpucount.c",
     14     "bionic/sigblock.c",
     15     "bionic/siginterrupt.c",
     16     "bionic/sigsetmask.c",
     17     "bionic/system_properties_compat.c",
     18     "stdio/fread.c",
     19     "stdio/refill.c",
     20     "stdio/snprintf.c",
     21     "stdio/sprintf.c",
     22     "stdio/stdio.cpp",
     23     "stdio/stdio_ext.cpp",
     24     "stdlib/atexit.c",
     25     "stdlib/exit.c",
     26 
     27     // Fortify implementations of libc functions.
     28     "bionic/__FD_chk.cpp",
     29     "bionic/__fgets_chk.cpp",
     30     "bionic/__fread_chk.cpp",
     31     "bionic/__fwrite_chk.cpp",
     32     "bionic/__getcwd_chk.cpp",
     33     "bionic/__memchr_chk.cpp",
     34     "bionic/__memmove_chk.cpp",
     35     "bionic/__memrchr_chk.cpp",
     36     "bionic/__poll_chk.cpp",
     37     "bionic/__pread64_chk.cpp",
     38     "bionic/__pread_chk.cpp",
     39     "bionic/__pwrite64_chk.cpp",
     40     "bionic/__pwrite_chk.cpp",
     41     "bionic/__read_chk.cpp",
     42     "bionic/__readlink_chk.cpp",
     43     "bionic/__readlinkat_chk.cpp",
     44     "bionic/__recvfrom_chk.cpp",
     45     "bionic/__stpcpy_chk.cpp",
     46     "bionic/__stpncpy_chk.cpp",
     47     "bionic/__strchr_chk.cpp",
     48     "bionic/__strlcat_chk.cpp",
     49     "bionic/__strlcpy_chk.cpp",
     50     "bionic/__strlen_chk.cpp",
     51     "bionic/__strncat_chk.cpp",
     52     "bionic/__strncpy_chk.cpp",
     53     "bionic/__strrchr_chk.cpp",
     54     "bionic/__umask_chk.cpp",
     55     "bionic/__vsnprintf_chk.cpp",
     56     "bionic/__vsprintf_chk.cpp",
     57     "bionic/__write_chk.cpp",
     58 ]
     59 
     60 // Various kinds of cruft.
     61 // ========================================================
     62 libc_common_src_files += [
     63     "bionic/ndk_cruft.cpp",
     64 ]
     65 
     66 libc_common_src_files_32 = [
     67     "bionic/legacy_32_bit_support.cpp",
     68     "bionic/time64.c",
     69 ]
     70 
     71 // Define some common cflags
     72 // ========================================================
     73 cc_defaults {
     74     name: "libc_defaults",
     75     cflags: [
     76         "-D_LIBC=1",
     77         "-Wall",
     78         "-Wextra",
     79         "-Wunused",
     80 
     81         // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
     82         "-Werror=pointer-to-int-cast",
     83         "-Werror=int-to-pointer-cast",
     84         "-Werror=type-limits",
     85         "-Werror",
     86     ],
     87     // TODO: split out the asflags.
     88     asflags: [
     89         "-D_LIBC=1",
     90         "-Wall",
     91         "-Wextra",
     92         "-Wunused",
     93 
     94         // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
     95         "-Werror=pointer-to-int-cast",
     96         "-Werror=int-to-pointer-cast",
     97         "-Werror=type-limits",
     98         "-Werror",
     99     ],
    100     conlyflags: ["-std=gnu99"],
    101     cppflags: [],
    102     include_dirs: ["external/jemalloc/include"],
    103 
    104     arch: {
    105         // Clang/llvm has incompatible long double (fp128) for x86_64.
    106         // https://llvm.org/bugs/show_bug.cgi?id=23897
    107         x86_64: {
    108             clang: false,
    109         },
    110         // b/25291096, Clang/llvm compiled libc.so for mips/mips64 failed to boot.
    111         mips: {
    112             clang: false,
    113         },
    114         mips64: {
    115             clang: false,
    116         },
    117     },
    118 
    119     stl: "none",
    120     system_shared_libs: [],
    121     sanitize: ["never"],
    122     native_coverage: false,
    123 }
    124 
    125 // ANDROIDMK TRANSLATION ERROR: unsupported directive
    126 // ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
    127 //libc_common_cflags += ["-DDEBUG"]
    128 // ANDROIDMK TRANSLATION ERROR: unsupported directive
    129 // endif
    130 
    131 // ========================================================
    132 // libc_stack_protector.a - stack protector code
    133 // ========================================================
    134 //
    135 // Code that implements the stack protector (or that runs
    136 // before TLS has been set up) needs to be compiled with
    137 // -fno-stack-protector, since it accesses the stack canary
    138 // TLS slot.
    139 
    140 cc_library_static {
    141 
    142     srcs: [
    143         "bionic/__libc_init_main_thread.cpp",
    144         "bionic/__stack_chk_fail.cpp",
    145     ],
    146     arch: {
    147         arm64: {
    148             srcs: ["arch-arm64/bionic/__set_tls.c"],
    149         },
    150         x86: {
    151             srcs: ["arch-x86/bionic/__set_tls.c"],
    152         },
    153         x86_64: {
    154             srcs: ["arch-x86_64/bionic/__set_tls.c"],
    155         },
    156     },
    157 
    158     defaults: ["libc_defaults"],
    159     cflags: ["-fno-stack-protector"],
    160     name: "libc_stack_protector",
    161 }
    162 
    163 // libc_init_static.cpp also needs to be built without stack protector,
    164 // because it's responsible for setting up TLS for static executables.
    165 // This isn't the case for dynamic executables because the dynamic linker
    166 // has already set up the main thread's TLS.
    167 
    168 cc_library_static {
    169     name: "libc_init_static",
    170     defaults: ["libc_defaults"],
    171     srcs: ["bionic/libc_init_static.cpp"],
    172     cflags: ["-fno-stack-protector"],
    173 }
    174 
    175 
    176 // ========================================================
    177 // libc_tzcode.a - upstream 'tzcode' code
    178 // ========================================================
    179 
    180 cc_library_static {
    181 
    182     defaults: ["libc_defaults"],
    183     srcs: [
    184         "tzcode/**/*.c",
    185         "upstream-openbsd/lib/libc/time/wcsftime.c", // tzcode doesn't include wcsftime, so we use the OpenBSD one.
    186     ],
    187 
    188     cflags: [
    189         "-fvisibility=hidden",
    190         "-Wno-unused-parameter",
    191         // Don't use ridiculous amounts of stack.
    192         "-DALL_STATE",
    193         // Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
    194         "-DSTD_INSPIRED",
    195         // Obviously, we want to be thread-safe.
    196         "-DTHREAD_SAFE",
    197         // The name of the tm_gmtoff field in our struct tm.
    198         "-DTM_GMTOFF=tm_gmtoff",
    199         // Where we store our tzdata.
    200         "-DTZDIR=\\\"/system/usr/share/zoneinfo\\\"",
    201         // Include timezone and daylight globals.
    202         "-DUSG_COMPAT=1",
    203         // Use the empty string (instead of "   ") as the timezone abbreviation
    204         // fallback.
    205         "-DWILDABBR=\\\"\\\"",
    206         "-DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU",
    207         "-Dlint",
    208     ],
    209 
    210     local_include_dirs: ["tzcode/"],
    211     name: "libc_tzcode",
    212 }
    213 
    214 // ========================================================
    215 // libc_dns.a - modified NetBSD DNS code
    216 // ========================================================
    217 
    218 cc_library_static {
    219 
    220     defaults: ["libc_defaults"],
    221     srcs: [
    222         "dns/**/*.c",
    223 
    224         "upstream-netbsd/lib/libc/isc/ev_streams.c",
    225         "upstream-netbsd/lib/libc/isc/ev_timers.c",
    226         "upstream-netbsd/lib/libc/resolv/mtctxres.c",
    227     ],
    228 
    229     cflags: [
    230         "-DANDROID_CHANGES",
    231         "-DINET6",
    232         "-fvisibility=hidden",
    233         "-Wno-unused-parameter",
    234         "-include netbsd-compat.h",
    235     ],
    236 
    237     local_include_dirs: [
    238         "dns/include",
    239         "private",
    240         "upstream-netbsd/lib/libc/include",
    241         "upstream-netbsd/android/include",
    242     ],
    243 
    244     name: "libc_dns",
    245 }
    246 
    247 // ========================================================
    248 // libc_freebsd.a - upstream FreeBSD C library code
    249 // ========================================================
    250 //
    251 // These files are built with the freebsd-compat.h header file
    252 // automatically included.
    253 
    254 cc_library_static {
    255     defaults: ["libc_defaults"],
    256     srcs: [
    257         "upstream-freebsd/lib/libc/gen/ldexp.c",
    258         "upstream-freebsd/lib/libc/gen/sleep.c",
    259         "upstream-freebsd/lib/libc/gen/usleep.c",
    260         "upstream-freebsd/lib/libc/stdlib/getopt_long.c",
    261         "upstream-freebsd/lib/libc/stdlib/qsort.c",
    262         "upstream-freebsd/lib/libc/stdlib/quick_exit.c",
    263         "upstream-freebsd/lib/libc/stdlib/realpath.c",
    264         "upstream-freebsd/lib/libc/string/wcpcpy.c",
    265         "upstream-freebsd/lib/libc/string/wcpncpy.c",
    266         "upstream-freebsd/lib/libc/string/wcscasecmp.c",
    267         "upstream-freebsd/lib/libc/string/wcscat.c",
    268         "upstream-freebsd/lib/libc/string/wcschr.c",
    269         "upstream-freebsd/lib/libc/string/wcscmp.c",
    270         "upstream-freebsd/lib/libc/string/wcscpy.c",
    271         "upstream-freebsd/lib/libc/string/wcscspn.c",
    272         "upstream-freebsd/lib/libc/string/wcsdup.c",
    273         "upstream-freebsd/lib/libc/string/wcslcat.c",
    274         "upstream-freebsd/lib/libc/string/wcslen.c",
    275         "upstream-freebsd/lib/libc/string/wcsncasecmp.c",
    276         "upstream-freebsd/lib/libc/string/wcsncat.c",
    277         "upstream-freebsd/lib/libc/string/wcsncmp.c",
    278         "upstream-freebsd/lib/libc/string/wcsncpy.c",
    279         "upstream-freebsd/lib/libc/string/wcsnlen.c",
    280         "upstream-freebsd/lib/libc/string/wcspbrk.c",
    281         "upstream-freebsd/lib/libc/string/wcsrchr.c",
    282         "upstream-freebsd/lib/libc/string/wcsspn.c",
    283         "upstream-freebsd/lib/libc/string/wcstok.c",
    284         "upstream-freebsd/lib/libc/string/wmemchr.c",
    285         "upstream-freebsd/lib/libc/string/wmemcmp.c",
    286         "upstream-freebsd/lib/libc/string/wmemmove.c",
    287         "upstream-freebsd/lib/libc/string/wmemset.c",
    288     ],
    289     arch: {
    290         arm64: {
    291             exclude_srcs: [
    292                 "upstream-freebsd/lib/libc/string/wmemmove.c",
    293             ],
    294         },
    295         x86: {
    296             exclude_srcs: [
    297                 "upstream-freebsd/lib/libc/string/wcschr.c",
    298                 "upstream-freebsd/lib/libc/string/wcscmp.c",
    299                 "upstream-freebsd/lib/libc/string/wcslen.c",
    300                 "upstream-freebsd/lib/libc/string/wcsrchr.c",
    301             ],
    302             atom: {
    303                 exclude_srcs: [
    304                     "upstream-freebsd/lib/libc/string/wmemcmp.c",
    305                 ],
    306             },
    307             ssse3: {
    308                 exclude_srcs: [
    309                     "upstream-freebsd/lib/libc/string/wcscat.c",
    310                     "upstream-freebsd/lib/libc/string/wcscpy.c",
    311                 ],
    312             },
    313             sse4: {
    314                 exclude_srcs: [
    315                     "upstream-freebsd/lib/libc/string/wmemcmp.c",
    316                 ],
    317             },
    318         },
    319     },
    320 
    321     cflags: [
    322         "-Wno-sign-compare",
    323         "-Wno-uninitialized",
    324         "-include freebsd-compat.h",
    325     ],
    326 
    327     local_include_dirs: [
    328         "upstream-freebsd/android/include",
    329     ],
    330 
    331     name: "libc_freebsd",
    332 }
    333 
    334 // ========================================================
    335 // libc_netbsd.a - upstream NetBSD C library code
    336 // ========================================================
    337 //
    338 // These files are built with the netbsd-compat.h header file
    339 // automatically included.
    340 
    341 cc_library_static {
    342 
    343     defaults: ["libc_defaults"],
    344     srcs: [
    345         "upstream-netbsd/common/lib/libc/stdlib/random.c",
    346         "upstream-netbsd/lib/libc/gen/ftw.c",
    347         "upstream-netbsd/lib/libc/gen/nftw.c",
    348         "upstream-netbsd/lib/libc/gen/nice.c",
    349         "upstream-netbsd/lib/libc/gen/popen.c",
    350         "upstream-netbsd/lib/libc/gen/psignal.c",
    351         "upstream-netbsd/lib/libc/gen/utime.c",
    352         "upstream-netbsd/lib/libc/gen/utmp.c",
    353         "upstream-netbsd/lib/libc/inet/nsap_addr.c",
    354         "upstream-netbsd/lib/libc/regex/regcomp.c",
    355         "upstream-netbsd/lib/libc/regex/regerror.c",
    356         "upstream-netbsd/lib/libc/regex/regexec.c",
    357         "upstream-netbsd/lib/libc/regex/regfree.c",
    358         "upstream-netbsd/lib/libc/stdlib/bsearch.c",
    359         "upstream-netbsd/lib/libc/stdlib/div.c",
    360         "upstream-netbsd/lib/libc/stdlib/drand48.c",
    361         "upstream-netbsd/lib/libc/stdlib/erand48.c",
    362         "upstream-netbsd/lib/libc/stdlib/jrand48.c",
    363         "upstream-netbsd/lib/libc/stdlib/lcong48.c",
    364         "upstream-netbsd/lib/libc/stdlib/ldiv.c",
    365         "upstream-netbsd/lib/libc/stdlib/lldiv.c",
    366         "upstream-netbsd/lib/libc/stdlib/lrand48.c",
    367         "upstream-netbsd/lib/libc/stdlib/mrand48.c",
    368         "upstream-netbsd/lib/libc/stdlib/nrand48.c",
    369         "upstream-netbsd/lib/libc/stdlib/_rand48.c",
    370         "upstream-netbsd/lib/libc/stdlib/rand_r.c",
    371         "upstream-netbsd/lib/libc/stdlib/reallocarr.c",
    372         "upstream-netbsd/lib/libc/stdlib/seed48.c",
    373         "upstream-netbsd/lib/libc/stdlib/srand48.c",
    374         "upstream-netbsd/lib/libc/string/memccpy.c",
    375         "upstream-netbsd/lib/libc/string/strcasestr.c",
    376         "upstream-netbsd/lib/libc/string/strcoll.c",
    377         "upstream-netbsd/lib/libc/string/strxfrm.c",
    378     ],
    379     multilib: {
    380         lib32: {
    381             // LP32 cruft
    382             srcs: ["upstream-netbsd/common/lib/libc/hash/sha1/sha1.c"],
    383         },
    384     },
    385     cflags: [
    386         "-Wno-sign-compare",
    387         "-Wno-uninitialized",
    388         "-Wno-unused-parameter",
    389         "-DPOSIX_MISTAKE",
    390         "-include netbsd-compat.h",
    391     ],
    392 
    393     local_include_dirs: [
    394         "upstream-netbsd/android/include",
    395         "upstream-netbsd/lib/libc/include",
    396     ],
    397 
    398     name: "libc_netbsd",
    399 }
    400 
    401 // ========================================================
    402 // libc_openbsd_ndk.a - upstream OpenBSD C library code
    403 // that can be safely included in the libc_ndk.a (doesn't
    404 // contain any troublesome global data or constructors).
    405 // ========================================================
    406 //
    407 // These files are built with the openbsd-compat.h header file
    408 // automatically included.
    409 
    410 cc_library_static {
    411     name: "libc_openbsd_ndk",
    412     defaults: ["libc_defaults"],
    413     srcs: [
    414         "upstream-openbsd/lib/libc/compat-43/killpg.c",
    415         "upstream-openbsd/lib/libc/gen/alarm.c",
    416         "upstream-openbsd/lib/libc/gen/ctype_.c",
    417         "upstream-openbsd/lib/libc/gen/daemon.c",
    418         "upstream-openbsd/lib/libc/gen/err.c",
    419         "upstream-openbsd/lib/libc/gen/errx.c",
    420         "upstream-openbsd/lib/libc/gen/exec.c",
    421         "upstream-openbsd/lib/libc/gen/fnmatch.c",
    422         "upstream-openbsd/lib/libc/gen/ftok.c",
    423         "upstream-openbsd/lib/libc/gen/getprogname.c",
    424         "upstream-openbsd/lib/libc/gen/isctype.c",
    425         "upstream-openbsd/lib/libc/gen/setprogname.c",
    426         "upstream-openbsd/lib/libc/gen/time.c",
    427         "upstream-openbsd/lib/libc/gen/tolower_.c",
    428         "upstream-openbsd/lib/libc/gen/toupper_.c",
    429         "upstream-openbsd/lib/libc/gen/verr.c",
    430         "upstream-openbsd/lib/libc/gen/verrx.c",
    431         "upstream-openbsd/lib/libc/gen/vwarn.c",
    432         "upstream-openbsd/lib/libc/gen/vwarnx.c",
    433         "upstream-openbsd/lib/libc/gen/warn.c",
    434         "upstream-openbsd/lib/libc/gen/warnx.c",
    435         "upstream-openbsd/lib/libc/locale/btowc.c",
    436         "upstream-openbsd/lib/libc/locale/mbrlen.c",
    437         "upstream-openbsd/lib/libc/locale/mbstowcs.c",
    438         "upstream-openbsd/lib/libc/locale/mbtowc.c",
    439         "upstream-openbsd/lib/libc/locale/wcscoll.c",
    440         "upstream-openbsd/lib/libc/locale/wcstod.c",
    441         "upstream-openbsd/lib/libc/locale/wcstof.c",
    442         "upstream-openbsd/lib/libc/locale/wcstoimax.c",
    443         "upstream-openbsd/lib/libc/locale/wcstol.c",
    444         "upstream-openbsd/lib/libc/locale/wcstold.c",
    445         "upstream-openbsd/lib/libc/locale/wcstoll.c",
    446         "upstream-openbsd/lib/libc/locale/wcstombs.c",
    447         "upstream-openbsd/lib/libc/locale/wcstoul.c",
    448         "upstream-openbsd/lib/libc/locale/wcstoull.c",
    449         "upstream-openbsd/lib/libc/locale/wcstoumax.c",
    450         "upstream-openbsd/lib/libc/locale/wcsxfrm.c",
    451         "upstream-openbsd/lib/libc/locale/wctob.c",
    452         "upstream-openbsd/lib/libc/locale/wctomb.c",
    453         "upstream-openbsd/lib/libc/net/htonl.c",
    454         "upstream-openbsd/lib/libc/net/htons.c",
    455         "upstream-openbsd/lib/libc/net/inet_lnaof.c",
    456         "upstream-openbsd/lib/libc/net/inet_makeaddr.c",
    457         "upstream-openbsd/lib/libc/net/inet_netof.c",
    458         "upstream-openbsd/lib/libc/net/inet_ntoa.c",
    459         "upstream-openbsd/lib/libc/net/inet_ntop.c",
    460         "upstream-openbsd/lib/libc/net/inet_pton.c",
    461         "upstream-openbsd/lib/libc/net/ntohl.c",
    462         "upstream-openbsd/lib/libc/net/ntohs.c",
    463         "upstream-openbsd/lib/libc/net/res_random.c",
    464         "upstream-openbsd/lib/libc/stdio/asprintf.c",
    465         "upstream-openbsd/lib/libc/stdio/clrerr.c",
    466         "upstream-openbsd/lib/libc/stdio/dprintf.c",
    467         "upstream-openbsd/lib/libc/stdio/feof.c",
    468         "upstream-openbsd/lib/libc/stdio/ferror.c",
    469         "upstream-openbsd/lib/libc/stdio/fflush.c",
    470         "upstream-openbsd/lib/libc/stdio/fgetc.c",
    471         "upstream-openbsd/lib/libc/stdio/fgetln.c",
    472         "upstream-openbsd/lib/libc/stdio/fgets.c",
    473         "upstream-openbsd/lib/libc/stdio/fgetwc.c",
    474         "upstream-openbsd/lib/libc/stdio/fgetws.c",
    475         "upstream-openbsd/lib/libc/stdio/flags.c",
    476         "upstream-openbsd/lib/libc/stdio/fmemopen.c",
    477         "upstream-openbsd/lib/libc/stdio/fprintf.c",
    478         "upstream-openbsd/lib/libc/stdio/fpurge.c",
    479         "upstream-openbsd/lib/libc/stdio/fputc.c",
    480         "upstream-openbsd/lib/libc/stdio/fputs.c",
    481         "upstream-openbsd/lib/libc/stdio/fputwc.c",
    482         "upstream-openbsd/lib/libc/stdio/fputws.c",
    483         "upstream-openbsd/lib/libc/stdio/fscanf.c",
    484         "upstream-openbsd/lib/libc/stdio/fvwrite.c",
    485         "upstream-openbsd/lib/libc/stdio/fwalk.c",
    486         "upstream-openbsd/lib/libc/stdio/fwide.c",
    487         "upstream-openbsd/lib/libc/stdio/fwprintf.c",
    488         "upstream-openbsd/lib/libc/stdio/fwrite.c",
    489         "upstream-openbsd/lib/libc/stdio/fwscanf.c",
    490         "upstream-openbsd/lib/libc/stdio/getc.c",
    491         "upstream-openbsd/lib/libc/stdio/getchar.c",
    492         "upstream-openbsd/lib/libc/stdio/getdelim.c",
    493         "upstream-openbsd/lib/libc/stdio/getline.c",
    494         "upstream-openbsd/lib/libc/stdio/gets.c",
    495         "upstream-openbsd/lib/libc/stdio/getwc.c",
    496         "upstream-openbsd/lib/libc/stdio/getwchar.c",
    497         "upstream-openbsd/lib/libc/stdio/makebuf.c",
    498         "upstream-openbsd/lib/libc/stdio/mktemp.c",
    499         "upstream-openbsd/lib/libc/stdio/open_memstream.c",
    500         "upstream-openbsd/lib/libc/stdio/open_wmemstream.c",
    501         "upstream-openbsd/lib/libc/stdio/perror.c",
    502         "upstream-openbsd/lib/libc/stdio/printf.c",
    503         "upstream-openbsd/lib/libc/stdio/putc.c",
    504         "upstream-openbsd/lib/libc/stdio/putchar.c",
    505         "upstream-openbsd/lib/libc/stdio/puts.c",
    506         "upstream-openbsd/lib/libc/stdio/putwc.c",
    507         "upstream-openbsd/lib/libc/stdio/putwchar.c",
    508         "upstream-openbsd/lib/libc/stdio/remove.c",
    509         "upstream-openbsd/lib/libc/stdio/rewind.c",
    510         "upstream-openbsd/lib/libc/stdio/rget.c",
    511         "upstream-openbsd/lib/libc/stdio/scanf.c",
    512         "upstream-openbsd/lib/libc/stdio/setbuf.c",
    513         "upstream-openbsd/lib/libc/stdio/setbuffer.c",
    514         "upstream-openbsd/lib/libc/stdio/setvbuf.c",
    515         "upstream-openbsd/lib/libc/stdio/sscanf.c",
    516         "upstream-openbsd/lib/libc/stdio/swprintf.c",
    517         "upstream-openbsd/lib/libc/stdio/swscanf.c",
    518         "upstream-openbsd/lib/libc/stdio/tempnam.c",
    519         "upstream-openbsd/lib/libc/stdio/tmpnam.c",
    520         "upstream-openbsd/lib/libc/stdio/ungetc.c",
    521         "upstream-openbsd/lib/libc/stdio/ungetwc.c",
    522         "upstream-openbsd/lib/libc/stdio/vasprintf.c",
    523         "upstream-openbsd/lib/libc/stdio/vdprintf.c",
    524         "upstream-openbsd/lib/libc/stdio/vfprintf.c",
    525         "upstream-openbsd/lib/libc/stdio/vfscanf.c",
    526         "upstream-openbsd/lib/libc/stdio/vfwprintf.c",
    527         "upstream-openbsd/lib/libc/stdio/vfwscanf.c",
    528         "upstream-openbsd/lib/libc/stdio/vprintf.c",
    529         "upstream-openbsd/lib/libc/stdio/vscanf.c",
    530         "upstream-openbsd/lib/libc/stdio/vsnprintf.c",
    531         "upstream-openbsd/lib/libc/stdio/vsprintf.c",
    532         "upstream-openbsd/lib/libc/stdio/vsscanf.c",
    533         "upstream-openbsd/lib/libc/stdio/vswprintf.c",
    534         "upstream-openbsd/lib/libc/stdio/vswscanf.c",
    535         "upstream-openbsd/lib/libc/stdio/vwprintf.c",
    536         "upstream-openbsd/lib/libc/stdio/vwscanf.c",
    537         "upstream-openbsd/lib/libc/stdio/wbuf.c",
    538         "upstream-openbsd/lib/libc/stdio/wprintf.c",
    539         "upstream-openbsd/lib/libc/stdio/wscanf.c",
    540         "upstream-openbsd/lib/libc/stdio/wsetup.c",
    541         "upstream-openbsd/lib/libc/stdlib/abs.c",
    542         "upstream-openbsd/lib/libc/stdlib/atoi.c",
    543         "upstream-openbsd/lib/libc/stdlib/atol.c",
    544         "upstream-openbsd/lib/libc/stdlib/atoll.c",
    545         "upstream-openbsd/lib/libc/stdlib/getenv.c",
    546         "upstream-openbsd/lib/libc/stdlib/insque.c",
    547         "upstream-openbsd/lib/libc/stdlib/imaxabs.c",
    548         "upstream-openbsd/lib/libc/stdlib/imaxdiv.c",
    549         "upstream-openbsd/lib/libc/stdlib/labs.c",
    550         "upstream-openbsd/lib/libc/stdlib/llabs.c",
    551         "upstream-openbsd/lib/libc/stdlib/lsearch.c",
    552         "upstream-openbsd/lib/libc/stdlib/reallocarray.c",
    553         "upstream-openbsd/lib/libc/stdlib/remque.c",
    554         "upstream-openbsd/lib/libc/stdlib/setenv.c",
    555         "upstream-openbsd/lib/libc/stdlib/strtoimax.c",
    556         "upstream-openbsd/lib/libc/stdlib/strtol.c",
    557         "upstream-openbsd/lib/libc/stdlib/strtoll.c",
    558         "upstream-openbsd/lib/libc/stdlib/strtoul.c",
    559         "upstream-openbsd/lib/libc/stdlib/strtoull.c",
    560         "upstream-openbsd/lib/libc/stdlib/strtoumax.c",
    561         "upstream-openbsd/lib/libc/stdlib/system.c",
    562         "upstream-openbsd/lib/libc/stdlib/tfind.c",
    563         "upstream-openbsd/lib/libc/stdlib/tsearch.c",
    564         "upstream-openbsd/lib/libc/string/strcasecmp.c",
    565         "upstream-openbsd/lib/libc/string/strcspn.c",
    566         "upstream-openbsd/lib/libc/string/strdup.c",
    567         "upstream-openbsd/lib/libc/string/strndup.c",
    568         "upstream-openbsd/lib/libc/string/strpbrk.c",
    569         "upstream-openbsd/lib/libc/string/strsep.c",
    570         "upstream-openbsd/lib/libc/string/strspn.c",
    571         "upstream-openbsd/lib/libc/string/strstr.c",
    572         "upstream-openbsd/lib/libc/string/strtok.c",
    573         "upstream-openbsd/lib/libc/string/wmemcpy.c",
    574         "upstream-openbsd/lib/libc/string/wcslcpy.c",
    575         "upstream-openbsd/lib/libc/string/wcsstr.c",
    576         "upstream-openbsd/lib/libc/string/wcswidth.c",
    577     ],
    578 
    579     cflags: [
    580         "-Wno-sign-compare",
    581         "-Wno-uninitialized",
    582         "-Wno-unused-parameter",
    583         "-include openbsd-compat.h",
    584     ],
    585 
    586     local_include_dirs: [
    587         "private",
    588         "stdio",
    589         "upstream-openbsd/android/include",
    590         "upstream-openbsd/lib/libc/include",
    591         "upstream-openbsd/lib/libc/gdtoa/",
    592     ],
    593 }
    594 
    595 // ========================================================
    596 // libc_openbsd.a - upstream OpenBSD C library code
    597 // ========================================================
    598 //
    599 // These files are built with the openbsd-compat.h header file
    600 // automatically included.
    601 cc_library_static {
    602     defaults: ["libc_defaults"],
    603     srcs: [
    604         // These two depend on getentropy_linux.c, which isn't in libc_ndk.a.
    605         "upstream-openbsd/lib/libc/crypt/arc4random.c",
    606         "upstream-openbsd/lib/libc/crypt/arc4random_uniform.c",
    607 
    608         // May be overriden by per-arch optimized versions
    609         "upstream-openbsd/lib/libc/string/memchr.c",
    610         "upstream-openbsd/lib/libc/string/memmove.c",
    611         "upstream-openbsd/lib/libc/string/memrchr.c",
    612         "upstream-openbsd/lib/libc/string/stpcpy.c",
    613         "upstream-openbsd/lib/libc/string/stpncpy.c",
    614         "upstream-openbsd/lib/libc/string/strcat.c",
    615         "upstream-openbsd/lib/libc/string/strcpy.c",
    616         "upstream-openbsd/lib/libc/string/strlcat.c",
    617         "upstream-openbsd/lib/libc/string/strlcpy.c",
    618         "upstream-openbsd/lib/libc/string/strncat.c",
    619         "upstream-openbsd/lib/libc/string/strncmp.c",
    620         "upstream-openbsd/lib/libc/string/strncpy.c",
    621     ],
    622     multilib: {
    623         lib32: {
    624             // LP32 cruft
    625             srcs: ["upstream-openbsd/lib/libc/stdio/putw.c"],
    626         },
    627     },
    628 
    629     arch: {
    630         arm: {
    631             exclude_srcs: [
    632                 "upstream-openbsd/lib/libc/string/strcpy.c",
    633             ],
    634             cortex_a7: {
    635                 exclude_srcs: [
    636                     "upstream-openbsd/lib/libc/string/memmove.c",
    637                     "upstream-openbsd/lib/libc/string/stpcpy.c",
    638                     "upstream-openbsd/lib/libc/string/strcat.c",
    639                 ],
    640             },
    641             cortex_a53: {
    642                 exclude_srcs: [
    643                     "upstream-openbsd/lib/libc/string/memmove.c",
    644                     "upstream-openbsd/lib/libc/string/stpcpy.c",
    645                     "upstream-openbsd/lib/libc/string/strcat.c",
    646                 ],
    647             },
    648             cortex_a53_a57: {
    649                 exclude_srcs: [
    650                     "upstream-openbsd/lib/libc/string/memmove.c",
    651                     "upstream-openbsd/lib/libc/string/stpcpy.c",
    652                     "upstream-openbsd/lib/libc/string/strcat.c",
    653                 ],
    654             },
    655             cortex_a8: {
    656                 exclude_srcs: [
    657                     "upstream-openbsd/lib/libc/string/memmove.c",
    658                     "upstream-openbsd/lib/libc/string/stpcpy.c",
    659                     "upstream-openbsd/lib/libc/string/strcat.c",
    660                 ],
    661             },
    662             cortex_a9: {
    663                 exclude_srcs: [
    664                     "upstream-openbsd/lib/libc/string/memmove.c",
    665                     "upstream-openbsd/lib/libc/string/stpcpy.c",
    666                     "upstream-openbsd/lib/libc/string/strcat.c",
    667                 ],
    668             },
    669             cortex_a15: {
    670                 exclude_srcs: [
    671                     "upstream-openbsd/lib/libc/string/memmove.c",
    672                     "upstream-openbsd/lib/libc/string/stpcpy.c",
    673                     "upstream-openbsd/lib/libc/string/strcat.c",
    674                 ],
    675             },
    676             denver: {
    677                 exclude_srcs: [
    678                     "upstream-openbsd/lib/libc/string/memmove.c",
    679                     "upstream-openbsd/lib/libc/string/stpcpy.c",
    680                     "upstream-openbsd/lib/libc/string/strcat.c",
    681                 ],
    682             },
    683             krait: {
    684                 exclude_srcs: [
    685                     "upstream-openbsd/lib/libc/string/memmove.c",
    686                     "upstream-openbsd/lib/libc/string/stpcpy.c",
    687                     "upstream-openbsd/lib/libc/string/strcat.c",
    688                 ],
    689             },
    690         },
    691         arm64: {
    692             exclude_srcs: [
    693                 "upstream-openbsd/lib/libc/string/memchr.c",
    694                 "upstream-openbsd/lib/libc/string/memmove.c",
    695                 "upstream-openbsd/lib/libc/string/stpcpy.c",
    696                 "upstream-openbsd/lib/libc/string/strcpy.c",
    697                 "upstream-openbsd/lib/libc/string/strncmp.c",
    698             ],
    699         },
    700 
    701         x86: {
    702             exclude_srcs: [
    703                 "upstream-openbsd/lib/libc/string/memchr.c",
    704                 "upstream-openbsd/lib/libc/string/memmove.c",
    705                 "upstream-openbsd/lib/libc/string/memrchr.c",
    706                 "upstream-openbsd/lib/libc/string/stpcpy.c",
    707                 "upstream-openbsd/lib/libc/string/stpncpy.c",
    708                 "upstream-openbsd/lib/libc/string/strcat.c",
    709                 "upstream-openbsd/lib/libc/string/strcpy.c",
    710                 "upstream-openbsd/lib/libc/string/strncmp.c",
    711                 "upstream-openbsd/lib/libc/string/strncpy.c",
    712             ],
    713             ssse3: {
    714                 exclude_srcs: [
    715                     "upstream-openbsd/lib/libc/string/strlcat.c",
    716                     "upstream-openbsd/lib/libc/string/strlcpy.c",
    717                     "upstream-openbsd/lib/libc/string/strncat.c",
    718                 ],
    719             },
    720         },
    721 
    722         x86_64: {
    723             exclude_srcs: [
    724                 "upstream-openbsd/lib/libc/string/memmove.c",
    725                 "upstream-openbsd/lib/libc/string/stpcpy.c",
    726                 "upstream-openbsd/lib/libc/string/stpncpy.c",
    727                 "upstream-openbsd/lib/libc/string/strcat.c",
    728                 "upstream-openbsd/lib/libc/string/strcpy.c",
    729                 "upstream-openbsd/lib/libc/string/strlcat.c",
    730                 "upstream-openbsd/lib/libc/string/strlcpy.c",
    731                 "upstream-openbsd/lib/libc/string/strncat.c",
    732                 "upstream-openbsd/lib/libc/string/strncmp.c",
    733                 "upstream-openbsd/lib/libc/string/strncpy.c",
    734             ],
    735         },
    736     },
    737 
    738     cflags: [
    739         "-Wno-sign-compare",
    740         "-Wno-uninitialized",
    741         "-Wno-unused-parameter",
    742         "-include openbsd-compat.h",
    743     ],
    744 
    745     local_include_dirs: [
    746         "private",
    747         "stdio",
    748         "upstream-openbsd/android/include",
    749         "upstream-openbsd/lib/libc/include",
    750         "upstream-openbsd/lib/libc/gdtoa/",
    751     ],
    752 
    753     name: "libc_openbsd",
    754 }
    755 
    756 // ========================================================
    757 // libc_gdtoa.a - upstream OpenBSD C library gdtoa code
    758 // ========================================================
    759 //
    760 // These files are built with the openbsd-compat.h header file
    761 // automatically included.
    762 
    763 cc_library_static {
    764     defaults: ["libc_defaults"],
    765     srcs: [
    766         "upstream-openbsd/android/gdtoa_support.cpp",
    767         "upstream-openbsd/lib/libc/gdtoa/dmisc.c",
    768         "upstream-openbsd/lib/libc/gdtoa/dtoa.c",
    769         "upstream-openbsd/lib/libc/gdtoa/gdtoa.c",
    770         "upstream-openbsd/lib/libc/gdtoa/gethex.c",
    771         "upstream-openbsd/lib/libc/gdtoa/gmisc.c",
    772         "upstream-openbsd/lib/libc/gdtoa/hd_init.c",
    773         "upstream-openbsd/lib/libc/gdtoa/hdtoa.c",
    774         "upstream-openbsd/lib/libc/gdtoa/hexnan.c",
    775         "upstream-openbsd/lib/libc/gdtoa/ldtoa.c",
    776         "upstream-openbsd/lib/libc/gdtoa/misc.c",
    777         "upstream-openbsd/lib/libc/gdtoa/smisc.c",
    778         "upstream-openbsd/lib/libc/gdtoa/strtod.c",
    779         "upstream-openbsd/lib/libc/gdtoa/strtodg.c",
    780         "upstream-openbsd/lib/libc/gdtoa/strtof.c",
    781         "upstream-openbsd/lib/libc/gdtoa/strtord.c",
    782         "upstream-openbsd/lib/libc/gdtoa/sum.c",
    783         "upstream-openbsd/lib/libc/gdtoa/ulp.c",
    784     ],
    785     multilib: {
    786         lib64: {
    787             srcs: ["upstream-openbsd/lib/libc/gdtoa/strtorQ.c"],
    788         },
    789     },
    790 
    791     cflags: [
    792         "-Wno-sign-compare",
    793         "-Wno-uninitialized",
    794         "-fvisibility=hidden",
    795         "-include openbsd-compat.h",
    796     ],
    797 
    798     local_include_dirs: [
    799         "private",
    800         "upstream-openbsd/android/include",
    801         "upstream-openbsd/lib/libc/include",
    802     ],
    803 
    804     name: "libc_gdtoa",
    805 }
    806 
    807 // ========================================================
    808 // libc_bionic.a - home-grown C library code
    809 // ========================================================
    810 
    811 cc_library_static {
    812     defaults: ["libc_defaults"],
    813     srcs: [
    814         // The following implementations depend on pthread data, so we can't
    815         // include them in libc_ndk.a.
    816         "bionic/__cxa_thread_atexit_impl.cpp",
    817         "bionic/fork.cpp",
    818 
    819         // The data that backs getauxval is initialized in the libc init
    820         // functions which are invoked by the linker. If this file is included
    821         // in libc_ndk.a, only one of the copies of the global data will be
    822         // initialized, resulting in nullptr dereferences.
    823         "bionic/getauxval.cpp",
    824 
    825         // These four require getauxval, which isn't available on older
    826         // platforms.
    827         "bionic/getentropy_linux.c",
    828         "bionic/sysconf.cpp",
    829         "bionic/vdso.cpp",
    830         "bionic/setjmp_cookie.cpp",
    831 
    832         "bionic/__memcpy_chk.cpp",
    833         "bionic/__memset_chk.cpp",
    834         "bionic/__strcat_chk.cpp",
    835         "bionic/__strcpy_chk.cpp",
    836         "bionic/strchr.cpp",
    837         "bionic/strnlen.c",
    838         "bionic/strrchr.cpp",
    839     ],
    840     cflags: ["-Wframe-larger-than=2048"],
    841 
    842     arch: {
    843         arm: {
    844             srcs: [
    845                 "arch-arm/generic/bionic/memcmp.S",
    846                 "arch-arm/generic/bionic/memcpy.S",
    847                 "arch-arm/generic/bionic/memset.S",
    848                 "arch-arm/generic/bionic/strcmp.S",
    849                 "arch-arm/generic/bionic/strcpy.S",
    850                 "arch-arm/generic/bionic/strlen.c",
    851 
    852                 "arch-arm/bionic/abort_arm.S",
    853                 "arch-arm/bionic/atomics_arm.c",
    854                 "arch-arm/bionic/__bionic_clone.S",
    855                 "arch-arm/bionic/_exit_with_stack_teardown.S",
    856                 "arch-arm/bionic/libgcc_compat.c",
    857                 "arch-arm/bionic/popcount_tab.c",
    858                 "arch-arm/bionic/__restore.S",
    859                 "arch-arm/bionic/setjmp.S",
    860                 "arch-arm/bionic/syscall.S",
    861                 "arch-arm/bionic/vfork.S",
    862             ],
    863             exclude_srcs: [
    864                 "bionic/__memcpy_chk.cpp",
    865                 "bionic/__memset_chk.cpp",
    866             ],
    867             cortex_a7: {
    868                 srcs: [
    869                     "arch-arm/cortex-a7/bionic/memset.S",
    870 
    871                     "arch-arm/cortex-a15/bionic/memcpy.S",
    872                     "arch-arm/cortex-a15/bionic/stpcpy.S",
    873                     "arch-arm/cortex-a15/bionic/strcat.S",
    874                     "arch-arm/cortex-a15/bionic/__strcat_chk.S",
    875                     "arch-arm/cortex-a15/bionic/strcmp.S",
    876                     "arch-arm/cortex-a15/bionic/strcpy.S",
    877                     "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
    878                     "arch-arm/cortex-a15/bionic/strlen.S",
    879 
    880                     "arch-arm/denver/bionic/memmove.S",
    881                 ],
    882                 exclude_srcs: [
    883                     "arch-arm/generic/bionic/memcpy.S",
    884                     "arch-arm/generic/bionic/memset.S",
    885                     "arch-arm/generic/bionic/strcmp.S",
    886                     "arch-arm/generic/bionic/strcpy.S",
    887                     "arch-arm/generic/bionic/strlen.c",
    888                     "bionic/__strcat_chk.cpp",
    889                     "bionic/__strcpy_chk.cpp",
    890                 ],
    891             },
    892             cortex_a53: {
    893                 srcs: [
    894                     "arch-arm/cortex-a53/bionic/memcpy.S",
    895                     "arch-arm/cortex-a53/bionic/__strcat_chk.S",
    896                     "arch-arm/cortex-a53/bionic/__strcpy_chk.S",
    897 
    898                     "arch-arm/cortex-a7/bionic/memset.S",
    899 
    900                     "arch-arm/cortex-a15/bionic/stpcpy.S",
    901                     "arch-arm/cortex-a15/bionic/strcat.S",
    902                     "arch-arm/cortex-a15/bionic/strcmp.S",
    903                     "arch-arm/cortex-a15/bionic/strcpy.S",
    904                     "arch-arm/cortex-a15/bionic/strlen.S",
    905 
    906                     "arch-arm/denver/bionic/memmove.S",
    907                 ],
    908                 exclude_srcs: [
    909                     "arch-arm/generic/bionic/memcpy.S",
    910                     "arch-arm/generic/bionic/memset.S",
    911                     "arch-arm/generic/bionic/strcmp.S",
    912                     "arch-arm/generic/bionic/strcpy.S",
    913                     "arch-arm/generic/bionic/strlen.c",
    914                     "bionic/__strcat_chk.cpp",
    915                     "bionic/__strcpy_chk.cpp",
    916                 ],
    917             },
    918             cortex_a53_a57: {
    919                 srcs: [
    920                     "arch-arm/cortex-a15/bionic/memcpy.S",
    921                     "arch-arm/cortex-a15/bionic/memset.S",
    922                     "arch-arm/cortex-a15/bionic/stpcpy.S",
    923                     "arch-arm/cortex-a15/bionic/strcat.S",
    924                     "arch-arm/cortex-a15/bionic/__strcat_chk.S",
    925                     "arch-arm/cortex-a15/bionic/strcmp.S",
    926                     "arch-arm/cortex-a15/bionic/strcpy.S",
    927                     "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
    928                     "arch-arm/cortex-a15/bionic/strlen.S",
    929 
    930                     "arch-arm/denver/bionic/memmove.S",
    931                 ],
    932                 exclude_srcs: [
    933                     "arch-arm/generic/bionic/memcpy.S",
    934                     "arch-arm/generic/bionic/memset.S",
    935                     "arch-arm/generic/bionic/strcmp.S",
    936                     "arch-arm/generic/bionic/strcpy.S",
    937                     "arch-arm/generic/bionic/strlen.c",
    938                     "bionic/__strcat_chk.cpp",
    939                     "bionic/__strcpy_chk.cpp",
    940                 ],
    941             },
    942             cortex_a8: {
    943                 srcs: [
    944                     "arch-arm/cortex-a15/bionic/memcpy.S",
    945                     "arch-arm/cortex-a15/bionic/memset.S",
    946                     "arch-arm/cortex-a15/bionic/stpcpy.S",
    947                     "arch-arm/cortex-a15/bionic/strcat.S",
    948                     "arch-arm/cortex-a15/bionic/__strcat_chk.S",
    949                     "arch-arm/cortex-a15/bionic/strcmp.S",
    950                     "arch-arm/cortex-a15/bionic/strcpy.S",
    951                     "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
    952                     "arch-arm/cortex-a15/bionic/strlen.S",
    953 
    954                     "arch-arm/denver/bionic/memmove.S",
    955                 ],
    956                 exclude_srcs: [
    957                     "arch-arm/generic/bionic/memcpy.S",
    958                     "arch-arm/generic/bionic/memset.S",
    959                     "arch-arm/generic/bionic/strcmp.S",
    960                     "arch-arm/generic/bionic/strcpy.S",
    961                     "arch-arm/generic/bionic/strlen.c",
    962                     "bionic/__strcat_chk.cpp",
    963                     "bionic/__strcpy_chk.cpp",
    964                 ],
    965             },
    966             cortex_a9: {
    967                 srcs: [
    968                     "arch-arm/cortex-a9/bionic/memcpy.S",
    969                     "arch-arm/cortex-a9/bionic/memset.S",
    970                     "arch-arm/cortex-a9/bionic/stpcpy.S",
    971                     "arch-arm/cortex-a9/bionic/strcat.S",
    972                     "arch-arm/cortex-a9/bionic/__strcat_chk.S",
    973                     "arch-arm/cortex-a9/bionic/strcmp.S",
    974                     "arch-arm/cortex-a9/bionic/strcpy.S",
    975                     "arch-arm/cortex-a9/bionic/__strcpy_chk.S",
    976                     "arch-arm/cortex-a9/bionic/strlen.S",
    977 
    978                     "arch-arm/denver/bionic/memmove.S",
    979                 ],
    980                 exclude_srcs: [
    981                     "arch-arm/generic/bionic/memcpy.S",
    982                     "arch-arm/generic/bionic/memset.S",
    983                     "arch-arm/generic/bionic/strcmp.S",
    984                     "arch-arm/generic/bionic/strcpy.S",
    985                     "arch-arm/generic/bionic/strlen.c",
    986                     "bionic/__strcat_chk.cpp",
    987                     "bionic/__strcpy_chk.cpp",
    988                 ],
    989             },
    990             cortex_a15: {
    991                 srcs: [
    992                     "arch-arm/cortex-a15/bionic/memcpy.S",
    993                     "arch-arm/cortex-a15/bionic/memset.S",
    994                     "arch-arm/cortex-a15/bionic/stpcpy.S",
    995                     "arch-arm/cortex-a15/bionic/strcat.S",
    996                     "arch-arm/cortex-a15/bionic/__strcat_chk.S",
    997                     "arch-arm/cortex-a15/bionic/strcmp.S",
    998                     "arch-arm/cortex-a15/bionic/strcpy.S",
    999                     "arch-arm/cortex-a15/bionic/__strcpy_chk.S",
   1000                     "arch-arm/cortex-a15/bionic/strlen.S",
   1001 
   1002                     "arch-arm/denver/bionic/memmove.S",
   1003                 ],
   1004                 exclude_srcs: [
   1005                     "arch-arm/generic/bionic/memcpy.S",
   1006                     "arch-arm/generic/bionic/memset.S",
   1007                     "arch-arm/generic/bionic/strcmp.S",
   1008                     "arch-arm/generic/bionic/strcpy.S",
   1009                     "arch-arm/generic/bionic/strlen.c",
   1010                     "bionic/__strcat_chk.cpp",
   1011                     "bionic/__strcpy_chk.cpp",
   1012                 ],
   1013             },
   1014             denver: {
   1015                 srcs: [
   1016                     "arch-arm/denver/bionic/memcpy.S",
   1017                     "arch-arm/denver/bionic/memmove.S",
   1018                     "arch-arm/denver/bionic/memset.S",
   1019                     "arch-arm/denver/bionic/__strcat_chk.S",
   1020                     "arch-arm/denver/bionic/__strcpy_chk.S",
   1021 
   1022                     // Use cortex-a15 versions of strcat/strcpy/strlen.
   1023                     "arch-arm/cortex-a15/bionic/stpcpy.S",
   1024                     "arch-arm/cortex-a15/bionic/strcat.S",
   1025                     "arch-arm/cortex-a15/bionic/strcmp.S",
   1026                     "arch-arm/cortex-a15/bionic/strcpy.S",
   1027                     "arch-arm/cortex-a15/bionic/strlen.S",
   1028                 ],
   1029                 exclude_srcs: [
   1030                     "arch-arm/generic/bionic/memcpy.S",
   1031                     "arch-arm/generic/bionic/memset.S",
   1032                     "arch-arm/generic/bionic/strcmp.S",
   1033                     "arch-arm/generic/bionic/strcpy.S",
   1034                     "arch-arm/generic/bionic/strlen.c",
   1035                     "bionic/__strcat_chk.cpp",
   1036                     "bionic/__strcpy_chk.cpp",
   1037                 ],
   1038             },
   1039             krait: {
   1040                 srcs: [
   1041                     "arch-arm/krait/bionic/memcpy.S",
   1042                     "arch-arm/krait/bionic/memset.S",
   1043                     "arch-arm/krait/bionic/strcmp.S",
   1044                     "arch-arm/krait/bionic/__strcat_chk.S",
   1045                     "arch-arm/krait/bionic/__strcpy_chk.S",
   1046 
   1047                     // Use cortex-a15 versions of strcat/strcpy/strlen.
   1048                     "arch-arm/cortex-a15/bionic/stpcpy.S",
   1049                     "arch-arm/cortex-a15/bionic/strcat.S",
   1050                     "arch-arm/cortex-a15/bionic/strcpy.S",
   1051                     "arch-arm/cortex-a15/bionic/strlen.S",
   1052 
   1053                     "arch-arm/denver/bionic/memmove.S",
   1054                 ],
   1055                 exclude_srcs: [
   1056                     "arch-arm/generic/bionic/memcpy.S",
   1057                     "arch-arm/generic/bionic/memset.S",
   1058                     "arch-arm/generic/bionic/strcmp.S",
   1059                     "arch-arm/generic/bionic/strcpy.S",
   1060                     "arch-arm/generic/bionic/strlen.c",
   1061                     "bionic/__strcat_chk.cpp",
   1062                     "bionic/__strcpy_chk.cpp",
   1063                 ],
   1064             },
   1065 
   1066         },
   1067         arm64: {
   1068             srcs: [
   1069                 "arch-arm64/generic/bionic/memchr.S",
   1070                 "arch-arm64/generic/bionic/memcmp.S",
   1071                 "arch-arm64/generic/bionic/memcpy.S",
   1072                 "arch-arm64/generic/bionic/memmove.S",
   1073                 "arch-arm64/generic/bionic/memset.S",
   1074                 "arch-arm64/generic/bionic/stpcpy.S",
   1075                 "arch-arm64/generic/bionic/strchr.S",
   1076                 "arch-arm64/generic/bionic/strcmp.S",
   1077                 "arch-arm64/generic/bionic/strcpy.S",
   1078                 "arch-arm64/generic/bionic/strlen.S",
   1079                 "arch-arm64/generic/bionic/strncmp.S",
   1080                 "arch-arm64/generic/bionic/strnlen.S",
   1081                 "arch-arm64/generic/bionic/wmemmove.S",
   1082 
   1083                 "arch-arm64/bionic/__bionic_clone.S",
   1084                 "arch-arm64/bionic/_exit_with_stack_teardown.S",
   1085                 "arch-arm64/bionic/setjmp.S",
   1086                 "arch-arm64/bionic/syscall.S",
   1087                 "arch-arm64/bionic/vfork.S",
   1088             ],
   1089             exclude_srcs: [
   1090                 "bionic/__memcpy_chk.cpp",
   1091                 "bionic/strchr.cpp",
   1092                 "bionic/strnlen.c",
   1093             ],
   1094             denver64: {
   1095                 srcs: [
   1096                     "arch-arm64/denver64/bionic/memcpy.S",
   1097                     "arch-arm64/denver64/bionic/memset.S",
   1098                 ],
   1099                 exclude_srcs: [
   1100                     "arch-arm64/generic/bionic/memcpy.S",
   1101                     "arch-arm64/generic/bionic/memset.S",
   1102                 ],
   1103             },
   1104         },
   1105 
   1106         mips: {
   1107             srcs: [
   1108                 "arch-mips/string/memcmp.c",
   1109                 "arch-mips/string/memcpy.S",
   1110                 "arch-mips/string/memset.S",
   1111                 "arch-mips/string/strcmp.S",
   1112                 "arch-mips/string/strlen.c",
   1113 
   1114                 "arch-mips/bionic/__bionic_clone.S",
   1115                 "arch-mips/bionic/bzero.S",
   1116                 "arch-mips/bionic/cacheflush.cpp",
   1117                 "arch-mips/bionic/_exit_with_stack_teardown.S",
   1118                 "arch-mips/bionic/setjmp.S",
   1119                 "arch-mips/bionic/syscall.S",
   1120                 "arch-mips/bionic/vfork.S",
   1121             ],
   1122             rev6: {
   1123                 srcs: [
   1124                     "arch-mips/string/mips_strlen.c",
   1125                 ],
   1126                 exclude_srcs: [
   1127                     "arch-mips/string/strlen.c",
   1128                 ],
   1129             },
   1130         },
   1131         mips64: {
   1132             srcs: [
   1133                 "arch-mips/string/memcmp.c",
   1134                 "arch-mips/string/memcpy.S",
   1135                 "arch-mips/string/memset.S",
   1136                 "arch-mips/string/strcmp.S",
   1137                 "arch-mips/string/strlen.c",
   1138 
   1139                 "arch-mips64/bionic/__bionic_clone.S",
   1140                 "arch-mips64/bionic/_exit_with_stack_teardown.S",
   1141                 "arch-mips64/bionic/setjmp.S",
   1142                 "arch-mips64/bionic/syscall.S",
   1143                 "arch-mips64/bionic/vfork.S",
   1144                 "arch-mips64/bionic/stat.cpp",
   1145             ],
   1146         },
   1147 
   1148         x86: {
   1149             srcs: [
   1150                 "arch-x86/generic/string/memcmp.S",
   1151                 "arch-x86/generic/string/strcmp.S",
   1152                 "arch-x86/generic/string/strncmp.S",
   1153                 "arch-x86/generic/string/strcat.S",
   1154                 "arch-x86/atom/string/sse2-memchr-atom.S",
   1155                 "arch-x86/atom/string/sse2-memrchr-atom.S",
   1156                 "arch-x86/atom/string/sse2-strchr-atom.S",
   1157                 "arch-x86/atom/string/sse2-strnlen-atom.S",
   1158                 "arch-x86/atom/string/sse2-strrchr-atom.S",
   1159                 "arch-x86/atom/string/sse2-wcschr-atom.S",
   1160                 "arch-x86/atom/string/sse2-wcsrchr-atom.S",
   1161                 "arch-x86/atom/string/sse2-wcslen-atom.S",
   1162                 "arch-x86/atom/string/sse2-wcscmp-atom.S",
   1163                 "arch-x86/silvermont/string/sse2-bcopy-slm.S",
   1164                 "arch-x86/silvermont/string/sse2-bzero-slm.S",
   1165                 "arch-x86/silvermont/string/sse2-memcpy-slm.S",
   1166                 "arch-x86/silvermont/string/sse2-memmove-slm.S",
   1167                 "arch-x86/silvermont/string/sse2-memset-slm.S",
   1168                 "arch-x86/silvermont/string/sse2-stpcpy-slm.S",
   1169                 "arch-x86/silvermont/string/sse2-stpncpy-slm.S",
   1170                 "arch-x86/silvermont/string/sse2-strcpy-slm.S",
   1171                 "arch-x86/silvermont/string/sse2-strlen-slm.S",
   1172                 "arch-x86/silvermont/string/sse2-strncpy-slm.S",
   1173 
   1174                 "arch-x86/bionic/__bionic_clone.S",
   1175                 "arch-x86/bionic/_exit_with_stack_teardown.S",
   1176                 "arch-x86/bionic/libgcc_compat.c",
   1177                 "arch-x86/bionic/__restore.S",
   1178                 "arch-x86/bionic/setjmp.S",
   1179                 "arch-x86/bionic/syscall.S",
   1180                 "arch-x86/bionic/vfork.S",
   1181             ],
   1182 
   1183             exclude_srcs: [
   1184                 "bionic/strchr.cpp",
   1185                 "bionic/strnlen.c",
   1186                 "bionic/strrchr.cpp",
   1187             ],
   1188             atom: {
   1189                 srcs: [
   1190                     "arch-x86/atom/string/sse2-bzero-atom.S",
   1191                     "arch-x86/atom/string/sse2-memset-atom.S",
   1192                     "arch-x86/atom/string/sse2-strlen-atom.S",
   1193                     "arch-x86/atom/string/ssse3-bcopy-atom.S",
   1194                     "arch-x86/atom/string/ssse3-memcmp-atom.S",
   1195                     "arch-x86/atom/string/ssse3-memcpy-atom.S",
   1196                     "arch-x86/atom/string/ssse3-memmove-atom.S",
   1197                     "arch-x86/atom/string/ssse3-strcpy-atom.S",
   1198                     "arch-x86/atom/string/ssse3-strncpy-atom.S",
   1199                     "arch-x86/atom/string/ssse3-wmemcmp-atom.S",
   1200                 ],
   1201                 exclude_srcs: [
   1202                     "arch-x86/generic/string/memcmp.S",
   1203                     "arch-x86/silvermont/string/sse2-bcopy-slm.S",
   1204                     "arch-x86/silvermont/string/sse2-bzero-slm.S",
   1205                     "arch-x86/silvermont/string/sse2-memcpy-slm.S",
   1206                     "arch-x86/silvermont/string/sse2-memmove-slm.S",
   1207                     "arch-x86/silvermont/string/sse2-memset-slm.S",
   1208                     "arch-x86/silvermont/string/sse2-strcpy-slm.S",
   1209                     "arch-x86/silvermont/string/sse2-strlen-slm.S",
   1210                     "arch-x86/silvermont/string/sse2-strncpy-slm.S",
   1211                 ],
   1212             },
   1213             ssse3: {
   1214                 srcs: [
   1215                     "arch-x86/atom/string/ssse3-strncat-atom.S",
   1216                     "arch-x86/atom/string/ssse3-strlcat-atom.S",
   1217                     "arch-x86/atom/string/ssse3-strlcpy-atom.S",
   1218                     "arch-x86/atom/string/ssse3-strcat-atom.S",
   1219                     "arch-x86/atom/string/ssse3-strcmp-atom.S",
   1220                     "arch-x86/atom/string/ssse3-strncmp-atom.S",
   1221                     "arch-x86/atom/string/ssse3-wcscat-atom.S",
   1222                     "arch-x86/atom/string/ssse3-wcscpy-atom.S",
   1223                 ],
   1224                 exclude_srcs: [
   1225                     "arch-x86/generic/string/strcmp.S",
   1226                     "arch-x86/generic/string/strncmp.S",
   1227                     "arch-x86/generic/string/strcat.S",
   1228                 ],
   1229             },
   1230             sse4: {
   1231                 srcs: [
   1232                     "arch-x86/silvermont/string/sse4-memcmp-slm.S",
   1233                     "arch-x86/silvermont/string/sse4-wmemcmp-slm.S",
   1234                 ],
   1235                 exclude_srcs: [
   1236                     "arch-x86/generic/string/memcmp.S",
   1237                 ],
   1238             },
   1239         },
   1240         x86_64: {
   1241             srcs: [
   1242                 "arch-x86_64/string/sse2-memcpy-slm.S",
   1243                 "arch-x86_64/string/sse2-memmove-slm.S",
   1244                 "arch-x86_64/string/sse2-memset-slm.S",
   1245                 "arch-x86_64/string/sse2-stpcpy-slm.S",
   1246                 "arch-x86_64/string/sse2-stpncpy-slm.S",
   1247                 "arch-x86_64/string/sse2-strcat-slm.S",
   1248                 "arch-x86_64/string/sse2-strcpy-slm.S",
   1249                 "arch-x86_64/string/sse2-strlcat-slm.S",
   1250                 "arch-x86_64/string/sse2-strlcpy-slm.S",
   1251                 "arch-x86_64/string/sse2-strlen-slm.S",
   1252                 "arch-x86_64/string/sse2-strncat-slm.S",
   1253                 "arch-x86_64/string/sse2-strncpy-slm.S",
   1254                 "arch-x86_64/string/sse4-memcmp-slm.S",
   1255                 "arch-x86_64/string/ssse3-strcmp-slm.S",
   1256                 "arch-x86_64/string/ssse3-strncmp-slm.S",
   1257 
   1258                 "arch-x86_64/bionic/__bionic_clone.S",
   1259                 "arch-x86_64/bionic/_exit_with_stack_teardown.S",
   1260                 "arch-x86_64/bionic/__restore_rt.S",
   1261                 "arch-x86_64/bionic/setjmp.S",
   1262                 "arch-x86_64/bionic/syscall.S",
   1263                 "arch-x86_64/bionic/vfork.S",
   1264             ],
   1265         },
   1266     },
   1267 
   1268     cppflags: ["-Wold-style-cast"],
   1269     include_dirs: ["bionic/libstdc++/include"],
   1270     name: "libc_bionic",
   1271 }
   1272 
   1273 // ========================================================
   1274 // libc_bionic_ndk.a- The portions of libc_bionic that can
   1275 // be safely used in libc_ndk.a (no troublesome global data
   1276 // or constructors).
   1277 // ========================================================
   1278 cc_library_static {
   1279     defaults: ["libc_defaults"],
   1280     srcs: [
   1281         "bionic/abort.cpp",
   1282         "bionic/accept.cpp",
   1283         "bionic/accept4.cpp",
   1284         "bionic/access.cpp",
   1285         "bionic/arpa_inet.cpp",
   1286         "bionic/assert.cpp",
   1287         "bionic/atof.cpp",
   1288         "bionic/bionic_netlink.cpp",
   1289         "bionic/bionic_systrace.cpp",
   1290         "bionic/bionic_time_conversions.cpp",
   1291         "bionic/brk.cpp",
   1292         "bionic/c16rtomb.cpp",
   1293         "bionic/c32rtomb.cpp",
   1294         "bionic/chmod.cpp",
   1295         "bionic/chown.cpp",
   1296         "bionic/clearenv.cpp",
   1297         "bionic/clock.cpp",
   1298         "bionic/clock_getcpuclockid.cpp",
   1299         "bionic/clock_nanosleep.cpp",
   1300         "bionic/clone.cpp",
   1301         "bionic/close.cpp",
   1302         "bionic/__cmsg_nxthdr.cpp",
   1303         "bionic/connect.cpp",
   1304         "bionic/ctype.cpp",
   1305         "bionic/dirent.cpp",
   1306         "bionic/dup2.cpp",
   1307         "bionic/epoll_create.cpp",
   1308         "bionic/epoll_pwait.cpp",
   1309         "bionic/epoll_wait.cpp",
   1310         "bionic/__errno.cpp",
   1311         "bionic/error.cpp",
   1312         "bionic/eventfd_read.cpp",
   1313         "bionic/eventfd_write.cpp",
   1314         "bionic/faccessat.cpp",
   1315         "bionic/fchmod.cpp",
   1316         "bionic/fchmodat.cpp",
   1317         "bionic/ffs.cpp",
   1318         "bionic/fgetxattr.cpp",
   1319         "bionic/flistxattr.cpp",
   1320         "bionic/flockfile.cpp",
   1321         "bionic/fpclassify.cpp",
   1322         "bionic/fsetxattr.cpp",
   1323         "bionic/ftruncate.cpp",
   1324         "bionic/futimens.cpp",
   1325         "bionic/getcwd.cpp",
   1326         "bionic/gethostname.cpp",
   1327         "bionic/getpgrp.cpp",
   1328         "bionic/getpid.cpp",
   1329         "bionic/gettid.cpp",
   1330         "bionic/__gnu_basename.cpp",
   1331         "bionic/ifaddrs.cpp",
   1332         "bionic/inotify_init.cpp",
   1333         "bionic/ioctl.cpp",
   1334         "bionic/lchown.cpp",
   1335         "bionic/lfs64_support.cpp",
   1336         "bionic/__libc_current_sigrtmax.cpp",
   1337         "bionic/__libc_current_sigrtmin.cpp",
   1338         "bionic/libc_init_common.cpp",
   1339         "bionic/libc_logging.cpp",
   1340         "bionic/libgen.cpp",
   1341         "bionic/link.cpp",
   1342         "bionic/locale.cpp",
   1343         "bionic/lockf.cpp",
   1344         "bionic/lstat.cpp",
   1345         "bionic/malloc_info.cpp",
   1346         "bionic/mbrtoc16.cpp",
   1347         "bionic/mbrtoc32.cpp",
   1348         "bionic/mbstate.cpp",
   1349         "bionic/mempcpy.cpp",
   1350         "bionic/mkdir.cpp",
   1351         "bionic/mkfifo.cpp",
   1352         "bionic/mknod.cpp",
   1353         "bionic/mntent.cpp",
   1354         "bionic/mremap.cpp",
   1355         "bionic/NetdClientDispatch.cpp",
   1356         "bionic/net_if.cpp",
   1357         "bionic/netinet_in.cpp",
   1358         "bionic/open.cpp",
   1359         "bionic/pathconf.cpp",
   1360         "bionic/pause.cpp",
   1361         "bionic/pipe.cpp",
   1362         "bionic/poll.cpp",
   1363         "bionic/posix_fadvise.cpp",
   1364         "bionic/posix_fallocate.cpp",
   1365         "bionic/posix_madvise.cpp",
   1366         "bionic/posix_timers.cpp",
   1367         "bionic/ptrace.cpp",
   1368         "bionic/pty.cpp",
   1369         "bionic/raise.cpp",
   1370         "bionic/rand.cpp",
   1371         "bionic/readlink.cpp",
   1372         "bionic/reboot.cpp",
   1373         "bionic/recv.cpp",
   1374         "bionic/rename.cpp",
   1375         "bionic/rmdir.cpp",
   1376         "bionic/scandir.cpp",
   1377         "bionic/sched_getaffinity.cpp",
   1378         "bionic/sched_getcpu.cpp",
   1379         "bionic/semaphore.cpp",
   1380         "bionic/send.cpp",
   1381         "bionic/setegid.cpp",
   1382         "bionic/__set_errno.cpp",
   1383         "bionic/seteuid.cpp",
   1384         "bionic/setpgrp.cpp",
   1385         "bionic/sigaction.cpp",
   1386         "bionic/sigaddset.cpp",
   1387         "bionic/sigdelset.cpp",
   1388         "bionic/sigemptyset.cpp",
   1389         "bionic/sigfillset.cpp",
   1390         "bionic/sigismember.cpp",
   1391         "bionic/signal.cpp",
   1392         "bionic/signalfd.cpp",
   1393         "bionic/sigpending.cpp",
   1394         "bionic/sigprocmask.cpp",
   1395         "bionic/sigqueue.cpp",
   1396         "bionic/sigsuspend.cpp",
   1397         "bionic/sigtimedwait.cpp",
   1398         "bionic/sigwait.cpp",
   1399         "bionic/sigwaitinfo.cpp",
   1400         "bionic/socket.cpp",
   1401         "bionic/stat.cpp",
   1402         "bionic/statvfs.cpp",
   1403         "bionic/strchrnul.cpp",
   1404         "bionic/strerror.cpp",
   1405         "bionic/strerror_r.cpp",
   1406         "bionic/strsignal.cpp",
   1407         "bionic/strtold.cpp",
   1408         "bionic/stubs.cpp",
   1409         "bionic/symlink.cpp",
   1410         "bionic/sysinfo.cpp",
   1411         "bionic/syslog.cpp",
   1412         "bionic/sys_siglist.c",
   1413         "bionic/sys_signame.c",
   1414         "bionic/system_properties.cpp",
   1415         "bionic/tdestroy.cpp",
   1416         "bionic/termios.cpp",
   1417         "bionic/thread_private.cpp",
   1418         "bionic/tmpfile.cpp",
   1419         "bionic/umount.cpp",
   1420         "bionic/unlink.cpp",
   1421         "bionic/utimes.cpp",
   1422         "bionic/wait.cpp",
   1423         "bionic/wchar.cpp",
   1424         "bionic/wctype.cpp",
   1425         "bionic/wmempcpy.cpp",
   1426     ],
   1427     cflags: ["-Wframe-larger-than=2048"],
   1428 
   1429     multilib: {
   1430         lib32: {
   1431             // LP32 cruft
   1432             srcs: ["bionic/mmap.cpp"],
   1433         },
   1434     },
   1435 
   1436     cppflags: ["-Wold-style-cast"],
   1437     local_include_dirs: ["stdio"],
   1438     include_dirs: ["bionic/libstdc++/include"],
   1439     name: "libc_bionic_ndk",
   1440 }
   1441 
   1442 // ========================================================
   1443 // libc_pthread.a - pthreads parts that previously lived in
   1444 // libc_bionic.a. Relocated to their own library because
   1445 // they can't be included in libc_ndk.a (as they layout of
   1446 // pthread_t has changed over the years and has ABI
   1447 // compatibility issues).
   1448 // ========================================================
   1449 
   1450 cc_library_static {
   1451     defaults: ["libc_defaults"],
   1452     srcs: [
   1453         "bionic/pthread_atfork.cpp",
   1454         "bionic/pthread_attr.cpp",
   1455         "bionic/pthread_barrier.cpp",
   1456         "bionic/pthread_cond.cpp",
   1457         "bionic/pthread_create.cpp",
   1458         "bionic/pthread_detach.cpp",
   1459         "bionic/pthread_equal.cpp",
   1460         "bionic/pthread_exit.cpp",
   1461         "bionic/pthread_getcpuclockid.cpp",
   1462         "bionic/pthread_getschedparam.cpp",
   1463         "bionic/pthread_gettid_np.cpp",
   1464         "bionic/pthread_internal.cpp",
   1465         "bionic/pthread_join.cpp",
   1466         "bionic/pthread_key.cpp",
   1467         "bionic/pthread_kill.cpp",
   1468         "bionic/pthread_mutex.cpp",
   1469         "bionic/pthread_once.cpp",
   1470         "bionic/pthread_rwlock.cpp",
   1471         "bionic/pthread_self.cpp",
   1472         "bionic/pthread_setname_np.cpp",
   1473         "bionic/pthread_setschedparam.cpp",
   1474         "bionic/pthread_sigmask.cpp",
   1475         "bionic/pthread_spinlock.cpp",
   1476     ],
   1477     cflags: ["-Wframe-larger-than=2048"],
   1478 
   1479     cppflags: ["-Wold-style-cast"],
   1480     include_dirs: ["bionic/libstdc++/include"],
   1481     name: "libc_pthread",
   1482 }
   1483 
   1484 // ========================================================
   1485 // libc_cxa.a - Things traditionally in libstdc++
   1486 // ========================================================
   1487 
   1488 cc_library_static {
   1489     defaults: ["libc_defaults"],
   1490     srcs: [
   1491         "bionic/__cxa_guard.cpp",
   1492         "bionic/__cxa_pure_virtual.cpp",
   1493         "bionic/new.cpp",
   1494     ],
   1495     cflags: ["-fvisibility=hidden"],
   1496     include_dirs: ["bionic/libstdc++/include"],
   1497     name: "libc_cxa",
   1498     clang: true, // GCC refuses to hide new/delete
   1499 
   1500     // b/17574078: Need to disable coverage until we have a prebuilt libprofile_rt.
   1501     // Since this is a static library built with clang, it needs to link
   1502     // libprofile_rt when it is linked into the final binary. Since the final binary
   1503     // is built with GCC, it won't link libprofile_rt. We can't very easily just add
   1504     // libprofile_rt to all link lines the way we've done for libgcov because
   1505     // libprofile_rt isn't prebuilt, and it would be tricky to write a rule that
   1506     // would make sure libprofile_rt is built.
   1507     native_coverage: false,
   1508 }
   1509 
   1510 // ========================================================
   1511 // libc_syscalls.a
   1512 // ========================================================
   1513 
   1514 cc_library_static {
   1515     arch: {
   1516         arm: {
   1517             srcs: ["arch-arm/syscalls/**/*.S"],
   1518         },
   1519         arm64: {
   1520             srcs: ["arch-arm64/syscalls/**/*.S"],
   1521         },
   1522         mips: {
   1523             srcs: ["arch-mips/syscalls/**/*.S"],
   1524         },
   1525         mips64: {
   1526             srcs: ["arch-mips64/syscalls/**/*.S"],
   1527         },
   1528         x86: {
   1529             srcs: ["arch-x86/syscalls/**/*.S"],
   1530         },
   1531         x86_64: {
   1532             srcs: ["arch-x86_64/syscalls/**/*.S"],
   1533         },
   1534     },
   1535     name: "libc_syscalls",
   1536 }
   1537 
   1538 // ========================================================
   1539 // libc_aeabi.a
   1540 // This is an LP32 ARM-only library that needs to be built with -fno-builtin
   1541 // to avoid infinite recursion. For the other architectures we just build an
   1542 // empty library to keep this makefile simple.
   1543 // ========================================================
   1544 
   1545 cc_library_static {
   1546     defaults: ["libc_defaults"],
   1547     arch: {
   1548         arm: {
   1549             srcs: ["arch-arm/bionic/__aeabi.c"],
   1550         },
   1551     },
   1552     name: "libc_aeabi",
   1553     cflags: ["-fno-builtin"],
   1554 }
   1555 
   1556 // ========================================================
   1557 // libc_ndk.a
   1558 // Compatibility library for the NDK. This library contains
   1559 // all the parts of libc that are safe to statically link.
   1560 // We can't safely statically link things that can only run
   1561 // on a certain version of the OS. Examples include
   1562 // anything that talks to netd (a large portion of the DNS
   1563 // code) and anything that is dependent on the layout of a
   1564 // data structure that has changed across releases (such as
   1565 // pthread_t).
   1566 // ========================================================
   1567 
   1568 cc_library_static {
   1569     name: "libc_ndk",
   1570     defaults: ["libc_defaults"],
   1571     srcs: libc_common_src_files + ["bionic/malloc_common.cpp"],
   1572     multilib: {
   1573         lib32: {
   1574             srcs: libc_common_src_files_32,
   1575         },
   1576     },
   1577     arch: {
   1578         arm: {
   1579             srcs: [
   1580                 "arch-arm/bionic/exidx_dynamic.c",
   1581                 "arch-common/bionic/crtbegin_so.c",
   1582                 "arch-arm/bionic/atexit_legacy.c",
   1583                 "arch-common/bionic/crtend_so.S",
   1584             ],
   1585             whole_static_libs: ["libc_aeabi"],
   1586         },
   1587     },
   1588 
   1589     cflags: [
   1590         "-fvisibility=hidden",
   1591         "-DLIBC_STATIC",
   1592     ],
   1593 
   1594     whole_static_libs: [
   1595         "libc_bionic_ndk",
   1596         "libc_cxa",
   1597         "libc_freebsd",
   1598         "libc_gdtoa",
   1599         "libc_malloc",
   1600         "libc_netbsd",
   1601         "libc_openbsd_ndk",
   1602         "libc_stack_protector",
   1603         "libc_syscalls",
   1604         "libc_tzcode",
   1605         "libm",
   1606         "libjemalloc",
   1607     ],
   1608 }
   1609 
   1610 // ========================================================
   1611 // libc_common.a
   1612 // ========================================================
   1613 
   1614 cc_library_static {
   1615     defaults: ["libc_defaults"],
   1616     srcs: libc_common_src_files,
   1617     multilib: {
   1618         lib32: {
   1619             srcs: libc_common_src_files_32,
   1620         },
   1621     },
   1622     name: "libc_common",
   1623 
   1624     whole_static_libs: [
   1625         "libc_bionic",
   1626         "libc_bionic_ndk",
   1627         "libc_cxa",
   1628         "libc_dns",
   1629         "libc_freebsd",
   1630         "libc_gdtoa",
   1631         "libc_malloc",
   1632         "libc_netbsd",
   1633         "libc_openbsd",
   1634         "libc_openbsd_ndk",
   1635         "libc_pthread",
   1636         "libc_stack_protector",
   1637         "libc_syscalls",
   1638         "libc_tzcode",
   1639     ],
   1640 
   1641     arch: {
   1642         arm: {
   1643             whole_static_libs: ["libc_aeabi"],
   1644         },
   1645     },
   1646 }
   1647 
   1648 // ========================================================
   1649 // libc_nomalloc.a
   1650 // ========================================================
   1651 //
   1652 // This is a version of the static C library that does not
   1653 // include malloc. It's useful in situations when the user wants
   1654 // to provide their own malloc implementation, or wants to
   1655 // explicitly disallow the use of malloc, such as in the
   1656 // dynamic linker.
   1657 
   1658 cc_library_static {
   1659     defaults: ["libc_defaults"],
   1660     srcs: [
   1661         "bionic/dl_iterate_phdr_static.cpp",
   1662     ],
   1663 
   1664     arch: {
   1665         arm: {
   1666             srcs: ["arch-arm/bionic/exidx_static.c"],
   1667         },
   1668     },
   1669 
   1670     cflags: ["-DLIBC_STATIC"],
   1671 
   1672     name: "libc_nomalloc",
   1673 
   1674     whole_static_libs: [
   1675         "libc_common",
   1676         "libc_init_static",
   1677     ],
   1678 }
   1679 
   1680 // ========================================================
   1681 // libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
   1682 // ========================================================
   1683 cc_library_static {
   1684     defaults: ["libc_defaults"],
   1685     srcs: ["bionic/jemalloc_wrapper.cpp"],
   1686     cflags: ["-fvisibility=hidden"],
   1687 
   1688     name: "libc_malloc",
   1689 }
   1690 
   1691 // ========================================================
   1692 // libc.a + libc.so
   1693 // ========================================================
   1694 cc_library {
   1695     defaults: ["libc_defaults"],
   1696     name: "libc",
   1697     product_variables: {
   1698         platform_sdk_version: {
   1699             asflags: ["-DPLATFORM_SDK_VERSION=%d"],
   1700         },
   1701     },
   1702     srcs: ["bionic/malloc_common.cpp"],
   1703     static: {
   1704         srcs: [
   1705             "bionic/dl_iterate_phdr_static.cpp",
   1706             "bionic/libc_init_static.cpp",
   1707         ],
   1708         cflags: ["-DLIBC_STATIC"],
   1709         whole_static_libs: ["libc_init_static"],
   1710     },
   1711     shared: {
   1712         srcs: [
   1713             "arch-common/bionic/crtbegin_so.c",
   1714             "arch-common/bionic/crtbrand.S",
   1715             "bionic/libc_init_dynamic.cpp",
   1716             "bionic/NetdClient.cpp",
   1717             "arch-common/bionic/crtend_so.S",
   1718         ],
   1719     },
   1720 
   1721     required: ["tzdata"],
   1722 
   1723     // Leave the symbols in the shared library so that stack unwinders can produce
   1724     // meaningful name resolution.
   1725     strip: "keep_symbols",
   1726 
   1727     // WARNING: The only library libc.so should depend on is libdl.so!  If you add other libraries,
   1728     // make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries.  This
   1729     // ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
   1730     // external; if that were the case, then libc would not pull those symbols from libgcc.a as it
   1731     // should, instead relying on the external symbols from the dependent libraries.  That would
   1732     // create a "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
   1733     // you wanted!
   1734 
   1735     shared_libs: ["libdl"],
   1736     whole_static_libs: ["libc_common", "libjemalloc"],
   1737 
   1738     // We'd really like to do this for all architectures, but since this wasn't done
   1739     // before, these symbols must continue to be exported on LP32 for binary
   1740     // compatibility.
   1741     multilib: {
   1742         lib64: {
   1743             ldflags: ["-Wl,--exclude-libs,libgcc.a"],
   1744         },
   1745     },
   1746 
   1747     nocrt: true,
   1748 
   1749     arch: {
   1750         arm: {
   1751             //TODO: This is to work around b/24465209. Remove after root cause is fixed
   1752             ldflags: ["-Wl,--hash-style=both"],
   1753 
   1754             // Don't re-export new/delete and friends, even if the compiler really wants to.
   1755             version_script: "libc.arm.map",
   1756             product_variables: {
   1757                 brillo: {
   1758                     version_script: "libc.arm.brillo.map",
   1759                 },
   1760             },
   1761 
   1762             shared: {
   1763                 srcs: ["arch-arm/bionic/exidx_dynamic.c"],
   1764             },
   1765             static: {
   1766                 srcs: ["arch-arm/bionic/exidx_static.c"],
   1767             },
   1768 
   1769             // special for arm
   1770             cflags: ["-DCRT_LEGACY_WORKAROUND"],
   1771             srcs: [
   1772                 "arch-arm/bionic/atexit_legacy.c",
   1773             ],
   1774         },
   1775         arm64: {
   1776             // Don't re-export new/delete and friends, even if the compiler really wants to.
   1777             version_script: "libc.arm64.map",
   1778         },
   1779         mips: {
   1780             // Don't re-export new/delete and friends, even if the compiler really wants to.
   1781             version_script: "libc.mips.map",
   1782             product_variables: {
   1783                 brillo: {
   1784                     version_script: "libc.mips.brillo.map",
   1785                 },
   1786             },
   1787         },
   1788         mips64: {
   1789             // Don't re-export new/delete and friends, even if the compiler really wants to.
   1790             version_script: "libc.mips64.map",
   1791         },
   1792         x86: {
   1793             //TODO: This is to work around b/24465209. Remove after root cause is fixed
   1794             ldflags: ["-Wl,--hash-style=both"],
   1795 
   1796             // Don't re-export new/delete and friends, even if the compiler really wants to.
   1797             version_script: "libc.x86.map",
   1798             product_variables: {
   1799                 brillo: {
   1800                     version_script: "libc.x86.brillo.map",
   1801                 },
   1802             },
   1803         },
   1804         x86_64: {
   1805             // Don't re-export new/delete and friends, even if the compiler really wants to.
   1806             version_script: "libc.x86_64.map",
   1807         },
   1808     },
   1809 }
   1810 
   1811 // ========================================================
   1812 // libc_logging.a
   1813 // ========================================================
   1814 cc_library_static {
   1815     defaults: ["libc_defaults"],
   1816 
   1817     srcs: [
   1818         "bionic/libc_logging.cpp",
   1819     ],
   1820 
   1821     name: "libc_logging",
   1822 }
   1823 
   1824 // ========================================================
   1825 // libstdc++.so + libstdc++.a
   1826 // ========================================================
   1827 cc_library {
   1828     defaults: ["libc_defaults"],
   1829     include_dirs: ["bionic/libstdc++/include"],
   1830     srcs: [
   1831         "bionic/__cxa_guard.cpp",
   1832         "bionic/__cxa_pure_virtual.cpp",
   1833         "bionic/new.cpp",
   1834     ],
   1835     name: "libstdc++",
   1836     system_shared_libs: ["libc"],
   1837     shared: {
   1838         static_libs: ["libc_logging"],
   1839     },
   1840 
   1841     //TODO: This is to work around b/24465209. Remove after root cause is fixed
   1842     arch: {
   1843         arm: {
   1844             ldflags: ["-Wl,--hash-style=both"],
   1845         },
   1846         x86: {
   1847             ldflags: ["-Wl,--hash-style=both"],
   1848         },
   1849     },
   1850 }
   1851 
   1852 cc_defaults {
   1853     name: "crt_defaults",
   1854 
   1855     no_default_compiler_flags: true,
   1856 
   1857     arch: {
   1858         arm: {
   1859             local_include_dirs: ["arch-arm/include"],
   1860         },
   1861         arm64: {
   1862             local_include_dirs: ["arch-arm64/include"],
   1863         },
   1864         mips: {
   1865             local_include_dirs: ["arch-mips/include"],
   1866         },
   1867         mips64: {
   1868             local_include_dirs: ["arch-mips64/include"],
   1869         },
   1870         x86: {
   1871             local_include_dirs: ["arch-x86/include"],
   1872         },
   1873         x86_64: {
   1874             local_include_dirs: ["arch-x86_64/include"],
   1875         },
   1876     },
   1877     clang: false,
   1878 }
   1879 
   1880 cc_defaults {
   1881     name: "crt_so_defaults",
   1882 
   1883     arch: {
   1884         mips: {
   1885             cflags: ["-fPIC"],
   1886         },
   1887         mips64: {
   1888             cflags: ["-fPIC"],
   1889         },
   1890         x86: {
   1891             cflags: ["-fPIC"],
   1892         },
   1893         x86_64: {
   1894             cflags: ["-fPIC"],
   1895         },
   1896     },
   1897 }
   1898 
   1899 // Android.mk:start
   1900 // # crt obj files
   1901 // # ========================================================
   1902 // # crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
   1903 // libc_crt_target_cflags := \
   1904 //    -I$(LOCAL_PATH)/include \
   1905 //    -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \
   1906 //
   1907 // my_2nd_arch_prefix :=
   1908 // include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
   1909 // include $(LOCAL_PATH)/crt.mk
   1910 // ifdef TARGET_2ND_ARCH
   1911 // my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
   1912 // include $(LOCAL_PATH)/arch-$(TARGET_2ND_ARCH)/$(TARGET_2ND_ARCH).mk
   1913 // include $(LOCAL_PATH)/crt.mk
   1914 // my_2nd_arch_prefix :=
   1915 // endif
   1916 //
   1917 // include $(call all-makefiles-under,$(LOCAL_PATH))
   1918 // Android.mk:end
   1919 cc_object {
   1920     name: "crtbrand",
   1921     local_include_dirs: ["include"],
   1922     product_variables: {
   1923         platform_sdk_version: {
   1924             asflags: ["-DPLATFORM_SDK_VERSION=%d"],
   1925         },
   1926     },
   1927     srcs: ["arch-common/bionic/crtbrand.S"],
   1928 
   1929     defaults: [
   1930         "crt_defaults",
   1931         "crt_so_defaults",
   1932     ],
   1933 }
   1934 
   1935 // Android.mk:ignore
   1936 cc_object {
   1937     name: "crtbegin_so1",
   1938     local_include_dirs: ["include"],
   1939     srcs: ["arch-common/bionic/crtbegin_so.c"],
   1940 
   1941     defaults: [
   1942         "crt_defaults",
   1943         "crt_so_defaults",
   1944     ],
   1945 }
   1946 
   1947 // Android.mk:ignore
   1948 cc_object {
   1949     name: "crtbegin_so",
   1950 
   1951     defaults: [
   1952         "crt_defaults",
   1953         "crt_so_defaults",
   1954     ],
   1955     deps: [
   1956         "crtbegin_so1",
   1957         "crtbrand",
   1958     ],
   1959 }
   1960 
   1961 // Android.mk:ignore
   1962 cc_object {
   1963     name: "crtend_so",
   1964     local_include_dirs: ["include"],
   1965     srcs: ["arch-common/bionic/crtend_so.S"],
   1966 
   1967     defaults: [
   1968         "crt_defaults",
   1969         "crt_so_defaults",
   1970     ],
   1971 }
   1972 
   1973 // Android.mk:ignore
   1974 cc_object {
   1975     name: "crtbegin_static1",
   1976     local_include_dirs: ["include"],
   1977     srcs: ["arch-common/bionic/crtbegin.c"],
   1978 
   1979     arch: {
   1980         arm64: {
   1981             srcs: [
   1982                 "arch-arm64/bionic/crtbegin.c",
   1983             ],
   1984             exclude_srcs: [
   1985                 "arch-common/bionic/crtbegin.c",
   1986             ],
   1987         },
   1988         mips: {
   1989             srcs: [
   1990                 "arch-mips/bionic/crtbegin.c",
   1991             ],
   1992             exclude_srcs: [
   1993                 "arch-common/bionic/crtbegin.c",
   1994             ],
   1995         },
   1996         mips64: {
   1997             srcs: [
   1998                 "arch-mips64/bionic/crtbegin.c",
   1999             ],
   2000             exclude_srcs: [
   2001                 "arch-common/bionic/crtbegin.c",
   2002             ],
   2003         },
   2004     },
   2005 
   2006     defaults: ["crt_defaults"],
   2007 }
   2008 
   2009 // Android.mk:ignore
   2010 cc_object {
   2011     name: "crtbegin_static",
   2012 
   2013     deps: [
   2014         "crtbegin_static1",
   2015         "crtbrand",
   2016     ],
   2017     defaults: ["crt_defaults"],
   2018 }
   2019 
   2020 // Android.mk:ignore
   2021 cc_object {
   2022     name: "crtbegin_dynamic1",
   2023     local_include_dirs: ["include"],
   2024     srcs: ["arch-common/bionic/crtbegin.c"],
   2025 
   2026     arch: {
   2027         arm64: {
   2028             srcs: [
   2029                 "arch-arm64/bionic/crtbegin.c",
   2030             ],
   2031             exclude_srcs: [
   2032                 "arch-common/bionic/crtbegin.c",
   2033             ],
   2034         },
   2035         mips: {
   2036             srcs: [
   2037                 "arch-mips/bionic/crtbegin.c",
   2038             ],
   2039             exclude_srcs: [
   2040                 "arch-common/bionic/crtbegin.c",
   2041             ],
   2042         },
   2043         mips64: {
   2044             srcs: [
   2045                 "arch-mips64/bionic/crtbegin.c",
   2046             ],
   2047             exclude_srcs: [
   2048                 "arch-common/bionic/crtbegin.c",
   2049             ],
   2050         },
   2051     },
   2052     defaults: ["crt_defaults"],
   2053 }
   2054 
   2055 // Android.mk:ignore
   2056 cc_object {
   2057     name: "crtbegin_dynamic",
   2058 
   2059     deps: [
   2060         "crtbegin_dynamic1",
   2061         "crtbrand",
   2062     ],
   2063     defaults: ["crt_defaults"],
   2064 }
   2065 
   2066 // Android.mk:ignore
   2067 cc_object {
   2068     // We rename crtend.o to crtend_android.o to avoid a
   2069     // name clash between gcc and bionic.
   2070     name: "crtend_android",
   2071     local_include_dirs: ["include"],
   2072     srcs: ["arch-common/bionic/crtend.S"],
   2073 
   2074     defaults: ["crt_defaults"],
   2075 }
   2076