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