1 LOCAL_PATH := $(call my-dir) 2 3 # Make everything depend on any changes to included makefiles. 4 libc_common_additional_dependencies := $(LOCAL_PATH)/Android.mk 5 6 # Load config for TARGET_ARCH 7 my_2nd_arch_prefix := 8 include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk 9 libc_common_additional_dependencies += \ 10 $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk 11 12 13 ifdef TARGET_2ND_ARCH 14 # Load config for TARGET_2ND_ARCH 15 my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) 16 include $(LOCAL_PATH)/arch-$(TARGET_2ND_ARCH)/$(TARGET_2ND_ARCH).mk 17 my_2nd_arch_prefix := 18 libc_common_additional_dependencies += \ 19 $(LOCAL_PATH)/arch-$(TARGET_2ND_ARCH)/$(TARGET_2ND_ARCH).mk 20 endif 21 22 # crt obj files 23 # ======================================================== 24 # crtbrand.c needs <stdint.h> and a #define for the platform SDK version. 25 libc_crt_target_cflags := \ 26 -I$(LOCAL_PATH)/include \ 27 -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \ 28 29 my_2nd_arch_prefix := 30 include $(LOCAL_PATH)/crt.mk 31 ifdef TARGET_2ND_ARCH 32 my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) 33 include $(LOCAL_PATH)/crt.mk 34 my_2nd_arch_prefix := 35 endif 36 37 # Define the common source files for all the libc instances 38 # ========================================================= 39 libc_common_src_files := \ 40 bionic/bindresvport.c \ 41 bionic/daemon.c \ 42 bionic/err.c \ 43 bionic/ether_aton.c \ 44 bionic/ether_ntoa.c \ 45 bionic/fts.c \ 46 bionic/gethostname.c \ 47 bionic/getpriority.c \ 48 bionic/if_indextoname.c \ 49 bionic/if_nametoindex.c \ 50 bionic/initgroups.c \ 51 bionic/ioctl.c \ 52 bionic/isatty.c \ 53 bionic/memmem.c \ 54 bionic/pathconf.c \ 55 bionic/pututline.c \ 56 bionic/sched_cpualloc.c \ 57 bionic/sched_cpucount.c \ 58 bionic/semaphore.c \ 59 bionic/sigblock.c \ 60 bionic/siginterrupt.c \ 61 bionic/sigsetmask.c \ 62 bionic/system_properties_compat.c \ 63 stdio/findfp.c \ 64 stdio/fread.c \ 65 stdio/snprintf.c\ 66 stdio/sprintf.c \ 67 68 # Fortify implementations of libc functions. 69 libc_common_src_files += \ 70 bionic/__FD_chk.cpp \ 71 bionic/__fgets_chk.cpp \ 72 bionic/__memmove_chk.cpp \ 73 bionic/__read_chk.cpp \ 74 bionic/__recvfrom_chk.cpp \ 75 bionic/__stpcpy_chk.cpp \ 76 bionic/__stpncpy_chk.cpp \ 77 bionic/__strchr_chk.cpp \ 78 bionic/__strlcat_chk.cpp \ 79 bionic/__strlcpy_chk.cpp \ 80 bionic/__strlen_chk.cpp \ 81 bionic/__strncat_chk.cpp \ 82 bionic/__strncpy_chk.cpp \ 83 bionic/__strrchr_chk.cpp \ 84 bionic/__umask_chk.cpp \ 85 bionic/__vsnprintf_chk.cpp \ 86 bionic/__vsprintf_chk.cpp \ 87 88 libc_bionic_src_files := \ 89 bionic/abort.cpp \ 90 bionic/accept.cpp \ 91 bionic/accept4.cpp \ 92 bionic/access.cpp \ 93 bionic/assert.cpp \ 94 bionic/atof.cpp \ 95 bionic/bionic_time_conversions.cpp \ 96 bionic/brk.cpp \ 97 bionic/c16rtomb.cpp \ 98 bionic/c32rtomb.cpp \ 99 bionic/chmod.cpp \ 100 bionic/chown.cpp \ 101 bionic/clearenv.cpp \ 102 bionic/clock.cpp \ 103 bionic/clone.cpp \ 104 bionic/__cmsg_nxthdr.cpp \ 105 bionic/connect.cpp \ 106 bionic/ctype.cpp \ 107 bionic/dirent.cpp \ 108 bionic/dup2.cpp \ 109 bionic/epoll_create.cpp \ 110 bionic/epoll_pwait.cpp \ 111 bionic/epoll_wait.cpp \ 112 bionic/__errno.cpp \ 113 bionic/eventfd_read.cpp \ 114 bionic/eventfd_write.cpp \ 115 bionic/ffs.cpp \ 116 bionic/flockfile.cpp \ 117 bionic/fork.cpp \ 118 bionic/fpclassify.cpp \ 119 bionic/futimens.cpp \ 120 bionic/getauxval.cpp \ 121 bionic/getcwd.cpp \ 122 bionic/getentropy_linux.c \ 123 bionic/getpgrp.cpp \ 124 bionic/getpid.cpp \ 125 bionic/gettid.cpp \ 126 bionic/inotify_init.cpp \ 127 bionic/lchown.cpp \ 128 bionic/lfs64_support.cpp \ 129 bionic/__libc_current_sigrtmax.cpp \ 130 bionic/__libc_current_sigrtmin.cpp \ 131 bionic/libc_init_common.cpp \ 132 bionic/libc_logging.cpp \ 133 bionic/libgen.cpp \ 134 bionic/link.cpp \ 135 bionic/locale.cpp \ 136 bionic/lstat.cpp \ 137 bionic/mbrtoc16.cpp \ 138 bionic/mbrtoc32.cpp \ 139 bionic/mbstate.cpp \ 140 bionic/mkdir.cpp \ 141 bionic/mkfifo.cpp \ 142 bionic/mknod.cpp \ 143 bionic/mntent.cpp \ 144 bionic/NetdClientDispatch.cpp \ 145 bionic/open.cpp \ 146 bionic/pause.cpp \ 147 bionic/pipe.cpp \ 148 bionic/poll.cpp \ 149 bionic/posix_fadvise.cpp \ 150 bionic/posix_fallocate.cpp \ 151 bionic/posix_timers.cpp \ 152 bionic/pthread_atfork.cpp \ 153 bionic/pthread_attr.cpp \ 154 bionic/pthread_cond.cpp \ 155 bionic/pthread_create.cpp \ 156 bionic/pthread_detach.cpp \ 157 bionic/pthread_equal.cpp \ 158 bionic/pthread_exit.cpp \ 159 bionic/pthread_getcpuclockid.cpp \ 160 bionic/pthread_getschedparam.cpp \ 161 bionic/pthread_gettid_np.cpp \ 162 bionic/pthread_internals.cpp \ 163 bionic/pthread_join.cpp \ 164 bionic/pthread_key.cpp \ 165 bionic/pthread_kill.cpp \ 166 bionic/pthread_mutex.cpp \ 167 bionic/pthread_once.cpp \ 168 bionic/pthread_rwlock.cpp \ 169 bionic/pthread_self.cpp \ 170 bionic/pthread_setname_np.cpp \ 171 bionic/pthread_setschedparam.cpp \ 172 bionic/pthread_sigmask.cpp \ 173 bionic/ptrace.cpp \ 174 bionic/pty.cpp \ 175 bionic/raise.cpp \ 176 bionic/rand.cpp \ 177 bionic/readlink.cpp \ 178 bionic/reboot.cpp \ 179 bionic/recv.cpp \ 180 bionic/rename.cpp \ 181 bionic/rmdir.cpp \ 182 bionic/scandir.cpp \ 183 bionic/sched_getaffinity.cpp \ 184 bionic/sched_getcpu.cpp \ 185 bionic/send.cpp \ 186 bionic/setegid.cpp \ 187 bionic/__set_errno.cpp \ 188 bionic/seteuid.cpp \ 189 bionic/setpgrp.cpp \ 190 bionic/sigaction.cpp \ 191 bionic/sigaddset.cpp \ 192 bionic/sigdelset.cpp \ 193 bionic/sigemptyset.cpp \ 194 bionic/sigfillset.cpp \ 195 bionic/sigismember.cpp \ 196 bionic/signal.cpp \ 197 bionic/signalfd.cpp \ 198 bionic/sigpending.cpp \ 199 bionic/sigprocmask.cpp \ 200 bionic/sigsuspend.cpp \ 201 bionic/sigwait.cpp \ 202 bionic/socket.cpp \ 203 bionic/stat.cpp \ 204 bionic/statvfs.cpp \ 205 bionic/strcoll_l.cpp \ 206 bionic/strerror.cpp \ 207 bionic/strerror_r.cpp \ 208 bionic/strftime_l.cpp \ 209 bionic/strsignal.cpp \ 210 bionic/strtold.cpp \ 211 bionic/strtold_l.cpp \ 212 bionic/strtoll_l.cpp \ 213 bionic/strtoull_l.cpp \ 214 bionic/strxfrm_l.cpp \ 215 bionic/stubs.cpp \ 216 bionic/symlink.cpp \ 217 bionic/sysconf.cpp \ 218 bionic/syslog.cpp \ 219 bionic/sys_siglist.c \ 220 bionic/sys_signame.c \ 221 bionic/system_properties.cpp \ 222 bionic/tdestroy.cpp \ 223 bionic/termios.cpp \ 224 bionic/thread_private.cpp \ 225 bionic/tmpfile.cpp \ 226 bionic/umount.cpp \ 227 bionic/unlink.cpp \ 228 bionic/utimes.cpp \ 229 bionic/vdso.cpp \ 230 bionic/wait.cpp \ 231 bionic/wchar.cpp \ 232 bionic/wctype.cpp \ 233 234 libc_cxa_src_files := \ 235 bionic/__cxa_guard.cpp \ 236 bionic/__cxa_pure_virtual.cpp \ 237 bionic/new.cpp \ 238 239 libc_upstream_freebsd_src_files := \ 240 upstream-freebsd/lib/libc/gen/ldexp.c \ 241 upstream-freebsd/lib/libc/gen/sleep.c \ 242 upstream-freebsd/lib/libc/gen/usleep.c \ 243 upstream-freebsd/lib/libc/stdio/fclose.c \ 244 upstream-freebsd/lib/libc/stdio/flags.c \ 245 upstream-freebsd/lib/libc/stdio/fopen.c \ 246 upstream-freebsd/lib/libc/stdlib/abs.c \ 247 upstream-freebsd/lib/libc/stdlib/getopt_long.c \ 248 upstream-freebsd/lib/libc/stdlib/imaxabs.c \ 249 upstream-freebsd/lib/libc/stdlib/imaxdiv.c \ 250 upstream-freebsd/lib/libc/stdlib/labs.c \ 251 upstream-freebsd/lib/libc/stdlib/llabs.c \ 252 upstream-freebsd/lib/libc/stdlib/qsort.c \ 253 upstream-freebsd/lib/libc/stdlib/quick_exit.c \ 254 upstream-freebsd/lib/libc/stdlib/realpath.c \ 255 upstream-freebsd/lib/libc/string/wcpcpy.c \ 256 upstream-freebsd/lib/libc/string/wcpncpy.c \ 257 upstream-freebsd/lib/libc/string/wcscasecmp.c \ 258 upstream-freebsd/lib/libc/string/wcscspn.c \ 259 upstream-freebsd/lib/libc/string/wcsdup.c \ 260 upstream-freebsd/lib/libc/string/wcslcat.c \ 261 upstream-freebsd/lib/libc/string/wcsncasecmp.c \ 262 upstream-freebsd/lib/libc/string/wcsncat.c \ 263 upstream-freebsd/lib/libc/string/wcsncmp.c \ 264 upstream-freebsd/lib/libc/string/wcsncpy.c \ 265 upstream-freebsd/lib/libc/string/wcsnlen.c \ 266 upstream-freebsd/lib/libc/string/wcspbrk.c \ 267 upstream-freebsd/lib/libc/string/wcsspn.c \ 268 upstream-freebsd/lib/libc/string/wcstok.c \ 269 upstream-freebsd/lib/libc/string/wmemchr.c \ 270 upstream-freebsd/lib/libc/string/wmemcpy.c \ 271 upstream-freebsd/lib/libc/string/wmemset.c \ 272 273 libc_upstream_netbsd_src_files := \ 274 upstream-netbsd/common/lib/libc/stdlib/random.c \ 275 upstream-netbsd/lib/libc/gen/ftw.c \ 276 upstream-netbsd/lib/libc/gen/nftw.c \ 277 upstream-netbsd/lib/libc/gen/nice.c \ 278 upstream-netbsd/lib/libc/gen/popen.c \ 279 upstream-netbsd/lib/libc/gen/psignal.c \ 280 upstream-netbsd/lib/libc/gen/utime.c \ 281 upstream-netbsd/lib/libc/gen/utmp.c \ 282 upstream-netbsd/lib/libc/inet/nsap_addr.c \ 283 upstream-netbsd/lib/libc/regex/regcomp.c \ 284 upstream-netbsd/lib/libc/regex/regerror.c \ 285 upstream-netbsd/lib/libc/regex/regexec.c \ 286 upstream-netbsd/lib/libc/regex/regfree.c \ 287 upstream-netbsd/lib/libc/stdlib/bsearch.c \ 288 upstream-netbsd/lib/libc/stdlib/div.c \ 289 upstream-netbsd/lib/libc/stdlib/drand48.c \ 290 upstream-netbsd/lib/libc/stdlib/erand48.c \ 291 upstream-netbsd/lib/libc/stdlib/insque.c \ 292 upstream-netbsd/lib/libc/stdlib/jrand48.c \ 293 upstream-netbsd/lib/libc/stdlib/ldiv.c \ 294 upstream-netbsd/lib/libc/stdlib/lldiv.c \ 295 upstream-netbsd/lib/libc/stdlib/lrand48.c \ 296 upstream-netbsd/lib/libc/stdlib/mrand48.c \ 297 upstream-netbsd/lib/libc/stdlib/nrand48.c \ 298 upstream-netbsd/lib/libc/stdlib/_rand48.c \ 299 upstream-netbsd/lib/libc/stdlib/rand_r.c \ 300 upstream-netbsd/lib/libc/stdlib/remque.c \ 301 upstream-netbsd/lib/libc/stdlib/seed48.c \ 302 upstream-netbsd/lib/libc/stdlib/srand48.c \ 303 upstream-netbsd/lib/libc/string/memccpy.c \ 304 upstream-netbsd/lib/libc/string/strcasestr.c \ 305 upstream-netbsd/lib/libc/string/strcoll.c \ 306 upstream-netbsd/lib/libc/string/strxfrm.c \ 307 upstream-netbsd/lib/libc/unistd/killpg.c \ 308 309 libc_upstream_openbsd_gdtoa_src_files := \ 310 upstream-openbsd/android/gdtoa_support.cpp \ 311 upstream-openbsd/lib/libc/gdtoa/dmisc.c \ 312 upstream-openbsd/lib/libc/gdtoa/dtoa.c \ 313 upstream-openbsd/lib/libc/gdtoa/gdtoa.c \ 314 upstream-openbsd/lib/libc/gdtoa/gethex.c \ 315 upstream-openbsd/lib/libc/gdtoa/gmisc.c \ 316 upstream-openbsd/lib/libc/gdtoa/hd_init.c \ 317 upstream-openbsd/lib/libc/gdtoa/hdtoa.c \ 318 upstream-openbsd/lib/libc/gdtoa/hexnan.c \ 319 upstream-openbsd/lib/libc/gdtoa/ldtoa.c \ 320 upstream-openbsd/lib/libc/gdtoa/misc.c \ 321 upstream-openbsd/lib/libc/gdtoa/smisc.c \ 322 upstream-openbsd/lib/libc/gdtoa/strtod.c \ 323 upstream-openbsd/lib/libc/gdtoa/strtodg.c \ 324 upstream-openbsd/lib/libc/gdtoa/strtof.c \ 325 upstream-openbsd/lib/libc/gdtoa/strtord.c \ 326 upstream-openbsd/lib/libc/gdtoa/sum.c \ 327 upstream-openbsd/lib/libc/gdtoa/ulp.c \ 328 329 libc_upstream_openbsd_gdtoa_src_files_32 := \ 330 $(libc_upstream_openbsd_gdtoa_src_files) \ 331 332 libc_upstream_openbsd_gdtoa_src_files_64 := \ 333 $(libc_upstream_openbsd_gdtoa_src_files) \ 334 upstream-openbsd/lib/libc/gdtoa/strtorQ.c \ 335 336 libc_upstream_openbsd_src_files := \ 337 upstream-openbsd/lib/libc/crypt/arc4random.c \ 338 upstream-openbsd/lib/libc/crypt/arc4random_uniform.c \ 339 upstream-openbsd/lib/libc/gen/alarm.c \ 340 upstream-openbsd/lib/libc/gen/ctype_.c \ 341 upstream-openbsd/lib/libc/gen/exec.c \ 342 upstream-openbsd/lib/libc/gen/fnmatch.c \ 343 upstream-openbsd/lib/libc/gen/ftok.c \ 344 upstream-openbsd/lib/libc/gen/getprogname.c \ 345 upstream-openbsd/lib/libc/gen/isctype.c \ 346 upstream-openbsd/lib/libc/gen/setprogname.c \ 347 upstream-openbsd/lib/libc/gen/time.c \ 348 upstream-openbsd/lib/libc/gen/tolower_.c \ 349 upstream-openbsd/lib/libc/gen/toupper_.c \ 350 upstream-openbsd/lib/libc/locale/btowc.c \ 351 upstream-openbsd/lib/libc/locale/mbrlen.c \ 352 upstream-openbsd/lib/libc/locale/mbstowcs.c \ 353 upstream-openbsd/lib/libc/locale/mbtowc.c \ 354 upstream-openbsd/lib/libc/locale/wcscoll.c \ 355 upstream-openbsd/lib/libc/locale/wcstod.c \ 356 upstream-openbsd/lib/libc/locale/wcstof.c \ 357 upstream-openbsd/lib/libc/locale/wcstoimax.c \ 358 upstream-openbsd/lib/libc/locale/wcstol.c \ 359 upstream-openbsd/lib/libc/locale/wcstold.c \ 360 upstream-openbsd/lib/libc/locale/wcstoll.c \ 361 upstream-openbsd/lib/libc/locale/wcstombs.c \ 362 upstream-openbsd/lib/libc/locale/wcstoul.c \ 363 upstream-openbsd/lib/libc/locale/wcstoull.c \ 364 upstream-openbsd/lib/libc/locale/wcstoumax.c \ 365 upstream-openbsd/lib/libc/locale/wcsxfrm.c \ 366 upstream-openbsd/lib/libc/locale/wctob.c \ 367 upstream-openbsd/lib/libc/locale/wctomb.c \ 368 upstream-openbsd/lib/libc/net/htonl.c \ 369 upstream-openbsd/lib/libc/net/htons.c \ 370 upstream-openbsd/lib/libc/net/inet_addr.c \ 371 upstream-openbsd/lib/libc/net/inet_lnaof.c \ 372 upstream-openbsd/lib/libc/net/inet_makeaddr.c \ 373 upstream-openbsd/lib/libc/net/inet_netof.c \ 374 upstream-openbsd/lib/libc/net/inet_network.c \ 375 upstream-openbsd/lib/libc/net/inet_ntoa.c \ 376 upstream-openbsd/lib/libc/net/inet_ntop.c \ 377 upstream-openbsd/lib/libc/net/inet_pton.c \ 378 upstream-openbsd/lib/libc/net/ntohl.c \ 379 upstream-openbsd/lib/libc/net/ntohs.c \ 380 upstream-openbsd/lib/libc/stdio/asprintf.c \ 381 upstream-openbsd/lib/libc/stdio/clrerr.c \ 382 upstream-openbsd/lib/libc/stdio/dprintf.c \ 383 upstream-openbsd/lib/libc/stdio/fdopen.c \ 384 upstream-openbsd/lib/libc/stdio/feof.c \ 385 upstream-openbsd/lib/libc/stdio/ferror.c \ 386 upstream-openbsd/lib/libc/stdio/fflush.c \ 387 upstream-openbsd/lib/libc/stdio/fgetc.c \ 388 upstream-openbsd/lib/libc/stdio/fgetln.c \ 389 upstream-openbsd/lib/libc/stdio/fgetpos.c \ 390 upstream-openbsd/lib/libc/stdio/fgets.c \ 391 upstream-openbsd/lib/libc/stdio/fgetwc.c \ 392 upstream-openbsd/lib/libc/stdio/fgetws.c \ 393 upstream-openbsd/lib/libc/stdio/fileno.c \ 394 upstream-openbsd/lib/libc/stdio/fprintf.c \ 395 upstream-openbsd/lib/libc/stdio/fpurge.c \ 396 upstream-openbsd/lib/libc/stdio/fputc.c \ 397 upstream-openbsd/lib/libc/stdio/fputs.c \ 398 upstream-openbsd/lib/libc/stdio/fputwc.c \ 399 upstream-openbsd/lib/libc/stdio/fputws.c \ 400 upstream-openbsd/lib/libc/stdio/freopen.c \ 401 upstream-openbsd/lib/libc/stdio/fscanf.c \ 402 upstream-openbsd/lib/libc/stdio/fseek.c \ 403 upstream-openbsd/lib/libc/stdio/fsetpos.c \ 404 upstream-openbsd/lib/libc/stdio/ftell.c \ 405 upstream-openbsd/lib/libc/stdio/funopen.c \ 406 upstream-openbsd/lib/libc/stdio/fvwrite.c \ 407 upstream-openbsd/lib/libc/stdio/fwalk.c \ 408 upstream-openbsd/lib/libc/stdio/fwide.c \ 409 upstream-openbsd/lib/libc/stdio/fwprintf.c \ 410 upstream-openbsd/lib/libc/stdio/fwrite.c \ 411 upstream-openbsd/lib/libc/stdio/fwscanf.c \ 412 upstream-openbsd/lib/libc/stdio/getc.c \ 413 upstream-openbsd/lib/libc/stdio/getchar.c \ 414 upstream-openbsd/lib/libc/stdio/getdelim.c \ 415 upstream-openbsd/lib/libc/stdio/getline.c \ 416 upstream-openbsd/lib/libc/stdio/gets.c \ 417 upstream-openbsd/lib/libc/stdio/getwc.c \ 418 upstream-openbsd/lib/libc/stdio/getwchar.c \ 419 upstream-openbsd/lib/libc/stdio/makebuf.c \ 420 upstream-openbsd/lib/libc/stdio/mktemp.c \ 421 upstream-openbsd/lib/libc/stdio/perror.c \ 422 upstream-openbsd/lib/libc/stdio/printf.c \ 423 upstream-openbsd/lib/libc/stdio/putc.c \ 424 upstream-openbsd/lib/libc/stdio/putchar.c \ 425 upstream-openbsd/lib/libc/stdio/puts.c \ 426 upstream-openbsd/lib/libc/stdio/putwc.c \ 427 upstream-openbsd/lib/libc/stdio/putwchar.c \ 428 upstream-openbsd/lib/libc/stdio/refill.c \ 429 upstream-openbsd/lib/libc/stdio/remove.c \ 430 upstream-openbsd/lib/libc/stdio/rewind.c \ 431 upstream-openbsd/lib/libc/stdio/rget.c \ 432 upstream-openbsd/lib/libc/stdio/scanf.c \ 433 upstream-openbsd/lib/libc/stdio/setbuf.c \ 434 upstream-openbsd/lib/libc/stdio/setbuffer.c \ 435 upstream-openbsd/lib/libc/stdio/setvbuf.c \ 436 upstream-openbsd/lib/libc/stdio/sscanf.c \ 437 upstream-openbsd/lib/libc/stdio/stdio.c \ 438 upstream-openbsd/lib/libc/stdio/swprintf.c \ 439 upstream-openbsd/lib/libc/stdio/swscanf.c \ 440 upstream-openbsd/lib/libc/stdio/tempnam.c \ 441 upstream-openbsd/lib/libc/stdio/tmpnam.c \ 442 upstream-openbsd/lib/libc/stdio/ungetc.c \ 443 upstream-openbsd/lib/libc/stdio/ungetwc.c \ 444 upstream-openbsd/lib/libc/stdio/vasprintf.c \ 445 upstream-openbsd/lib/libc/stdio/vdprintf.c \ 446 upstream-openbsd/lib/libc/stdio/vfprintf.c \ 447 upstream-openbsd/lib/libc/stdio/vfscanf.c \ 448 upstream-openbsd/lib/libc/stdio/vfwprintf.c \ 449 upstream-openbsd/lib/libc/stdio/vfwscanf.c \ 450 upstream-openbsd/lib/libc/stdio/vprintf.c \ 451 upstream-openbsd/lib/libc/stdio/vscanf.c \ 452 upstream-openbsd/lib/libc/stdio/vsnprintf.c \ 453 upstream-openbsd/lib/libc/stdio/vsprintf.c \ 454 upstream-openbsd/lib/libc/stdio/vsscanf.c \ 455 upstream-openbsd/lib/libc/stdio/vswprintf.c \ 456 upstream-openbsd/lib/libc/stdio/vswscanf.c \ 457 upstream-openbsd/lib/libc/stdio/vwprintf.c \ 458 upstream-openbsd/lib/libc/stdio/vwscanf.c \ 459 upstream-openbsd/lib/libc/stdio/wbuf.c \ 460 upstream-openbsd/lib/libc/stdio/wprintf.c \ 461 upstream-openbsd/lib/libc/stdio/wscanf.c \ 462 upstream-openbsd/lib/libc/stdio/wsetup.c \ 463 upstream-openbsd/lib/libc/stdlib/atexit.c \ 464 upstream-openbsd/lib/libc/stdlib/atoi.c \ 465 upstream-openbsd/lib/libc/stdlib/atol.c \ 466 upstream-openbsd/lib/libc/stdlib/atoll.c \ 467 upstream-openbsd/lib/libc/stdlib/exit.c \ 468 upstream-openbsd/lib/libc/stdlib/getenv.c \ 469 upstream-openbsd/lib/libc/stdlib/lsearch.c \ 470 upstream-openbsd/lib/libc/stdlib/setenv.c \ 471 upstream-openbsd/lib/libc/stdlib/strtoimax.c \ 472 upstream-openbsd/lib/libc/stdlib/strtol.c \ 473 upstream-openbsd/lib/libc/stdlib/strtoll.c \ 474 upstream-openbsd/lib/libc/stdlib/strtoul.c \ 475 upstream-openbsd/lib/libc/stdlib/strtoull.c \ 476 upstream-openbsd/lib/libc/stdlib/strtoumax.c \ 477 upstream-openbsd/lib/libc/stdlib/system.c \ 478 upstream-openbsd/lib/libc/stdlib/tfind.c \ 479 upstream-openbsd/lib/libc/stdlib/tsearch.c \ 480 upstream-openbsd/lib/libc/string/strcasecmp.c \ 481 upstream-openbsd/lib/libc/string/strcspn.c \ 482 upstream-openbsd/lib/libc/string/strdup.c \ 483 upstream-openbsd/lib/libc/string/strndup.c \ 484 upstream-openbsd/lib/libc/string/strpbrk.c \ 485 upstream-openbsd/lib/libc/string/strsep.c \ 486 upstream-openbsd/lib/libc/string/strspn.c \ 487 upstream-openbsd/lib/libc/string/strstr.c \ 488 upstream-openbsd/lib/libc/string/strtok.c \ 489 upstream-openbsd/lib/libc/string/wcslcpy.c \ 490 upstream-openbsd/lib/libc/string/wcsstr.c \ 491 upstream-openbsd/lib/libc/string/wcswidth.c \ 492 493 libc_arch_static_src_files := \ 494 bionic/dl_iterate_phdr_static.cpp \ 495 496 # Define some common cflags 497 # ======================================================== 498 libc_common_cflags := \ 499 -D_LIBC=1 \ 500 -Wall -Wextra -Wunused \ 501 502 ifneq ($(TARGET_USES_LOGD),false) 503 libc_common_cflags += -DTARGET_USES_LOGD 504 endif 505 506 use_clang := $(USE_CLANG_PLATFORM_BUILD) 507 ifeq ($(use_clang),) 508 use_clang := false 509 endif 510 511 # Try to catch typical 32-bit assumptions that break with 64-bit pointers. 512 libc_common_cflags += \ 513 -Werror=pointer-to-int-cast \ 514 -Werror=int-to-pointer-cast \ 515 -Werror=type-limits \ 516 -Werror \ 517 518 ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true) 519 libc_common_cflags += -DDEBUG 520 endif 521 522 ifeq ($(MALLOC_IMPL),dlmalloc) 523 libc_common_cflags += -DUSE_DLMALLOC 524 libc_malloc_src := bionic/dlmalloc.c 525 else 526 libc_common_cflags += -DUSE_JEMALLOC 527 libc_malloc_src := bionic/jemalloc_wrapper.cpp 528 libc_common_c_includes += external/jemalloc/include 529 endif 530 531 # To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in 532 # the appropriate BoardConfig.mk file. 533 # 534 ifneq ($(BOARD_MALLOC_ALIGNMENT),) 535 libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT) 536 endif 537 538 # Define ANDROID_SMP appropriately. 539 ifeq ($(TARGET_CPU_SMP),true) 540 libc_common_cflags += -DANDROID_SMP=1 541 else 542 libc_common_cflags += -DANDROID_SMP=0 543 endif 544 545 # Define some common conlyflags 546 libc_common_conlyflags := \ 547 -std=gnu99 548 549 # Define some common cppflags 550 libc_common_cppflags := \ 551 -std=gnu++11 552 553 # Define some common includes 554 # ======================================================== 555 libc_common_c_includes += \ 556 $(LOCAL_PATH)/stdio \ 557 558 # ======================================================== 559 # Add in the arch-specific flags. 560 # Must be called with $(eval). 561 # $(1): the LOCAL_ variable name 562 # $(2): the bionic variable name to pull in 563 define patch-up-arch-specific-flags 564 $(1)_$(TARGET_ARCH) += $($(2)_$(TARGET_ARCH)) 565 ifdef TARGET_2ND_ARCH 566 $(1)_$(TARGET_2ND_ARCH) += $($(2)_$(TARGET_2ND_ARCH)) 567 endif 568 endef 569 570 571 # ======================================================== 572 # libc_stack_protector.a - stack protector code 573 # ======================================================== 574 # 575 # The stack protector code needs to be compiled 576 # with -fno-stack-protector, since it modifies the 577 # stack canary. 578 579 include $(CLEAR_VARS) 580 581 LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp 582 LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector 583 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 584 LOCAL_CPPFLAGS := $(libc_common_cppflags) 585 LOCAL_C_INCLUDES := $(libc_common_c_includes) 586 LOCAL_MODULE := libc_stack_protector 587 LOCAL_CLANG := $(use_clang) 588 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 589 LOCAL_SYSTEM_SHARED_LIBRARIES := 590 591 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) 592 include $(BUILD_STATIC_LIBRARY) 593 594 595 # ======================================================== 596 # libc_tzcode.a - upstream 'tzcode' code 597 # ======================================================== 598 599 include $(CLEAR_VARS) 600 601 LOCAL_SRC_FILES := $(call all-c-files-under,tzcode) 602 # tzcode doesn't include wcsftime, so we use the OpenBSD one. 603 LOCAL_SRC_FILES += upstream-openbsd/lib/libc/time/wcsftime.c 604 605 LOCAL_CFLAGS := $(libc_common_cflags) \ 606 -fvisibility=hidden \ 607 608 # Don't use ridiculous amounts of stack. 609 LOCAL_CFLAGS += -DALL_STATE 610 # Include tzsetwall, timelocal, timegm, time2posix, and posix2time. 611 LOCAL_CFLAGS += -DSTD_INSPIRED 612 # The name of the tm_gmtoff field in our struct tm. 613 LOCAL_CFLAGS += -DTM_GMTOFF=tm_gmtoff 614 # Where we store our tzdata. 615 LOCAL_CFLAGS += -DTZDIR=\"/system/usr/share/zoneinfo\" 616 # Include timezone and daylight globals. 617 LOCAL_CFLAGS += -DUSG_COMPAT=1 618 LOCAL_CFLAGS += -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU 619 LOCAL_CFLAGS += -Dlint 620 621 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 622 LOCAL_CPPFLAGS := $(libc_common_cppflags) 623 LOCAL_C_INCLUDES := $(libc_common_c_includes) $(LOCAL_PATH)/tzcode/ 624 LOCAL_MODULE := libc_tzcode 625 LOCAL_CLANG := $(use_clang) 626 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 627 LOCAL_SYSTEM_SHARED_LIBRARIES := 628 629 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) 630 include $(BUILD_STATIC_LIBRARY) 631 632 633 # ======================================================== 634 # libc_dns.a - modified NetBSD DNS code 635 # ======================================================== 636 637 include $(CLEAR_VARS) 638 639 LOCAL_SRC_FILES := \ 640 $(call all-c-files-under,dns) \ 641 upstream-netbsd/lib/libc/isc/ev_streams.c \ 642 upstream-netbsd/lib/libc/isc/ev_timers.c \ 643 upstream-netbsd/lib/libc/resolv/mtctxres.c \ 644 645 LOCAL_CFLAGS := \ 646 $(libc_common_cflags) \ 647 -DANDROID_CHANGES \ 648 -DINET6 \ 649 -fvisibility=hidden \ 650 -Wno-unused-parameter \ 651 -I$(LOCAL_PATH)/dns/include \ 652 -I$(LOCAL_PATH)/private \ 653 -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \ 654 -I$(LOCAL_PATH)/upstream-netbsd/android/include \ 655 -include netbsd-compat.h \ 656 657 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 658 LOCAL_CPPFLAGS := $(libc_common_cppflags) 659 LOCAL_C_INCLUDES := $(libc_common_c_includes) 660 LOCAL_MODULE := libc_dns 661 LOCAL_CLANG := $(use_clang) 662 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 663 LOCAL_SYSTEM_SHARED_LIBRARIES := 664 665 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) 666 include $(BUILD_STATIC_LIBRARY) 667 668 669 # ======================================================== 670 # libc_freebsd.a - upstream FreeBSD C library code 671 # ======================================================== 672 # 673 # These files are built with the freebsd-compat.h header file 674 # automatically included. 675 676 include $(CLEAR_VARS) 677 678 LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files) 679 LOCAL_CFLAGS := \ 680 $(libc_common_cflags) \ 681 -Wno-sign-compare -Wno-uninitialized \ 682 -I$(LOCAL_PATH)/upstream-freebsd/android/include \ 683 -I$(LOCAL_PATH)/upstream-freebsd/lib/libc/include \ 684 -include freebsd-compat.h \ 685 686 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 687 LOCAL_CPPFLAGS := $(libc_common_cppflags) 688 LOCAL_C_INCLUDES := $(libc_common_c_includes) 689 LOCAL_MODULE := libc_freebsd 690 LOCAL_CLANG := $(use_clang) 691 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 692 LOCAL_SYSTEM_SHARED_LIBRARIES := 693 694 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) 695 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_freebsd_src_files)) 696 include $(BUILD_STATIC_LIBRARY) 697 698 699 # ======================================================== 700 # libc_netbsd.a - upstream NetBSD C library code 701 # ======================================================== 702 # 703 # These files are built with the netbsd-compat.h header file 704 # automatically included. 705 706 include $(CLEAR_VARS) 707 708 LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files) 709 LOCAL_CFLAGS := \ 710 $(libc_common_cflags) \ 711 -Wno-sign-compare -Wno-uninitialized \ 712 -DPOSIX_MISTAKE \ 713 -I$(LOCAL_PATH)/upstream-netbsd/android/include \ 714 -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \ 715 -include netbsd-compat.h \ 716 717 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 718 LOCAL_CPPFLAGS := $(libc_common_cppflags) 719 LOCAL_C_INCLUDES := $(libc_common_c_includes) 720 LOCAL_MODULE := libc_netbsd 721 LOCAL_CLANG := $(use_clang) 722 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 723 LOCAL_SYSTEM_SHARED_LIBRARIES := 724 725 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) 726 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_netbsd_src_files)) 727 include $(BUILD_STATIC_LIBRARY) 728 729 730 # ======================================================== 731 # libc_openbsd.a - upstream OpenBSD C library code 732 # ======================================================== 733 # 734 # These files are built with the openbsd-compat.h header file 735 # automatically included. 736 737 include $(CLEAR_VARS) 738 739 LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files) 740 ifneq (,$(filter $(TARGET_ARCH),x86 x86_64)) 741 # Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651. 742 LOCAL_CLANG := false 743 else 744 LOCAL_CLANG := $(use_clang) 745 endif 746 747 LOCAL_CFLAGS := \ 748 $(libc_common_cflags) \ 749 -Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter \ 750 -I$(LOCAL_PATH)/private \ 751 -I$(LOCAL_PATH)/upstream-openbsd/android/include \ 752 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \ 753 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/gdtoa/ \ 754 -include openbsd-compat.h \ 755 756 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 757 LOCAL_CPPFLAGS := $(libc_common_cppflags) 758 LOCAL_C_INCLUDES := $(libc_common_c_includes) 759 LOCAL_MODULE := libc_openbsd 760 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 761 LOCAL_SYSTEM_SHARED_LIBRARIES := 762 763 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) 764 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_openbsd_src_files)) 765 include $(BUILD_STATIC_LIBRARY) 766 767 768 # ======================================================== 769 # libc_gdtoa.a - upstream OpenBSD C library gdtoa code 770 # ======================================================== 771 # 772 # These files are built with the openbsd-compat.h header file 773 # automatically included. 774 775 include $(CLEAR_VARS) 776 777 LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32) 778 LOCAL_SRC_FILES_64 := $(libc_upstream_openbsd_gdtoa_src_files_64) 779 ifneq (,$(filter $(TARGET_ARCH),x86 x86_64)) 780 # Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651. 781 LOCAL_CLANG := false 782 else 783 LOCAL_CLANG := $(use_clang) 784 endif 785 786 LOCAL_CFLAGS := \ 787 $(libc_common_cflags) \ 788 -Wno-sign-compare -Wno-uninitialized \ 789 -fvisibility=hidden \ 790 -I$(LOCAL_PATH)/private \ 791 -I$(LOCAL_PATH)/upstream-openbsd/android/include \ 792 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \ 793 -include openbsd-compat.h \ 794 795 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 796 LOCAL_CPPFLAGS := $(libc_common_cppflags) 797 LOCAL_C_INCLUDES := $(libc_common_c_includes) 798 LOCAL_MODULE := libc_gdtoa 799 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 800 LOCAL_SYSTEM_SHARED_LIBRARIES := 801 802 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) 803 include $(BUILD_STATIC_LIBRARY) 804 805 806 # ======================================================== 807 # libc_bionic.a - home-grown C library code 808 # ======================================================== 809 810 include $(CLEAR_VARS) 811 812 LOCAL_SRC_FILES := $(libc_bionic_src_files) 813 LOCAL_CFLAGS := $(libc_common_cflags) \ 814 -Wframe-larger-than=2048 \ 815 816 ifeq ($(TARGET_ARCH),x86_64) 817 # Clang assembler has problem with ssse3-strcmp-slm.S, http://b/17302991 818 LOCAL_CLANG_ASFLAGS += -no-integrated-as 819 endif 820 821 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 822 LOCAL_CPPFLAGS := $(libc_common_cppflags) 823 LOCAL_C_INCLUDES := $(libc_common_c_includes) 824 LOCAL_MODULE := libc_bionic 825 LOCAL_CLANG := $(use_clang) 826 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 827 LOCAL_SYSTEM_SHARED_LIBRARIES := 828 829 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) 830 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_bionic_src_files)) 831 include $(BUILD_STATIC_LIBRARY) 832 833 834 # ======================================================== 835 # libc_cxa.a - Things traditionally in libstdc++ 836 # ======================================================== 837 838 include $(CLEAR_VARS) 839 840 LOCAL_SRC_FILES := $(libc_cxa_src_files) 841 LOCAL_CFLAGS := $(libc_common_cflags) \ 842 -fvisibility=hidden \ 843 844 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 845 LOCAL_CPPFLAGS := $(libc_common_cppflags) 846 LOCAL_C_INCLUDES := $(libc_common_c_includes) 847 LOCAL_MODULE := libc_cxa 848 # GCC refuses to hide new/delete 849 LOCAL_CLANG := true 850 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 851 LOCAL_SYSTEM_SHARED_LIBRARIES := 852 853 include $(BUILD_STATIC_LIBRARY) 854 855 856 # ======================================================== 857 # libc_syscalls.a 858 # ======================================================== 859 860 include $(CLEAR_VARS) 861 862 LOCAL_SRC_FILES_$(TARGET_ARCH) := $(call all-S-files-under,arch-$(TARGET_ARCH)/syscalls) 863 ifdef TARGET_2ND_ARCH 864 LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) := $(call all-S-files-under,arch-$(TARGET_2ND_ARCH)/syscalls) 865 endif 866 LOCAL_MODULE := libc_syscalls 867 LOCAL_CLANG := $(use_clang) 868 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 869 LOCAL_SYSTEM_SHARED_LIBRARIES := 870 871 include $(BUILD_STATIC_LIBRARY) 872 873 874 # ======================================================== 875 # libc_aeabi.a 876 # This is an LP32 ARM-only library that needs to be built with -fno-builtin 877 # to avoid infinite recursion. For the other architectures we just build an 878 # empty library to keep this makefile simple. 879 # ======================================================== 880 881 include $(CLEAR_VARS) 882 883 LOCAL_SRC_FILES_arm := arch-arm/bionic/__aeabi.c 884 LOCAL_MODULE := libc_aeabi 885 LOCAL_CLANG := $(use_clang) 886 LOCAL_CFLAGS := $(libc_common_cflags) -fno-builtin 887 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 888 LOCAL_SYSTEM_SHARED_LIBRARIES := 889 890 include $(BUILD_STATIC_LIBRARY) 891 892 # ======================================================== 893 # libc_common.a 894 # ======================================================== 895 896 include $(CLEAR_VARS) 897 898 LOCAL_SRC_FILES := $(libc_common_src_files) 899 LOCAL_CFLAGS := $(libc_common_cflags) 900 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 901 LOCAL_CPPFLAGS := $(libc_common_cppflags) 902 LOCAL_C_INCLUDES := $(libc_common_c_includes) 903 LOCAL_MODULE := libc_common 904 LOCAL_CLANG := $(use_clang) 905 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 906 LOCAL_WHOLE_STATIC_LIBRARIES := \ 907 libc_bionic \ 908 libc_cxa \ 909 libc_dns \ 910 libc_freebsd \ 911 libc_gdtoa \ 912 libc_malloc \ 913 libc_netbsd \ 914 libc_openbsd \ 915 libc_stack_protector \ 916 libc_syscalls \ 917 libc_tzcode \ 918 919 LOCAL_WHOLE_STATIC_LIBRARIES_arm := libc_aeabi 920 921 ifneq ($(MALLOC_IMPL),dlmalloc) 922 LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc 923 endif 924 925 LOCAL_SYSTEM_SHARED_LIBRARIES := 926 927 # TODO: split out the asflags. 928 LOCAL_ASFLAGS := $(LOCAL_CFLAGS) 929 930 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) 931 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_common_src_files)) 932 $(eval $(call patch-up-arch-specific-flags,LOCAL_ASFLAGS,LOCAL_CFLAGS)) 933 include $(BUILD_STATIC_LIBRARY) 934 935 936 # ======================================================== 937 # libc_nomalloc.a 938 # ======================================================== 939 # 940 # This is a version of the static C library that does not 941 # include malloc. It's useful in situations when the user wants 942 # to provide their own malloc implementation, or wants to 943 # explicitly disallow the use of malloc, such as in the 944 # dynamic linker. 945 946 include $(CLEAR_VARS) 947 948 LOCAL_SRC_FILES := \ 949 $(libc_arch_static_src_files) \ 950 $(libc_static_common_src_files) \ 951 bionic/libc_init_static.cpp 952 953 LOCAL_C_INCLUDES := $(libc_common_c_includes) 954 LOCAL_CFLAGS := $(libc_common_cflags) \ 955 -DLIBC_STATIC \ 956 957 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 958 LOCAL_CPPFLAGS := $(libc_common_cppflags) 959 960 LOCAL_MODULE := libc_nomalloc 961 LOCAL_CLANG := $(use_clang) 962 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 963 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common 964 LOCAL_SYSTEM_SHARED_LIBRARIES := 965 966 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) 967 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files)) 968 include $(BUILD_STATIC_LIBRARY) 969 970 971 # ======================================================== 972 # libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc). 973 # ======================================================== 974 975 include $(CLEAR_VARS) 976 LOCAL_SRC_FILES := $(libc_malloc_src) 977 LOCAL_CFLAGS := $(libc_common_cflags) \ 978 -fvisibility=hidden \ 979 980 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 981 LOCAL_CPPFLAGS := $(libc_common_cppflags) 982 LOCAL_C_INCLUDES := $(libc_common_c_includes) 983 LOCAL_MODULE := libc_malloc 984 LOCAL_CLANG := $(use_clang) 985 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 986 include $(BUILD_STATIC_LIBRARY) 987 988 989 # ======================================================== 990 # libc.a 991 # ======================================================== 992 include $(CLEAR_VARS) 993 994 LOCAL_SRC_FILES := \ 995 $(libc_arch_static_src_files) \ 996 $(libc_static_common_src_files) \ 997 bionic/malloc_debug_common.cpp \ 998 bionic/libc_init_static.cpp \ 999 1000 LOCAL_CFLAGS := $(libc_common_cflags) \ 1001 -DLIBC_STATIC \ 1002 1003 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 1004 LOCAL_CPPFLAGS := $(libc_common_cppflags) 1005 LOCAL_C_INCLUDES := $(libc_common_c_includes) 1006 LOCAL_MODULE := libc 1007 LOCAL_CLANG := $(use_clang) 1008 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 1009 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common 1010 LOCAL_SYSTEM_SHARED_LIBRARIES := 1011 1012 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) 1013 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files)) 1014 include $(BUILD_STATIC_LIBRARY) 1015 1016 1017 # ======================================================== 1018 # libc.so 1019 # ======================================================== 1020 include $(CLEAR_VARS) 1021 1022 LOCAL_CFLAGS := $(libc_common_cflags) 1023 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 1024 LOCAL_CPPFLAGS := $(libc_common_cppflags) 1025 LOCAL_C_INCLUDES := $(libc_common_c_includes) 1026 LOCAL_SRC_FILES := \ 1027 $(libc_arch_dynamic_src_files) \ 1028 $(libc_static_common_src_files) \ 1029 bionic/malloc_debug_common.cpp \ 1030 bionic/libc_init_dynamic.cpp \ 1031 bionic/NetdClient.cpp \ 1032 1033 LOCAL_MODULE := libc 1034 LOCAL_CLANG := $(use_clang) 1035 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 1036 LOCAL_REQUIRED_MODULES := tzdata 1037 1038 # Leave the symbols in the shared library so that stack unwinders can produce 1039 # meaningful name resolution. 1040 LOCAL_STRIP_MODULE := keep_symbols 1041 1042 # WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries, 1043 # make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This 1044 # ensures that symbols that are pulled into those new libraries from libgcc.a are not declared 1045 # external; if that were the case, then libc would not pull those symbols from libgcc.a as it 1046 # should, instead relying on the external symbols from the dependent libraries. That would 1047 # create a "cloaked" dependency on libgcc.a in libc though the libraries, which is not what 1048 # you wanted! 1049 1050 LOCAL_SHARED_LIBRARIES := libdl 1051 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common 1052 LOCAL_SYSTEM_SHARED_LIBRARIES := 1053 1054 # We'd really like to do this for all architectures, but since this wasn't done 1055 # before, these symbols must continue to be exported on LP32 for binary 1056 # compatibility. 1057 LOCAL_LDFLAGS_arm64 := -Wl,--exclude-libs,libgcc.a 1058 LOCAL_LDFLAGS_mips64 := -Wl,--exclude-libs,libgcc.a 1059 LOCAL_LDFLAGS_x86_64 := -Wl,--exclude-libs,libgcc.a 1060 1061 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) 1062 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src_files)) 1063 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_static_common_src_files)) 1064 # special for arm 1065 LOCAL_NO_CRT_arm := true 1066 LOCAL_CFLAGS_arm += -DCRT_LEGACY_WORKAROUND 1067 LOCAL_SRC_FILES_arm += \ 1068 arch-common/bionic/crtbegin_so.c \ 1069 arch-arm/bionic/atexit_legacy.c \ 1070 arch-common/bionic/crtend_so.S 1071 1072 include $(BUILD_SHARED_LIBRARY) 1073 1074 1075 # For all builds, except for the -user build we will enable memory 1076 # allocation checking (including memory leaks, buffer overwrites, etc.) 1077 # Note that all these checks are also controlled by env. settings 1078 # that can enable, or disable specific checks. Note also that some of 1079 # the checks are available only in emulator and are implemeted in 1080 # libc_malloc_qemu_instrumented.so. 1081 ifneq ($(TARGET_BUILD_VARIANT),user) 1082 1083 # ======================================================== 1084 # libc_malloc_debug_leak.so 1085 # ======================================================== 1086 include $(CLEAR_VARS) 1087 1088 LOCAL_CFLAGS := \ 1089 $(libc_common_cflags) \ 1090 -DMALLOC_LEAK_CHECK \ 1091 1092 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 1093 LOCAL_CPPFLAGS := $(libc_common_cppflags) 1094 1095 # Make sure that unwind.h comes from libunwind. 1096 LOCAL_C_INCLUDES := \ 1097 $(libc_common_c_includes) \ 1098 1099 LOCAL_SRC_FILES := \ 1100 bionic/debug_mapinfo.cpp \ 1101 bionic/debug_stacktrace.cpp \ 1102 bionic/libc_logging.cpp \ 1103 bionic/malloc_debug_leak.cpp \ 1104 bionic/malloc_debug_check.cpp \ 1105 1106 LOCAL_MODULE := libc_malloc_debug_leak 1107 LOCAL_CLANG := $(use_clang) 1108 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 1109 1110 LOCAL_SHARED_LIBRARIES := libc libdl 1111 LOCAL_SYSTEM_SHARED_LIBRARIES := 1112 # Only need this for arm since libc++ uses its own unwind code that 1113 # doesn't mix with the other default unwind code. 1114 LOCAL_STATIC_LIBRARIES_arm := libc++ 1115 LOCAL_ALLOW_UNDEFINED_SYMBOLS := true 1116 1117 # Don't install on release build 1118 LOCAL_MODULE_TAGS := eng debug 1119 1120 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) 1121 include $(BUILD_SHARED_LIBRARY) 1122 1123 1124 # ======================================================== 1125 # libc_malloc_debug_qemu.so 1126 # ======================================================== 1127 include $(CLEAR_VARS) 1128 1129 LOCAL_CFLAGS := \ 1130 $(libc_common_cflags) \ 1131 -DMALLOC_QEMU_INSTRUMENT \ 1132 1133 LOCAL_CONLYFLAGS := $(libc_common_conlyflags) 1134 LOCAL_CPPFLAGS := $(libc_common_cppflags) 1135 1136 LOCAL_C_INCLUDES := $(libc_common_c_includes) 1137 1138 LOCAL_SRC_FILES := \ 1139 bionic/libc_logging.cpp \ 1140 bionic/malloc_debug_qemu.cpp \ 1141 1142 LOCAL_MODULE := libc_malloc_debug_qemu 1143 LOCAL_CLANG := $(use_clang) 1144 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) 1145 1146 LOCAL_SHARED_LIBRARIES := libc libdl 1147 LOCAL_SYSTEM_SHARED_LIBRARIES := 1148 1149 # Don't install on release build 1150 LOCAL_MODULE_TAGS := eng debug 1151 1152 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) 1153 include $(BUILD_SHARED_LIBRARY) 1154 1155 endif #!user 1156 1157 # ======================================================== 1158 # libstdc++.so 1159 # ======================================================== 1160 libstdcxx_common_src_files := \ 1161 bionic/__cxa_guard.cpp \ 1162 bionic/__cxa_pure_virtual.cpp \ 1163 bionic/new.cpp \ 1164 bionic/libc_logging.cpp \ 1165 1166 include $(CLEAR_VARS) 1167 LOCAL_C_INCLUDES := $(libc_common_c_includes) 1168 LOCAL_CFLAGS := $(libc_common_cflags) 1169 LOCAL_CPPFLAGS := $(libc_common_cppflags) 1170 LOCAL_SRC_FILES := $(libstdcxx_common_src_files) 1171 LOCAL_MODULE:= libstdc++ 1172 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 1173 LOCAL_SYSTEM_SHARED_LIBRARIES := libc 1174 include $(BUILD_SHARED_LIBRARY) 1175 1176 # ======================================================== 1177 # libstdc++.a 1178 # ======================================================== 1179 include $(CLEAR_VARS) 1180 LOCAL_C_INCLUDES := $(libc_common_c_includes) 1181 LOCAL_CFLAGS := $(libc_common_cflags) 1182 LOCAL_CPPFLAGS := $(libc_common_cppflags) 1183 LOCAL_SRC_FILES := $(libstdcxx_common_src_files) 1184 LOCAL_MODULE:= libstdc++ 1185 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 1186 LOCAL_SYSTEM_SHARED_LIBRARIES := libc 1187 include $(BUILD_STATIC_LIBRARY) 1188 1189 1190 # ======================================================== 1191 include $(call all-makefiles-under,$(LOCAL_PATH)) 1192