2009-03-04 04:28:35 +01:00
|
|
|
LOCAL_PATH:= $(call my-dir)
|
|
|
|
|
|
|
|
include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/syscalls.mk
|
2009-05-27 19:52:37 +02:00
|
|
|
|
|
|
|
# Define the common source files for all the libc instances
|
|
|
|
# =========================================================
|
2009-03-04 04:28:35 +01:00
|
|
|
libc_common_src_files := \
|
|
|
|
$(syscall_src) \
|
|
|
|
unistd/abort.c \
|
|
|
|
unistd/alarm.c \
|
|
|
|
unistd/brk.c \
|
|
|
|
unistd/creat.c \
|
|
|
|
unistd/daemon.c \
|
2010-09-26 22:29:14 +02:00
|
|
|
unistd/eventfd.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
unistd/exec.c \
|
|
|
|
unistd/fcntl.c \
|
|
|
|
unistd/fnmatch.c \
|
2010-07-09 01:52:27 +02:00
|
|
|
unistd/fstatfs.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
unistd/ftime.c \
|
|
|
|
unistd/ftok.c \
|
|
|
|
unistd/getcwd.c \
|
|
|
|
unistd/getdtablesize.c \
|
|
|
|
unistd/gethostname.c \
|
|
|
|
unistd/getopt_long.c \
|
|
|
|
unistd/getpgrp.c \
|
|
|
|
unistd/getpriority.c \
|
|
|
|
unistd/getpt.c \
|
|
|
|
unistd/initgroups.c \
|
|
|
|
unistd/isatty.c \
|
|
|
|
unistd/issetugid.c \
|
2010-01-14 01:39:26 +01:00
|
|
|
unistd/killpg.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
unistd/lseek64.c \
|
|
|
|
unistd/mmap.c \
|
|
|
|
unistd/nice.c \
|
|
|
|
unistd/open.c \
|
|
|
|
unistd/openat.c \
|
|
|
|
unistd/opendir.c \
|
|
|
|
unistd/pathconf.c \
|
|
|
|
unistd/perror.c \
|
|
|
|
unistd/popen.c \
|
|
|
|
unistd/pread.c \
|
|
|
|
unistd/pselect.c \
|
|
|
|
unistd/ptsname.c \
|
|
|
|
unistd/ptsname_r.c \
|
|
|
|
unistd/pwrite.c \
|
|
|
|
unistd/raise.c \
|
|
|
|
unistd/reboot.c \
|
|
|
|
unistd/recv.c \
|
|
|
|
unistd/sbrk.c \
|
|
|
|
unistd/send.c \
|
|
|
|
unistd/setegid.c \
|
2010-03-02 19:55:58 +01:00
|
|
|
unistd/setuid.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
unistd/seteuid.c \
|
2010-03-02 19:55:58 +01:00
|
|
|
unistd/setreuid.c \
|
|
|
|
unistd/setresuid.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
unistd/setpgrp.c \
|
|
|
|
unistd/sigblock.c \
|
|
|
|
unistd/siginterrupt.c \
|
|
|
|
unistd/siglist.c \
|
|
|
|
unistd/signal.c \
|
2009-10-02 15:39:00 +02:00
|
|
|
unistd/signame.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
unistd/sigsetmask.c \
|
|
|
|
unistd/sigsuspend.c \
|
|
|
|
unistd/sigwait.c \
|
|
|
|
unistd/sleep.c \
|
|
|
|
unistd/statfs.c \
|
|
|
|
unistd/strsignal.c \
|
|
|
|
unistd/syslog.c \
|
|
|
|
unistd/system.c \
|
|
|
|
unistd/tcgetpgrp.c \
|
|
|
|
unistd/tcsetpgrp.c \
|
|
|
|
unistd/time.c \
|
|
|
|
unistd/umount.c \
|
|
|
|
unistd/unlockpt.c \
|
|
|
|
unistd/usleep.c \
|
|
|
|
unistd/wait.c \
|
|
|
|
stdio/asprintf.c \
|
|
|
|
stdio/clrerr.c \
|
|
|
|
stdio/fclose.c \
|
|
|
|
stdio/fdopen.c \
|
|
|
|
stdio/feof.c \
|
|
|
|
stdio/ferror.c \
|
|
|
|
stdio/fflush.c \
|
|
|
|
stdio/fgetc.c \
|
|
|
|
stdio/fgetln.c \
|
|
|
|
stdio/fgetpos.c \
|
|
|
|
stdio/fgets.c \
|
|
|
|
stdio/fileno.c \
|
|
|
|
stdio/findfp.c \
|
|
|
|
stdio/flags.c \
|
|
|
|
stdio/flockfile.c \
|
|
|
|
stdio/fopen.c \
|
|
|
|
stdio/fprintf.c \
|
|
|
|
stdio/fpurge.c \
|
|
|
|
stdio/fputc.c \
|
|
|
|
stdio/fputs.c \
|
|
|
|
stdio/fread.c \
|
|
|
|
stdio/freopen.c \
|
|
|
|
stdio/fscanf.c \
|
|
|
|
stdio/fseek.c \
|
|
|
|
stdio/fsetpos.c \
|
|
|
|
stdio/ftell.c \
|
|
|
|
stdio/funopen.c \
|
|
|
|
stdio/fvwrite.c \
|
|
|
|
stdio/fwalk.c \
|
|
|
|
stdio/fwrite.c \
|
|
|
|
stdio/getc.c \
|
|
|
|
stdio/getchar.c \
|
|
|
|
stdio/gets.c \
|
|
|
|
stdio/makebuf.c \
|
|
|
|
stdio/mktemp.c \
|
|
|
|
stdio/printf.c \
|
|
|
|
stdio/putc.c \
|
|
|
|
stdio/putchar.c \
|
|
|
|
stdio/puts.c \
|
|
|
|
stdio/putw.c \
|
|
|
|
stdio/refill.c \
|
|
|
|
stdio/remove.c \
|
|
|
|
stdio/rewind.c \
|
|
|
|
stdio/rget.c \
|
|
|
|
stdio/scanf.c \
|
|
|
|
stdio/setbuf.c \
|
|
|
|
stdio/setbuffer.c \
|
|
|
|
stdio/setvbuf.c \
|
|
|
|
stdio/snprintf.c\
|
|
|
|
stdio/sprintf.c \
|
|
|
|
stdio/sscanf.c \
|
|
|
|
stdio/stdio.c \
|
|
|
|
stdio/tempnam.c \
|
|
|
|
stdio/tmpfile.c \
|
|
|
|
stdio/tmpnam.c \
|
|
|
|
stdio/ungetc.c \
|
|
|
|
stdio/vasprintf.c \
|
|
|
|
stdio/vfprintf.c \
|
|
|
|
stdio/vfscanf.c \
|
|
|
|
stdio/vprintf.c \
|
|
|
|
stdio/vsnprintf.c \
|
|
|
|
stdio/vsprintf.c \
|
|
|
|
stdio/vscanf.c \
|
|
|
|
stdio/vsscanf.c \
|
|
|
|
stdio/wbuf.c \
|
|
|
|
stdio/wsetup.c \
|
|
|
|
stdlib/_rand48.c \
|
|
|
|
stdlib/assert.c \
|
|
|
|
stdlib/atexit.c \
|
|
|
|
stdlib/atoi.c \
|
|
|
|
stdlib/atol.c \
|
|
|
|
stdlib/atoll.c \
|
|
|
|
stdlib/bsearch.c \
|
|
|
|
stdlib/ctype_.c \
|
|
|
|
stdlib/div.c \
|
|
|
|
stdlib/exit.c \
|
|
|
|
stdlib/getenv.c \
|
|
|
|
stdlib/jrand48.c \
|
|
|
|
stdlib/ldiv.c \
|
|
|
|
stdlib/lldiv.c \
|
|
|
|
stdlib/locale.c \
|
|
|
|
stdlib/lrand48.c \
|
|
|
|
stdlib/mrand48.c \
|
|
|
|
stdlib/nrand48.c \
|
|
|
|
stdlib/putenv.c \
|
|
|
|
stdlib/qsort.c \
|
|
|
|
stdlib/seed48.c \
|
|
|
|
stdlib/setenv.c \
|
|
|
|
stdlib/setjmperr.c \
|
|
|
|
stdlib/srand48.c \
|
|
|
|
stdlib/strntoimax.c \
|
|
|
|
stdlib/strntoumax.c \
|
|
|
|
stdlib/strtod.c \
|
|
|
|
stdlib/strtoimax.c \
|
|
|
|
stdlib/strtol.c \
|
|
|
|
stdlib/strtoll.c \
|
|
|
|
stdlib/strtoul.c \
|
|
|
|
stdlib/strtoull.c \
|
|
|
|
stdlib/strtoumax.c \
|
|
|
|
stdlib/tolower_.c \
|
|
|
|
stdlib/toupper_.c \
|
|
|
|
stdlib/wchar.c \
|
|
|
|
string/index.c \
|
|
|
|
string/memccpy.c \
|
|
|
|
string/memchr.c \
|
|
|
|
string/memmem.c \
|
|
|
|
string/memrchr.c \
|
|
|
|
string/memswap.c \
|
|
|
|
string/strcasecmp.c \
|
|
|
|
string/strcasestr.c \
|
|
|
|
string/strcat.c \
|
|
|
|
string/strchr.c \
|
|
|
|
string/strcoll.c \
|
|
|
|
string/strcspn.c \
|
|
|
|
string/strdup.c \
|
|
|
|
string/strerror.c \
|
|
|
|
string/strerror_r.c \
|
|
|
|
string/strlcat.c \
|
|
|
|
string/strlcpy.c \
|
|
|
|
string/strncat.c \
|
|
|
|
string/strncpy.c \
|
|
|
|
string/strndup.c \
|
|
|
|
string/strnlen.c \
|
|
|
|
string/strpbrk.c \
|
|
|
|
string/strrchr.c \
|
|
|
|
string/strsep.c \
|
|
|
|
string/strspn.c \
|
|
|
|
string/strstr.c \
|
|
|
|
string/strtok.c \
|
|
|
|
string/strtotimeval.c \
|
|
|
|
string/strxfrm.c \
|
2012-06-05 00:20:25 +02:00
|
|
|
string/__memcpy_chk.c \
|
|
|
|
string/__memmove_chk.c \
|
2012-06-07 23:01:26 +02:00
|
|
|
string/__memset_chk.c \
|
2012-06-05 00:20:25 +02:00
|
|
|
string/__strcat_chk.c \
|
|
|
|
string/__strcpy_chk.c \
|
|
|
|
string/__strncat_chk.c \
|
|
|
|
string/__strncpy_chk.c \
|
2010-06-15 02:18:35 +02:00
|
|
|
wchar/wcpcpy.c \
|
|
|
|
wchar/wcpncpy.c \
|
|
|
|
wchar/wcscasecmp.c \
|
|
|
|
wchar/wcscat.c \
|
|
|
|
wchar/wcschr.c \
|
|
|
|
wchar/wcscmp.c \
|
|
|
|
wchar/wcscoll.c \
|
|
|
|
wchar/wcscpy.c \
|
|
|
|
wchar/wcscspn.c \
|
|
|
|
wchar/wcsdup.c \
|
|
|
|
wchar/wcslcat.c \
|
|
|
|
wchar/wcslcpy.c \
|
|
|
|
wchar/wcslen.c \
|
|
|
|
wchar/wcsncasecmp.c \
|
|
|
|
wchar/wcsncat.c \
|
|
|
|
wchar/wcsncmp.c \
|
|
|
|
wchar/wcsncpy.c \
|
|
|
|
wchar/wcsnlen.c \
|
|
|
|
wchar/wcspbrk.c \
|
|
|
|
wchar/wcsrchr.c \
|
|
|
|
wchar/wcsspn.c \
|
|
|
|
wchar/wcsstr.c \
|
|
|
|
wchar/wcstok.c \
|
|
|
|
wchar/wcswidth.c \
|
2010-06-16 15:51:52 +02:00
|
|
|
wchar/wcsxfrm.c \
|
2010-06-15 02:18:35 +02:00
|
|
|
wchar/wmemchr.c \
|
2010-06-16 15:51:52 +02:00
|
|
|
wchar/wmemcmp.c \
|
2010-06-15 02:18:35 +02:00
|
|
|
wchar/wmemcpy.c \
|
|
|
|
wchar/wmemmove.c \
|
|
|
|
wchar/wmemset.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
inet/bindresvport.c \
|
|
|
|
inet/inet_addr.c \
|
|
|
|
inet/inet_aton.c \
|
|
|
|
inet/inet_ntoa.c \
|
|
|
|
inet/inet_ntop.c \
|
|
|
|
inet/inet_pton.c \
|
2010-06-09 21:53:28 +02:00
|
|
|
inet/ether_aton.c \
|
|
|
|
inet/ether_ntoa.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
tzcode/asctime.c \
|
|
|
|
tzcode/difftime.c \
|
|
|
|
tzcode/localtime.c \
|
|
|
|
tzcode/strftime.c \
|
|
|
|
tzcode/strptime.c \
|
|
|
|
bionic/__set_errno.c \
|
2010-03-02 19:55:58 +01:00
|
|
|
bionic/cpuacct.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/arc4random.c \
|
|
|
|
bionic/basename.c \
|
|
|
|
bionic/basename_r.c \
|
2010-01-14 02:48:34 +01:00
|
|
|
bionic/clearenv.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/dirname.c \
|
|
|
|
bionic/dirname_r.c \
|
|
|
|
bionic/drand48.c \
|
|
|
|
bionic/erand48.c \
|
2010-01-14 06:19:52 +01:00
|
|
|
bionic/err.c \
|
2010-01-14 02:48:34 +01:00
|
|
|
bionic/fdprintf.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/fork.c \
|
2010-01-14 06:19:52 +01:00
|
|
|
bionic/fts.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/if_nametoindex.c \
|
|
|
|
bionic/if_indextoname.c \
|
|
|
|
bionic/ioctl.c \
|
|
|
|
bionic/ldexp.c \
|
|
|
|
bionic/libc_init_common.c \
|
|
|
|
bionic/logd_write.c \
|
|
|
|
bionic/md5.c \
|
2011-02-04 23:45:57 +01:00
|
|
|
bionic/memmove_words.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/pututline.c \
|
|
|
|
bionic/realpath.c \
|
2010-12-03 18:04:01 +01:00
|
|
|
bionic/sched_getaffinity.c \
|
|
|
|
bionic/sched_getcpu.c \
|
|
|
|
bionic/sched_cpualloc.c \
|
|
|
|
bionic/sched_cpucount.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/semaphore.c \
|
|
|
|
bionic/sha1.c \
|
|
|
|
bionic/ssp.c \
|
|
|
|
bionic/stubs.c \
|
|
|
|
bionic/system_properties.c \
|
2012-03-14 07:04:57 +01:00
|
|
|
bionic/tdelete.c \
|
|
|
|
bionic/tdestroy.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/time64.c \
|
2012-03-14 07:04:57 +01:00
|
|
|
bionic/tfind.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/thread_atexit.c \
|
2012-03-14 07:04:57 +01:00
|
|
|
bionic/tsearch.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/utime.c \
|
|
|
|
bionic/utmp.c \
|
|
|
|
netbsd/gethnamaddr.c \
|
|
|
|
netbsd/isc/ev_timers.c \
|
|
|
|
netbsd/isc/ev_streams.c \
|
|
|
|
netbsd/inet/nsap_addr.c \
|
|
|
|
netbsd/resolv/__dn_comp.c \
|
|
|
|
netbsd/resolv/__res_close.c \
|
|
|
|
netbsd/resolv/__res_send.c \
|
|
|
|
netbsd/resolv/herror.c \
|
|
|
|
netbsd/resolv/res_comp.c \
|
|
|
|
netbsd/resolv/res_data.c \
|
|
|
|
netbsd/resolv/res_debug.c \
|
|
|
|
netbsd/resolv/res_init.c \
|
|
|
|
netbsd/resolv/res_mkquery.c \
|
|
|
|
netbsd/resolv/res_query.c \
|
|
|
|
netbsd/resolv/res_send.c \
|
2009-09-28 09:11:39 +02:00
|
|
|
netbsd/resolv/res_state.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
netbsd/resolv/res_cache.c \
|
|
|
|
netbsd/net/nsdispatch.c \
|
|
|
|
netbsd/net/getaddrinfo.c \
|
|
|
|
netbsd/net/getnameinfo.c \
|
|
|
|
netbsd/net/getservbyname.c \
|
|
|
|
netbsd/net/getservent.c \
|
|
|
|
netbsd/net/base64.c \
|
|
|
|
netbsd/net/getservbyport.c \
|
|
|
|
netbsd/nameser/ns_name.c \
|
|
|
|
netbsd/nameser/ns_parse.c \
|
|
|
|
netbsd/nameser/ns_ttl.c \
|
|
|
|
netbsd/nameser/ns_netint.c \
|
|
|
|
netbsd/nameser/ns_print.c \
|
2010-01-13 03:59:25 +01:00
|
|
|
netbsd/nameser/ns_samedomain.c \
|
|
|
|
regex/regcomp.c \
|
|
|
|
regex/regerror.c \
|
|
|
|
regex/regexec.c \
|
|
|
|
regex/regfree.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2010-08-27 17:19:19 +02:00
|
|
|
# The following files are common, but must be compiled
|
|
|
|
# with different C flags when building a static C library.
|
|
|
|
#
|
|
|
|
# The reason for this is the implementation of __get_tls()
|
|
|
|
# that will differ between the shared and static versions
|
|
|
|
# of the library.
|
|
|
|
#
|
|
|
|
# See comments in private/bionic_tls.h for more details.
|
|
|
|
#
|
|
|
|
# NOTE: bionic/pthread.c is added later to this list
|
|
|
|
# because it needs special handling on ARM, see
|
|
|
|
# below.
|
|
|
|
#
|
|
|
|
libc_static_common_src_files := \
|
|
|
|
unistd/sysconf.c \
|
|
|
|
bionic/__errno.c \
|
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
# Architecture specific source files go here
|
|
|
|
# =========================================================
|
2009-03-04 04:28:35 +01:00
|
|
|
ifeq ($(TARGET_ARCH),arm)
|
|
|
|
libc_common_src_files += \
|
2010-01-23 03:59:05 +01:00
|
|
|
bionic/bionic_clone.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
arch-arm/bionic/__get_pc.S \
|
|
|
|
arch-arm/bionic/__get_sp.S \
|
|
|
|
arch-arm/bionic/_exit_with_stack_teardown.S \
|
|
|
|
arch-arm/bionic/_setjmp.S \
|
2012-05-08 22:36:37 +02:00
|
|
|
arch-arm/bionic/abort_arm.S \
|
2011-11-16 17:37:15 +01:00
|
|
|
arch-arm/bionic/atomics_arm.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
arch-arm/bionic/clone.S \
|
2010-06-18 23:47:22 +02:00
|
|
|
arch-arm/bionic/eabi.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
arch-arm/bionic/ffs.S \
|
2011-11-16 17:37:15 +01:00
|
|
|
arch-arm/bionic/futex_arm.S \
|
2009-03-04 04:28:35 +01:00
|
|
|
arch-arm/bionic/kill.S \
|
2009-09-29 23:43:38 +02:00
|
|
|
arch-arm/bionic/libgcc_compat.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
arch-arm/bionic/tkill.S \
|
2011-11-19 00:17:07 +01:00
|
|
|
arch-arm/bionic/tgkill.S \
|
2009-03-04 04:28:35 +01:00
|
|
|
arch-arm/bionic/memcmp.S \
|
|
|
|
arch-arm/bionic/memcmp16.S \
|
|
|
|
arch-arm/bionic/memcpy.S \
|
|
|
|
arch-arm/bionic/memset.S \
|
|
|
|
arch-arm/bionic/setjmp.S \
|
|
|
|
arch-arm/bionic/sigsetjmp.S \
|
|
|
|
arch-arm/bionic/strlen.c.arm \
|
2010-08-10 11:23:39 +02:00
|
|
|
arch-arm/bionic/strcpy.S \
|
2011-04-20 09:35:04 +02:00
|
|
|
arch-arm/bionic/strcmp.S \
|
2009-03-04 04:28:35 +01:00
|
|
|
arch-arm/bionic/syscall.S \
|
2009-09-28 09:11:39 +02:00
|
|
|
string/memmove.c.arm \
|
2010-03-04 20:03:37 +01:00
|
|
|
string/bcopy.c \
|
|
|
|
string/strncmp.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
unistd/socketcalls.c
|
|
|
|
|
|
|
|
# These files need to be arm so that gdbserver
|
|
|
|
# can set breakpoints in them without messing
|
|
|
|
# up any thumb code.
|
|
|
|
libc_common_src_files += \
|
2010-06-25 21:36:39 +02:00
|
|
|
bionic/pthread-atfork.c.arm \
|
2010-05-12 01:39:22 +02:00
|
|
|
bionic/pthread-rwlocks.c.arm \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/pthread-timers.c.arm \
|
|
|
|
bionic/ptrace.c.arm
|
2009-05-27 19:52:37 +02:00
|
|
|
|
2010-08-27 17:19:19 +02:00
|
|
|
libc_static_common_src_files += \
|
|
|
|
bionic/pthread.c.arm \
|
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
# these are used by the static and dynamic versions of the libc
|
|
|
|
# respectively
|
|
|
|
libc_arch_static_src_files := \
|
|
|
|
arch-arm/bionic/exidx_static.c
|
|
|
|
|
|
|
|
libc_arch_dynamic_src_files := \
|
|
|
|
arch-arm/bionic/exidx_dynamic.c
|
2009-03-04 04:28:35 +01:00
|
|
|
else # !arm
|
|
|
|
|
|
|
|
ifeq ($(TARGET_ARCH),x86)
|
|
|
|
libc_common_src_files += \
|
|
|
|
arch-x86/bionic/__get_sp.S \
|
|
|
|
arch-x86/bionic/__get_tls.c \
|
|
|
|
arch-x86/bionic/__set_tls.c \
|
|
|
|
arch-x86/bionic/clone.S \
|
|
|
|
arch-x86/bionic/_exit_with_stack_teardown.S \
|
2011-11-16 17:37:15 +01:00
|
|
|
arch-x86/bionic/futex_x86.S \
|
2009-03-04 04:28:35 +01:00
|
|
|
arch-x86/bionic/setjmp.S \
|
|
|
|
arch-x86/bionic/_setjmp.S \
|
2010-12-14 10:55:23 +01:00
|
|
|
arch-x86/bionic/sigsetjmp.S \
|
2009-03-04 04:28:35 +01:00
|
|
|
arch-x86/bionic/vfork.S \
|
2010-03-04 19:29:38 +01:00
|
|
|
arch-x86/bionic/syscall.S \
|
2010-03-04 20:03:37 +01:00
|
|
|
arch-x86/string/bcopy_wrapper.S \
|
|
|
|
arch-x86/string/memcpy_wrapper.S \
|
|
|
|
arch-x86/string/memmove_wrapper.S \
|
|
|
|
arch-x86/string/bzero_wrapper.S \
|
|
|
|
arch-x86/string/memcmp_wrapper.S \
|
|
|
|
arch-x86/string/memset_wrapper.S \
|
|
|
|
arch-x86/string/strcmp_wrapper.S \
|
|
|
|
arch-x86/string/strncmp_wrapper.S \
|
2010-10-11 21:24:41 +02:00
|
|
|
arch-x86/string/strlen_wrapper.S \
|
2010-08-10 11:23:39 +02:00
|
|
|
string/strcpy.c \
|
2010-06-25 21:36:39 +02:00
|
|
|
bionic/pthread-atfork.c \
|
2010-05-12 01:39:22 +02:00
|
|
|
bionic/pthread-rwlocks.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/pthread-timers.c \
|
|
|
|
bionic/ptrace.c
|
|
|
|
|
2010-08-27 17:19:19 +02:00
|
|
|
libc_static_common_src_files += \
|
|
|
|
bionic/pthread.c \
|
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
# this is needed for static versions of libc
|
|
|
|
libc_arch_static_src_files := \
|
|
|
|
arch-x86/bionic/dl_iterate_phdr_static.c
|
|
|
|
|
|
|
|
libc_arch_dynamic_src_files :=
|
2009-09-28 09:11:39 +02:00
|
|
|
else # !x86
|
|
|
|
|
|
|
|
endif # !x86
|
2009-03-04 04:28:35 +01:00
|
|
|
endif # !arm
|
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
# Define some common cflags
|
|
|
|
# ========================================================
|
2009-03-04 04:28:35 +01:00
|
|
|
libc_common_cflags := \
|
2012-06-06 19:32:56 +02:00
|
|
|
-DWITH_ERRLIST \
|
|
|
|
-DANDROID_CHANGES \
|
|
|
|
-DUSE_LOCKS \
|
|
|
|
-DREALLOC_ZERO_BYTES_FREES \
|
|
|
|
-D_LIBC=1 \
|
|
|
|
-DSOFTFLOAT \
|
|
|
|
-DFLOATING_POINT \
|
|
|
|
-DINET6 \
|
|
|
|
-I$(LOCAL_PATH)/private \
|
|
|
|
-DUSE_DL_PREFIX \
|
|
|
|
-DPOSIX_MISTAKE \
|
|
|
|
-DLOG_ON_HEAP_ERROR \
|
|
|
|
-std=gnu99
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2010-03-05 23:17:35 +01:00
|
|
|
# these macro definitions are required to implement the
|
|
|
|
# 'timezone' and 'daylight' global variables, as well as
|
|
|
|
# properly update the 'tm_gmtoff' field in 'struct tm'.
|
|
|
|
#
|
|
|
|
libc_common_cflags += \
|
|
|
|
-DTM_GMTOFF=tm_gmtoff \
|
|
|
|
-DUSG_COMPAT=1
|
|
|
|
|
2009-04-24 00:50:03 +02:00
|
|
|
ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
|
2009-03-04 04:28:35 +01:00
|
|
|
libc_common_cflags += -DDEBUG
|
|
|
|
endif
|
|
|
|
|
2011-11-19 02:48:03 +01:00
|
|
|
# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
|
|
|
|
# the appropriate BoardConfig.mk file.
|
|
|
|
#
|
|
|
|
ifneq ($(BOARD_MALLOC_ALIGNMENT),)
|
|
|
|
libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:35 +01:00
|
|
|
ifeq ($(TARGET_ARCH),arm)
|
|
|
|
libc_common_cflags += -fstrict-aliasing
|
2009-05-27 19:52:37 +02:00
|
|
|
libc_crt_target_cflags := -mthumb-interwork
|
2009-09-18 22:35:05 +02:00
|
|
|
#
|
|
|
|
# Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
|
|
|
|
# that it should access the hardware TLS register directly in
|
|
|
|
# private/bionic_tls.h
|
|
|
|
#
|
|
|
|
# The value must match your kernel configuration
|
|
|
|
#
|
|
|
|
ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
|
|
|
|
libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
|
|
|
|
endif
|
2010-09-15 16:08:03 +02:00
|
|
|
#
|
|
|
|
# Define HAVE_32_BYTE_CACHE_LINES to indicate to C
|
|
|
|
# library it should use to 32-byte version of memcpy, and not
|
|
|
|
# the 64-byte version.
|
|
|
|
#
|
|
|
|
ifeq ($(ARCH_ARM_HAVE_32_BYTE_CACHE_LINES),true)
|
|
|
|
libc_common_cflags += -DHAVE_32_BYTE_CACHE_LINE
|
|
|
|
endif
|
2012-05-07 23:17:44 +02:00
|
|
|
ifeq ($(ARCH_ARM_USE_NON_NEON_MEMCPY),true)
|
|
|
|
libc_common_cflags += -DARCH_ARM_USE_NON_NEON_MEMCPY
|
|
|
|
endif
|
2009-05-27 19:52:37 +02:00
|
|
|
else # !arm
|
|
|
|
ifeq ($(TARGET_ARCH),x86)
|
2011-12-09 22:52:19 +01:00
|
|
|
libc_crt_target_cflags :=
|
2011-12-14 18:23:40 +01:00
|
|
|
ifeq ($(ARCH_X86_HAVE_SSE2),true)
|
|
|
|
libc_crt_target_cflags += -DUSE_SSE2=1
|
|
|
|
endif
|
|
|
|
ifeq ($(ARCH_X86_HAVE_SSSE3),true)
|
|
|
|
libc_crt_target_cflags += -DUSE_SSSE3=1
|
|
|
|
endif
|
2009-05-27 19:52:37 +02:00
|
|
|
endif # x86
|
|
|
|
endif # !arm
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2010-05-28 22:31:45 +02:00
|
|
|
# Define ANDROID_SMP appropriately.
|
|
|
|
ifeq ($(TARGET_CPU_SMP),true)
|
|
|
|
libc_common_cflags += -DANDROID_SMP=1
|
|
|
|
else
|
|
|
|
libc_common_cflags += -DANDROID_SMP=0
|
|
|
|
endif
|
|
|
|
|
arm: rewrite crtbegin* as C files.
Rewrite
crtbegin.S -> crtbegin.c
crtbegin_so.S -> crtbegin_so.c
This change allows us to generate PIC code without relying
on text relocations.
As a consequence of this rewrite, also rewrite
__dso_handle.S -> __dso_handle.c
__dso_handle_so.S -> __dso_handle_so.c
atexit.S -> atexit.c
In crtbegin.c _start, place the __PREINIT_ARRAY__, __INIT_ARRAY__,
__FINI_ARRAY__, and __CTOR_LIST__ variables onto the stack, instead of
passing a pointer to the text section of the binary.
This change appears sorta wonky, as I attempted to preserve,
as much as possible, the structure of the original assembly.
As a result, you have C files including other C files, and other
programming uglyness.
Result: This change reduces the number of files with text-relocations
from 315 to 19 on my Android build.
Before:
$ scanelf -aR $OUT/system | grep TEXTREL | wc -l
315
After:
$ scanelf -aR $OUT/system | grep TEXTREL | wc -l
19
Change-Id: Ib9f98107c0eeabcb606e1ddc7ed7fc4eba01c9c4
2012-05-31 20:40:10 +02:00
|
|
|
# Needed to access private/__dso_handle.h from
|
|
|
|
# crtbegin_xxx.c and crtend_xxx.c
|
2010-06-18 23:47:22 +02:00
|
|
|
#
|
|
|
|
libc_crt_target_cflags += -I$(LOCAL_PATH)/private
|
2010-05-28 22:31:45 +02:00
|
|
|
|
2011-06-20 19:29:50 +02:00
|
|
|
ifeq ($(TARGET_ARCH),arm)
|
|
|
|
libc_crt_target_cflags += -DCRT_LEGACY_WORKAROUND
|
|
|
|
endif
|
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
# Define some common includes
|
|
|
|
# ========================================================
|
2009-03-04 04:28:35 +01:00
|
|
|
libc_common_c_includes := \
|
|
|
|
$(LOCAL_PATH)/stdlib \
|
|
|
|
$(LOCAL_PATH)/string \
|
|
|
|
$(LOCAL_PATH)/stdio
|
|
|
|
|
arm: rewrite crtbegin* as C files.
Rewrite
crtbegin.S -> crtbegin.c
crtbegin_so.S -> crtbegin_so.c
This change allows us to generate PIC code without relying
on text relocations.
As a consequence of this rewrite, also rewrite
__dso_handle.S -> __dso_handle.c
__dso_handle_so.S -> __dso_handle_so.c
atexit.S -> atexit.c
In crtbegin.c _start, place the __PREINIT_ARRAY__, __INIT_ARRAY__,
__FINI_ARRAY__, and __CTOR_LIST__ variables onto the stack, instead of
passing a pointer to the text section of the binary.
This change appears sorta wonky, as I attempted to preserve,
as much as possible, the structure of the original assembly.
As a result, you have C files including other C files, and other
programming uglyness.
Result: This change reduces the number of files with text-relocations
from 315 to 19 on my Android build.
Before:
$ scanelf -aR $OUT/system | grep TEXTREL | wc -l
315
After:
$ scanelf -aR $OUT/system | grep TEXTREL | wc -l
19
Change-Id: Ib9f98107c0eeabcb606e1ddc7ed7fc4eba01c9c4
2012-05-31 20:40:10 +02:00
|
|
|
# Needed to access private/__dso_handle.h from
|
2010-07-02 08:09:28 +02:00
|
|
|
# crtbegin_xxx.S and crtend_xxx.S
|
|
|
|
#
|
2012-04-11 02:24:24 +02:00
|
|
|
libc_crt_target_cflags += -I$(LOCAL_PATH)/private -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
# Define the libc run-time (crt) support object files that must be built,
|
|
|
|
# which are needed to build all other objects (shared/static libs and
|
|
|
|
# executables)
|
|
|
|
# ==========================================================================
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2010-06-18 23:47:22 +02:00
|
|
|
ifneq ($(filter arm x86,$(TARGET_ARCH)),)
|
|
|
|
# ARM and x86 need crtbegin_so/crtend_so.
|
|
|
|
#
|
|
|
|
# For x86, the .init section must point to a function that calls all
|
|
|
|
# entries in the .ctors section. (on ARM this is done through the
|
|
|
|
# .init_array section instead).
|
|
|
|
#
|
|
|
|
# For both platforms, the .fini_array section must point to a function
|
|
|
|
# that will call __cxa_finalize(&__dso_handle) in order to ensure that
|
|
|
|
# static C++ destructors are properly called on dlclose().
|
|
|
|
#
|
2011-06-25 17:26:38 +02:00
|
|
|
|
|
|
|
libc_crt_target_so_cflags := $(libc_crt_target_cflags)
|
arm: rewrite crtbegin* as C files.
Rewrite
crtbegin.S -> crtbegin.c
crtbegin_so.S -> crtbegin_so.c
This change allows us to generate PIC code without relying
on text relocations.
As a consequence of this rewrite, also rewrite
__dso_handle.S -> __dso_handle.c
__dso_handle_so.S -> __dso_handle_so.c
atexit.S -> atexit.c
In crtbegin.c _start, place the __PREINIT_ARRAY__, __INIT_ARRAY__,
__FINI_ARRAY__, and __CTOR_LIST__ variables onto the stack, instead of
passing a pointer to the text section of the binary.
This change appears sorta wonky, as I attempted to preserve,
as much as possible, the structure of the original assembly.
As a result, you have C files including other C files, and other
programming uglyness.
Result: This change reduces the number of files with text-relocations
from 315 to 19 on my Android build.
Before:
$ scanelf -aR $OUT/system | grep TEXTREL | wc -l
315
After:
$ scanelf -aR $OUT/system | grep TEXTREL | wc -l
19
Change-Id: Ib9f98107c0eeabcb606e1ddc7ed7fc4eba01c9c4
2012-05-31 20:40:10 +02:00
|
|
|
libc_crt_target_crtstart_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.c
|
|
|
|
libc_crt_target_crtstart_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.c
|
2011-06-25 17:26:38 +02:00
|
|
|
ifeq ($(TARGET_ARCH),x86)
|
|
|
|
# This flag must be added for x86 targets, but not for ARM
|
|
|
|
libc_crt_target_so_cflags += -fPIC
|
arm: rewrite crtbegin* as C files.
Rewrite
crtbegin.S -> crtbegin.c
crtbegin_so.S -> crtbegin_so.c
This change allows us to generate PIC code without relying
on text relocations.
As a consequence of this rewrite, also rewrite
__dso_handle.S -> __dso_handle.c
__dso_handle_so.S -> __dso_handle_so.c
atexit.S -> atexit.c
In crtbegin.c _start, place the __PREINIT_ARRAY__, __INIT_ARRAY__,
__FINI_ARRAY__, and __CTOR_LIST__ variables onto the stack, instead of
passing a pointer to the text section of the binary.
This change appears sorta wonky, as I attempted to preserve,
as much as possible, the structure of the original assembly.
As a result, you have C files including other C files, and other
programming uglyness.
Result: This change reduces the number of files with text-relocations
from 315 to 19 on my Android build.
Before:
$ scanelf -aR $OUT/system | grep TEXTREL | wc -l
315
After:
$ scanelf -aR $OUT/system | grep TEXTREL | wc -l
19
Change-Id: Ib9f98107c0eeabcb606e1ddc7ed7fc4eba01c9c4
2012-05-31 20:40:10 +02:00
|
|
|
libc_crt_target_crtstart_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.S
|
|
|
|
libc_crt_target_crtstart_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
|
2011-06-25 17:26:38 +02:00
|
|
|
endif
|
2012-05-16 00:15:11 +02:00
|
|
|
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
|
arm: rewrite crtbegin* as C files.
Rewrite
crtbegin.S -> crtbegin.c
crtbegin_so.S -> crtbegin_so.c
This change allows us to generate PIC code without relying
on text relocations.
As a consequence of this rewrite, also rewrite
__dso_handle.S -> __dso_handle.c
__dso_handle_so.S -> __dso_handle_so.c
atexit.S -> atexit.c
In crtbegin.c _start, place the __PREINIT_ARRAY__, __INIT_ARRAY__,
__FINI_ARRAY__, and __CTOR_LIST__ variables onto the stack, instead of
passing a pointer to the text section of the binary.
This change appears sorta wonky, as I attempted to preserve,
as much as possible, the structure of the original assembly.
As a result, you have C files including other C files, and other
programming uglyness.
Result: This change reduces the number of files with text-relocations
from 315 to 19 on my Android build.
Before:
$ scanelf -aR $OUT/system | grep TEXTREL | wc -l
315
After:
$ scanelf -aR $OUT/system | grep TEXTREL | wc -l
19
Change-Id: Ib9f98107c0eeabcb606e1ddc7ed7fc4eba01c9c4
2012-05-31 20:40:10 +02:00
|
|
|
$(GEN): $(libc_crt_target_crtstart_so_file)
|
2009-03-04 04:28:35 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2011-06-25 17:26:38 +02:00
|
|
|
$(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
|
2009-03-04 04:28:35 +01:00
|
|
|
ALL_GENERATED_SOURCES += $(GEN)
|
|
|
|
|
2012-05-16 00:15:11 +02:00
|
|
|
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
|
2009-05-27 19:52:37 +02:00
|
|
|
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
|
|
|
|
@mkdir -p $(dir $@)
|
2011-06-25 17:26:38 +02:00
|
|
|
$(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
|
2009-05-27 19:52:37 +02:00
|
|
|
ALL_GENERATED_SOURCES += $(GEN)
|
2011-06-25 17:26:38 +02:00
|
|
|
endif # TARGET_ARCH == x86 || TARGET_ARCH == arm
|
2009-03-04 04:28:35 +01:00
|
|
|
|
|
|
|
|
2012-05-16 00:15:11 +02:00
|
|
|
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
|
arm: rewrite crtbegin* as C files.
Rewrite
crtbegin.S -> crtbegin.c
crtbegin_so.S -> crtbegin_so.c
This change allows us to generate PIC code without relying
on text relocations.
As a consequence of this rewrite, also rewrite
__dso_handle.S -> __dso_handle.c
__dso_handle_so.S -> __dso_handle_so.c
atexit.S -> atexit.c
In crtbegin.c _start, place the __PREINIT_ARRAY__, __INIT_ARRAY__,
__FINI_ARRAY__, and __CTOR_LIST__ variables onto the stack, instead of
passing a pointer to the text section of the binary.
This change appears sorta wonky, as I attempted to preserve,
as much as possible, the structure of the original assembly.
As a result, you have C files including other C files, and other
programming uglyness.
Result: This change reduces the number of files with text-relocations
from 315 to 19 on my Android build.
Before:
$ scanelf -aR $OUT/system | grep TEXTREL | wc -l
315
After:
$ scanelf -aR $OUT/system | grep TEXTREL | wc -l
19
Change-Id: Ib9f98107c0eeabcb606e1ddc7ed7fc4eba01c9c4
2012-05-31 20:40:10 +02:00
|
|
|
$(GEN): $(libc_crt_target_crtstart_file)
|
2009-05-27 19:52:37 +02:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
|
|
|
|
ALL_GENERATED_SOURCES += $(GEN)
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2012-05-16 00:15:11 +02:00
|
|
|
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
|
arm: rewrite crtbegin* as C files.
Rewrite
crtbegin.S -> crtbegin.c
crtbegin_so.S -> crtbegin_so.c
This change allows us to generate PIC code without relying
on text relocations.
As a consequence of this rewrite, also rewrite
__dso_handle.S -> __dso_handle.c
__dso_handle_so.S -> __dso_handle_so.c
atexit.S -> atexit.c
In crtbegin.c _start, place the __PREINIT_ARRAY__, __INIT_ARRAY__,
__FINI_ARRAY__, and __CTOR_LIST__ variables onto the stack, instead of
passing a pointer to the text section of the binary.
This change appears sorta wonky, as I attempted to preserve,
as much as possible, the structure of the original assembly.
As a result, you have C files including other C files, and other
programming uglyness.
Result: This change reduces the number of files with text-relocations
from 315 to 19 on my Android build.
Before:
$ scanelf -aR $OUT/system | grep TEXTREL | wc -l
315
After:
$ scanelf -aR $OUT/system | grep TEXTREL | wc -l
19
Change-Id: Ib9f98107c0eeabcb606e1ddc7ed7fc4eba01c9c4
2012-05-31 20:40:10 +02:00
|
|
|
$(GEN): $(libc_crt_target_crtstart_file)
|
2009-03-04 04:28:35 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2009-05-27 19:52:37 +02:00
|
|
|
$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
|
2009-03-04 04:28:35 +01:00
|
|
|
ALL_GENERATED_SOURCES += $(GEN)
|
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
|
|
|
|
# We rename crtend.o to crtend_android.o to avoid a
|
|
|
|
# name clash between gcc and bionic.
|
2012-05-16 00:15:11 +02:00
|
|
|
GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
|
2009-05-27 19:52:37 +02:00
|
|
|
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
|
2009-03-04 04:28:35 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2009-05-27 19:52:37 +02:00
|
|
|
$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
|
2009-03-04 04:28:35 +01:00
|
|
|
ALL_GENERATED_SOURCES += $(GEN)
|
|
|
|
|
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
# To enable malloc leak check for statically linked programs, add
|
|
|
|
# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
|
|
|
|
WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
# ========================================================
|
|
|
|
# libc_common.a
|
|
|
|
# ========================================================
|
|
|
|
include $(CLEAR_VARS)
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
LOCAL_SRC_FILES := $(libc_common_src_files)
|
|
|
|
LOCAL_CFLAGS := $(libc_common_cflags)
|
2011-06-20 19:29:50 +02:00
|
|
|
ifeq ($(TARGET_ARCH),arm)
|
|
|
|
LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
|
|
|
|
endif
|
2009-05-27 19:52:37 +02:00
|
|
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
2009-03-04 04:28:35 +01:00
|
|
|
LOCAL_MODULE := libc_common
|
|
|
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
|
|
|
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
# ========================================================
|
|
|
|
# libc_nomalloc.a
|
|
|
|
# ========================================================
|
|
|
|
#
|
|
|
|
# This is a version of the static C library that does not
|
|
|
|
# include malloc. It's useful in situations when calling
|
|
|
|
# the user wants to provide their own malloc implementation,
|
|
|
|
# or wants to explicitly disallow the use of the use of malloc,
|
|
|
|
# like the dynamic loader.
|
|
|
|
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_SRC_FILES := \
|
|
|
|
$(libc_arch_static_src_files) \
|
2010-08-27 17:19:19 +02:00
|
|
|
$(libc_static_common_src_files) \
|
2009-05-27 19:52:37 +02:00
|
|
|
bionic/libc_init_static.c
|
|
|
|
|
|
|
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
2010-08-27 17:19:19 +02:00
|
|
|
LOCAL_CFLAGS := $(libc_common_cflags) \
|
|
|
|
-DLIBC_STATIC
|
2009-05-27 19:52:37 +02:00
|
|
|
|
|
|
|
LOCAL_MODULE := libc_nomalloc
|
|
|
|
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
|
|
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
|
|
|
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
# ========================================================
|
2009-03-04 04:28:35 +01:00
|
|
|
# libc.a
|
|
|
|
# ========================================================
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_SRC_FILES := \
|
2009-05-27 19:52:37 +02:00
|
|
|
$(libc_arch_static_src_files) \
|
2010-08-27 17:19:19 +02:00
|
|
|
$(libc_static_common_src_files) \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/dlmalloc.c \
|
2009-11-17 23:13:38 +01:00
|
|
|
bionic/malloc_debug_common.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/libc_init_static.c
|
|
|
|
|
2009-11-17 23:13:38 +01:00
|
|
|
LOCAL_CFLAGS := $(libc_common_cflags) \
|
|
|
|
-DLIBC_STATIC
|
2009-03-04 04:28:35 +01:00
|
|
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
2009-05-27 19:52:37 +02:00
|
|
|
LOCAL_MODULE := libc
|
2009-03-04 04:28:35 +01:00
|
|
|
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
|
|
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
|
|
|
|
|
|
|
include $(BUILD_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
# ========================================================
|
2009-03-04 04:28:35 +01:00
|
|
|
# libc.so
|
|
|
|
# ========================================================
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2011-09-06 08:54:55 +02:00
|
|
|
# pthread deadlock prediction:
|
|
|
|
# set -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=1 to enable support for
|
|
|
|
# pthread deadlock prediction.
|
|
|
|
# Since this code is experimental it is disabled by default.
|
|
|
|
# see libc/bionic/pthread_debug.c for details
|
|
|
|
|
|
|
|
LOCAL_CFLAGS := $(libc_common_cflags) -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=0
|
2009-03-04 04:28:35 +01:00
|
|
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
|
|
|
|
|
|
|
LOCAL_SRC_FILES := \
|
2009-05-27 19:52:37 +02:00
|
|
|
$(libc_arch_dynamic_src_files) \
|
2010-08-27 17:19:19 +02:00
|
|
|
$(libc_static_common_src_files) \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/dlmalloc.c \
|
2009-11-17 23:13:38 +01:00
|
|
|
bionic/malloc_debug_common.c \
|
2011-09-06 08:54:55 +02:00
|
|
|
bionic/pthread_debug.c \
|
2009-03-04 04:28:35 +01:00
|
|
|
bionic/libc_init_dynamic.c
|
|
|
|
|
|
|
|
LOCAL_MODULE:= libc
|
|
|
|
|
|
|
|
# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
|
|
|
|
# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
|
|
|
|
# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
|
|
|
|
# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
|
|
|
|
# should, instead relying on the external symbols from the dependent libraries. That would
|
|
|
|
# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
|
|
|
|
# you wanted!
|
|
|
|
|
|
|
|
LOCAL_SHARED_LIBRARIES := libdl
|
|
|
|
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
|
|
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
|
|
|
|
|
|
|
include $(BUILD_SHARED_LIBRARY)
|
|
|
|
|
|
|
|
|
2009-11-17 23:13:38 +01:00
|
|
|
# For all builds, except for the -user build we will enable memory
|
|
|
|
# allocation checking (including memory leaks, buffer overwrites, etc.)
|
|
|
|
# Note that all these checks are also controlled by env. settings
|
|
|
|
# that can enable, or disable specific checks. Note also that some of
|
|
|
|
# the checks are available only in emulator and are implemeted in
|
|
|
|
# libc_malloc_qemu_instrumented.so.
|
|
|
|
ifneq ($(TARGET_BUILD_VARIANT),user)
|
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
# ========================================================
|
2009-11-17 23:13:38 +01:00
|
|
|
# libc_malloc_debug_leak.so
|
2009-03-04 04:28:35 +01:00
|
|
|
# ========================================================
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
2009-05-27 19:52:37 +02:00
|
|
|
LOCAL_CFLAGS := \
|
|
|
|
$(libc_common_cflags) \
|
|
|
|
-DMALLOC_LEAK_CHECK
|
2009-03-04 04:28:35 +01:00
|
|
|
|
|
|
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
|
|
|
|
|
|
|
LOCAL_SRC_FILES := \
|
bionic: import heaptracker as chk_malloc
This patch is a rewrite of libc.debug.malloc = 10 (chk_malloc). It provides
the same features as the original (poison freed memory, detect heap overruns
and underruns), except that it provides more debugging information whenever it
detects a problem.
In addition to the original features, the new chk_malloc() implementation
detects multiple frees within a given range of the last N allocations, N being
configurable via the system property libc.debug.malloc.backlog.
Finally, this patch keeps track of all outstanding memory allocations. On
program exit, we walk that list and report each outstanding allocation.
(There is support (not enabled) for a scanner thread periodically walks over
the list of outstanding allocations as well as the backlog of recently-freed
allocations, checking for heap-usage errors.)
Feature overview:
1) memory leaks
2) multiple frees
3) use after free
4) overrun
Implementation:
-- for each allocation, there is a:
1) stack trace at the time the allocation is made
2) if the memory is freed, there is also a stack trace at the point
3) a front and rear guard (fence)
4) the stack traces are kept together with the allocation
-- the following lists and maintained
1) all outstanding memory allocations
3) a backlog of allocations what are freed; when you call free(), instead of
actually freed, the allocation is moved to this backlog;
4) when the backlog of allocations gets full, the oldest entry gets evicted
from it; at that point, the allocation is checked for overruns or
use-after-free errors, and then actually freed.
5) when the program exits, the list of outstanding allocations and the
backlog are inspected for errors, then freed;
To use this, set the following system properties before running the process or
processes you want to inspect:
libc.malloc.debug.backlog # defaults to 100
libc.malloc.debug 10
When a problem is detected, you will see the following on logcat for a multiple
free:
E/libc ( 7233): +++ ALLOCATION 0x404b9278 SIZE 10 BYTES MULTIPLY FREED!
E/libc ( 7233): +++ ALLOCATION 0x404b9278 SIZE 10 ALLOCATED HERE:
E/libc ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc ( 7233): #00 pc 0000c35a /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #01 pc 0000c658 /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #02 pc 00016d80 /system/lib/libc.so
E/libc ( 7233): #03 pc 4009647c /system/bin/malloctest
E/libc ( 7233): #04 pc 00016f24 /system/lib/libc.so
E/libc ( 7233): +++ ALLOCATION 0x404b9278 SIZE 10 FIRST FREED HERE:
E/libc ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc ( 7233): #00 pc 0000c35a /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #01 pc 0000c7d2 /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #02 pc 00016d94 /system/lib/libc.so
E/libc ( 7233): #03 pc 40096490 /system/bin/malloctest
E/libc ( 7233): #04 pc 00016f24 /system/lib/libc.so
E/libc ( 7233): +++ ALLOCATION 0x404b9278 SIZE 10 NOW BEING FREED HERE:
E/libc ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc ( 7233): #00 pc 0000c35a /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #01 pc 0000c6ac /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #02 pc 00016d94 /system/lib/libc.so
E/libc ( 7233): #03 pc 400964a0 /system/bin/malloctest
E/libc ( 7233): #04 pc 00016f24 /system/lib/libc.so
The following for a heap overrun and underrun:
E/libc ( 7233): +++ REAR GUARD MISMATCH [10, 11)
E/libc ( 7233): +++ ALLOCATION 0x404b9198 SIZE 10 HAS A CORRUPTED REAR GUARD
E/libc ( 7233): +++ ALLOCATION 0x404b9198 SIZE 10 ALLOCATED HERE:
E/libc ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc ( 7233): #00 pc 0000c35a /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #01 pc 0000c658 /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #02 pc 00016d80 /system/lib/libc.so
E/libc ( 7233): #03 pc 40096438 /system/bin/malloctest
E/libc ( 7233): #04 pc 00016f24 /system/lib/libc.so
E/libc ( 7233): +++ ALLOCATION 0x404b9198 SIZE 10 FREED HERE:
E/libc ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc ( 7233): #00 pc 0000c35a /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #01 pc 0000c7d2 /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #02 pc 00016d94 /system/lib/libc.so
E/libc ( 7233): #03 pc 40096462 /system/bin/malloctest
E/libc ( 7233): #04 pc 00016f24 /system/lib/libc.so
E/libc ( 7233): +++ ALLOCATION 0x404b9358 SIZE 10 HAS A CORRUPTED FRONT GUARD
E/libc ( 7233): +++ ALLOCATION 0x404b9358 SIZE 10 ALLOCATED HERE:
E/libc ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc ( 7233): #00 pc 0000c35a /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #01 pc 0000c658 /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #02 pc 00016d80 /system/lib/libc.so
E/libc ( 7233): #03 pc 400964ba /system/bin/malloctest
E/libc ( 7233): #04 pc 00016f24 /system/lib/libc.so
E/libc ( 7233): +++ ALLOCATION 0x404b9358 SIZE 10 FREED HERE:
E/libc ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc ( 7233): #00 pc 0000c35a /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #01 pc 0000c7d2 /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #02 pc 00016d94 /system/lib/libc.so
E/libc ( 7233): #03 pc 400964e4 /system/bin/malloctest
E/libc ( 7233): #04 pc 00016f24 /system/lib/libc.so
The following for a memory leak:
E/libc ( 7233): +++ THERE ARE 1 LEAKED ALLOCATIONS
E/libc ( 7233): +++ DELETING 4096 BYTES OF LEAKED MEMORY AT 0x404b95e8 (1 REMAINING)
E/libc ( 7233): +++ ALLOCATION 0x404b95e8 SIZE 4096 ALLOCATED HERE:
E/libc ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc ( 7233): #00 pc 0000c35a /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #01 pc 0000c658 /system/lib/libc_malloc_debug_leak.so
E/libc ( 7233): #02 pc 00016d80 /system/lib/libc.so
E/libc ( 7233): #03 pc 0001bc94 /system/lib/libc.so
E/libc ( 7233): #04 pc 0001edf6 /system/lib/libc.so
E/libc ( 7233): #05 pc 0001b80a /system/lib/libc.so
E/libc ( 7233): #06 pc 0001c086 /system/lib/libc.so
E/libc ( 7233): #07 pc 40096402 /system/bin/malloctest
E/libc ( 7233): #08 pc 00016f24 /system/lib/libc.so
Change-Id: Ic440e9d05a01e2ea86b25e8998714e88bc2d16e0
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-05-29 23:22:42 +02:00
|
|
|
bionic/malloc_debug_leak.c \
|
|
|
|
bionic/malloc_debug_check.c \
|
|
|
|
bionic/malloc_debug_check_mapinfo.c \
|
|
|
|
bionic/malloc_debug_stacktrace.c
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2009-11-17 23:13:38 +01:00
|
|
|
LOCAL_MODULE:= libc_malloc_debug_leak
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2009-11-17 23:13:38 +01:00
|
|
|
LOCAL_SHARED_LIBRARIES := libc
|
|
|
|
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
|
|
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
2010-07-08 23:47:50 +02:00
|
|
|
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
|
2011-03-14 22:02:05 +01:00
|
|
|
|
2009-11-17 23:13:38 +01:00
|
|
|
# Don't install on release build
|
|
|
|
LOCAL_MODULE_TAGS := eng debug
|
2009-03-04 04:28:35 +01:00
|
|
|
|
2009-11-17 23:13:38 +01:00
|
|
|
include $(BUILD_SHARED_LIBRARY)
|
|
|
|
|
|
|
|
|
|
|
|
# ========================================================
|
|
|
|
# libc_malloc_debug_qemu.so
|
|
|
|
# ========================================================
|
|
|
|
include $(CLEAR_VARS)
|
|
|
|
|
|
|
|
LOCAL_CFLAGS := \
|
|
|
|
$(libc_common_cflags) \
|
|
|
|
-DMALLOC_QEMU_INSTRUMENT
|
|
|
|
|
|
|
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
|
|
|
|
|
|
|
LOCAL_SRC_FILES := \
|
|
|
|
bionic/malloc_debug_qemu.c
|
|
|
|
|
|
|
|
LOCAL_MODULE:= libc_malloc_debug_qemu
|
|
|
|
|
2011-09-06 08:54:55 +02:00
|
|
|
LOCAL_SHARED_LIBRARIES := libc libdl
|
2009-03-04 04:28:35 +01:00
|
|
|
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
|
|
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
2011-03-14 22:02:05 +01:00
|
|
|
|
2009-03-04 04:28:35 +01:00
|
|
|
# Don't install on release build
|
2009-11-17 23:13:38 +01:00
|
|
|
LOCAL_MODULE_TAGS := eng debug
|
2009-03-04 04:28:35 +01:00
|
|
|
|
|
|
|
include $(BUILD_SHARED_LIBRARY)
|
|
|
|
|
2009-11-17 23:13:38 +01:00
|
|
|
endif #!user
|
|
|
|
|
|
|
|
|
2009-03-04 04:28:35 +01:00
|
|
|
# ========================================================
|
|
|
|
include $(call all-makefiles-under,$(LOCAL_PATH))
|