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