blob: 301be371f56619b844e08cce5872af6c08cde194 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001LOCAL_PATH:= $(call my-dir)
2
3include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/syscalls.mk
Dima Zavinca122b02009-05-27 10:52:37 -07004
5# Define the common source files for all the libc instances
6# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08007libc_common_src_files := \
8 $(syscall_src) \
9 unistd/abort.c \
10 unistd/alarm.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080011 unistd/exec.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080012 unistd/fnmatch.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080013 unistd/getopt_long.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080014 unistd/popen.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080015 unistd/syslog.c \
16 unistd/system.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080017 unistd/time.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080018 stdio/asprintf.c \
19 stdio/clrerr.c \
20 stdio/fclose.c \
21 stdio/fdopen.c \
22 stdio/feof.c \
23 stdio/ferror.c \
24 stdio/fflush.c \
25 stdio/fgetc.c \
26 stdio/fgetln.c \
27 stdio/fgetpos.c \
28 stdio/fgets.c \
29 stdio/fileno.c \
30 stdio/findfp.c \
31 stdio/flags.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080032 stdio/fopen.c \
33 stdio/fprintf.c \
34 stdio/fpurge.c \
35 stdio/fputc.c \
36 stdio/fputs.c \
37 stdio/fread.c \
38 stdio/freopen.c \
39 stdio/fscanf.c \
40 stdio/fseek.c \
41 stdio/fsetpos.c \
42 stdio/ftell.c \
43 stdio/funopen.c \
44 stdio/fvwrite.c \
45 stdio/fwalk.c \
46 stdio/fwrite.c \
47 stdio/getc.c \
48 stdio/getchar.c \
49 stdio/gets.c \
50 stdio/makebuf.c \
51 stdio/mktemp.c \
52 stdio/printf.c \
53 stdio/putc.c \
54 stdio/putchar.c \
55 stdio/puts.c \
56 stdio/putw.c \
57 stdio/refill.c \
58 stdio/remove.c \
59 stdio/rewind.c \
60 stdio/rget.c \
61 stdio/scanf.c \
62 stdio/setbuf.c \
63 stdio/setbuffer.c \
64 stdio/setvbuf.c \
65 stdio/snprintf.c\
66 stdio/sprintf.c \
67 stdio/sscanf.c \
68 stdio/stdio.c \
69 stdio/tempnam.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080070 stdio/tmpnam.c \
71 stdio/ungetc.c \
72 stdio/vasprintf.c \
73 stdio/vfprintf.c \
74 stdio/vfscanf.c \
75 stdio/vprintf.c \
76 stdio/vsnprintf.c \
77 stdio/vsprintf.c \
78 stdio/vscanf.c \
79 stdio/vsscanf.c \
80 stdio/wbuf.c \
81 stdio/wsetup.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080082 stdlib/atexit.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080083 stdlib/ctype_.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080084 stdlib/exit.c \
85 stdlib/getenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080086 stdlib/putenv.c \
87 stdlib/qsort.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080088 stdlib/setenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080089 stdlib/strtod.c \
90 stdlib/strtoimax.c \
91 stdlib/strtol.c \
92 stdlib/strtoll.c \
93 stdlib/strtoul.c \
94 stdlib/strtoull.c \
95 stdlib/strtoumax.c \
96 stdlib/tolower_.c \
97 stdlib/toupper_.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080098 string/index.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080099 string/strcasecmp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800100 string/strcat.c \
101 string/strchr.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800102 string/strcspn.c \
103 string/strdup.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800104 string/strlcat.c \
105 string/strlcpy.c \
106 string/strncat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800107 string/strncpy.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800108 string/strpbrk.c \
109 string/strrchr.c \
110 string/strsep.c \
111 string/strspn.c \
112 string/strstr.c \
113 string/strtok.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700114 wchar/wcpcpy.c \
115 wchar/wcpncpy.c \
116 wchar/wcscasecmp.c \
117 wchar/wcscat.c \
118 wchar/wcschr.c \
119 wchar/wcscmp.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700120 wchar/wcscpy.c \
121 wchar/wcscspn.c \
122 wchar/wcsdup.c \
123 wchar/wcslcat.c \
124 wchar/wcslcpy.c \
125 wchar/wcslen.c \
126 wchar/wcsncasecmp.c \
127 wchar/wcsncat.c \
128 wchar/wcsncmp.c \
129 wchar/wcsncpy.c \
130 wchar/wcsnlen.c \
131 wchar/wcspbrk.c \
132 wchar/wcsrchr.c \
133 wchar/wcsspn.c \
134 wchar/wcsstr.c \
135 wchar/wcstok.c \
136 wchar/wcswidth.c \
Kristian Monsen70465612010-06-16 14:51:52 +0100137 wchar/wcsxfrm.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700138 wchar/wmemchr.c \
Kristian Monsen70465612010-06-16 14:51:52 +0100139 wchar/wmemcmp.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700140 wchar/wmemcpy.c \
141 wchar/wmemmove.c \
142 wchar/wmemset.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800143 tzcode/asctime.c \
144 tzcode/difftime.c \
145 tzcode/localtime.c \
146 tzcode/strftime.c \
147 tzcode/strptime.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800148 bionic/arc4random.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700149 bionic/atoi.c \
150 bionic/atol.c \
151 bionic/atoll.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700152 bionic/bindresvport.c \
153 bionic/bionic_clone.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800154 bionic/clearenv.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700155 bionic/cpuacct.c \
156 bionic/daemon.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800157 bionic/err.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700158 bionic/ether_aton.c \
159 bionic/ether_ntoa.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700160 bionic/fcntl.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800161 bionic/fdprintf.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700162 bionic/flockfile.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800163 bionic/fork.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700164 bionic/fstatfs.c \
165 bionic/ftime.c \
166 bionic/ftok.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800167 bionic/fts.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700168 bionic/getdtablesize.c \
169 bionic/gethostname.c \
170 bionic/getpgrp.c \
171 bionic/getpriority.c \
172 bionic/getpt.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800173 bionic/if_indextoname.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700174 bionic/if_nametoindex.c \
175 bionic/initgroups.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800176 bionic/ioctl.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700177 bionic/isatty.c \
178 bionic/issetugid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800179 bionic/ldexp.c \
180 bionic/libc_init_common.c \
181 bionic/logd_write.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700182 bionic/lseek64.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800183 bionic/md5.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700184 bionic/memchr.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700185 bionic/memmem.c \
Andy McFadden4ce737f2011-02-04 14:45:57 -0800186 bionic/memmove_words.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700187 bionic/memrchr.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700188 bionic/memswap.c \
189 bionic/mmap.c \
190 bionic/openat.c \
191 bionic/open.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700192 bionic/pathconf.c \
193 bionic/perror.c \
194 bionic/pread.c \
195 bionic/pselect.c \
196 bionic/ptsname.c \
197 bionic/ptsname_r.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800198 bionic/pututline.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700199 bionic/pwrite.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800200 bionic/realpath.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700201 bionic/reboot.c \
202 bionic/recv.c \
David 'Digit' Turner72e6fd42010-12-03 18:04:01 +0100203 bionic/sched_cpualloc.c \
204 bionic/sched_cpucount.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700205 bionic/sched_getaffinity.c \
206 bionic/sched_getcpu.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800207 bionic/semaphore.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700208 bionic/send.c \
209 bionic/setegid.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700210 bionic/seteuid.c \
211 bionic/setpgrp.c \
212 bionic/setresuid.c \
213 bionic/setreuid.c \
214 bionic/setuid.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700215 bionic/sigblock.c \
216 bionic/siginterrupt.c \
217 bionic/siglist.c \
218 bionic/signal.c \
219 bionic/signame.c \
220 bionic/sigsetmask.c \
221 bionic/sigsuspend.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700222 bionic/sleep.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700223 bionic/statfs.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700224 bionic/strndup.c \
225 bionic/strnlen.c \
226 bionic/strntoimax.c \
227 bionic/strntoumax.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700228 bionic/strtotimeval.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800229 bionic/system_properties.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700230 bionic/tcgetpgrp.c \
231 bionic/tcsetpgrp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800232 bionic/thread_atexit.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700233 bionic/time64.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700234 bionic/umount.c \
235 bionic/unlockpt.c \
236 bionic/usleep.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800237 bionic/utmp.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700238 bionic/wait.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700239 bionic/wcscoll.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800240 netbsd/gethnamaddr.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800241 netbsd/inet/nsap_addr.c \
242 netbsd/resolv/__dn_comp.c \
243 netbsd/resolv/__res_close.c \
244 netbsd/resolv/__res_send.c \
245 netbsd/resolv/herror.c \
246 netbsd/resolv/res_comp.c \
247 netbsd/resolv/res_data.c \
248 netbsd/resolv/res_debug.c \
249 netbsd/resolv/res_init.c \
250 netbsd/resolv/res_mkquery.c \
251 netbsd/resolv/res_query.c \
252 netbsd/resolv/res_send.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900253 netbsd/resolv/res_state.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800254 netbsd/resolv/res_cache.c \
255 netbsd/net/nsdispatch.c \
256 netbsd/net/getaddrinfo.c \
257 netbsd/net/getnameinfo.c \
258 netbsd/net/getservbyname.c \
259 netbsd/net/getservent.c \
260 netbsd/net/base64.c \
261 netbsd/net/getservbyport.c \
262 netbsd/nameser/ns_name.c \
263 netbsd/nameser/ns_parse.c \
264 netbsd/nameser/ns_ttl.c \
265 netbsd/nameser/ns_netint.c \
266 netbsd/nameser/ns_print.c \
Colin Cross4fa7b102010-01-12 18:59:25 -0800267 netbsd/nameser/ns_samedomain.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800268
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700269libc_bionic_src_files := \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700270 bionic/assert.cpp \
Elliott Hughes428f5562013-02-05 16:10:59 -0800271 bionic/brk.cpp \
Elliott Hughes1e980b62013-01-17 18:36:06 -0800272 bionic/debug_format.cpp \
David 'Digit' Turnerc30396f2012-10-29 15:32:54 +0100273 bionic/dirent.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700274 bionic/eventfd.cpp \
275 bionic/__fgets_chk.cpp \
Nick Kralevich2c5153b2013-01-11 14:43:05 -0800276 bionic/getauxval.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700277 bionic/getcwd.cpp \
Elliott Hughes58b57542012-10-29 14:27:10 -0700278 bionic/libgen.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700279 bionic/__memcpy_chk.cpp \
280 bionic/__memmove_chk.cpp \
281 bionic/__memset_chk.cpp \
Elliott Hughesc5d028f2013-01-10 14:42:14 -0800282 bionic/pthread_sigmask.cpp \
Chris Dearmand8a5a6f2012-12-07 18:41:10 -0800283 bionic/raise.cpp \
Elliott Hughes428f5562013-02-05 16:10:59 -0800284 bionic/sbrk.cpp \
Elliott Hughes4a9e8372012-11-30 11:58:57 -0800285 bionic/__set_errno.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700286 bionic/setlocale.cpp \
Rom Lemarchanda4b2dc02013-01-09 15:46:06 -0800287 bionic/signalfd.cpp \
Elliott Hughesc5d028f2013-01-10 14:42:14 -0800288 bionic/sigwait.cpp \
Elliott Hughes063cfb22012-10-25 20:55:23 -0700289 bionic/__strcat_chk.cpp \
290 bionic/__strcpy_chk.cpp \
291 bionic/strerror.cpp \
292 bionic/strerror_r.cpp \
293 bionic/__strlcat_chk.cpp \
294 bionic/__strlcpy_chk.cpp \
295 bionic/__strlen_chk.cpp \
296 bionic/__strncat_chk.cpp \
297 bionic/__strncpy_chk.cpp \
298 bionic/strsignal.cpp \
299 bionic/stubs.cpp \
300 bionic/tdestroy.cpp \
301 bionic/tmpfile.cpp \
302 bionic/__umask_chk.cpp \
303 bionic/__vsnprintf_chk.cpp \
304 bionic/__vsprintf_chk.cpp \
305 bionic/wchar.cpp \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700306
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700307libc_upstream_netbsd_src_files := \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700308 upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
309 upstream-netbsd/common/lib/libc/inet/inet_addr.c \
310 upstream-netbsd/libc/compat-43/creat.c \
311 upstream-netbsd/libc/gen/ftw.c \
312 upstream-netbsd/libc/gen/nftw.c \
313 upstream-netbsd/libc/gen/nice.c \
314 upstream-netbsd/libc/gen/psignal.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700315 upstream-netbsd/libc/gen/setjmperr.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700316 upstream-netbsd/libc/gen/utime.c \
317 upstream-netbsd/libc/inet/inet_ntoa.c \
318 upstream-netbsd/libc/inet/inet_ntop.c \
319 upstream-netbsd/libc/inet/inet_pton.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700320 upstream-netbsd/libc/isc/ev_streams.c \
321 upstream-netbsd/libc/isc/ev_timers.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700322 upstream-netbsd/libc/regex/regcomp.c \
323 upstream-netbsd/libc/regex/regerror.c \
324 upstream-netbsd/libc/regex/regexec.c \
325 upstream-netbsd/libc/regex/regfree.c \
326 upstream-netbsd/libc/stdio/getdelim.c \
327 upstream-netbsd/libc/stdio/getline.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700328 upstream-netbsd/libc/stdlib/bsearch.c \
329 upstream-netbsd/libc/stdlib/div.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700330 upstream-netbsd/libc/stdlib/drand48.c \
331 upstream-netbsd/libc/stdlib/erand48.c \
332 upstream-netbsd/libc/stdlib/jrand48.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700333 upstream-netbsd/libc/stdlib/ldiv.c \
334 upstream-netbsd/libc/stdlib/lldiv.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700335 upstream-netbsd/libc/stdlib/lrand48.c \
336 upstream-netbsd/libc/stdlib/mrand48.c \
337 upstream-netbsd/libc/stdlib/nrand48.c \
338 upstream-netbsd/libc/stdlib/_rand48.c \
339 upstream-netbsd/libc/stdlib/seed48.c \
340 upstream-netbsd/libc/stdlib/srand48.c \
341 upstream-netbsd/libc/stdlib/tdelete.c \
342 upstream-netbsd/libc/stdlib/tfind.c \
343 upstream-netbsd/libc/stdlib/tsearch.c \
Elliott Hughesc51cd762013-01-22 14:41:23 -0800344 upstream-netbsd/libc/string/memccpy.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700345 upstream-netbsd/libc/string/strcasestr.c \
Elliott Hughes2b473072013-01-22 15:10:19 -0800346 upstream-netbsd/libc/string/strcoll.c \
Elliott Hughese8bcca32012-10-23 12:26:26 -0700347 upstream-netbsd/libc/string/strxfrm.c \
Elliott Hughesab44f522012-10-23 16:05:09 -0700348 upstream-netbsd/libc/unistd/killpg.c \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700349
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700350# The following files are common, but must be compiled
351# with different C flags when building a static C library.
352#
353# The reason for this is the implementation of __get_tls()
354# that will differ between the shared and static versions
355# of the library.
356#
357# See comments in private/bionic_tls.h for more details.
358#
359# NOTE: bionic/pthread.c is added later to this list
360# because it needs special handling on ARM, see
361# below.
362#
363libc_static_common_src_files := \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700364 bionic/__errno.c \
Elliott Hughesa55f6302013-01-02 14:23:43 -0800365 bionic/sysconf.cpp \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700366
Dima Zavinca122b02009-05-27 10:52:37 -0700367# Architecture specific source files go here
368# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800369ifeq ($(TARGET_ARCH),arm)
370libc_common_src_files += \
Ben Cheng017f4382012-05-08 13:36:37 -0700371 arch-arm/bionic/abort_arm.S \
David 'Digit' Turner0fec6b92011-11-16 17:37:15 +0100372 arch-arm/bionic/atomics_arm.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800373 arch-arm/bionic/clone.S \
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700374 arch-arm/bionic/eabi.c \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700375 arch-arm/bionic/_exit_with_stack_teardown.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800376 arch-arm/bionic/ffs.S \
David 'Digit' Turner0fec6b92011-11-16 17:37:15 +0100377 arch-arm/bionic/futex_arm.S \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700378 arch-arm/bionic/__get_sp.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800379 arch-arm/bionic/kill.S \
David 'Digit' Turner2a7ad972009-09-29 14:43:38 -0700380 arch-arm/bionic/libgcc_compat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800381 arch-arm/bionic/memcmp16.S \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700382 arch-arm/bionic/memcmp.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800383 arch-arm/bionic/memcpy.S \
384 arch-arm/bionic/memset.S \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700385 arch-arm/bionic/_setjmp.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800386 arch-arm/bionic/setjmp.S \
387 arch-arm/bionic/sigsetjmp.S \
Jim Huangf50e9be2011-04-20 15:35:04 +0800388 arch-arm/bionic/strcmp.S \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700389 arch-arm/bionic/strcpy.S \
390 arch-arm/bionic/strlen.c.arm \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800391 arch-arm/bionic/syscall.S \
Elliott Hughesa89864a2012-10-01 17:35:49 -0700392 arch-arm/bionic/tgkill.S \
393 arch-arm/bionic/tkill.S \
394 bionic/memmove.c.arm \
395 bionic/socketcalls.c \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800396 string/bcopy.c \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800397 string/strncmp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800398
399# These files need to be arm so that gdbserver
400# can set breakpoints in them without messing
401# up any thumb code.
402libc_common_src_files += \
Matt Fischer4f086ae2010-06-25 14:36:39 -0500403 bionic/pthread-atfork.c.arm \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700404 bionic/pthread-rwlocks.c.arm \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800405 bionic/pthread-timers.c.arm \
406 bionic/ptrace.c.arm
Dima Zavinca122b02009-05-27 10:52:37 -0700407
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700408libc_static_common_src_files += \
409 bionic/pthread.c.arm \
410
Dima Zavinca122b02009-05-27 10:52:37 -0700411# these are used by the static and dynamic versions of the libc
412# respectively
413libc_arch_static_src_files := \
414 arch-arm/bionic/exidx_static.c
415
416libc_arch_dynamic_src_files := \
417 arch-arm/bionic/exidx_dynamic.c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700418endif # arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800419
420ifeq ($(TARGET_ARCH),x86)
421libc_common_src_files += \
422 arch-x86/bionic/__get_sp.S \
423 arch-x86/bionic/__get_tls.c \
424 arch-x86/bionic/__set_tls.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800425 arch-x86/bionic/clone.S \
426 arch-x86/bionic/_exit_with_stack_teardown.S \
David 'Digit' Turner0fec6b92011-11-16 17:37:15 +0100427 arch-x86/bionic/futex_x86.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800428 arch-x86/bionic/setjmp.S \
429 arch-x86/bionic/_setjmp.S \
Chih-Wei Huang18635d92010-12-14 17:55:23 +0800430 arch-x86/bionic/sigsetjmp.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800431 arch-x86/bionic/vfork.S \
Bruce Beare3c543e12010-03-04 10:29:38 -0800432 arch-x86/bionic/syscall.S \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800433 arch-x86/string/bcopy_wrapper.S \
434 arch-x86/string/memcpy_wrapper.S \
435 arch-x86/string/memmove_wrapper.S \
436 arch-x86/string/bzero_wrapper.S \
437 arch-x86/string/memcmp_wrapper.S \
438 arch-x86/string/memset_wrapper.S \
439 arch-x86/string/strcmp_wrapper.S \
440 arch-x86/string/strncmp_wrapper.S \
Bruce Beare124a5422010-10-11 12:24:41 -0700441 arch-x86/string/strlen_wrapper.S \
Jim Huang73c04b32010-08-10 17:23:39 +0800442 string/strcpy.c \
Matt Fischer4f086ae2010-06-25 14:36:39 -0500443 bionic/pthread-atfork.c \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700444 bionic/pthread-rwlocks.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800445 bionic/pthread-timers.c \
446 bionic/ptrace.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800447
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700448libc_static_common_src_files += \
449 bionic/pthread.c \
450
Dima Zavinca122b02009-05-27 10:52:37 -0700451libc_arch_static_src_files := \
Raghu Gandham405b8022012-07-25 18:16:42 -0700452 bionic/dl_iterate_phdr_static.c
Dima Zavinca122b02009-05-27 10:52:37 -0700453
454libc_arch_dynamic_src_files :=
Raghu Gandhama4c79332012-08-07 12:23:24 -0700455endif # x86
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900456
Raghu Gandhama4c79332012-08-07 12:23:24 -0700457ifeq ($(TARGET_ARCH),mips)
458libc_common_src_files += \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700459 arch-mips/bionic/__get_sp.S \
460 arch-mips/bionic/__get_tls.c \
461 arch-mips/bionic/__set_tls.c \
462 arch-mips/bionic/_exit_with_stack_teardown.S \
463 arch-mips/bionic/_setjmp.S \
464 arch-mips/bionic/futex_mips.S \
465 arch-mips/bionic/bzero.S \
466 arch-mips/bionic/cacheflush.c \
467 arch-mips/bionic/clone.S \
468 arch-mips/bionic/ffs.S \
469 arch-mips/bionic/memcmp16.S \
470 arch-mips/bionic/memmove.c \
471 arch-mips/bionic/pipe.S \
472 arch-mips/bionic/setjmp.S \
473 arch-mips/bionic/sigsetjmp.S \
474 arch-mips/bionic/vfork.S
475
476libc_common_src_files += \
477 arch-mips/string/memset.S \
478 arch-mips/string/memcpy.S \
479 arch-mips/string/mips_strlen.c
480
481libc_common_src_files += \
Elliott Hughes857fed52012-10-02 11:20:07 -0700482 bionic/memcmp.c \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700483 string/bcopy.c \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700484 string/strcmp.c \
485 string/strcpy.c \
486 string/strncmp.c
487
488libc_common_src_files += \
489 bionic/pthread-atfork.c \
490 bionic/pthread-rwlocks.c \
491 bionic/pthread-timers.c \
492 bionic/ptrace.c
493
494libc_static_common_src_files += \
495 bionic/pthread.c
496
497libc_arch_static_src_files := \
498 bionic/dl_iterate_phdr_static.c
499
500libc_arch_dynamic_src_files :=
501endif # mips
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800502
Dima Zavinca122b02009-05-27 10:52:37 -0700503# Define some common cflags
504# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800505libc_common_cflags := \
Elliott Hughes470631e2012-06-06 10:32:56 -0700506 -DWITH_ERRLIST \
507 -DANDROID_CHANGES \
Elliott Hughes470631e2012-06-06 10:32:56 -0700508 -D_LIBC=1 \
Elliott Hughes470631e2012-06-06 10:32:56 -0700509 -DFLOATING_POINT \
510 -DINET6 \
511 -I$(LOCAL_PATH)/private \
Elliott Hughes470631e2012-06-06 10:32:56 -0700512 -DPOSIX_MISTAKE \
513 -DLOG_ON_HEAP_ERROR \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700514 -Wall -Wextra
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800515
David 'Digit' Turnerd7ed1ae2010-03-05 14:17:35 -0800516# these macro definitions are required to implement the
517# 'timezone' and 'daylight' global variables, as well as
518# properly update the 'tm_gmtoff' field in 'struct tm'.
519#
520libc_common_cflags += \
521 -DTM_GMTOFF=tm_gmtoff \
522 -DUSG_COMPAT=1
523
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700524ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800525 libc_common_cflags += -DDEBUG
526endif
527
Jack Ren2fd81ef2011-11-19 09:48:03 +0800528# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
529# the appropriate BoardConfig.mk file.
530#
531ifneq ($(BOARD_MALLOC_ALIGNMENT),)
532 libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
533endif
534
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800535ifeq ($(TARGET_ARCH),arm)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700536 libc_common_cflags += -DSOFTFLOAT
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800537 libc_common_cflags += -fstrict-aliasing
Dima Zavinca122b02009-05-27 10:52:37 -0700538 libc_crt_target_cflags := -mthumb-interwork
David 'Digit' Turner4a05d122009-09-18 13:35:05 -0700539 #
540 # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
541 # that it should access the hardware TLS register directly in
542 # private/bionic_tls.h
543 #
544 # The value must match your kernel configuration
545 #
546 ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
547 libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
548 endif
Henrik Smidingfe6338d2010-09-15 16:08:03 +0200549 #
550 # Define HAVE_32_BYTE_CACHE_LINES to indicate to C
551 # library it should use to 32-byte version of memcpy, and not
552 # the 64-byte version.
553 #
554 ifeq ($(ARCH_ARM_HAVE_32_BYTE_CACHE_LINES),true)
555 libc_common_cflags += -DHAVE_32_BYTE_CACHE_LINE
556 endif
Prajakta Gudadhe08e72d02012-05-07 14:17:44 -0700557 ifeq ($(ARCH_ARM_USE_NON_NEON_MEMCPY),true)
558 libc_common_cflags += -DARCH_ARM_USE_NON_NEON_MEMCPY
559 endif
Dima Zavinca122b02009-05-27 10:52:37 -0700560endif # !arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800561
Raghu Gandhama4c79332012-08-07 12:23:24 -0700562ifeq ($(TARGET_ARCH),x86)
563 libc_common_cflags += -DSOFTFLOAT
564 libc_crt_target_cflags :=
565 ifeq ($(ARCH_X86_HAVE_SSE2),true)
566 libc_crt_target_cflags += -DUSE_SSE2=1
567 endif
568 ifeq ($(ARCH_X86_HAVE_SSSE3),true)
569 libc_crt_target_cflags += -DUSE_SSSE3=1
570 endif
571endif # x86
572
573ifeq ($(TARGET_ARCH),mips)
574 ifneq ($(ARCH_MIPS_HAS_FPU),true)
575 libc_common_cflags += -DSOFTFLOAT
576 endif
577 libc_common_cflags += -fstrict-aliasing
578 libc_crt_target_cflags := $(TARGET_GLOBAL_CFLAGS)
579endif # mips
580
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700581# Define ANDROID_SMP appropriately.
582ifeq ($(TARGET_CPU_SMP),true)
583 libc_common_cflags += -DANDROID_SMP=1
584else
585 libc_common_cflags += -DANDROID_SMP=0
586endif
587
Elliott Hughes76be6602012-08-08 14:07:37 -0700588# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
589libc_crt_target_cflags += \
590 -I$(LOCAL_PATH)/include \
591 -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700592
Dima Zavinca122b02009-05-27 10:52:37 -0700593# Define some common includes
594# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800595libc_common_c_includes := \
596 $(LOCAL_PATH)/stdlib \
597 $(LOCAL_PATH)/string \
Nick Kralevich76656af2012-06-07 16:30:02 -0700598 $(LOCAL_PATH)/stdio \
599 external/safe-iop/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800600
Nick Kralevich9d403262012-05-31 11:40:10 -0700601# Needed to access private/__dso_handle.h from
David 'Digit' Turner3b43f872010-07-01 23:09:28 -0700602# crtbegin_xxx.S and crtend_xxx.S
Elliott Hughes76be6602012-08-08 14:07:37 -0700603libc_crt_target_cflags += \
604 -I$(LOCAL_PATH)/private \
605 -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800606
Dima Zavinca122b02009-05-27 10:52:37 -0700607# Define the libc run-time (crt) support object files that must be built,
608# which are needed to build all other objects (shared/static libs and
609# executables)
610# ==========================================================================
Raghu Gandhama4c79332012-08-07 12:23:24 -0700611# ARM, MIPS, and x86 all need crtbegin_so/crtend_so.
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700612#
613# For x86, the .init section must point to a function that calls all
614# entries in the .ctors section. (on ARM this is done through the
615# .init_array section instead).
616#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700617# For all the platforms, the .fini_array section must point to a function
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700618# that will call __cxa_finalize(&__dso_handle) in order to ensure that
619# static C++ destructors are properly called on dlclose().
620#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700621ifeq ($(TARGET_ARCH),arm)
Elliott Hughes12949e52012-09-10 11:16:12 -0700622 libc_crtbegin_extension := c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700623 libc_crt_target_so_cflags :=
David 'Digit' Turner2d2dbd32011-06-25 17:26:38 +0200624endif
Raghu Gandhama4c79332012-08-07 12:23:24 -0700625ifeq ($(TARGET_ARCH),mips)
Elliott Hughes12949e52012-09-10 11:16:12 -0700626 libc_crtbegin_extension := S
Raghu Gandhama4c79332012-08-07 12:23:24 -0700627 libc_crt_target_so_cflags := -fPIC
628endif
629ifeq ($(TARGET_ARCH),x86)
Pavel Chupin20c4a3a2012-11-28 18:31:14 +0400630 libc_crtbegin_extension := c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700631 libc_crt_target_so_cflags := -fPIC
632endif
Elliott Hughes12949e52012-09-10 11:16:12 -0700633ifeq ($(libc_crtbegin_extension),)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700634 $(error $(TARGET_ARCH) not supported)
635endif
636libc_crt_target_so_cflags += $(libc_crt_target_cflags)
Elliott Hughes12949e52012-09-10 11:16:12 -0700637libc_crt_target_crtbegin_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.$(libc_crtbegin_extension)
638libc_crt_target_crtbegin_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.$(libc_crtbegin_extension)
Michael Hopeea8fad12012-07-31 16:18:22 +1200639
640# See the comment in crtbrand.c for the reason why we need to generate
641# crtbrand.s before generating crtbrand.o.
642GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
643$(GEN): $(LOCAL_PATH)/bionic/crtbrand.c
644 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700645 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) -S \
646 -MD -MF $(@:%.s=%.d) -o $@ $<
647 $(hide) sed -i -e '/\.note\.ABI-tag/s/progbits/note/' $@
648 $(call transform-d-to-p-args,$(@:%.s=%.d),$(@:%.s=%.P))
649-include $(GEN:%.s=%.P)
Michael Hopeea8fad12012-07-31 16:18:22 +1200650ALL_GENERATED_SOURCES += $(GEN)
651
652GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
653$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
654 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700655 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
Michael Hopeea8fad12012-07-31 16:18:22 +1200656ALL_GENERATED_SOURCES += $(GEN)
657
Ying Wangfc9e5252012-05-15 15:15:11 -0700658GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700659$(GEN): $(libc_crt_target_crtbegin_so_file)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800660 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700661 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) \
662 -MD -MF $(@:%.o=%.d) -o $@ -c $<
663 $(transform-d-to-p)
664-include $(GEN:%.o=%.P)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800665ALL_GENERATED_SOURCES += $(GEN)
666
Ying Wangfc9e5252012-05-15 15:15:11 -0700667GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800668$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
669 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700670 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) \
671 -MD -MF $(@:%.o=%.d) -o $@ -c $<
672 $(transform-d-to-p)
673-include $(GEN:%.o=%.P)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800674ALL_GENERATED_SOURCES += $(GEN)
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700675
Ying Wangcf464872012-09-07 17:06:56 -0700676# The following two are installed to device
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700677GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtbegin_so.o
Ying Wangcf464872012-09-07 17:06:56 -0700678$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
679 $(hide) mkdir -p $(dir $@) && cp -f $< $@
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700680ALL_GENERATED_SOURCES += $(GEN)
681
682GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtend_so.o
Ying Wangcf464872012-09-07 17:06:56 -0700683$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
684 $(hide) mkdir -p $(dir $@) && cp -f $< $@
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700685ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800686
Dima Zavinca122b02009-05-27 10:52:37 -0700687
Michael Hopeea8fad12012-07-31 16:18:22 +1200688GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700689$(GEN): $(libc_crt_target_crtbegin_file)
Michael Hopeea8fad12012-07-31 16:18:22 +1200690 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700691 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
692 -MD -MF $(@:%.o=%.d) -o $@ -c $<
693 $(transform-d-to-p)
694-include $(GEN:%.o=%.P)
Michael Hopeea8fad12012-07-31 16:18:22 +1200695ALL_GENERATED_SOURCES += $(GEN)
696
Ying Wangfc9e5252012-05-15 15:15:11 -0700697GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200698$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
699 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700700 $(hide) $(TARGET_LD) -r -o $@ $^
Michael Hopeea8fad12012-07-31 16:18:22 +1200701ALL_GENERATED_SOURCES += $(GEN)
702
703GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700704$(GEN): $(libc_crt_target_crtbegin_file)
Dima Zavinca122b02009-05-27 10:52:37 -0700705 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700706 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
707 -MD -MF $(@:%.o=%.d) -o $@ -c $<
708 $(transform-d-to-p)
709-include $(GEN:%.o=%.P)
Dima Zavinca122b02009-05-27 10:52:37 -0700710ALL_GENERATED_SOURCES += $(GEN)
711
Ying Wangfc9e5252012-05-15 15:15:11 -0700712GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200713$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
Dima Zavinca122b02009-05-27 10:52:37 -0700714 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700715 $(hide) $(TARGET_LD) -r -o $@ $^
Dima Zavinca122b02009-05-27 10:52:37 -0700716ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800717
Dima Zavinca122b02009-05-27 10:52:37 -0700718# We rename crtend.o to crtend_android.o to avoid a
719# name clash between gcc and bionic.
Ying Wangfc9e5252012-05-15 15:15:11 -0700720GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
Dima Zavinca122b02009-05-27 10:52:37 -0700721$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
722 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700723 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
724 -MD -MF $(@:%.o=%.d) -o $@ -c $<
725 $(transform-d-to-p)
726-include $(GEN:%.o=%.P)
Dima Zavinca122b02009-05-27 10:52:37 -0700727ALL_GENERATED_SOURCES += $(GEN)
728
729
730# To enable malloc leak check for statically linked programs, add
731# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
732WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
733
734# ========================================================
Nick Kralevich6334c662012-07-10 10:46:19 -0700735# libbionic_ssp.a - stack protector code
736# ========================================================
737#
738# The stack protector code needs to be compiled
739# with -fno-stack-protector, since it modifies the
740# stack canary.
741
742include $(CLEAR_VARS)
743
Elliott Hughesad88a082012-10-24 18:37:21 -0700744LOCAL_SRC_FILES := bionic/ssp.cpp
Nick Kralevich6334c662012-07-10 10:46:19 -0700745LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
746LOCAL_C_INCLUDES := $(libc_common_c_includes)
747LOCAL_MODULE := libbionic_ssp
Elliott Hughesae5c6442012-08-13 14:06:05 -0700748LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Nick Kralevich6334c662012-07-10 10:46:19 -0700749LOCAL_SYSTEM_SHARED_LIBRARIES :=
750
751include $(BUILD_STATIC_LIBRARY)
752
753
754# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700755# libc_netbsd.a - upstream NetBSD C library code
756# ========================================================
757#
758# These files are built with the netbsd-compat.h header file
759# automatically included.
760
761include $(CLEAR_VARS)
762
763LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
764LOCAL_CFLAGS := \
765 $(libc_common_cflags) \
Elliott Hughes3d2d4482012-08-13 16:38:29 -0700766 -I$(LOCAL_PATH)/upstream-netbsd \
Elliott Hughesab44f522012-10-23 16:05:09 -0700767 -I$(LOCAL_PATH)/upstream-netbsd/libc/include \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700768 -include upstream-netbsd/netbsd-compat.h
769LOCAL_C_INCLUDES := $(libc_common_c_includes)
770LOCAL_MODULE := libc_netbsd
Elliott Hughesae5c6442012-08-13 14:06:05 -0700771LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700772LOCAL_SYSTEM_SHARED_LIBRARIES :=
773
774include $(BUILD_STATIC_LIBRARY)
775
776
777# ========================================================
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700778# libc_bionic.a - home-grown C library code
779# ========================================================
780#
781include $(CLEAR_VARS)
782
783LOCAL_SRC_FILES := $(libc_bionic_src_files)
784LOCAL_CFLAGS := $(libc_common_cflags) -Werror
785LOCAL_C_INCLUDES := $(libc_common_c_includes)
786LOCAL_MODULE := libc_bionic
787LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
788LOCAL_SYSTEM_SHARED_LIBRARIES :=
789
790include $(BUILD_STATIC_LIBRARY)
791
792
793# ========================================================
Dima Zavinca122b02009-05-27 10:52:37 -0700794# libc_common.a
795# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700796
Dima Zavinca122b02009-05-27 10:52:37 -0700797include $(CLEAR_VARS)
798
799LOCAL_SRC_FILES := $(libc_common_src_files)
Elliott Hughesab44f522012-10-23 16:05:09 -0700800LOCAL_CFLAGS := $(libc_common_cflags) \
801 -std=gnu99 \
802 -I$(LOCAL_PATH)/upstream-netbsd/libc/include # for netbsd private headers
Dima Zavinca122b02009-05-27 10:52:37 -0700803LOCAL_C_INCLUDES := $(libc_common_c_includes)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800804LOCAL_MODULE := libc_common
Elliott Hughesae5c6442012-08-13 14:06:05 -0700805LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700806LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp libc_bionic libc_netbsd
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800807LOCAL_SYSTEM_SHARED_LIBRARIES :=
808
809include $(BUILD_STATIC_LIBRARY)
810
811
Dima Zavinca122b02009-05-27 10:52:37 -0700812# ========================================================
Dima Zavin49e55332009-05-27 10:52:37 -0700813# libc_nomalloc.a
814# ========================================================
815#
816# This is a version of the static C library that does not
817# include malloc. It's useful in situations when calling
818# the user wants to provide their own malloc implementation,
819# or wants to explicitly disallow the use of the use of malloc,
820# like the dynamic loader.
821
822include $(CLEAR_VARS)
823
824LOCAL_SRC_FILES := \
825 $(libc_arch_static_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700826 $(libc_static_common_src_files) \
Dima Zavin49e55332009-05-27 10:52:37 -0700827 bionic/libc_init_static.c
828
829LOCAL_C_INCLUDES := $(libc_common_c_includes)
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700830LOCAL_CFLAGS := $(libc_common_cflags) \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700831 -DLIBC_STATIC \
832 -std=gnu99
Dima Zavin49e55332009-05-27 10:52:37 -0700833
834LOCAL_MODULE := libc_nomalloc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700835LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dima Zavin49e55332009-05-27 10:52:37 -0700836LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
837LOCAL_SYSTEM_SHARED_LIBRARIES :=
838
839include $(BUILD_STATIC_LIBRARY)
840
841
842# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800843# libc.a
844# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800845include $(CLEAR_VARS)
846
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800847LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700848 $(libc_arch_static_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700849 $(libc_static_common_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800850 bionic/dlmalloc.c \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700851 bionic/malloc_debug_common.cpp \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800852 bionic/libc_init_static.c
853
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800854LOCAL_CFLAGS := $(libc_common_cflags) \
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700855 -DLIBC_STATIC \
856 -std=gnu99
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800857LOCAL_C_INCLUDES := $(libc_common_c_includes)
Dima Zavinca122b02009-05-27 10:52:37 -0700858LOCAL_MODULE := libc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700859LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800860LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800861LOCAL_SYSTEM_SHARED_LIBRARIES :=
862
863include $(BUILD_STATIC_LIBRARY)
864
865
Dima Zavinca122b02009-05-27 10:52:37 -0700866# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800867# libc.so
868# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800869include $(CLEAR_VARS)
870
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700871# pthread deadlock prediction:
872# set -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=1 to enable support for
873# pthread deadlock prediction.
874# Since this code is experimental it is disabled by default.
875# see libc/bionic/pthread_debug.c for details
876
Elliott Hughes29c7f0b2012-10-22 17:05:27 -0700877LOCAL_CFLAGS := $(libc_common_cflags) -std=gnu99 -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=0
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800878LOCAL_C_INCLUDES := $(libc_common_c_includes)
879
880LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700881 $(libc_arch_dynamic_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700882 $(libc_static_common_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800883 bionic/dlmalloc.c \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700884 bionic/malloc_debug_common.cpp \
Elliott Hughes1e980b62013-01-17 18:36:06 -0800885 bionic/pthread_debug.cpp \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800886 bionic/libc_init_dynamic.c
887
Ard Biesheuvelf3cfcd82012-08-21 14:13:50 +0200888ifeq ($(TARGET_ARCH),arm)
889 LOCAL_NO_CRT := true
890 LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
891
892 LOCAL_SRC_FILES := \
893 arch-arm/bionic/crtbegin_so.c \
894 arch-arm/bionic/atexit_legacy.c \
895 $(LOCAL_SRC_FILES) \
896 arch-arm/bionic/crtend_so.S
897endif
898
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800899LOCAL_MODULE:= libc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700900LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughes914d8d42012-10-18 11:28:56 -0700901LOCAL_REQUIRED_MODULES := tzdata
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800902
903# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
904# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
905# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
906# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
907# should, instead relying on the external symbols from the dependent libraries. That would
908# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
909# you wanted!
910
911LOCAL_SHARED_LIBRARIES := libdl
912LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
913LOCAL_SYSTEM_SHARED_LIBRARIES :=
914
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800915include $(BUILD_SHARED_LIBRARY)
916
917
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800918# For all builds, except for the -user build we will enable memory
919# allocation checking (including memory leaks, buffer overwrites, etc.)
920# Note that all these checks are also controlled by env. settings
921# that can enable, or disable specific checks. Note also that some of
922# the checks are available only in emulator and are implemeted in
923# libc_malloc_qemu_instrumented.so.
924ifneq ($(TARGET_BUILD_VARIANT),user)
925
Dima Zavinca122b02009-05-27 10:52:37 -0700926# ========================================================
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800927# libc_malloc_debug_leak.so
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800928# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800929include $(CLEAR_VARS)
930
Dima Zavinca122b02009-05-27 10:52:37 -0700931LOCAL_CFLAGS := \
932 $(libc_common_cflags) \
933 -DMALLOC_LEAK_CHECK
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800934
935LOCAL_C_INCLUDES := $(libc_common_c_includes)
936
937LOCAL_SRC_FILES := \
Elliott Hughes1e980b62013-01-17 18:36:06 -0800938 bionic/debug_mapinfo.cpp \
939 bionic/debug_stacktrace.cpp \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700940 bionic/malloc_debug_leak.cpp \
941 bionic/malloc_debug_check.cpp \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800942
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800943LOCAL_MODULE:= libc_malloc_debug_leak
Elliott Hughesae5c6442012-08-13 14:06:05 -0700944LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800945
Pavel Chupine0077752012-09-10 19:35:25 +0400946LOCAL_SHARED_LIBRARIES := libc libdl
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800947LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
948LOCAL_SYSTEM_SHARED_LIBRARIES :=
Bruce Beareaa46fa22010-07-08 14:47:50 -0700949LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
Iliyan Malchev36807042011-03-14 14:02:05 -0700950
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800951# Don't install on release build
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800952LOCAL_MODULE_TAGS := eng debug
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800953
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800954include $(BUILD_SHARED_LIBRARY)
955
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800956
957# ========================================================
958# libc_malloc_debug_qemu.so
959# ========================================================
960include $(CLEAR_VARS)
961
962LOCAL_CFLAGS := \
963 $(libc_common_cflags) \
964 -DMALLOC_QEMU_INSTRUMENT
965
966LOCAL_C_INCLUDES := $(libc_common_c_includes)
967
968LOCAL_SRC_FILES := \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700969 bionic/malloc_debug_qemu.cpp
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800970
971LOCAL_MODULE:= libc_malloc_debug_qemu
Elliott Hughesae5c6442012-08-13 14:06:05 -0700972LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800973
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700974LOCAL_SHARED_LIBRARIES := libc libdl
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800975LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
976LOCAL_SYSTEM_SHARED_LIBRARIES :=
Iliyan Malchev36807042011-03-14 14:02:05 -0700977
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800978# Don't install on release build
979LOCAL_MODULE_TAGS := eng debug
980
981include $(BUILD_SHARED_LIBRARY)
982
983endif #!user
984
985
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800986# ========================================================
987include $(call all-makefiles-under,$(LOCAL_PATH))