blob: 6ebb9e9293f579d023bef8d8e13657c77b87be06 [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/syslog.c \
13 unistd/system.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080014 unistd/time.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080015 stdio/asprintf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080016 stdio/fflush.c \
17 stdio/fgetc.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080018 stdio/findfp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080019 stdio/fprintf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080020 stdio/fputc.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080021 stdio/fread.c \
22 stdio/freopen.c \
23 stdio/fscanf.c \
24 stdio/fseek.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080025 stdio/ftell.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080026 stdio/fvwrite.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080027 stdio/gets.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080028 stdio/printf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080029 stdio/refill.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080030 stdio/rewind.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080031 stdio/scanf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080032 stdio/snprintf.c\
33 stdio/sprintf.c \
34 stdio/sscanf.c \
35 stdio/stdio.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080036 stdio/ungetc.c \
37 stdio/vasprintf.c \
38 stdio/vfprintf.c \
39 stdio/vfscanf.c \
40 stdio/vprintf.c \
41 stdio/vsnprintf.c \
42 stdio/vsprintf.c \
43 stdio/vscanf.c \
44 stdio/vsscanf.c \
45 stdio/wbuf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080046 stdlib/atexit.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080047 stdlib/ctype_.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080048 stdlib/exit.c \
49 stdlib/getenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080050 stdlib/putenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080051 stdlib/setenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080052 stdlib/strtod.c \
53 stdlib/strtoimax.c \
54 stdlib/strtol.c \
55 stdlib/strtoll.c \
56 stdlib/strtoul.c \
57 stdlib/strtoull.c \
58 stdlib/strtoumax.c \
59 stdlib/tolower_.c \
60 stdlib/toupper_.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080061 string/strcasecmp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080062 string/strcspn.c \
63 string/strdup.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080064 string/strpbrk.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080065 string/strsep.c \
66 string/strspn.c \
67 string/strstr.c \
68 string/strtok.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -070069 wchar/wcswidth.c \
Kristian Monsen70465612010-06-16 14:51:52 +010070 wchar/wcsxfrm.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080071 bionic/arc4random.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070072 bionic/atoi.c \
73 bionic/atol.c \
74 bionic/atoll.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070075 bionic/bindresvport.c \
76 bionic/bionic_clone.c \
Colin Crossfc10b242010-01-13 17:48:34 -080077 bionic/clearenv.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070078 bionic/cpuacct.c \
79 bionic/daemon.c \
Colin Cross64ceac32010-01-13 21:19:52 -080080 bionic/err.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070081 bionic/ether_aton.c \
82 bionic/ether_ntoa.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070083 bionic/fcntl.c \
Colin Crossfc10b242010-01-13 17:48:34 -080084 bionic/fdprintf.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070085 bionic/flockfile.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080086 bionic/fork.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070087 bionic/fstatfs.c \
88 bionic/ftime.c \
89 bionic/ftok.c \
Colin Cross64ceac32010-01-13 21:19:52 -080090 bionic/fts.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070091 bionic/getdtablesize.c \
92 bionic/gethostname.c \
93 bionic/getpgrp.c \
94 bionic/getpriority.c \
95 bionic/getpt.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080096 bionic/if_indextoname.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -070097 bionic/if_nametoindex.c \
98 bionic/initgroups.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080099 bionic/ioctl.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700100 bionic/isatty.c \
101 bionic/issetugid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800102 bionic/ldexp.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700103 bionic/lseek64.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800104 bionic/md5.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700105 bionic/memmem.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700106 bionic/memswap.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700107 bionic/openat.c \
108 bionic/open.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700109 bionic/pathconf.c \
110 bionic/perror.c \
111 bionic/pread.c \
112 bionic/pselect.c \
113 bionic/ptsname.c \
114 bionic/ptsname_r.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800115 bionic/pututline.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700116 bionic/pwrite.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700117 bionic/reboot.c \
118 bionic/recv.c \
David 'Digit' Turner72e6fd42010-12-03 18:04:01 +0100119 bionic/sched_cpualloc.c \
120 bionic/sched_cpucount.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700121 bionic/sched_getcpu.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800122 bionic/semaphore.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700123 bionic/send.c \
124 bionic/setegid.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700125 bionic/seteuid.c \
126 bionic/setpgrp.c \
127 bionic/setresuid.c \
128 bionic/setreuid.c \
129 bionic/setuid.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700130 bionic/sigblock.c \
131 bionic/siginterrupt.c \
132 bionic/siglist.c \
133 bionic/signal.c \
134 bionic/signame.c \
135 bionic/sigsetmask.c \
136 bionic/sigsuspend.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700137 bionic/sleep.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700138 bionic/statfs.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700139 bionic/strndup.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700140 bionic/strntoimax.c \
141 bionic/strntoumax.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700142 bionic/strtotimeval.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800143 bionic/system_properties.c \
Colin Cross5e9a0862013-06-24 18:36:39 -0700144 bionic/system_properties_compat.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700145 bionic/tcgetpgrp.c \
146 bionic/tcsetpgrp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800147 bionic/thread_atexit.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700148 bionic/time64.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700149 bionic/umount.c \
150 bionic/unlockpt.c \
151 bionic/usleep.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800152 bionic/utmp.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700153 bionic/wcscoll.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800154 netbsd/gethnamaddr.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800155 netbsd/inet/nsap_addr.c \
156 netbsd/resolv/__dn_comp.c \
157 netbsd/resolv/__res_close.c \
158 netbsd/resolv/__res_send.c \
159 netbsd/resolv/herror.c \
160 netbsd/resolv/res_comp.c \
161 netbsd/resolv/res_data.c \
162 netbsd/resolv/res_debug.c \
163 netbsd/resolv/res_init.c \
164 netbsd/resolv/res_mkquery.c \
165 netbsd/resolv/res_query.c \
166 netbsd/resolv/res_send.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900167 netbsd/resolv/res_state.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800168 netbsd/resolv/res_cache.c \
169 netbsd/net/nsdispatch.c \
170 netbsd/net/getaddrinfo.c \
171 netbsd/net/getnameinfo.c \
172 netbsd/net/getservbyname.c \
173 netbsd/net/getservent.c \
174 netbsd/net/base64.c \
175 netbsd/net/getservbyport.c \
176 netbsd/nameser/ns_name.c \
177 netbsd/nameser/ns_parse.c \
178 netbsd/nameser/ns_ttl.c \
179 netbsd/nameser/ns_netint.c \
180 netbsd/nameser/ns_print.c \
Colin Cross4fa7b102010-01-12 18:59:25 -0800181 netbsd/nameser/ns_samedomain.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800182
Christopher Ferris7c860db2013-08-01 13:13:33 -0700183# Fortify implementations of libc functions.
184libc_common_src_files += \
185 bionic/__fgets_chk.cpp \
186 bionic/__memcpy_chk.cpp \
187 bionic/__memmove_chk.cpp \
188 bionic/__memset_chk.cpp \
189 bionic/__strcat_chk.cpp \
190 bionic/__strchr_chk.cpp \
191 bionic/__strcpy_chk.cpp \
192 bionic/__strlcat_chk.cpp \
193 bionic/__strlcpy_chk.cpp \
194 bionic/__strlen_chk.cpp \
195 bionic/__strncat_chk.cpp \
196 bionic/__strncpy_chk.cpp \
197 bionic/__strrchr_chk.cpp \
198 bionic/__umask_chk.cpp \
199 bionic/__vsnprintf_chk.cpp \
200 bionic/__vsprintf_chk.cpp \
201
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700202libc_bionic_src_files := \
Elliott Hughes61e699a2013-06-12 14:05:46 -0700203 bionic/abort.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700204 bionic/assert.cpp \
Elliott Hughes428f5562013-02-05 16:10:59 -0800205 bionic/brk.cpp \
David 'Digit' Turnerc30396f2012-10-29 15:32:54 +0100206 bionic/dirent.cpp \
Elliott Hughes91a99252013-02-12 21:56:42 -0800207 bionic/__errno.c \
Kito Cheng9b848242013-04-03 11:29:40 +0800208 bionic/eventfd_read.cpp \
209 bionic/eventfd_write.cpp \
Nick Kralevich2c5153b2013-01-11 14:43:05 -0800210 bionic/getauxval.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700211 bionic/getcwd.cpp \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800212 bionic/libc_init_common.cpp \
Elliott Hughes8f2a5a02013-03-15 15:30:25 -0700213 bionic/libc_logging.cpp \
Elliott Hughes58b57542012-10-29 14:27:10 -0700214 bionic/libgen.cpp \
Elliott Hughes107cdd42013-07-17 13:12:26 -0700215 bionic/mmap.cpp \
Elliott Hughes3e898472013-02-12 16:40:24 +0000216 bionic/pthread_attr.cpp \
Elliott Hughes9d23e042013-02-15 19:21:51 -0800217 bionic/pthread_detach.cpp \
218 bionic/pthread_equal.cpp \
219 bionic/pthread_getcpuclockid.cpp \
220 bionic/pthread_getschedparam.cpp \
221 bionic/pthread_internals.cpp \
222 bionic/pthread_join.cpp \
223 bionic/pthread_kill.cpp \
224 bionic/pthread_self.cpp \
Elliott Hughes3e898472013-02-12 16:40:24 +0000225 bionic/pthread_setname_np.cpp \
Elliott Hughes9d23e042013-02-15 19:21:51 -0800226 bionic/pthread_setschedparam.cpp \
Elliott Hughesc5d028f2013-01-10 14:42:14 -0800227 bionic/pthread_sigmask.cpp \
Chris Dearmand8a5a6f2012-12-07 18:41:10 -0800228 bionic/raise.cpp \
Elliott Hughes428f5562013-02-05 16:10:59 -0800229 bionic/sbrk.cpp \
Elliott Hughes701bec22013-02-25 13:14:31 -0800230 bionic/scandir.cpp \
Kito Cheng4ca685e2013-04-10 00:57:42 +0800231 bionic/sched_getaffinity.cpp \
Elliott Hughes4a9e8372012-11-30 11:58:57 -0800232 bionic/__set_errno.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700233 bionic/setlocale.cpp \
Rom Lemarchanda4b2dc02013-01-09 15:46:06 -0800234 bionic/signalfd.cpp \
Elliott Hughesc5d028f2013-01-10 14:42:14 -0800235 bionic/sigwait.cpp \
Elliott Hughes06040fd2013-07-09 13:25:03 -0700236 bionic/statvfs.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700237 bionic/strerror.cpp \
238 bionic/strerror_r.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700239 bionic/strsignal.cpp \
240 bionic/stubs.cpp \
Elliott Hughes91a99252013-02-12 21:56:42 -0800241 bionic/sysconf.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700242 bionic/tdestroy.cpp \
243 bionic/tmpfile.cpp \
Elliott Hughes17a8b0d2013-03-21 15:43:53 -0700244 bionic/wait.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700245 bionic/wchar.cpp \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700246
Elliott Hughesce4783c2013-07-12 17:31:11 -0700247libc_tzcode_src_files := \
248 tzcode/asctime.c \
249 tzcode/difftime.c \
250 tzcode/localtime.c \
251 tzcode/strftime.c \
252 tzcode/strptime.c \
253
Elliott Hughesf0777842013-03-01 16:59:46 -0800254libc_upstream_freebsd_src_files := \
Elliott Hughes6b05c8e2013-04-11 13:54:48 -0700255 upstream-freebsd/lib/libc/stdio/clrerr.c \
256 upstream-freebsd/lib/libc/stdio/fclose.c \
257 upstream-freebsd/lib/libc/stdio/fdopen.c \
258 upstream-freebsd/lib/libc/stdio/feof.c \
259 upstream-freebsd/lib/libc/stdio/ferror.c \
260 upstream-freebsd/lib/libc/stdio/fgetln.c \
261 upstream-freebsd/lib/libc/stdio/fgetpos.c \
262 upstream-freebsd/lib/libc/stdio/fgets.c \
263 upstream-freebsd/lib/libc/stdio/fileno.c \
264 upstream-freebsd/lib/libc/stdio/flags.c \
265 upstream-freebsd/lib/libc/stdio/fopen.c \
266 upstream-freebsd/lib/libc/stdio/fpurge.c \
267 upstream-freebsd/lib/libc/stdio/fputs.c \
268 upstream-freebsd/lib/libc/stdio/fsetpos.c \
269 upstream-freebsd/lib/libc/stdio/funopen.c \
270 upstream-freebsd/lib/libc/stdio/fwalk.c \
271 upstream-freebsd/lib/libc/stdio/fwrite.c \
272 upstream-freebsd/lib/libc/stdio/getc.c \
273 upstream-freebsd/lib/libc/stdio/getchar.c \
Elliott Hughes677ee562013-06-12 15:24:15 -0700274 upstream-freebsd/lib/libc/stdio/makebuf.c \
Elliott Hughes284f7882013-07-19 15:20:31 -0700275 upstream-freebsd/lib/libc/stdio/mktemp.c \
Elliott Hughes6b05c8e2013-04-11 13:54:48 -0700276 upstream-freebsd/lib/libc/stdio/putc.c \
277 upstream-freebsd/lib/libc/stdio/putchar.c \
278 upstream-freebsd/lib/libc/stdio/puts.c \
279 upstream-freebsd/lib/libc/stdio/putw.c \
280 upstream-freebsd/lib/libc/stdio/remove.c \
281 upstream-freebsd/lib/libc/stdio/rget.c \
282 upstream-freebsd/lib/libc/stdio/setbuf.c \
283 upstream-freebsd/lib/libc/stdio/setbuffer.c \
Elliott Hughes677ee562013-06-12 15:24:15 -0700284 upstream-freebsd/lib/libc/stdio/setvbuf.c \
Elliott Hughes6b05c8e2013-04-11 13:54:48 -0700285 upstream-freebsd/lib/libc/stdio/tempnam.c \
286 upstream-freebsd/lib/libc/stdio/tmpnam.c \
287 upstream-freebsd/lib/libc/stdio/wsetup.c \
Elliott Hughesd278b822013-06-25 14:48:10 -0700288 upstream-freebsd/lib/libc/stdlib/getopt_long.c \
Elliott Hughes0b25f632013-04-11 18:08:34 -0700289 upstream-freebsd/lib/libc/stdlib/qsort.c \
Elliott Hughesf0777842013-03-01 16:59:46 -0800290 upstream-freebsd/lib/libc/stdlib/realpath.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800291 upstream-freebsd/lib/libc/string/wcpcpy.c \
292 upstream-freebsd/lib/libc/string/wcpncpy.c \
293 upstream-freebsd/lib/libc/string/wcscasecmp.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800294 upstream-freebsd/lib/libc/string/wcscspn.c \
295 upstream-freebsd/lib/libc/string/wcsdup.c \
296 upstream-freebsd/lib/libc/string/wcslcat.c \
297 upstream-freebsd/lib/libc/string/wcslcpy.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800298 upstream-freebsd/lib/libc/string/wcsncasecmp.c \
299 upstream-freebsd/lib/libc/string/wcsncat.c \
300 upstream-freebsd/lib/libc/string/wcsncmp.c \
301 upstream-freebsd/lib/libc/string/wcsncpy.c \
302 upstream-freebsd/lib/libc/string/wcsnlen.c \
303 upstream-freebsd/lib/libc/string/wcspbrk.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800304 upstream-freebsd/lib/libc/string/wcsspn.c \
305 upstream-freebsd/lib/libc/string/wcsstr.c \
306 upstream-freebsd/lib/libc/string/wcstok.c \
307 upstream-freebsd/lib/libc/string/wmemchr.c \
Elliott Hugheseb93ebf2013-03-01 18:35:56 -0800308 upstream-freebsd/lib/libc/string/wmemcpy.c \
309 upstream-freebsd/lib/libc/string/wmemmove.c \
310 upstream-freebsd/lib/libc/string/wmemset.c \
Elliott Hughesf0777842013-03-01 16:59:46 -0800311
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700312libc_upstream_netbsd_src_files := \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700313 upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
314 upstream-netbsd/common/lib/libc/inet/inet_addr.c \
315 upstream-netbsd/libc/compat-43/creat.c \
316 upstream-netbsd/libc/gen/ftw.c \
317 upstream-netbsd/libc/gen/nftw.c \
318 upstream-netbsd/libc/gen/nice.c \
Elliott Hughes6b3f49a2013-03-06 16:20:55 -0800319 upstream-netbsd/libc/gen/popen.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700320 upstream-netbsd/libc/gen/psignal.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700321 upstream-netbsd/libc/gen/setjmperr.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700322 upstream-netbsd/libc/gen/utime.c \
323 upstream-netbsd/libc/inet/inet_ntoa.c \
324 upstream-netbsd/libc/inet/inet_ntop.c \
325 upstream-netbsd/libc/inet/inet_pton.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700326 upstream-netbsd/libc/isc/ev_streams.c \
327 upstream-netbsd/libc/isc/ev_timers.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700328 upstream-netbsd/libc/regex/regcomp.c \
329 upstream-netbsd/libc/regex/regerror.c \
330 upstream-netbsd/libc/regex/regexec.c \
331 upstream-netbsd/libc/regex/regfree.c \
332 upstream-netbsd/libc/stdio/getdelim.c \
333 upstream-netbsd/libc/stdio/getline.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700334 upstream-netbsd/libc/stdlib/bsearch.c \
335 upstream-netbsd/libc/stdlib/div.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700336 upstream-netbsd/libc/stdlib/drand48.c \
337 upstream-netbsd/libc/stdlib/erand48.c \
338 upstream-netbsd/libc/stdlib/jrand48.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700339 upstream-netbsd/libc/stdlib/ldiv.c \
340 upstream-netbsd/libc/stdlib/lldiv.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700341 upstream-netbsd/libc/stdlib/lrand48.c \
342 upstream-netbsd/libc/stdlib/mrand48.c \
343 upstream-netbsd/libc/stdlib/nrand48.c \
344 upstream-netbsd/libc/stdlib/_rand48.c \
345 upstream-netbsd/libc/stdlib/seed48.c \
346 upstream-netbsd/libc/stdlib/srand48.c \
347 upstream-netbsd/libc/stdlib/tdelete.c \
348 upstream-netbsd/libc/stdlib/tfind.c \
349 upstream-netbsd/libc/stdlib/tsearch.c \
Elliott Hughesc51cd762013-01-22 14:41:23 -0800350 upstream-netbsd/libc/string/memccpy.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700351 upstream-netbsd/libc/string/strcasestr.c \
Elliott Hughes2b473072013-01-22 15:10:19 -0800352 upstream-netbsd/libc/string/strcoll.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700353 upstream-netbsd/libc/string/strxfrm.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700354 upstream-netbsd/libc/unistd/killpg.c \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700355
Dima Zavinca122b02009-05-27 10:52:37 -0700356# Architecture specific source files go here
357# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800358ifeq ($(TARGET_ARCH),arm)
359libc_common_src_files += \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700360 bionic/memmove.c.arm \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800361 string/bcopy.c \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800362 string/strncmp.c \
Liubov Dmitrieva0a490662012-01-17 12:55:46 +0400363 string/strncat.c \
364 string/strncpy.c \
365 bionic/strchr.cpp \
366 string/strrchr.c \
367 bionic/memchr.c \
368 bionic/memrchr.c \
369 string/index.c \
370 bionic/strnlen.c \
371 string/strlcat.c \
372 string/strlcpy.c \
373 upstream-freebsd/lib/libc/string/wcschr.c \
374 upstream-freebsd/lib/libc/string/wcsrchr.c \
375 upstream-freebsd/lib/libc/string/wcscmp.c \
376 upstream-freebsd/lib/libc/string/wcscpy.c \
377 upstream-freebsd/lib/libc/string/wmemcmp.c \
378 upstream-freebsd/lib/libc/string/wcslen.c \
379 upstream-freebsd/lib/libc/string/wcscat.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800380
381# These files need to be arm so that gdbserver
382# can set breakpoints in them without messing
383# up any thumb code.
384libc_common_src_files += \
Matt Fischer4f086ae2010-06-25 14:36:39 -0500385 bionic/pthread-atfork.c.arm \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700386 bionic/pthread-rwlocks.c.arm \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800387 bionic/pthread-timers.c.arm \
388 bionic/ptrace.c.arm
Dima Zavinca122b02009-05-27 10:52:37 -0700389
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700390libc_static_common_src_files += \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000391 bionic/pthread.c.arm \
Elliott Hughes4b4a8822013-02-12 17:15:59 -0800392 bionic/pthread_create.cpp.arm \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000393 bionic/pthread_key.cpp.arm \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700394
Raghu Gandhama4c79332012-08-07 12:23:24 -0700395endif # arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800396
397ifeq ($(TARGET_ARCH),x86)
398libc_common_src_files += \
Elliott Hughesd2547042013-02-13 16:31:52 -0800399 bionic/pthread-atfork.c \
400 bionic/pthread-rwlocks.c \
401 bionic/pthread-timers.c \
402 bionic/ptrace.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800403
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700404libc_static_common_src_files += \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000405 bionic/pthread.c \
Elliott Hughes4b4a8822013-02-12 17:15:59 -0800406 bionic/pthread_create.cpp \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000407 bionic/pthread_key.cpp \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700408
Raghu Gandhama4c79332012-08-07 12:23:24 -0700409endif # x86
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900410
Raghu Gandhama4c79332012-08-07 12:23:24 -0700411ifeq ($(TARGET_ARCH),mips)
412libc_common_src_files += \
Elliott Hughes857fed52012-10-02 11:20:07 -0700413 bionic/memcmp.c \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700414 string/bcopy.c \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700415 string/strcmp.c \
416 string/strcpy.c \
Liubov Dmitrieva0a490662012-01-17 12:55:46 +0400417 string/strncmp.c \
418 string/strcat.c \
419 string/strncat.c \
420 string/strncpy.c \
421 bionic/strchr.cpp \
422 string/strrchr.c \
423 bionic/memchr.c \
424 bionic/memrchr.c \
425 string/index.c \
426 bionic/strnlen.c \
427 string/strlcat.c \
428 string/strlcpy.c \
429 upstream-freebsd/lib/libc/string/wcschr.c \
430 upstream-freebsd/lib/libc/string/wcsrchr.c \
431 upstream-freebsd/lib/libc/string/wcscmp.c \
432 upstream-freebsd/lib/libc/string/wcscpy.c \
433 upstream-freebsd/lib/libc/string/wmemcmp.c \
434 upstream-freebsd/lib/libc/string/wcslen.c \
435 upstream-freebsd/lib/libc/string/wcscat.c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700436
437libc_common_src_files += \
438 bionic/pthread-atfork.c \
439 bionic/pthread-rwlocks.c \
440 bionic/pthread-timers.c \
441 bionic/ptrace.c
442
443libc_static_common_src_files += \
Elliott Hughesba342c12013-02-11 18:06:23 -0800444 bionic/pthread.c \
Elliott Hughes4b4a8822013-02-12 17:15:59 -0800445 bionic/pthread_create.cpp \
Elliott Hughes44b53ad2013-02-11 20:18:47 +0000446 bionic/pthread_key.cpp \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700447
Raghu Gandhama4c79332012-08-07 12:23:24 -0700448endif # mips
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800449
Christopher Ferris7c83a1e2013-02-26 01:30:00 -0800450ifeq ($(strip $(TARGET_CPU_VARIANT)),)
451$(warning TARGET_CPU_VARIANT is not defined)
452endif
453
454###########################################################
455## Add cpu specific source files.
456##
457## This can be called multiple times, but it will only add
458## the first source file for each unique $(1).
459## $(1): Unique identifier to identify the cpu variant
460## implementation.
461## $(2): Cpu specific source file.
462###########################################################
463
464define libc-add-cpu-variant-src
465$(if $(filter true,$(_LIBC_ARCH_CPU_VARIANT_HAS_$(1))), \
466 , \
467 $(eval _LIBC_ARCH_CPU_VARIANT_HAS_$(1) := true) \
468 $(eval _LIBC_ARCH_CPU_VARIANT_SRC_FILE.$(1) := $(2)) \
469 $(eval _LIBC_ARCH_CPU_VARIANT_SRC_FILES += $(2)) \
470)
471endef
472
473_LIBC_ARCH_COMMON_SRC_FILES :=
474_LIBC_ARCH_CPU_VARIANT_SRC_FILES :=
475_LIBC_ARCH_STATIC_SRC_FILES :=
476_LIBC_ARCH_DYNAMIC_SRC_FILES :=
477include bionic/libc/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
478
479libc_common_src_files += $(_LIBC_ARCH_COMMON_SRC_FILES)
480libc_common_src_files += $(_LIBC_ARCH_CPU_VARIANT_SRC_FILES)
481libc_arch_static_src_files := $(_LIBC_ARCH_STATIC_SRC_FILES)
482libc_arch_dynamic_src_files := $(_LIBC_ARCH_DYNAMIC_SRC_FILES)
483
Dima Zavinca122b02009-05-27 10:52:37 -0700484# Define some common cflags
485# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800486libc_common_cflags := \
Elliott Hughes470631e2012-06-06 10:32:56 -0700487 -DWITH_ERRLIST \
488 -DANDROID_CHANGES \
Elliott Hughes470631e2012-06-06 10:32:56 -0700489 -D_LIBC=1 \
Elliott Hughes470631e2012-06-06 10:32:56 -0700490 -DFLOATING_POINT \
491 -DINET6 \
492 -I$(LOCAL_PATH)/private \
Elliott Hughes470631e2012-06-06 10:32:56 -0700493 -DPOSIX_MISTAKE \
494 -DLOG_ON_HEAP_ERROR \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700495 -Wall -Wextra
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800496
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700497ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800498 libc_common_cflags += -DDEBUG
499endif
500
Jack Ren2fd81ef2011-11-19 09:48:03 +0800501# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
502# the appropriate BoardConfig.mk file.
503#
504ifneq ($(BOARD_MALLOC_ALIGNMENT),)
505 libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
506endif
507
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800508ifeq ($(TARGET_ARCH),arm)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700509 libc_common_cflags += -DSOFTFLOAT
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800510 libc_common_cflags += -fstrict-aliasing
Dima Zavinca122b02009-05-27 10:52:37 -0700511 libc_crt_target_cflags := -mthumb-interwork
Dima Zavinca122b02009-05-27 10:52:37 -0700512endif # !arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800513
Raghu Gandhama4c79332012-08-07 12:23:24 -0700514ifeq ($(TARGET_ARCH),x86)
515 libc_common_cflags += -DSOFTFLOAT
516 libc_crt_target_cflags :=
517 ifeq ($(ARCH_X86_HAVE_SSE2),true)
518 libc_crt_target_cflags += -DUSE_SSE2=1
519 endif
520 ifeq ($(ARCH_X86_HAVE_SSSE3),true)
521 libc_crt_target_cflags += -DUSE_SSSE3=1
522 endif
523endif # x86
524
525ifeq ($(TARGET_ARCH),mips)
526 ifneq ($(ARCH_MIPS_HAS_FPU),true)
527 libc_common_cflags += -DSOFTFLOAT
528 endif
529 libc_common_cflags += -fstrict-aliasing
530 libc_crt_target_cflags := $(TARGET_GLOBAL_CFLAGS)
531endif # mips
532
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700533# Define ANDROID_SMP appropriately.
534ifeq ($(TARGET_CPU_SMP),true)
535 libc_common_cflags += -DANDROID_SMP=1
536else
537 libc_common_cflags += -DANDROID_SMP=0
538endif
539
Elliott Hughes76be6602012-08-08 14:07:37 -0700540# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
541libc_crt_target_cflags += \
542 -I$(LOCAL_PATH)/include \
543 -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700544
Dima Zavinca122b02009-05-27 10:52:37 -0700545# Define some common includes
546# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800547libc_common_c_includes := \
548 $(LOCAL_PATH)/stdlib \
549 $(LOCAL_PATH)/string \
Nick Kralevich76656af2012-06-07 16:30:02 -0700550 $(LOCAL_PATH)/stdio \
551 external/safe-iop/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800552
Nick Kralevich9d403262012-05-31 11:40:10 -0700553# Needed to access private/__dso_handle.h from
David 'Digit' Turner3b43f872010-07-01 23:09:28 -0700554# crtbegin_xxx.S and crtend_xxx.S
Elliott Hughes76be6602012-08-08 14:07:37 -0700555libc_crt_target_cflags += \
556 -I$(LOCAL_PATH)/private \
557 -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800558
Dima Zavinca122b02009-05-27 10:52:37 -0700559# Define the libc run-time (crt) support object files that must be built,
560# which are needed to build all other objects (shared/static libs and
561# executables)
562# ==========================================================================
Raghu Gandhama4c79332012-08-07 12:23:24 -0700563# ARM, MIPS, and x86 all need crtbegin_so/crtend_so.
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700564#
565# For x86, the .init section must point to a function that calls all
566# entries in the .ctors section. (on ARM this is done through the
567# .init_array section instead).
568#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700569# For all the platforms, the .fini_array section must point to a function
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700570# that will call __cxa_finalize(&__dso_handle) in order to ensure that
571# static C++ destructors are properly called on dlclose().
572#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700573ifeq ($(TARGET_ARCH),arm)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700574 libc_crt_target_so_cflags :=
David 'Digit' Turner2d2dbd32011-06-25 17:26:38 +0200575endif
Raghu Gandhama4c79332012-08-07 12:23:24 -0700576ifeq ($(TARGET_ARCH),mips)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700577 libc_crt_target_so_cflags := -fPIC
578endif
579ifeq ($(TARGET_ARCH),x86)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700580 libc_crt_target_so_cflags := -fPIC
581endif
Raghu Gandhama4c79332012-08-07 12:23:24 -0700582libc_crt_target_so_cflags += $(libc_crt_target_cflags)
Elliott Hughes4c6b9252013-07-17 17:38:45 -0700583libc_crt_target_crtbegin_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.c
584libc_crt_target_crtbegin_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.c
Michael Hopeea8fad12012-07-31 16:18:22 +1200585
586# See the comment in crtbrand.c for the reason why we need to generate
587# crtbrand.s before generating crtbrand.o.
588GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
589$(GEN): $(LOCAL_PATH)/bionic/crtbrand.c
590 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700591 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) -S \
592 -MD -MF $(@:%.s=%.d) -o $@ $<
593 $(hide) sed -i -e '/\.note\.ABI-tag/s/progbits/note/' $@
594 $(call transform-d-to-p-args,$(@:%.s=%.d),$(@:%.s=%.P))
595-include $(GEN:%.s=%.P)
Michael Hopeea8fad12012-07-31 16:18:22 +1200596ALL_GENERATED_SOURCES += $(GEN)
597
598GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
599$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
600 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700601 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
Michael Hopeea8fad12012-07-31 16:18:22 +1200602ALL_GENERATED_SOURCES += $(GEN)
603
Ying Wangfc9e5252012-05-15 15:15:11 -0700604GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700605$(GEN): $(libc_crt_target_crtbegin_so_file)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800606 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700607 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) \
608 -MD -MF $(@:%.o=%.d) -o $@ -c $<
609 $(transform-d-to-p)
610-include $(GEN:%.o=%.P)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800611ALL_GENERATED_SOURCES += $(GEN)
612
Ying Wangfc9e5252012-05-15 15:15:11 -0700613GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800614$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
615 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700616 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) \
617 -MD -MF $(@:%.o=%.d) -o $@ -c $<
618 $(transform-d-to-p)
619-include $(GEN:%.o=%.P)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800620ALL_GENERATED_SOURCES += $(GEN)
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700621
Ying Wangcf464872012-09-07 17:06:56 -0700622# The following two are installed to device
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700623GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtbegin_so.o
Ying Wangcf464872012-09-07 17:06:56 -0700624$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
625 $(hide) mkdir -p $(dir $@) && cp -f $< $@
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700626ALL_GENERATED_SOURCES += $(GEN)
627
628GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtend_so.o
Ying Wangcf464872012-09-07 17:06:56 -0700629$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
630 $(hide) mkdir -p $(dir $@) && cp -f $< $@
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700631ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800632
Dima Zavinca122b02009-05-27 10:52:37 -0700633
Michael Hopeea8fad12012-07-31 16:18:22 +1200634GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700635$(GEN): $(libc_crt_target_crtbegin_file)
Michael Hopeea8fad12012-07-31 16:18:22 +1200636 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700637 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
638 -MD -MF $(@:%.o=%.d) -o $@ -c $<
639 $(transform-d-to-p)
640-include $(GEN:%.o=%.P)
Michael Hopeea8fad12012-07-31 16:18:22 +1200641ALL_GENERATED_SOURCES += $(GEN)
642
Ying Wangfc9e5252012-05-15 15:15:11 -0700643GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200644$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
645 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700646 $(hide) $(TARGET_LD) -r -o $@ $^
Michael Hopeea8fad12012-07-31 16:18:22 +1200647ALL_GENERATED_SOURCES += $(GEN)
648
649GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700650$(GEN): $(libc_crt_target_crtbegin_file)
Dima Zavinca122b02009-05-27 10:52:37 -0700651 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700652 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
653 -MD -MF $(@:%.o=%.d) -o $@ -c $<
654 $(transform-d-to-p)
655-include $(GEN:%.o=%.P)
Dima Zavinca122b02009-05-27 10:52:37 -0700656ALL_GENERATED_SOURCES += $(GEN)
657
Ying Wangfc9e5252012-05-15 15:15:11 -0700658GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200659$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
Dima Zavinca122b02009-05-27 10:52:37 -0700660 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700661 $(hide) $(TARGET_LD) -r -o $@ $^
Dima Zavinca122b02009-05-27 10:52:37 -0700662ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800663
Dima Zavinca122b02009-05-27 10:52:37 -0700664# We rename crtend.o to crtend_android.o to avoid a
665# name clash between gcc and bionic.
Ying Wangfc9e5252012-05-15 15:15:11 -0700666GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
Dima Zavinca122b02009-05-27 10:52:37 -0700667$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
668 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700669 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
670 -MD -MF $(@:%.o=%.d) -o $@ -c $<
671 $(transform-d-to-p)
672-include $(GEN:%.o=%.P)
Dima Zavinca122b02009-05-27 10:52:37 -0700673ALL_GENERATED_SOURCES += $(GEN)
674
675
676# To enable malloc leak check for statically linked programs, add
677# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
678WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
679
680# ========================================================
Nick Kralevich6334c662012-07-10 10:46:19 -0700681# libbionic_ssp.a - stack protector code
682# ========================================================
683#
684# The stack protector code needs to be compiled
685# with -fno-stack-protector, since it modifies the
686# stack canary.
687
688include $(CLEAR_VARS)
689
Elliott Hughes642331b2013-03-06 15:03:53 -0800690LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
Elliott Hughesdc5ec072013-02-14 11:15:58 -0800691LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector -Werror
Nick Kralevich6334c662012-07-10 10:46:19 -0700692LOCAL_C_INCLUDES := $(libc_common_c_includes)
693LOCAL_MODULE := libbionic_ssp
Elliott Hughesae5c6442012-08-13 14:06:05 -0700694LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Nick Kralevich6334c662012-07-10 10:46:19 -0700695LOCAL_SYSTEM_SHARED_LIBRARIES :=
696
697include $(BUILD_STATIC_LIBRARY)
698
699
700# ========================================================
Elliott Hughesce4783c2013-07-12 17:31:11 -0700701# libc_tzcode.a - upstream 'tzcode' code
702# ========================================================
703
704include $(CLEAR_VARS)
705
706LOCAL_SRC_FILES := $(libc_tzcode_src_files)
707LOCAL_CFLAGS := \
708 $(libc_common_cflags) \
709 -std=gnu99 \
710 -DSTD_INSPIRED=1 \
711 -DTZDIR=\"/system/usr/share/zoneinfo\" \
712 -DTM_GMTOFF=tm_gmtoff \
713 -DUSG_COMPAT=1
714LOCAL_C_INCLUDES := $(libc_common_c_includes)
715LOCAL_MODULE := libc_tzcode
716LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
717LOCAL_SYSTEM_SHARED_LIBRARIES :=
718
719include $(BUILD_STATIC_LIBRARY)
720
721
722# ========================================================
Elliott Hughesf0777842013-03-01 16:59:46 -0800723# libc_freebsd.a - upstream FreeBSD C library code
724# ========================================================
725#
726# These files are built with the freebsd-compat.h header file
727# automatically included.
728
729include $(CLEAR_VARS)
730
731LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files)
732LOCAL_CFLAGS := \
733 $(libc_common_cflags) \
734 -I$(LOCAL_PATH)/upstream-freebsd \
735 -I$(LOCAL_PATH)/upstream-freebsd/libc/include \
736 -include upstream-freebsd/freebsd-compat.h
737LOCAL_C_INCLUDES := $(libc_common_c_includes)
738LOCAL_MODULE := libc_freebsd
739LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
740LOCAL_SYSTEM_SHARED_LIBRARIES :=
741
742include $(BUILD_STATIC_LIBRARY)
743
744
745# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700746# libc_netbsd.a - upstream NetBSD C library code
747# ========================================================
748#
749# These files are built with the netbsd-compat.h header file
750# automatically included.
751
752include $(CLEAR_VARS)
753
754LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
755LOCAL_CFLAGS := \
756 $(libc_common_cflags) \
Elliott Hughes3d2d4482012-08-13 16:38:29 -0700757 -I$(LOCAL_PATH)/upstream-netbsd \
Elliott Hughesab44f522012-10-23 16:05:09 -0700758 -I$(LOCAL_PATH)/upstream-netbsd/libc/include \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700759 -include upstream-netbsd/netbsd-compat.h
760LOCAL_C_INCLUDES := $(libc_common_c_includes)
761LOCAL_MODULE := libc_netbsd
Elliott Hughesae5c6442012-08-13 14:06:05 -0700762LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700763LOCAL_SYSTEM_SHARED_LIBRARIES :=
764
765include $(BUILD_STATIC_LIBRARY)
766
767
768# ========================================================
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700769# libc_bionic.a - home-grown C library code
770# ========================================================
771#
772include $(CLEAR_VARS)
773
774LOCAL_SRC_FILES := $(libc_bionic_src_files)
775LOCAL_CFLAGS := $(libc_common_cflags) -Werror
776LOCAL_C_INCLUDES := $(libc_common_c_includes)
777LOCAL_MODULE := libc_bionic
778LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
779LOCAL_SYSTEM_SHARED_LIBRARIES :=
780
781include $(BUILD_STATIC_LIBRARY)
782
783
784# ========================================================
Dima Zavinca122b02009-05-27 10:52:37 -0700785# libc_common.a
786# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700787
Dima Zavinca122b02009-05-27 10:52:37 -0700788include $(CLEAR_VARS)
789
790LOCAL_SRC_FILES := $(libc_common_src_files)
Elliott Hughesab44f522012-10-23 16:05:09 -0700791LOCAL_CFLAGS := $(libc_common_cflags) \
792 -std=gnu99 \
793 -I$(LOCAL_PATH)/upstream-netbsd/libc/include # for netbsd private headers
Dima Zavinca122b02009-05-27 10:52:37 -0700794LOCAL_C_INCLUDES := $(libc_common_c_includes)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800795LOCAL_MODULE := libc_common
Elliott Hughesae5c6442012-08-13 14:06:05 -0700796LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughesce4783c2013-07-12 17:31:11 -0700797LOCAL_WHOLE_STATIC_LIBRARIES := \
798 libbionic_ssp \
799 libc_bionic \
800 libc_freebsd \
801 libc_netbsd \
802 libc_tzcode
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800803LOCAL_SYSTEM_SHARED_LIBRARIES :=
804
Ying Wangc97c5fc2012-08-11 14:23:19 -0700805# TODO: split out the asflags.
806LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
807
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800808include $(BUILD_STATIC_LIBRARY)
809
810
Dima Zavinca122b02009-05-27 10:52:37 -0700811# ========================================================
Dima Zavin49e55332009-05-27 10:52:37 -0700812# libc_nomalloc.a
813# ========================================================
814#
815# This is a version of the static C library that does not
Elliott Hughes91a99252013-02-12 21:56:42 -0800816# include malloc. It's useful in situations when the user wants
817# to provide their own malloc implementation, or wants to
818# explicitly disallow the use of the use of malloc,
819# such as in the dynamic loader.
Dima Zavin49e55332009-05-27 10:52:37 -0700820
821include $(CLEAR_VARS)
822
823LOCAL_SRC_FILES := \
824 $(libc_arch_static_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700825 $(libc_static_common_src_files) \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800826 bionic/libc_init_static.cpp
Dima Zavin49e55332009-05-27 10:52:37 -0700827
828LOCAL_C_INCLUDES := $(libc_common_c_includes)
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700829LOCAL_CFLAGS := $(libc_common_cflags) \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700830 -DLIBC_STATIC \
831 -std=gnu99
Dima Zavin49e55332009-05-27 10:52:37 -0700832
833LOCAL_MODULE := libc_nomalloc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700834LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dima Zavin49e55332009-05-27 10:52:37 -0700835LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
836LOCAL_SYSTEM_SHARED_LIBRARIES :=
837
838include $(BUILD_STATIC_LIBRARY)
839
840
841# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800842# libc.a
843# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800844include $(CLEAR_VARS)
845
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800846LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700847 $(libc_arch_static_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700848 $(libc_static_common_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800849 bionic/dlmalloc.c \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700850 bionic/malloc_debug_common.cpp \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800851 bionic/libc_init_static.cpp
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800852
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800853LOCAL_CFLAGS := $(libc_common_cflags) \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700854 -DLIBC_STATIC \
855 -std=gnu99
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800856LOCAL_C_INCLUDES := $(libc_common_c_includes)
Dima Zavinca122b02009-05-27 10:52:37 -0700857LOCAL_MODULE := libc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700858LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800859LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800860LOCAL_SYSTEM_SHARED_LIBRARIES :=
861
862include $(BUILD_STATIC_LIBRARY)
863
864
Dima Zavinca122b02009-05-27 10:52:37 -0700865# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800866# libc.so
867# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800868include $(CLEAR_VARS)
869
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700870# pthread deadlock prediction:
871# set -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=1 to enable support for
872# pthread deadlock prediction.
873# Since this code is experimental it is disabled by default.
874# see libc/bionic/pthread_debug.c for details
875
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700876LOCAL_CFLAGS := $(libc_common_cflags) -std=gnu99 -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=0
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800877LOCAL_C_INCLUDES := $(libc_common_c_includes)
878
879LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700880 $(libc_arch_dynamic_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700881 $(libc_static_common_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800882 bionic/dlmalloc.c \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700883 bionic/malloc_debug_common.cpp \
Elliott Hughes1e980b62013-01-17 18:36:06 -0800884 bionic/pthread_debug.cpp \
Elliott Hughes42b2c6a2013-02-07 10:14:39 -0800885 bionic/libc_init_dynamic.cpp
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800886
Ard Biesheuvelf3cfcd82012-08-21 14:13:50 +0200887ifeq ($(TARGET_ARCH),arm)
888 LOCAL_NO_CRT := true
889 LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
890
891 LOCAL_SRC_FILES := \
892 arch-arm/bionic/crtbegin_so.c \
893 arch-arm/bionic/atexit_legacy.c \
894 $(LOCAL_SRC_FILES) \
895 arch-arm/bionic/crtend_so.S
896endif
897
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800898LOCAL_MODULE:= libc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700899LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughes914d8d42012-10-18 11:28:56 -0700900LOCAL_REQUIRED_MODULES := tzdata
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800901
902# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
903# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
904# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
905# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
906# should, instead relying on the external symbols from the dependent libraries. That would
907# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
908# you wanted!
909
910LOCAL_SHARED_LIBRARIES := libdl
911LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
912LOCAL_SYSTEM_SHARED_LIBRARIES :=
913
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800914include $(BUILD_SHARED_LIBRARY)
915
916
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800917# For all builds, except for the -user build we will enable memory
918# allocation checking (including memory leaks, buffer overwrites, etc.)
919# Note that all these checks are also controlled by env. settings
920# that can enable, or disable specific checks. Note also that some of
921# the checks are available only in emulator and are implemeted in
922# libc_malloc_qemu_instrumented.so.
923ifneq ($(TARGET_BUILD_VARIANT),user)
924
Dima Zavinca122b02009-05-27 10:52:37 -0700925# ========================================================
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800926# libc_malloc_debug_leak.so
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800927# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800928include $(CLEAR_VARS)
929
Dima Zavinca122b02009-05-27 10:52:37 -0700930LOCAL_CFLAGS := \
931 $(libc_common_cflags) \
932 -DMALLOC_LEAK_CHECK
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800933
934LOCAL_C_INCLUDES := $(libc_common_c_includes)
935
936LOCAL_SRC_FILES := \
Elliott Hughes1e980b62013-01-17 18:36:06 -0800937 bionic/debug_mapinfo.cpp \
938 bionic/debug_stacktrace.cpp \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700939 bionic/malloc_debug_leak.cpp \
940 bionic/malloc_debug_check.cpp \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800941
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800942LOCAL_MODULE:= libc_malloc_debug_leak
Elliott Hughesae5c6442012-08-13 14:06:05 -0700943LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800944
Pavel Chupine0077752012-09-10 19:35:25 +0400945LOCAL_SHARED_LIBRARIES := libc libdl
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800946LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
947LOCAL_SYSTEM_SHARED_LIBRARIES :=
Bruce Beareaa46fa22010-07-08 14:47:50 -0700948LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
Iliyan Malchev36807042011-03-14 14:02:05 -0700949
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800950# Don't install on release build
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800951LOCAL_MODULE_TAGS := eng debug
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800952
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800953include $(BUILD_SHARED_LIBRARY)
954
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800955
956# ========================================================
957# libc_malloc_debug_qemu.so
958# ========================================================
959include $(CLEAR_VARS)
960
961LOCAL_CFLAGS := \
962 $(libc_common_cflags) \
963 -DMALLOC_QEMU_INSTRUMENT
964
965LOCAL_C_INCLUDES := $(libc_common_c_includes)
966
967LOCAL_SRC_FILES := \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700968 bionic/malloc_debug_qemu.cpp
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800969
970LOCAL_MODULE:= libc_malloc_debug_qemu
Elliott Hughesae5c6442012-08-13 14:06:05 -0700971LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800972
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700973LOCAL_SHARED_LIBRARIES := libc libdl
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800974LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
975LOCAL_SYSTEM_SHARED_LIBRARIES :=
Iliyan Malchev36807042011-03-14 14:02:05 -0700976
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800977# Don't install on release build
978LOCAL_MODULE_TAGS := eng debug
979
980include $(BUILD_SHARED_LIBRARY)
981
982endif #!user
983
984
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800985# ========================================================
986include $(call all-makefiles-under,$(LOCAL_PATH))