Merge "support _POSIX_REALTIME_SIGNALS"
[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_madvise.cpp \
157     bionic/posix_timers.cpp \
158     bionic/pthread_atfork.cpp \
159     bionic/pthread_attr.cpp \
160     bionic/pthread_cond.cpp \
161     bionic/pthread_create.cpp \
162     bionic/pthread_detach.cpp \
163     bionic/pthread_equal.cpp \
164     bionic/pthread_exit.cpp \
165     bionic/pthread_getcpuclockid.cpp \
166     bionic/pthread_getschedparam.cpp \
167     bionic/pthread_gettid_np.cpp \
168     bionic/pthread_internals.cpp \
169     bionic/pthread_join.cpp \
170     bionic/pthread_key.cpp \
171     bionic/pthread_kill.cpp \
172     bionic/pthread_mutex.cpp \
173     bionic/pthread_once.cpp \
174     bionic/pthread_rwlock.cpp \
175     bionic/pthread_self.cpp \
176     bionic/pthread_setname_np.cpp \
177     bionic/pthread_setschedparam.cpp \
178     bionic/pthread_sigmask.cpp \
179     bionic/ptrace.cpp \
180     bionic/pty.cpp \
181     bionic/raise.cpp \
182     bionic/rand.cpp \
183     bionic/readlink.cpp \
184     bionic/reboot.cpp \
185     bionic/recv.cpp \
186     bionic/rename.cpp \
187     bionic/rmdir.cpp \
188     bionic/scandir.cpp \
189     bionic/sched_getaffinity.cpp \
190     bionic/sched_getcpu.cpp \
191     bionic/semaphore.cpp \
192     bionic/send.cpp \
193     bionic/setegid.cpp \
194     bionic/__set_errno.cpp \
195     bionic/seteuid.cpp \
196     bionic/setpgrp.cpp \
197     bionic/sigaction.cpp \
198     bionic/sigaddset.cpp \
199     bionic/sigdelset.cpp \
200     bionic/sigemptyset.cpp \
201     bionic/sigfillset.cpp \
202     bionic/sigismember.cpp \
203     bionic/signal.cpp \
204     bionic/signalfd.cpp \
205     bionic/sigpending.cpp \
206     bionic/sigprocmask.cpp \
207     bionic/sigqueue.cpp \
208     bionic/sigsuspend.cpp \
209     bionic/sigtimedwait.cpp \
210     bionic/sigwait.cpp \
211     bionic/sigwaitinfo.cpp \
212     bionic/socket.cpp \
213     bionic/stat.cpp \
214     bionic/statvfs.cpp \
215     bionic/strerror.cpp \
216     bionic/strerror_r.cpp \
217     bionic/strsignal.cpp \
218     bionic/strtold.cpp \
219     bionic/stubs.cpp \
220     bionic/symlink.cpp \
221     bionic/sysconf.cpp \
222     bionic/sysinfo.cpp \
223     bionic/syslog.cpp \
224     bionic/sys_siglist.c \
225     bionic/sys_signame.c \
226     bionic/system_properties.cpp \
227     bionic/tdestroy.cpp \
228     bionic/termios.cpp \
229     bionic/thread_private.cpp \
230     bionic/tmpfile.cpp \
231     bionic/umount.cpp \
232     bionic/unlink.cpp \
233     bionic/utimes.cpp \
234     bionic/vdso.cpp \
235     bionic/wait.cpp \
236     bionic/wchar.cpp \
237     bionic/wctype.cpp \
239 libc_cxa_src_files := \
240     bionic/__cxa_guard.cpp \
241     bionic/__cxa_pure_virtual.cpp \
242     bionic/new.cpp \
244 libc_upstream_freebsd_src_files := \
245     upstream-freebsd/lib/libc/gen/ldexp.c \
246     upstream-freebsd/lib/libc/gen/sleep.c \
247     upstream-freebsd/lib/libc/gen/usleep.c \
248     upstream-freebsd/lib/libc/stdlib/abs.c \
249     upstream-freebsd/lib/libc/stdlib/getopt_long.c \
250     upstream-freebsd/lib/libc/stdlib/imaxabs.c \
251     upstream-freebsd/lib/libc/stdlib/imaxdiv.c \
252     upstream-freebsd/lib/libc/stdlib/labs.c \
253     upstream-freebsd/lib/libc/stdlib/llabs.c \
254     upstream-freebsd/lib/libc/stdlib/qsort.c \
255     upstream-freebsd/lib/libc/stdlib/quick_exit.c \
256     upstream-freebsd/lib/libc/stdlib/realpath.c \
257     upstream-freebsd/lib/libc/string/wcpcpy.c \
258     upstream-freebsd/lib/libc/string/wcpncpy.c \
259     upstream-freebsd/lib/libc/string/wcscasecmp.c \
260     upstream-freebsd/lib/libc/string/wcscspn.c \
261     upstream-freebsd/lib/libc/string/wcsdup.c \
262     upstream-freebsd/lib/libc/string/wcslcat.c \
263     upstream-freebsd/lib/libc/string/wcsncasecmp.c \
264     upstream-freebsd/lib/libc/string/wcsncat.c \
265     upstream-freebsd/lib/libc/string/wcsncmp.c \
266     upstream-freebsd/lib/libc/string/wcsncpy.c \
267     upstream-freebsd/lib/libc/string/wcsnlen.c \
268     upstream-freebsd/lib/libc/string/wcspbrk.c \
269     upstream-freebsd/lib/libc/string/wcsspn.c \
270     upstream-freebsd/lib/libc/string/wcstok.c \
271     upstream-freebsd/lib/libc/string/wmemchr.c \
272     upstream-freebsd/lib/libc/string/wmemcpy.c \
273     upstream-freebsd/lib/libc/string/wmemset.c \
275 libc_upstream_netbsd_src_files := \
276     upstream-netbsd/common/lib/libc/stdlib/random.c \
277     upstream-netbsd/lib/libc/gen/ftw.c \
278     upstream-netbsd/lib/libc/gen/nftw.c \
279     upstream-netbsd/lib/libc/gen/nice.c \
280     upstream-netbsd/lib/libc/gen/popen.c \
281     upstream-netbsd/lib/libc/gen/psignal.c \
282     upstream-netbsd/lib/libc/gen/utime.c \
283     upstream-netbsd/lib/libc/gen/utmp.c \
284     upstream-netbsd/lib/libc/inet/nsap_addr.c \
285     upstream-netbsd/lib/libc/regex/regcomp.c \
286     upstream-netbsd/lib/libc/regex/regerror.c \
287     upstream-netbsd/lib/libc/regex/regexec.c \
288     upstream-netbsd/lib/libc/regex/regfree.c \
289     upstream-netbsd/lib/libc/stdlib/bsearch.c \
290     upstream-netbsd/lib/libc/stdlib/div.c \
291     upstream-netbsd/lib/libc/stdlib/drand48.c \
292     upstream-netbsd/lib/libc/stdlib/erand48.c \
293     upstream-netbsd/lib/libc/stdlib/jrand48.c \
294     upstream-netbsd/lib/libc/stdlib/lcong48.c \
295     upstream-netbsd/lib/libc/stdlib/ldiv.c \
296     upstream-netbsd/lib/libc/stdlib/lldiv.c \
297     upstream-netbsd/lib/libc/stdlib/lrand48.c \
298     upstream-netbsd/lib/libc/stdlib/mrand48.c \
299     upstream-netbsd/lib/libc/stdlib/nrand48.c \
300     upstream-netbsd/lib/libc/stdlib/_rand48.c \
301     upstream-netbsd/lib/libc/stdlib/rand_r.c \
302     upstream-netbsd/lib/libc/stdlib/seed48.c \
303     upstream-netbsd/lib/libc/stdlib/srand48.c \
304     upstream-netbsd/lib/libc/string/memccpy.c \
305     upstream-netbsd/lib/libc/string/strcasestr.c \
306     upstream-netbsd/lib/libc/string/strcoll.c \
307     upstream-netbsd/lib/libc/string/strxfrm.c \
309 libc_upstream_openbsd_gdtoa_src_files := \
310     upstream-openbsd/android/gdtoa_support.cpp \
311     upstream-openbsd/lib/libc/gdtoa/dmisc.c \
312     upstream-openbsd/lib/libc/gdtoa/dtoa.c \
313     upstream-openbsd/lib/libc/gdtoa/gdtoa.c \
314     upstream-openbsd/lib/libc/gdtoa/gethex.c \
315     upstream-openbsd/lib/libc/gdtoa/gmisc.c \
316     upstream-openbsd/lib/libc/gdtoa/hd_init.c \
317     upstream-openbsd/lib/libc/gdtoa/hdtoa.c \
318     upstream-openbsd/lib/libc/gdtoa/hexnan.c \
319     upstream-openbsd/lib/libc/gdtoa/ldtoa.c \
320     upstream-openbsd/lib/libc/gdtoa/misc.c \
321     upstream-openbsd/lib/libc/gdtoa/smisc.c \
322     upstream-openbsd/lib/libc/gdtoa/strtod.c \
323     upstream-openbsd/lib/libc/gdtoa/strtodg.c \
324     upstream-openbsd/lib/libc/gdtoa/strtof.c \
325     upstream-openbsd/lib/libc/gdtoa/strtord.c \
326     upstream-openbsd/lib/libc/gdtoa/sum.c \
327     upstream-openbsd/lib/libc/gdtoa/ulp.c \
329 libc_upstream_openbsd_gdtoa_src_files_32 := \
330     $(libc_upstream_openbsd_gdtoa_src_files) \
332 libc_upstream_openbsd_gdtoa_src_files_64 := \
333     $(libc_upstream_openbsd_gdtoa_src_files) \
334     upstream-openbsd/lib/libc/gdtoa/strtorQ.c \
336 libc_upstream_openbsd_src_files := \
337     upstream-openbsd/lib/libc/compat-43/killpg.c \
338     upstream-openbsd/lib/libc/crypt/arc4random.c \
339     upstream-openbsd/lib/libc/crypt/arc4random_uniform.c \
340     upstream-openbsd/lib/libc/gen/alarm.c \
341     upstream-openbsd/lib/libc/gen/ctype_.c \
342     upstream-openbsd/lib/libc/gen/daemon.c \
343     upstream-openbsd/lib/libc/gen/err.c \
344     upstream-openbsd/lib/libc/gen/errx.c \
345     upstream-openbsd/lib/libc/gen/exec.c \
346     upstream-openbsd/lib/libc/gen/fnmatch.c \
347     upstream-openbsd/lib/libc/gen/ftok.c \
348     upstream-openbsd/lib/libc/gen/getprogname.c \
349     upstream-openbsd/lib/libc/gen/isctype.c \
350     upstream-openbsd/lib/libc/gen/setprogname.c \
351     upstream-openbsd/lib/libc/gen/time.c \
352     upstream-openbsd/lib/libc/gen/tolower_.c \
353     upstream-openbsd/lib/libc/gen/toupper_.c \
354     upstream-openbsd/lib/libc/gen/verr.c \
355     upstream-openbsd/lib/libc/gen/verrx.c \
356     upstream-openbsd/lib/libc/gen/vwarn.c \
357     upstream-openbsd/lib/libc/gen/vwarnx.c \
358     upstream-openbsd/lib/libc/gen/warn.c \
359     upstream-openbsd/lib/libc/gen/warnx.c \
360     upstream-openbsd/lib/libc/locale/btowc.c \
361     upstream-openbsd/lib/libc/locale/mbrlen.c \
362     upstream-openbsd/lib/libc/locale/mbstowcs.c \
363     upstream-openbsd/lib/libc/locale/mbtowc.c \
364     upstream-openbsd/lib/libc/locale/wcscoll.c \
365     upstream-openbsd/lib/libc/locale/wcstod.c \
366     upstream-openbsd/lib/libc/locale/wcstof.c \
367     upstream-openbsd/lib/libc/locale/wcstoimax.c \
368     upstream-openbsd/lib/libc/locale/wcstol.c \
369     upstream-openbsd/lib/libc/locale/wcstold.c \
370     upstream-openbsd/lib/libc/locale/wcstoll.c \
371     upstream-openbsd/lib/libc/locale/wcstombs.c \
372     upstream-openbsd/lib/libc/locale/wcstoul.c \
373     upstream-openbsd/lib/libc/locale/wcstoull.c \
374     upstream-openbsd/lib/libc/locale/wcstoumax.c \
375     upstream-openbsd/lib/libc/locale/wcsxfrm.c \
376     upstream-openbsd/lib/libc/locale/wctob.c \
377     upstream-openbsd/lib/libc/locale/wctomb.c \
378     upstream-openbsd/lib/libc/net/htonl.c \
379     upstream-openbsd/lib/libc/net/htons.c \
380     upstream-openbsd/lib/libc/net/inet_addr.c \
381     upstream-openbsd/lib/libc/net/inet_lnaof.c \
382     upstream-openbsd/lib/libc/net/inet_makeaddr.c \
383     upstream-openbsd/lib/libc/net/inet_netof.c \
384     upstream-openbsd/lib/libc/net/inet_network.c \
385     upstream-openbsd/lib/libc/net/inet_ntoa.c \
386     upstream-openbsd/lib/libc/net/inet_ntop.c \
387     upstream-openbsd/lib/libc/net/inet_pton.c \
388     upstream-openbsd/lib/libc/net/ntohl.c \
389     upstream-openbsd/lib/libc/net/ntohs.c \
390     upstream-openbsd/lib/libc/stdio/asprintf.c \
391     upstream-openbsd/lib/libc/stdio/clrerr.c \
392     upstream-openbsd/lib/libc/stdio/dprintf.c \
393     upstream-openbsd/lib/libc/stdio/fclose.c \
394     upstream-openbsd/lib/libc/stdio/fdopen.c \
395     upstream-openbsd/lib/libc/stdio/feof.c \
396     upstream-openbsd/lib/libc/stdio/ferror.c \
397     upstream-openbsd/lib/libc/stdio/fflush.c \
398     upstream-openbsd/lib/libc/stdio/fgetc.c \
399     upstream-openbsd/lib/libc/stdio/fgetln.c \
400     upstream-openbsd/lib/libc/stdio/fgetpos.c \
401     upstream-openbsd/lib/libc/stdio/fgets.c \
402     upstream-openbsd/lib/libc/stdio/fgetwc.c \
403     upstream-openbsd/lib/libc/stdio/fgetws.c \
404     upstream-openbsd/lib/libc/stdio/fileno.c \
405     upstream-openbsd/lib/libc/stdio/flags.c \
406     upstream-openbsd/lib/libc/stdio/fmemopen.c \
407     upstream-openbsd/lib/libc/stdio/fopen.c \
408     upstream-openbsd/lib/libc/stdio/fprintf.c \
409     upstream-openbsd/lib/libc/stdio/fpurge.c \
410     upstream-openbsd/lib/libc/stdio/fputc.c \
411     upstream-openbsd/lib/libc/stdio/fputs.c \
412     upstream-openbsd/lib/libc/stdio/fputwc.c \
413     upstream-openbsd/lib/libc/stdio/fputws.c \
414     upstream-openbsd/lib/libc/stdio/freopen.c \
415     upstream-openbsd/lib/libc/stdio/fscanf.c \
416     upstream-openbsd/lib/libc/stdio/fseek.c \
417     upstream-openbsd/lib/libc/stdio/fsetpos.c \
418     upstream-openbsd/lib/libc/stdio/ftell.c \
419     upstream-openbsd/lib/libc/stdio/funopen.c \
420     upstream-openbsd/lib/libc/stdio/fvwrite.c \
421     upstream-openbsd/lib/libc/stdio/fwalk.c \
422     upstream-openbsd/lib/libc/stdio/fwide.c \
423     upstream-openbsd/lib/libc/stdio/fwprintf.c \
424     upstream-openbsd/lib/libc/stdio/fwrite.c \
425     upstream-openbsd/lib/libc/stdio/fwscanf.c \
426     upstream-openbsd/lib/libc/stdio/getc.c \
427     upstream-openbsd/lib/libc/stdio/getchar.c \
428     upstream-openbsd/lib/libc/stdio/getdelim.c \
429     upstream-openbsd/lib/libc/stdio/getline.c \
430     upstream-openbsd/lib/libc/stdio/gets.c \
431     upstream-openbsd/lib/libc/stdio/getwc.c \
432     upstream-openbsd/lib/libc/stdio/getwchar.c \
433     upstream-openbsd/lib/libc/stdio/makebuf.c \
434     upstream-openbsd/lib/libc/stdio/mktemp.c \
435     upstream-openbsd/lib/libc/stdio/open_memstream.c \
436     upstream-openbsd/lib/libc/stdio/open_wmemstream.c \
437     upstream-openbsd/lib/libc/stdio/perror.c \
438     upstream-openbsd/lib/libc/stdio/printf.c \
439     upstream-openbsd/lib/libc/stdio/putc.c \
440     upstream-openbsd/lib/libc/stdio/putchar.c \
441     upstream-openbsd/lib/libc/stdio/puts.c \
442     upstream-openbsd/lib/libc/stdio/putwc.c \
443     upstream-openbsd/lib/libc/stdio/putwchar.c \
444     upstream-openbsd/lib/libc/stdio/refill.c \
445     upstream-openbsd/lib/libc/stdio/remove.c \
446     upstream-openbsd/lib/libc/stdio/rewind.c \
447     upstream-openbsd/lib/libc/stdio/rget.c \
448     upstream-openbsd/lib/libc/stdio/scanf.c \
449     upstream-openbsd/lib/libc/stdio/setbuf.c \
450     upstream-openbsd/lib/libc/stdio/setbuffer.c \
451     upstream-openbsd/lib/libc/stdio/setvbuf.c \
452     upstream-openbsd/lib/libc/stdio/sscanf.c \
453     upstream-openbsd/lib/libc/stdio/stdio.c \
454     upstream-openbsd/lib/libc/stdio/swprintf.c \
455     upstream-openbsd/lib/libc/stdio/swscanf.c \
456     upstream-openbsd/lib/libc/stdio/tempnam.c \
457     upstream-openbsd/lib/libc/stdio/tmpnam.c \
458     upstream-openbsd/lib/libc/stdio/ungetc.c \
459     upstream-openbsd/lib/libc/stdio/ungetwc.c \
460     upstream-openbsd/lib/libc/stdio/vasprintf.c \
461     upstream-openbsd/lib/libc/stdio/vdprintf.c \
462     upstream-openbsd/lib/libc/stdio/vfprintf.c \
463     upstream-openbsd/lib/libc/stdio/vfscanf.c \
464     upstream-openbsd/lib/libc/stdio/vfwprintf.c \
465     upstream-openbsd/lib/libc/stdio/vfwscanf.c \
466     upstream-openbsd/lib/libc/stdio/vprintf.c \
467     upstream-openbsd/lib/libc/stdio/vscanf.c \
468     upstream-openbsd/lib/libc/stdio/vsnprintf.c \
469     upstream-openbsd/lib/libc/stdio/vsprintf.c \
470     upstream-openbsd/lib/libc/stdio/vsscanf.c \
471     upstream-openbsd/lib/libc/stdio/vswprintf.c \
472     upstream-openbsd/lib/libc/stdio/vswscanf.c \
473     upstream-openbsd/lib/libc/stdio/vwprintf.c \
474     upstream-openbsd/lib/libc/stdio/vwscanf.c \
475     upstream-openbsd/lib/libc/stdio/wbuf.c \
476     upstream-openbsd/lib/libc/stdio/wprintf.c \
477     upstream-openbsd/lib/libc/stdio/wscanf.c \
478     upstream-openbsd/lib/libc/stdio/wsetup.c \
479     upstream-openbsd/lib/libc/stdlib/atexit.c \
480     upstream-openbsd/lib/libc/stdlib/atoi.c \
481     upstream-openbsd/lib/libc/stdlib/atol.c \
482     upstream-openbsd/lib/libc/stdlib/atoll.c \
483     upstream-openbsd/lib/libc/stdlib/exit.c \
484     upstream-openbsd/lib/libc/stdlib/getenv.c \
485     upstream-openbsd/lib/libc/stdlib/insque.c \
486     upstream-openbsd/lib/libc/stdlib/lsearch.c \
487     upstream-openbsd/lib/libc/stdlib/reallocarray.c \
488     upstream-openbsd/lib/libc/stdlib/remque.c \
489     upstream-openbsd/lib/libc/stdlib/setenv.c \
490     upstream-openbsd/lib/libc/stdlib/strtoimax.c \
491     upstream-openbsd/lib/libc/stdlib/strtol.c \
492     upstream-openbsd/lib/libc/stdlib/strtoll.c \
493     upstream-openbsd/lib/libc/stdlib/strtoul.c \
494     upstream-openbsd/lib/libc/stdlib/strtoull.c \
495     upstream-openbsd/lib/libc/stdlib/strtoumax.c \
496     upstream-openbsd/lib/libc/stdlib/system.c \
497     upstream-openbsd/lib/libc/stdlib/tfind.c \
498     upstream-openbsd/lib/libc/stdlib/tsearch.c \
499     upstream-openbsd/lib/libc/string/strcasecmp.c \
500     upstream-openbsd/lib/libc/string/strcspn.c \
501     upstream-openbsd/lib/libc/string/strdup.c \
502     upstream-openbsd/lib/libc/string/strndup.c \
503     upstream-openbsd/lib/libc/string/strpbrk.c \
504     upstream-openbsd/lib/libc/string/strsep.c \
505     upstream-openbsd/lib/libc/string/strspn.c \
506     upstream-openbsd/lib/libc/string/strstr.c \
507     upstream-openbsd/lib/libc/string/strtok.c \
508     upstream-openbsd/lib/libc/string/wcslcpy.c \
509     upstream-openbsd/lib/libc/string/wcsstr.c \
510     upstream-openbsd/lib/libc/string/wcswidth.c \
512 libc_arch_static_src_files := \
513     bionic/dl_iterate_phdr_static.cpp \
515 # Define some common cflags
516 # ========================================================
517 libc_common_cflags := \
518     -D_LIBC=1 \
519     -Wall -Wextra -Wunused \
521 ifneq ($(TARGET_USES_LOGD),false)
522 libc_common_cflags += -DTARGET_USES_LOGD
523 endif
525 use_clang := $(USE_CLANG_PLATFORM_BUILD)
526 ifeq ($(use_clang),)
527   use_clang := false
528 endif
530 # Try to catch typical 32-bit assumptions that break with 64-bit pointers.
531 libc_common_cflags += \
532     -Werror=pointer-to-int-cast \
533     -Werror=int-to-pointer-cast \
534     -Werror=type-limits \
535     -Werror \
537 ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
538   libc_common_cflags += -DDEBUG
539 endif
541 ifeq ($(MALLOC_IMPL),dlmalloc)
542   libc_common_cflags += -DUSE_DLMALLOC
543   libc_malloc_src := bionic/dlmalloc.c
544 else
545   libc_common_cflags += -DUSE_JEMALLOC
546   libc_malloc_src := bionic/jemalloc_wrapper.cpp
547   libc_common_c_includes += external/jemalloc/include
548 endif
550 # To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
551 # the appropriate BoardConfig.mk file.
553 ifneq ($(BOARD_MALLOC_ALIGNMENT),)
554   libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
555 endif
557 # Define some common conlyflags
558 libc_common_conlyflags := \
559     -std=gnu99
561 # Define some common cppflags
562 libc_common_cppflags := \
563     -std=gnu++11
565 # Define some common includes
566 # ========================================================
567 libc_common_c_includes += \
568     $(LOCAL_PATH)/stdio   \
570 # ========================================================
571 # Add in the arch-specific flags.
572 # Must be called with $(eval).
573 # $(1): the LOCAL_ variable name
574 # $(2): the bionic variable name to pull in
575 define patch-up-arch-specific-flags
576 $(1)_$(TARGET_ARCH) += $($(2)_$(TARGET_ARCH))
577 ifdef TARGET_2ND_ARCH
578 $(1)_$(TARGET_2ND_ARCH) += $($(2)_$(TARGET_2ND_ARCH))
579 endif
580 endef
583 # ========================================================
584 # libc_stack_protector.a - stack protector code
585 # ========================================================
587 # The stack protector code needs to be compiled
588 # with -fno-stack-protector, since it modifies the
589 # stack canary.
591 include $(CLEAR_VARS)
593 LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
594 LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
595 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
596 LOCAL_CPPFLAGS := $(libc_common_cppflags)
597 LOCAL_C_INCLUDES := $(libc_common_c_includes)
598 LOCAL_MODULE := libc_stack_protector
599 LOCAL_CLANG := $(use_clang)
600 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
601 LOCAL_CXX_STL := none
602 LOCAL_SYSTEM_SHARED_LIBRARIES :=
603 LOCAL_ADDRESS_SANITIZER := false
604 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
606 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
607 include $(BUILD_STATIC_LIBRARY)
610 # ========================================================
611 # libc_tzcode.a - upstream 'tzcode' code
612 # ========================================================
614 include $(CLEAR_VARS)
616 LOCAL_SRC_FILES := $(call all-c-files-under,tzcode)
617 # tzcode doesn't include wcsftime, so we use the OpenBSD one.
618 LOCAL_SRC_FILES += upstream-openbsd/lib/libc/time/wcsftime.c
620 LOCAL_CFLAGS := $(libc_common_cflags) \
621     -fvisibility=hidden \
623 # Don't use ridiculous amounts of stack.
624 LOCAL_CFLAGS += -DALL_STATE
625 # Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
626 LOCAL_CFLAGS += -DSTD_INSPIRED
627 # The name of the tm_gmtoff field in our struct tm.
628 LOCAL_CFLAGS += -DTM_GMTOFF=tm_gmtoff
629 # Where we store our tzdata.
630 LOCAL_CFLAGS += -DTZDIR=\"/system/usr/share/zoneinfo\"
631 # Include timezone and daylight globals.
632 LOCAL_CFLAGS += -DUSG_COMPAT=1
633 LOCAL_CFLAGS += -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
634 LOCAL_CFLAGS += -Dlint
636 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
637 LOCAL_CPPFLAGS := $(libc_common_cppflags)
638 LOCAL_C_INCLUDES := $(libc_common_c_includes) $(LOCAL_PATH)/tzcode/
639 LOCAL_MODULE := libc_tzcode
640 LOCAL_CLANG := $(use_clang)
641 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
642 LOCAL_CXX_STL := none
643 LOCAL_SYSTEM_SHARED_LIBRARIES :=
644 LOCAL_ADDRESS_SANITIZER := false
645 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
647 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
648 include $(BUILD_STATIC_LIBRARY)
651 # ========================================================
652 # libc_dns.a - modified NetBSD DNS code
653 # ========================================================
655 include $(CLEAR_VARS)
657 LOCAL_SRC_FILES := \
658     $(call all-c-files-under,dns) \
659     upstream-netbsd/lib/libc/isc/ev_streams.c \
660     upstream-netbsd/lib/libc/isc/ev_timers.c \
661     upstream-netbsd/lib/libc/resolv/mtctxres.c \
663 # We use the OpenBSD res_random.
664 LOCAL_CFLAGS += \
665     -Dres_randomid=__res_randomid
666 LOCAL_SRC_FILES += \
667     upstream-openbsd/lib/libc/net/res_random.c \
669 LOCAL_CFLAGS += \
670     $(libc_common_cflags) \
671     -DANDROID_CHANGES \
672     -DINET6 \
673     -fvisibility=hidden \
674     -Wno-unused-parameter \
675     -I$(LOCAL_PATH)/dns/include \
676     -I$(LOCAL_PATH)/private \
677     -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
678     -I$(LOCAL_PATH)/upstream-netbsd/android/include \
679     -include netbsd-compat.h \
681 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
682 LOCAL_CPPFLAGS := $(libc_common_cppflags)
683 LOCAL_C_INCLUDES := $(libc_common_c_includes)
684 LOCAL_MODULE := libc_dns
685 LOCAL_CLANG := $(use_clang)
686 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
687 LOCAL_CXX_STL := none
688 LOCAL_SYSTEM_SHARED_LIBRARIES :=
689 LOCAL_ADDRESS_SANITIZER := false
690 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
692 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
693 include $(BUILD_STATIC_LIBRARY)
696 # ========================================================
697 # libc_freebsd.a - upstream FreeBSD C library code
698 # ========================================================
700 # These files are built with the freebsd-compat.h header file
701 # automatically included.
703 include $(CLEAR_VARS)
705 LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files)
706 LOCAL_CFLAGS := \
707     $(libc_common_cflags) \
708     -Wno-sign-compare -Wno-uninitialized \
709     -I$(LOCAL_PATH)/upstream-freebsd/android/include \
710     -I$(LOCAL_PATH)/upstream-freebsd/lib/libc/include \
711     -include freebsd-compat.h \
713 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
714 LOCAL_CPPFLAGS := $(libc_common_cppflags)
715 LOCAL_C_INCLUDES := $(libc_common_c_includes)
716 LOCAL_MODULE := libc_freebsd
717 LOCAL_CLANG := $(use_clang)
718 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
719 LOCAL_CXX_STL := none
720 LOCAL_SYSTEM_SHARED_LIBRARIES :=
721 LOCAL_ADDRESS_SANITIZER := false
722 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
724 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
725 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_freebsd_src_files))
726 include $(BUILD_STATIC_LIBRARY)
729 # ========================================================
730 # libc_netbsd.a - upstream NetBSD C library code
731 # ========================================================
733 # These files are built with the netbsd-compat.h header file
734 # automatically included.
736 include $(CLEAR_VARS)
738 LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
739 LOCAL_CFLAGS := \
740     $(libc_common_cflags) \
741     -Wno-sign-compare -Wno-uninitialized \
742     -DPOSIX_MISTAKE \
743     -I$(LOCAL_PATH)/upstream-netbsd/android/include \
744     -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
745     -include netbsd-compat.h \
747 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
748 LOCAL_CPPFLAGS := $(libc_common_cppflags)
749 LOCAL_C_INCLUDES := $(libc_common_c_includes)
750 LOCAL_MODULE := libc_netbsd
751 LOCAL_CLANG := $(use_clang)
752 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
753 LOCAL_CXX_STL := none
754 LOCAL_SYSTEM_SHARED_LIBRARIES :=
755 LOCAL_ADDRESS_SANITIZER := false
756 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
758 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
759 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_netbsd_src_files))
760 include $(BUILD_STATIC_LIBRARY)
763 # ========================================================
764 # libc_openbsd.a - upstream OpenBSD C library code
765 # ========================================================
767 # These files are built with the openbsd-compat.h header file
768 # automatically included.
770 include $(CLEAR_VARS)
772 LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files)
773 ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
774   # Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
775   LOCAL_CLANG := false
776 else
777   LOCAL_CLANG := $(use_clang)
778 endif
780 LOCAL_CFLAGS := \
781     $(libc_common_cflags) \
782     -Wno-sign-compare \
783     -Wno-uninitialized \
784     -Wno-unused-parameter \
785     -I$(LOCAL_PATH)/private \
786     -I$(LOCAL_PATH)/upstream-openbsd/android/include \
787     -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
788     -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/gdtoa/ \
789     -include openbsd-compat.h \
791 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
792 LOCAL_CPPFLAGS := $(libc_common_cppflags)
793 LOCAL_C_INCLUDES := $(libc_common_c_includes)
794 LOCAL_MODULE := libc_openbsd
795 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
796 LOCAL_CXX_STL := none
797 LOCAL_SYSTEM_SHARED_LIBRARIES :=
798 LOCAL_ADDRESS_SANITIZER := false
799 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
801 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
802 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_openbsd_src_files))
803 include $(BUILD_STATIC_LIBRARY)
806 # ========================================================
807 # libc_gdtoa.a - upstream OpenBSD C library gdtoa code
808 # ========================================================
810 # These files are built with the openbsd-compat.h header file
811 # automatically included.
813 include $(CLEAR_VARS)
815 LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32)
816 LOCAL_SRC_FILES_64 := $(libc_upstream_openbsd_gdtoa_src_files_64)
817 ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
818   # Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
819   LOCAL_CLANG := false
820 else
821   LOCAL_CLANG := $(use_clang)
822 endif
824 LOCAL_CFLAGS := \
825     $(libc_common_cflags) \
826     -Wno-sign-compare -Wno-uninitialized \
827     -fvisibility=hidden \
828     -I$(LOCAL_PATH)/private \
829     -I$(LOCAL_PATH)/upstream-openbsd/android/include \
830     -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
831     -include openbsd-compat.h \
833 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
834 LOCAL_CPPFLAGS := $(libc_common_cppflags)
835 LOCAL_C_INCLUDES := $(libc_common_c_includes)
836 LOCAL_MODULE := libc_gdtoa
837 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
838 LOCAL_CXX_STL := none
839 LOCAL_SYSTEM_SHARED_LIBRARIES :=
840 LOCAL_ADDRESS_SANITIZER := false
841 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
843 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
844 include $(BUILD_STATIC_LIBRARY)
847 # ========================================================
848 # libc_bionic.a - home-grown C library code
849 # ========================================================
851 include $(CLEAR_VARS)
853 LOCAL_SRC_FILES := $(libc_bionic_src_files)
854 LOCAL_CFLAGS := $(libc_common_cflags) \
855     -Wframe-larger-than=2048 \
857 # ssse3-strcmp-slm.S does not compile with Clang.
858 LOCAL_CLANG_ASFLAGS_x86_64 += -no-integrated-as
860 # memcpy.S, memchr.S, etc. do not compile with Clang.
861 LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
862 LOCAL_CLANG_ASFLAGS_arm64 += -no-integrated-as
864 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
865 LOCAL_CPPFLAGS := $(libc_common_cppflags)
866 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
867 LOCAL_MODULE := libc_bionic
868 LOCAL_CLANG := $(use_clang)
869 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
870 LOCAL_CXX_STL := none
871 LOCAL_SYSTEM_SHARED_LIBRARIES :=
872 LOCAL_ADDRESS_SANITIZER := false
873 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
875 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
876 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_bionic_src_files))
877 include $(BUILD_STATIC_LIBRARY)
880 # ========================================================
881 # libc_cxa.a - Things traditionally in libstdc++
882 # ========================================================
884 include $(CLEAR_VARS)
886 LOCAL_SRC_FILES := $(libc_cxa_src_files)
887 LOCAL_CFLAGS := $(libc_common_cflags) \
888     -fvisibility=hidden \
890 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
891 LOCAL_CPPFLAGS := $(libc_common_cppflags)
892 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
893 LOCAL_MODULE := libc_cxa
894 LOCAL_CLANG := true # GCC refuses to hide new/delete
895 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
896 LOCAL_CXX_STL := none
897 LOCAL_SYSTEM_SHARED_LIBRARIES :=
898 LOCAL_ADDRESS_SANITIZER := false
899 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
901 include $(BUILD_STATIC_LIBRARY)
904 # ========================================================
905 # libc_syscalls.a
906 # ========================================================
908 include $(CLEAR_VARS)
910 LOCAL_SRC_FILES_$(TARGET_ARCH) := $(call all-S-files-under,arch-$(TARGET_ARCH)/syscalls)
911 ifdef TARGET_2ND_ARCH
912 LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) := $(call all-S-files-under,arch-$(TARGET_2ND_ARCH)/syscalls)
913 endif
914 LOCAL_MODULE := libc_syscalls
915 LOCAL_CLANG := $(use_clang)
916 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
917 LOCAL_CXX_STL := none
918 LOCAL_SYSTEM_SHARED_LIBRARIES :=
919 LOCAL_ADDRESS_SANITIZER := false
920 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
922 include $(BUILD_STATIC_LIBRARY)
925 # ========================================================
926 # libc_aeabi.a
927 # This is an LP32 ARM-only library that needs to be built with -fno-builtin
928 # to avoid infinite recursion. For the other architectures we just build an
929 # empty library to keep this makefile simple.
930 # ========================================================
932 include $(CLEAR_VARS)
934 LOCAL_SRC_FILES_arm := arch-arm/bionic/__aeabi.c
935 LOCAL_MODULE := libc_aeabi
936 LOCAL_CLANG := $(use_clang)
937 LOCAL_CFLAGS := $(libc_common_cflags) -fno-builtin
938 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
939 LOCAL_CXX_STL := none
940 LOCAL_SYSTEM_SHARED_LIBRARIES :=
941 LOCAL_ADDRESS_SANITIZER := false
942 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
944 include $(BUILD_STATIC_LIBRARY)
946 # ========================================================
947 # libc_common.a
948 # ========================================================
950 include $(CLEAR_VARS)
952 LOCAL_SRC_FILES := $(libc_common_src_files)
953 LOCAL_CFLAGS := $(libc_common_cflags)
954 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
955 LOCAL_CPPFLAGS := $(libc_common_cppflags)
956 LOCAL_C_INCLUDES := $(libc_common_c_includes)
957 LOCAL_MODULE := libc_common
958 LOCAL_CLANG := $(use_clang)
959 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
960 LOCAL_WHOLE_STATIC_LIBRARIES := \
961     libc_bionic \
962     libc_cxa \
963     libc_dns \
964     libc_freebsd \
965     libc_gdtoa \
966     libc_malloc \
967     libc_netbsd \
968     libc_openbsd \
969     libc_stack_protector \
970     libc_syscalls \
971     libc_tzcode \
973 LOCAL_WHOLE_STATIC_LIBRARIES_arm := libc_aeabi
975 ifneq ($(MALLOC_IMPL),dlmalloc)
976 LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
977 endif
979 LOCAL_CXX_STL := none
980 LOCAL_SYSTEM_SHARED_LIBRARIES :=
982 # TODO: split out the asflags.
983 LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
984 LOCAL_ADDRESS_SANITIZER := false
985 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
987 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
988 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_common_src_files))
989 $(eval $(call patch-up-arch-specific-flags,LOCAL_ASFLAGS,LOCAL_CFLAGS))
990 include $(BUILD_STATIC_LIBRARY)
993 # ========================================================
994 # libc_nomalloc.a
995 # ========================================================
997 # This is a version of the static C library that does not
998 # include malloc. It's useful in situations when the user wants
999 # to provide their own malloc implementation, or wants to
1000 # explicitly disallow the use of malloc, such as in the
1001 # dynamic linker.
1003 include $(CLEAR_VARS)
1005 LOCAL_SRC_FILES := \
1006     $(libc_arch_static_src_files) \
1007     $(libc_static_common_src_files) \
1008     bionic/libc_init_static.cpp
1010 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1011 LOCAL_CFLAGS := $(libc_common_cflags) \
1012     -DLIBC_STATIC \
1014 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1015 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1017 LOCAL_MODULE := libc_nomalloc
1018 LOCAL_CLANG := $(use_clang)
1019 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1020 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1021 LOCAL_CXX_STL := none
1022 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1023 LOCAL_ADDRESS_SANITIZER := false
1024 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1026 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1027 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
1028 include $(BUILD_STATIC_LIBRARY)
1031 # ========================================================
1032 # libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1033 # ========================================================
1035 include $(CLEAR_VARS)
1036 LOCAL_SRC_FILES := $(libc_malloc_src)
1037 LOCAL_CFLAGS := $(libc_common_cflags) \
1038     -fvisibility=hidden \
1040 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1041 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1042 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1043 LOCAL_MODULE := libc_malloc
1044 LOCAL_CLANG := $(use_clang)
1045 LOCAL_CXX_STL := none
1046 LOCAL_ADDRESS_SANITIZER := false
1047 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1048 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1049 include $(BUILD_STATIC_LIBRARY)
1052 # ========================================================
1053 # libc.a
1054 # ========================================================
1055 include $(CLEAR_VARS)
1057 LOCAL_SRC_FILES := \
1058     $(libc_arch_static_src_files) \
1059     $(libc_static_common_src_files) \
1060     bionic/malloc_debug_common.cpp \
1061     bionic/libc_init_static.cpp \
1063 LOCAL_CFLAGS := $(libc_common_cflags) \
1064     -DLIBC_STATIC \
1066 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1067 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1068 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1069 LOCAL_MODULE := libc
1070 LOCAL_CLANG := $(use_clang)
1071 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1072 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1073 LOCAL_CXX_STL := none
1074 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1075 LOCAL_ADDRESS_SANITIZER := false
1076 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1078 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1079 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
1080 include $(BUILD_STATIC_LIBRARY)
1083 # ========================================================
1084 # libc.so
1085 # ========================================================
1086 include $(CLEAR_VARS)
1088 LOCAL_CFLAGS := $(libc_common_cflags)
1089 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1090 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1091 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1092 LOCAL_SRC_FILES := \
1093     $(libc_arch_dynamic_src_files) \
1094     $(libc_static_common_src_files) \
1095     bionic/malloc_debug_common.cpp \
1096     bionic/libc_init_dynamic.cpp \
1097     bionic/NetdClient.cpp \
1099 LOCAL_MODULE := libc
1100 LOCAL_CLANG := $(use_clang)
1101 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1102 LOCAL_REQUIRED_MODULES := tzdata
1104 # Leave the symbols in the shared library so that stack unwinders can produce
1105 # meaningful name resolution.
1106 LOCAL_STRIP_MODULE := keep_symbols
1108 # WARNING: The only library libc.so should depend on is libdl.so!  If you add other libraries,
1109 # make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries.  This
1110 # ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
1111 # external; if that were the case, then libc would not pull those symbols from libgcc.a as it
1112 # should, instead relying on the external symbols from the dependent libraries.  That would
1113 # create a "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
1114 # you wanted!
1116 LOCAL_SHARED_LIBRARIES := libdl
1117 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1118 LOCAL_CXX_STL := none
1119 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1121 # We'd really like to do this for all architectures, but since this wasn't done
1122 # before, these symbols must continue to be exported on LP32 for binary
1123 # compatibility.
1124 LOCAL_LDFLAGS_arm64 := -Wl,--exclude-libs,libgcc.a
1125 LOCAL_LDFLAGS_mips64 := -Wl,--exclude-libs,libgcc.a
1126 LOCAL_LDFLAGS_x86_64 := -Wl,--exclude-libs,libgcc.a
1128 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1129 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src_files))
1130 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_static_common_src_files))
1131 # special for arm
1132 LOCAL_NO_CRT_arm := true
1133 LOCAL_CFLAGS_arm += -DCRT_LEGACY_WORKAROUND
1134 LOCAL_SRC_FILES_arm += \
1135     arch-common/bionic/crtbegin_so.c \
1136     arch-arm/bionic/atexit_legacy.c \
1137     arch-common/bionic/crtend_so.S
1138 LOCAL_ADDRESS_SANITIZER := false
1139 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1141 include $(BUILD_SHARED_LIBRARY)
1144 # For all builds, except for the -user build we will enable memory
1145 # allocation checking (including memory leaks, buffer overwrites, etc.)
1146 # Note that all these checks are also controlled by env. settings
1147 # that can enable, or disable specific checks. Note also that some of
1148 # the checks are available only in emulator and are implemeted in
1149 # libc_malloc_qemu_instrumented.so.
1150 ifneq ($(TARGET_BUILD_VARIANT),user)
1152 # ========================================================
1153 # libc_malloc_debug_leak.so
1154 # ========================================================
1155 include $(CLEAR_VARS)
1157 LOCAL_CFLAGS := $(libc_common_cflags)
1158 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1159 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1161 # Make sure that unwind.h comes from libunwind.
1162 LOCAL_C_INCLUDES := \
1163     $(libc_common_c_includes) \
1165 LOCAL_SRC_FILES := \
1166     bionic/debug_mapinfo.cpp \
1167     bionic/debug_stacktrace.cpp \
1168     bionic/libc_logging.cpp \
1169     bionic/malloc_debug_leak.cpp \
1170     bionic/malloc_debug_check.cpp \
1172 LOCAL_MODULE := libc_malloc_debug_leak
1173 LOCAL_CLANG := $(use_clang)
1174 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1176 LOCAL_SHARED_LIBRARIES := libc libdl
1177 LOCAL_CXX_STL := none
1178 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1179 # Only need this for arm since libc++ uses its own unwind code that
1180 # doesn't mix with the other default unwind code.
1181 LOCAL_STATIC_LIBRARIES_arm := libunwind_llvm
1182 LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
1184 # Don't install on release build
1185 LOCAL_MODULE_TAGS := eng debug
1186 LOCAL_ADDRESS_SANITIZER := false
1187 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1189 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1190 include $(BUILD_SHARED_LIBRARY)
1193 # ========================================================
1194 # libc_malloc_debug_qemu.so
1195 # ========================================================
1196 include $(CLEAR_VARS)
1198 LOCAL_CFLAGS := \
1199     $(libc_common_cflags) \
1200     -DMALLOC_QEMU_INSTRUMENT \
1202 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1203 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1205 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1207 LOCAL_SRC_FILES := \
1208     bionic/libc_logging.cpp \
1209     bionic/malloc_debug_qemu.cpp \
1211 LOCAL_MODULE := libc_malloc_debug_qemu
1212 LOCAL_CLANG := $(use_clang)
1213 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1215 LOCAL_SHARED_LIBRARIES := libc libdl
1216 LOCAL_CXX_STL := none
1217 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1219 # Don't install on release build
1220 LOCAL_MODULE_TAGS := eng debug
1221 LOCAL_ADDRESS_SANITIZER := false
1222 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1224 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1225 include $(BUILD_SHARED_LIBRARY)
1227 endif  #!user
1229 # ========================================================
1230 # libstdc++.so
1231 # ========================================================
1232 libstdcxx_common_src_files := \
1233     bionic/__cxa_guard.cpp \
1234     bionic/__cxa_pure_virtual.cpp \
1235     bionic/new.cpp \
1236     bionic/libc_logging.cpp \
1238 include $(CLEAR_VARS)
1239 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
1240 LOCAL_CFLAGS := $(libc_common_cflags)
1241 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1242 LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1243 LOCAL_MODULE:= libstdc++
1244 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1245 LOCAL_CXX_STL := none
1246 LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1247 LOCAL_ADDRESS_SANITIZER := false
1248 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1249 include $(BUILD_SHARED_LIBRARY)
1251 # ========================================================
1252 # libstdc++.a
1253 # ========================================================
1254 include $(CLEAR_VARS)
1255 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
1256 LOCAL_CFLAGS := $(libc_common_cflags)
1257 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1258 LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1259 LOCAL_MODULE:= libstdc++
1260 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1261 LOCAL_CXX_STL := none
1262 LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1263 LOCAL_ADDRESS_SANITIZER := false
1264 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1265 include $(BUILD_STATIC_LIBRARY)
1268 # ========================================================
1269 include $(call all-makefiles-under,$(LOCAL_PATH))