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