OSDN Git Service

Update Android.bp to match Android.mk
[android-x86/bionic.git] / libc / Android.mk
1 LOCAL_PATH := $(call my-dir)
2
3 bionic_coverage ?= false
4
5 # Make everything depend on any changes to included makefiles.
6 libc_common_additional_dependencies := $(LOCAL_PATH)/Android.mk
7
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
13
14
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
23
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) \
30
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
38
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/initgroups.c \
48     bionic/isatty.c \
49     bionic/memmem.c \
50     bionic/pututline.c \
51     bionic/sched_cpualloc.c \
52     bionic/sched_cpucount.c \
53     bionic/sigblock.c \
54     bionic/siginterrupt.c \
55     bionic/sigsetmask.c \
56     bionic/system_properties_compat.c \
57     stdio/findfp.c \
58     stdio/fread.c \
59     stdio/refill.c \
60     stdio/snprintf.c\
61     stdio/sprintf.c \
62     stdio/stdio.c \
63     stdio/stdio_ext.cpp \
64     stdlib/atexit.c \
65     stdlib/exit.c \
66
67 # Fortify implementations of libc functions.
68 libc_common_src_files += \
69     bionic/__FD_chk.cpp \
70     bionic/__fgets_chk.cpp \
71     bionic/__fread_chk.cpp \
72     bionic/__fwrite_chk.cpp \
73     bionic/__getcwd_chk.cpp \
74     bionic/__memchr_chk.cpp \
75     bionic/__memmove_chk.cpp \
76     bionic/__memrchr_chk.cpp \
77     bionic/__poll_chk.cpp \
78     bionic/__pread64_chk.cpp \
79     bionic/__pread_chk.cpp \
80     bionic/__pwrite64_chk.cpp \
81     bionic/__pwrite_chk.cpp \
82     bionic/__read_chk.cpp \
83     bionic/__readlink_chk.cpp \
84     bionic/__readlinkat_chk.cpp \
85     bionic/__recvfrom_chk.cpp \
86     bionic/__stpcpy_chk.cpp \
87     bionic/__stpncpy_chk.cpp \
88     bionic/__strchr_chk.cpp \
89     bionic/__strlcat_chk.cpp \
90     bionic/__strlcpy_chk.cpp \
91     bionic/__strlen_chk.cpp \
92     bionic/__strncat_chk.cpp \
93     bionic/__strncpy_chk.cpp \
94     bionic/__strrchr_chk.cpp \
95     bionic/__umask_chk.cpp \
96     bionic/__vsnprintf_chk.cpp \
97     bionic/__vsprintf_chk.cpp \
98     bionic/__write_chk.cpp
99
100 libc_bionic_ndk_src_files := \
101     bionic/abort.cpp \
102     bionic/accept.cpp \
103     bionic/accept4.cpp \
104     bionic/access.cpp \
105     bionic/arpa_inet.cpp \
106     bionic/assert.cpp \
107     bionic/atof.cpp \
108     bionic/bionic_netlink.cpp \
109     bionic/bionic_systrace.cpp \
110     bionic/bionic_time_conversions.cpp \
111     bionic/brk.cpp \
112     bionic/c16rtomb.cpp \
113     bionic/c32rtomb.cpp \
114     bionic/chmod.cpp \
115     bionic/chown.cpp \
116     bionic/clearenv.cpp \
117     bionic/clock.cpp \
118     bionic/clock_getcpuclockid.cpp \
119     bionic/clock_nanosleep.cpp \
120     bionic/clone.cpp \
121     bionic/close.cpp \
122     bionic/__cmsg_nxthdr.cpp \
123     bionic/connect.cpp \
124     bionic/ctype.cpp \
125     bionic/dirent.cpp \
126     bionic/dup2.cpp \
127     bionic/epoll_create.cpp \
128     bionic/epoll_pwait.cpp \
129     bionic/epoll_wait.cpp \
130     bionic/__errno.cpp \
131     bionic/error.cpp \
132     bionic/eventfd_read.cpp \
133     bionic/eventfd_write.cpp \
134     bionic/faccessat.cpp \
135     bionic/fchmod.cpp \
136     bionic/fchmodat.cpp \
137     bionic/ffs.cpp \
138     bionic/fgetxattr.cpp \
139     bionic/flistxattr.cpp \
140     bionic/flockfile.cpp \
141     bionic/fpclassify.cpp \
142     bionic/fsetxattr.cpp \
143     bionic/ftruncate.cpp \
144     bionic/futimens.cpp \
145     bionic/getcwd.cpp \
146     bionic/gethostname.cpp \
147     bionic/getpgrp.cpp \
148     bionic/getpid.cpp \
149     bionic/gettid.cpp \
150     bionic/__gnu_basename.cpp \
151     bionic/ifaddrs.cpp \
152     bionic/inotify_init.cpp \
153     bionic/ioctl.cpp \
154     bionic/lchown.cpp \
155     bionic/lfs64_support.cpp \
156     bionic/__libc_current_sigrtmax.cpp \
157     bionic/__libc_current_sigrtmin.cpp \
158     bionic/libc_init_common.cpp \
159     bionic/libc_logging.cpp \
160     bionic/libgen.cpp \
161     bionic/link.cpp \
162     bionic/locale.cpp \
163     bionic/lstat.cpp \
164     bionic/malloc_info.cpp \
165     bionic/mbrtoc16.cpp \
166     bionic/mbrtoc32.cpp \
167     bionic/mbstate.cpp \
168     bionic/mempcpy.cpp \
169     bionic/mkdir.cpp \
170     bionic/mkfifo.cpp \
171     bionic/mknod.cpp \
172     bionic/mntent.cpp \
173     bionic/mremap.cpp \
174     bionic/NetdClientDispatch.cpp \
175     bionic/net_if.cpp \
176     bionic/open.cpp \
177     bionic/pathconf.cpp \
178     bionic/pause.cpp \
179     bionic/pipe.cpp \
180     bionic/poll.cpp \
181     bionic/posix_fadvise.cpp \
182     bionic/posix_fallocate.cpp \
183     bionic/posix_madvise.cpp \
184     bionic/posix_timers.cpp \
185     bionic/ptrace.cpp \
186     bionic/pty.cpp \
187     bionic/raise.cpp \
188     bionic/rand.cpp \
189     bionic/readlink.cpp \
190     bionic/reboot.cpp \
191     bionic/recv.cpp \
192     bionic/rename.cpp \
193     bionic/rmdir.cpp \
194     bionic/scandir.cpp \
195     bionic/sched_getaffinity.cpp \
196     bionic/sched_getcpu.cpp \
197     bionic/semaphore.cpp \
198     bionic/send.cpp \
199     bionic/setegid.cpp \
200     bionic/__set_errno.cpp \
201     bionic/seteuid.cpp \
202     bionic/setpgrp.cpp \
203     bionic/sigaction.cpp \
204     bionic/sigaddset.cpp \
205     bionic/sigdelset.cpp \
206     bionic/sigemptyset.cpp \
207     bionic/sigfillset.cpp \
208     bionic/sigismember.cpp \
209     bionic/signal.cpp \
210     bionic/signalfd.cpp \
211     bionic/sigpending.cpp \
212     bionic/sigprocmask.cpp \
213     bionic/sigqueue.cpp \
214     bionic/sigsuspend.cpp \
215     bionic/sigtimedwait.cpp \
216     bionic/sigwait.cpp \
217     bionic/sigwaitinfo.cpp \
218     bionic/socket.cpp \
219     bionic/stat.cpp \
220     bionic/statvfs.cpp \
221     bionic/strchrnul.cpp \
222     bionic/strerror.cpp \
223     bionic/strerror_r.cpp \
224     bionic/strsignal.cpp \
225     bionic/strtold.cpp \
226     bionic/stubs.cpp \
227     bionic/symlink.cpp \
228     bionic/sysinfo.cpp \
229     bionic/syslog.cpp \
230     bionic/sys_siglist.c \
231     bionic/sys_signame.c \
232     bionic/system_properties.cpp \
233     bionic/tdestroy.cpp \
234     bionic/termios.cpp \
235     bionic/thread_private.cpp \
236     bionic/tmpfile.cpp \
237     bionic/umount.cpp \
238     bionic/unlink.cpp \
239     bionic/utimes.cpp \
240     bionic/wait.cpp \
241     bionic/wchar.cpp \
242     bionic/wctype.cpp \
243     bionic/wmempcpy.cpp \
244
245 libc_bionic_src_files :=
246
247 # The following implementations depend on pthread data, so we can't include
248 # them in libc_ndk.a.
249 libc_bionic_src_files += \
250     bionic/__cxa_thread_atexit_impl.cpp \
251     bionic/fork.cpp \
252
253 # The data that backs getauxval is initialized in the libc init functions which
254 # are invoked by the linker. If this file is included in libc_ndk.a, only one of
255 # the copies of the global data will be initialized, resulting in nullptr
256 # dereferences.
257 libc_bionic_src_files += bionic/getauxval.cpp
258
259 # These four require getauxval, which isn't available on older platforms.
260 libc_bionic_src_files += bionic/getentropy_linux.c
261 libc_bionic_src_files += bionic/sysconf.cpp
262 libc_bionic_src_files += bionic/vdso.cpp
263 libc_bionic_src_files += bionic/setjmp_cookie.cpp
264
265 libc_bionic_src_files += \
266     bionic/__memcpy_chk.cpp \
267     bionic/__memset_chk.cpp \
268     bionic/__strcat_chk.cpp \
269     bionic/__strcpy_chk.cpp \
270     bionic/strchr.cpp \
271     bionic/strnlen.c \
272     bionic/strrchr.cpp \
273
274 libc_cxa_src_files := \
275     bionic/__cxa_guard.cpp \
276     bionic/__cxa_pure_virtual.cpp \
277     bionic/new.cpp \
278
279 libc_upstream_freebsd_src_files := \
280     upstream-freebsd/lib/libc/gen/ldexp.c \
281     upstream-freebsd/lib/libc/gen/sleep.c \
282     upstream-freebsd/lib/libc/gen/usleep.c \
283     upstream-freebsd/lib/libc/stdlib/getopt_long.c \
284     upstream-freebsd/lib/libc/stdlib/qsort.c \
285     upstream-freebsd/lib/libc/stdlib/quick_exit.c \
286     upstream-freebsd/lib/libc/stdlib/realpath.c \
287     upstream-freebsd/lib/libc/string/wcpcpy.c \
288     upstream-freebsd/lib/libc/string/wcpncpy.c \
289     upstream-freebsd/lib/libc/string/wcscasecmp.c \
290     upstream-freebsd/lib/libc/string/wcscat.c \
291     upstream-freebsd/lib/libc/string/wcschr.c \
292     upstream-freebsd/lib/libc/string/wcscmp.c \
293     upstream-freebsd/lib/libc/string/wcscpy.c \
294     upstream-freebsd/lib/libc/string/wcscspn.c \
295     upstream-freebsd/lib/libc/string/wcsdup.c \
296     upstream-freebsd/lib/libc/string/wcslcat.c \
297     upstream-freebsd/lib/libc/string/wcslen.c \
298     upstream-freebsd/lib/libc/string/wcsncasecmp.c \
299     upstream-freebsd/lib/libc/string/wcsncat.c \
300     upstream-freebsd/lib/libc/string/wcsncmp.c \
301     upstream-freebsd/lib/libc/string/wcsncpy.c \
302     upstream-freebsd/lib/libc/string/wcsnlen.c \
303     upstream-freebsd/lib/libc/string/wcspbrk.c \
304     upstream-freebsd/lib/libc/string/wcsrchr.c \
305     upstream-freebsd/lib/libc/string/wcsspn.c \
306     upstream-freebsd/lib/libc/string/wcstok.c \
307     upstream-freebsd/lib/libc/string/wmemchr.c \
308     upstream-freebsd/lib/libc/string/wmemcmp.c \
309     upstream-freebsd/lib/libc/string/wmemmove.c \
310     upstream-freebsd/lib/libc/string/wmemset.c \
311
312 libc_upstream_netbsd_src_files := \
313     upstream-netbsd/common/lib/libc/stdlib/random.c \
314     upstream-netbsd/lib/libc/gen/ftw.c \
315     upstream-netbsd/lib/libc/gen/nftw.c \
316     upstream-netbsd/lib/libc/gen/nice.c \
317     upstream-netbsd/lib/libc/gen/popen.c \
318     upstream-netbsd/lib/libc/gen/psignal.c \
319     upstream-netbsd/lib/libc/gen/utime.c \
320     upstream-netbsd/lib/libc/gen/utmp.c \
321     upstream-netbsd/lib/libc/inet/nsap_addr.c \
322     upstream-netbsd/lib/libc/regex/regcomp.c \
323     upstream-netbsd/lib/libc/regex/regerror.c \
324     upstream-netbsd/lib/libc/regex/regexec.c \
325     upstream-netbsd/lib/libc/regex/regfree.c \
326     upstream-netbsd/lib/libc/stdlib/bsearch.c \
327     upstream-netbsd/lib/libc/stdlib/div.c \
328     upstream-netbsd/lib/libc/stdlib/drand48.c \
329     upstream-netbsd/lib/libc/stdlib/erand48.c \
330     upstream-netbsd/lib/libc/stdlib/jrand48.c \
331     upstream-netbsd/lib/libc/stdlib/lcong48.c \
332     upstream-netbsd/lib/libc/stdlib/ldiv.c \
333     upstream-netbsd/lib/libc/stdlib/lldiv.c \
334     upstream-netbsd/lib/libc/stdlib/lrand48.c \
335     upstream-netbsd/lib/libc/stdlib/mrand48.c \
336     upstream-netbsd/lib/libc/stdlib/nrand48.c \
337     upstream-netbsd/lib/libc/stdlib/_rand48.c \
338     upstream-netbsd/lib/libc/stdlib/rand_r.c \
339     upstream-netbsd/lib/libc/stdlib/reallocarr.c \
340     upstream-netbsd/lib/libc/stdlib/seed48.c \
341     upstream-netbsd/lib/libc/stdlib/srand48.c \
342     upstream-netbsd/lib/libc/string/memccpy.c \
343     upstream-netbsd/lib/libc/string/strcasestr.c \
344     upstream-netbsd/lib/libc/string/strcoll.c \
345     upstream-netbsd/lib/libc/string/strxfrm.c \
346
347 libc_upstream_openbsd_gdtoa_src_files := \
348     upstream-openbsd/android/gdtoa_support.cpp \
349     upstream-openbsd/lib/libc/gdtoa/dmisc.c \
350     upstream-openbsd/lib/libc/gdtoa/dtoa.c \
351     upstream-openbsd/lib/libc/gdtoa/gdtoa.c \
352     upstream-openbsd/lib/libc/gdtoa/gethex.c \
353     upstream-openbsd/lib/libc/gdtoa/gmisc.c \
354     upstream-openbsd/lib/libc/gdtoa/hd_init.c \
355     upstream-openbsd/lib/libc/gdtoa/hdtoa.c \
356     upstream-openbsd/lib/libc/gdtoa/hexnan.c \
357     upstream-openbsd/lib/libc/gdtoa/ldtoa.c \
358     upstream-openbsd/lib/libc/gdtoa/misc.c \
359     upstream-openbsd/lib/libc/gdtoa/smisc.c \
360     upstream-openbsd/lib/libc/gdtoa/strtod.c \
361     upstream-openbsd/lib/libc/gdtoa/strtodg.c \
362     upstream-openbsd/lib/libc/gdtoa/strtof.c \
363     upstream-openbsd/lib/libc/gdtoa/strtord.c \
364     upstream-openbsd/lib/libc/gdtoa/sum.c \
365     upstream-openbsd/lib/libc/gdtoa/ulp.c \
366
367 libc_upstream_openbsd_gdtoa_src_files_32 := \
368     $(libc_upstream_openbsd_gdtoa_src_files) \
369
370 libc_upstream_openbsd_gdtoa_src_files_64 := \
371     $(libc_upstream_openbsd_gdtoa_src_files) \
372     upstream-openbsd/lib/libc/gdtoa/strtorQ.c \
373
374 # These two depend on getentropy_linux.c, which isn't in libc_ndk.a.
375 libc_upstream_openbsd_src_files := \
376     upstream-openbsd/lib/libc/crypt/arc4random.c \
377     upstream-openbsd/lib/libc/crypt/arc4random_uniform.c \
378
379 libc_upstream_openbsd_src_files += \
380     upstream-openbsd/lib/libc/string/memchr.c \
381     upstream-openbsd/lib/libc/string/memmove.c \
382     upstream-openbsd/lib/libc/string/memrchr.c \
383     upstream-openbsd/lib/libc/string/stpcpy.c \
384     upstream-openbsd/lib/libc/string/stpncpy.c \
385     upstream-openbsd/lib/libc/string/strcat.c \
386     upstream-openbsd/lib/libc/string/strcpy.c \
387     upstream-openbsd/lib/libc/string/strlcat.c \
388     upstream-openbsd/lib/libc/string/strlcpy.c \
389     upstream-openbsd/lib/libc/string/strncat.c \
390     upstream-openbsd/lib/libc/string/strncmp.c \
391     upstream-openbsd/lib/libc/string/strncpy.c \
392
393 libc_upstream_openbsd_ndk_src_files := \
394     upstream-openbsd/lib/libc/compat-43/killpg.c \
395     upstream-openbsd/lib/libc/gen/alarm.c \
396     upstream-openbsd/lib/libc/gen/ctype_.c \
397     upstream-openbsd/lib/libc/gen/daemon.c \
398     upstream-openbsd/lib/libc/gen/err.c \
399     upstream-openbsd/lib/libc/gen/errx.c \
400     upstream-openbsd/lib/libc/gen/exec.c \
401     upstream-openbsd/lib/libc/gen/fnmatch.c \
402     upstream-openbsd/lib/libc/gen/ftok.c \
403     upstream-openbsd/lib/libc/gen/getprogname.c \
404     upstream-openbsd/lib/libc/gen/isctype.c \
405     upstream-openbsd/lib/libc/gen/setprogname.c \
406     upstream-openbsd/lib/libc/gen/time.c \
407     upstream-openbsd/lib/libc/gen/tolower_.c \
408     upstream-openbsd/lib/libc/gen/toupper_.c \
409     upstream-openbsd/lib/libc/gen/verr.c \
410     upstream-openbsd/lib/libc/gen/verrx.c \
411     upstream-openbsd/lib/libc/gen/vwarn.c \
412     upstream-openbsd/lib/libc/gen/vwarnx.c \
413     upstream-openbsd/lib/libc/gen/warn.c \
414     upstream-openbsd/lib/libc/gen/warnx.c \
415     upstream-openbsd/lib/libc/locale/btowc.c \
416     upstream-openbsd/lib/libc/locale/mbrlen.c \
417     upstream-openbsd/lib/libc/locale/mbstowcs.c \
418     upstream-openbsd/lib/libc/locale/mbtowc.c \
419     upstream-openbsd/lib/libc/locale/wcscoll.c \
420     upstream-openbsd/lib/libc/locale/wcstod.c \
421     upstream-openbsd/lib/libc/locale/wcstof.c \
422     upstream-openbsd/lib/libc/locale/wcstoimax.c \
423     upstream-openbsd/lib/libc/locale/wcstol.c \
424     upstream-openbsd/lib/libc/locale/wcstold.c \
425     upstream-openbsd/lib/libc/locale/wcstoll.c \
426     upstream-openbsd/lib/libc/locale/wcstombs.c \
427     upstream-openbsd/lib/libc/locale/wcstoul.c \
428     upstream-openbsd/lib/libc/locale/wcstoull.c \
429     upstream-openbsd/lib/libc/locale/wcstoumax.c \
430     upstream-openbsd/lib/libc/locale/wcsxfrm.c \
431     upstream-openbsd/lib/libc/locale/wctob.c \
432     upstream-openbsd/lib/libc/locale/wctomb.c \
433     upstream-openbsd/lib/libc/net/htonl.c \
434     upstream-openbsd/lib/libc/net/htons.c \
435     upstream-openbsd/lib/libc/net/inet_lnaof.c \
436     upstream-openbsd/lib/libc/net/inet_makeaddr.c \
437     upstream-openbsd/lib/libc/net/inet_netof.c \
438     upstream-openbsd/lib/libc/net/inet_ntoa.c \
439     upstream-openbsd/lib/libc/net/inet_ntop.c \
440     upstream-openbsd/lib/libc/net/inet_pton.c \
441     upstream-openbsd/lib/libc/net/ntohl.c \
442     upstream-openbsd/lib/libc/net/ntohs.c \
443     upstream-openbsd/lib/libc/net/res_random.c \
444     upstream-openbsd/lib/libc/stdio/asprintf.c \
445     upstream-openbsd/lib/libc/stdio/clrerr.c \
446     upstream-openbsd/lib/libc/stdio/dprintf.c \
447     upstream-openbsd/lib/libc/stdio/fclose.c \
448     upstream-openbsd/lib/libc/stdio/fdopen.c \
449     upstream-openbsd/lib/libc/stdio/feof.c \
450     upstream-openbsd/lib/libc/stdio/ferror.c \
451     upstream-openbsd/lib/libc/stdio/fflush.c \
452     upstream-openbsd/lib/libc/stdio/fgetc.c \
453     upstream-openbsd/lib/libc/stdio/fgetln.c \
454     upstream-openbsd/lib/libc/stdio/fgetpos.c \
455     upstream-openbsd/lib/libc/stdio/fgets.c \
456     upstream-openbsd/lib/libc/stdio/fgetwc.c \
457     upstream-openbsd/lib/libc/stdio/fgetws.c \
458     upstream-openbsd/lib/libc/stdio/fileno.c \
459     upstream-openbsd/lib/libc/stdio/flags.c \
460     upstream-openbsd/lib/libc/stdio/fmemopen.c \
461     upstream-openbsd/lib/libc/stdio/fopen.c \
462     upstream-openbsd/lib/libc/stdio/fprintf.c \
463     upstream-openbsd/lib/libc/stdio/fpurge.c \
464     upstream-openbsd/lib/libc/stdio/fputc.c \
465     upstream-openbsd/lib/libc/stdio/fputs.c \
466     upstream-openbsd/lib/libc/stdio/fputwc.c \
467     upstream-openbsd/lib/libc/stdio/fputws.c \
468     upstream-openbsd/lib/libc/stdio/freopen.c \
469     upstream-openbsd/lib/libc/stdio/fscanf.c \
470     upstream-openbsd/lib/libc/stdio/fseek.c \
471     upstream-openbsd/lib/libc/stdio/fsetpos.c \
472     upstream-openbsd/lib/libc/stdio/ftell.c \
473     upstream-openbsd/lib/libc/stdio/funopen.c \
474     upstream-openbsd/lib/libc/stdio/fvwrite.c \
475     upstream-openbsd/lib/libc/stdio/fwalk.c \
476     upstream-openbsd/lib/libc/stdio/fwide.c \
477     upstream-openbsd/lib/libc/stdio/fwprintf.c \
478     upstream-openbsd/lib/libc/stdio/fwrite.c \
479     upstream-openbsd/lib/libc/stdio/fwscanf.c \
480     upstream-openbsd/lib/libc/stdio/getc.c \
481     upstream-openbsd/lib/libc/stdio/getchar.c \
482     upstream-openbsd/lib/libc/stdio/getdelim.c \
483     upstream-openbsd/lib/libc/stdio/getline.c \
484     upstream-openbsd/lib/libc/stdio/gets.c \
485     upstream-openbsd/lib/libc/stdio/getwc.c \
486     upstream-openbsd/lib/libc/stdio/getwchar.c \
487     upstream-openbsd/lib/libc/stdio/makebuf.c \
488     upstream-openbsd/lib/libc/stdio/mktemp.c \
489     upstream-openbsd/lib/libc/stdio/open_memstream.c \
490     upstream-openbsd/lib/libc/stdio/open_wmemstream.c \
491     upstream-openbsd/lib/libc/stdio/perror.c \
492     upstream-openbsd/lib/libc/stdio/printf.c \
493     upstream-openbsd/lib/libc/stdio/putc.c \
494     upstream-openbsd/lib/libc/stdio/putchar.c \
495     upstream-openbsd/lib/libc/stdio/puts.c \
496     upstream-openbsd/lib/libc/stdio/putwc.c \
497     upstream-openbsd/lib/libc/stdio/putwchar.c \
498     upstream-openbsd/lib/libc/stdio/remove.c \
499     upstream-openbsd/lib/libc/stdio/rewind.c \
500     upstream-openbsd/lib/libc/stdio/rget.c \
501     upstream-openbsd/lib/libc/stdio/scanf.c \
502     upstream-openbsd/lib/libc/stdio/setbuf.c \
503     upstream-openbsd/lib/libc/stdio/setbuffer.c \
504     upstream-openbsd/lib/libc/stdio/setvbuf.c \
505     upstream-openbsd/lib/libc/stdio/sscanf.c \
506     upstream-openbsd/lib/libc/stdio/swprintf.c \
507     upstream-openbsd/lib/libc/stdio/swscanf.c \
508     upstream-openbsd/lib/libc/stdio/tempnam.c \
509     upstream-openbsd/lib/libc/stdio/tmpnam.c \
510     upstream-openbsd/lib/libc/stdio/ungetc.c \
511     upstream-openbsd/lib/libc/stdio/ungetwc.c \
512     upstream-openbsd/lib/libc/stdio/vasprintf.c \
513     upstream-openbsd/lib/libc/stdio/vdprintf.c \
514     upstream-openbsd/lib/libc/stdio/vfprintf.c \
515     upstream-openbsd/lib/libc/stdio/vfscanf.c \
516     upstream-openbsd/lib/libc/stdio/vfwprintf.c \
517     upstream-openbsd/lib/libc/stdio/vfwscanf.c \
518     upstream-openbsd/lib/libc/stdio/vprintf.c \
519     upstream-openbsd/lib/libc/stdio/vscanf.c \
520     upstream-openbsd/lib/libc/stdio/vsnprintf.c \
521     upstream-openbsd/lib/libc/stdio/vsprintf.c \
522     upstream-openbsd/lib/libc/stdio/vsscanf.c \
523     upstream-openbsd/lib/libc/stdio/vswprintf.c \
524     upstream-openbsd/lib/libc/stdio/vswscanf.c \
525     upstream-openbsd/lib/libc/stdio/vwprintf.c \
526     upstream-openbsd/lib/libc/stdio/vwscanf.c \
527     upstream-openbsd/lib/libc/stdio/wbuf.c \
528     upstream-openbsd/lib/libc/stdio/wprintf.c \
529     upstream-openbsd/lib/libc/stdio/wscanf.c \
530     upstream-openbsd/lib/libc/stdio/wsetup.c \
531     upstream-openbsd/lib/libc/stdlib/abs.c \
532     upstream-openbsd/lib/libc/stdlib/atoi.c \
533     upstream-openbsd/lib/libc/stdlib/atol.c \
534     upstream-openbsd/lib/libc/stdlib/atoll.c \
535     upstream-openbsd/lib/libc/stdlib/getenv.c \
536     upstream-openbsd/lib/libc/stdlib/insque.c \
537     upstream-openbsd/lib/libc/stdlib/imaxabs.c \
538     upstream-openbsd/lib/libc/stdlib/imaxdiv.c \
539     upstream-openbsd/lib/libc/stdlib/labs.c \
540     upstream-openbsd/lib/libc/stdlib/llabs.c \
541     upstream-openbsd/lib/libc/stdlib/lsearch.c \
542     upstream-openbsd/lib/libc/stdlib/reallocarray.c \
543     upstream-openbsd/lib/libc/stdlib/remque.c \
544     upstream-openbsd/lib/libc/stdlib/setenv.c \
545     upstream-openbsd/lib/libc/stdlib/strtoimax.c \
546     upstream-openbsd/lib/libc/stdlib/strtol.c \
547     upstream-openbsd/lib/libc/stdlib/strtoll.c \
548     upstream-openbsd/lib/libc/stdlib/strtoul.c \
549     upstream-openbsd/lib/libc/stdlib/strtoull.c \
550     upstream-openbsd/lib/libc/stdlib/strtoumax.c \
551     upstream-openbsd/lib/libc/stdlib/system.c \
552     upstream-openbsd/lib/libc/stdlib/tfind.c \
553     upstream-openbsd/lib/libc/stdlib/tsearch.c \
554     upstream-openbsd/lib/libc/string/strcasecmp.c \
555     upstream-openbsd/lib/libc/string/strcspn.c \
556     upstream-openbsd/lib/libc/string/strdup.c \
557     upstream-openbsd/lib/libc/string/strndup.c \
558     upstream-openbsd/lib/libc/string/strpbrk.c \
559     upstream-openbsd/lib/libc/string/strsep.c \
560     upstream-openbsd/lib/libc/string/strspn.c \
561     upstream-openbsd/lib/libc/string/strstr.c \
562     upstream-openbsd/lib/libc/string/strtok.c \
563     upstream-openbsd/lib/libc/string/wmemcpy.c \
564     upstream-openbsd/lib/libc/string/wcslcpy.c \
565     upstream-openbsd/lib/libc/string/wcsstr.c \
566     upstream-openbsd/lib/libc/string/wcswidth.c \
567
568 libc_pthread_src_files := \
569     bionic/pthread_atfork.cpp \
570     bionic/pthread_attr.cpp \
571     bionic/pthread_barrier.cpp \
572     bionic/pthread_cond.cpp \
573     bionic/pthread_create.cpp \
574     bionic/pthread_detach.cpp \
575     bionic/pthread_equal.cpp \
576     bionic/pthread_exit.cpp \
577     bionic/pthread_getcpuclockid.cpp \
578     bionic/pthread_getschedparam.cpp \
579     bionic/pthread_gettid_np.cpp \
580     bionic/pthread_internal.cpp \
581     bionic/pthread_join.cpp \
582     bionic/pthread_key.cpp \
583     bionic/pthread_kill.cpp \
584     bionic/pthread_mutex.cpp \
585     bionic/pthread_once.cpp \
586     bionic/pthread_rwlock.cpp \
587     bionic/pthread_self.cpp \
588     bionic/pthread_setname_np.cpp \
589     bionic/pthread_setschedparam.cpp \
590     bionic/pthread_sigmask.cpp \
591     bionic/pthread_spinlock.cpp \
592
593 libc_arch_static_src_files := \
594     bionic/dl_iterate_phdr_static.cpp \
595
596 # Various kinds of cruft.
597 # ========================================================
598 libc_common_src_files += \
599     bionic/ndk_cruft.cpp \
600
601 libc_bionic_ndk_src_files_32 += \
602     bionic/mmap.cpp \
603
604 libc_common_src_files_32 += \
605     bionic/legacy_32_bit_support.cpp \
606     bionic/time64.c \
607
608 libc_netbsd_src_files_32 += \
609     upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \
610
611 libc_openbsd_src_files_32 += \
612     upstream-openbsd/lib/libc/stdio/putw.c \
613
614
615 # Define some common cflags
616 # ========================================================
617 libc_common_cflags := \
618     -D_LIBC=1 \
619     -Wall -Wextra -Wunused \
620
621 use_clang := $(USE_CLANG_PLATFORM_BUILD)
622
623 # Clang/llvm has incompatible long double (fp128) for x86_64.
624 # https://llvm.org/bugs/show_bug.cgi?id=23897
625 ifeq ($(TARGET_ARCH),x86_64)
626   use_clang := false
627 endif
628
629 # b/25291096, Clang/llvm compiled libc.so for mips/mips64 failed to boot.
630 ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64))
631   use_clang := false
632 endif
633
634 ifeq ($(use_clang),)
635   use_clang := true
636 endif
637
638 # Try to catch typical 32-bit assumptions that break with 64-bit pointers.
639 libc_common_cflags += \
640     -Werror=pointer-to-int-cast \
641     -Werror=int-to-pointer-cast \
642     -Werror=type-limits \
643     -Werror \
644
645 ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
646   libc_common_cflags += -DDEBUG
647 endif
648
649 ifeq ($(MALLOC_SVELTE),true)
650   libc_common_cflags += -DUSE_DLMALLOC
651   libc_malloc_src := bionic/dlmalloc.c
652 else
653   libc_common_cflags += -DUSE_JEMALLOC
654   libc_malloc_src := bionic/jemalloc_wrapper.cpp
655   libc_common_c_includes += external/jemalloc/include
656 endif
657
658 # Define some common conlyflags
659 libc_common_conlyflags := \
660     -std=gnu99
661
662 # Define some common cppflags
663 libc_common_cppflags := \
664
665 # Define some common includes
666 # ========================================================
667 libc_common_c_includes += \
668     $(LOCAL_PATH)/stdio   \
669
670 # ========================================================
671 # Add in the arch or 32-bit specific flags
672 # Must be called with $(eval).
673 # $(1): the LOCAL_ variable name
674 # $(2): the bionic variable name to pull in
675 define patch-up-arch-specific-flags
676 $(1)_$(TARGET_ARCH) += $($(2)_$(TARGET_ARCH))
677 $(1)_32 += $($(2)_32)
678 ifdef TARGET_2ND_ARCH
679 $(1)_$(TARGET_2ND_ARCH) += $($(2)_$(TARGET_2ND_ARCH))
680 endif
681 endef
682
683
684 # ========================================================
685 # libc_stack_protector.a - stack protector code
686 # ========================================================
687 #
688 # Code that implements the stack protector (or that runs
689 # before TLS has been set up) needs to be compiled with
690 # -fno-stack-protector, since it accesses the stack canary
691 # TLS slot.
692
693 include $(CLEAR_VARS)
694
695 LOCAL_SRC_FILES := \
696     bionic/__libc_init_main_thread.cpp \
697     bionic/__stack_chk_fail.cpp \
698
699 LOCAL_SRC_FILES_arm64 := arch-arm64/bionic/__set_tls.c
700 LOCAL_SRC_FILES_x86 := arch-x86/bionic/__set_tls.c
701 LOCAL_SRC_FILES_x86_64 := arch-x86_64/bionic/__set_tls.c
702
703 LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
704 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
705 LOCAL_CPPFLAGS := $(libc_common_cppflags)
706 LOCAL_C_INCLUDES := $(libc_common_c_includes)
707 LOCAL_MODULE := libc_stack_protector
708 LOCAL_CLANG := $(use_clang)
709 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
710 LOCAL_CXX_STL := none
711 LOCAL_SYSTEM_SHARED_LIBRARIES :=
712 LOCAL_SANITIZE := never
713 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
714
715 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
716 include $(BUILD_STATIC_LIBRARY)
717
718
719 # libc_init_static.cpp also needs to be built without stack protector,
720 # because it's responsible for setting up TLS for static executables.
721 # This isn't the case for dynamic executables because the dynamic linker
722 # has already set up the main thread's TLS.
723
724 include $(CLEAR_VARS)
725
726 LOCAL_SRC_FILES := bionic/libc_init_static.cpp
727 LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
728 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
729 LOCAL_CPPFLAGS := $(libc_common_cppflags)
730 LOCAL_C_INCLUDES := $(libc_common_c_includes)
731 LOCAL_MODULE := libc_init_static
732 LOCAL_CLANG := $(use_clang)
733 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
734 LOCAL_CXX_STL := none
735 LOCAL_SYSTEM_SHARED_LIBRARIES :=
736 LOCAL_SANITIZE := never
737 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
738
739 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
740 include $(BUILD_STATIC_LIBRARY)
741
742
743 # ========================================================
744 # libc_tzcode.a - upstream 'tzcode' code
745 # ========================================================
746
747 include $(CLEAR_VARS)
748
749 LOCAL_SRC_FILES := $(call all-c-files-under,tzcode)
750 # tzcode doesn't include wcsftime, so we use the OpenBSD one.
751 LOCAL_SRC_FILES += upstream-openbsd/lib/libc/time/wcsftime.c
752
753 LOCAL_CFLAGS := $(libc_common_cflags) \
754     -fvisibility=hidden \
755     -Wno-unused-parameter \
756
757 # Don't use ridiculous amounts of stack.
758 LOCAL_CFLAGS += -DALL_STATE
759 # Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
760 LOCAL_CFLAGS += -DSTD_INSPIRED
761 # Obviously, we want to be thread-safe.
762 LOCAL_CFLAGS += -DTHREAD_SAFE
763 # The name of the tm_gmtoff field in our struct tm.
764 LOCAL_CFLAGS += -DTM_GMTOFF=tm_gmtoff
765 # Where we store our tzdata.
766 LOCAL_CFLAGS += -DTZDIR=\"/system/usr/share/zoneinfo\"
767 # Include timezone and daylight globals.
768 LOCAL_CFLAGS += -DUSG_COMPAT=1
769 # Use the empty string (instead of "   ") as the timezone abbreviation fallback.
770 LOCAL_CFLAGS += -DWILDABBR=\"\"
771 LOCAL_CFLAGS += -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
772 LOCAL_CFLAGS += -Dlint
773
774 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
775 LOCAL_CPPFLAGS := $(libc_common_cppflags)
776 LOCAL_C_INCLUDES := $(libc_common_c_includes) $(LOCAL_PATH)/tzcode/
777 LOCAL_MODULE := libc_tzcode
778 LOCAL_CLANG := $(use_clang)
779 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
780 LOCAL_CXX_STL := none
781 LOCAL_SYSTEM_SHARED_LIBRARIES :=
782 LOCAL_SANITIZE := never
783 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
784
785 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
786 include $(BUILD_STATIC_LIBRARY)
787
788
789 # ========================================================
790 # libc_dns.a - modified NetBSD DNS code
791 # ========================================================
792
793 include $(CLEAR_VARS)
794
795 LOCAL_SRC_FILES := \
796     $(call all-c-files-under,dns) \
797     upstream-netbsd/lib/libc/isc/ev_streams.c \
798     upstream-netbsd/lib/libc/isc/ev_timers.c \
799     upstream-netbsd/lib/libc/resolv/mtctxres.c \
800
801 LOCAL_CFLAGS += \
802     $(libc_common_cflags) \
803     -DANDROID_CHANGES \
804     -DINET6 \
805     -fvisibility=hidden \
806     -Wno-unused-parameter \
807     -include netbsd-compat.h \
808
809 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
810 LOCAL_CPPFLAGS := $(libc_common_cppflags)
811 LOCAL_C_INCLUDES := $(libc_common_c_includes) \
812     $(LOCAL_PATH)/dns/include \
813     $(LOCAL_PATH)/private \
814     $(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
815     $(LOCAL_PATH)/upstream-netbsd/android/include \
816
817 LOCAL_MODULE := libc_dns
818 LOCAL_CLANG := $(use_clang)
819 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
820 LOCAL_CXX_STL := none
821 LOCAL_SYSTEM_SHARED_LIBRARIES :=
822 LOCAL_SANITIZE := never
823 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
824
825 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
826 include $(BUILD_STATIC_LIBRARY)
827
828
829 # ========================================================
830 # libc_freebsd.a - upstream FreeBSD C library code
831 # ========================================================
832 #
833 # These files are built with the freebsd-compat.h header file
834 # automatically included.
835
836 include $(CLEAR_VARS)
837
838 LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files)
839 LOCAL_CFLAGS := \
840     $(libc_common_cflags) \
841     -Wno-sign-compare -Wno-uninitialized \
842     -include freebsd-compat.h \
843
844 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
845 LOCAL_CPPFLAGS := $(libc_common_cppflags)
846 LOCAL_C_INCLUDES := $(libc_common_c_includes) \
847     $(LOCAL_PATH)/upstream-freebsd/android/include \
848     $(LOCAL_PATH)/upstream-freebsd/lib/libc/include \
849
850 LOCAL_MODULE := libc_freebsd
851 LOCAL_CLANG := $(use_clang)
852 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
853 LOCAL_CXX_STL := none
854 LOCAL_SYSTEM_SHARED_LIBRARIES :=
855 LOCAL_SANITIZE := never
856 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
857
858 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
859 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES_EXCLUDE,libc_freebsd_src_files_exclude))
860 include $(BUILD_STATIC_LIBRARY)
861
862
863 # ========================================================
864 # libc_netbsd.a - upstream NetBSD C library code
865 # ========================================================
866 #
867 # These files are built with the netbsd-compat.h header file
868 # automatically included.
869
870 include $(CLEAR_VARS)
871
872 LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
873 LOCAL_CFLAGS := \
874     $(libc_common_cflags) \
875     -Wno-sign-compare -Wno-uninitialized \
876     -DPOSIX_MISTAKE \
877     -include netbsd-compat.h \
878
879 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
880 LOCAL_CPPFLAGS := $(libc_common_cppflags)
881 LOCAL_C_INCLUDES := $(libc_common_c_includes) \
882     $(LOCAL_PATH)/upstream-netbsd/android/include \
883     $(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
884
885 LOCAL_MODULE := libc_netbsd
886 LOCAL_CLANG := $(use_clang)
887 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
888 LOCAL_CXX_STL := none
889 LOCAL_SYSTEM_SHARED_LIBRARIES :=
890 LOCAL_SANITIZE := never
891 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
892
893 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
894 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_netbsd_src_files))
895 include $(BUILD_STATIC_LIBRARY)
896
897
898 # ========================================================
899 # libc_openbsd_ndk.a - upstream OpenBSD C library code
900 # that can be safely included in the libc_ndk.a (doesn't
901 # contain any troublesome global data or constructors).
902 # ========================================================
903 #
904 # These files are built with the openbsd-compat.h header file
905 # automatically included.
906
907 include $(CLEAR_VARS)
908
909 LOCAL_SRC_FILES := $(libc_upstream_openbsd_ndk_src_files)
910 LOCAL_CLANG := $(use_clang)
911
912 LOCAL_CFLAGS := \
913     $(libc_common_cflags) \
914     -Wno-sign-compare \
915     -Wno-uninitialized \
916     -Wno-unused-parameter \
917     -include openbsd-compat.h \
918
919 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
920 LOCAL_CPPFLAGS := $(libc_common_cppflags)
921 LOCAL_C_INCLUDES := $(libc_common_c_includes) \
922     $(LOCAL_PATH)/private \
923     $(LOCAL_PATH)/upstream-openbsd/android/include \
924     $(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
925     $(LOCAL_PATH)/upstream-openbsd/lib/libc/gdtoa/ \
926
927 LOCAL_MODULE := libc_openbsd_ndk
928 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
929 LOCAL_CXX_STL := none
930 LOCAL_SYSTEM_SHARED_LIBRARIES :=
931 LOCAL_SANITIZE := never
932 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
933
934 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
935 include $(BUILD_STATIC_LIBRARY)
936
937
938 # ========================================================
939 # libc_openbsd.a - upstream OpenBSD C library code
940 # ========================================================
941 #
942 # These files are built with the openbsd-compat.h header file
943 # automatically included.
944
945 include $(CLEAR_VARS)
946
947 LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files)
948 LOCAL_CLANG := $(use_clang)
949
950 LOCAL_CFLAGS := \
951     $(libc_common_cflags) \
952     -Wno-sign-compare \
953     -Wno-uninitialized \
954     -Wno-unused-parameter \
955     -include openbsd-compat.h \
956
957 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
958 LOCAL_CPPFLAGS := $(libc_common_cppflags)
959 LOCAL_C_INCLUDES := $(libc_common_c_includes) \
960     $(LOCAL_PATH)/private \
961     $(LOCAL_PATH)/upstream-openbsd/android/include \
962     $(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
963     $(LOCAL_PATH)/upstream-openbsd/lib/libc/gdtoa/ \
964
965 LOCAL_MODULE := libc_openbsd
966 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
967 LOCAL_CXX_STL := none
968 LOCAL_SYSTEM_SHARED_LIBRARIES :=
969 LOCAL_SANITIZE := never
970 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
971
972 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
973 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_openbsd_src_files))
974 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES_EXCLUDE,libc_openbsd_src_files_exclude))
975 include $(BUILD_STATIC_LIBRARY)
976
977
978 # ========================================================
979 # libc_gdtoa.a - upstream OpenBSD C library gdtoa code
980 # ========================================================
981 #
982 # These files are built with the openbsd-compat.h header file
983 # automatically included.
984
985 include $(CLEAR_VARS)
986
987 LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32)
988 LOCAL_SRC_FILES_64 := $(libc_upstream_openbsd_gdtoa_src_files_64)
989 LOCAL_CLANG := $(use_clang)
990
991 LOCAL_CFLAGS := \
992     $(libc_common_cflags) \
993     -Wno-sign-compare -Wno-uninitialized \
994     -fvisibility=hidden \
995     -include openbsd-compat.h \
996
997 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
998 LOCAL_CPPFLAGS := $(libc_common_cppflags)
999 LOCAL_C_INCLUDES := $(libc_common_c_includes) \
1000     $(LOCAL_PATH)/private \
1001     $(LOCAL_PATH)/upstream-openbsd/android/include \
1002     $(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
1003
1004 LOCAL_MODULE := libc_gdtoa
1005 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1006 LOCAL_CXX_STL := none
1007 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1008 LOCAL_SANITIZE := never
1009 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1010
1011 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1012 include $(BUILD_STATIC_LIBRARY)
1013
1014
1015 # ========================================================
1016 # libc_bionic.a - home-grown C library code
1017 # ========================================================
1018
1019 include $(CLEAR_VARS)
1020
1021 LOCAL_SRC_FILES := $(libc_bionic_src_files)
1022 LOCAL_CFLAGS := $(libc_common_cflags) \
1023     -Wframe-larger-than=2048 \
1024
1025 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1026 LOCAL_CPPFLAGS := $(libc_common_cppflags) -Wold-style-cast
1027 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
1028 LOCAL_MODULE := libc_bionic
1029 LOCAL_CLANG := $(use_clang)
1030 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1031 LOCAL_CXX_STL := none
1032 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1033 LOCAL_SANITIZE := never
1034 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1035
1036 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1037 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_bionic_src_files))
1038 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES_EXCLUDE,libc_bionic_src_files_exclude))
1039 include $(BUILD_STATIC_LIBRARY)
1040
1041
1042 # ========================================================
1043 # libc_bionic_ndk.a - The portions of libc_bionic that can
1044 # be safely used in libc_ndk.a (no troublesome global data
1045 # or constructors).
1046 # ========================================================
1047
1048 include $(CLEAR_VARS)
1049
1050 LOCAL_SRC_FILES := $(libc_bionic_ndk_src_files)
1051 LOCAL_CFLAGS := $(libc_common_cflags) \
1052     -Wframe-larger-than=2048 \
1053
1054 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1055 LOCAL_CPPFLAGS := $(libc_common_cppflags) -Wold-style-cast
1056 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
1057 LOCAL_MODULE := libc_bionic_ndk
1058 LOCAL_CLANG := $(use_clang)
1059 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1060 LOCAL_CXX_STL := none
1061 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1062 LOCAL_SANITIZE := never
1063 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1064
1065 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1066 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_bionic_ndk_src_files))
1067 include $(BUILD_STATIC_LIBRARY)
1068
1069
1070 # ========================================================
1071 # libc_pthread.a - pthreads parts that previously lived in
1072 # libc_bionic.a. Relocated to their own library because
1073 # they can't be included in libc_ndk.a (as they layout of
1074 # pthread_t has changed over the years and has ABI
1075 # compatibility issues).
1076 # ========================================================
1077
1078 include $(CLEAR_VARS)
1079
1080 LOCAL_SRC_FILES := $(libc_pthread_src_files)
1081 LOCAL_CFLAGS := $(libc_common_cflags) \
1082     -Wframe-larger-than=2048 \
1083
1084 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1085 LOCAL_CPPFLAGS := $(libc_common_cppflags) -Wold-style-cast
1086 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1087 LOCAL_MODULE := libc_pthread
1088 LOCAL_CLANG := $(use_clang)
1089 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1090 LOCAL_CXX_STL := none
1091 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1092 LOCAL_SANITIZE := never
1093 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1094
1095 include $(BUILD_STATIC_LIBRARY)
1096
1097
1098 # ========================================================
1099 # libc_cxa.a - Things traditionally in libstdc++
1100 # ========================================================
1101
1102 include $(CLEAR_VARS)
1103
1104 LOCAL_SRC_FILES := $(libc_cxa_src_files)
1105 LOCAL_CFLAGS := $(libc_common_cflags) \
1106     -fvisibility=hidden \
1107
1108 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1109 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1110 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
1111 LOCAL_MODULE := libc_cxa
1112 LOCAL_CLANG := true # GCC refuses to hide new/delete
1113 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1114 LOCAL_CXX_STL := none
1115 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1116 LOCAL_SANITIZE := never
1117 # b/17574078: Need to disable coverage until we have a prebuilt libprofile_rt.
1118 # Since this is a static library built with clang, it needs to link
1119 # libprofile_rt when it is linked into the final binary. Since the final binary
1120 # is built with GCC, it won't link libprofile_rt. We can't very easily just add
1121 # libprofile_rt to all link lines the way we've done for libgcov because
1122 # libprofile_rt isn't prebuilt, and it would be tricky to write a rule that
1123 # would make sure libprofile_rt is built.
1124 LOCAL_NATIVE_COVERAGE := false
1125
1126 include $(BUILD_STATIC_LIBRARY)
1127
1128
1129 # ========================================================
1130 # libc_syscalls.a
1131 # ========================================================
1132
1133 include $(CLEAR_VARS)
1134
1135 LOCAL_SRC_FILES_$(TARGET_ARCH) := $(call all-S-files-under,arch-$(TARGET_ARCH)/syscalls)
1136 ifdef TARGET_2ND_ARCH
1137 LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) := $(call all-S-files-under,arch-$(TARGET_2ND_ARCH)/syscalls)
1138 endif
1139 LOCAL_MODULE := libc_syscalls
1140 LOCAL_CLANG := $(use_clang)
1141 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1142 LOCAL_CXX_STL := none
1143 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1144 LOCAL_SANITIZE := never
1145 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1146
1147 include $(BUILD_STATIC_LIBRARY)
1148
1149
1150 # ========================================================
1151 # libc_aeabi.a
1152 # This is an LP32 ARM-only library that needs to be built with -fno-builtin
1153 # to avoid infinite recursion. For the other architectures we just build an
1154 # empty library to keep this makefile simple.
1155 # ========================================================
1156
1157 include $(CLEAR_VARS)
1158
1159 LOCAL_SRC_FILES_arm := arch-arm/bionic/__aeabi.c
1160 LOCAL_MODULE := libc_aeabi
1161 LOCAL_CLANG := $(use_clang)
1162 LOCAL_CFLAGS := $(libc_common_cflags) -fno-builtin
1163 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1164 LOCAL_CXX_STL := none
1165 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1166 LOCAL_SANITIZE := never
1167 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1168
1169 include $(BUILD_STATIC_LIBRARY)
1170
1171 # ========================================================
1172 # libc_ndk.a
1173 # Compatibility library for the NDK. This library contains
1174 # all the parts of libc that are safe to statically link.
1175 # We can't safely statically link things that can only run
1176 # on a certain version of the OS. Examples include
1177 # anything that talks to netd (a large portion of the DNS
1178 # code) and anything that is dependent on the layout of a
1179 # data structure that has changed across releases (such as
1180 # pthread_t).
1181 # ========================================================
1182
1183 include $(CLEAR_VARS)
1184
1185 LOCAL_MODULE := libc_ndk
1186 LOCAL_CLANG := $(use_clang)
1187 LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
1188 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1189 LOCAL_CFLAGS := $(libc_common_cflags) -fvisibility=hidden -O0
1190 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1191 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1192 LOCAL_SANITIZE := never
1193 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1194 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1195
1196 LOCAL_SRC_FILES := \
1197     $(libc_common_src_files) \
1198     $(libc_arch_dynamic_src_files) \
1199     $(libc_ndk_stub_src_files) \
1200     bionic/malloc_debug_common.cpp \
1201
1202 LOCAL_SRC_FILES_arm += \
1203     arch-common/bionic/crtbegin_so.c \
1204     arch-arm/bionic/atexit_legacy.c \
1205     arch-common/bionic/crtend_so.S \
1206
1207 LOCAL_CFLAGS := $(libc_common_cflags) \
1208     -DLIBC_STATIC \
1209
1210 LOCAL_WHOLE_STATIC_LIBRARIES := \
1211     libc_bionic_ndk \
1212     libc_cxa \
1213     libc_freebsd \
1214     libc_gdtoa \
1215     libc_malloc \
1216     libc_netbsd \
1217     libc_openbsd_ndk \
1218     libc_stack_protector \
1219     libc_syscalls \
1220     libc_tzcode \
1221     libm \
1222
1223 LOCAL_WHOLE_STATIC_LIBRARIES_arm := libc_aeabi
1224 LOCAL_CXX_STL := none
1225
1226 ifneq ($(MALLOC_SVELTE),true)
1227 LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
1228 endif
1229
1230 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1231 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_common_src_files))
1232 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src_files))
1233 $(eval $(call patch-up-arch-specific-flags,LOCAL_ASFLAGS,LOCAL_CFLAGS))
1234
1235 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1236 include $(BUILD_STATIC_LIBRARY)
1237
1238 # ========================================================
1239 # libc_common.a
1240 # ========================================================
1241
1242 include $(CLEAR_VARS)
1243
1244 LOCAL_SRC_FILES := $(libc_common_src_files)
1245 LOCAL_CFLAGS := $(libc_common_cflags)
1246 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1247 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1248 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1249 LOCAL_MODULE := libc_common
1250 LOCAL_CLANG := $(use_clang)
1251 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1252 LOCAL_WHOLE_STATIC_LIBRARIES := \
1253     libc_bionic \
1254     libc_bionic_ndk \
1255     libc_cxa \
1256     libc_dns \
1257     libc_freebsd \
1258     libc_gdtoa \
1259     libc_malloc \
1260     libc_netbsd \
1261     libc_openbsd \
1262     libc_openbsd_ndk \
1263     libc_pthread \
1264     libc_stack_protector \
1265     libc_syscalls \
1266     libc_tzcode \
1267
1268 LOCAL_WHOLE_STATIC_LIBRARIES_arm := libc_aeabi
1269
1270 LOCAL_CXX_STL := none
1271 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1272
1273 # TODO: split out the asflags.
1274 LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
1275 LOCAL_SANITIZE := never
1276 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1277
1278 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1279 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_common_src_files))
1280 $(eval $(call patch-up-arch-specific-flags,LOCAL_ASFLAGS,LOCAL_CFLAGS))
1281 include $(BUILD_STATIC_LIBRARY)
1282
1283
1284 # ========================================================
1285 # libc_nomalloc.a
1286 # ========================================================
1287 #
1288 # This is a version of the static C library that does not
1289 # include malloc. It's useful in situations when the user wants
1290 # to provide their own malloc implementation, or wants to
1291 # explicitly disallow the use of malloc, such as in the
1292 # dynamic linker.
1293
1294 include $(CLEAR_VARS)
1295
1296 LOCAL_SRC_FILES := \
1297     $(libc_arch_static_src_files) \
1298
1299 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1300 LOCAL_CFLAGS := $(libc_common_cflags) \
1301     -DLIBC_STATIC \
1302
1303 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1304 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1305
1306 LOCAL_MODULE := libc_nomalloc
1307 LOCAL_CLANG := $(use_clang)
1308 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1309 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common libc_init_static
1310 LOCAL_CXX_STL := none
1311 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1312 LOCAL_SANITIZE := never
1313 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1314
1315 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1316 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
1317 include $(BUILD_STATIC_LIBRARY)
1318
1319
1320 # ========================================================
1321 # libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1322 # ========================================================
1323
1324 include $(CLEAR_VARS)
1325 LOCAL_SRC_FILES := $(libc_malloc_src)
1326 LOCAL_CFLAGS := $(libc_common_cflags) \
1327     -fvisibility=hidden \
1328
1329 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1330 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1331 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1332 LOCAL_MODULE := libc_malloc
1333 LOCAL_CLANG := $(use_clang)
1334 LOCAL_CXX_STL := none
1335 LOCAL_SANITIZE := never
1336 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1337 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1338 include $(BUILD_STATIC_LIBRARY)
1339
1340
1341 # ========================================================
1342 # libc.a
1343 # ========================================================
1344 include $(CLEAR_VARS)
1345
1346 LOCAL_SRC_FILES := \
1347     $(libc_arch_static_src_files) \
1348     bionic/malloc_debug_common.cpp \
1349
1350 LOCAL_CFLAGS := $(libc_common_cflags) \
1351     -DLIBC_STATIC \
1352
1353 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1354 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1355 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1356 LOCAL_MODULE := libc
1357 LOCAL_CLANG := $(use_clang)
1358 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1359 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common libc_init_static
1360
1361 ifneq ($(MALLOC_SVELTE),true)
1362 LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
1363 endif
1364
1365 LOCAL_CXX_STL := none
1366 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1367 LOCAL_SANITIZE := never
1368 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1369
1370 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1371 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
1372 include $(BUILD_STATIC_LIBRARY)
1373
1374
1375 # ========================================================
1376 # libc.so
1377 # ========================================================
1378 include $(CLEAR_VARS)
1379
1380 LOCAL_CFLAGS := $(libc_common_cflags)
1381 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1382 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1383
1384 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1385 LOCAL_SRC_FILES := \
1386     arch-common/bionic/crtbegin_so.c \
1387     arch-common/bionic/crtbrand.S \
1388     $(libc_arch_dynamic_src_files) \
1389     bionic/malloc_debug_common.cpp \
1390     bionic/libc_init_dynamic.cpp \
1391     bionic/NetdClient.cpp \
1392     arch-common/bionic/crtend_so.S \
1393
1394 LOCAL_MODULE := libc
1395 LOCAL_CLANG := $(use_clang)
1396 LOCAL_REQUIRED_MODULES := tzdata
1397 LOCAL_ADDITIONAL_DEPENDENCIES := \
1398     $(libc_common_additional_dependencies) \
1399     $(LOCAL_PATH)/libc.arm.map \
1400     $(LOCAL_PATH)/libc.arm64.map \
1401     $(LOCAL_PATH)/libc.mips.map \
1402     $(LOCAL_PATH)/libc.mips64.map \
1403     $(LOCAL_PATH)/libc.x86.map \
1404     $(LOCAL_PATH)/libc.x86_64.map \
1405     $(LOCAL_PATH)/libc.arm.brillo.map \
1406     $(LOCAL_PATH)/libc.mips.brillo.map \
1407     $(LOCAL_PATH)/libc.x86.brillo.map \
1408
1409 # Leave the symbols in the shared library so that stack unwinders can produce
1410 # meaningful name resolution.
1411 LOCAL_STRIP_MODULE := keep_symbols
1412
1413 # Do not pack libc.so relocations; see http://b/20645321 for details.
1414 LOCAL_PACK_MODULE_RELOCATIONS := false
1415
1416 # WARNING: The only library libc.so should depend on is libdl.so!  If you add other libraries,
1417 # make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries.  This
1418 # ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
1419 # external; if that were the case, then libc would not pull those symbols from libgcc.a as it
1420 # should, instead relying on the external symbols from the dependent libraries.  That would
1421 # create a "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
1422 # you wanted!
1423
1424 LOCAL_SHARED_LIBRARIES := libdl
1425 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1426
1427 ifneq ($(MALLOC_SVELTE),true)
1428 LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
1429 endif
1430
1431 LOCAL_CXX_STL := none
1432 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1433
1434 # TODO: This is to work around b/24465209. Remove after root cause is fixed
1435 LOCAL_LDFLAGS_arm := -Wl,--hash-style=both
1436 LOCAL_LDFLAGS_x86 := -Wl,--hash-style=both
1437
1438 # Don't re-export new/delete and friends, even if the compiler really wants to.
1439 ifdef BRILLO
1440 LOCAL_LDFLAGS_arm    += -Wl,--version-script,$(LOCAL_PATH)/libc.arm.brillo.map
1441 LOCAL_LDFLAGS_mips   += -Wl,--version-script,$(LOCAL_PATH)/libc.mips.brillo.map
1442 LOCAL_LDFLAGS_x86    += -Wl,--version-script,$(LOCAL_PATH)/libc.x86.brillo.map
1443 else
1444 LOCAL_LDFLAGS_arm    += -Wl,--version-script,$(LOCAL_PATH)/libc.arm.map
1445 LOCAL_LDFLAGS_mips   += -Wl,--version-script,$(LOCAL_PATH)/libc.mips.map
1446 LOCAL_LDFLAGS_x86    += -Wl,--version-script,$(LOCAL_PATH)/libc.x86.map
1447 endif
1448
1449 LOCAL_LDFLAGS_arm64  += -Wl,--version-script,$(LOCAL_PATH)/libc.arm64.map
1450 LOCAL_LDFLAGS_mips64 += -Wl,--version-script,$(LOCAL_PATH)/libc.mips64.map
1451 LOCAL_LDFLAGS_x86_64 += -Wl,--version-script,$(LOCAL_PATH)/libc.x86_64.map
1452
1453 # We'd really like to do this for all architectures, but since this wasn't done
1454 # before, these symbols must continue to be exported on LP32 for binary
1455 # compatibility.
1456 LOCAL_LDFLAGS_64 := -Wl,--exclude-libs,libgcc.a
1457
1458 # Unfortunately --exclude-libs clobbers our version script, so we have to
1459 # prevent the build system from using this flag.
1460 LOCAL_NO_EXCLUDE_LIBS := true
1461
1462 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1463 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src_files))
1464
1465 LOCAL_NO_CRT := true
1466 LOCAL_ASFLAGS += $(libc_crt_target_cflags)
1467
1468 # special for arm
1469 LOCAL_CFLAGS_arm += -DCRT_LEGACY_WORKAROUND
1470 LOCAL_SRC_FILES_arm += \
1471     arch-arm/bionic/atexit_legacy.c
1472
1473 LOCAL_SANITIZE := never
1474 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1475
1476 include $(BUILD_SHARED_LIBRARY)
1477
1478
1479 # For all builds, except for the -user build we will enable memory
1480 # allocation checking (including memory leaks, buffer overwrites, etc.)
1481 # Note that all these checks are also controlled by env. settings
1482 # that can enable, or disable specific checks. Note also that some of
1483 # the checks are available only in emulator and are implemeted in
1484 # libc_malloc_qemu_instrumented.so.
1485 ifneq ($(TARGET_BUILD_VARIANT),user)
1486
1487 # ========================================================
1488 # libc_malloc_debug_leak.so
1489 # ========================================================
1490 include $(CLEAR_VARS)
1491
1492 LOCAL_CFLAGS := $(libc_common_cflags)
1493 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1494 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1495
1496 # Make sure that unwind.h comes from libunwind.
1497 LOCAL_C_INCLUDES := \
1498     $(libc_common_c_includes) \
1499
1500 LOCAL_SRC_FILES := \
1501     bionic/debug_backtrace.cpp \
1502     bionic/debug_mapinfo.cpp \
1503     bionic/libc_logging.cpp \
1504     bionic/malloc_debug_leak.cpp \
1505     bionic/malloc_debug_check.cpp \
1506
1507 LOCAL_MODULE := libc_malloc_debug_leak
1508 LOCAL_CLANG := $(use_clang)
1509 LOCAL_ADDITIONAL_DEPENDENCIES := \
1510     $(libc_common_additional_dependencies) \
1511     $(LOCAL_PATH)/version_script.txt \
1512
1513 LOCAL_SHARED_LIBRARIES := libc libdl
1514 LOCAL_CXX_STL := none
1515 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1516 # Only need this for arm since libc++ uses its own unwind code that
1517 # doesn't mix with the other default unwind code.
1518 LOCAL_STATIC_LIBRARIES_arm := libunwind_llvm
1519 LOCAL_LDFLAGS_arm := -Wl,--exclude-libs,libunwind_llvm.a
1520 LOCAL_STATIC_LIBRARIES += libc++abi
1521 LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
1522
1523 # Don't re-export new/delete and friends, even if the compiler really wants to.
1524 LOCAL_LDFLAGS := -Wl,--version-script,$(LOCAL_PATH)/version_script.txt
1525
1526 # Unfortunately --exclude-libs clobbers our version script, so we have to
1527 # prevent the build system from using this flag.
1528 LOCAL_NO_EXCLUDE_LIBS := true
1529
1530 # Don't install on release build
1531 LOCAL_MODULE_TAGS := eng debug
1532 LOCAL_SANITIZE := never
1533 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1534
1535 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1536 include $(BUILD_SHARED_LIBRARY)
1537
1538
1539 # ========================================================
1540 # libc_malloc_debug_qemu.so
1541 # ========================================================
1542 include $(CLEAR_VARS)
1543
1544 LOCAL_CFLAGS := \
1545     $(libc_common_cflags) \
1546     -DMALLOC_QEMU_INSTRUMENT \
1547
1548 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1549 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1550
1551 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1552
1553 LOCAL_SRC_FILES := \
1554     bionic/libc_logging.cpp \
1555     bionic/malloc_debug_qemu.cpp \
1556
1557 LOCAL_MODULE := libc_malloc_debug_qemu
1558 LOCAL_CLANG := $(use_clang)
1559 LOCAL_ADDITIONAL_DEPENDENCIES := \
1560     $(libc_common_additional_dependencies) \
1561     $(LOCAL_PATH)/version_script.txt \
1562
1563 LOCAL_SHARED_LIBRARIES := libc libdl
1564 LOCAL_CXX_STL := none
1565 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1566
1567 # Don't re-export new/delete and friends, even if the compiler really wants to.
1568 LOCAL_LDFLAGS := -Wl,--version-script,$(LOCAL_PATH)/version_script.txt
1569
1570 # Unfortunately --exclude-libs clobbers our version script, so we have to
1571 # prevent the build system from using this flag.
1572 LOCAL_NO_EXCLUDE_LIBS := true
1573
1574 # Don't install on release build
1575 LOCAL_MODULE_TAGS := eng debug
1576 LOCAL_SANITIZE := never
1577 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1578
1579 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1580 include $(BUILD_SHARED_LIBRARY)
1581
1582 endif  #!user
1583
1584 # ========================================================
1585 # libstdc++.so
1586 # ========================================================
1587 libstdcxx_common_src_files := \
1588     bionic/__cxa_guard.cpp \
1589     bionic/__cxa_pure_virtual.cpp \
1590     bionic/new.cpp \
1591     bionic/libc_logging.cpp \
1592
1593 include $(CLEAR_VARS)
1594 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
1595 LOCAL_CFLAGS := $(libc_common_cflags)
1596 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1597
1598 # TODO: This is to work around b/24465209. Remove after root cause is fixed
1599 LOCAL_LDFLAGS_arm := -Wl,--hash-style=both
1600 LOCAL_LDFLAGS_x86 := -Wl,--hash-style=both
1601
1602 LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1603 LOCAL_MODULE:= libstdc++
1604 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1605 LOCAL_CXX_STL := none
1606 LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1607 LOCAL_SANITIZE := never
1608 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1609 include $(BUILD_SHARED_LIBRARY)
1610
1611 # ========================================================
1612 # libstdc++.a
1613 # ========================================================
1614 include $(CLEAR_VARS)
1615 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
1616 LOCAL_CFLAGS := $(libc_common_cflags)
1617 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1618 LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1619 LOCAL_MODULE:= libstdc++
1620 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1621 LOCAL_CXX_STL := none
1622 LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1623 LOCAL_SANITIZE := never
1624 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1625 include $(BUILD_STATIC_LIBRARY)
1626