blob: c66ec5936d4891b578e171ec9b5cee09986860f3 [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 \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080012 unistd/daemon.c \
David 'Digit' Turnerdefd1622010-09-26 22:29:14 +020013 unistd/eventfd.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080014 unistd/exec.c \
15 unistd/fcntl.c \
16 unistd/fnmatch.c \
David 'Digit' Turnerab8b5412010-07-08 16:52:27 -070017 unistd/fstatfs.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080018 unistd/ftime.c \
19 unistd/ftok.c \
20 unistd/getcwd.c \
21 unistd/getdtablesize.c \
22 unistd/gethostname.c \
23 unistd/getopt_long.c \
24 unistd/getpgrp.c \
25 unistd/getpriority.c \
26 unistd/getpt.c \
27 unistd/initgroups.c \
28 unistd/isatty.c \
29 unistd/issetugid.c \
Colin Cross8c59d962010-01-13 16:39:26 -080030 unistd/killpg.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080031 unistd/lseek64.c \
32 unistd/mmap.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080033 unistd/open.c \
34 unistd/openat.c \
35 unistd/opendir.c \
36 unistd/pathconf.c \
37 unistd/perror.c \
38 unistd/popen.c \
39 unistd/pread.c \
40 unistd/pselect.c \
41 unistd/ptsname.c \
42 unistd/ptsname_r.c \
43 unistd/pwrite.c \
44 unistd/raise.c \
45 unistd/reboot.c \
46 unistd/recv.c \
47 unistd/sbrk.c \
48 unistd/send.c \
49 unistd/setegid.c \
Mike Chan9f691562010-03-02 10:55:58 -080050 unistd/setuid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080051 unistd/seteuid.c \
Mike Chan9f691562010-03-02 10:55:58 -080052 unistd/setreuid.c \
53 unistd/setresuid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080054 unistd/setpgrp.c \
55 unistd/sigblock.c \
56 unistd/siginterrupt.c \
57 unistd/siglist.c \
58 unistd/signal.c \
Thorsten Glaser92b10af2009-10-02 15:39:00 +020059 unistd/signame.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080060 unistd/sigsetmask.c \
61 unistd/sigsuspend.c \
62 unistd/sigwait.c \
63 unistd/sleep.c \
64 unistd/statfs.c \
65 unistd/strsignal.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080066 unistd/syslog.c \
67 unistd/system.c \
68 unistd/tcgetpgrp.c \
69 unistd/tcsetpgrp.c \
70 unistd/time.c \
71 unistd/umount.c \
72 unistd/unlockpt.c \
73 unistd/usleep.c \
74 unistd/wait.c \
75 stdio/asprintf.c \
76 stdio/clrerr.c \
77 stdio/fclose.c \
78 stdio/fdopen.c \
79 stdio/feof.c \
80 stdio/ferror.c \
81 stdio/fflush.c \
82 stdio/fgetc.c \
83 stdio/fgetln.c \
84 stdio/fgetpos.c \
85 stdio/fgets.c \
86 stdio/fileno.c \
87 stdio/findfp.c \
88 stdio/flags.c \
89 stdio/flockfile.c \
90 stdio/fopen.c \
91 stdio/fprintf.c \
92 stdio/fpurge.c \
93 stdio/fputc.c \
94 stdio/fputs.c \
95 stdio/fread.c \
96 stdio/freopen.c \
97 stdio/fscanf.c \
98 stdio/fseek.c \
99 stdio/fsetpos.c \
100 stdio/ftell.c \
101 stdio/funopen.c \
102 stdio/fvwrite.c \
103 stdio/fwalk.c \
104 stdio/fwrite.c \
105 stdio/getc.c \
106 stdio/getchar.c \
107 stdio/gets.c \
108 stdio/makebuf.c \
109 stdio/mktemp.c \
110 stdio/printf.c \
111 stdio/putc.c \
112 stdio/putchar.c \
113 stdio/puts.c \
114 stdio/putw.c \
115 stdio/refill.c \
116 stdio/remove.c \
117 stdio/rewind.c \
118 stdio/rget.c \
119 stdio/scanf.c \
120 stdio/setbuf.c \
121 stdio/setbuffer.c \
122 stdio/setvbuf.c \
123 stdio/snprintf.c\
124 stdio/sprintf.c \
125 stdio/sscanf.c \
126 stdio/stdio.c \
127 stdio/tempnam.c \
128 stdio/tmpfile.c \
129 stdio/tmpnam.c \
130 stdio/ungetc.c \
131 stdio/vasprintf.c \
132 stdio/vfprintf.c \
133 stdio/vfscanf.c \
134 stdio/vprintf.c \
135 stdio/vsnprintf.c \
136 stdio/vsprintf.c \
137 stdio/vscanf.c \
138 stdio/vsscanf.c \
139 stdio/wbuf.c \
140 stdio/wsetup.c \
Nick Kralevich965dbc62012-07-03 11:45:31 -0700141 stdio/__fgets_chk.c \
Nick Kralevichcffdf662012-06-11 15:50:57 -0700142 stdio/__snprintf_chk.c \
Nick Kralevich9b549c32012-06-12 15:59:04 -0700143 stdio/__sprintf_chk.c \
Nick Kralevichcffdf662012-06-11 15:50:57 -0700144 stdio/__vsnprintf_chk.c \
Nick Kralevich9b549c32012-06-12 15:59:04 -0700145 stdio/__vsprintf_chk.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800146 stdlib/_rand48.c \
147 stdlib/assert.c \
148 stdlib/atexit.c \
149 stdlib/atoi.c \
150 stdlib/atol.c \
151 stdlib/atoll.c \
152 stdlib/bsearch.c \
153 stdlib/ctype_.c \
154 stdlib/div.c \
155 stdlib/exit.c \
156 stdlib/getenv.c \
157 stdlib/jrand48.c \
158 stdlib/ldiv.c \
159 stdlib/lldiv.c \
160 stdlib/locale.c \
161 stdlib/lrand48.c \
162 stdlib/mrand48.c \
163 stdlib/nrand48.c \
164 stdlib/putenv.c \
165 stdlib/qsort.c \
166 stdlib/seed48.c \
167 stdlib/setenv.c \
168 stdlib/setjmperr.c \
169 stdlib/srand48.c \
170 stdlib/strntoimax.c \
171 stdlib/strntoumax.c \
172 stdlib/strtod.c \
173 stdlib/strtoimax.c \
174 stdlib/strtol.c \
175 stdlib/strtoll.c \
176 stdlib/strtoul.c \
177 stdlib/strtoull.c \
178 stdlib/strtoumax.c \
179 stdlib/tolower_.c \
180 stdlib/toupper_.c \
181 stdlib/wchar.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800182 string/index.c \
183 string/memccpy.c \
184 string/memchr.c \
185 string/memmem.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800186 string/memrchr.c \
187 string/memswap.c \
188 string/strcasecmp.c \
189 string/strcasestr.c \
190 string/strcat.c \
191 string/strchr.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800192 string/strcoll.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800193 string/strcspn.c \
194 string/strdup.c \
195 string/strerror.c \
196 string/strerror_r.c \
197 string/strlcat.c \
198 string/strlcpy.c \
199 string/strncat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800200 string/strncpy.c \
201 string/strndup.c \
202 string/strnlen.c \
203 string/strpbrk.c \
204 string/strrchr.c \
205 string/strsep.c \
206 string/strspn.c \
207 string/strstr.c \
208 string/strtok.c \
209 string/strtotimeval.c \
Nick Kralevich0a230152012-06-04 15:20:25 -0700210 string/__memcpy_chk.c \
211 string/__memmove_chk.c \
Nick Kralevich71a18dd2012-06-07 14:01:26 -0700212 string/__memset_chk.c \
Nick Kralevich0a230152012-06-04 15:20:25 -0700213 string/__strcat_chk.c \
214 string/__strcpy_chk.c \
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700215 string/__strlcat_chk.c \
216 string/__strlcpy_chk.c \
Nick Kralevich260bf8c2012-07-13 11:27:06 -0700217 string/__strlen_chk.c \
Nick Kralevich0a230152012-06-04 15:20:25 -0700218 string/__strncat_chk.c \
219 string/__strncpy_chk.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700220 wchar/wcpcpy.c \
221 wchar/wcpncpy.c \
222 wchar/wcscasecmp.c \
223 wchar/wcscat.c \
224 wchar/wcschr.c \
225 wchar/wcscmp.c \
226 wchar/wcscoll.c \
227 wchar/wcscpy.c \
228 wchar/wcscspn.c \
229 wchar/wcsdup.c \
230 wchar/wcslcat.c \
231 wchar/wcslcpy.c \
232 wchar/wcslen.c \
233 wchar/wcsncasecmp.c \
234 wchar/wcsncat.c \
235 wchar/wcsncmp.c \
236 wchar/wcsncpy.c \
237 wchar/wcsnlen.c \
238 wchar/wcspbrk.c \
239 wchar/wcsrchr.c \
240 wchar/wcsspn.c \
241 wchar/wcsstr.c \
242 wchar/wcstok.c \
243 wchar/wcswidth.c \
Kristian Monsen70465612010-06-16 14:51:52 +0100244 wchar/wcsxfrm.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700245 wchar/wmemchr.c \
Kristian Monsen70465612010-06-16 14:51:52 +0100246 wchar/wmemcmp.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700247 wchar/wmemcpy.c \
248 wchar/wmemmove.c \
249 wchar/wmemset.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800250 inet/bindresvport.c \
251 inet/inet_addr.c \
252 inet/inet_aton.c \
253 inet/inet_ntoa.c \
254 inet/inet_ntop.c \
255 inet/inet_pton.c \
Szymon Jakubczak41e533a2010-06-09 15:53:28 -0400256 inet/ether_aton.c \
257 inet/ether_ntoa.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800258 tzcode/asctime.c \
259 tzcode/difftime.c \
260 tzcode/localtime.c \
261 tzcode/strftime.c \
262 tzcode/strptime.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800263 bionic/__set_errno.c \
Jin Wei22d366c2012-08-08 15:15:16 +0800264 bionic/bionic_clone.c \
Mike Chan9f691562010-03-02 10:55:58 -0800265 bionic/cpuacct.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800266 bionic/arc4random.c \
267 bionic/basename.c \
268 bionic/basename_r.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800269 bionic/clearenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800270 bionic/dirname.c \
271 bionic/dirname_r.c \
272 bionic/drand48.c \
273 bionic/erand48.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800274 bionic/err.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800275 bionic/fdprintf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800276 bionic/fork.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800277 bionic/fts.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800278 bionic/if_nametoindex.c \
279 bionic/if_indextoname.c \
280 bionic/ioctl.c \
281 bionic/ldexp.c \
282 bionic/libc_init_common.c \
283 bionic/logd_write.c \
284 bionic/md5.c \
Andy McFadden4ce737f2011-02-04 14:45:57 -0800285 bionic/memmove_words.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800286 bionic/pututline.c \
287 bionic/realpath.c \
David 'Digit' Turner72e6fd42010-12-03 18:04:01 +0100288 bionic/sched_getaffinity.c \
289 bionic/sched_getcpu.c \
290 bionic/sched_cpualloc.c \
291 bionic/sched_cpucount.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800292 bionic/semaphore.c \
293 bionic/sha1.c \
Elliott Hughesde727ca2012-08-13 15:45:36 -0700294 bionic/stubs.cpp \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800295 bionic/system_properties.c \
Ben Cheng21eab512012-03-13 23:04:57 -0700296 bionic/tdestroy.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800297 bionic/time64.c \
298 bionic/thread_atexit.c \
299 bionic/utime.c \
300 bionic/utmp.c \
301 netbsd/gethnamaddr.c \
302 netbsd/isc/ev_timers.c \
303 netbsd/isc/ev_streams.c \
304 netbsd/inet/nsap_addr.c \
305 netbsd/resolv/__dn_comp.c \
306 netbsd/resolv/__res_close.c \
307 netbsd/resolv/__res_send.c \
308 netbsd/resolv/herror.c \
309 netbsd/resolv/res_comp.c \
310 netbsd/resolv/res_data.c \
311 netbsd/resolv/res_debug.c \
312 netbsd/resolv/res_init.c \
313 netbsd/resolv/res_mkquery.c \
314 netbsd/resolv/res_query.c \
315 netbsd/resolv/res_send.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900316 netbsd/resolv/res_state.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800317 netbsd/resolv/res_cache.c \
318 netbsd/net/nsdispatch.c \
319 netbsd/net/getaddrinfo.c \
320 netbsd/net/getnameinfo.c \
321 netbsd/net/getservbyname.c \
322 netbsd/net/getservent.c \
323 netbsd/net/base64.c \
324 netbsd/net/getservbyport.c \
325 netbsd/nameser/ns_name.c \
326 netbsd/nameser/ns_parse.c \
327 netbsd/nameser/ns_ttl.c \
328 netbsd/nameser/ns_netint.c \
329 netbsd/nameser/ns_print.c \
Colin Cross4fa7b102010-01-12 18:59:25 -0800330 netbsd/nameser/ns_samedomain.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800331
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700332libc_upstream_netbsd_src_files := \
Elliott Hughescc213f82012-08-14 15:32:42 -0700333 upstream-netbsd/libc/compat-43/creat.c \
Elliott Hughes3d2d4482012-08-13 16:38:29 -0700334 upstream-netbsd/libc/gen/nice.c \
Elliott Hughescc213f82012-08-14 15:32:42 -0700335 upstream-netbsd/libc/regex/regcomp.c \
336 upstream-netbsd/libc/regex/regerror.c \
337 upstream-netbsd/libc/regex/regexec.c \
338 upstream-netbsd/libc/regex/regfree.c \
Elliott Hughes409302f2012-08-13 17:02:11 -0700339 upstream-netbsd/libc/stdlib/tdelete.c \
340 upstream-netbsd/libc/stdlib/tfind.c \
341 upstream-netbsd/libc/stdlib/tsearch.c \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700342 upstream-netbsd/libc/string/strxfrm.c \
343
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700344# The following files are common, but must be compiled
345# with different C flags when building a static C library.
346#
347# The reason for this is the implementation of __get_tls()
348# that will differ between the shared and static versions
349# of the library.
350#
351# See comments in private/bionic_tls.h for more details.
352#
353# NOTE: bionic/pthread.c is added later to this list
354# because it needs special handling on ARM, see
355# below.
356#
357libc_static_common_src_files := \
358 unistd/sysconf.c \
359 bionic/__errno.c \
360
Dima Zavinca122b02009-05-27 10:52:37 -0700361# Architecture specific source files go here
362# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800363ifeq ($(TARGET_ARCH),arm)
364libc_common_src_files += \
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 += \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700454 arch-mips/bionic/__get_sp.S \
455 arch-mips/bionic/__get_tls.c \
456 arch-mips/bionic/__set_tls.c \
457 arch-mips/bionic/_exit_with_stack_teardown.S \
458 arch-mips/bionic/_setjmp.S \
459 arch-mips/bionic/futex_mips.S \
460 arch-mips/bionic/bzero.S \
461 arch-mips/bionic/cacheflush.c \
462 arch-mips/bionic/clone.S \
463 arch-mips/bionic/ffs.S \
464 arch-mips/bionic/memcmp16.S \
465 arch-mips/bionic/memmove.c \
466 arch-mips/bionic/pipe.S \
467 arch-mips/bionic/setjmp.S \
468 arch-mips/bionic/sigsetjmp.S \
469 arch-mips/bionic/vfork.S
470
471libc_common_src_files += \
472 arch-mips/string/memset.S \
473 arch-mips/string/memcpy.S \
474 arch-mips/string/mips_strlen.c
475
476libc_common_src_files += \
477 string/bcopy.c \
478 string/memcmp.c \
479 string/strcmp.c \
480 string/strcpy.c \
481 string/strncmp.c
482
483libc_common_src_files += \
484 bionic/pthread-atfork.c \
485 bionic/pthread-rwlocks.c \
486 bionic/pthread-timers.c \
487 bionic/ptrace.c
488
489libc_static_common_src_files += \
490 bionic/pthread.c
491
492libc_arch_static_src_files := \
493 bionic/dl_iterate_phdr_static.c
494
495libc_arch_dynamic_src_files :=
496endif # mips
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800497
Dima Zavinca122b02009-05-27 10:52:37 -0700498# Define some common cflags
499# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800500libc_common_cflags := \
Elliott Hughes470631e2012-06-06 10:32:56 -0700501 -DWITH_ERRLIST \
502 -DANDROID_CHANGES \
503 -DUSE_LOCKS \
504 -DREALLOC_ZERO_BYTES_FREES \
505 -D_LIBC=1 \
Elliott Hughes470631e2012-06-06 10:32:56 -0700506 -DFLOATING_POINT \
507 -DINET6 \
508 -I$(LOCAL_PATH)/private \
509 -DUSE_DL_PREFIX \
510 -DPOSIX_MISTAKE \
511 -DLOG_ON_HEAP_ERROR \
512 -std=gnu99
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800513
David 'Digit' Turnerd7ed1ae2010-03-05 14:17:35 -0800514# these macro definitions are required to implement the
515# 'timezone' and 'daylight' global variables, as well as
516# properly update the 'tm_gmtoff' field in 'struct tm'.
517#
518libc_common_cflags += \
519 -DTM_GMTOFF=tm_gmtoff \
520 -DUSG_COMPAT=1
521
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700522ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800523 libc_common_cflags += -DDEBUG
524endif
525
Jack Ren2fd81ef2011-11-19 09:48:03 +0800526# 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
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800533ifeq ($(TARGET_ARCH),arm)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700534 libc_common_cflags += -DSOFTFLOAT
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800535 libc_common_cflags += -fstrict-aliasing
Dima Zavinca122b02009-05-27 10:52:37 -0700536 libc_crt_target_cflags := -mthumb-interwork
David 'Digit' Turner4a05d122009-09-18 13:35:05 -0700537 #
538 # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
539 # that it should access the hardware TLS register directly in
540 # private/bionic_tls.h
541 #
542 # The value must match your kernel configuration
543 #
544 ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
545 libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
546 endif
Henrik Smidingfe6338d2010-09-15 16:08:03 +0200547 #
548 # Define HAVE_32_BYTE_CACHE_LINES to indicate to C
549 # library it should use to 32-byte version of memcpy, and not
550 # the 64-byte version.
551 #
552 ifeq ($(ARCH_ARM_HAVE_32_BYTE_CACHE_LINES),true)
553 libc_common_cflags += -DHAVE_32_BYTE_CACHE_LINE
554 endif
Prajakta Gudadhe08e72d02012-05-07 14:17:44 -0700555 ifeq ($(ARCH_ARM_USE_NON_NEON_MEMCPY),true)
556 libc_common_cflags += -DARCH_ARM_USE_NON_NEON_MEMCPY
557 endif
Dima Zavinca122b02009-05-27 10:52:37 -0700558endif # !arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800559
Raghu Gandhama4c79332012-08-07 12:23:24 -0700560ifeq ($(TARGET_ARCH),x86)
561 libc_common_cflags += -DSOFTFLOAT
562 libc_crt_target_cflags :=
563 ifeq ($(ARCH_X86_HAVE_SSE2),true)
564 libc_crt_target_cflags += -DUSE_SSE2=1
565 endif
566 ifeq ($(ARCH_X86_HAVE_SSSE3),true)
567 libc_crt_target_cflags += -DUSE_SSSE3=1
568 endif
569endif # x86
570
571ifeq ($(TARGET_ARCH),mips)
572 ifneq ($(ARCH_MIPS_HAS_FPU),true)
573 libc_common_cflags += -DSOFTFLOAT
574 endif
575 libc_common_cflags += -fstrict-aliasing
576 libc_crt_target_cflags := $(TARGET_GLOBAL_CFLAGS)
577endif # mips
578
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700579# Define ANDROID_SMP appropriately.
580ifeq ($(TARGET_CPU_SMP),true)
581 libc_common_cflags += -DANDROID_SMP=1
582else
583 libc_common_cflags += -DANDROID_SMP=0
584endif
585
Elliott Hughes76be6602012-08-08 14:07:37 -0700586# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
587libc_crt_target_cflags += \
588 -I$(LOCAL_PATH)/include \
589 -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700590
Bruce Beare39640842011-06-20 10:29:50 -0700591ifeq ($(TARGET_ARCH),arm)
Elliott Hughes76be6602012-08-08 14:07:37 -0700592 libc_crt_target_cflags += -DCRT_LEGACY_WORKAROUND
Bruce Beare39640842011-06-20 10:29:50 -0700593endif
594
Dima Zavinca122b02009-05-27 10:52:37 -0700595# Define some common includes
596# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800597libc_common_c_includes := \
598 $(LOCAL_PATH)/stdlib \
599 $(LOCAL_PATH)/string \
Nick Kralevich76656af2012-06-07 16:30:02 -0700600 $(LOCAL_PATH)/stdio \
601 external/safe-iop/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800602
Nick Kralevich9d403262012-05-31 11:40:10 -0700603# Needed to access private/__dso_handle.h from
David 'Digit' Turner3b43f872010-07-01 23:09:28 -0700604# crtbegin_xxx.S and crtend_xxx.S
Elliott Hughes76be6602012-08-08 14:07:37 -0700605libc_crt_target_cflags += \
606 -I$(LOCAL_PATH)/private \
607 -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800608
Dima Zavinca122b02009-05-27 10:52:37 -0700609# Define the libc run-time (crt) support object files that must be built,
610# which are needed to build all other objects (shared/static libs and
611# executables)
612# ==========================================================================
Raghu Gandhama4c79332012-08-07 12:23:24 -0700613# ARM, MIPS, and x86 all need crtbegin_so/crtend_so.
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700614#
615# For x86, the .init section must point to a function that calls all
616# entries in the .ctors section. (on ARM this is done through the
617# .init_array section instead).
618#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700619# For all the platforms, the .fini_array section must point to a function
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700620# that will call __cxa_finalize(&__dso_handle) in order to ensure that
621# static C++ destructors are properly called on dlclose().
622#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700623ifeq ($(TARGET_ARCH),arm)
624 libc_crtstart_extension := c
625 libc_crt_target_so_cflags :=
David 'Digit' Turner2d2dbd32011-06-25 17:26:38 +0200626endif
Raghu Gandhama4c79332012-08-07 12:23:24 -0700627ifeq ($(TARGET_ARCH),mips)
628 libc_crtstart_extension := S
629 libc_crt_target_so_cflags := -fPIC
630endif
631ifeq ($(TARGET_ARCH),x86)
632 libc_crtstart_extension := S
633 libc_crt_target_so_cflags := -fPIC
634endif
635ifeq ($(libc_crtstart_extension),)
636 $(error $(TARGET_ARCH) not supported)
637endif
638libc_crt_target_so_cflags += $(libc_crt_target_cflags)
639libc_crt_target_crtstart_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.$(libc_crtstart_extension)
640libc_crt_target_crtstart_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.$(libc_crtstart_extension)
Michael Hopeea8fad12012-07-31 16:18:22 +1200641
642# See the comment in crtbrand.c for the reason why we need to generate
643# crtbrand.s before generating crtbrand.o.
644GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
645$(GEN): $(LOCAL_PATH)/bionic/crtbrand.c
646 @mkdir -p $(dir $@)
647 $(TARGET_CC) $(libc_crt_target_so_cflags) -S -o $@ $<
648 sed -i -e '/\.note\.ABI-tag/s/progbits/note/' $@
649ALL_GENERATED_SOURCES += $(GEN)
650
651GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
652$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
653 @mkdir -p $(dir $@)
654 $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
655ALL_GENERATED_SOURCES += $(GEN)
656
Ying Wangfc9e5252012-05-15 15:15:11 -0700657GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
Nick Kralevich9d403262012-05-31 11:40:10 -0700658$(GEN): $(libc_crt_target_crtstart_so_file)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800659 @mkdir -p $(dir $@)
David 'Digit' Turner2d2dbd32011-06-25 17:26:38 +0200660 $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800661ALL_GENERATED_SOURCES += $(GEN)
662
Ying Wangfc9e5252012-05-15 15:15:11 -0700663GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800664$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
665 @mkdir -p $(dir $@)
David 'Digit' Turner2d2dbd32011-06-25 17:26:38 +0200666 $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800667ALL_GENERATED_SOURCES += $(GEN)
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700668
669GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtbegin_so.o
670$(GEN): $(libc_crt_target_crtstart_so_file)
671 @mkdir -p $(dir $@)
672 $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
673ALL_GENERATED_SOURCES += $(GEN)
674
675GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtend_so.o
676$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
677 @mkdir -p $(dir $@)
678 $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
679ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800680
Dima Zavinca122b02009-05-27 10:52:37 -0700681
Michael Hopeea8fad12012-07-31 16:18:22 +1200682GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o
683$(GEN): $(libc_crt_target_crtstart_file)
684 @mkdir -p $(dir $@)
685 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
686ALL_GENERATED_SOURCES += $(GEN)
687
Ying Wangfc9e5252012-05-15 15:15:11 -0700688GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200689$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
690 @mkdir -p $(dir $@)
691 $(TARGET_LD) -r -o $@ $^
692ALL_GENERATED_SOURCES += $(GEN)
693
694GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o
Nick Kralevich9d403262012-05-31 11:40:10 -0700695$(GEN): $(libc_crt_target_crtstart_file)
Dima Zavinca122b02009-05-27 10:52:37 -0700696 @mkdir -p $(dir $@)
697 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
698ALL_GENERATED_SOURCES += $(GEN)
699
Ying Wangfc9e5252012-05-15 15:15:11 -0700700GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200701$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
Dima Zavinca122b02009-05-27 10:52:37 -0700702 @mkdir -p $(dir $@)
Michael Hopeea8fad12012-07-31 16:18:22 +1200703 $(TARGET_LD) -r -o $@ $^
Dima Zavinca122b02009-05-27 10:52:37 -0700704ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800705
Dima Zavinca122b02009-05-27 10:52:37 -0700706# We rename crtend.o to crtend_android.o to avoid a
707# name clash between gcc and bionic.
Ying Wangfc9e5252012-05-15 15:15:11 -0700708GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
Dima Zavinca122b02009-05-27 10:52:37 -0700709$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
710 @mkdir -p $(dir $@)
711 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
712ALL_GENERATED_SOURCES += $(GEN)
713
714
715# To enable malloc leak check for statically linked programs, add
716# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
717WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
718
719# ========================================================
Nick Kralevich6334c662012-07-10 10:46:19 -0700720# libbionic_ssp.a - stack protector code
721# ========================================================
722#
723# The stack protector code needs to be compiled
724# with -fno-stack-protector, since it modifies the
725# stack canary.
726
727include $(CLEAR_VARS)
728
729LOCAL_SRC_FILES := bionic/ssp.c
730LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
731LOCAL_C_INCLUDES := $(libc_common_c_includes)
732LOCAL_MODULE := libbionic_ssp
Elliott Hughesae5c6442012-08-13 14:06:05 -0700733LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Nick Kralevich6334c662012-07-10 10:46:19 -0700734LOCAL_SYSTEM_SHARED_LIBRARIES :=
735
736include $(BUILD_STATIC_LIBRARY)
737
738
739# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700740# libc_netbsd.a - upstream NetBSD C library code
741# ========================================================
742#
743# These files are built with the netbsd-compat.h header file
744# automatically included.
745
746include $(CLEAR_VARS)
747
748LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
749LOCAL_CFLAGS := \
750 $(libc_common_cflags) \
Elliott Hughes3d2d4482012-08-13 16:38:29 -0700751 -I$(LOCAL_PATH)/upstream-netbsd \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700752 -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))