blob: 26da523157f228eddfa2a5d172433cd61457e069 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001LOCAL_PATH:= $(call my-dir)
2
3include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/syscalls.mk
Dima Zavinca122b02009-05-27 10:52:37 -07004
5# Define the common source files for all the libc instances
6# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08007libc_common_src_files := \
8 $(syscall_src) \
9 unistd/abort.c \
10 unistd/alarm.c \
11 unistd/brk.c \
12 unistd/creat.c \
13 unistd/daemon.c \
David 'Digit' Turnerdefd1622010-09-26 22:29:14 +020014 unistd/eventfd.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080015 unistd/exec.c \
16 unistd/fcntl.c \
17 unistd/fnmatch.c \
David 'Digit' Turnerab8b5412010-07-08 16:52:27 -070018 unistd/fstatfs.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080019 unistd/ftime.c \
20 unistd/ftok.c \
21 unistd/getcwd.c \
22 unistd/getdtablesize.c \
23 unistd/gethostname.c \
24 unistd/getopt_long.c \
25 unistd/getpgrp.c \
26 unistd/getpriority.c \
27 unistd/getpt.c \
28 unistd/initgroups.c \
29 unistd/isatty.c \
30 unistd/issetugid.c \
Colin Cross8c59d962010-01-13 16:39:26 -080031 unistd/killpg.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080032 unistd/lseek64.c \
33 unistd/mmap.c \
34 unistd/nice.c \
35 unistd/open.c \
36 unistd/openat.c \
37 unistd/opendir.c \
38 unistd/pathconf.c \
39 unistd/perror.c \
40 unistd/popen.c \
41 unistd/pread.c \
42 unistd/pselect.c \
43 unistd/ptsname.c \
44 unistd/ptsname_r.c \
45 unistd/pwrite.c \
46 unistd/raise.c \
47 unistd/reboot.c \
48 unistd/recv.c \
49 unistd/sbrk.c \
50 unistd/send.c \
51 unistd/setegid.c \
Mike Chan9f691562010-03-02 10:55:58 -080052 unistd/setuid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080053 unistd/seteuid.c \
Mike Chan9f691562010-03-02 10:55:58 -080054 unistd/setreuid.c \
55 unistd/setresuid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080056 unistd/setpgrp.c \
57 unistd/sigblock.c \
58 unistd/siginterrupt.c \
59 unistd/siglist.c \
60 unistd/signal.c \
Thorsten Glaser92b10af2009-10-02 15:39:00 +020061 unistd/signame.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080062 unistd/sigsetmask.c \
63 unistd/sigsuspend.c \
64 unistd/sigwait.c \
65 unistd/sleep.c \
66 unistd/statfs.c \
67 unistd/strsignal.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080068 unistd/syslog.c \
69 unistd/system.c \
70 unistd/tcgetpgrp.c \
71 unistd/tcsetpgrp.c \
72 unistd/time.c \
73 unistd/umount.c \
74 unistd/unlockpt.c \
75 unistd/usleep.c \
76 unistd/wait.c \
77 stdio/asprintf.c \
78 stdio/clrerr.c \
79 stdio/fclose.c \
80 stdio/fdopen.c \
81 stdio/feof.c \
82 stdio/ferror.c \
83 stdio/fflush.c \
84 stdio/fgetc.c \
85 stdio/fgetln.c \
86 stdio/fgetpos.c \
87 stdio/fgets.c \
88 stdio/fileno.c \
89 stdio/findfp.c \
90 stdio/flags.c \
91 stdio/flockfile.c \
92 stdio/fopen.c \
93 stdio/fprintf.c \
94 stdio/fpurge.c \
95 stdio/fputc.c \
96 stdio/fputs.c \
97 stdio/fread.c \
98 stdio/freopen.c \
99 stdio/fscanf.c \
100 stdio/fseek.c \
101 stdio/fsetpos.c \
102 stdio/ftell.c \
103 stdio/funopen.c \
104 stdio/fvwrite.c \
105 stdio/fwalk.c \
106 stdio/fwrite.c \
107 stdio/getc.c \
108 stdio/getchar.c \
109 stdio/gets.c \
110 stdio/makebuf.c \
111 stdio/mktemp.c \
112 stdio/printf.c \
113 stdio/putc.c \
114 stdio/putchar.c \
115 stdio/puts.c \
116 stdio/putw.c \
117 stdio/refill.c \
118 stdio/remove.c \
119 stdio/rewind.c \
120 stdio/rget.c \
121 stdio/scanf.c \
122 stdio/setbuf.c \
123 stdio/setbuffer.c \
124 stdio/setvbuf.c \
125 stdio/snprintf.c\
126 stdio/sprintf.c \
127 stdio/sscanf.c \
128 stdio/stdio.c \
129 stdio/tempnam.c \
130 stdio/tmpfile.c \
131 stdio/tmpnam.c \
132 stdio/ungetc.c \
133 stdio/vasprintf.c \
134 stdio/vfprintf.c \
135 stdio/vfscanf.c \
136 stdio/vprintf.c \
137 stdio/vsnprintf.c \
138 stdio/vsprintf.c \
139 stdio/vscanf.c \
140 stdio/vsscanf.c \
141 stdio/wbuf.c \
142 stdio/wsetup.c \
Nick Kralevich965dbc62012-07-03 11:45:31 -0700143 stdio/__fgets_chk.c \
Nick Kralevichcffdf662012-06-11 15:50:57 -0700144 stdio/__snprintf_chk.c \
Nick Kralevich9b549c32012-06-12 15:59:04 -0700145 stdio/__sprintf_chk.c \
Nick Kralevichcffdf662012-06-11 15:50:57 -0700146 stdio/__vsnprintf_chk.c \
Nick Kralevich9b549c32012-06-12 15:59:04 -0700147 stdio/__vsprintf_chk.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800148 stdlib/_rand48.c \
149 stdlib/assert.c \
150 stdlib/atexit.c \
151 stdlib/atoi.c \
152 stdlib/atol.c \
153 stdlib/atoll.c \
154 stdlib/bsearch.c \
155 stdlib/ctype_.c \
156 stdlib/div.c \
157 stdlib/exit.c \
158 stdlib/getenv.c \
159 stdlib/jrand48.c \
160 stdlib/ldiv.c \
161 stdlib/lldiv.c \
162 stdlib/locale.c \
163 stdlib/lrand48.c \
164 stdlib/mrand48.c \
165 stdlib/nrand48.c \
166 stdlib/putenv.c \
167 stdlib/qsort.c \
168 stdlib/seed48.c \
169 stdlib/setenv.c \
170 stdlib/setjmperr.c \
171 stdlib/srand48.c \
172 stdlib/strntoimax.c \
173 stdlib/strntoumax.c \
174 stdlib/strtod.c \
175 stdlib/strtoimax.c \
176 stdlib/strtol.c \
177 stdlib/strtoll.c \
178 stdlib/strtoul.c \
179 stdlib/strtoull.c \
180 stdlib/strtoumax.c \
181 stdlib/tolower_.c \
182 stdlib/toupper_.c \
183 stdlib/wchar.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800184 string/index.c \
185 string/memccpy.c \
186 string/memchr.c \
187 string/memmem.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800188 string/memrchr.c \
189 string/memswap.c \
190 string/strcasecmp.c \
191 string/strcasestr.c \
192 string/strcat.c \
193 string/strchr.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800194 string/strcoll.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800195 string/strcspn.c \
196 string/strdup.c \
197 string/strerror.c \
198 string/strerror_r.c \
199 string/strlcat.c \
200 string/strlcpy.c \
201 string/strncat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800202 string/strncpy.c \
203 string/strndup.c \
204 string/strnlen.c \
205 string/strpbrk.c \
206 string/strrchr.c \
207 string/strsep.c \
208 string/strspn.c \
209 string/strstr.c \
210 string/strtok.c \
211 string/strtotimeval.c \
Nick Kralevich0a230152012-06-04 15:20:25 -0700212 string/__memcpy_chk.c \
213 string/__memmove_chk.c \
Nick Kralevich71a18dd2012-06-07 14:01:26 -0700214 string/__memset_chk.c \
Nick Kralevich0a230152012-06-04 15:20:25 -0700215 string/__strcat_chk.c \
216 string/__strcpy_chk.c \
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700217 string/__strlcat_chk.c \
218 string/__strlcpy_chk.c \
Nick Kralevich260bf8c2012-07-13 11:27:06 -0700219 string/__strlen_chk.c \
Nick Kralevich0a230152012-06-04 15:20:25 -0700220 string/__strncat_chk.c \
221 string/__strncpy_chk.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700222 wchar/wcpcpy.c \
223 wchar/wcpncpy.c \
224 wchar/wcscasecmp.c \
225 wchar/wcscat.c \
226 wchar/wcschr.c \
227 wchar/wcscmp.c \
228 wchar/wcscoll.c \
229 wchar/wcscpy.c \
230 wchar/wcscspn.c \
231 wchar/wcsdup.c \
232 wchar/wcslcat.c \
233 wchar/wcslcpy.c \
234 wchar/wcslen.c \
235 wchar/wcsncasecmp.c \
236 wchar/wcsncat.c \
237 wchar/wcsncmp.c \
238 wchar/wcsncpy.c \
239 wchar/wcsnlen.c \
240 wchar/wcspbrk.c \
241 wchar/wcsrchr.c \
242 wchar/wcsspn.c \
243 wchar/wcsstr.c \
244 wchar/wcstok.c \
245 wchar/wcswidth.c \
Kristian Monsen70465612010-06-16 14:51:52 +0100246 wchar/wcsxfrm.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700247 wchar/wmemchr.c \
Kristian Monsen70465612010-06-16 14:51:52 +0100248 wchar/wmemcmp.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700249 wchar/wmemcpy.c \
250 wchar/wmemmove.c \
251 wchar/wmemset.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800252 inet/bindresvport.c \
253 inet/inet_addr.c \
254 inet/inet_aton.c \
255 inet/inet_ntoa.c \
256 inet/inet_ntop.c \
257 inet/inet_pton.c \
Szymon Jakubczak41e533a2010-06-09 15:53:28 -0400258 inet/ether_aton.c \
259 inet/ether_ntoa.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800260 tzcode/asctime.c \
261 tzcode/difftime.c \
262 tzcode/localtime.c \
263 tzcode/strftime.c \
264 tzcode/strptime.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800265 bionic/__set_errno.c \
Mike Chan9f691562010-03-02 10:55:58 -0800266 bionic/cpuacct.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800267 bionic/arc4random.c \
268 bionic/basename.c \
269 bionic/basename_r.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800270 bionic/clearenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800271 bionic/dirname.c \
272 bionic/dirname_r.c \
273 bionic/drand48.c \
274 bionic/erand48.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800275 bionic/err.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800276 bionic/fdprintf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800277 bionic/fork.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800278 bionic/fts.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800279 bionic/if_nametoindex.c \
280 bionic/if_indextoname.c \
281 bionic/ioctl.c \
282 bionic/ldexp.c \
283 bionic/libc_init_common.c \
284 bionic/logd_write.c \
285 bionic/md5.c \
Andy McFadden4ce737f2011-02-04 14:45:57 -0800286 bionic/memmove_words.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800287 bionic/pututline.c \
288 bionic/realpath.c \
David 'Digit' Turner72e6fd42010-12-03 18:04:01 +0100289 bionic/sched_getaffinity.c \
290 bionic/sched_getcpu.c \
291 bionic/sched_cpualloc.c \
292 bionic/sched_cpucount.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800293 bionic/semaphore.c \
294 bionic/sha1.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800295 bionic/stubs.c \
296 bionic/system_properties.c \
Ben Cheng21eab512012-03-13 23:04:57 -0700297 bionic/tdelete.c \
298 bionic/tdestroy.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800299 bionic/time64.c \
Ben Cheng21eab512012-03-13 23:04:57 -0700300 bionic/tfind.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800301 bionic/thread_atexit.c \
Ben Cheng21eab512012-03-13 23:04:57 -0700302 bionic/tsearch.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800303 bionic/utime.c \
304 bionic/utmp.c \
305 netbsd/gethnamaddr.c \
306 netbsd/isc/ev_timers.c \
307 netbsd/isc/ev_streams.c \
308 netbsd/inet/nsap_addr.c \
309 netbsd/resolv/__dn_comp.c \
310 netbsd/resolv/__res_close.c \
311 netbsd/resolv/__res_send.c \
312 netbsd/resolv/herror.c \
313 netbsd/resolv/res_comp.c \
314 netbsd/resolv/res_data.c \
315 netbsd/resolv/res_debug.c \
316 netbsd/resolv/res_init.c \
317 netbsd/resolv/res_mkquery.c \
318 netbsd/resolv/res_query.c \
319 netbsd/resolv/res_send.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900320 netbsd/resolv/res_state.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800321 netbsd/resolv/res_cache.c \
322 netbsd/net/nsdispatch.c \
323 netbsd/net/getaddrinfo.c \
324 netbsd/net/getnameinfo.c \
325 netbsd/net/getservbyname.c \
326 netbsd/net/getservent.c \
327 netbsd/net/base64.c \
328 netbsd/net/getservbyport.c \
329 netbsd/nameser/ns_name.c \
330 netbsd/nameser/ns_parse.c \
331 netbsd/nameser/ns_ttl.c \
332 netbsd/nameser/ns_netint.c \
333 netbsd/nameser/ns_print.c \
Colin Cross4fa7b102010-01-12 18:59:25 -0800334 netbsd/nameser/ns_samedomain.c \
335 regex/regcomp.c \
336 regex/regerror.c \
337 regex/regexec.c \
338 regex/regfree.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800339
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700340libc_upstream_netbsd_src_files := \
341 upstream-netbsd/libc/string/strxfrm.c \
342
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700343# The following files are common, but must be compiled
344# with different C flags when building a static C library.
345#
346# The reason for this is the implementation of __get_tls()
347# that will differ between the shared and static versions
348# of the library.
349#
350# See comments in private/bionic_tls.h for more details.
351#
352# NOTE: bionic/pthread.c is added later to this list
353# because it needs special handling on ARM, see
354# below.
355#
356libc_static_common_src_files := \
357 unistd/sysconf.c \
358 bionic/__errno.c \
359
Dima Zavinca122b02009-05-27 10:52:37 -0700360# Architecture specific source files go here
361# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800362ifeq ($(TARGET_ARCH),arm)
363libc_common_src_files += \
David 'Digit' Turner97cf7f32010-01-22 18:59:05 -0800364 bionic/bionic_clone.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800365 arch-arm/bionic/__get_pc.S \
366 arch-arm/bionic/__get_sp.S \
367 arch-arm/bionic/_exit_with_stack_teardown.S \
368 arch-arm/bionic/_setjmp.S \
Ben Cheng017f4382012-05-08 13:36:37 -0700369 arch-arm/bionic/abort_arm.S \
David 'Digit' Turner0fec6b92011-11-16 17:37:15 +0100370 arch-arm/bionic/atomics_arm.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800371 arch-arm/bionic/clone.S \
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700372 arch-arm/bionic/eabi.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800373 arch-arm/bionic/ffs.S \
David 'Digit' Turner0fec6b92011-11-16 17:37:15 +0100374 arch-arm/bionic/futex_arm.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800375 arch-arm/bionic/kill.S \
David 'Digit' Turner2a7ad972009-09-29 14:43:38 -0700376 arch-arm/bionic/libgcc_compat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800377 arch-arm/bionic/tkill.S \
Jeff Brown10c8ce52011-11-18 15:17:07 -0800378 arch-arm/bionic/tgkill.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800379 arch-arm/bionic/memcmp.S \
380 arch-arm/bionic/memcmp16.S \
381 arch-arm/bionic/memcpy.S \
382 arch-arm/bionic/memset.S \
383 arch-arm/bionic/setjmp.S \
384 arch-arm/bionic/sigsetjmp.S \
385 arch-arm/bionic/strlen.c.arm \
Jim Huang73c04b32010-08-10 17:23:39 +0800386 arch-arm/bionic/strcpy.S \
Jim Huangf50e9be2011-04-20 15:35:04 +0800387 arch-arm/bionic/strcmp.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800388 arch-arm/bionic/syscall.S \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900389 string/memmove.c.arm \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800390 string/bcopy.c \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800391 string/strncmp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800392 unistd/socketcalls.c
393
394# These files need to be arm so that gdbserver
395# can set breakpoints in them without messing
396# up any thumb code.
397libc_common_src_files += \
Matt Fischer4f086ae2010-06-25 14:36:39 -0500398 bionic/pthread-atfork.c.arm \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700399 bionic/pthread-rwlocks.c.arm \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800400 bionic/pthread-timers.c.arm \
401 bionic/ptrace.c.arm
Dima Zavinca122b02009-05-27 10:52:37 -0700402
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700403libc_static_common_src_files += \
404 bionic/pthread.c.arm \
405
Dima Zavinca122b02009-05-27 10:52:37 -0700406# these are used by the static and dynamic versions of the libc
407# respectively
408libc_arch_static_src_files := \
409 arch-arm/bionic/exidx_static.c
410
411libc_arch_dynamic_src_files := \
412 arch-arm/bionic/exidx_dynamic.c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700413endif # arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800414
415ifeq ($(TARGET_ARCH),x86)
416libc_common_src_files += \
417 arch-x86/bionic/__get_sp.S \
418 arch-x86/bionic/__get_tls.c \
419 arch-x86/bionic/__set_tls.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800420 arch-x86/bionic/clone.S \
421 arch-x86/bionic/_exit_with_stack_teardown.S \
David 'Digit' Turner0fec6b92011-11-16 17:37:15 +0100422 arch-x86/bionic/futex_x86.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800423 arch-x86/bionic/setjmp.S \
424 arch-x86/bionic/_setjmp.S \
Chih-Wei Huang18635d92010-12-14 17:55:23 +0800425 arch-x86/bionic/sigsetjmp.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800426 arch-x86/bionic/vfork.S \
Bruce Beare3c543e12010-03-04 10:29:38 -0800427 arch-x86/bionic/syscall.S \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800428 arch-x86/string/bcopy_wrapper.S \
429 arch-x86/string/memcpy_wrapper.S \
430 arch-x86/string/memmove_wrapper.S \
431 arch-x86/string/bzero_wrapper.S \
432 arch-x86/string/memcmp_wrapper.S \
433 arch-x86/string/memset_wrapper.S \
434 arch-x86/string/strcmp_wrapper.S \
435 arch-x86/string/strncmp_wrapper.S \
Bruce Beare124a5422010-10-11 12:24:41 -0700436 arch-x86/string/strlen_wrapper.S \
Jim Huang73c04b32010-08-10 17:23:39 +0800437 string/strcpy.c \
Matt Fischer4f086ae2010-06-25 14:36:39 -0500438 bionic/pthread-atfork.c \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700439 bionic/pthread-rwlocks.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800440 bionic/pthread-timers.c \
441 bionic/ptrace.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800442
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700443libc_static_common_src_files += \
444 bionic/pthread.c \
445
Dima Zavinca122b02009-05-27 10:52:37 -0700446libc_arch_static_src_files := \
Raghu Gandham405b8022012-07-25 18:16:42 -0700447 bionic/dl_iterate_phdr_static.c
Dima Zavinca122b02009-05-27 10:52:37 -0700448
449libc_arch_dynamic_src_files :=
Raghu Gandhama4c79332012-08-07 12:23:24 -0700450endif # x86
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900451
Raghu Gandhama4c79332012-08-07 12:23:24 -0700452ifeq ($(TARGET_ARCH),mips)
453libc_common_src_files += \
454 bionic/bionic_clone.c \
455 arch-mips/bionic/__get_sp.S \
456 arch-mips/bionic/__get_tls.c \
457 arch-mips/bionic/__set_tls.c \
458 arch-mips/bionic/_exit_with_stack_teardown.S \
459 arch-mips/bionic/_setjmp.S \
460 arch-mips/bionic/futex_mips.S \
461 arch-mips/bionic/bzero.S \
462 arch-mips/bionic/cacheflush.c \
463 arch-mips/bionic/clone.S \
464 arch-mips/bionic/ffs.S \
465 arch-mips/bionic/memcmp16.S \
466 arch-mips/bionic/memmove.c \
467 arch-mips/bionic/pipe.S \
468 arch-mips/bionic/setjmp.S \
469 arch-mips/bionic/sigsetjmp.S \
470 arch-mips/bionic/vfork.S
471
472libc_common_src_files += \
473 arch-mips/string/memset.S \
474 arch-mips/string/memcpy.S \
475 arch-mips/string/mips_strlen.c
476
477libc_common_src_files += \
478 string/bcopy.c \
479 string/memcmp.c \
480 string/strcmp.c \
481 string/strcpy.c \
482 string/strncmp.c
483
484libc_common_src_files += \
485 bionic/pthread-atfork.c \
486 bionic/pthread-rwlocks.c \
487 bionic/pthread-timers.c \
488 bionic/ptrace.c
489
490libc_static_common_src_files += \
491 bionic/pthread.c
492
493libc_arch_static_src_files := \
494 bionic/dl_iterate_phdr_static.c
495
496libc_arch_dynamic_src_files :=
497endif # mips
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800498
Dima Zavinca122b02009-05-27 10:52:37 -0700499# Define some common cflags
500# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800501libc_common_cflags := \
Elliott Hughes470631e2012-06-06 10:32:56 -0700502 -DWITH_ERRLIST \
503 -DANDROID_CHANGES \
504 -DUSE_LOCKS \
505 -DREALLOC_ZERO_BYTES_FREES \
506 -D_LIBC=1 \
Elliott Hughes470631e2012-06-06 10:32:56 -0700507 -DFLOATING_POINT \
508 -DINET6 \
509 -I$(LOCAL_PATH)/private \
510 -DUSE_DL_PREFIX \
511 -DPOSIX_MISTAKE \
512 -DLOG_ON_HEAP_ERROR \
513 -std=gnu99
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800514
David 'Digit' Turnerd7ed1ae2010-03-05 14:17:35 -0800515# these macro definitions are required to implement the
516# 'timezone' and 'daylight' global variables, as well as
517# properly update the 'tm_gmtoff' field in 'struct tm'.
518#
519libc_common_cflags += \
520 -DTM_GMTOFF=tm_gmtoff \
521 -DUSG_COMPAT=1
522
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700523ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800524 libc_common_cflags += -DDEBUG
525endif
526
Jack Ren2fd81ef2011-11-19 09:48:03 +0800527# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
528# the appropriate BoardConfig.mk file.
529#
530ifneq ($(BOARD_MALLOC_ALIGNMENT),)
531 libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
532endif
533
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800534ifeq ($(TARGET_ARCH),arm)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700535 libc_common_cflags += -DSOFTFLOAT
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800536 libc_common_cflags += -fstrict-aliasing
Dima Zavinca122b02009-05-27 10:52:37 -0700537 libc_crt_target_cflags := -mthumb-interwork
David 'Digit' Turner4a05d122009-09-18 13:35:05 -0700538 #
539 # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
540 # that it should access the hardware TLS register directly in
541 # private/bionic_tls.h
542 #
543 # The value must match your kernel configuration
544 #
545 ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
546 libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
547 endif
Henrik Smidingfe6338d2010-09-15 16:08:03 +0200548 #
549 # Define HAVE_32_BYTE_CACHE_LINES to indicate to C
550 # library it should use to 32-byte version of memcpy, and not
551 # the 64-byte version.
552 #
553 ifeq ($(ARCH_ARM_HAVE_32_BYTE_CACHE_LINES),true)
554 libc_common_cflags += -DHAVE_32_BYTE_CACHE_LINE
555 endif
Prajakta Gudadhe08e72d02012-05-07 14:17:44 -0700556 ifeq ($(ARCH_ARM_USE_NON_NEON_MEMCPY),true)
557 libc_common_cflags += -DARCH_ARM_USE_NON_NEON_MEMCPY
558 endif
Dima Zavinca122b02009-05-27 10:52:37 -0700559endif # !arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800560
Raghu Gandhama4c79332012-08-07 12:23:24 -0700561ifeq ($(TARGET_ARCH),x86)
562 libc_common_cflags += -DSOFTFLOAT
563 libc_crt_target_cflags :=
564 ifeq ($(ARCH_X86_HAVE_SSE2),true)
565 libc_crt_target_cflags += -DUSE_SSE2=1
566 endif
567 ifeq ($(ARCH_X86_HAVE_SSSE3),true)
568 libc_crt_target_cflags += -DUSE_SSSE3=1
569 endif
570endif # x86
571
572ifeq ($(TARGET_ARCH),mips)
573 ifneq ($(ARCH_MIPS_HAS_FPU),true)
574 libc_common_cflags += -DSOFTFLOAT
575 endif
576 libc_common_cflags += -fstrict-aliasing
577 libc_crt_target_cflags := $(TARGET_GLOBAL_CFLAGS)
578endif # mips
579
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700580# Define ANDROID_SMP appropriately.
581ifeq ($(TARGET_CPU_SMP),true)
582 libc_common_cflags += -DANDROID_SMP=1
583else
584 libc_common_cflags += -DANDROID_SMP=0
585endif
586
Elliott Hughes76be6602012-08-08 14:07:37 -0700587# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
588libc_crt_target_cflags += \
589 -I$(LOCAL_PATH)/include \
590 -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700591
Bruce Beare39640842011-06-20 10:29:50 -0700592ifeq ($(TARGET_ARCH),arm)
Elliott Hughes76be6602012-08-08 14:07:37 -0700593 libc_crt_target_cflags += -DCRT_LEGACY_WORKAROUND
Bruce Beare39640842011-06-20 10:29:50 -0700594endif
595
Dima Zavinca122b02009-05-27 10:52:37 -0700596# Define some common includes
597# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800598libc_common_c_includes := \
599 $(LOCAL_PATH)/stdlib \
600 $(LOCAL_PATH)/string \
Nick Kralevich76656af2012-06-07 16:30:02 -0700601 $(LOCAL_PATH)/stdio \
602 external/safe-iop/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800603
Nick Kralevich9d403262012-05-31 11:40:10 -0700604# Needed to access private/__dso_handle.h from
David 'Digit' Turner3b43f872010-07-01 23:09:28 -0700605# crtbegin_xxx.S and crtend_xxx.S
Elliott Hughes76be6602012-08-08 14:07:37 -0700606libc_crt_target_cflags += \
607 -I$(LOCAL_PATH)/private \
608 -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800609
Dima Zavinca122b02009-05-27 10:52:37 -0700610# Define the libc run-time (crt) support object files that must be built,
611# which are needed to build all other objects (shared/static libs and
612# executables)
613# ==========================================================================
Raghu Gandhama4c79332012-08-07 12:23:24 -0700614# ARM, MIPS, and x86 all need crtbegin_so/crtend_so.
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700615#
616# For x86, the .init section must point to a function that calls all
617# entries in the .ctors section. (on ARM this is done through the
618# .init_array section instead).
619#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700620# For all the platforms, the .fini_array section must point to a function
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700621# that will call __cxa_finalize(&__dso_handle) in order to ensure that
622# static C++ destructors are properly called on dlclose().
623#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700624ifeq ($(TARGET_ARCH),arm)
625 libc_crtstart_extension := c
626 libc_crt_target_so_cflags :=
David 'Digit' Turner2d2dbd32011-06-25 17:26:38 +0200627endif
Raghu Gandhama4c79332012-08-07 12:23:24 -0700628ifeq ($(TARGET_ARCH),mips)
629 libc_crtstart_extension := S
630 libc_crt_target_so_cflags := -fPIC
631endif
632ifeq ($(TARGET_ARCH),x86)
633 libc_crtstart_extension := S
634 libc_crt_target_so_cflags := -fPIC
635endif
636ifeq ($(libc_crtstart_extension),)
637 $(error $(TARGET_ARCH) not supported)
638endif
639libc_crt_target_so_cflags += $(libc_crt_target_cflags)
640libc_crt_target_crtstart_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.$(libc_crtstart_extension)
641libc_crt_target_crtstart_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.$(libc_crtstart_extension)
Michael Hopeea8fad12012-07-31 16:18:22 +1200642
643# See the comment in crtbrand.c for the reason why we need to generate
644# crtbrand.s before generating crtbrand.o.
645GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
646$(GEN): $(LOCAL_PATH)/bionic/crtbrand.c
647 @mkdir -p $(dir $@)
648 $(TARGET_CC) $(libc_crt_target_so_cflags) -S -o $@ $<
649 sed -i -e '/\.note\.ABI-tag/s/progbits/note/' $@
650ALL_GENERATED_SOURCES += $(GEN)
651
652GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
653$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
654 @mkdir -p $(dir $@)
655 $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
656ALL_GENERATED_SOURCES += $(GEN)
657
Ying Wangfc9e5252012-05-15 15:15:11 -0700658GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
Nick Kralevich9d403262012-05-31 11:40:10 -0700659$(GEN): $(libc_crt_target_crtstart_so_file)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800660 @mkdir -p $(dir $@)
David 'Digit' Turner2d2dbd32011-06-25 17:26:38 +0200661 $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800662ALL_GENERATED_SOURCES += $(GEN)
663
Ying Wangfc9e5252012-05-15 15:15:11 -0700664GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800665$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
666 @mkdir -p $(dir $@)
David 'Digit' Turner2d2dbd32011-06-25 17:26:38 +0200667 $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800668ALL_GENERATED_SOURCES += $(GEN)
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700669
670GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtbegin_so.o
671$(GEN): $(libc_crt_target_crtstart_so_file)
672 @mkdir -p $(dir $@)
673 $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
674ALL_GENERATED_SOURCES += $(GEN)
675
676GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtend_so.o
677$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
678 @mkdir -p $(dir $@)
679 $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
680ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800681
Dima Zavinca122b02009-05-27 10:52:37 -0700682
Michael Hopeea8fad12012-07-31 16:18:22 +1200683GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o
684$(GEN): $(libc_crt_target_crtstart_file)
685 @mkdir -p $(dir $@)
686 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
687ALL_GENERATED_SOURCES += $(GEN)
688
Ying Wangfc9e5252012-05-15 15:15:11 -0700689GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200690$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
691 @mkdir -p $(dir $@)
692 $(TARGET_LD) -r -o $@ $^
693ALL_GENERATED_SOURCES += $(GEN)
694
695GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o
Nick Kralevich9d403262012-05-31 11:40:10 -0700696$(GEN): $(libc_crt_target_crtstart_file)
Dima Zavinca122b02009-05-27 10:52:37 -0700697 @mkdir -p $(dir $@)
698 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
699ALL_GENERATED_SOURCES += $(GEN)
700
Ying Wangfc9e5252012-05-15 15:15:11 -0700701GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200702$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
Dima Zavinca122b02009-05-27 10:52:37 -0700703 @mkdir -p $(dir $@)
Michael Hopeea8fad12012-07-31 16:18:22 +1200704 $(TARGET_LD) -r -o $@ $^
Dima Zavinca122b02009-05-27 10:52:37 -0700705ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800706
Dima Zavinca122b02009-05-27 10:52:37 -0700707# We rename crtend.o to crtend_android.o to avoid a
708# name clash between gcc and bionic.
Ying Wangfc9e5252012-05-15 15:15:11 -0700709GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
Dima Zavinca122b02009-05-27 10:52:37 -0700710$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
711 @mkdir -p $(dir $@)
712 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
713ALL_GENERATED_SOURCES += $(GEN)
714
715
716# To enable malloc leak check for statically linked programs, add
717# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
718WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
719
720# ========================================================
Nick Kralevich6334c662012-07-10 10:46:19 -0700721# libbionic_ssp.a - stack protector code
722# ========================================================
723#
724# The stack protector code needs to be compiled
725# with -fno-stack-protector, since it modifies the
726# stack canary.
727
728include $(CLEAR_VARS)
729
730LOCAL_SRC_FILES := bionic/ssp.c
731LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
732LOCAL_C_INCLUDES := $(libc_common_c_includes)
733LOCAL_MODULE := libbionic_ssp
Elliott Hughesae5c6442012-08-13 14:06:05 -0700734LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Nick Kralevich6334c662012-07-10 10:46:19 -0700735LOCAL_SYSTEM_SHARED_LIBRARIES :=
736
737include $(BUILD_STATIC_LIBRARY)
738
739
740# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700741# libc_netbsd.a - upstream NetBSD C library code
742# ========================================================
743#
744# These files are built with the netbsd-compat.h header file
745# automatically included.
746
747include $(CLEAR_VARS)
748
749LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
750LOCAL_CFLAGS := \
751 $(libc_common_cflags) \
752 -include upstream-netbsd/netbsd-compat.h
753LOCAL_C_INCLUDES := $(libc_common_c_includes)
754LOCAL_MODULE := libc_netbsd
Elliott Hughesae5c6442012-08-13 14:06:05 -0700755LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700756LOCAL_SYSTEM_SHARED_LIBRARIES :=
757
758include $(BUILD_STATIC_LIBRARY)
759
760
761# ========================================================
Dima Zavinca122b02009-05-27 10:52:37 -0700762# libc_common.a
763# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700764
Dima Zavinca122b02009-05-27 10:52:37 -0700765include $(CLEAR_VARS)
766
767LOCAL_SRC_FILES := $(libc_common_src_files)
768LOCAL_CFLAGS := $(libc_common_cflags)
Bruce Beare39640842011-06-20 10:29:50 -0700769ifeq ($(TARGET_ARCH),arm)
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700770 LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
Bruce Beare39640842011-06-20 10:29:50 -0700771endif
Dima Zavinca122b02009-05-27 10:52:37 -0700772LOCAL_C_INCLUDES := $(libc_common_c_includes)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800773LOCAL_MODULE := libc_common
Elliott Hughesae5c6442012-08-13 14:06:05 -0700774LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700775LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp libc_netbsd
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800776LOCAL_SYSTEM_SHARED_LIBRARIES :=
777
778include $(BUILD_STATIC_LIBRARY)
779
780
Dima Zavinca122b02009-05-27 10:52:37 -0700781# ========================================================
Dima Zavin49e55332009-05-27 10:52:37 -0700782# libc_nomalloc.a
783# ========================================================
784#
785# This is a version of the static C library that does not
786# include malloc. It's useful in situations when calling
787# the user wants to provide their own malloc implementation,
788# or wants to explicitly disallow the use of the use of malloc,
789# like the dynamic loader.
790
791include $(CLEAR_VARS)
792
793LOCAL_SRC_FILES := \
794 $(libc_arch_static_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700795 $(libc_static_common_src_files) \
Dima Zavin49e55332009-05-27 10:52:37 -0700796 bionic/libc_init_static.c
797
798LOCAL_C_INCLUDES := $(libc_common_c_includes)
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700799LOCAL_CFLAGS := $(libc_common_cflags) \
800 -DLIBC_STATIC
Dima Zavin49e55332009-05-27 10:52:37 -0700801
802LOCAL_MODULE := libc_nomalloc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700803LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dima Zavin49e55332009-05-27 10:52:37 -0700804LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
805LOCAL_SYSTEM_SHARED_LIBRARIES :=
806
807include $(BUILD_STATIC_LIBRARY)
808
809
810# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800811# libc.a
812# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800813include $(CLEAR_VARS)
814
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800815LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700816 $(libc_arch_static_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700817 $(libc_static_common_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800818 bionic/dlmalloc.c \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800819 bionic/malloc_debug_common.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800820 bionic/libc_init_static.c
821
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800822LOCAL_CFLAGS := $(libc_common_cflags) \
823 -DLIBC_STATIC
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800824LOCAL_C_INCLUDES := $(libc_common_c_includes)
Dima Zavinca122b02009-05-27 10:52:37 -0700825LOCAL_MODULE := libc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700826LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800827LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800828LOCAL_SYSTEM_SHARED_LIBRARIES :=
829
830include $(BUILD_STATIC_LIBRARY)
831
832
Dima Zavinca122b02009-05-27 10:52:37 -0700833# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800834# libc.so
835# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800836include $(CLEAR_VARS)
837
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700838# pthread deadlock prediction:
839# set -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=1 to enable support for
840# pthread deadlock prediction.
841# Since this code is experimental it is disabled by default.
842# see libc/bionic/pthread_debug.c for details
843
844LOCAL_CFLAGS := $(libc_common_cflags) -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=0
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800845LOCAL_C_INCLUDES := $(libc_common_c_includes)
846
847LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700848 $(libc_arch_dynamic_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700849 $(libc_static_common_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800850 bionic/dlmalloc.c \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800851 bionic/malloc_debug_common.c \
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700852 bionic/pthread_debug.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800853 bionic/libc_init_dynamic.c
854
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800855LOCAL_MODULE:= libc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700856LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800857
858# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
859# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
860# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
861# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
862# should, instead relying on the external symbols from the dependent libraries. That would
863# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
864# you wanted!
865
866LOCAL_SHARED_LIBRARIES := libdl
867LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
868LOCAL_SYSTEM_SHARED_LIBRARIES :=
869
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800870include $(BUILD_SHARED_LIBRARY)
871
872
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800873# For all builds, except for the -user build we will enable memory
874# allocation checking (including memory leaks, buffer overwrites, etc.)
875# Note that all these checks are also controlled by env. settings
876# that can enable, or disable specific checks. Note also that some of
877# the checks are available only in emulator and are implemeted in
878# libc_malloc_qemu_instrumented.so.
879ifneq ($(TARGET_BUILD_VARIANT),user)
880
Dima Zavinca122b02009-05-27 10:52:37 -0700881# ========================================================
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800882# libc_malloc_debug_leak.so
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800883# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800884include $(CLEAR_VARS)
885
Dima Zavinca122b02009-05-27 10:52:37 -0700886LOCAL_CFLAGS := \
887 $(libc_common_cflags) \
888 -DMALLOC_LEAK_CHECK
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800889
890LOCAL_C_INCLUDES := $(libc_common_c_includes)
891
892LOCAL_SRC_FILES := \
Iliyan Malcheve1dd3c22012-05-29 14:22:42 -0700893 bionic/malloc_debug_leak.c \
894 bionic/malloc_debug_check.c \
895 bionic/malloc_debug_check_mapinfo.c \
896 bionic/malloc_debug_stacktrace.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800897
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800898LOCAL_MODULE:= libc_malloc_debug_leak
Elliott Hughesae5c6442012-08-13 14:06:05 -0700899LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800900
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800901LOCAL_SHARED_LIBRARIES := libc
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800902LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
903LOCAL_SYSTEM_SHARED_LIBRARIES :=
Bruce Beareaa46fa22010-07-08 14:47:50 -0700904LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
Iliyan Malchev36807042011-03-14 14:02:05 -0700905
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800906# Don't install on release build
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800907LOCAL_MODULE_TAGS := eng debug
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800908
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800909include $(BUILD_SHARED_LIBRARY)
910
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800911
912# ========================================================
913# libc_malloc_debug_qemu.so
914# ========================================================
915include $(CLEAR_VARS)
916
917LOCAL_CFLAGS := \
918 $(libc_common_cflags) \
919 -DMALLOC_QEMU_INSTRUMENT
920
921LOCAL_C_INCLUDES := $(libc_common_c_includes)
922
923LOCAL_SRC_FILES := \
924 bionic/malloc_debug_qemu.c
925
926LOCAL_MODULE:= libc_malloc_debug_qemu
Elliott Hughesae5c6442012-08-13 14:06:05 -0700927LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800928
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700929LOCAL_SHARED_LIBRARIES := libc libdl
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800930LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
931LOCAL_SYSTEM_SHARED_LIBRARIES :=
Iliyan Malchev36807042011-03-14 14:02:05 -0700932
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800933# Don't install on release build
934LOCAL_MODULE_TAGS := eng debug
935
936include $(BUILD_SHARED_LIBRARY)
937
938endif #!user
939
940
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800941# ========================================================
942include $(call all-makefiles-under,$(LOCAL_PATH))