blob: 370af720b28260ab131ae64cb1d1c0c0dcfbfd31 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001LOCAL_PATH:= $(call my-dir)
2
3include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/syscalls.mk
Dima Zavinca122b02009-05-27 10:52:37 -07004
5# Define the common source files for all the libc instances
6# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08007libc_common_src_files := \
8 $(syscall_src) \
9 unistd/abort.c \
10 unistd/alarm.c \
11 unistd/brk.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080012 unistd/daemon.c \
David 'Digit' Turnerdefd1622010-09-26 22:29:14 +020013 unistd/eventfd.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080014 unistd/exec.c \
15 unistd/fcntl.c \
16 unistd/fnmatch.c \
David 'Digit' Turnerab8b5412010-07-08 16:52:27 -070017 unistd/fstatfs.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080018 unistd/ftime.c \
19 unistd/ftok.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080020 unistd/getdtablesize.c \
21 unistd/gethostname.c \
22 unistd/getopt_long.c \
23 unistd/getpgrp.c \
24 unistd/getpriority.c \
25 unistd/getpt.c \
26 unistd/initgroups.c \
27 unistd/isatty.c \
28 unistd/issetugid.c \
Colin Cross8c59d962010-01-13 16:39:26 -080029 unistd/killpg.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080030 unistd/lseek64.c \
31 unistd/mmap.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080032 unistd/open.c \
33 unistd/openat.c \
34 unistd/opendir.c \
35 unistd/pathconf.c \
36 unistd/perror.c \
37 unistd/popen.c \
38 unistd/pread.c \
39 unistd/pselect.c \
40 unistd/ptsname.c \
41 unistd/ptsname_r.c \
42 unistd/pwrite.c \
43 unistd/raise.c \
44 unistd/reboot.c \
45 unistd/recv.c \
46 unistd/sbrk.c \
47 unistd/send.c \
48 unistd/setegid.c \
Mike Chan9f691562010-03-02 10:55:58 -080049 unistd/setuid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080050 unistd/seteuid.c \
Mike Chan9f691562010-03-02 10:55:58 -080051 unistd/setreuid.c \
52 unistd/setresuid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080053 unistd/setpgrp.c \
54 unistd/sigblock.c \
55 unistd/siginterrupt.c \
56 unistd/siglist.c \
57 unistd/signal.c \
Thorsten Glaser92b10af2009-10-02 15:39:00 +020058 unistd/signame.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080059 unistd/sigsetmask.c \
60 unistd/sigsuspend.c \
61 unistd/sigwait.c \
62 unistd/sleep.c \
63 unistd/statfs.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080064 unistd/syslog.c \
65 unistd/system.c \
66 unistd/tcgetpgrp.c \
67 unistd/tcsetpgrp.c \
68 unistd/time.c \
69 unistd/umount.c \
70 unistd/unlockpt.c \
71 unistd/usleep.c \
72 unistd/wait.c \
73 stdio/asprintf.c \
74 stdio/clrerr.c \
75 stdio/fclose.c \
76 stdio/fdopen.c \
77 stdio/feof.c \
78 stdio/ferror.c \
79 stdio/fflush.c \
80 stdio/fgetc.c \
81 stdio/fgetln.c \
82 stdio/fgetpos.c \
83 stdio/fgets.c \
84 stdio/fileno.c \
85 stdio/findfp.c \
86 stdio/flags.c \
87 stdio/flockfile.c \
88 stdio/fopen.c \
89 stdio/fprintf.c \
90 stdio/fpurge.c \
91 stdio/fputc.c \
92 stdio/fputs.c \
93 stdio/fread.c \
94 stdio/freopen.c \
95 stdio/fscanf.c \
96 stdio/fseek.c \
97 stdio/fsetpos.c \
98 stdio/ftell.c \
99 stdio/funopen.c \
100 stdio/fvwrite.c \
101 stdio/fwalk.c \
102 stdio/fwrite.c \
103 stdio/getc.c \
104 stdio/getchar.c \
105 stdio/gets.c \
106 stdio/makebuf.c \
107 stdio/mktemp.c \
108 stdio/printf.c \
109 stdio/putc.c \
110 stdio/putchar.c \
111 stdio/puts.c \
112 stdio/putw.c \
113 stdio/refill.c \
114 stdio/remove.c \
115 stdio/rewind.c \
116 stdio/rget.c \
117 stdio/scanf.c \
118 stdio/setbuf.c \
119 stdio/setbuffer.c \
120 stdio/setvbuf.c \
121 stdio/snprintf.c\
122 stdio/sprintf.c \
123 stdio/sscanf.c \
124 stdio/stdio.c \
125 stdio/tempnam.c \
126 stdio/tmpfile.c \
127 stdio/tmpnam.c \
128 stdio/ungetc.c \
129 stdio/vasprintf.c \
130 stdio/vfprintf.c \
131 stdio/vfscanf.c \
132 stdio/vprintf.c \
133 stdio/vsnprintf.c \
134 stdio/vsprintf.c \
135 stdio/vscanf.c \
136 stdio/vsscanf.c \
137 stdio/wbuf.c \
138 stdio/wsetup.c \
Nick Kralevich965dbc62012-07-03 11:45:31 -0700139 stdio/__fgets_chk.c \
Nick Kralevichcffdf662012-06-11 15:50:57 -0700140 stdio/__snprintf_chk.c \
Nick Kralevich9b549c32012-06-12 15:59:04 -0700141 stdio/__sprintf_chk.c \
Nick Kralevichcffdf662012-06-11 15:50:57 -0700142 stdio/__vsnprintf_chk.c \
Nick Kralevich9b549c32012-06-12 15:59:04 -0700143 stdio/__vsprintf_chk.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800144 stdlib/_rand48.c \
145 stdlib/assert.c \
146 stdlib/atexit.c \
147 stdlib/atoi.c \
148 stdlib/atol.c \
149 stdlib/atoll.c \
150 stdlib/bsearch.c \
151 stdlib/ctype_.c \
152 stdlib/div.c \
153 stdlib/exit.c \
154 stdlib/getenv.c \
155 stdlib/jrand48.c \
156 stdlib/ldiv.c \
157 stdlib/lldiv.c \
158 stdlib/locale.c \
159 stdlib/lrand48.c \
160 stdlib/mrand48.c \
161 stdlib/nrand48.c \
162 stdlib/putenv.c \
163 stdlib/qsort.c \
164 stdlib/seed48.c \
165 stdlib/setenv.c \
166 stdlib/setjmperr.c \
167 stdlib/srand48.c \
168 stdlib/strntoimax.c \
169 stdlib/strntoumax.c \
170 stdlib/strtod.c \
171 stdlib/strtoimax.c \
172 stdlib/strtol.c \
173 stdlib/strtoll.c \
174 stdlib/strtoul.c \
175 stdlib/strtoull.c \
176 stdlib/strtoumax.c \
177 stdlib/tolower_.c \
178 stdlib/toupper_.c \
179 stdlib/wchar.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800180 string/index.c \
181 string/memccpy.c \
182 string/memchr.c \
183 string/memmem.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800184 string/memrchr.c \
185 string/memswap.c \
186 string/strcasecmp.c \
187 string/strcasestr.c \
188 string/strcat.c \
189 string/strchr.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800190 string/strcoll.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800191 string/strcspn.c \
192 string/strdup.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800193 string/strlcat.c \
194 string/strlcpy.c \
195 string/strncat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800196 string/strncpy.c \
197 string/strndup.c \
198 string/strnlen.c \
199 string/strpbrk.c \
200 string/strrchr.c \
201 string/strsep.c \
202 string/strspn.c \
203 string/strstr.c \
204 string/strtok.c \
205 string/strtotimeval.c \
Nick Kralevich0a230152012-06-04 15:20:25 -0700206 string/__memcpy_chk.c \
207 string/__memmove_chk.c \
Nick Kralevich71a18dd2012-06-07 14:01:26 -0700208 string/__memset_chk.c \
Nick Kralevich0a230152012-06-04 15:20:25 -0700209 string/__strcat_chk.c \
210 string/__strcpy_chk.c \
Nick Kralevich8df49ad2012-06-13 16:57:27 -0700211 string/__strlcat_chk.c \
212 string/__strlcpy_chk.c \
Nick Kralevich260bf8c2012-07-13 11:27:06 -0700213 string/__strlen_chk.c \
Nick Kralevich0a230152012-06-04 15:20:25 -0700214 string/__strncat_chk.c \
215 string/__strncpy_chk.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700216 wchar/wcpcpy.c \
217 wchar/wcpncpy.c \
218 wchar/wcscasecmp.c \
219 wchar/wcscat.c \
220 wchar/wcschr.c \
221 wchar/wcscmp.c \
222 wchar/wcscoll.c \
223 wchar/wcscpy.c \
224 wchar/wcscspn.c \
225 wchar/wcsdup.c \
226 wchar/wcslcat.c \
227 wchar/wcslcpy.c \
228 wchar/wcslen.c \
229 wchar/wcsncasecmp.c \
230 wchar/wcsncat.c \
231 wchar/wcsncmp.c \
232 wchar/wcsncpy.c \
233 wchar/wcsnlen.c \
234 wchar/wcspbrk.c \
235 wchar/wcsrchr.c \
236 wchar/wcsspn.c \
237 wchar/wcsstr.c \
238 wchar/wcstok.c \
239 wchar/wcswidth.c \
Kristian Monsen70465612010-06-16 14:51:52 +0100240 wchar/wcsxfrm.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700241 wchar/wmemchr.c \
Kristian Monsen70465612010-06-16 14:51:52 +0100242 wchar/wmemcmp.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700243 wchar/wmemcpy.c \
244 wchar/wmemmove.c \
245 wchar/wmemset.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800246 inet/bindresvport.c \
247 inet/inet_addr.c \
248 inet/inet_aton.c \
249 inet/inet_ntoa.c \
250 inet/inet_ntop.c \
251 inet/inet_pton.c \
Szymon Jakubczak41e533a2010-06-09 15:53:28 -0400252 inet/ether_aton.c \
253 inet/ether_ntoa.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800254 tzcode/asctime.c \
255 tzcode/difftime.c \
256 tzcode/localtime.c \
257 tzcode/strftime.c \
258 tzcode/strptime.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800259 bionic/__set_errno.c \
Jin Wei22d366c2012-08-08 15:15:16 +0800260 bionic/bionic_clone.c \
Mike Chan9f691562010-03-02 10:55:58 -0800261 bionic/cpuacct.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800262 bionic/arc4random.c \
263 bionic/basename.c \
264 bionic/basename_r.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800265 bionic/clearenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800266 bionic/dirname.c \
267 bionic/dirname_r.c \
268 bionic/drand48.c \
269 bionic/erand48.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800270 bionic/err.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800271 bionic/fdprintf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800272 bionic/fork.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800273 bionic/fts.c \
Elliott Hughes04a83a42012-08-16 15:59:12 -0700274 bionic/getcwd.cpp \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800275 bionic/if_nametoindex.c \
276 bionic/if_indextoname.c \
277 bionic/ioctl.c \
278 bionic/ldexp.c \
279 bionic/libc_init_common.c \
280 bionic/logd_write.c \
281 bionic/md5.c \
282 bionic/pututline.c \
283 bionic/realpath.c \
David 'Digit' Turner72e6fd42010-12-03 18:04:01 +0100284 bionic/sched_getaffinity.c \
285 bionic/sched_getcpu.c \
286 bionic/sched_cpualloc.c \
287 bionic/sched_cpucount.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800288 bionic/semaphore.c \
289 bionic/sha1.c \
Irina Tirdeab5f053b2012-09-08 09:17:54 +0300290 bionic/strerror.cpp \
291 bionic/strerror_r.cpp \
292 bionic/strsignal.cpp \
Elliott Hughesde727ca2012-08-13 15:45:36 -0700293 bionic/stubs.cpp \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800294 bionic/system_properties.c \
Ben Cheng21eab512012-03-13 23:04:57 -0700295 bionic/tdestroy.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800296 bionic/time64.c \
297 bionic/thread_atexit.c \
298 bionic/utime.c \
299 bionic/utmp.c \
300 netbsd/gethnamaddr.c \
301 netbsd/isc/ev_timers.c \
302 netbsd/isc/ev_streams.c \
303 netbsd/inet/nsap_addr.c \
304 netbsd/resolv/__dn_comp.c \
305 netbsd/resolv/__res_close.c \
306 netbsd/resolv/__res_send.c \
307 netbsd/resolv/herror.c \
308 netbsd/resolv/res_comp.c \
309 netbsd/resolv/res_data.c \
310 netbsd/resolv/res_debug.c \
311 netbsd/resolv/res_init.c \
312 netbsd/resolv/res_mkquery.c \
313 netbsd/resolv/res_query.c \
314 netbsd/resolv/res_send.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900315 netbsd/resolv/res_state.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800316 netbsd/resolv/res_cache.c \
317 netbsd/net/nsdispatch.c \
318 netbsd/net/getaddrinfo.c \
319 netbsd/net/getnameinfo.c \
320 netbsd/net/getservbyname.c \
321 netbsd/net/getservent.c \
322 netbsd/net/base64.c \
323 netbsd/net/getservbyport.c \
324 netbsd/nameser/ns_name.c \
325 netbsd/nameser/ns_parse.c \
326 netbsd/nameser/ns_ttl.c \
327 netbsd/nameser/ns_netint.c \
328 netbsd/nameser/ns_print.c \
Colin Cross4fa7b102010-01-12 18:59:25 -0800329 netbsd/nameser/ns_samedomain.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800330
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700331libc_upstream_netbsd_src_files := \
Elliott Hughescc213f82012-08-14 15:32:42 -0700332 upstream-netbsd/libc/compat-43/creat.c \
Nick Kralevich5e58ea02012-09-12 13:21:25 -0700333 upstream-netbsd/libc/gen/ftw.c \
334 upstream-netbsd/libc/gen/nftw.c \
Elliott Hughes3d2d4482012-08-13 16:38:29 -0700335 upstream-netbsd/libc/gen/nice.c \
Irina Tirdeab5f053b2012-09-08 09:17:54 +0300336 upstream-netbsd/libc/gen/psignal.c \
Elliott Hughescc213f82012-08-14 15:32:42 -0700337 upstream-netbsd/libc/regex/regcomp.c \
338 upstream-netbsd/libc/regex/regerror.c \
339 upstream-netbsd/libc/regex/regexec.c \
340 upstream-netbsd/libc/regex/regfree.c \
Elliott Hughes409302f2012-08-13 17:02:11 -0700341 upstream-netbsd/libc/stdlib/tdelete.c \
342 upstream-netbsd/libc/stdlib/tfind.c \
343 upstream-netbsd/libc/stdlib/tsearch.c \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700344 upstream-netbsd/libc/string/strxfrm.c \
345
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700346# The following files are common, but must be compiled
347# with different C flags when building a static C library.
348#
349# The reason for this is the implementation of __get_tls()
350# that will differ between the shared and static versions
351# of the library.
352#
353# See comments in private/bionic_tls.h for more details.
354#
355# NOTE: bionic/pthread.c is added later to this list
356# because it needs special handling on ARM, see
357# below.
358#
359libc_static_common_src_files := \
360 unistd/sysconf.c \
361 bionic/__errno.c \
362
Dima Zavinca122b02009-05-27 10:52:37 -0700363# Architecture specific source files go here
364# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800365ifeq ($(TARGET_ARCH),arm)
366libc_common_src_files += \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800367 arch-arm/bionic/__get_sp.S \
368 arch-arm/bionic/_exit_with_stack_teardown.S \
369 arch-arm/bionic/_setjmp.S \
Ben Cheng017f4382012-05-08 13:36:37 -0700370 arch-arm/bionic/abort_arm.S \
David 'Digit' Turner0fec6b92011-11-16 17:37:15 +0100371 arch-arm/bionic/atomics_arm.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800372 arch-arm/bionic/clone.S \
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700373 arch-arm/bionic/eabi.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800374 arch-arm/bionic/ffs.S \
David 'Digit' Turner0fec6b92011-11-16 17:37:15 +0100375 arch-arm/bionic/futex_arm.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800376 arch-arm/bionic/kill.S \
David 'Digit' Turner2a7ad972009-09-29 14:43:38 -0700377 arch-arm/bionic/libgcc_compat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800378 arch-arm/bionic/tkill.S \
Jeff Brown10c8ce52011-11-18 15:17:07 -0800379 arch-arm/bionic/tgkill.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800380 arch-arm/bionic/memcmp.S \
381 arch-arm/bionic/memcmp16.S \
382 arch-arm/bionic/memcpy.S \
383 arch-arm/bionic/memset.S \
384 arch-arm/bionic/setjmp.S \
385 arch-arm/bionic/sigsetjmp.S \
386 arch-arm/bionic/strlen.c.arm \
Jim Huang73c04b32010-08-10 17:23:39 +0800387 arch-arm/bionic/strcpy.S \
Jim Huangf50e9be2011-04-20 15:35:04 +0800388 arch-arm/bionic/strcmp.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800389 arch-arm/bionic/syscall.S \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800390 string/strncmp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800391 unistd/socketcalls.c
392
Brent DeGraafa8c02212012-05-30 22:50:19 -0400393# Check if we want a neonized version of memmove instead of the
394# current ARM version
395ifeq ($(TARGET_USE_SCORPION_BIONIC_OPTIMIZATION),true)
396libc_common_src_files += \
397 arch-arm/bionic/memmove.S \
398 bionic/memmove_words.c
399else
400ifneq (, $(filter true,$(TARGET_USE_KRAIT_BIONIC_OPTIMIZATION) $(TARGET_USE_SPARROW_BIONIC_OPTIMIZATION)))
401 libc_common_src_files += \
402 arch-arm/bionic/memmove.S
403 else # Other ARM
404 libc_common_src_files += \
405 string/bcopy.c \
406 string/memmove.c.arm \
407 bionic/memmove_words.c
408 endif # !TARGET_USE_KRAIT_BIONIC_OPTIMIZATION
409endif # !TARGET_USE_SCORPION_BIONIC_OPTIMIZATION
410
Greg Reide5bf5b22012-10-22 16:05:45 -0400411# If the kernel supports kernel user helpers for gettimeofday, use
412# that instead.
413ifeq ($(KERNEL_HAS_GETTIMEOFDAY_HELPER),true)
414 libc_common_src_files := $(filter-out arch-arm/syscalls/gettimeofday.S,$(libc_common_src_files))
415 libc_common_src_files := $(filter-out arch-arm/syscalls/clock_gettime.S,$(libc_common_src_files))
416 libc_common_src_files += \
417 arch-arm/bionic/gettimeofday.c \
418 arch-arm/bionic/gettimeofday_syscall.S \
419 arch-arm/bionic/clock_gettime.c \
420 arch-arm/bionic/clock_gettime_syscall.S
421endif # KERNEL_HAS_GETTIMEOFDAY_HELPER
422
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800423# These files need to be arm so that gdbserver
424# can set breakpoints in them without messing
425# up any thumb code.
426libc_common_src_files += \
Matt Fischer4f086ae2010-06-25 14:36:39 -0500427 bionic/pthread-atfork.c.arm \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700428 bionic/pthread-rwlocks.c.arm \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800429 bionic/pthread-timers.c.arm \
430 bionic/ptrace.c.arm
Dima Zavinca122b02009-05-27 10:52:37 -0700431
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700432libc_static_common_src_files += \
433 bionic/pthread.c.arm \
434
Dima Zavinca122b02009-05-27 10:52:37 -0700435# these are used by the static and dynamic versions of the libc
436# respectively
437libc_arch_static_src_files := \
438 arch-arm/bionic/exidx_static.c
439
440libc_arch_dynamic_src_files := \
441 arch-arm/bionic/exidx_dynamic.c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700442endif # arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800443
444ifeq ($(TARGET_ARCH),x86)
445libc_common_src_files += \
446 arch-x86/bionic/__get_sp.S \
447 arch-x86/bionic/__get_tls.c \
448 arch-x86/bionic/__set_tls.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800449 arch-x86/bionic/clone.S \
450 arch-x86/bionic/_exit_with_stack_teardown.S \
David 'Digit' Turner0fec6b92011-11-16 17:37:15 +0100451 arch-x86/bionic/futex_x86.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800452 arch-x86/bionic/setjmp.S \
453 arch-x86/bionic/_setjmp.S \
Chih-Wei Huang18635d92010-12-14 17:55:23 +0800454 arch-x86/bionic/sigsetjmp.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800455 arch-x86/bionic/vfork.S \
Bruce Beare3c543e12010-03-04 10:29:38 -0800456 arch-x86/bionic/syscall.S \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800457 arch-x86/string/bcopy_wrapper.S \
458 arch-x86/string/memcpy_wrapper.S \
459 arch-x86/string/memmove_wrapper.S \
460 arch-x86/string/bzero_wrapper.S \
461 arch-x86/string/memcmp_wrapper.S \
462 arch-x86/string/memset_wrapper.S \
463 arch-x86/string/strcmp_wrapper.S \
464 arch-x86/string/strncmp_wrapper.S \
Bruce Beare124a5422010-10-11 12:24:41 -0700465 arch-x86/string/strlen_wrapper.S \
Jim Huang73c04b32010-08-10 17:23:39 +0800466 string/strcpy.c \
Matt Fischer4f086ae2010-06-25 14:36:39 -0500467 bionic/pthread-atfork.c \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700468 bionic/pthread-rwlocks.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800469 bionic/pthread-timers.c \
470 bionic/ptrace.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800471
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700472libc_static_common_src_files += \
473 bionic/pthread.c \
474
Dima Zavinca122b02009-05-27 10:52:37 -0700475libc_arch_static_src_files := \
Raghu Gandham405b8022012-07-25 18:16:42 -0700476 bionic/dl_iterate_phdr_static.c
Dima Zavinca122b02009-05-27 10:52:37 -0700477
478libc_arch_dynamic_src_files :=
Raghu Gandhama4c79332012-08-07 12:23:24 -0700479endif # x86
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900480
Raghu Gandhama4c79332012-08-07 12:23:24 -0700481ifeq ($(TARGET_ARCH),mips)
482libc_common_src_files += \
Raghu Gandhama4c79332012-08-07 12:23:24 -0700483 arch-mips/bionic/__get_sp.S \
484 arch-mips/bionic/__get_tls.c \
485 arch-mips/bionic/__set_tls.c \
486 arch-mips/bionic/_exit_with_stack_teardown.S \
487 arch-mips/bionic/_setjmp.S \
488 arch-mips/bionic/futex_mips.S \
489 arch-mips/bionic/bzero.S \
490 arch-mips/bionic/cacheflush.c \
491 arch-mips/bionic/clone.S \
492 arch-mips/bionic/ffs.S \
493 arch-mips/bionic/memcmp16.S \
494 arch-mips/bionic/memmove.c \
495 arch-mips/bionic/pipe.S \
496 arch-mips/bionic/setjmp.S \
497 arch-mips/bionic/sigsetjmp.S \
498 arch-mips/bionic/vfork.S
499
500libc_common_src_files += \
501 arch-mips/string/memset.S \
502 arch-mips/string/memcpy.S \
503 arch-mips/string/mips_strlen.c
504
505libc_common_src_files += \
506 string/bcopy.c \
507 string/memcmp.c \
508 string/strcmp.c \
509 string/strcpy.c \
510 string/strncmp.c
511
512libc_common_src_files += \
513 bionic/pthread-atfork.c \
514 bionic/pthread-rwlocks.c \
515 bionic/pthread-timers.c \
516 bionic/ptrace.c
517
518libc_static_common_src_files += \
519 bionic/pthread.c
520
521libc_arch_static_src_files := \
522 bionic/dl_iterate_phdr_static.c
523
524libc_arch_dynamic_src_files :=
525endif # mips
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800526
Dima Zavinca122b02009-05-27 10:52:37 -0700527# Define some common cflags
528# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800529libc_common_cflags := \
Elliott Hughes470631e2012-06-06 10:32:56 -0700530 -DWITH_ERRLIST \
531 -DANDROID_CHANGES \
Elliott Hughes470631e2012-06-06 10:32:56 -0700532 -D_LIBC=1 \
Elliott Hughes470631e2012-06-06 10:32:56 -0700533 -DFLOATING_POINT \
534 -DINET6 \
535 -I$(LOCAL_PATH)/private \
Elliott Hughes470631e2012-06-06 10:32:56 -0700536 -DPOSIX_MISTAKE \
537 -DLOG_ON_HEAP_ERROR \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700538 -std=gnu99 \
539 -Wall -Wextra
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800540
David 'Digit' Turnerd7ed1ae2010-03-05 14:17:35 -0800541# these macro definitions are required to implement the
542# 'timezone' and 'daylight' global variables, as well as
543# properly update the 'tm_gmtoff' field in 'struct tm'.
544#
545libc_common_cflags += \
546 -DTM_GMTOFF=tm_gmtoff \
547 -DUSG_COMPAT=1
548
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700549ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800550 libc_common_cflags += -DDEBUG
551endif
552
Jack Ren2fd81ef2011-11-19 09:48:03 +0800553# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
554# the appropriate BoardConfig.mk file.
555#
556ifneq ($(BOARD_MALLOC_ALIGNMENT),)
557 libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
558endif
559
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800560ifeq ($(TARGET_ARCH),arm)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700561 libc_common_cflags += -DSOFTFLOAT
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800562 libc_common_cflags += -fstrict-aliasing
Dima Zavinca122b02009-05-27 10:52:37 -0700563 libc_crt_target_cflags := -mthumb-interwork
David 'Digit' Turner4a05d122009-09-18 13:35:05 -0700564 #
565 # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
566 # that it should access the hardware TLS register directly in
567 # private/bionic_tls.h
568 #
569 # The value must match your kernel configuration
570 #
571 ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
572 libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
573 endif
Henrik Smidingfe6338d2010-09-15 16:08:03 +0200574 #
575 # Define HAVE_32_BYTE_CACHE_LINES to indicate to C
576 # library it should use to 32-byte version of memcpy, and not
577 # the 64-byte version.
578 #
579 ifeq ($(ARCH_ARM_HAVE_32_BYTE_CACHE_LINES),true)
580 libc_common_cflags += -DHAVE_32_BYTE_CACHE_LINE
581 endif
Prajakta Gudadhe08e72d02012-05-07 14:17:44 -0700582 ifeq ($(ARCH_ARM_USE_NON_NEON_MEMCPY),true)
583 libc_common_cflags += -DARCH_ARM_USE_NON_NEON_MEMCPY
584 endif
Brent DeGraafa8c02212012-05-30 22:50:19 -0400585 # Add in defines to activate SCORPION_NEON_OPTIMIZATION
586 ifeq ($(TARGET_USE_SCORPION_BIONIC_OPTIMIZATION),true)
587 libc_common_cflags += -DSCORPION_NEON_OPTIMIZATION
588 ifeq ($(TARGET_USE_SCORPION_PLD_SET),true)
589 libc_common_cflags += -DPLDOFFS=$(TARGET_SCORPION_BIONIC_PLDOFFS)
590 libc_common_cflags += -DPLDSIZE=$(TARGET_SCORPION_BIONIC_PLDSIZE)
591 endif
592 endif
593 # Add in defines to activate KRAIT_NEON_OPTIMIZATION
594 ifeq ($(TARGET_USE_KRAIT_BIONIC_OPTIMIZATION),true)
595 libc_common_cflags += -DKRAIT_NEON_OPTIMIZATION
596 ifeq ($(TARGET_USE_KRAIT_PLD_SET),true)
597 libc_common_cflags += -DPLDOFFS=$(TARGET_KRAIT_BIONIC_PLDOFFS)
598 libc_common_cflags += -DPLDTHRESH=$(TARGET_KRAIT_BIONIC_PLDTHRESH)
599 libc_common_cflags += -DPLDSIZE=$(TARGET_KRAIT_BIONIC_PLDSIZE)
600 libc_common_cflags += -DBBTHRESH=$(TARGET_KRAIT_BIONIC_BBTHRESH)
601 endif
602 endif
603 ifeq ($(TARGET_USE_SPARROW_BIONIC_OPTIMIZATION),true)
604 libc_common_cflags += -DSPARROW_NEON_OPTIMIZATION
605 endif
606 ifeq ($(TARGET_CORTEX_CACHE_LINE_32),true)
607 libc_common_cflags += -DCORTEX_CACHE_LINE_32
608 endif
Dima Zavinca122b02009-05-27 10:52:37 -0700609endif # !arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800610
Raghu Gandhama4c79332012-08-07 12:23:24 -0700611ifeq ($(TARGET_ARCH),x86)
612 libc_common_cflags += -DSOFTFLOAT
613 libc_crt_target_cflags :=
614 ifeq ($(ARCH_X86_HAVE_SSE2),true)
615 libc_crt_target_cflags += -DUSE_SSE2=1
616 endif
617 ifeq ($(ARCH_X86_HAVE_SSSE3),true)
618 libc_crt_target_cflags += -DUSE_SSSE3=1
619 endif
620endif # x86
621
622ifeq ($(TARGET_ARCH),mips)
623 ifneq ($(ARCH_MIPS_HAS_FPU),true)
624 libc_common_cflags += -DSOFTFLOAT
625 endif
626 libc_common_cflags += -fstrict-aliasing
627 libc_crt_target_cflags := $(TARGET_GLOBAL_CFLAGS)
628endif # mips
629
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700630# Define ANDROID_SMP appropriately.
631ifeq ($(TARGET_CPU_SMP),true)
632 libc_common_cflags += -DANDROID_SMP=1
633else
634 libc_common_cflags += -DANDROID_SMP=0
635endif
636
Elliott Hughes76be6602012-08-08 14:07:37 -0700637# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
638libc_crt_target_cflags += \
639 -I$(LOCAL_PATH)/include \
640 -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700641
Dima Zavinca122b02009-05-27 10:52:37 -0700642# Define some common includes
643# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800644libc_common_c_includes := \
645 $(LOCAL_PATH)/stdlib \
646 $(LOCAL_PATH)/string \
Nick Kralevich76656af2012-06-07 16:30:02 -0700647 $(LOCAL_PATH)/stdio \
648 external/safe-iop/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800649
Nick Kralevich9d403262012-05-31 11:40:10 -0700650# Needed to access private/__dso_handle.h from
David 'Digit' Turner3b43f872010-07-01 23:09:28 -0700651# crtbegin_xxx.S and crtend_xxx.S
Elliott Hughes76be6602012-08-08 14:07:37 -0700652libc_crt_target_cflags += \
653 -I$(LOCAL_PATH)/private \
654 -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800655
Dima Zavinca122b02009-05-27 10:52:37 -0700656# Define the libc run-time (crt) support object files that must be built,
657# which are needed to build all other objects (shared/static libs and
658# executables)
659# ==========================================================================
Raghu Gandhama4c79332012-08-07 12:23:24 -0700660# ARM, MIPS, and x86 all need crtbegin_so/crtend_so.
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700661#
662# For x86, the .init section must point to a function that calls all
663# entries in the .ctors section. (on ARM this is done through the
664# .init_array section instead).
665#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700666# For all the platforms, the .fini_array section must point to a function
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700667# that will call __cxa_finalize(&__dso_handle) in order to ensure that
668# static C++ destructors are properly called on dlclose().
669#
Raghu Gandhama4c79332012-08-07 12:23:24 -0700670ifeq ($(TARGET_ARCH),arm)
Elliott Hughes12949e52012-09-10 11:16:12 -0700671 libc_crtbegin_extension := c
Raghu Gandhama4c79332012-08-07 12:23:24 -0700672 libc_crt_target_so_cflags :=
David 'Digit' Turner2d2dbd32011-06-25 17:26:38 +0200673endif
Raghu Gandhama4c79332012-08-07 12:23:24 -0700674ifeq ($(TARGET_ARCH),mips)
Elliott Hughes12949e52012-09-10 11:16:12 -0700675 libc_crtbegin_extension := S
Raghu Gandhama4c79332012-08-07 12:23:24 -0700676 libc_crt_target_so_cflags := -fPIC
677endif
678ifeq ($(TARGET_ARCH),x86)
Elliott Hughes12949e52012-09-10 11:16:12 -0700679 libc_crtbegin_extension := S
Raghu Gandhama4c79332012-08-07 12:23:24 -0700680 libc_crt_target_so_cflags := -fPIC
681endif
Elliott Hughes12949e52012-09-10 11:16:12 -0700682ifeq ($(libc_crtbegin_extension),)
Raghu Gandhama4c79332012-08-07 12:23:24 -0700683 $(error $(TARGET_ARCH) not supported)
684endif
685libc_crt_target_so_cflags += $(libc_crt_target_cflags)
Elliott Hughes12949e52012-09-10 11:16:12 -0700686libc_crt_target_crtbegin_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin.$(libc_crtbegin_extension)
687libc_crt_target_crtbegin_so_file := $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.$(libc_crtbegin_extension)
Michael Hopeea8fad12012-07-31 16:18:22 +1200688
689# See the comment in crtbrand.c for the reason why we need to generate
690# crtbrand.s before generating crtbrand.o.
691GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
692$(GEN): $(LOCAL_PATH)/bionic/crtbrand.c
693 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700694 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) -S \
695 -MD -MF $(@:%.s=%.d) -o $@ $<
696 $(hide) sed -i -e '/\.note\.ABI-tag/s/progbits/note/' $@
697 $(call transform-d-to-p-args,$(@:%.s=%.d),$(@:%.s=%.P))
698-include $(GEN:%.s=%.P)
Michael Hopeea8fad12012-07-31 16:18:22 +1200699ALL_GENERATED_SOURCES += $(GEN)
700
701GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
702$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.s
703 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700704 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
Michael Hopeea8fad12012-07-31 16:18:22 +1200705ALL_GENERATED_SOURCES += $(GEN)
706
Ying Wangfc9e5252012-05-15 15:15:11 -0700707GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700708$(GEN): $(libc_crt_target_crtbegin_so_file)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800709 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700710 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) \
711 -MD -MF $(@:%.o=%.d) -o $@ -c $<
712 $(transform-d-to-p)
713-include $(GEN:%.o=%.P)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800714ALL_GENERATED_SOURCES += $(GEN)
715
Ying Wangfc9e5252012-05-15 15:15:11 -0700716GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800717$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
718 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700719 $(hide) $(TARGET_CC) $(libc_crt_target_so_cflags) \
720 -MD -MF $(@:%.o=%.d) -o $@ -c $<
721 $(transform-d-to-p)
722-include $(GEN:%.o=%.P)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800723ALL_GENERATED_SOURCES += $(GEN)
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700724
Ying Wangcf464872012-09-07 17:06:56 -0700725# The following two are installed to device
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700726GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtbegin_so.o
Ying Wangcf464872012-09-07 17:06:56 -0700727$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
728 $(hide) mkdir -p $(dir $@) && cp -f $< $@
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700729ALL_GENERATED_SOURCES += $(GEN)
730
731GEN := $(TARGET_OUT_SHARED_LIBRARIES)/crtend_so.o
Ying Wangcf464872012-09-07 17:06:56 -0700732$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
733 $(hide) mkdir -p $(dir $@) && cp -f $< $@
Shih-wei Liaofc0725e2012-07-28 00:33:28 -0700734ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800735
Dima Zavinca122b02009-05-27 10:52:37 -0700736
Michael Hopeea8fad12012-07-31 16:18:22 +1200737GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700738$(GEN): $(libc_crt_target_crtbegin_file)
Michael Hopeea8fad12012-07-31 16:18:22 +1200739 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700740 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
741 -MD -MF $(@:%.o=%.d) -o $@ -c $<
742 $(transform-d-to-p)
743-include $(GEN:%.o=%.P)
Michael Hopeea8fad12012-07-31 16:18:22 +1200744ALL_GENERATED_SOURCES += $(GEN)
745
Ying Wangfc9e5252012-05-15 15:15:11 -0700746GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200747$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
748 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700749 $(hide) $(TARGET_LD) -r -o $@ $^
Michael Hopeea8fad12012-07-31 16:18:22 +1200750ALL_GENERATED_SOURCES += $(GEN)
751
752GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o
Elliott Hughes12949e52012-09-10 11:16:12 -0700753$(GEN): $(libc_crt_target_crtbegin_file)
Dima Zavinca122b02009-05-27 10:52:37 -0700754 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700755 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
756 -MD -MF $(@:%.o=%.d) -o $@ -c $<
757 $(transform-d-to-p)
758-include $(GEN:%.o=%.P)
Dima Zavinca122b02009-05-27 10:52:37 -0700759ALL_GENERATED_SOURCES += $(GEN)
760
Ying Wangfc9e5252012-05-15 15:15:11 -0700761GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
Michael Hopeea8fad12012-07-31 16:18:22 +1200762$(GEN): $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic1.o $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbrand.o
Dima Zavinca122b02009-05-27 10:52:37 -0700763 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700764 $(hide) $(TARGET_LD) -r -o $@ $^
Dima Zavinca122b02009-05-27 10:52:37 -0700765ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800766
Dima Zavinca122b02009-05-27 10:52:37 -0700767# We rename crtend.o to crtend_android.o to avoid a
768# name clash between gcc and bionic.
Ying Wangfc9e5252012-05-15 15:15:11 -0700769GEN := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
Dima Zavinca122b02009-05-27 10:52:37 -0700770$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
771 @mkdir -p $(dir $@)
Ying Wangcf464872012-09-07 17:06:56 -0700772 $(hide) $(TARGET_CC) $(libc_crt_target_cflags) \
773 -MD -MF $(@:%.o=%.d) -o $@ -c $<
774 $(transform-d-to-p)
775-include $(GEN:%.o=%.P)
Dima Zavinca122b02009-05-27 10:52:37 -0700776ALL_GENERATED_SOURCES += $(GEN)
777
778
779# To enable malloc leak check for statically linked programs, add
780# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
781WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
782
783# ========================================================
Nick Kralevich6334c662012-07-10 10:46:19 -0700784# libbionic_ssp.a - stack protector code
785# ========================================================
786#
787# The stack protector code needs to be compiled
788# with -fno-stack-protector, since it modifies the
789# stack canary.
790
791include $(CLEAR_VARS)
792
793LOCAL_SRC_FILES := bionic/ssp.c
794LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
795LOCAL_C_INCLUDES := $(libc_common_c_includes)
796LOCAL_MODULE := libbionic_ssp
Elliott Hughesae5c6442012-08-13 14:06:05 -0700797LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Nick Kralevich6334c662012-07-10 10:46:19 -0700798LOCAL_SYSTEM_SHARED_LIBRARIES :=
799
800include $(BUILD_STATIC_LIBRARY)
801
802
803# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700804# libc_netbsd.a - upstream NetBSD C library code
805# ========================================================
806#
807# These files are built with the netbsd-compat.h header file
808# automatically included.
809
810include $(CLEAR_VARS)
811
812LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
813LOCAL_CFLAGS := \
814 $(libc_common_cflags) \
Elliott Hughes3d2d4482012-08-13 16:38:29 -0700815 -I$(LOCAL_PATH)/upstream-netbsd \
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700816 -include upstream-netbsd/netbsd-compat.h
817LOCAL_C_INCLUDES := $(libc_common_c_includes)
818LOCAL_MODULE := libc_netbsd
Elliott Hughesae5c6442012-08-13 14:06:05 -0700819LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700820LOCAL_SYSTEM_SHARED_LIBRARIES :=
821
822include $(BUILD_STATIC_LIBRARY)
823
824
825# ========================================================
Dima Zavinca122b02009-05-27 10:52:37 -0700826# libc_common.a
827# ========================================================
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700828
Dima Zavinca122b02009-05-27 10:52:37 -0700829include $(CLEAR_VARS)
830
831LOCAL_SRC_FILES := $(libc_common_src_files)
832LOCAL_CFLAGS := $(libc_common_cflags)
833LOCAL_C_INCLUDES := $(libc_common_c_includes)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800834LOCAL_MODULE := libc_common
Elliott Hughesae5c6442012-08-13 14:06:05 -0700835LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Elliott Hughesf8b3a922012-08-10 11:39:58 -0700836LOCAL_WHOLE_STATIC_LIBRARIES := libbionic_ssp libc_netbsd
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800837LOCAL_SYSTEM_SHARED_LIBRARIES :=
838
839include $(BUILD_STATIC_LIBRARY)
840
841
Dima Zavinca122b02009-05-27 10:52:37 -0700842# ========================================================
Dima Zavin49e55332009-05-27 10:52:37 -0700843# libc_nomalloc.a
844# ========================================================
845#
846# This is a version of the static C library that does not
847# include malloc. It's useful in situations when calling
848# the user wants to provide their own malloc implementation,
849# or wants to explicitly disallow the use of the use of malloc,
850# like the dynamic loader.
851
852include $(CLEAR_VARS)
853
854LOCAL_SRC_FILES := \
855 $(libc_arch_static_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700856 $(libc_static_common_src_files) \
Dima Zavin49e55332009-05-27 10:52:37 -0700857 bionic/libc_init_static.c
858
859LOCAL_C_INCLUDES := $(libc_common_c_includes)
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700860LOCAL_CFLAGS := $(libc_common_cflags) \
861 -DLIBC_STATIC
Dima Zavin49e55332009-05-27 10:52:37 -0700862
863LOCAL_MODULE := libc_nomalloc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700864LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Dima Zavin49e55332009-05-27 10:52:37 -0700865LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
866LOCAL_SYSTEM_SHARED_LIBRARIES :=
867
868include $(BUILD_STATIC_LIBRARY)
869
870
871# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800872# libc.a
873# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800874include $(CLEAR_VARS)
875
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800876LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700877 $(libc_arch_static_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700878 $(libc_static_common_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800879 bionic/dlmalloc.c \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700880 bionic/malloc_debug_common.cpp \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800881 bionic/libc_init_static.c
882
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800883LOCAL_CFLAGS := $(libc_common_cflags) \
884 -DLIBC_STATIC
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800885LOCAL_C_INCLUDES := $(libc_common_c_includes)
Dima Zavinca122b02009-05-27 10:52:37 -0700886LOCAL_MODULE := libc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700887LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800888LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800889LOCAL_SYSTEM_SHARED_LIBRARIES :=
890
891include $(BUILD_STATIC_LIBRARY)
892
893
Dima Zavinca122b02009-05-27 10:52:37 -0700894# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800895# libc.so
896# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800897include $(CLEAR_VARS)
898
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700899# pthread deadlock prediction:
900# set -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=1 to enable support for
901# pthread deadlock prediction.
902# Since this code is experimental it is disabled by default.
903# see libc/bionic/pthread_debug.c for details
904
905LOCAL_CFLAGS := $(libc_common_cflags) -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=0
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800906LOCAL_C_INCLUDES := $(libc_common_c_includes)
907
908LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700909 $(libc_arch_dynamic_src_files) \
David 'Digit' Turner6a51def2010-08-27 08:19:19 -0700910 $(libc_static_common_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800911 bionic/dlmalloc.c \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700912 bionic/malloc_debug_common.cpp \
Mathias Agopian7c0c3792011-09-05 23:54:55 -0700913 bionic/pthread_debug.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800914 bionic/libc_init_dynamic.c
915
Ard Biesheuvelf3cfcd82012-08-21 14:13:50 +0200916ifeq ($(TARGET_ARCH),arm)
917 LOCAL_NO_CRT := true
918 LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
919
920 LOCAL_SRC_FILES := \
921 arch-arm/bionic/crtbegin_so.c \
922 arch-arm/bionic/atexit_legacy.c \
923 $(LOCAL_SRC_FILES) \
924 arch-arm/bionic/crtend_so.S
925endif
926
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800927LOCAL_MODULE:= libc
Elliott Hughesae5c6442012-08-13 14:06:05 -0700928LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800929
930# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
931# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
932# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
933# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
934# should, instead relying on the external symbols from the dependent libraries. That would
935# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
936# you wanted!
937
938LOCAL_SHARED_LIBRARIES := libdl
939LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
940LOCAL_SYSTEM_SHARED_LIBRARIES :=
941
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800942include $(BUILD_SHARED_LIBRARY)
943
944
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800945# For all builds, except for the -user build we will enable memory
946# allocation checking (including memory leaks, buffer overwrites, etc.)
947# Note that all these checks are also controlled by env. settings
948# that can enable, or disable specific checks. Note also that some of
949# the checks are available only in emulator and are implemeted in
950# libc_malloc_qemu_instrumented.so.
951ifneq ($(TARGET_BUILD_VARIANT),user)
952
Dima Zavinca122b02009-05-27 10:52:37 -0700953# ========================================================
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800954# libc_malloc_debug_leak.so
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800955# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800956include $(CLEAR_VARS)
957
Dima Zavinca122b02009-05-27 10:52:37 -0700958LOCAL_CFLAGS := \
959 $(libc_common_cflags) \
960 -DMALLOC_LEAK_CHECK
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800961
962LOCAL_C_INCLUDES := $(libc_common_c_includes)
963
964LOCAL_SRC_FILES := \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700965 bionic/malloc_debug_leak.cpp \
966 bionic/malloc_debug_check.cpp \
967 bionic/malloc_debug_check_mapinfo.cpp \
968 bionic/malloc_debug_stacktrace.cpp
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800969
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800970LOCAL_MODULE:= libc_malloc_debug_leak
Elliott Hughesae5c6442012-08-13 14:06:05 -0700971LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800972
Pavel Chupine0077752012-09-10 19:35:25 +0400973LOCAL_SHARED_LIBRARIES := libc libdl
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800974LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
975LOCAL_SYSTEM_SHARED_LIBRARIES :=
Bruce Beareaa46fa22010-07-08 14:47:50 -0700976LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
Iliyan Malchev36807042011-03-14 14:02:05 -0700977
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800978# Don't install on release build
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800979LOCAL_MODULE_TAGS := eng debug
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800980
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800981include $(BUILD_SHARED_LIBRARY)
982
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800983
984# ========================================================
985# libc_malloc_debug_qemu.so
986# ========================================================
987include $(CLEAR_VARS)
988
989LOCAL_CFLAGS := \
990 $(libc_common_cflags) \
991 -DMALLOC_QEMU_INSTRUMENT
992
993LOCAL_C_INCLUDES := $(libc_common_c_includes)
994
995LOCAL_SRC_FILES := \
Elliott Hughesc4d1fec2012-08-28 14:15:04 -0700996 bionic/malloc_debug_qemu.cpp
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800997
998LOCAL_MODULE:= libc_malloc_debug_qemu
Elliott Hughesae5c6442012-08-13 14:06:05 -0700999LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001000
Mathias Agopian7c0c3792011-09-05 23:54:55 -07001001LOCAL_SHARED_LIBRARIES := libc libdl
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001002LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1003LOCAL_SYSTEM_SHARED_LIBRARIES :=
Iliyan Malchev36807042011-03-14 14:02:05 -07001004
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001005# Don't install on release build
1006LOCAL_MODULE_TAGS := eng debug
1007
1008include $(BUILD_SHARED_LIBRARY)
1009
1010endif #!user
1011
1012
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001013# ========================================================
1014include $(call all-makefiles-under,$(LOCAL_PATH))