blob: 4470efa865e735d83ea0d9711aebf90d8457a127 [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 \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080011 unistd/exec.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080012 unistd/fnmatch.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080013 unistd/getopt_long.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080014 unistd/popen.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080015 unistd/syslog.c \
16 unistd/system.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080017 unistd/time.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080018 stdio/asprintf.c \
19 stdio/clrerr.c \
20 stdio/fclose.c \
21 stdio/fdopen.c \
22 stdio/feof.c \
23 stdio/ferror.c \
24 stdio/fflush.c \
25 stdio/fgetc.c \
26 stdio/fgetln.c \
27 stdio/fgetpos.c \
28 stdio/fgets.c \
29 stdio/fileno.c \
30 stdio/findfp.c \
31 stdio/flags.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080032 stdio/fopen.c \
33 stdio/fprintf.c \
34 stdio/fpurge.c \
35 stdio/fputc.c \
36 stdio/fputs.c \
37 stdio/fread.c \
38 stdio/freopen.c \
39 stdio/fscanf.c \
40 stdio/fseek.c \
41 stdio/fsetpos.c \
42 stdio/ftell.c \
43 stdio/funopen.c \
44 stdio/fvwrite.c \
45 stdio/fwalk.c \
46 stdio/fwrite.c \
47 stdio/getc.c \
48 stdio/getchar.c \
49 stdio/gets.c \
50 stdio/makebuf.c \
51 stdio/mktemp.c \
52 stdio/printf.c \
53 stdio/putc.c \
54 stdio/putchar.c \
55 stdio/puts.c \
56 stdio/putw.c \
57 stdio/refill.c \
58 stdio/remove.c \
59 stdio/rewind.c \
60 stdio/rget.c \
61 stdio/scanf.c \
62 stdio/setbuf.c \
63 stdio/setbuffer.c \
64 stdio/setvbuf.c \
65 stdio/snprintf.c\
66 stdio/sprintf.c \
67 stdio/sscanf.c \
68 stdio/stdio.c \
69 stdio/tempnam.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080070 stdio/tmpnam.c \
71 stdio/ungetc.c \
72 stdio/vasprintf.c \
73 stdio/vfprintf.c \
74 stdio/vfscanf.c \
75 stdio/vprintf.c \
76 stdio/vsnprintf.c \
77 stdio/vsprintf.c \
78 stdio/vscanf.c \
79 stdio/vsscanf.c \
80 stdio/wbuf.c \
81 stdio/wsetup.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080082 stdlib/atexit.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080083 stdlib/ctype_.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080084 stdlib/exit.c \
85 stdlib/getenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080086 stdlib/putenv.c \
87 stdlib/qsort.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080088 stdlib/setenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080089 stdlib/strtod.c \
90 stdlib/strtoimax.c \
91 stdlib/strtol.c \
92 stdlib/strtoll.c \
93 stdlib/strtoul.c \
94 stdlib/strtoull.c \
95 stdlib/strtoumax.c \
96 stdlib/tolower_.c \
97 stdlib/toupper_.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080098 string/index.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080099 string/strcasecmp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800100 string/strcat.c \
101 string/strchr.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800102 string/strcspn.c \
103 string/strdup.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800104 string/strlcat.c \
105 string/strlcpy.c \
106 string/strncat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800107 string/strncpy.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800108 string/strpbrk.c \
109 string/strrchr.c \
110 string/strsep.c \
111 string/strspn.c \
112 string/strstr.c \
113 string/strtok.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700114 wchar/wcswidth.c \
Kristian Monsen70465612010-06-16 14:51:52 +0100115 wchar/wcsxfrm.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800116 tzcode/asctime.c \
117 tzcode/difftime.c \
118 tzcode/localtime.c \
119 tzcode/strftime.c \
120 tzcode/strptime.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800121 bionic/arc4random.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700122 bionic/atoi.c \
123 bionic/atol.c \
124 bionic/atoll.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700125 bionic/bindresvport.c \
126 bionic/bionic_clone.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800127 bionic/clearenv.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700128 bionic/cpuacct.c \
129 bionic/daemon.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800130 bionic/err.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700131 bionic/ether_aton.c \
132 bionic/ether_ntoa.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700133 bionic/fcntl.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800134 bionic/fdprintf.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700135 bionic/flockfile.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800136 bionic/fork.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700137 bionic/fstatfs.c \
138 bionic/ftime.c \
139 bionic/ftok.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800140 bionic/fts.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700141 bionic/getdtablesize.c \
142 bionic/gethostname.c \
143 bionic/getpgrp.c \
144 bionic/getpriority.c \
145 bionic/getpt.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800146 bionic/if_indextoname.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700147 bionic/if_nametoindex.c \
148 bionic/initgroups.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800149 bionic/ioctl.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700150 bionic/isatty.c \
151 bionic/issetugid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800152 bionic/ldexp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800153 bionic/logd_write.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700154 bionic/lseek64.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800155 bionic/md5.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700156 bionic/memchr.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700157 bionic/memmem.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700158 bionic/memrchr.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700159 bionic/memswap.c \
160 bionic/mmap.c \
161 bionic/openat.c \
162 bionic/open.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700163 bionic/pathconf.c \
164 bionic/perror.c \
165 bionic/pread.c \
166 bionic/pselect.c \
167 bionic/ptsname.c \
168 bionic/ptsname_r.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800169 bionic/pututline.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700170 bionic/pwrite.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700171 bionic/reboot.c \
172 bionic/recv.c \
David 'Digit' Turner72e6fd42010-12-03 18:04:01 +0100173 bionic/sched_cpualloc.c \
174 bionic/sched_cpucount.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700175 bionic/sched_getaffinity.c \
176 bionic/sched_getcpu.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800177 bionic/semaphore.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700178 bionic/send.c \
179 bionic/setegid.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700180 bionic/seteuid.c \
181 bionic/setpgrp.c \
182 bionic/setresuid.c \
183 bionic/setreuid.c \
184 bionic/setuid.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700185 bionic/sigblock.c \
186 bionic/siginterrupt.c \
187 bionic/siglist.c \
188 bionic/signal.c \
189 bionic/signame.c \
190 bionic/sigsetmask.c \
191 bionic/sigsuspend.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700192 bionic/sleep.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700193 bionic/statfs.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700194 bionic/strndup.c \
195 bionic/strnlen.c \
196 bionic/strntoimax.c \
197 bionic/strntoumax.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700198 bionic/strtotimeval.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800199 bionic/system_properties.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700200 bionic/tcgetpgrp.c \
201 bionic/tcsetpgrp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800202 bionic/thread_atexit.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700203 bionic/time64.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700204 bionic/umount.c \
205 bionic/unlockpt.c \
206 bionic/usleep.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800207 bionic/utmp.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700208 bionic/wait.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700209 bionic/wcscoll.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800210 netbsd/gethnamaddr.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800211 netbsd/inet/nsap_addr.c \
212 netbsd/resolv/__dn_comp.c \
213 netbsd/resolv/__res_close.c \
214 netbsd/resolv/__res_send.c \
215 netbsd/resolv/herror.c \
216 netbsd/resolv/res_comp.c \
217 netbsd/resolv/res_data.c \
218 netbsd/resolv/res_debug.c \
219 netbsd/resolv/res_init.c \
220 netbsd/resolv/res_mkquery.c \
221 netbsd/resolv/res_query.c \
222 netbsd/resolv/res_send.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900223 netbsd/resolv/res_state.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800224 netbsd/resolv/res_cache.c \
225 netbsd/net/nsdispatch.c \
226 netbsd/net/getaddrinfo.c \
227 netbsd/net/getnameinfo.c \
228 netbsd/net/getservbyname.c \
229 netbsd/net/getservent.c \
230 netbsd/net/base64.c \
231 netbsd/net/getservbyport.c \
232 netbsd/nameser/ns_name.c \
233 netbsd/nameser/ns_parse.c \
234 netbsd/nameser/ns_ttl.c \
235 netbsd/nameser/ns_netint.c \
236 netbsd/nameser/ns_print.c \
Colin Cross4fa7b102010-01-12 18:59:25 -0800237 netbsd/nameser/ns_samedomain.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800238
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700239libc_bionic_src_files := \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700240 bionic/assert.cpp \
Elliott Hughes428f5562013-02-05 16:10:59 -0800241 bionic/brk.cpp \
Elliott Hughes1e980b62013-01-17 18:36:06 -0800242 bionic/debug_format.cpp \
David 'Digit' Turnerc30396f2012-10-29 15:32:54 +0100243 bionic/dirent.cpp \
Elliott Hughes91a99252013-02-12 21:56:42 -0800244 bionic/__errno.c \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700245 bionic/eventfd.cpp \
246 bionic/__fgets_chk.cpp \
Nick Kralevich2c5153b2013-01-11 14:43:05 -0800247 bionic/getauxval.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700248 bionic/getcwd.cpp \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800249 bionic/libc_init_common.cpp \
Elliott Hughes58b57542012-10-29 14:27:10 -0700250 bionic/libgen.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700251 bionic/__memcpy_chk.cpp \
252 bionic/__memmove_chk.cpp \
253 bionic/__memset_chk.cpp \
Elliott Hughes3e898472013-02-12 16:40:24 +0000254 bionic/pthread_attr.cpp \
Elliott Hughes9d23e042013-02-15 19:21:51 -0800255 bionic/pthread_detach.cpp \
256 bionic/pthread_equal.cpp \
257 bionic/pthread_getcpuclockid.cpp \
258 bionic/pthread_getschedparam.cpp \
259 bionic/pthread_internals.cpp \
260 bionic/pthread_join.cpp \
261 bionic/pthread_kill.cpp \
262 bionic/pthread_self.cpp \
Elliott Hughes3e898472013-02-12 16:40:24 +0000263 bionic/pthread_setname_np.cpp \
Elliott Hughes9d23e042013-02-15 19:21:51 -0800264 bionic/pthread_setschedparam.cpp \
Elliott Hughesc5d028f2013-01-10 14:42:14 -0800265 bionic/pthread_sigmask.cpp \
Chris Dearmand8a5a6f2012-12-07 18:41:10 -0800266 bionic/raise.cpp \
Elliott Hughes428f5562013-02-05 16:10:59 -0800267 bionic/sbrk.cpp \
Elliott Hughes701bec22013-02-25 13:14:31 -0800268 bionic/scandir.cpp \
Elliott Hughes4a9e8372012-11-30 11:58:57 -0800269 bionic/__set_errno.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700270 bionic/setlocale.cpp \
Rom Lemarchanda4b2dc02013-01-09 15:46:06 -0800271 bionic/signalfd.cpp \
Elliott Hughesc5d028f2013-01-10 14:42:14 -0800272 bionic/sigwait.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700273 bionic/__strcat_chk.cpp \
274 bionic/__strcpy_chk.cpp \
275 bionic/strerror.cpp \
276 bionic/strerror_r.cpp \
277 bionic/__strlcat_chk.cpp \
278 bionic/__strlcpy_chk.cpp \
279 bionic/__strlen_chk.cpp \
280 bionic/__strncat_chk.cpp \
281 bionic/__strncpy_chk.cpp \
282 bionic/strsignal.cpp \
283 bionic/stubs.cpp \
Elliott Hughes91a99252013-02-12 21:56:42 -0800284 bionic/sysconf.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700285 bionic/tdestroy.cpp \
286 bionic/tmpfile.cpp \
287 bionic/__umask_chk.cpp \
288 bionic/__vsnprintf_chk.cpp \
289 bionic/__vsprintf_chk.cpp \
290 bionic/wchar.cpp \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700291
Elliott Hughesf0777842013-03-01 16:59:46 -0800292libc_upstream_freebsd_src_files := \
293 upstream-freebsd/lib/libc/stdlib/realpath.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800294 upstream-freebsd/lib/libc/string/wcpcpy.c \
295 upstream-freebsd/lib/libc/string/wcpncpy.c \
296 upstream-freebsd/lib/libc/string/wcscasecmp.c \
297 upstream-freebsd/lib/libc/string/wcscat.c \
298 upstream-freebsd/lib/libc/string/wcschr.c \
299 upstream-freebsd/lib/libc/string/wcscmp.c \
300 upstream-freebsd/lib/libc/string/wcscpy.c \
301 upstream-freebsd/lib/libc/string/wcscspn.c \
302 upstream-freebsd/lib/libc/string/wcsdup.c \
303 upstream-freebsd/lib/libc/string/wcslcat.c \
304 upstream-freebsd/lib/libc/string/wcslcpy.c \
305 upstream-freebsd/lib/libc/string/wcslen.c \
306 upstream-freebsd/lib/libc/string/wcsncasecmp.c \
307 upstream-freebsd/lib/libc/string/wcsncat.c \
308 upstream-freebsd/lib/libc/string/wcsncmp.c \
309 upstream-freebsd/lib/libc/string/wcsncpy.c \
310 upstream-freebsd/lib/libc/string/wcsnlen.c \
311 upstream-freebsd/lib/libc/string/wcspbrk.c \
312 upstream-freebsd/lib/libc/string/wcsrchr.c \
313 upstream-freebsd/lib/libc/string/wcsspn.c \
314 upstream-freebsd/lib/libc/string/wcsstr.c \
315 upstream-freebsd/lib/libc/string/wcstok.c \
316 upstream-freebsd/lib/libc/string/wmemchr.c \
317 upstream-freebsd/lib/libc/string/wmemcmp.c \
318 upstream-freebsd/lib/libc/string/wmemcpy.c \
319 upstream-freebsd/lib/libc/string/wmemmove.c \
320 upstream-freebsd/lib/libc/string/wmemset.c \
Elliott Hughesf0777842013-03-01 16:59:46 -0800321
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700322libc_upstream_netbsd_src_files := \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700323 upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
324 upstream-netbsd/common/lib/libc/inet/inet_addr.c \
325 upstream-netbsd/libc/compat-43/creat.c \
326 upstream-netbsd/libc/gen/ftw.c \
327 upstream-netbsd/libc/gen/nftw.c \
328 upstream-netbsd/libc/gen/nice.c \
329 upstream-netbsd/libc/gen/psignal.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700330 upstream-netbsd/libc/gen/setjmperr.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700331 upstream-netbsd/libc/gen/utime.c \
332 upstream-netbsd/libc/inet/inet_ntoa.c \
333 upstream-netbsd/libc/inet/inet_ntop.c \
334 upstream-netbsd/libc/inet/inet_pton.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700335 upstream-netbsd/libc/isc/ev_streams.c \
336 upstream-netbsd/libc/isc/ev_timers.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700337 upstream-netbsd/libc/regex/regcomp.c \
338 upstream-netbsd/libc/regex/regerror.c \
339 upstream-netbsd/libc/regex/regexec.c \
340 upstream-netbsd/libc/regex/regfree.c \
341 upstream-netbsd/libc/stdio/getdelim.c \
342 upstream-netbsd/libc/stdio/getline.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700343 upstream-netbsd/libc/stdlib/bsearch.c \
344 upstream-netbsd/libc/stdlib/div.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700345 upstream-netbsd/libc/stdlib/drand48.c \
346 upstream-netbsd/libc/stdlib/erand48.c \
347 upstream-netbsd/libc/stdlib/jrand48.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700348 upstream-netbsd/libc/stdlib/ldiv.c \
349 upstream-netbsd/libc/stdlib/lldiv.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700350 upstream-netbsd/libc/stdlib/lrand48.c \
351 upstream-netbsd/libc/stdlib/mrand48.c \
352 upstream-netbsd/libc/stdlib/nrand48.c \
353 upstream-netbsd/libc/stdlib/_rand48.c \
354 upstream-netbsd/libc/stdlib/seed48.c \
355 upstream-netbsd/libc/stdlib/srand48.c \
356 upstream-netbsd/libc/stdlib/tdelete.c \
357 upstream-netbsd/libc/stdlib/tfind.c \
358 upstream-netbsd/libc/stdlib/tsearch.c \
Elliott Hughesc51cd762013-01-22 14:41:23 -0800359 upstream-netbsd/libc/string/memccpy.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700360 upstream-netbsd/libc/string/strcasestr.c \
Elliott Hughes2b473072013-01-22 15:10:19 -0800361 upstream-netbsd/libc/string/strcoll.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700362 upstream-netbsd/libc/string/strxfrm.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700363 upstream-netbsd/libc/unistd/killpg.c \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700364
Dima Zavinca122b02009-05-27 10:52:37 -0700365# Architecture specific source files go here
366# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800367ifeq ($(TARGET_ARCH),arm)
368libc_common_src_files += \
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 \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700373 arch-arm/bionic/_exit_with_stack_teardown.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800374 arch-arm/bionic/ffs.S \
David 'Digit' Turner0fec6b92011-11-16 17:37:15 +0100375 arch-arm/bionic/futex_arm.S \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700376 arch-arm/bionic/__get_sp.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800377 arch-arm/bionic/kill.S \
David 'Digit' Turner2a7ad972009-09-29 14:43:38 -0700378 arch-arm/bionic/libgcc_compat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800379 arch-arm/bionic/memcmp16.S \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700380 arch-arm/bionic/memcmp.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800381 arch-arm/bionic/memcpy.S \
382 arch-arm/bionic/memset.S \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700383 arch-arm/bionic/_setjmp.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800384 arch-arm/bionic/setjmp.S \
385 arch-arm/bionic/sigsetjmp.S \
Jim Huangf50e9be2011-04-20 15:35:04 +0800386 arch-arm/bionic/strcmp.S \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700387 arch-arm/bionic/strcpy.S \
388 arch-arm/bionic/strlen.c.arm \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800389 arch-arm/bionic/syscall.S \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700390 arch-arm/bionic/tgkill.S \
391 arch-arm/bionic/tkill.S \
392 bionic/memmove.c.arm \
393 bionic/socketcalls.c \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800394 string/bcopy.c \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800395 string/strncmp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800396
397# These files need to be arm so that gdbserver
398# can set breakpoints in them without messing
399# up any thumb code.
400libc_common_src_files += \
Matt Fischer4f086ae2010-06-25 14:36:39 -0500401 bionic/pthread-atfork.c.arm \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700402 bionic/pthread-rwlocks.c.arm \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800403 bionic/pthread-timers.c.arm \
404 bionic/ptrace.c.arm
Dima Zavinca122b02009-05-27 10:52:37 -0700405
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700406libc_static_common_src_files += \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000407 bionic/pthread.c.arm \
Elliott Hughes4b4a8822013-02-12 17:15:59 -0800408 bionic/pthread_create.cpp.arm \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000409 bionic/pthread_key.cpp.arm \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700410
Dima Zavinca122b02009-05-27 10:52:37 -0700411# these are used by the static and dynamic versions of the libc
412# respectively
413libc_arch_static_src_files := \
414 arch-arm/bionic/exidx_static.c
415
416libc_arch_dynamic_src_files := \
417 arch-arm/bionic/exidx_dynamic.c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700418endif # arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800419
420ifeq ($(TARGET_ARCH),x86)
421libc_common_src_files += \
Elliott Hughesd2547042013-02-13 16:31:52 -0800422 arch-x86/bionic/clone.S \
423 arch-x86/bionic/_exit_with_stack_teardown.S \
424 arch-x86/bionic/futex_x86.S \
425 arch-x86/bionic/__get_sp.S \
426 arch-x86/bionic/__get_tls.c \
427 arch-x86/bionic/_setjmp.S \
428 arch-x86/bionic/setjmp.S \
429 arch-x86/bionic/__set_tls.c \
430 arch-x86/bionic/sigsetjmp.S \
431 arch-x86/bionic/syscall.S \
432 arch-x86/bionic/vfork.S \
433 arch-x86/string/bcopy_wrapper.S \
434 arch-x86/string/bzero_wrapper.S \
435 arch-x86/string/ffs.S \
436 arch-x86/string/memcmp_wrapper.S \
437 arch-x86/string/memcpy_wrapper.S \
438 arch-x86/string/memmove_wrapper.S \
439 arch-x86/string/memset_wrapper.S \
440 arch-x86/string/strcmp_wrapper.S \
441 arch-x86/string/strlen_wrapper.S \
442 arch-x86/string/strncmp_wrapper.S \
443 bionic/pthread-atfork.c \
444 bionic/pthread-rwlocks.c \
445 bionic/pthread-timers.c \
446 bionic/ptrace.c \
447 string/strcpy.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800448
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700449libc_static_common_src_files += \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000450 bionic/pthread.c \
Elliott Hughes4b4a8822013-02-12 17:15:59 -0800451 bionic/pthread_create.cpp \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000452 bionic/pthread_key.cpp \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700453
Dima Zavinca122b02009-05-27 10:52:37 -0700454libc_arch_static_src_files := \
Raghu Gandham405b8022012-07-25 18:16:42 -0700455 bionic/dl_iterate_phdr_static.c
Dima Zavinca122b02009-05-27 10:52:37 -0700456
457libc_arch_dynamic_src_files :=
Raghu Gandhama4c79332012-08-07 12:23:24 -0700458endif # x86
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900459
Raghu Gandhama4c79332012-08-07 12:23:24 -0700460ifeq ($(TARGET_ARCH),mips)
461libc_common_src_files += \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700462 arch-mips/bionic/__get_sp.S \
463 arch-mips/bionic/__get_tls.c \
464 arch-mips/bionic/__set_tls.c \
465 arch-mips/bionic/_exit_with_stack_teardown.S \
466 arch-mips/bionic/_setjmp.S \
467 arch-mips/bionic/futex_mips.S \
468 arch-mips/bionic/bzero.S \
469 arch-mips/bionic/cacheflush.c \
470 arch-mips/bionic/clone.S \
471 arch-mips/bionic/ffs.S \
472 arch-mips/bionic/memcmp16.S \
473 arch-mips/bionic/memmove.c \
474 arch-mips/bionic/pipe.S \
475 arch-mips/bionic/setjmp.S \
476 arch-mips/bionic/sigsetjmp.S \
477 arch-mips/bionic/vfork.S
478
479libc_common_src_files += \
480 arch-mips/string/memset.S \
481 arch-mips/string/memcpy.S \
482 arch-mips/string/mips_strlen.c
483
484libc_common_src_files += \
Elliott Hughes857fed52012-10-02 11:20:07 -0700485 bionic/memcmp.c \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700486 string/bcopy.c \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700487 string/strcmp.c \
488 string/strcpy.c \
489 string/strncmp.c
490
491libc_common_src_files += \
492 bionic/pthread-atfork.c \
493 bionic/pthread-rwlocks.c \
494 bionic/pthread-timers.c \
495 bionic/ptrace.c
496
497libc_static_common_src_files += \
Elliott Hughesba342c12013-02-11 18:06:23 -0800498 bionic/pthread.c \
Elliott Hughes4b4a8822013-02-12 17:15:59 -0800499 bionic/pthread_create.cpp \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000500 bionic/pthread_key.cpp \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700501
502libc_arch_static_src_files := \
503 bionic/dl_iterate_phdr_static.c
504
505libc_arch_dynamic_src_files :=
506endif # mips
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800507
Dima Zavinca122b02009-05-27 10:52:37 -0700508# Define some common cflags
509# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800510libc_common_cflags := \
Elliott Hughes470631e2012-06-06 10:32:56 -0700511 -DWITH_ERRLIST \
512 -DANDROID_CHANGES \
Elliott Hughes470631e2012-06-06 10:32:56 -0700513 -D_LIBC=1 \
Elliott Hughes470631e2012-06-06 10:32:56 -0700514 -DFLOATING_POINT \
515 -DINET6 \
516 -I$(LOCAL_PATH)/private \
Elliott Hughes470631e2012-06-06 10:32:56 -0700517 -DPOSIX_MISTAKE \
518 -DLOG_ON_HEAP_ERROR \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700519 -Wall -Wextra
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800520
David 'Digit' Turnerd7ed1ae2010-03-05 14:17:35 -0800521# these macro definitions are required to implement the
522# 'timezone' and 'daylight' global variables, as well as
523# properly update the 'tm_gmtoff' field in 'struct tm'.
524#
525libc_common_cflags += \
526 -DTM_GMTOFF=tm_gmtoff \
527 -DUSG_COMPAT=1
528
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700529ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800530 libc_common_cflags += -DDEBUG
531endif
532
Jack Ren2fd81ef2011-11-19 09:48:03 +0800533# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
534# the appropriate BoardConfig.mk file.
535#
536ifneq ($(BOARD_MALLOC_ALIGNMENT),)
537 libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
538endif
539
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800540ifeq ($(TARGET_ARCH),arm)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700541 libc_common_cflags += -DSOFTFLOAT
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800542 libc_common_cflags += -fstrict-aliasing
Dima Zavinca122b02009-05-27 10:52:37 -0700543 libc_crt_target_cflags := -mthumb-interwork
David 'Digit' Turner4a05d122009-09-18 13:35:05 -0700544 #
Elliott Hughes91a99252013-02-12 21:56:42 -0800545 # Define HAVE_32_BYTE_CACHE_LINES to indicate to the C library
546 # that it should use the 32-byte version of memcpy, not
Henrik Smidingfe6338d2010-09-15 16:08:03 +0200547 # the 64-byte version.
548 #
549 ifeq ($(ARCH_ARM_HAVE_32_BYTE_CACHE_LINES),true)
550 libc_common_cflags += -DHAVE_32_BYTE_CACHE_LINE
551 endif
Prajakta Gudadhe08e72d02012-05-07 14:17:44 -0700552 ifeq ($(ARCH_ARM_USE_NON_NEON_MEMCPY),true)
553 libc_common_cflags += -DARCH_ARM_USE_NON_NEON_MEMCPY
554 endif
Dima Zavinca122b02009-05-27 10:52:37 -0700555endif # !arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800556
Raghu Gandhama4c79332012-08-07 12:23:24 -0700557ifeq ($(TARGET_ARCH),x86)
558 libc_common_cflags += -DSOFTFLOAT
559 libc_crt_target_cflags :=
560 ifeq ($(ARCH_X86_HAVE_SSE2),true)
561 libc_crt_target_cflags += -DUSE_SSE2=1
562 endif
563 ifeq ($(ARCH_X86_HAVE_SSSE3),true)
564 libc_crt_target_cflags += -DUSE_SSSE3=1
565 endif
566endif # x86
567
568ifeq ($(TARGET_ARCH),mips)
569 ifneq ($(ARCH_MIPS_HAS_FPU),true)
570 libc_common_cflags += -DSOFTFLOAT
571 endif
572 libc_common_cflags += -fstrict-aliasing
573 libc_crt_target_cflags := $(TARGET_GLOBAL_CFLAGS)
574endif # mips
575
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700576# Define ANDROID_SMP appropriately.
577ifeq ($(TARGET_CPU_SMP),true)
578 libc_common_cflags += -DANDROID_SMP=1
579else
580 libc_common_cflags += -DANDROID_SMP=0
581endif
582
Elliott Hughes76be6602012-08-08 14:07:37 -0700583# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
584libc_crt_target_cflags += \
585 -I$(LOCAL_PATH)/include \
586 -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700587
Dima Zavinca122b02009-05-27 10:52:37 -0700588# Define some common includes
589# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800590libc_common_c_includes := \
591 $(LOCAL_PATH)/stdlib \
592 $(LOCAL_PATH)/string \
Nick Kralevich76656af2012-06-07 16:30:02 -0700593 $(LOCAL_PATH)/stdio \
594 external/safe-iop/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800595
Nick Kralevich9d403262012-05-31 11:40:10 -0700596# Needed to access private/__dso_handle.h from
David 'Digit' Turner3b43f872010-07-01 23:09:28 -0700597# crtbegin_xxx.S and crtend_xxx.S
Elliott Hughes76be6602012-08-08 14:07:37 -0700598libc_crt_target_cflags += \
599 -I$(LOCAL_PATH)/private \
600 -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800601
Dima Zavinca122b02009-05-27 10:52:37 -0700602# Define the libc run-time (crt) support object files that must be built,
603# which are needed to build all other objects (shared/static libs and
604# executables)
605# ==========================================================================
Raghu Gandhama4c79332012-08-07 12:23:24 -0700606# ARM, MIPS, and x86 all need crtbegin_so/crtend_so.
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700607#
608# For x86, the .init section must point to a function that calls all
609# entries in the .ctors section. (on ARM this is done through the
610# .init_array section instead).
611#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700612# For all the platforms, the .fini_array section must point to a function
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700613# that will call __cxa_finalize(&__dso_handle) in order to ensure that
614# static C++ destructors are properly called on dlclose().
615#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700616ifeq ($(TARGET_ARCH),arm)
Elliott Hughes12949e52012-09-10 11:16:12 -0700617 libc_crtbegin_extension := c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700618 libc_crt_target_so_cflags :=
David 'Digit' Turner2d2dbd32011-06-25 17:26:38 +0200619endif
Raghu Gandhama4c79332012-08-07 12:23:24 -0700620ifeq ($(TARGET_ARCH),mips)
Elliott Hughes12949e52012-09-10 11:16:12 -0700621 libc_crtbegin_extension := S
Raghu Gandhama4c79332012-08-07 12:23:24 -0700622 libc_crt_target_so_cflags := -fPIC
623endif
624ifeq ($(TARGET_ARCH),x86)
Pavel Chupin20c4a3a2012-11-28 18:31:14 +0400625 libc_crtbegin_extension := c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700626 libc_crt_target_so_cflags := -fPIC
627endif
Elliott Hughes12949e52012-09-10 11:16:12 -0700628ifeq ($(libc_crtbegin_extension),)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700629 $(error $(TARGET_ARCH) not supported)
630endif
631libc_crt_target_so_cflags += $(libc_crt_target_cflags)
Elliott Hughes12949e52012-09-10 11:16:12 -0700632libc_crt_target_crtbegin_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.$(libc_crtbegin_extension)
633libc_crt_target_crtbegin_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.$(libc_crtbegin_extension)
Michael Hopeea8fad12012-07-31 16:18:22 +1200634
635# See the comment in crtbrand.c for the reason why we need to generate
636# crtbrand.s before generating crtbrand.o.
637GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
638$(GEN): $(LOCAL_PATH)/bionic/crtbrand.c
639 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700640 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) -S \
641 -MD -MF $(@:%.s=%.d) -o $@ $<
642 $(hide) sed -i -e '/\.note\.ABI-tag/s/progbits/note/' $@
643 $(call transform-d-to-p-args,$(@:%.s=%.d),$(@:%.s=%.P))
644-include $(GEN:%.s=%.P)
Michael Hopeea8fad12012-07-31 16:18:22 +1200645ALL_GENERATED_SOURCES += $(GEN)
646
647GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
648$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
649 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700650 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
Michael Hopeea8fad12012-07-31 16:18:22 +1200651ALL_GENERATED_SOURCES += $(GEN)
652
Ying Wangfc9e5252012-05-15 15:15:11 -0700653GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700654$(GEN): $(libc_crt_target_crtbegin_so_file)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800655 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700656 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) \
657 -MD -MF $(@:%.o=%.d) -o $@ -c $<
658 $(transform-d-to-p)
659-include $(GEN:%.o=%.P)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800660ALL_GENERATED_SOURCES += $(GEN)
661
Ying Wangfc9e5252012-05-15 15:15:11 -0700662GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800663$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
664 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700665 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) \
666 -MD -MF $(@:%.o=%.d) -o $@ -c $<
667 $(transform-d-to-p)
668-include $(GEN:%.o=%.P)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800669ALL_GENERATED_SOURCES += $(GEN)
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700670
Ying Wangcf464872012-09-07 17:06:56 -0700671# The following two are installed to device
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700672GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtbegin_so.o
Ying Wangcf464872012-09-07 17:06:56 -0700673$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
674 $(hide) mkdir -p $(dir $@) && cp -f $< $@
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700675ALL_GENERATED_SOURCES += $(GEN)
676
677GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtend_so.o
Ying Wangcf464872012-09-07 17:06:56 -0700678$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
679 $(hide) mkdir -p $(dir $@) && cp -f $< $@
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700680ALL_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
Elliott Hughes12949e52012-09-10 11:16:12 -0700684$(GEN): $(libc_crt_target_crtbegin_file)
Michael Hopeea8fad12012-07-31 16:18:22 +1200685 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700686 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
687 -MD -MF $(@:%.o=%.d) -o $@ -c $<
688 $(transform-d-to-p)
689-include $(GEN:%.o=%.P)
Michael Hopeea8fad12012-07-31 16:18:22 +1200690ALL_GENERATED_SOURCES += $(GEN)
691
Ying Wangfc9e5252012-05-15 15:15:11 -0700692GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200693$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
694 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700695 $(hide) $(TARGET_LD) -r -o $@ $^
Michael Hopeea8fad12012-07-31 16:18:22 +1200696ALL_GENERATED_SOURCES += $(GEN)
697
698GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700699$(GEN): $(libc_crt_target_crtbegin_file)
Dima Zavinca122b02009-05-27 10:52:37 -0700700 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700701 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
702 -MD -MF $(@:%.o=%.d) -o $@ -c $<
703 $(transform-d-to-p)
704-include $(GEN:%.o=%.P)
Dima Zavinca122b02009-05-27 10:52:37 -0700705ALL_GENERATED_SOURCES += $(GEN)
706
Ying Wangfc9e5252012-05-15 15:15:11 -0700707GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200708$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
Dima Zavinca122b02009-05-27 10:52:37 -0700709 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700710 $(hide) $(TARGET_LD) -r -o $@ $^
Dima Zavinca122b02009-05-27 10:52:37 -0700711ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800712
Dima Zavinca122b02009-05-27 10:52:37 -0700713# We rename crtend.o to crtend_android.o to avoid a
714# name clash between gcc and bionic.
Ying Wangfc9e5252012-05-15 15:15:11 -0700715GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
Dima Zavinca122b02009-05-27 10:52:37 -0700716$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
717 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700718 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
719 -MD -MF $(@:%.o=%.d) -o $@ -c $<
720 $(transform-d-to-p)
721-include $(GEN:%.o=%.P)
Dima Zavinca122b02009-05-27 10:52:37 -0700722ALL_GENERATED_SOURCES += $(GEN)
723
724
725# To enable malloc leak check for statically linked programs, add
726# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
727WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
728
729# ========================================================
Nick Kralevich6334c662012-07-10 10:46:19 -0700730# libbionic_ssp.a - stack protector code
731# ========================================================
732#
733# The stack protector code needs to be compiled
734# with -fno-stack-protector, since it modifies the
735# stack canary.
736
737include $(CLEAR_VARS)
738
Elliott Hughes642331b2013-03-06 15:03:53 -0800739LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
Elliott Hughesdc5ec072013-02-14 11:15:58 -0800740LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector -Werror
Nick Kralevich6334c662012-07-10 10:46:19 -0700741LOCAL_C_INCLUDES := $(libc_common_c_includes)
742LOCAL_MODULE := libbionic_ssp
Elliott Hughesae5c6442012-08-13 14:06:05 -0700743LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Nick Kralevich6334c662012-07-10 10:46:19 -0700744LOCAL_SYSTEM_SHARED_LIBRARIES :=
745
746include $(BUILD_STATIC_LIBRARY)
747
748
749# ========================================================
Elliott Hughesf0777842013-03-01 16:59:46 -0800750# libc_freebsd.a - upstream FreeBSD C library code
751# ========================================================
752#
753# These files are built with the freebsd-compat.h header file
754# automatically included.
755
756include $(CLEAR_VARS)
757
758LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files)
759LOCAL_CFLAGS := \
760 $(libc_common_cflags) \
761 -I$(LOCAL_PATH)/upstream-freebsd \
762 -I$(LOCAL_PATH)/upstream-freebsd/libc/include \
763 -include upstream-freebsd/freebsd-compat.h
764LOCAL_C_INCLUDES := $(libc_common_c_includes)
765LOCAL_MODULE := libc_freebsd
766LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
767LOCAL_SYSTEM_SHARED_LIBRARIES :=
768
769include $(BUILD_STATIC_LIBRARY)
770
771
772# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700773# libc_netbsd.a - upstream NetBSD C library code
774# ========================================================
775#
776# These files are built with the netbsd-compat.h header file
777# automatically included.
778
779include $(CLEAR_VARS)
780
781LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
782LOCAL_CFLAGS := \
783 $(libc_common_cflags) \
Elliott Hughes3d2d4482012-08-13 16:38:29 -0700784 -I$(LOCAL_PATH)/upstream-netbsd \
Elliott Hughesab44f522012-10-23 16:05:09 -0700785 -I$(LOCAL_PATH)/upstream-netbsd/libc/include \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700786 -include upstream-netbsd/netbsd-compat.h
787LOCAL_C_INCLUDES := $(libc_common_c_includes)
788LOCAL_MODULE := libc_netbsd
Elliott Hughesae5c6442012-08-13 14:06:05 -0700789LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700790LOCAL_SYSTEM_SHARED_LIBRARIES :=
791
792include $(BUILD_STATIC_LIBRARY)
793
794
795# ========================================================
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700796# libc_bionic.a - home-grown C library code
797# ========================================================
798#
799include $(CLEAR_VARS)
800
801LOCAL_SRC_FILES := $(libc_bionic_src_files)
802LOCAL_CFLAGS := $(libc_common_cflags) -Werror
803LOCAL_C_INCLUDES := $(libc_common_c_includes)
804LOCAL_MODULE := libc_bionic
805LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
806LOCAL_SYSTEM_SHARED_LIBRARIES :=
807
808include $(BUILD_STATIC_LIBRARY)
809
810
811# ========================================================
Dima Zavinca122b02009-05-27 10:52:37 -0700812# libc_common.a
813# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700814
Dima Zavinca122b02009-05-27 10:52:37 -0700815include $(CLEAR_VARS)
816
817LOCAL_SRC_FILES := $(libc_common_src_files)
Elliott Hughesab44f522012-10-23 16:05:09 -0700818LOCAL_CFLAGS := $(libc_common_cflags) \
819 -std=gnu99 \
820 -I$(LOCAL_PATH)/upstream-netbsd/libc/include # for netbsd private headers
Dima Zavinca122b02009-05-27 10:52:37 -0700821LOCAL_C_INCLUDES := $(libc_common_c_includes)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800822LOCAL_MODULE := libc_common
Elliott Hughesae5c6442012-08-13 14:06:05 -0700823LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughesf0777842013-03-01 16:59:46 -0800824LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp libc_bionic libc_freebsd libc_netbsd
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800825LOCAL_SYSTEM_SHARED_LIBRARIES :=
826
827include $(BUILD_STATIC_LIBRARY)
828
829
Dima Zavinca122b02009-05-27 10:52:37 -0700830# ========================================================
Dima Zavin49e55332009-05-27 10:52:37 -0700831# libc_nomalloc.a
832# ========================================================
833#
834# This is a version of the static C library that does not
Elliott Hughes91a99252013-02-12 21:56:42 -0800835# include malloc. It's useful in situations when the user wants
836# to provide their own malloc implementation, or wants to
837# explicitly disallow the use of the use of malloc,
838# such as in the dynamic loader.
Dima Zavin49e55332009-05-27 10:52:37 -0700839
840include $(CLEAR_VARS)
841
842LOCAL_SRC_FILES := \
843 $(libc_arch_static_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700844 $(libc_static_common_src_files) \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800845 bionic/libc_init_static.cpp
Dima Zavin49e55332009-05-27 10:52:37 -0700846
847LOCAL_C_INCLUDES := $(libc_common_c_includes)
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700848LOCAL_CFLAGS := $(libc_common_cflags) \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700849 -DLIBC_STATIC \
850 -std=gnu99
Dima Zavin49e55332009-05-27 10:52:37 -0700851
852LOCAL_MODULE := libc_nomalloc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700853LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dima Zavin49e55332009-05-27 10:52:37 -0700854LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
855LOCAL_SYSTEM_SHARED_LIBRARIES :=
856
857include $(BUILD_STATIC_LIBRARY)
858
859
860# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800861# libc.a
862# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800863include $(CLEAR_VARS)
864
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800865LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700866 $(libc_arch_static_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700867 $(libc_static_common_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800868 bionic/dlmalloc.c \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700869 bionic/malloc_debug_common.cpp \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800870 bionic/libc_init_static.cpp
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800871
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800872LOCAL_CFLAGS := $(libc_common_cflags) \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700873 -DLIBC_STATIC \
874 -std=gnu99
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800875LOCAL_C_INCLUDES := $(libc_common_c_includes)
Dima Zavinca122b02009-05-27 10:52:37 -0700876LOCAL_MODULE := libc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700877LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800878LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800879LOCAL_SYSTEM_SHARED_LIBRARIES :=
880
881include $(BUILD_STATIC_LIBRARY)
882
883
Dima Zavinca122b02009-05-27 10:52:37 -0700884# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800885# libc.so
886# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800887include $(CLEAR_VARS)
888
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700889# pthread deadlock prediction:
890# set -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=1 to enable support for
891# pthread deadlock prediction.
892# Since this code is experimental it is disabled by default.
893# see libc/bionic/pthread_debug.c for details
894
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700895LOCAL_CFLAGS := $(libc_common_cflags) -std=gnu99 -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=0
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800896LOCAL_C_INCLUDES := $(libc_common_c_includes)
897
898LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700899 $(libc_arch_dynamic_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700900 $(libc_static_common_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800901 bionic/dlmalloc.c \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700902 bionic/malloc_debug_common.cpp \
Elliott Hughes1e980b62013-01-17 18:36:06 -0800903 bionic/pthread_debug.cpp \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800904 bionic/libc_init_dynamic.cpp
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800905
Ard Biesheuvelf3cfcd82012-08-21 14:13:50 +0200906ifeq ($(TARGET_ARCH),arm)
907 LOCAL_NO_CRT := true
908 LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
909
910 LOCAL_SRC_FILES := \
911 arch-arm/bionic/crtbegin_so.c \
912 arch-arm/bionic/atexit_legacy.c \
913 $(LOCAL_SRC_FILES) \
914 arch-arm/bionic/crtend_so.S
915endif
916
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800917LOCAL_MODULE:= libc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700918LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughes914d8d42012-10-18 11:28:56 -0700919LOCAL_REQUIRED_MODULES := tzdata
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800920
921# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
922# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
923# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
924# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
925# should, instead relying on the external symbols from the dependent libraries. That would
926# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
927# you wanted!
928
929LOCAL_SHARED_LIBRARIES := libdl
930LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
931LOCAL_SYSTEM_SHARED_LIBRARIES :=
932
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800933include $(BUILD_SHARED_LIBRARY)
934
935
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800936# For all builds, except for the -user build we will enable memory
937# allocation checking (including memory leaks, buffer overwrites, etc.)
938# Note that all these checks are also controlled by env. settings
939# that can enable, or disable specific checks. Note also that some of
940# the checks are available only in emulator and are implemeted in
941# libc_malloc_qemu_instrumented.so.
942ifneq ($(TARGET_BUILD_VARIANT),user)
943
Dima Zavinca122b02009-05-27 10:52:37 -0700944# ========================================================
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800945# libc_malloc_debug_leak.so
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800946# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800947include $(CLEAR_VARS)
948
Dima Zavinca122b02009-05-27 10:52:37 -0700949LOCAL_CFLAGS := \
950 $(libc_common_cflags) \
951 -DMALLOC_LEAK_CHECK
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800952
953LOCAL_C_INCLUDES := $(libc_common_c_includes)
954
955LOCAL_SRC_FILES := \
Elliott Hughes1e980b62013-01-17 18:36:06 -0800956 bionic/debug_mapinfo.cpp \
957 bionic/debug_stacktrace.cpp \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700958 bionic/malloc_debug_leak.cpp \
959 bionic/malloc_debug_check.cpp \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800960
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800961LOCAL_MODULE:= libc_malloc_debug_leak
Elliott Hughesae5c6442012-08-13 14:06:05 -0700962LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800963
Pavel Chupine0077752012-09-10 19:35:25 +0400964LOCAL_SHARED_LIBRARIES := libc libdl
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800965LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
966LOCAL_SYSTEM_SHARED_LIBRARIES :=
Bruce Beareaa46fa22010-07-08 14:47:50 -0700967LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
Iliyan Malchev36807042011-03-14 14:02:05 -0700968
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800969# Don't install on release build
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800970LOCAL_MODULE_TAGS := eng debug
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800971
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800972include $(BUILD_SHARED_LIBRARY)
973
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800974
975# ========================================================
976# libc_malloc_debug_qemu.so
977# ========================================================
978include $(CLEAR_VARS)
979
980LOCAL_CFLAGS := \
981 $(libc_common_cflags) \
982 -DMALLOC_QEMU_INSTRUMENT
983
984LOCAL_C_INCLUDES := $(libc_common_c_includes)
985
986LOCAL_SRC_FILES := \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700987 bionic/malloc_debug_qemu.cpp
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800988
989LOCAL_MODULE:= libc_malloc_debug_qemu
Elliott Hughesae5c6442012-08-13 14:06:05 -0700990LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800991
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700992LOCAL_SHARED_LIBRARIES := libc libdl
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800993LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
994LOCAL_SYSTEM_SHARED_LIBRARIES :=
Iliyan Malchev36807042011-03-14 14:02:05 -0700995
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800996# Don't install on release build
997LOCAL_MODULE_TAGS := eng debug
998
999include $(BUILD_SHARED_LIBRARY)
1000
1001endif #!user
1002
1003
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001004# ========================================================
1005include $(call all-makefiles-under,$(LOCAL_PATH))