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