blob: 04741be89d17891c7333dd2f858c8d6a10c5790a [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) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08009 unistd/alarm.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080010 unistd/exec.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080011 unistd/fnmatch.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080012 unistd/getopt_long.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080013 unistd/syslog.c \
14 unistd/system.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080015 unistd/time.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080016 stdio/asprintf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080017 stdio/fflush.c \
18 stdio/fgetc.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080019 stdio/findfp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080020 stdio/fprintf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080021 stdio/fputc.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080022 stdio/fread.c \
23 stdio/freopen.c \
24 stdio/fscanf.c \
25 stdio/fseek.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080026 stdio/ftell.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080027 stdio/fvwrite.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080028 stdio/gets.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080029 stdio/mktemp.c \
30 stdio/printf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080031 stdio/refill.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080032 stdio/rewind.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080033 stdio/scanf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080034 stdio/snprintf.c\
35 stdio/sprintf.c \
36 stdio/sscanf.c \
37 stdio/stdio.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080038 stdio/ungetc.c \
39 stdio/vasprintf.c \
40 stdio/vfprintf.c \
41 stdio/vfscanf.c \
42 stdio/vprintf.c \
43 stdio/vsnprintf.c \
44 stdio/vsprintf.c \
45 stdio/vscanf.c \
46 stdio/vsscanf.c \
47 stdio/wbuf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080048 stdlib/atexit.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080049 stdlib/ctype_.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080050 stdlib/exit.c \
51 stdlib/getenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080052 stdlib/putenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080053 stdlib/setenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080054 stdlib/strtod.c \
55 stdlib/strtoimax.c \
56 stdlib/strtol.c \
57 stdlib/strtoll.c \
58 stdlib/strtoul.c \
59 stdlib/strtoull.c \
60 stdlib/strtoumax.c \
61 stdlib/tolower_.c \
62 stdlib/toupper_.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080063 string/strcasecmp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080064 string/strcspn.c \
65 string/strdup.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080066 string/strpbrk.c \
Liubov Dmitrieva0a490662012-01-17 12:55:46 +040067 string/__strrchr_chk.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080068 string/strsep.c \
69 string/strspn.c \
70 string/strstr.c \
71 string/strtok.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -070072 wchar/wcswidth.c \
Kristian Monsen70465612010-06-16 14:51:52 +010073 wchar/wcsxfrm.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080074 tzcode/asctime.c \
75 tzcode/difftime.c \
76 tzcode/localtime.c \
77 tzcode/strftime.c \
78 tzcode/strptime.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080079 bionic/arc4random.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070080 bionic/atoi.c \
81 bionic/atol.c \
82 bionic/atoll.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070083 bionic/bindresvport.c \
84 bionic/bionic_clone.c \
Colin Crossfc10b242010-01-13 17:48:34 -080085 bionic/clearenv.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070086 bionic/cpuacct.c \
87 bionic/daemon.c \
Colin Cross64ceac32010-01-13 21:19:52 -080088 bionic/err.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070089 bionic/ether_aton.c \
90 bionic/ether_ntoa.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070091 bionic/fcntl.c \
Colin Crossfc10b242010-01-13 17:48:34 -080092 bionic/fdprintf.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070093 bionic/flockfile.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080094 bionic/fork.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070095 bionic/fstatfs.c \
96 bionic/ftime.c \
97 bionic/ftok.c \
Colin Cross64ceac32010-01-13 21:19:52 -080098 bionic/fts.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070099 bionic/getdtablesize.c \
100 bionic/gethostname.c \
101 bionic/getpgrp.c \
102 bionic/getpriority.c \
103 bionic/getpt.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800104 bionic/if_indextoname.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700105 bionic/if_nametoindex.c \
106 bionic/initgroups.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800107 bionic/ioctl.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700108 bionic/isatty.c \
109 bionic/issetugid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800110 bionic/ldexp.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700111 bionic/lseek64.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800112 bionic/md5.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700113 bionic/memmem.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700114 bionic/memswap.c \
115 bionic/mmap.c \
116 bionic/openat.c \
117 bionic/open.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700118 bionic/pathconf.c \
119 bionic/perror.c \
120 bionic/pread.c \
121 bionic/pselect.c \
122 bionic/ptsname.c \
123 bionic/ptsname_r.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800124 bionic/pututline.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700125 bionic/pwrite.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700126 bionic/reboot.c \
127 bionic/recv.c \
David 'Digit' Turner72e6fd42010-12-03 18:04:01 +0100128 bionic/sched_cpualloc.c \
129 bionic/sched_cpucount.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700130 bionic/sched_getcpu.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800131 bionic/semaphore.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700132 bionic/send.c \
133 bionic/setegid.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700134 bionic/seteuid.c \
135 bionic/setpgrp.c \
136 bionic/setresuid.c \
137 bionic/setreuid.c \
138 bionic/setuid.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700139 bionic/sigblock.c \
140 bionic/siginterrupt.c \
141 bionic/siglist.c \
142 bionic/signal.c \
143 bionic/signame.c \
144 bionic/sigsetmask.c \
145 bionic/sigsuspend.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700146 bionic/sleep.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700147 bionic/statfs.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700148 bionic/strndup.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700149 bionic/strntoimax.c \
150 bionic/strntoumax.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700151 bionic/strtotimeval.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800152 bionic/system_properties.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700153 bionic/tcgetpgrp.c \
154 bionic/tcsetpgrp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800155 bionic/thread_atexit.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700156 bionic/time64.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700157 bionic/umount.c \
158 bionic/unlockpt.c \
159 bionic/usleep.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800160 bionic/utmp.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700161 bionic/wcscoll.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800162 netbsd/gethnamaddr.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800163 netbsd/inet/nsap_addr.c \
164 netbsd/resolv/__dn_comp.c \
165 netbsd/resolv/__res_close.c \
166 netbsd/resolv/__res_send.c \
167 netbsd/resolv/herror.c \
168 netbsd/resolv/res_comp.c \
169 netbsd/resolv/res_data.c \
170 netbsd/resolv/res_debug.c \
171 netbsd/resolv/res_init.c \
172 netbsd/resolv/res_mkquery.c \
173 netbsd/resolv/res_query.c \
174 netbsd/resolv/res_send.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900175 netbsd/resolv/res_state.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800176 netbsd/resolv/res_cache.c \
177 netbsd/net/nsdispatch.c \
178 netbsd/net/getaddrinfo.c \
179 netbsd/net/getnameinfo.c \
180 netbsd/net/getservbyname.c \
181 netbsd/net/getservent.c \
182 netbsd/net/base64.c \
183 netbsd/net/getservbyport.c \
184 netbsd/nameser/ns_name.c \
185 netbsd/nameser/ns_parse.c \
186 netbsd/nameser/ns_ttl.c \
187 netbsd/nameser/ns_netint.c \
188 netbsd/nameser/ns_print.c \
Colin Cross4fa7b102010-01-12 18:59:25 -0800189 netbsd/nameser/ns_samedomain.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800190
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700191libc_bionic_src_files := \
Elliott Hughes61e699a2013-06-12 14:05:46 -0700192 bionic/abort.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700193 bionic/assert.cpp \
Elliott Hughes428f5562013-02-05 16:10:59 -0800194 bionic/brk.cpp \
David 'Digit' Turnerc30396f2012-10-29 15:32:54 +0100195 bionic/dirent.cpp \
Elliott Hughes91a99252013-02-12 21:56:42 -0800196 bionic/__errno.c \
Kito Cheng8baa9292013-04-03 11:29:40 +0800197 bionic/eventfd_read.cpp \
198 bionic/eventfd_write.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700199 bionic/__fgets_chk.cpp \
Nick Kralevich2c5153b2013-01-11 14:43:05 -0800200 bionic/getauxval.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700201 bionic/getcwd.cpp \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800202 bionic/libc_init_common.cpp \
Elliott Hughes8f2a5a02013-03-15 15:30:25 -0700203 bionic/libc_logging.cpp \
Elliott Hughes58b57542012-10-29 14:27:10 -0700204 bionic/libgen.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700205 bionic/__memcpy_chk.cpp \
206 bionic/__memmove_chk.cpp \
207 bionic/__memset_chk.cpp \
Elliott Hughes3e898472013-02-12 16:40:24 +0000208 bionic/pthread_attr.cpp \
Elliott Hughes9d23e042013-02-15 19:21:51 -0800209 bionic/pthread_detach.cpp \
210 bionic/pthread_equal.cpp \
211 bionic/pthread_getcpuclockid.cpp \
212 bionic/pthread_getschedparam.cpp \
213 bionic/pthread_internals.cpp \
214 bionic/pthread_join.cpp \
215 bionic/pthread_kill.cpp \
216 bionic/pthread_self.cpp \
Elliott Hughes3e898472013-02-12 16:40:24 +0000217 bionic/pthread_setname_np.cpp \
Elliott Hughes9d23e042013-02-15 19:21:51 -0800218 bionic/pthread_setschedparam.cpp \
Elliott Hughesc5d028f2013-01-10 14:42:14 -0800219 bionic/pthread_sigmask.cpp \
Chris Dearmand8a5a6f2012-12-07 18:41:10 -0800220 bionic/raise.cpp \
Elliott Hughes428f5562013-02-05 16:10:59 -0800221 bionic/sbrk.cpp \
Elliott Hughes701bec22013-02-25 13:14:31 -0800222 bionic/scandir.cpp \
Kito Cheng4ca685e2013-04-10 00:57:42 +0800223 bionic/sched_getaffinity.cpp \
Elliott Hughes4a9e8372012-11-30 11:58:57 -0800224 bionic/__set_errno.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700225 bionic/setlocale.cpp \
Rom Lemarchanda4b2dc02013-01-09 15:46:06 -0800226 bionic/signalfd.cpp \
Elliott Hughesc5d028f2013-01-10 14:42:14 -0800227 bionic/sigwait.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700228 bionic/__strcat_chk.cpp \
Liubov Dmitrieva0a490662012-01-17 12:55:46 +0400229 bionic/__strchr_chk.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700230 bionic/__strcpy_chk.cpp \
231 bionic/strerror.cpp \
232 bionic/strerror_r.cpp \
233 bionic/__strlcat_chk.cpp \
234 bionic/__strlcpy_chk.cpp \
235 bionic/__strlen_chk.cpp \
236 bionic/__strncat_chk.cpp \
237 bionic/__strncpy_chk.cpp \
238 bionic/strsignal.cpp \
239 bionic/stubs.cpp \
Elliott Hughes91a99252013-02-12 21:56:42 -0800240 bionic/sysconf.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700241 bionic/tdestroy.cpp \
242 bionic/tmpfile.cpp \
243 bionic/__umask_chk.cpp \
244 bionic/__vsnprintf_chk.cpp \
245 bionic/__vsprintf_chk.cpp \
Elliott Hughes17a8b0d2013-03-21 15:43:53 -0700246 bionic/wait.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700247 bionic/wchar.cpp \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700248
Elliott Hughesf0777842013-03-01 16:59:46 -0800249libc_upstream_freebsd_src_files := \
Elliott Hughes6b05c8e2013-04-11 13:54:48 -0700250 upstream-freebsd/lib/libc/stdio/clrerr.c \
251 upstream-freebsd/lib/libc/stdio/fclose.c \
252 upstream-freebsd/lib/libc/stdio/fdopen.c \
253 upstream-freebsd/lib/libc/stdio/feof.c \
254 upstream-freebsd/lib/libc/stdio/ferror.c \
255 upstream-freebsd/lib/libc/stdio/fgetln.c \
256 upstream-freebsd/lib/libc/stdio/fgetpos.c \
257 upstream-freebsd/lib/libc/stdio/fgets.c \
258 upstream-freebsd/lib/libc/stdio/fileno.c \
259 upstream-freebsd/lib/libc/stdio/flags.c \
260 upstream-freebsd/lib/libc/stdio/fopen.c \
261 upstream-freebsd/lib/libc/stdio/fpurge.c \
262 upstream-freebsd/lib/libc/stdio/fputs.c \
263 upstream-freebsd/lib/libc/stdio/fsetpos.c \
264 upstream-freebsd/lib/libc/stdio/funopen.c \
265 upstream-freebsd/lib/libc/stdio/fwalk.c \
266 upstream-freebsd/lib/libc/stdio/fwrite.c \
267 upstream-freebsd/lib/libc/stdio/getc.c \
268 upstream-freebsd/lib/libc/stdio/getchar.c \
Elliott Hughes677ee562013-06-12 15:24:15 -0700269 upstream-freebsd/lib/libc/stdio/makebuf.c \
Elliott Hughes6b05c8e2013-04-11 13:54:48 -0700270 upstream-freebsd/lib/libc/stdio/putc.c \
271 upstream-freebsd/lib/libc/stdio/putchar.c \
272 upstream-freebsd/lib/libc/stdio/puts.c \
273 upstream-freebsd/lib/libc/stdio/putw.c \
274 upstream-freebsd/lib/libc/stdio/remove.c \
275 upstream-freebsd/lib/libc/stdio/rget.c \
276 upstream-freebsd/lib/libc/stdio/setbuf.c \
277 upstream-freebsd/lib/libc/stdio/setbuffer.c \
Elliott Hughes677ee562013-06-12 15:24:15 -0700278 upstream-freebsd/lib/libc/stdio/setvbuf.c \
Elliott Hughes6b05c8e2013-04-11 13:54:48 -0700279 upstream-freebsd/lib/libc/stdio/tempnam.c \
280 upstream-freebsd/lib/libc/stdio/tmpnam.c \
281 upstream-freebsd/lib/libc/stdio/wsetup.c \
Elliott Hughes0b25f632013-04-11 18:08:34 -0700282 upstream-freebsd/lib/libc/stdlib/qsort.c \
Elliott Hughesf0777842013-03-01 16:59:46 -0800283 upstream-freebsd/lib/libc/stdlib/realpath.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800284 upstream-freebsd/lib/libc/string/wcpcpy.c \
285 upstream-freebsd/lib/libc/string/wcpncpy.c \
286 upstream-freebsd/lib/libc/string/wcscasecmp.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800287 upstream-freebsd/lib/libc/string/wcscspn.c \
288 upstream-freebsd/lib/libc/string/wcsdup.c \
289 upstream-freebsd/lib/libc/string/wcslcat.c \
290 upstream-freebsd/lib/libc/string/wcslcpy.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800291 upstream-freebsd/lib/libc/string/wcsncasecmp.c \
292 upstream-freebsd/lib/libc/string/wcsncat.c \
293 upstream-freebsd/lib/libc/string/wcsncmp.c \
294 upstream-freebsd/lib/libc/string/wcsncpy.c \
295 upstream-freebsd/lib/libc/string/wcsnlen.c \
296 upstream-freebsd/lib/libc/string/wcspbrk.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800297 upstream-freebsd/lib/libc/string/wcsspn.c \
298 upstream-freebsd/lib/libc/string/wcsstr.c \
299 upstream-freebsd/lib/libc/string/wcstok.c \
300 upstream-freebsd/lib/libc/string/wmemchr.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800301 upstream-freebsd/lib/libc/string/wmemcpy.c \
302 upstream-freebsd/lib/libc/string/wmemmove.c \
303 upstream-freebsd/lib/libc/string/wmemset.c \
Elliott Hughesf0777842013-03-01 16:59:46 -0800304
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700305libc_upstream_netbsd_src_files := \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700306 upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
307 upstream-netbsd/common/lib/libc/inet/inet_addr.c \
308 upstream-netbsd/libc/compat-43/creat.c \
309 upstream-netbsd/libc/gen/ftw.c \
310 upstream-netbsd/libc/gen/nftw.c \
311 upstream-netbsd/libc/gen/nice.c \
Elliott Hughes6b3f49a2013-03-06 16:20:55 -0800312 upstream-netbsd/libc/gen/popen.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700313 upstream-netbsd/libc/gen/psignal.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700314 upstream-netbsd/libc/gen/setjmperr.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700315 upstream-netbsd/libc/gen/utime.c \
316 upstream-netbsd/libc/inet/inet_ntoa.c \
317 upstream-netbsd/libc/inet/inet_ntop.c \
318 upstream-netbsd/libc/inet/inet_pton.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700319 upstream-netbsd/libc/isc/ev_streams.c \
320 upstream-netbsd/libc/isc/ev_timers.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700321 upstream-netbsd/libc/regex/regcomp.c \
322 upstream-netbsd/libc/regex/regerror.c \
323 upstream-netbsd/libc/regex/regexec.c \
324 upstream-netbsd/libc/regex/regfree.c \
325 upstream-netbsd/libc/stdio/getdelim.c \
326 upstream-netbsd/libc/stdio/getline.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700327 upstream-netbsd/libc/stdlib/bsearch.c \
328 upstream-netbsd/libc/stdlib/div.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700329 upstream-netbsd/libc/stdlib/drand48.c \
330 upstream-netbsd/libc/stdlib/erand48.c \
331 upstream-netbsd/libc/stdlib/jrand48.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700332 upstream-netbsd/libc/stdlib/ldiv.c \
333 upstream-netbsd/libc/stdlib/lldiv.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700334 upstream-netbsd/libc/stdlib/lrand48.c \
335 upstream-netbsd/libc/stdlib/mrand48.c \
336 upstream-netbsd/libc/stdlib/nrand48.c \
337 upstream-netbsd/libc/stdlib/_rand48.c \
338 upstream-netbsd/libc/stdlib/seed48.c \
339 upstream-netbsd/libc/stdlib/srand48.c \
340 upstream-netbsd/libc/stdlib/tdelete.c \
341 upstream-netbsd/libc/stdlib/tfind.c \
342 upstream-netbsd/libc/stdlib/tsearch.c \
Elliott Hughesc51cd762013-01-22 14:41:23 -0800343 upstream-netbsd/libc/string/memccpy.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700344 upstream-netbsd/libc/string/strcasestr.c \
Elliott Hughes2b473072013-01-22 15:10:19 -0800345 upstream-netbsd/libc/string/strcoll.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700346 upstream-netbsd/libc/string/strxfrm.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700347 upstream-netbsd/libc/unistd/killpg.c \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700348
Dima Zavinca122b02009-05-27 10:52:37 -0700349# Architecture specific source files go here
350# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800351ifeq ($(TARGET_ARCH),arm)
352libc_common_src_files += \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700353 bionic/memmove.c.arm \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800354 string/bcopy.c \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800355 string/strncmp.c \
Liubov Dmitrieva0a490662012-01-17 12:55:46 +0400356 string/strcat.c \
357 string/strncat.c \
358 string/strncpy.c \
359 bionic/strchr.cpp \
360 string/strrchr.c \
361 bionic/memchr.c \
362 bionic/memrchr.c \
363 string/index.c \
364 bionic/strnlen.c \
365 string/strlcat.c \
366 string/strlcpy.c \
367 upstream-freebsd/lib/libc/string/wcschr.c \
368 upstream-freebsd/lib/libc/string/wcsrchr.c \
369 upstream-freebsd/lib/libc/string/wcscmp.c \
370 upstream-freebsd/lib/libc/string/wcscpy.c \
371 upstream-freebsd/lib/libc/string/wmemcmp.c \
372 upstream-freebsd/lib/libc/string/wcslen.c \
373 upstream-freebsd/lib/libc/string/wcscat.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800374
375# These files need to be arm so that gdbserver
376# can set breakpoints in them without messing
377# up any thumb code.
378libc_common_src_files += \
Matt Fischer4f086ae2010-06-25 14:36:39 -0500379 bionic/pthread-atfork.c.arm \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700380 bionic/pthread-rwlocks.c.arm \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800381 bionic/pthread-timers.c.arm \
382 bionic/ptrace.c.arm
Dima Zavinca122b02009-05-27 10:52:37 -0700383
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700384libc_static_common_src_files += \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000385 bionic/pthread.c.arm \
Elliott Hughes4b4a8822013-02-12 17:15:59 -0800386 bionic/pthread_create.cpp.arm \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000387 bionic/pthread_key.cpp.arm \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700388
Raghu Gandhama4c79332012-08-07 12:23:24 -0700389endif # arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800390
391ifeq ($(TARGET_ARCH),x86)
392libc_common_src_files += \
Elliott Hughesd2547042013-02-13 16:31:52 -0800393 bionic/pthread-atfork.c \
394 bionic/pthread-rwlocks.c \
395 bionic/pthread-timers.c \
396 bionic/ptrace.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800397
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700398libc_static_common_src_files += \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000399 bionic/pthread.c \
Elliott Hughes4b4a8822013-02-12 17:15:59 -0800400 bionic/pthread_create.cpp \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000401 bionic/pthread_key.cpp \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700402
Raghu Gandhama4c79332012-08-07 12:23:24 -0700403endif # x86
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900404
Raghu Gandhama4c79332012-08-07 12:23:24 -0700405ifeq ($(TARGET_ARCH),mips)
406libc_common_src_files += \
Elliott Hughes857fed52012-10-02 11:20:07 -0700407 bionic/memcmp.c \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700408 string/bcopy.c \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700409 string/strcmp.c \
410 string/strcpy.c \
Liubov Dmitrieva0a490662012-01-17 12:55:46 +0400411 string/strncmp.c \
412 string/strcat.c \
413 string/strncat.c \
414 string/strncpy.c \
415 bionic/strchr.cpp \
416 string/strrchr.c \
417 bionic/memchr.c \
418 bionic/memrchr.c \
419 string/index.c \
420 bionic/strnlen.c \
421 string/strlcat.c \
422 string/strlcpy.c \
423 upstream-freebsd/lib/libc/string/wcschr.c \
424 upstream-freebsd/lib/libc/string/wcsrchr.c \
425 upstream-freebsd/lib/libc/string/wcscmp.c \
426 upstream-freebsd/lib/libc/string/wcscpy.c \
427 upstream-freebsd/lib/libc/string/wmemcmp.c \
428 upstream-freebsd/lib/libc/string/wcslen.c \
429 upstream-freebsd/lib/libc/string/wcscat.c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700430
431libc_common_src_files += \
432 bionic/pthread-atfork.c \
433 bionic/pthread-rwlocks.c \
434 bionic/pthread-timers.c \
435 bionic/ptrace.c
436
437libc_static_common_src_files += \
Elliott Hughesba342c12013-02-11 18:06:23 -0800438 bionic/pthread.c \
Elliott Hughes4b4a8822013-02-12 17:15:59 -0800439 bionic/pthread_create.cpp \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000440 bionic/pthread_key.cpp \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700441
Raghu Gandhama4c79332012-08-07 12:23:24 -0700442endif # mips
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800443
Christopher Ferris04954a42013-02-26 01:30:00 -0800444ifeq ($(strip $(TARGET_CPU_VARIANT)),)
445$(warning TARGET_CPU_VARIANT is not defined)
446endif
447
448###########################################################
449## Add cpu specific source files.
450##
451## This can be called multiple times, but it will only add
452## the first source file for each unique $(1).
453## $(1): Unique identifier to identify the cpu variant
454## implementation.
455## $(2): Cpu specific source file.
456###########################################################
457
458define libc-add-cpu-variant-src
459$(if $(filter true,$(_LIBC_ARCH_CPU_VARIANT_HAS_$(1))), \
460 , \
461 $(eval _LIBC_ARCH_CPU_VARIANT_HAS_$(1) := true) \
462 $(eval _LIBC_ARCH_CPU_VARIANT_SRC_FILE.$(1) := $(2)) \
463 $(eval _LIBC_ARCH_CPU_VARIANT_SRC_FILES += $(2)) \
464)
465endef
466
467_LIBC_ARCH_COMMON_SRC_FILES :=
468_LIBC_ARCH_CPU_VARIANT_SRC_FILES :=
469_LIBC_ARCH_STATIC_SRC_FILES :=
470_LIBC_ARCH_DYNAMIC_SRC_FILES :=
471include bionic/libc/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
472
473libc_common_src_files += $(_LIBC_ARCH_COMMON_SRC_FILES)
474libc_common_src_files += $(_LIBC_ARCH_CPU_VARIANT_SRC_FILES)
475libc_arch_static_src_files := $(_LIBC_ARCH_STATIC_SRC_FILES)
476libc_arch_dynamic_src_files := $(_LIBC_ARCH_DYNAMIC_SRC_FILES)
477
Dima Zavinca122b02009-05-27 10:52:37 -0700478# Define some common cflags
479# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800480libc_common_cflags := \
Elliott Hughes470631e2012-06-06 10:32:56 -0700481 -DWITH_ERRLIST \
482 -DANDROID_CHANGES \
Elliott Hughes470631e2012-06-06 10:32:56 -0700483 -D_LIBC=1 \
Elliott Hughes470631e2012-06-06 10:32:56 -0700484 -DFLOATING_POINT \
485 -DINET6 \
486 -I$(LOCAL_PATH)/private \
Elliott Hughes470631e2012-06-06 10:32:56 -0700487 -DPOSIX_MISTAKE \
488 -DLOG_ON_HEAP_ERROR \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700489 -Wall -Wextra
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800490
David 'Digit' Turnerd7ed1ae2010-03-05 14:17:35 -0800491# these macro definitions are required to implement the
492# 'timezone' and 'daylight' global variables, as well as
493# properly update the 'tm_gmtoff' field in 'struct tm'.
494#
495libc_common_cflags += \
496 -DTM_GMTOFF=tm_gmtoff \
497 -DUSG_COMPAT=1
498
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700499ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800500 libc_common_cflags += -DDEBUG
501endif
502
Jack Ren2fd81ef2011-11-19 09:48:03 +0800503# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
504# the appropriate BoardConfig.mk file.
505#
506ifneq ($(BOARD_MALLOC_ALIGNMENT),)
507 libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
508endif
509
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800510ifeq ($(TARGET_ARCH),arm)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700511 libc_common_cflags += -DSOFTFLOAT
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800512 libc_common_cflags += -fstrict-aliasing
Dima Zavinca122b02009-05-27 10:52:37 -0700513 libc_crt_target_cflags := -mthumb-interwork
Dima Zavinca122b02009-05-27 10:52:37 -0700514endif # !arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800515
Raghu Gandhama4c79332012-08-07 12:23:24 -0700516ifeq ($(TARGET_ARCH),x86)
517 libc_common_cflags += -DSOFTFLOAT
518 libc_crt_target_cflags :=
519 ifeq ($(ARCH_X86_HAVE_SSE2),true)
520 libc_crt_target_cflags += -DUSE_SSE2=1
521 endif
522 ifeq ($(ARCH_X86_HAVE_SSSE3),true)
523 libc_crt_target_cflags += -DUSE_SSSE3=1
524 endif
525endif # x86
526
527ifeq ($(TARGET_ARCH),mips)
528 ifneq ($(ARCH_MIPS_HAS_FPU),true)
529 libc_common_cflags += -DSOFTFLOAT
530 endif
531 libc_common_cflags += -fstrict-aliasing
532 libc_crt_target_cflags := $(TARGET_GLOBAL_CFLAGS)
533endif # mips
534
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700535# Define ANDROID_SMP appropriately.
536ifeq ($(TARGET_CPU_SMP),true)
537 libc_common_cflags += -DANDROID_SMP=1
538else
539 libc_common_cflags += -DANDROID_SMP=0
540endif
541
Elliott Hughes76be6602012-08-08 14:07:37 -0700542# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
543libc_crt_target_cflags += \
544 -I$(LOCAL_PATH)/include \
545 -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700546
Dima Zavinca122b02009-05-27 10:52:37 -0700547# Define some common includes
548# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800549libc_common_c_includes := \
550 $(LOCAL_PATH)/stdlib \
551 $(LOCAL_PATH)/string \
Nick Kralevich76656af2012-06-07 16:30:02 -0700552 $(LOCAL_PATH)/stdio \
553 external/safe-iop/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800554
Nick Kralevich9d403262012-05-31 11:40:10 -0700555# Needed to access private/__dso_handle.h from
David 'Digit' Turner3b43f872010-07-01 23:09:28 -0700556# crtbegin_xxx.S and crtend_xxx.S
Elliott Hughes76be6602012-08-08 14:07:37 -0700557libc_crt_target_cflags += \
558 -I$(LOCAL_PATH)/private \
559 -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800560
Dima Zavinca122b02009-05-27 10:52:37 -0700561# Define the libc run-time (crt) support object files that must be built,
562# which are needed to build all other objects (shared/static libs and
563# executables)
564# ==========================================================================
Raghu Gandhama4c79332012-08-07 12:23:24 -0700565# ARM, MIPS, and x86 all need crtbegin_so/crtend_so.
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700566#
567# For x86, the .init section must point to a function that calls all
568# entries in the .ctors section. (on ARM this is done through the
569# .init_array section instead).
570#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700571# For all the platforms, the .fini_array section must point to a function
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700572# that will call __cxa_finalize(&__dso_handle) in order to ensure that
573# static C++ destructors are properly called on dlclose().
574#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700575ifeq ($(TARGET_ARCH),arm)
Elliott Hughes12949e52012-09-10 11:16:12 -0700576 libc_crtbegin_extension := c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700577 libc_crt_target_so_cflags :=
David 'Digit' Turner2d2dbd32011-06-25 17:26:38 +0200578endif
Raghu Gandhama4c79332012-08-07 12:23:24 -0700579ifeq ($(TARGET_ARCH),mips)
Elliott Hughes12949e52012-09-10 11:16:12 -0700580 libc_crtbegin_extension := S
Raghu Gandhama4c79332012-08-07 12:23:24 -0700581 libc_crt_target_so_cflags := -fPIC
582endif
583ifeq ($(TARGET_ARCH),x86)
Pavel Chupin20c4a3a2012-11-28 18:31:14 +0400584 libc_crtbegin_extension := c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700585 libc_crt_target_so_cflags := -fPIC
586endif
Elliott Hughes12949e52012-09-10 11:16:12 -0700587ifeq ($(libc_crtbegin_extension),)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700588 $(error $(TARGET_ARCH) not supported)
589endif
590libc_crt_target_so_cflags += $(libc_crt_target_cflags)
Elliott Hughes12949e52012-09-10 11:16:12 -0700591libc_crt_target_crtbegin_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.$(libc_crtbegin_extension)
592libc_crt_target_crtbegin_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.$(libc_crtbegin_extension)
Michael Hopeea8fad12012-07-31 16:18:22 +1200593
594# See the comment in crtbrand.c for the reason why we need to generate
595# crtbrand.s before generating crtbrand.o.
596GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
597$(GEN): $(LOCAL_PATH)/bionic/crtbrand.c
598 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700599 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) -S \
600 -MD -MF $(@:%.s=%.d) -o $@ $<
601 $(hide) sed -i -e '/\.note\.ABI-tag/s/progbits/note/' $@
602 $(call transform-d-to-p-args,$(@:%.s=%.d),$(@:%.s=%.P))
603-include $(GEN:%.s=%.P)
Michael Hopeea8fad12012-07-31 16:18:22 +1200604ALL_GENERATED_SOURCES += $(GEN)
605
606GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
607$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
608 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700609 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
Michael Hopeea8fad12012-07-31 16:18:22 +1200610ALL_GENERATED_SOURCES += $(GEN)
611
Ying Wangfc9e5252012-05-15 15:15:11 -0700612GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700613$(GEN): $(libc_crt_target_crtbegin_so_file)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800614 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700615 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) \
616 -MD -MF $(@:%.o=%.d) -o $@ -c $<
617 $(transform-d-to-p)
618-include $(GEN:%.o=%.P)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800619ALL_GENERATED_SOURCES += $(GEN)
620
Ying Wangfc9e5252012-05-15 15:15:11 -0700621GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800622$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
623 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700624 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) \
625 -MD -MF $(@:%.o=%.d) -o $@ -c $<
626 $(transform-d-to-p)
627-include $(GEN:%.o=%.P)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800628ALL_GENERATED_SOURCES += $(GEN)
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700629
Ying Wangcf464872012-09-07 17:06:56 -0700630# The following two are installed to device
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700631GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtbegin_so.o
Ying Wangcf464872012-09-07 17:06:56 -0700632$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
633 $(hide) mkdir -p $(dir $@) && cp -f $< $@
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700634ALL_GENERATED_SOURCES += $(GEN)
635
636GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtend_so.o
Ying Wangcf464872012-09-07 17:06:56 -0700637$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
638 $(hide) mkdir -p $(dir $@) && cp -f $< $@
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700639ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800640
Dima Zavinca122b02009-05-27 10:52:37 -0700641
Michael Hopeea8fad12012-07-31 16:18:22 +1200642GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700643$(GEN): $(libc_crt_target_crtbegin_file)
Michael Hopeea8fad12012-07-31 16:18:22 +1200644 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700645 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
646 -MD -MF $(@:%.o=%.d) -o $@ -c $<
647 $(transform-d-to-p)
648-include $(GEN:%.o=%.P)
Michael Hopeea8fad12012-07-31 16:18:22 +1200649ALL_GENERATED_SOURCES += $(GEN)
650
Ying Wangfc9e5252012-05-15 15:15:11 -0700651GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200652$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
653 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700654 $(hide) $(TARGET_LD) -r -o $@ $^
Michael Hopeea8fad12012-07-31 16:18:22 +1200655ALL_GENERATED_SOURCES += $(GEN)
656
657GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700658$(GEN): $(libc_crt_target_crtbegin_file)
Dima Zavinca122b02009-05-27 10:52:37 -0700659 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700660 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
661 -MD -MF $(@:%.o=%.d) -o $@ -c $<
662 $(transform-d-to-p)
663-include $(GEN:%.o=%.P)
Dima Zavinca122b02009-05-27 10:52:37 -0700664ALL_GENERATED_SOURCES += $(GEN)
665
Ying Wangfc9e5252012-05-15 15:15:11 -0700666GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200667$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
Dima Zavinca122b02009-05-27 10:52:37 -0700668 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700669 $(hide) $(TARGET_LD) -r -o $@ $^
Dima Zavinca122b02009-05-27 10:52:37 -0700670ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800671
Dima Zavinca122b02009-05-27 10:52:37 -0700672# We rename crtend.o to crtend_android.o to avoid a
673# name clash between gcc and bionic.
Ying Wangfc9e5252012-05-15 15:15:11 -0700674GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
Dima Zavinca122b02009-05-27 10:52:37 -0700675$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
676 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700677 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
678 -MD -MF $(@:%.o=%.d) -o $@ -c $<
679 $(transform-d-to-p)
680-include $(GEN:%.o=%.P)
Dima Zavinca122b02009-05-27 10:52:37 -0700681ALL_GENERATED_SOURCES += $(GEN)
682
683
684# To enable malloc leak check for statically linked programs, add
685# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
686WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
687
688# ========================================================
Nick Kralevich6334c662012-07-10 10:46:19 -0700689# libbionic_ssp.a - stack protector code
690# ========================================================
691#
692# The stack protector code needs to be compiled
693# with -fno-stack-protector, since it modifies the
694# stack canary.
695
696include $(CLEAR_VARS)
697
Elliott Hughes642331b2013-03-06 15:03:53 -0800698LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
Elliott Hughesdc5ec072013-02-14 11:15:58 -0800699LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector -Werror
Nick Kralevich6334c662012-07-10 10:46:19 -0700700LOCAL_C_INCLUDES := $(libc_common_c_includes)
701LOCAL_MODULE := libbionic_ssp
Elliott Hughesae5c6442012-08-13 14:06:05 -0700702LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Nick Kralevich6334c662012-07-10 10:46:19 -0700703LOCAL_SYSTEM_SHARED_LIBRARIES :=
704
705include $(BUILD_STATIC_LIBRARY)
706
707
708# ========================================================
Elliott Hughesf0777842013-03-01 16:59:46 -0800709# libc_freebsd.a - upstream FreeBSD C library code
710# ========================================================
711#
712# These files are built with the freebsd-compat.h header file
713# automatically included.
714
715include $(CLEAR_VARS)
716
717LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files)
718LOCAL_CFLAGS := \
719 $(libc_common_cflags) \
720 -I$(LOCAL_PATH)/upstream-freebsd \
721 -I$(LOCAL_PATH)/upstream-freebsd/libc/include \
722 -include upstream-freebsd/freebsd-compat.h
723LOCAL_C_INCLUDES := $(libc_common_c_includes)
724LOCAL_MODULE := libc_freebsd
725LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
726LOCAL_SYSTEM_SHARED_LIBRARIES :=
727
728include $(BUILD_STATIC_LIBRARY)
729
730
731# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700732# libc_netbsd.a - upstream NetBSD C library code
733# ========================================================
734#
735# These files are built with the netbsd-compat.h header file
736# automatically included.
737
738include $(CLEAR_VARS)
739
740LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
741LOCAL_CFLAGS := \
742 $(libc_common_cflags) \
Elliott Hughes3d2d4482012-08-13 16:38:29 -0700743 -I$(LOCAL_PATH)/upstream-netbsd \
Elliott Hughesab44f522012-10-23 16:05:09 -0700744 -I$(LOCAL_PATH)/upstream-netbsd/libc/include \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700745 -include upstream-netbsd/netbsd-compat.h
746LOCAL_C_INCLUDES := $(libc_common_c_includes)
747LOCAL_MODULE := libc_netbsd
Elliott Hughesae5c6442012-08-13 14:06:05 -0700748LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700749LOCAL_SYSTEM_SHARED_LIBRARIES :=
750
751include $(BUILD_STATIC_LIBRARY)
752
753
754# ========================================================
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700755# libc_bionic.a - home-grown C library code
756# ========================================================
757#
758include $(CLEAR_VARS)
759
760LOCAL_SRC_FILES := $(libc_bionic_src_files)
761LOCAL_CFLAGS := $(libc_common_cflags) -Werror
762LOCAL_C_INCLUDES := $(libc_common_c_includes)
763LOCAL_MODULE := libc_bionic
764LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
765LOCAL_SYSTEM_SHARED_LIBRARIES :=
766
767include $(BUILD_STATIC_LIBRARY)
768
769
770# ========================================================
Dima Zavinca122b02009-05-27 10:52:37 -0700771# libc_common.a
772# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700773
Dima Zavinca122b02009-05-27 10:52:37 -0700774include $(CLEAR_VARS)
775
776LOCAL_SRC_FILES := $(libc_common_src_files)
Elliott Hughesab44f522012-10-23 16:05:09 -0700777LOCAL_CFLAGS := $(libc_common_cflags) \
778 -std=gnu99 \
779 -I$(LOCAL_PATH)/upstream-netbsd/libc/include # for netbsd private headers
Dima Zavinca122b02009-05-27 10:52:37 -0700780LOCAL_C_INCLUDES := $(libc_common_c_includes)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800781LOCAL_MODULE := libc_common
Elliott Hughesae5c6442012-08-13 14:06:05 -0700782LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughesf0777842013-03-01 16:59:46 -0800783LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp libc_bionic libc_freebsd libc_netbsd
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800784LOCAL_SYSTEM_SHARED_LIBRARIES :=
785
786include $(BUILD_STATIC_LIBRARY)
787
788
Dima Zavinca122b02009-05-27 10:52:37 -0700789# ========================================================
Dima Zavin49e55332009-05-27 10:52:37 -0700790# libc_nomalloc.a
791# ========================================================
792#
793# This is a version of the static C library that does not
Elliott Hughes91a99252013-02-12 21:56:42 -0800794# include malloc. It's useful in situations when the user wants
795# to provide their own malloc implementation, or wants to
796# explicitly disallow the use of the use of malloc,
797# such as in the dynamic loader.
Dima Zavin49e55332009-05-27 10:52:37 -0700798
799include $(CLEAR_VARS)
800
801LOCAL_SRC_FILES := \
802 $(libc_arch_static_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700803 $(libc_static_common_src_files) \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800804 bionic/libc_init_static.cpp
Dima Zavin49e55332009-05-27 10:52:37 -0700805
806LOCAL_C_INCLUDES := $(libc_common_c_includes)
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700807LOCAL_CFLAGS := $(libc_common_cflags) \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700808 -DLIBC_STATIC \
809 -std=gnu99
Dima Zavin49e55332009-05-27 10:52:37 -0700810
811LOCAL_MODULE := libc_nomalloc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700812LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dima Zavin49e55332009-05-27 10:52:37 -0700813LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
814LOCAL_SYSTEM_SHARED_LIBRARIES :=
815
816include $(BUILD_STATIC_LIBRARY)
817
818
819# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800820# libc.a
821# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800822include $(CLEAR_VARS)
823
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800824LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700825 $(libc_arch_static_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700826 $(libc_static_common_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800827 bionic/dlmalloc.c \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700828 bionic/malloc_debug_common.cpp \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800829 bionic/libc_init_static.cpp
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800830
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800831LOCAL_CFLAGS := $(libc_common_cflags) \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700832 -DLIBC_STATIC \
833 -std=gnu99
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800834LOCAL_C_INCLUDES := $(libc_common_c_includes)
Dima Zavinca122b02009-05-27 10:52:37 -0700835LOCAL_MODULE := libc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700836LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800837LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800838LOCAL_SYSTEM_SHARED_LIBRARIES :=
839
840include $(BUILD_STATIC_LIBRARY)
841
842
Dima Zavinca122b02009-05-27 10:52:37 -0700843# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800844# libc.so
845# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800846include $(CLEAR_VARS)
847
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700848# pthread deadlock prediction:
849# set -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=1 to enable support for
850# pthread deadlock prediction.
851# Since this code is experimental it is disabled by default.
852# see libc/bionic/pthread_debug.c for details
853
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700854LOCAL_CFLAGS := $(libc_common_cflags) -std=gnu99 -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=0
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800855LOCAL_C_INCLUDES := $(libc_common_c_includes)
856
857LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700858 $(libc_arch_dynamic_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700859 $(libc_static_common_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800860 bionic/dlmalloc.c \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700861 bionic/malloc_debug_common.cpp \
Elliott Hughes1e980b62013-01-17 18:36:06 -0800862 bionic/pthread_debug.cpp \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800863 bionic/libc_init_dynamic.cpp
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800864
Ard Biesheuvelf3cfcd82012-08-21 14:13:50 +0200865ifeq ($(TARGET_ARCH),arm)
866 LOCAL_NO_CRT := true
867 LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
868
869 LOCAL_SRC_FILES := \
870 arch-arm/bionic/crtbegin_so.c \
871 arch-arm/bionic/atexit_legacy.c \
872 $(LOCAL_SRC_FILES) \
873 arch-arm/bionic/crtend_so.S
874endif
875
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800876LOCAL_MODULE:= libc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700877LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughes914d8d42012-10-18 11:28:56 -0700878LOCAL_REQUIRED_MODULES := tzdata
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800879
880# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
881# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
882# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
883# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
884# should, instead relying on the external symbols from the dependent libraries. That would
885# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
886# you wanted!
887
888LOCAL_SHARED_LIBRARIES := libdl
889LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
890LOCAL_SYSTEM_SHARED_LIBRARIES :=
891
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800892include $(BUILD_SHARED_LIBRARY)
893
894
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800895# For all builds, except for the -user build we will enable memory
896# allocation checking (including memory leaks, buffer overwrites, etc.)
897# Note that all these checks are also controlled by env. settings
898# that can enable, or disable specific checks. Note also that some of
899# the checks are available only in emulator and are implemeted in
900# libc_malloc_qemu_instrumented.so.
901ifneq ($(TARGET_BUILD_VARIANT),user)
902
Dima Zavinca122b02009-05-27 10:52:37 -0700903# ========================================================
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800904# libc_malloc_debug_leak.so
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800905# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800906include $(CLEAR_VARS)
907
Dima Zavinca122b02009-05-27 10:52:37 -0700908LOCAL_CFLAGS := \
909 $(libc_common_cflags) \
910 -DMALLOC_LEAK_CHECK
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800911
912LOCAL_C_INCLUDES := $(libc_common_c_includes)
913
914LOCAL_SRC_FILES := \
Elliott Hughes1e980b62013-01-17 18:36:06 -0800915 bionic/debug_mapinfo.cpp \
916 bionic/debug_stacktrace.cpp \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700917 bionic/malloc_debug_leak.cpp \
918 bionic/malloc_debug_check.cpp \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800919
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800920LOCAL_MODULE:= libc_malloc_debug_leak
Elliott Hughesae5c6442012-08-13 14:06:05 -0700921LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800922
Pavel Chupine0077752012-09-10 19:35:25 +0400923LOCAL_SHARED_LIBRARIES := libc libdl
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800924LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
925LOCAL_SYSTEM_SHARED_LIBRARIES :=
Bruce Beareaa46fa22010-07-08 14:47:50 -0700926LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
Iliyan Malchev36807042011-03-14 14:02:05 -0700927
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800928# Don't install on release build
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800929LOCAL_MODULE_TAGS := eng debug
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800930
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800931include $(BUILD_SHARED_LIBRARY)
932
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800933
934# ========================================================
935# libc_malloc_debug_qemu.so
936# ========================================================
937include $(CLEAR_VARS)
938
939LOCAL_CFLAGS := \
940 $(libc_common_cflags) \
941 -DMALLOC_QEMU_INSTRUMENT
942
943LOCAL_C_INCLUDES := $(libc_common_c_includes)
944
945LOCAL_SRC_FILES := \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700946 bionic/malloc_debug_qemu.cpp
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800947
948LOCAL_MODULE:= libc_malloc_debug_qemu
Elliott Hughesae5c6442012-08-13 14:06:05 -0700949LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800950
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700951LOCAL_SHARED_LIBRARIES := libc libdl
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800952LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
953LOCAL_SYSTEM_SHARED_LIBRARIES :=
Iliyan Malchev36807042011-03-14 14:02:05 -0700954
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800955# Don't install on release build
956LOCAL_MODULE_TAGS := eng debug
957
958include $(BUILD_SHARED_LIBRARY)
959
960endif #!user
961
962
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800963# ========================================================
964include $(call all-makefiles-under,$(LOCAL_PATH))