Android.mk revision 4674e3899afcc6b3ac8a48cdb716695d5489d26b
1LOCAL_PATH := $(call my-dir)
2
3bionic_coverage := false
4
5# Make everything depend on any changes to included makefiles.
6libc_common_additional_dependencies := $(LOCAL_PATH)/Android.mk
7
8# Load config for TARGET_ARCH
9my_2nd_arch_prefix :=
10include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
11libc_common_additional_dependencies += \
12    $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
13
14
15ifdef TARGET_2ND_ARCH
16# Load config for TARGET_2ND_ARCH
17my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
18include $(LOCAL_PATH)/arch-$(TARGET_2ND_ARCH)/$(TARGET_2ND_ARCH).mk
19my_2nd_arch_prefix :=
20libc_common_additional_dependencies += \
21    $(LOCAL_PATH)/arch-$(TARGET_2ND_ARCH)/$(TARGET_2ND_ARCH).mk
22endif
23
24# crt obj files
25# ========================================================
26# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
27libc_crt_target_cflags := \
28    -I$(LOCAL_PATH)/include \
29    -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \
30
31my_2nd_arch_prefix :=
32include $(LOCAL_PATH)/crt.mk
33ifdef TARGET_2ND_ARCH
34my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
35include $(LOCAL_PATH)/crt.mk
36my_2nd_arch_prefix :=
37endif
38
39# Define the common source files for all the libc instances
40# =========================================================
41libc_common_src_files := \
42    bionic/bindresvport.c \
43    bionic/ether_aton.c \
44    bionic/ether_ntoa.c \
45    bionic/fts.c \
46    bionic/getpriority.c \
47    bionic/if_indextoname.c \
48    bionic/if_nametoindex.c \
49    bionic/initgroups.c \
50    bionic/ioctl.c \
51    bionic/isatty.c \
52    bionic/memmem.c \
53    bionic/pututline.c \
54    bionic/sched_cpualloc.c \
55    bionic/sched_cpucount.c \
56    bionic/sigblock.c \
57    bionic/siginterrupt.c \
58    bionic/sigsetmask.c \
59    bionic/system_properties_compat.c \
60    stdio/findfp.c \
61    stdio/fread.c \
62    stdio/snprintf.c\
63    stdio/sprintf.c \
64    stdio/stdio.c \
65    stdio/stdio_ext.cpp \
66
67# Fortify implementations of libc functions.
68libc_common_src_files += \
69    bionic/__FD_chk.cpp \
70    bionic/__fgets_chk.cpp \
71    bionic/__memmove_chk.cpp \
72    bionic/__poll_chk.cpp \
73    bionic/__read_chk.cpp \
74    bionic/__recvfrom_chk.cpp \
75    bionic/__stpcpy_chk.cpp \
76    bionic/__stpncpy_chk.cpp \
77    bionic/__strchr_chk.cpp \
78    bionic/__strlcat_chk.cpp \
79    bionic/__strlcpy_chk.cpp \
80    bionic/__strlen_chk.cpp \
81    bionic/__strncat_chk.cpp \
82    bionic/__strncpy_chk.cpp \
83    bionic/__strrchr_chk.cpp \
84    bionic/__umask_chk.cpp \
85    bionic/__vsnprintf_chk.cpp \
86    bionic/__vsprintf_chk.cpp \
87
88libc_bionic_src_files := \
89    bionic/abort.cpp \
90    bionic/accept.cpp \
91    bionic/accept4.cpp \
92    bionic/access.cpp \
93    bionic/assert.cpp \
94    bionic/atof.cpp \
95    bionic/bionic_systrace.cpp \
96    bionic/bionic_time_conversions.cpp \
97    bionic/brk.cpp \
98    bionic/c16rtomb.cpp \
99    bionic/c32rtomb.cpp \
100    bionic/chmod.cpp \
101    bionic/chown.cpp \
102    bionic/clearenv.cpp \
103    bionic/clock.cpp \
104    bionic/clock_getcpuclockid.cpp \
105    bionic/clock_nanosleep.cpp \
106    bionic/clone.cpp \
107    bionic/__cmsg_nxthdr.cpp \
108    bionic/connect.cpp \
109    bionic/ctype.cpp \
110    bionic/dirent.cpp \
111    bionic/dup2.cpp \
112    bionic/epoll_create.cpp \
113    bionic/epoll_pwait.cpp \
114    bionic/epoll_wait.cpp \
115    bionic/__errno.cpp \
116    bionic/error.cpp \
117    bionic/eventfd_read.cpp \
118    bionic/eventfd_write.cpp \
119    bionic/ffs.cpp \
120    bionic/flockfile.cpp \
121    bionic/fork.cpp \
122    bionic/fpclassify.cpp \
123    bionic/futimens.cpp \
124    bionic/getauxval.cpp \
125    bionic/getcwd.cpp \
126    bionic/getentropy_linux.c \
127    bionic/gethostname.cpp \
128    bionic/getpgrp.cpp \
129    bionic/getpid.cpp \
130    bionic/gettid.cpp \
131    bionic/__gnu_basename.cpp \
132    bionic/inotify_init.cpp \
133    bionic/lchown.cpp \
134    bionic/lfs64_support.cpp \
135    bionic/__libc_current_sigrtmax.cpp \
136    bionic/__libc_current_sigrtmin.cpp \
137    bionic/libc_init_common.cpp \
138    bionic/libc_logging.cpp \
139    bionic/libgen.cpp \
140    bionic/link.cpp \
141    bionic/locale.cpp \
142    bionic/lstat.cpp \
143    bionic/malloc_info.cpp \
144    bionic/mbrtoc16.cpp \
145    bionic/mbrtoc32.cpp \
146    bionic/mbstate.cpp \
147    bionic/mkdir.cpp \
148    bionic/mkfifo.cpp \
149    bionic/mknod.cpp \
150    bionic/mntent.cpp \
151    bionic/NetdClientDispatch.cpp \
152    bionic/open.cpp \
153    bionic/pathconf.cpp \
154    bionic/pause.cpp \
155    bionic/pipe.cpp \
156    bionic/poll.cpp \
157    bionic/posix_fadvise.cpp \
158    bionic/posix_fallocate.cpp \
159    bionic/posix_madvise.cpp \
160    bionic/posix_timers.cpp \
161    bionic/pthread_atfork.cpp \
162    bionic/pthread_attr.cpp \
163    bionic/pthread_cond.cpp \
164    bionic/pthread_create.cpp \
165    bionic/pthread_detach.cpp \
166    bionic/pthread_equal.cpp \
167    bionic/pthread_exit.cpp \
168    bionic/pthread_getcpuclockid.cpp \
169    bionic/pthread_getschedparam.cpp \
170    bionic/pthread_gettid_np.cpp \
171    bionic/pthread_internals.cpp \
172    bionic/pthread_join.cpp \
173    bionic/pthread_key.cpp \
174    bionic/pthread_kill.cpp \
175    bionic/pthread_mutex.cpp \
176    bionic/pthread_once.cpp \
177    bionic/pthread_rwlock.cpp \
178    bionic/pthread_self.cpp \
179    bionic/pthread_setname_np.cpp \
180    bionic/pthread_setschedparam.cpp \
181    bionic/pthread_sigmask.cpp \
182    bionic/ptrace.cpp \
183    bionic/pty.cpp \
184    bionic/raise.cpp \
185    bionic/rand.cpp \
186    bionic/readlink.cpp \
187    bionic/reboot.cpp \
188    bionic/recv.cpp \
189    bionic/rename.cpp \
190    bionic/rmdir.cpp \
191    bionic/scandir.cpp \
192    bionic/sched_getaffinity.cpp \
193    bionic/sched_getcpu.cpp \
194    bionic/semaphore.cpp \
195    bionic/send.cpp \
196    bionic/setegid.cpp \
197    bionic/__set_errno.cpp \
198    bionic/seteuid.cpp \
199    bionic/setpgrp.cpp \
200    bionic/sigaction.cpp \
201    bionic/sigaddset.cpp \
202    bionic/sigdelset.cpp \
203    bionic/sigemptyset.cpp \
204    bionic/sigfillset.cpp \
205    bionic/sigismember.cpp \
206    bionic/signal.cpp \
207    bionic/signalfd.cpp \
208    bionic/sigpending.cpp \
209    bionic/sigprocmask.cpp \
210    bionic/sigqueue.cpp \
211    bionic/sigsuspend.cpp \
212    bionic/sigtimedwait.cpp \
213    bionic/sigwait.cpp \
214    bionic/sigwaitinfo.cpp \
215    bionic/socket.cpp \
216    bionic/stat.cpp \
217    bionic/statvfs.cpp \
218    bionic/strerror.cpp \
219    bionic/strerror_r.cpp \
220    bionic/strsignal.cpp \
221    bionic/strtold.cpp \
222    bionic/stubs.cpp \
223    bionic/symlink.cpp \
224    bionic/sysconf.cpp \
225    bionic/sysinfo.cpp \
226    bionic/syslog.cpp \
227    bionic/sys_siglist.c \
228    bionic/sys_signame.c \
229    bionic/system_properties.cpp \
230    bionic/tdestroy.cpp \
231    bionic/termios.cpp \
232    bionic/thread_private.cpp \
233    bionic/tmpfile.cpp \
234    bionic/umount.cpp \
235    bionic/unlink.cpp \
236    bionic/utimes.cpp \
237    bionic/vdso.cpp \
238    bionic/wait.cpp \
239    bionic/wchar.cpp \
240    bionic/wctype.cpp \
241
242libc_cxa_src_files := \
243    bionic/__cxa_guard.cpp \
244    bionic/__cxa_pure_virtual.cpp \
245    bionic/new.cpp \
246
247libc_upstream_freebsd_src_files := \
248    upstream-freebsd/lib/libc/gen/ldexp.c \
249    upstream-freebsd/lib/libc/gen/sleep.c \
250    upstream-freebsd/lib/libc/gen/usleep.c \
251    upstream-freebsd/lib/libc/stdlib/abs.c \
252    upstream-freebsd/lib/libc/stdlib/getopt_long.c \
253    upstream-freebsd/lib/libc/stdlib/imaxabs.c \
254    upstream-freebsd/lib/libc/stdlib/imaxdiv.c \
255    upstream-freebsd/lib/libc/stdlib/labs.c \
256    upstream-freebsd/lib/libc/stdlib/llabs.c \
257    upstream-freebsd/lib/libc/stdlib/qsort.c \
258    upstream-freebsd/lib/libc/stdlib/quick_exit.c \
259    upstream-freebsd/lib/libc/stdlib/realpath.c \
260    upstream-freebsd/lib/libc/string/wcpcpy.c \
261    upstream-freebsd/lib/libc/string/wcpncpy.c \
262    upstream-freebsd/lib/libc/string/wcscasecmp.c \
263    upstream-freebsd/lib/libc/string/wcscspn.c \
264    upstream-freebsd/lib/libc/string/wcsdup.c \
265    upstream-freebsd/lib/libc/string/wcslcat.c \
266    upstream-freebsd/lib/libc/string/wcsncasecmp.c \
267    upstream-freebsd/lib/libc/string/wcsncat.c \
268    upstream-freebsd/lib/libc/string/wcsncmp.c \
269    upstream-freebsd/lib/libc/string/wcsncpy.c \
270    upstream-freebsd/lib/libc/string/wcsnlen.c \
271    upstream-freebsd/lib/libc/string/wcspbrk.c \
272    upstream-freebsd/lib/libc/string/wcsspn.c \
273    upstream-freebsd/lib/libc/string/wcstok.c \
274    upstream-freebsd/lib/libc/string/wmemchr.c \
275    upstream-freebsd/lib/libc/string/wmemset.c \
276
277libc_upstream_netbsd_src_files := \
278    upstream-netbsd/common/lib/libc/stdlib/random.c \
279    upstream-netbsd/lib/libc/gen/ftw.c \
280    upstream-netbsd/lib/libc/gen/nftw.c \
281    upstream-netbsd/lib/libc/gen/nice.c \
282    upstream-netbsd/lib/libc/gen/popen.c \
283    upstream-netbsd/lib/libc/gen/psignal.c \
284    upstream-netbsd/lib/libc/gen/utime.c \
285    upstream-netbsd/lib/libc/gen/utmp.c \
286    upstream-netbsd/lib/libc/inet/nsap_addr.c \
287    upstream-netbsd/lib/libc/regex/regcomp.c \
288    upstream-netbsd/lib/libc/regex/regerror.c \
289    upstream-netbsd/lib/libc/regex/regexec.c \
290    upstream-netbsd/lib/libc/regex/regfree.c \
291    upstream-netbsd/lib/libc/stdlib/bsearch.c \
292    upstream-netbsd/lib/libc/stdlib/div.c \
293    upstream-netbsd/lib/libc/stdlib/drand48.c \
294    upstream-netbsd/lib/libc/stdlib/erand48.c \
295    upstream-netbsd/lib/libc/stdlib/jrand48.c \
296    upstream-netbsd/lib/libc/stdlib/lcong48.c \
297    upstream-netbsd/lib/libc/stdlib/ldiv.c \
298    upstream-netbsd/lib/libc/stdlib/lldiv.c \
299    upstream-netbsd/lib/libc/stdlib/lrand48.c \
300    upstream-netbsd/lib/libc/stdlib/mrand48.c \
301    upstream-netbsd/lib/libc/stdlib/nrand48.c \
302    upstream-netbsd/lib/libc/stdlib/_rand48.c \
303    upstream-netbsd/lib/libc/stdlib/rand_r.c \
304    upstream-netbsd/lib/libc/stdlib/seed48.c \
305    upstream-netbsd/lib/libc/stdlib/srand48.c \
306    upstream-netbsd/lib/libc/string/memccpy.c \
307    upstream-netbsd/lib/libc/string/strcasestr.c \
308    upstream-netbsd/lib/libc/string/strcoll.c \
309    upstream-netbsd/lib/libc/string/strxfrm.c \
310
311libc_upstream_openbsd_gdtoa_src_files := \
312    upstream-openbsd/android/gdtoa_support.cpp \
313    upstream-openbsd/lib/libc/gdtoa/dmisc.c \
314    upstream-openbsd/lib/libc/gdtoa/dtoa.c \
315    upstream-openbsd/lib/libc/gdtoa/gdtoa.c \
316    upstream-openbsd/lib/libc/gdtoa/gethex.c \
317    upstream-openbsd/lib/libc/gdtoa/gmisc.c \
318    upstream-openbsd/lib/libc/gdtoa/hd_init.c \
319    upstream-openbsd/lib/libc/gdtoa/hdtoa.c \
320    upstream-openbsd/lib/libc/gdtoa/hexnan.c \
321    upstream-openbsd/lib/libc/gdtoa/ldtoa.c \
322    upstream-openbsd/lib/libc/gdtoa/misc.c \
323    upstream-openbsd/lib/libc/gdtoa/smisc.c \
324    upstream-openbsd/lib/libc/gdtoa/strtod.c \
325    upstream-openbsd/lib/libc/gdtoa/strtodg.c \
326    upstream-openbsd/lib/libc/gdtoa/strtof.c \
327    upstream-openbsd/lib/libc/gdtoa/strtord.c \
328    upstream-openbsd/lib/libc/gdtoa/sum.c \
329    upstream-openbsd/lib/libc/gdtoa/ulp.c \
330
331libc_upstream_openbsd_gdtoa_src_files_32 := \
332    $(libc_upstream_openbsd_gdtoa_src_files) \
333
334libc_upstream_openbsd_gdtoa_src_files_64 := \
335    $(libc_upstream_openbsd_gdtoa_src_files) \
336    upstream-openbsd/lib/libc/gdtoa/strtorQ.c \
337
338libc_upstream_openbsd_src_files := \
339    upstream-openbsd/lib/libc/compat-43/killpg.c \
340    upstream-openbsd/lib/libc/crypt/arc4random.c \
341    upstream-openbsd/lib/libc/crypt/arc4random_uniform.c \
342    upstream-openbsd/lib/libc/gen/alarm.c \
343    upstream-openbsd/lib/libc/gen/ctype_.c \
344    upstream-openbsd/lib/libc/gen/daemon.c \
345    upstream-openbsd/lib/libc/gen/err.c \
346    upstream-openbsd/lib/libc/gen/errx.c \
347    upstream-openbsd/lib/libc/gen/exec.c \
348    upstream-openbsd/lib/libc/gen/fnmatch.c \
349    upstream-openbsd/lib/libc/gen/ftok.c \
350    upstream-openbsd/lib/libc/gen/getprogname.c \
351    upstream-openbsd/lib/libc/gen/isctype.c \
352    upstream-openbsd/lib/libc/gen/setprogname.c \
353    upstream-openbsd/lib/libc/gen/time.c \
354    upstream-openbsd/lib/libc/gen/tolower_.c \
355    upstream-openbsd/lib/libc/gen/toupper_.c \
356    upstream-openbsd/lib/libc/gen/verr.c \
357    upstream-openbsd/lib/libc/gen/verrx.c \
358    upstream-openbsd/lib/libc/gen/vwarn.c \
359    upstream-openbsd/lib/libc/gen/vwarnx.c \
360    upstream-openbsd/lib/libc/gen/warn.c \
361    upstream-openbsd/lib/libc/gen/warnx.c \
362    upstream-openbsd/lib/libc/locale/btowc.c \
363    upstream-openbsd/lib/libc/locale/mbrlen.c \
364    upstream-openbsd/lib/libc/locale/mbstowcs.c \
365    upstream-openbsd/lib/libc/locale/mbtowc.c \
366    upstream-openbsd/lib/libc/locale/wcscoll.c \
367    upstream-openbsd/lib/libc/locale/wcstod.c \
368    upstream-openbsd/lib/libc/locale/wcstof.c \
369    upstream-openbsd/lib/libc/locale/wcstoimax.c \
370    upstream-openbsd/lib/libc/locale/wcstol.c \
371    upstream-openbsd/lib/libc/locale/wcstold.c \
372    upstream-openbsd/lib/libc/locale/wcstoll.c \
373    upstream-openbsd/lib/libc/locale/wcstombs.c \
374    upstream-openbsd/lib/libc/locale/wcstoul.c \
375    upstream-openbsd/lib/libc/locale/wcstoull.c \
376    upstream-openbsd/lib/libc/locale/wcstoumax.c \
377    upstream-openbsd/lib/libc/locale/wcsxfrm.c \
378    upstream-openbsd/lib/libc/locale/wctob.c \
379    upstream-openbsd/lib/libc/locale/wctomb.c \
380    upstream-openbsd/lib/libc/net/htonl.c \
381    upstream-openbsd/lib/libc/net/htons.c \
382    upstream-openbsd/lib/libc/net/inet_addr.c \
383    upstream-openbsd/lib/libc/net/inet_lnaof.c \
384    upstream-openbsd/lib/libc/net/inet_makeaddr.c \
385    upstream-openbsd/lib/libc/net/inet_netof.c \
386    upstream-openbsd/lib/libc/net/inet_network.c \
387    upstream-openbsd/lib/libc/net/inet_ntoa.c \
388    upstream-openbsd/lib/libc/net/inet_ntop.c \
389    upstream-openbsd/lib/libc/net/inet_pton.c \
390    upstream-openbsd/lib/libc/net/ntohl.c \
391    upstream-openbsd/lib/libc/net/ntohs.c \
392    upstream-openbsd/lib/libc/stdio/asprintf.c \
393    upstream-openbsd/lib/libc/stdio/clrerr.c \
394    upstream-openbsd/lib/libc/stdio/dprintf.c \
395    upstream-openbsd/lib/libc/stdio/fclose.c \
396    upstream-openbsd/lib/libc/stdio/fdopen.c \
397    upstream-openbsd/lib/libc/stdio/feof.c \
398    upstream-openbsd/lib/libc/stdio/ferror.c \
399    upstream-openbsd/lib/libc/stdio/fflush.c \
400    upstream-openbsd/lib/libc/stdio/fgetc.c \
401    upstream-openbsd/lib/libc/stdio/fgetln.c \
402    upstream-openbsd/lib/libc/stdio/fgetpos.c \
403    upstream-openbsd/lib/libc/stdio/fgets.c \
404    upstream-openbsd/lib/libc/stdio/fgetwc.c \
405    upstream-openbsd/lib/libc/stdio/fgetws.c \
406    upstream-openbsd/lib/libc/stdio/fileno.c \
407    upstream-openbsd/lib/libc/stdio/flags.c \
408    upstream-openbsd/lib/libc/stdio/fmemopen.c \
409    upstream-openbsd/lib/libc/stdio/fopen.c \
410    upstream-openbsd/lib/libc/stdio/fprintf.c \
411    upstream-openbsd/lib/libc/stdio/fpurge.c \
412    upstream-openbsd/lib/libc/stdio/fputc.c \
413    upstream-openbsd/lib/libc/stdio/fputs.c \
414    upstream-openbsd/lib/libc/stdio/fputwc.c \
415    upstream-openbsd/lib/libc/stdio/fputws.c \
416    upstream-openbsd/lib/libc/stdio/freopen.c \
417    upstream-openbsd/lib/libc/stdio/fscanf.c \
418    upstream-openbsd/lib/libc/stdio/fseek.c \
419    upstream-openbsd/lib/libc/stdio/fsetpos.c \
420    upstream-openbsd/lib/libc/stdio/ftell.c \
421    upstream-openbsd/lib/libc/stdio/funopen.c \
422    upstream-openbsd/lib/libc/stdio/fvwrite.c \
423    upstream-openbsd/lib/libc/stdio/fwalk.c \
424    upstream-openbsd/lib/libc/stdio/fwide.c \
425    upstream-openbsd/lib/libc/stdio/fwprintf.c \
426    upstream-openbsd/lib/libc/stdio/fwrite.c \
427    upstream-openbsd/lib/libc/stdio/fwscanf.c \
428    upstream-openbsd/lib/libc/stdio/getc.c \
429    upstream-openbsd/lib/libc/stdio/getchar.c \
430    upstream-openbsd/lib/libc/stdio/getdelim.c \
431    upstream-openbsd/lib/libc/stdio/getline.c \
432    upstream-openbsd/lib/libc/stdio/gets.c \
433    upstream-openbsd/lib/libc/stdio/getwc.c \
434    upstream-openbsd/lib/libc/stdio/getwchar.c \
435    upstream-openbsd/lib/libc/stdio/makebuf.c \
436    upstream-openbsd/lib/libc/stdio/mktemp.c \
437    upstream-openbsd/lib/libc/stdio/open_memstream.c \
438    upstream-openbsd/lib/libc/stdio/open_wmemstream.c \
439    upstream-openbsd/lib/libc/stdio/perror.c \
440    upstream-openbsd/lib/libc/stdio/printf.c \
441    upstream-openbsd/lib/libc/stdio/putc.c \
442    upstream-openbsd/lib/libc/stdio/putchar.c \
443    upstream-openbsd/lib/libc/stdio/puts.c \
444    upstream-openbsd/lib/libc/stdio/putwc.c \
445    upstream-openbsd/lib/libc/stdio/putwchar.c \
446    upstream-openbsd/lib/libc/stdio/refill.c \
447    upstream-openbsd/lib/libc/stdio/remove.c \
448    upstream-openbsd/lib/libc/stdio/rewind.c \
449    upstream-openbsd/lib/libc/stdio/rget.c \
450    upstream-openbsd/lib/libc/stdio/scanf.c \
451    upstream-openbsd/lib/libc/stdio/setbuf.c \
452    upstream-openbsd/lib/libc/stdio/setbuffer.c \
453    upstream-openbsd/lib/libc/stdio/setvbuf.c \
454    upstream-openbsd/lib/libc/stdio/sscanf.c \
455    upstream-openbsd/lib/libc/stdio/swprintf.c \
456    upstream-openbsd/lib/libc/stdio/swscanf.c \
457    upstream-openbsd/lib/libc/stdio/tempnam.c \
458    upstream-openbsd/lib/libc/stdio/tmpnam.c \
459    upstream-openbsd/lib/libc/stdio/ungetc.c \
460    upstream-openbsd/lib/libc/stdio/ungetwc.c \
461    upstream-openbsd/lib/libc/stdio/vasprintf.c \
462    upstream-openbsd/lib/libc/stdio/vdprintf.c \
463    upstream-openbsd/lib/libc/stdio/vfprintf.c \
464    upstream-openbsd/lib/libc/stdio/vfscanf.c \
465    upstream-openbsd/lib/libc/stdio/vfwprintf.c \
466    upstream-openbsd/lib/libc/stdio/vfwscanf.c \
467    upstream-openbsd/lib/libc/stdio/vprintf.c \
468    upstream-openbsd/lib/libc/stdio/vscanf.c \
469    upstream-openbsd/lib/libc/stdio/vsnprintf.c \
470    upstream-openbsd/lib/libc/stdio/vsprintf.c \
471    upstream-openbsd/lib/libc/stdio/vsscanf.c \
472    upstream-openbsd/lib/libc/stdio/vswprintf.c \
473    upstream-openbsd/lib/libc/stdio/vswscanf.c \
474    upstream-openbsd/lib/libc/stdio/vwprintf.c \
475    upstream-openbsd/lib/libc/stdio/vwscanf.c \
476    upstream-openbsd/lib/libc/stdio/wbuf.c \
477    upstream-openbsd/lib/libc/stdio/wprintf.c \
478    upstream-openbsd/lib/libc/stdio/wscanf.c \
479    upstream-openbsd/lib/libc/stdio/wsetup.c \
480    upstream-openbsd/lib/libc/stdlib/atexit.c \
481    upstream-openbsd/lib/libc/stdlib/atoi.c \
482    upstream-openbsd/lib/libc/stdlib/atol.c \
483    upstream-openbsd/lib/libc/stdlib/atoll.c \
484    upstream-openbsd/lib/libc/stdlib/exit.c \
485    upstream-openbsd/lib/libc/stdlib/getenv.c \
486    upstream-openbsd/lib/libc/stdlib/insque.c \
487    upstream-openbsd/lib/libc/stdlib/lsearch.c \
488    upstream-openbsd/lib/libc/stdlib/reallocarray.c \
489    upstream-openbsd/lib/libc/stdlib/remque.c \
490    upstream-openbsd/lib/libc/stdlib/setenv.c \
491    upstream-openbsd/lib/libc/stdlib/strtoimax.c \
492    upstream-openbsd/lib/libc/stdlib/strtol.c \
493    upstream-openbsd/lib/libc/stdlib/strtoll.c \
494    upstream-openbsd/lib/libc/stdlib/strtoul.c \
495    upstream-openbsd/lib/libc/stdlib/strtoull.c \
496    upstream-openbsd/lib/libc/stdlib/strtoumax.c \
497    upstream-openbsd/lib/libc/stdlib/system.c \
498    upstream-openbsd/lib/libc/stdlib/tfind.c \
499    upstream-openbsd/lib/libc/stdlib/tsearch.c \
500    upstream-openbsd/lib/libc/string/strcasecmp.c \
501    upstream-openbsd/lib/libc/string/strcspn.c \
502    upstream-openbsd/lib/libc/string/strdup.c \
503    upstream-openbsd/lib/libc/string/strndup.c \
504    upstream-openbsd/lib/libc/string/strpbrk.c \
505    upstream-openbsd/lib/libc/string/strsep.c \
506    upstream-openbsd/lib/libc/string/strspn.c \
507    upstream-openbsd/lib/libc/string/strstr.c \
508    upstream-openbsd/lib/libc/string/strtok.c \
509    upstream-openbsd/lib/libc/string/wmemcpy.c \
510    upstream-openbsd/lib/libc/string/wcslcpy.c \
511    upstream-openbsd/lib/libc/string/wcsstr.c \
512    upstream-openbsd/lib/libc/string/wcswidth.c \
513
514libc_arch_static_src_files := \
515    bionic/dl_iterate_phdr_static.cpp \
516
517# Define some common cflags
518# ========================================================
519libc_common_cflags := \
520    -D_LIBC=1 \
521    -Wall -Wextra -Wunused \
522
523ifneq ($(TARGET_USES_LOGD),false)
524libc_common_cflags += -DTARGET_USES_LOGD
525endif
526
527use_clang := $(USE_CLANG_PLATFORM_BUILD)
528ifeq ($(use_clang),)
529  use_clang := false
530endif
531
532# Try to catch typical 32-bit assumptions that break with 64-bit pointers.
533libc_common_cflags += \
534    -Werror=pointer-to-int-cast \
535    -Werror=int-to-pointer-cast \
536    -Werror=type-limits \
537    -Werror \
538
539ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
540  libc_common_cflags += -DDEBUG
541endif
542
543ifeq ($(MALLOC_IMPL),dlmalloc)
544  libc_common_cflags += -DUSE_DLMALLOC
545  libc_malloc_src := bionic/dlmalloc.c
546else
547  libc_common_cflags += -DUSE_JEMALLOC
548  libc_malloc_src := bionic/jemalloc_wrapper.cpp
549  libc_common_c_includes += external/jemalloc/include
550endif
551
552# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
553# the appropriate BoardConfig.mk file.
554#
555ifneq ($(BOARD_MALLOC_ALIGNMENT),)
556  libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
557endif
558
559# Define some common conlyflags
560libc_common_conlyflags := \
561    -std=gnu99
562
563# Define some common cppflags
564libc_common_cppflags := \
565    -std=gnu++11
566
567# Define some common includes
568# ========================================================
569libc_common_c_includes += \
570    $(LOCAL_PATH)/stdio   \
571
572# ========================================================
573# Add in the arch-specific flags.
574# Must be called with $(eval).
575# $(1): the LOCAL_ variable name
576# $(2): the bionic variable name to pull in
577define patch-up-arch-specific-flags
578$(1)_$(TARGET_ARCH) += $($(2)_$(TARGET_ARCH))
579ifdef TARGET_2ND_ARCH
580$(1)_$(TARGET_2ND_ARCH) += $($(2)_$(TARGET_2ND_ARCH))
581endif
582endef
583
584
585# ========================================================
586# libc_stack_protector.a - stack protector code
587# ========================================================
588#
589# The stack protector code needs to be compiled
590# with -fno-stack-protector, since it modifies the
591# stack canary.
592
593include $(CLEAR_VARS)
594
595LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
596LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
597LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
598LOCAL_CPPFLAGS := $(libc_common_cppflags)
599LOCAL_C_INCLUDES := $(libc_common_c_includes)
600LOCAL_MODULE := libc_stack_protector
601LOCAL_CLANG := $(use_clang)
602LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
603LOCAL_CXX_STL := none
604LOCAL_SYSTEM_SHARED_LIBRARIES :=
605LOCAL_ADDRESS_SANITIZER := false
606LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
607
608$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
609include $(BUILD_STATIC_LIBRARY)
610
611
612# ========================================================
613# libc_tzcode.a - upstream 'tzcode' code
614# ========================================================
615
616include $(CLEAR_VARS)
617
618LOCAL_SRC_FILES := $(call all-c-files-under,tzcode)
619# tzcode doesn't include wcsftime, so we use the OpenBSD one.
620LOCAL_SRC_FILES += upstream-openbsd/lib/libc/time/wcsftime.c
621
622LOCAL_CFLAGS := $(libc_common_cflags) \
623    -fvisibility=hidden \
624
625# Don't use ridiculous amounts of stack.
626LOCAL_CFLAGS += -DALL_STATE
627# Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
628LOCAL_CFLAGS += -DSTD_INSPIRED
629# The name of the tm_gmtoff field in our struct tm.
630LOCAL_CFLAGS += -DTM_GMTOFF=tm_gmtoff
631# Where we store our tzdata.
632LOCAL_CFLAGS += -DTZDIR=\"/system/usr/share/zoneinfo\"
633# Include timezone and daylight globals.
634LOCAL_CFLAGS += -DUSG_COMPAT=1
635LOCAL_CFLAGS += -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
636LOCAL_CFLAGS += -Dlint
637
638LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
639LOCAL_CPPFLAGS := $(libc_common_cppflags)
640LOCAL_C_INCLUDES := $(libc_common_c_includes) $(LOCAL_PATH)/tzcode/
641LOCAL_MODULE := libc_tzcode
642LOCAL_CLANG := $(use_clang)
643LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
644LOCAL_CXX_STL := none
645LOCAL_SYSTEM_SHARED_LIBRARIES :=
646LOCAL_ADDRESS_SANITIZER := false
647LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
648
649$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
650include $(BUILD_STATIC_LIBRARY)
651
652
653# ========================================================
654# libc_dns.a - modified NetBSD DNS code
655# ========================================================
656
657include $(CLEAR_VARS)
658
659LOCAL_SRC_FILES := \
660    $(call all-c-files-under,dns) \
661    upstream-netbsd/lib/libc/isc/ev_streams.c \
662    upstream-netbsd/lib/libc/isc/ev_timers.c \
663    upstream-netbsd/lib/libc/resolv/mtctxres.c \
664
665# We use the OpenBSD res_random.
666LOCAL_CFLAGS += \
667    -Dres_randomid=__res_randomid
668LOCAL_SRC_FILES += \
669    upstream-openbsd/lib/libc/net/res_random.c \
670
671LOCAL_CFLAGS += \
672    $(libc_common_cflags) \
673    -DANDROID_CHANGES \
674    -DINET6 \
675    -fvisibility=hidden \
676    -Wno-unused-parameter \
677    -I$(LOCAL_PATH)/dns/include \
678    -I$(LOCAL_PATH)/private \
679    -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
680    -I$(LOCAL_PATH)/upstream-netbsd/android/include \
681    -include netbsd-compat.h \
682
683LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
684LOCAL_CPPFLAGS := $(libc_common_cppflags)
685LOCAL_C_INCLUDES := $(libc_common_c_includes)
686LOCAL_MODULE := libc_dns
687LOCAL_CLANG := $(use_clang)
688LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
689LOCAL_CXX_STL := none
690LOCAL_SYSTEM_SHARED_LIBRARIES :=
691LOCAL_ADDRESS_SANITIZER := false
692LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
693
694$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
695include $(BUILD_STATIC_LIBRARY)
696
697
698# ========================================================
699# libc_freebsd.a - upstream FreeBSD C library code
700# ========================================================
701#
702# These files are built with the freebsd-compat.h header file
703# automatically included.
704
705include $(CLEAR_VARS)
706
707LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files)
708LOCAL_CFLAGS := \
709    $(libc_common_cflags) \
710    -Wno-sign-compare -Wno-uninitialized \
711    -I$(LOCAL_PATH)/upstream-freebsd/android/include \
712    -I$(LOCAL_PATH)/upstream-freebsd/lib/libc/include \
713    -include freebsd-compat.h \
714
715LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
716LOCAL_CPPFLAGS := $(libc_common_cppflags)
717LOCAL_C_INCLUDES := $(libc_common_c_includes)
718LOCAL_MODULE := libc_freebsd
719LOCAL_CLANG := $(use_clang)
720LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
721LOCAL_CXX_STL := none
722LOCAL_SYSTEM_SHARED_LIBRARIES :=
723LOCAL_ADDRESS_SANITIZER := false
724LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
725
726$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
727$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_freebsd_src_files))
728include $(BUILD_STATIC_LIBRARY)
729
730
731# ========================================================
732# libc_netbsd.a - upstream NetBSD C library code
733# ========================================================
734#
735# These files are built with the netbsd-compat.h header file
736# automatically included.
737
738include $(CLEAR_VARS)
739
740LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
741LOCAL_CFLAGS := \
742    $(libc_common_cflags) \
743    -Wno-sign-compare -Wno-uninitialized \
744    -DPOSIX_MISTAKE \
745    -I$(LOCAL_PATH)/upstream-netbsd/android/include \
746    -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
747    -include netbsd-compat.h \
748
749LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
750LOCAL_CPPFLAGS := $(libc_common_cppflags)
751LOCAL_C_INCLUDES := $(libc_common_c_includes)
752LOCAL_MODULE := libc_netbsd
753LOCAL_CLANG := $(use_clang)
754LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
755LOCAL_CXX_STL := none
756LOCAL_SYSTEM_SHARED_LIBRARIES :=
757LOCAL_ADDRESS_SANITIZER := false
758LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
759
760$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
761$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_netbsd_src_files))
762include $(BUILD_STATIC_LIBRARY)
763
764
765# ========================================================
766# libc_openbsd.a - upstream OpenBSD C library code
767# ========================================================
768#
769# These files are built with the openbsd-compat.h header file
770# automatically included.
771
772include $(CLEAR_VARS)
773
774LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files)
775ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
776  # Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
777  LOCAL_CLANG := false
778else
779  LOCAL_CLANG := $(use_clang)
780endif
781
782LOCAL_CFLAGS := \
783    $(libc_common_cflags) \
784    -Wno-sign-compare \
785    -Wno-uninitialized \
786    -Wno-unused-parameter \
787    -I$(LOCAL_PATH)/private \
788    -I$(LOCAL_PATH)/upstream-openbsd/android/include \
789    -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
790    -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/gdtoa/ \
791    -include openbsd-compat.h \
792
793LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
794LOCAL_CPPFLAGS := $(libc_common_cppflags)
795LOCAL_C_INCLUDES := $(libc_common_c_includes)
796LOCAL_MODULE := libc_openbsd
797LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
798LOCAL_CXX_STL := none
799LOCAL_SYSTEM_SHARED_LIBRARIES :=
800LOCAL_ADDRESS_SANITIZER := false
801LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
802
803$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
804$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_openbsd_src_files))
805include $(BUILD_STATIC_LIBRARY)
806
807
808# ========================================================
809# libc_gdtoa.a - upstream OpenBSD C library gdtoa code
810# ========================================================
811#
812# These files are built with the openbsd-compat.h header file
813# automatically included.
814
815include $(CLEAR_VARS)
816
817LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32)
818LOCAL_SRC_FILES_64 := $(libc_upstream_openbsd_gdtoa_src_files_64)
819ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
820  # Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
821  LOCAL_CLANG := false
822else
823  LOCAL_CLANG := $(use_clang)
824endif
825
826LOCAL_CFLAGS := \
827    $(libc_common_cflags) \
828    -Wno-sign-compare -Wno-uninitialized \
829    -fvisibility=hidden \
830    -I$(LOCAL_PATH)/private \
831    -I$(LOCAL_PATH)/upstream-openbsd/android/include \
832    -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
833    -include openbsd-compat.h \
834
835LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
836LOCAL_CPPFLAGS := $(libc_common_cppflags)
837LOCAL_C_INCLUDES := $(libc_common_c_includes)
838LOCAL_MODULE := libc_gdtoa
839LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
840LOCAL_CXX_STL := none
841LOCAL_SYSTEM_SHARED_LIBRARIES :=
842LOCAL_ADDRESS_SANITIZER := false
843LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
844
845$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
846include $(BUILD_STATIC_LIBRARY)
847
848
849# ========================================================
850# libc_bionic.a - home-grown C library code
851# ========================================================
852
853include $(CLEAR_VARS)
854
855LOCAL_SRC_FILES := $(libc_bionic_src_files)
856LOCAL_CFLAGS := $(libc_common_cflags) \
857    -Wframe-larger-than=2048 \
858
859# ssse3-strcmp-slm.S does not compile with Clang.
860LOCAL_CLANG_ASFLAGS_x86_64 += -no-integrated-as
861
862# memcpy.S, memchr.S, etc. do not compile with Clang.
863LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
864LOCAL_CLANG_ASFLAGS_arm64 += -no-integrated-as
865
866LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
867LOCAL_CPPFLAGS := $(libc_common_cppflags) -Wold-style-cast
868LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
869LOCAL_MODULE := libc_bionic
870LOCAL_CLANG := $(use_clang)
871LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
872LOCAL_CXX_STL := none
873LOCAL_SYSTEM_SHARED_LIBRARIES :=
874LOCAL_ADDRESS_SANITIZER := false
875LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
876
877$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
878$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_bionic_src_files))
879include $(BUILD_STATIC_LIBRARY)
880
881
882# ========================================================
883# libc_cxa.a - Things traditionally in libstdc++
884# ========================================================
885
886include $(CLEAR_VARS)
887
888LOCAL_SRC_FILES := $(libc_cxa_src_files)
889LOCAL_CFLAGS := $(libc_common_cflags) \
890    -fvisibility=hidden \
891
892LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
893LOCAL_CPPFLAGS := $(libc_common_cppflags)
894LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
895LOCAL_MODULE := libc_cxa
896LOCAL_CLANG := true # GCC refuses to hide new/delete
897LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
898LOCAL_CXX_STL := none
899LOCAL_SYSTEM_SHARED_LIBRARIES :=
900LOCAL_ADDRESS_SANITIZER := false
901# b/17574078: Need to disable coverage until we have a prebuilt libprofile_rt.
902# Since this is a static library built with clang, it needs to link
903# libprofile_rt when it is linked into the final binary. Since the final binary
904# is built with GCC, it won't link libprofile_rt. We can't very easily just add
905# libprofile_rt to all link lines the way we've done for libgcov because
906# libprofile_rt isn't prebuilt, and it would be tricky to write a rule that
907# would make sure libprofile_rt is built.
908LOCAL_NATIVE_COVERAGE := false
909
910include $(BUILD_STATIC_LIBRARY)
911
912
913# ========================================================
914# libc_syscalls.a
915# ========================================================
916
917include $(CLEAR_VARS)
918
919LOCAL_SRC_FILES_$(TARGET_ARCH) := $(call all-S-files-under,arch-$(TARGET_ARCH)/syscalls)
920ifdef TARGET_2ND_ARCH
921LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) := $(call all-S-files-under,arch-$(TARGET_2ND_ARCH)/syscalls)
922endif
923LOCAL_MODULE := libc_syscalls
924LOCAL_CLANG := $(use_clang)
925LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
926LOCAL_CXX_STL := none
927LOCAL_SYSTEM_SHARED_LIBRARIES :=
928LOCAL_ADDRESS_SANITIZER := false
929LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
930
931include $(BUILD_STATIC_LIBRARY)
932
933
934# ========================================================
935# libc_aeabi.a
936# This is an LP32 ARM-only library that needs to be built with -fno-builtin
937# to avoid infinite recursion. For the other architectures we just build an
938# empty library to keep this makefile simple.
939# ========================================================
940
941include $(CLEAR_VARS)
942
943LOCAL_SRC_FILES_arm := arch-arm/bionic/__aeabi.c
944LOCAL_MODULE := libc_aeabi
945LOCAL_CLANG := $(use_clang)
946LOCAL_CFLAGS := $(libc_common_cflags) -fno-builtin
947LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
948LOCAL_CXX_STL := none
949LOCAL_SYSTEM_SHARED_LIBRARIES :=
950LOCAL_ADDRESS_SANITIZER := false
951LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
952
953include $(BUILD_STATIC_LIBRARY)
954
955# ========================================================
956# libc_ndk.a
957# Compatibility library for the NDK. This library contains
958# all the parts of libc that are safe to statically link.
959# We can't safely statically link things that can only run
960# on a certain version of the OS. Examples include
961# anything that talks to netd (a large portion of the DNS
962# code) and anything that is dependent on the layout of a
963# data structure that has changed across releases (such as
964# pthread_t).
965# ========================================================
966
967include $(CLEAR_VARS)
968
969LOCAL_MODULE := libc_ndk
970LOCAL_WHOLE_STATIC_LIBRARIES := libc_syscalls libm
971LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
972
973include $(BUILD_STATIC_LIBRARY)
974
975# ========================================================
976# libc_common.a
977# ========================================================
978
979include $(CLEAR_VARS)
980
981LOCAL_SRC_FILES := $(libc_common_src_files)
982LOCAL_CFLAGS := $(libc_common_cflags)
983LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
984LOCAL_CPPFLAGS := $(libc_common_cppflags)
985LOCAL_C_INCLUDES := $(libc_common_c_includes)
986LOCAL_MODULE := libc_common
987LOCAL_CLANG := $(use_clang)
988LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
989LOCAL_WHOLE_STATIC_LIBRARIES := \
990    libc_bionic \
991    libc_cxa \
992    libc_dns \
993    libc_freebsd \
994    libc_gdtoa \
995    libc_malloc \
996    libc_netbsd \
997    libc_openbsd \
998    libc_stack_protector \
999    libc_syscalls \
1000    libc_tzcode \
1001
1002LOCAL_WHOLE_STATIC_LIBRARIES_arm := libc_aeabi
1003
1004ifneq ($(MALLOC_IMPL),dlmalloc)
1005LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
1006endif
1007
1008LOCAL_CXX_STL := none
1009LOCAL_SYSTEM_SHARED_LIBRARIES :=
1010
1011# TODO: split out the asflags.
1012LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
1013LOCAL_ADDRESS_SANITIZER := false
1014LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1015
1016$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1017$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_common_src_files))
1018$(eval $(call patch-up-arch-specific-flags,LOCAL_ASFLAGS,LOCAL_CFLAGS))
1019include $(BUILD_STATIC_LIBRARY)
1020
1021
1022# ========================================================
1023# libc_nomalloc.a
1024# ========================================================
1025#
1026# This is a version of the static C library that does not
1027# include malloc. It's useful in situations when the user wants
1028# to provide their own malloc implementation, or wants to
1029# explicitly disallow the use of malloc, such as in the
1030# dynamic linker.
1031
1032include $(CLEAR_VARS)
1033
1034LOCAL_SRC_FILES := \
1035    $(libc_arch_static_src_files) \
1036    $(libc_static_common_src_files) \
1037    bionic/libc_init_static.cpp
1038
1039LOCAL_C_INCLUDES := $(libc_common_c_includes)
1040LOCAL_CFLAGS := $(libc_common_cflags) \
1041    -DLIBC_STATIC \
1042
1043LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1044LOCAL_CPPFLAGS := $(libc_common_cppflags)
1045
1046LOCAL_MODULE := libc_nomalloc
1047LOCAL_CLANG := $(use_clang)
1048LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1049LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1050LOCAL_CXX_STL := none
1051LOCAL_SYSTEM_SHARED_LIBRARIES :=
1052LOCAL_ADDRESS_SANITIZER := false
1053LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1054
1055$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1056$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
1057include $(BUILD_STATIC_LIBRARY)
1058
1059
1060# ========================================================
1061# libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1062# ========================================================
1063
1064include $(CLEAR_VARS)
1065LOCAL_SRC_FILES := $(libc_malloc_src)
1066LOCAL_CFLAGS := $(libc_common_cflags) \
1067    -fvisibility=hidden \
1068
1069LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1070LOCAL_CPPFLAGS := $(libc_common_cppflags)
1071LOCAL_C_INCLUDES := $(libc_common_c_includes)
1072LOCAL_MODULE := libc_malloc
1073LOCAL_CLANG := $(use_clang)
1074LOCAL_CXX_STL := none
1075LOCAL_ADDRESS_SANITIZER := false
1076LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1077LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1078include $(BUILD_STATIC_LIBRARY)
1079
1080
1081# ========================================================
1082# libc.a
1083# ========================================================
1084include $(CLEAR_VARS)
1085
1086LOCAL_SRC_FILES := \
1087    $(libc_arch_static_src_files) \
1088    $(libc_static_common_src_files) \
1089    bionic/malloc_debug_common.cpp \
1090    bionic/libc_init_static.cpp \
1091
1092LOCAL_CFLAGS := $(libc_common_cflags) \
1093    -DLIBC_STATIC \
1094
1095LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1096LOCAL_CPPFLAGS := $(libc_common_cppflags)
1097LOCAL_C_INCLUDES := $(libc_common_c_includes)
1098LOCAL_MODULE := libc
1099LOCAL_CLANG := $(use_clang)
1100LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1101LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1102LOCAL_CXX_STL := none
1103LOCAL_SYSTEM_SHARED_LIBRARIES :=
1104LOCAL_ADDRESS_SANITIZER := false
1105LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1106
1107$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1108$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
1109include $(BUILD_STATIC_LIBRARY)
1110
1111
1112# ========================================================
1113# libc.so
1114# ========================================================
1115include $(CLEAR_VARS)
1116
1117LOCAL_CFLAGS := $(libc_common_cflags)
1118LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1119LOCAL_CPPFLAGS := $(libc_common_cppflags)
1120LOCAL_C_INCLUDES := $(libc_common_c_includes)
1121LOCAL_SRC_FILES := \
1122    $(libc_arch_dynamic_src_files) \
1123    $(libc_static_common_src_files) \
1124    bionic/malloc_debug_common.cpp \
1125    bionic/libc_init_dynamic.cpp \
1126    bionic/NetdClient.cpp \
1127
1128LOCAL_MODULE := libc
1129LOCAL_CLANG := $(use_clang)
1130LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1131LOCAL_REQUIRED_MODULES := tzdata
1132
1133# Leave the symbols in the shared library so that stack unwinders can produce
1134# meaningful name resolution.
1135LOCAL_STRIP_MODULE := keep_symbols
1136
1137# WARNING: The only library libc.so should depend on is libdl.so!  If you add other libraries,
1138# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries.  This
1139# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
1140# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
1141# should, instead relying on the external symbols from the dependent libraries.  That would
1142# create a "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
1143# you wanted!
1144
1145LOCAL_SHARED_LIBRARIES := libdl
1146LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1147LOCAL_CXX_STL := none
1148LOCAL_SYSTEM_SHARED_LIBRARIES :=
1149
1150# We'd really like to do this for all architectures, but since this wasn't done
1151# before, these symbols must continue to be exported on LP32 for binary
1152# compatibility.
1153LOCAL_LDFLAGS_arm64 := -Wl,--exclude-libs,libgcc.a
1154LOCAL_LDFLAGS_mips64 := -Wl,--exclude-libs,libgcc.a
1155LOCAL_LDFLAGS_x86_64 := -Wl,--exclude-libs,libgcc.a
1156
1157$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1158$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src_files))
1159$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_static_common_src_files))
1160# special for arm
1161LOCAL_NO_CRT_arm := true
1162LOCAL_CFLAGS_arm += -DCRT_LEGACY_WORKAROUND
1163LOCAL_SRC_FILES_arm += \
1164    arch-common/bionic/crtbegin_so.c \
1165    arch-arm/bionic/atexit_legacy.c \
1166    arch-common/bionic/crtend_so.S
1167LOCAL_ADDRESS_SANITIZER := false
1168LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1169
1170include $(BUILD_SHARED_LIBRARY)
1171
1172
1173# For all builds, except for the -user build we will enable memory
1174# allocation checking (including memory leaks, buffer overwrites, etc.)
1175# Note that all these checks are also controlled by env. settings
1176# that can enable, or disable specific checks. Note also that some of
1177# the checks are available only in emulator and are implemeted in
1178# libc_malloc_qemu_instrumented.so.
1179ifneq ($(TARGET_BUILD_VARIANT),user)
1180
1181# ========================================================
1182# libc_malloc_debug_leak.so
1183# ========================================================
1184include $(CLEAR_VARS)
1185
1186LOCAL_CFLAGS := $(libc_common_cflags)
1187LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1188LOCAL_CPPFLAGS := $(libc_common_cppflags)
1189
1190# Make sure that unwind.h comes from libunwind.
1191LOCAL_C_INCLUDES := \
1192    $(libc_common_c_includes) \
1193
1194LOCAL_SRC_FILES := \
1195    bionic/debug_mapinfo.cpp \
1196    bionic/debug_stacktrace.cpp \
1197    bionic/libc_logging.cpp \
1198    bionic/malloc_debug_leak.cpp \
1199    bionic/malloc_debug_check.cpp \
1200
1201LOCAL_MODULE := libc_malloc_debug_leak
1202LOCAL_CLANG := $(use_clang)
1203LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1204
1205LOCAL_SHARED_LIBRARIES := libc libdl
1206LOCAL_CXX_STL := none
1207LOCAL_SYSTEM_SHARED_LIBRARIES :=
1208# Only need this for arm since libc++ uses its own unwind code that
1209# doesn't mix with the other default unwind code.
1210LOCAL_STATIC_LIBRARIES_arm := libunwind_llvm libc++abi
1211LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
1212
1213# Don't install on release build
1214LOCAL_MODULE_TAGS := eng debug
1215LOCAL_ADDRESS_SANITIZER := false
1216LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1217
1218$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1219include $(BUILD_SHARED_LIBRARY)
1220
1221
1222# ========================================================
1223# libc_malloc_debug_qemu.so
1224# ========================================================
1225include $(CLEAR_VARS)
1226
1227LOCAL_CFLAGS := \
1228    $(libc_common_cflags) \
1229    -DMALLOC_QEMU_INSTRUMENT \
1230
1231LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1232LOCAL_CPPFLAGS := $(libc_common_cppflags)
1233
1234LOCAL_C_INCLUDES := $(libc_common_c_includes)
1235
1236LOCAL_SRC_FILES := \
1237    bionic/libc_logging.cpp \
1238    bionic/malloc_debug_qemu.cpp \
1239
1240LOCAL_MODULE := libc_malloc_debug_qemu
1241LOCAL_CLANG := $(use_clang)
1242LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1243
1244LOCAL_SHARED_LIBRARIES := libc libdl
1245LOCAL_CXX_STL := none
1246LOCAL_SYSTEM_SHARED_LIBRARIES :=
1247
1248# Don't install on release build
1249LOCAL_MODULE_TAGS := eng debug
1250LOCAL_ADDRESS_SANITIZER := false
1251LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1252
1253$(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1254include $(BUILD_SHARED_LIBRARY)
1255
1256endif  #!user
1257
1258# ========================================================
1259# libstdc++.so
1260# ========================================================
1261libstdcxx_common_src_files := \
1262    bionic/__cxa_guard.cpp \
1263    bionic/__cxa_pure_virtual.cpp \
1264    bionic/new.cpp \
1265    bionic/libc_logging.cpp \
1266
1267include $(CLEAR_VARS)
1268LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
1269LOCAL_CFLAGS := $(libc_common_cflags)
1270LOCAL_CPPFLAGS := $(libc_common_cppflags)
1271LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1272LOCAL_MODULE:= libstdc++
1273LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1274LOCAL_CXX_STL := none
1275LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1276LOCAL_ADDRESS_SANITIZER := false
1277LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1278include $(BUILD_SHARED_LIBRARY)
1279
1280# ========================================================
1281# libstdc++.a
1282# ========================================================
1283include $(CLEAR_VARS)
1284LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
1285LOCAL_CFLAGS := $(libc_common_cflags)
1286LOCAL_CPPFLAGS := $(libc_common_cppflags)
1287LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1288LOCAL_MODULE:= libstdc++
1289LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1290LOCAL_CXX_STL := none
1291LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1292LOCAL_ADDRESS_SANITIZER := false
1293LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1294include $(BUILD_STATIC_LIBRARY)
1295
1296
1297# ========================================================
1298include $(call all-makefiles-under,$(LOCAL_PATH))
1299