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/gethostname.c \
47 bionic/getpriority.c \
48 bionic/if_indextoname.c \
49 bionic/if_nametoindex.c \
50 bionic/initgroups.c \
51 bionic/ioctl.c \
52 bionic/isatty.c \
53 bionic/memmem.c \
54 bionic/pututline.c \
55 bionic/sched_cpualloc.c \
56 bionic/sched_cpucount.c \
57 bionic/sigblock.c \
58 bionic/siginterrupt.c \
59 bionic/sigsetmask.c \
60 bionic/system_properties_compat.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/clone.cpp \
102 bionic/__cmsg_nxthdr.cpp \
103 bionic/connect.cpp \
104 bionic/ctype.cpp \
105 bionic/dirent.cpp \
106 bionic/dup2.cpp \
107 bionic/epoll_create.cpp \
108 bionic/epoll_pwait.cpp \
109 bionic/epoll_wait.cpp \
110 bionic/__errno.cpp \
111 bionic/eventfd_read.cpp \
112 bionic/eventfd_write.cpp \
113 bionic/ffs.cpp \
114 bionic/flockfile.cpp \
115 bionic/fork.cpp \
116 bionic/fpclassify.cpp \
117 bionic/futimens.cpp \
118 bionic/getauxval.cpp \
119 bionic/getcwd.cpp \
120 bionic/getentropy_linux.c \
121 bionic/getpgrp.cpp \
122 bionic/getpid.cpp \
123 bionic/gettid.cpp \
124 bionic/__gnu_basename.cpp \
125 bionic/inotify_init.cpp \
126 bionic/lchown.cpp \
127 bionic/lfs64_support.cpp \
128 bionic/__libc_current_sigrtmax.cpp \
129 bionic/__libc_current_sigrtmin.cpp \
130 bionic/libc_init_common.cpp \
131 bionic/libc_logging.cpp \
132 bionic/libgen.cpp \
133 bionic/link.cpp \
134 bionic/locale.cpp \
135 bionic/lstat.cpp \
136 bionic/malloc_info.cpp \
137 bionic/mbrtoc16.cpp \
138 bionic/mbrtoc32.cpp \
139 bionic/mbstate.cpp \
140 bionic/mkdir.cpp \
141 bionic/mkfifo.cpp \
142 bionic/mknod.cpp \
143 bionic/mntent.cpp \
144 bionic/NetdClientDispatch.cpp \
145 bionic/open.cpp \
146 bionic/pathconf.cpp \
147 bionic/pause.cpp \
148 bionic/pipe.cpp \
149 bionic/poll.cpp \
150 bionic/posix_fadvise.cpp \
151 bionic/posix_fallocate.cpp \
152 bionic/posix_timers.cpp \
153 bionic/pthread_atfork.cpp \
154 bionic/pthread_attr.cpp \
155 bionic/pthread_cond.cpp \
156 bionic/pthread_create.cpp \
157 bionic/pthread_detach.cpp \
158 bionic/pthread_equal.cpp \
159 bionic/pthread_exit.cpp \
160 bionic/pthread_getcpuclockid.cpp \
161 bionic/pthread_getschedparam.cpp \
162 bionic/pthread_gettid_np.cpp \
163 bionic/pthread_internals.cpp \
164 bionic/pthread_join.cpp \
165 bionic/pthread_key.cpp \
166 bionic/pthread_kill.cpp \
167 bionic/pthread_mutex.cpp \
168 bionic/pthread_once.cpp \
169 bionic/pthread_rwlock.cpp \
170 bionic/pthread_self.cpp \
171 bionic/pthread_setname_np.cpp \
172 bionic/pthread_setschedparam.cpp \
173 bionic/pthread_sigmask.cpp \
174 bionic/ptrace.cpp \
175 bionic/pty.cpp \
176 bionic/raise.cpp \
177 bionic/rand.cpp \
178 bionic/readlink.cpp \
179 bionic/reboot.cpp \
180 bionic/recv.cpp \
181 bionic/rename.cpp \
182 bionic/rmdir.cpp \
183 bionic/scandir.cpp \
184 bionic/sched_getaffinity.cpp \
185 bionic/sched_getcpu.cpp \
186 bionic/semaphore.cpp \
187 bionic/send.cpp \
188 bionic/setegid.cpp \
189 bionic/__set_errno.cpp \
190 bionic/seteuid.cpp \
191 bionic/setpgrp.cpp \
192 bionic/sigaction.cpp \
193 bionic/sigaddset.cpp \
194 bionic/sigdelset.cpp \
195 bionic/sigemptyset.cpp \
196 bionic/sigfillset.cpp \
197 bionic/sigismember.cpp \
198 bionic/signal.cpp \
199 bionic/signalfd.cpp \
200 bionic/sigpending.cpp \
201 bionic/sigprocmask.cpp \
202 bionic/sigsuspend.cpp \
203 bionic/sigwait.cpp \
204 bionic/socket.cpp \
205 bionic/stat.cpp \
206 bionic/statvfs.cpp \
207 bionic/strcoll_l.cpp \
208 bionic/strerror.cpp \
209 bionic/strerror_r.cpp \
210 bionic/strftime_l.cpp \
211 bionic/strsignal.cpp \
212 bionic/strtold.cpp \
213 bionic/strtold_l.cpp \
214 bionic/strtoll_l.cpp \
215 bionic/strtoull_l.cpp \
216 bionic/strxfrm_l.cpp \
217 bionic/stubs.cpp \
218 bionic/symlink.cpp \
219 bionic/sysconf.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/ldiv.c \
292 upstream-netbsd/lib/libc/stdlib/lldiv.c \
293 upstream-netbsd/lib/libc/stdlib/lrand48.c \
294 upstream-netbsd/lib/libc/stdlib/mrand48.c \
295 upstream-netbsd/lib/libc/stdlib/nrand48.c \
296 upstream-netbsd/lib/libc/stdlib/_rand48.c \
297 upstream-netbsd/lib/libc/stdlib/rand_r.c \
298 upstream-netbsd/lib/libc/stdlib/seed48.c \
299 upstream-netbsd/lib/libc/stdlib/srand48.c \
300 upstream-netbsd/lib/libc/string/memccpy.c \
301 upstream-netbsd/lib/libc/string/strcasestr.c \
302 upstream-netbsd/lib/libc/string/strcoll.c \
303 upstream-netbsd/lib/libc/string/strxfrm.c \
305 libc_upstream_openbsd_gdtoa_src_files := \
306 upstream-openbsd/android/gdtoa_support.cpp \
307 upstream-openbsd/lib/libc/gdtoa/dmisc.c \
308 upstream-openbsd/lib/libc/gdtoa/dtoa.c \
309 upstream-openbsd/lib/libc/gdtoa/gdtoa.c \
310 upstream-openbsd/lib/libc/gdtoa/gethex.c \
311 upstream-openbsd/lib/libc/gdtoa/gmisc.c \
312 upstream-openbsd/lib/libc/gdtoa/hd_init.c \
313 upstream-openbsd/lib/libc/gdtoa/hdtoa.c \
314 upstream-openbsd/lib/libc/gdtoa/hexnan.c \
315 upstream-openbsd/lib/libc/gdtoa/ldtoa.c \
316 upstream-openbsd/lib/libc/gdtoa/misc.c \
317 upstream-openbsd/lib/libc/gdtoa/smisc.c \
318 upstream-openbsd/lib/libc/gdtoa/strtod.c \
319 upstream-openbsd/lib/libc/gdtoa/strtodg.c \
320 upstream-openbsd/lib/libc/gdtoa/strtof.c \
321 upstream-openbsd/lib/libc/gdtoa/strtord.c \
322 upstream-openbsd/lib/libc/gdtoa/sum.c \
323 upstream-openbsd/lib/libc/gdtoa/ulp.c \
325 libc_upstream_openbsd_gdtoa_src_files_32 := \
326 $(libc_upstream_openbsd_gdtoa_src_files) \
328 libc_upstream_openbsd_gdtoa_src_files_64 := \
329 $(libc_upstream_openbsd_gdtoa_src_files) \
330 upstream-openbsd/lib/libc/gdtoa/strtorQ.c \
332 libc_upstream_openbsd_src_files := \
333 upstream-openbsd/lib/libc/compat-43/killpg.c \
334 upstream-openbsd/lib/libc/crypt/arc4random.c \
335 upstream-openbsd/lib/libc/crypt/arc4random_uniform.c \
336 upstream-openbsd/lib/libc/gen/alarm.c \
337 upstream-openbsd/lib/libc/gen/ctype_.c \
338 upstream-openbsd/lib/libc/gen/daemon.c \
339 upstream-openbsd/lib/libc/gen/err.c \
340 upstream-openbsd/lib/libc/gen/errx.c \
341 upstream-openbsd/lib/libc/gen/exec.c \
342 upstream-openbsd/lib/libc/gen/fnmatch.c \
343 upstream-openbsd/lib/libc/gen/ftok.c \
344 upstream-openbsd/lib/libc/gen/getprogname.c \
345 upstream-openbsd/lib/libc/gen/isctype.c \
346 upstream-openbsd/lib/libc/gen/setprogname.c \
347 upstream-openbsd/lib/libc/gen/time.c \
348 upstream-openbsd/lib/libc/gen/tolower_.c \
349 upstream-openbsd/lib/libc/gen/toupper_.c \
350 upstream-openbsd/lib/libc/gen/verr.c \
351 upstream-openbsd/lib/libc/gen/verrx.c \
352 upstream-openbsd/lib/libc/gen/vwarn.c \
353 upstream-openbsd/lib/libc/gen/vwarnx.c \
354 upstream-openbsd/lib/libc/gen/warn.c \
355 upstream-openbsd/lib/libc/gen/warnx.c \
356 upstream-openbsd/lib/libc/locale/btowc.c \
357 upstream-openbsd/lib/libc/locale/mbrlen.c \
358 upstream-openbsd/lib/libc/locale/mbstowcs.c \
359 upstream-openbsd/lib/libc/locale/mbtowc.c \
360 upstream-openbsd/lib/libc/locale/wcscoll.c \
361 upstream-openbsd/lib/libc/locale/wcstod.c \
362 upstream-openbsd/lib/libc/locale/wcstof.c \
363 upstream-openbsd/lib/libc/locale/wcstoimax.c \
364 upstream-openbsd/lib/libc/locale/wcstol.c \
365 upstream-openbsd/lib/libc/locale/wcstold.c \
366 upstream-openbsd/lib/libc/locale/wcstoll.c \
367 upstream-openbsd/lib/libc/locale/wcstombs.c \
368 upstream-openbsd/lib/libc/locale/wcstoul.c \
369 upstream-openbsd/lib/libc/locale/wcstoull.c \
370 upstream-openbsd/lib/libc/locale/wcstoumax.c \
371 upstream-openbsd/lib/libc/locale/wcsxfrm.c \
372 upstream-openbsd/lib/libc/locale/wctob.c \
373 upstream-openbsd/lib/libc/locale/wctomb.c \
374 upstream-openbsd/lib/libc/net/htonl.c \
375 upstream-openbsd/lib/libc/net/htons.c \
376 upstream-openbsd/lib/libc/net/inet_addr.c \
377 upstream-openbsd/lib/libc/net/inet_lnaof.c \
378 upstream-openbsd/lib/libc/net/inet_makeaddr.c \
379 upstream-openbsd/lib/libc/net/inet_netof.c \
380 upstream-openbsd/lib/libc/net/inet_network.c \
381 upstream-openbsd/lib/libc/net/inet_ntoa.c \
382 upstream-openbsd/lib/libc/net/inet_ntop.c \
383 upstream-openbsd/lib/libc/net/inet_pton.c \
384 upstream-openbsd/lib/libc/net/ntohl.c \
385 upstream-openbsd/lib/libc/net/ntohs.c \
386 upstream-openbsd/lib/libc/stdio/asprintf.c \
387 upstream-openbsd/lib/libc/stdio/clrerr.c \
388 upstream-openbsd/lib/libc/stdio/dprintf.c \
389 upstream-openbsd/lib/libc/stdio/fclose.c \
390 upstream-openbsd/lib/libc/stdio/fdopen.c \
391 upstream-openbsd/lib/libc/stdio/feof.c \
392 upstream-openbsd/lib/libc/stdio/ferror.c \
393 upstream-openbsd/lib/libc/stdio/fflush.c \
394 upstream-openbsd/lib/libc/stdio/fgetc.c \
395 upstream-openbsd/lib/libc/stdio/fgetln.c \
396 upstream-openbsd/lib/libc/stdio/fgetpos.c \
397 upstream-openbsd/lib/libc/stdio/fgets.c \
398 upstream-openbsd/lib/libc/stdio/fgetwc.c \
399 upstream-openbsd/lib/libc/stdio/fgetws.c \
400 upstream-openbsd/lib/libc/stdio/fileno.c \
401 upstream-openbsd/lib/libc/stdio/findfp.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/remque.c \
486 upstream-openbsd/lib/libc/stdlib/setenv.c \
487 upstream-openbsd/lib/libc/stdlib/strtoimax.c \
488 upstream-openbsd/lib/libc/stdlib/strtol.c \
489 upstream-openbsd/lib/libc/stdlib/strtoll.c \
490 upstream-openbsd/lib/libc/stdlib/strtoul.c \
491 upstream-openbsd/lib/libc/stdlib/strtoull.c \
492 upstream-openbsd/lib/libc/stdlib/strtoumax.c \
493 upstream-openbsd/lib/libc/stdlib/system.c \
494 upstream-openbsd/lib/libc/stdlib/tfind.c \
495 upstream-openbsd/lib/libc/stdlib/tsearch.c \
496 upstream-openbsd/lib/libc/string/strcasecmp.c \
497 upstream-openbsd/lib/libc/string/strcspn.c \
498 upstream-openbsd/lib/libc/string/strdup.c \
499 upstream-openbsd/lib/libc/string/strndup.c \
500 upstream-openbsd/lib/libc/string/strpbrk.c \
501 upstream-openbsd/lib/libc/string/strsep.c \
502 upstream-openbsd/lib/libc/string/strspn.c \
503 upstream-openbsd/lib/libc/string/strstr.c \
504 upstream-openbsd/lib/libc/string/strtok.c \
505 upstream-openbsd/lib/libc/string/wcslcpy.c \
506 upstream-openbsd/lib/libc/string/wcsstr.c \
507 upstream-openbsd/lib/libc/string/wcswidth.c \
509 libc_arch_static_src_files := \
510 bionic/dl_iterate_phdr_static.cpp \
512 # Define some common cflags
513 # ========================================================
514 libc_common_cflags := \
515 -D_LIBC=1 \
516 -Wall -Wextra -Wunused \
518 ifneq ($(TARGET_USES_LOGD),false)
519 libc_common_cflags += -DTARGET_USES_LOGD
520 endif
522 use_clang := $(USE_CLANG_PLATFORM_BUILD)
523 ifeq ($(use_clang),)
524 use_clang := false
525 endif
527 # Try to catch typical 32-bit assumptions that break with 64-bit pointers.
528 libc_common_cflags += \
529 -Werror=pointer-to-int-cast \
530 -Werror=int-to-pointer-cast \
531 -Werror=type-limits \
532 -Werror \
534 ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
535 libc_common_cflags += -DDEBUG
536 endif
538 ifeq ($(MALLOC_IMPL),dlmalloc)
539 libc_common_cflags += -DUSE_DLMALLOC
540 libc_malloc_src := bionic/dlmalloc.c
541 else
542 libc_common_cflags += -DUSE_JEMALLOC
543 libc_malloc_src := bionic/jemalloc_wrapper.cpp
544 libc_common_c_includes += external/jemalloc/include
545 endif
547 # To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
548 # the appropriate BoardConfig.mk file.
549 #
550 ifneq ($(BOARD_MALLOC_ALIGNMENT),)
551 libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
552 endif
554 # Define ANDROID_SMP appropriately.
555 ifeq ($(TARGET_CPU_SMP),true)
556 libc_common_cflags += -DANDROID_SMP=1
557 else
558 libc_common_cflags += -DANDROID_SMP=0
559 endif
561 # Define some common conlyflags
562 libc_common_conlyflags := \
563 -std=gnu99
565 # Define some common cppflags
566 libc_common_cppflags := \
567 -std=gnu++11
569 # Define some common includes
570 # ========================================================
571 libc_common_c_includes += \
572 $(LOCAL_PATH)/stdio \
574 # ========================================================
575 # Add in the arch-specific flags.
576 # Must be called with $(eval).
577 # $(1): the LOCAL_ variable name
578 # $(2): the bionic variable name to pull in
579 define patch-up-arch-specific-flags
580 $(1)_$(TARGET_ARCH) += $($(2)_$(TARGET_ARCH))
581 ifdef TARGET_2ND_ARCH
582 $(1)_$(TARGET_2ND_ARCH) += $($(2)_$(TARGET_2ND_ARCH))
583 endif
584 endef
587 # ========================================================
588 # libc_stack_protector.a - stack protector code
589 # ========================================================
590 #
591 # The stack protector code needs to be compiled
592 # with -fno-stack-protector, since it modifies the
593 # stack canary.
595 include $(CLEAR_VARS)
597 LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
598 LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
599 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
600 LOCAL_CPPFLAGS := $(libc_common_cppflags)
601 LOCAL_C_INCLUDES := $(libc_common_c_includes)
602 LOCAL_MODULE := libc_stack_protector
603 LOCAL_CLANG := $(use_clang)
604 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
605 LOCAL_CXX_STL := none
606 LOCAL_SYSTEM_SHARED_LIBRARIES :=
607 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
609 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
610 include $(BUILD_STATIC_LIBRARY)
613 # ========================================================
614 # libc_tzcode.a - upstream 'tzcode' code
615 # ========================================================
617 include $(CLEAR_VARS)
619 LOCAL_SRC_FILES := $(call all-c-files-under,tzcode)
620 # tzcode doesn't include wcsftime, so we use the OpenBSD one.
621 LOCAL_SRC_FILES += upstream-openbsd/lib/libc/time/wcsftime.c
623 LOCAL_CFLAGS := $(libc_common_cflags) \
624 -fvisibility=hidden \
626 # Don't use ridiculous amounts of stack.
627 LOCAL_CFLAGS += -DALL_STATE
628 # Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
629 LOCAL_CFLAGS += -DSTD_INSPIRED
630 # The name of the tm_gmtoff field in our struct tm.
631 LOCAL_CFLAGS += -DTM_GMTOFF=tm_gmtoff
632 # Where we store our tzdata.
633 LOCAL_CFLAGS += -DTZDIR=\"/system/usr/share/zoneinfo\"
634 # Include timezone and daylight globals.
635 LOCAL_CFLAGS += -DUSG_COMPAT=1
636 LOCAL_CFLAGS += -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
637 LOCAL_CFLAGS += -Dlint
639 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
640 LOCAL_CPPFLAGS := $(libc_common_cppflags)
641 LOCAL_C_INCLUDES := $(libc_common_c_includes) $(LOCAL_PATH)/tzcode/
642 LOCAL_MODULE := libc_tzcode
643 LOCAL_CLANG := $(use_clang)
644 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
645 LOCAL_CXX_STL := none
646 LOCAL_SYSTEM_SHARED_LIBRARIES :=
647 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
649 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
650 include $(BUILD_STATIC_LIBRARY)
653 # ========================================================
654 # libc_dns.a - modified NetBSD DNS code
655 # ========================================================
657 include $(CLEAR_VARS)
659 LOCAL_SRC_FILES := \
660 $(call all-c-files-under,dns) \
661 upstream-netbsd/lib/libc/isc/ev_streams.c \
662 upstream-netbsd/lib/libc/isc/ev_timers.c \
663 upstream-netbsd/lib/libc/resolv/mtctxres.c \
665 # We use the OpenBSD res_random.
666 LOCAL_CFLAGS += \
667 -Dres_randomid=__res_randomid
668 LOCAL_SRC_FILES += \
669 upstream-openbsd/lib/libc/net/res_random.c \
671 LOCAL_CFLAGS += \
672 $(libc_common_cflags) \
673 -DANDROID_CHANGES \
674 -DINET6 \
675 -fvisibility=hidden \
676 -Wno-unused-parameter \
677 -I$(LOCAL_PATH)/dns/include \
678 -I$(LOCAL_PATH)/private \
679 -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
680 -I$(LOCAL_PATH)/upstream-netbsd/android/include \
681 -include netbsd-compat.h \
683 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
684 LOCAL_CPPFLAGS := $(libc_common_cppflags)
685 LOCAL_C_INCLUDES := $(libc_common_c_includes)
686 LOCAL_MODULE := libc_dns
687 LOCAL_CLANG := $(use_clang)
688 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
689 LOCAL_CXX_STL := none
690 LOCAL_SYSTEM_SHARED_LIBRARIES :=
691 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
693 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
694 include $(BUILD_STATIC_LIBRARY)
697 # ========================================================
698 # libc_freebsd.a - upstream FreeBSD C library code
699 # ========================================================
700 #
701 # These files are built with the freebsd-compat.h header file
702 # automatically included.
704 include $(CLEAR_VARS)
706 LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files)
707 LOCAL_CFLAGS := \
708 $(libc_common_cflags) \
709 -Wno-sign-compare -Wno-uninitialized \
710 -I$(LOCAL_PATH)/upstream-freebsd/android/include \
711 -I$(LOCAL_PATH)/upstream-freebsd/lib/libc/include \
712 -include freebsd-compat.h \
714 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
715 LOCAL_CPPFLAGS := $(libc_common_cppflags)
716 LOCAL_C_INCLUDES := $(libc_common_c_includes)
717 LOCAL_MODULE := libc_freebsd
718 LOCAL_CLANG := $(use_clang)
719 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
720 LOCAL_CXX_STL := none
721 LOCAL_SYSTEM_SHARED_LIBRARIES :=
722 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
724 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
725 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_freebsd_src_files))
726 include $(BUILD_STATIC_LIBRARY)
729 # ========================================================
730 # libc_netbsd.a - upstream NetBSD C library code
731 # ========================================================
732 #
733 # These files are built with the netbsd-compat.h header file
734 # automatically included.
736 include $(CLEAR_VARS)
738 LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
739 LOCAL_CFLAGS := \
740 $(libc_common_cflags) \
741 -Wno-sign-compare -Wno-uninitialized \
742 -DPOSIX_MISTAKE \
743 -I$(LOCAL_PATH)/upstream-netbsd/android/include \
744 -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
745 -include netbsd-compat.h \
747 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
748 LOCAL_CPPFLAGS := $(libc_common_cppflags)
749 LOCAL_C_INCLUDES := $(libc_common_c_includes)
750 LOCAL_MODULE := libc_netbsd
751 LOCAL_CLANG := $(use_clang)
752 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
753 LOCAL_CXX_STL := none
754 LOCAL_SYSTEM_SHARED_LIBRARIES :=
755 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
757 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
758 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_netbsd_src_files))
759 include $(BUILD_STATIC_LIBRARY)
762 # ========================================================
763 # libc_openbsd.a - upstream OpenBSD C library code
764 # ========================================================
765 #
766 # These files are built with the openbsd-compat.h header file
767 # automatically included.
769 include $(CLEAR_VARS)
771 LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files)
772 ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
773 # Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
774 LOCAL_CLANG := false
775 else
776 LOCAL_CLANG := $(use_clang)
777 endif
779 LOCAL_CFLAGS := \
780 $(libc_common_cflags) \
781 -Wno-missing-field-initializers \
782 -Wno-sign-compare \
783 -Wno-uninitialized \
784 -Wno-unused-parameter \
785 -I$(LOCAL_PATH)/private \
786 -I$(LOCAL_PATH)/upstream-openbsd/android/include \
787 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
788 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/gdtoa/ \
789 -include openbsd-compat.h \
791 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
792 LOCAL_CPPFLAGS := $(libc_common_cppflags)
793 LOCAL_C_INCLUDES := $(libc_common_c_includes)
794 LOCAL_MODULE := libc_openbsd
795 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
796 LOCAL_CXX_STL := none
797 LOCAL_SYSTEM_SHARED_LIBRARIES :=
798 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
800 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
801 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_openbsd_src_files))
802 include $(BUILD_STATIC_LIBRARY)
805 # ========================================================
806 # libc_gdtoa.a - upstream OpenBSD C library gdtoa code
807 # ========================================================
808 #
809 # These files are built with the openbsd-compat.h header file
810 # automatically included.
812 include $(CLEAR_VARS)
814 LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32)
815 LOCAL_SRC_FILES_64 := $(libc_upstream_openbsd_gdtoa_src_files_64)
816 ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
817 # Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
818 LOCAL_CLANG := false
819 else
820 LOCAL_CLANG := $(use_clang)
821 endif
823 LOCAL_CFLAGS := \
824 $(libc_common_cflags) \
825 -Wno-sign-compare -Wno-uninitialized \
826 -fvisibility=hidden \
827 -I$(LOCAL_PATH)/private \
828 -I$(LOCAL_PATH)/upstream-openbsd/android/include \
829 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
830 -include openbsd-compat.h \
832 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
833 LOCAL_CPPFLAGS := $(libc_common_cppflags)
834 LOCAL_C_INCLUDES := $(libc_common_c_includes)
835 LOCAL_MODULE := libc_gdtoa
836 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
837 LOCAL_CXX_STL := none
838 LOCAL_SYSTEM_SHARED_LIBRARIES :=
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 ifeq ($(TARGET_ARCH),x86_64)
856 # Clang assembler has problem with ssse3-strcmp-slm.S, http://b/17302991
857 LOCAL_CLANG_ASFLAGS += -no-integrated-as
858 endif
860 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
861 LOCAL_CPPFLAGS := $(libc_common_cppflags)
862 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
863 LOCAL_MODULE := libc_bionic
864 LOCAL_CLANG := $(use_clang)
865 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
866 LOCAL_CXX_STL := none
867 LOCAL_SYSTEM_SHARED_LIBRARIES :=
868 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
870 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
871 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_bionic_src_files))
872 include $(BUILD_STATIC_LIBRARY)
875 # ========================================================
876 # libc_cxa.a - Things traditionally in libstdc++
877 # ========================================================
879 include $(CLEAR_VARS)
881 LOCAL_SRC_FILES := $(libc_cxa_src_files)
882 LOCAL_CFLAGS := $(libc_common_cflags) \
883 -fvisibility=hidden \
885 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
886 LOCAL_CPPFLAGS := $(libc_common_cppflags)
887 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
888 LOCAL_MODULE := libc_cxa
889 LOCAL_CLANG := true # GCC refuses to hide new/delete
890 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
891 LOCAL_CXX_STL := none
892 LOCAL_SYSTEM_SHARED_LIBRARIES :=
893 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
895 include $(BUILD_STATIC_LIBRARY)
898 # ========================================================
899 # libc_syscalls.a
900 # ========================================================
902 include $(CLEAR_VARS)
904 LOCAL_SRC_FILES_$(TARGET_ARCH) := $(call all-S-files-under,arch-$(TARGET_ARCH)/syscalls)
905 ifdef TARGET_2ND_ARCH
906 LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) := $(call all-S-files-under,arch-$(TARGET_2ND_ARCH)/syscalls)
907 endif
908 LOCAL_MODULE := libc_syscalls
909 LOCAL_CLANG := $(use_clang)
910 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
911 LOCAL_CXX_STL := none
912 LOCAL_SYSTEM_SHARED_LIBRARIES :=
913 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
915 include $(BUILD_STATIC_LIBRARY)
918 # ========================================================
919 # libc_aeabi.a
920 # This is an LP32 ARM-only library that needs to be built with -fno-builtin
921 # to avoid infinite recursion. For the other architectures we just build an
922 # empty library to keep this makefile simple.
923 # ========================================================
925 include $(CLEAR_VARS)
927 LOCAL_SRC_FILES_arm := arch-arm/bionic/__aeabi.c
928 LOCAL_MODULE := libc_aeabi
929 LOCAL_CLANG := $(use_clang)
930 LOCAL_CFLAGS := $(libc_common_cflags) -fno-builtin
931 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
932 LOCAL_CXX_STL := none
933 LOCAL_SYSTEM_SHARED_LIBRARIES :=
934 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
936 include $(BUILD_STATIC_LIBRARY)
938 # ========================================================
939 # libc_common.a
940 # ========================================================
942 include $(CLEAR_VARS)
944 LOCAL_SRC_FILES := $(libc_common_src_files)
945 LOCAL_CFLAGS := $(libc_common_cflags)
946 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
947 LOCAL_CPPFLAGS := $(libc_common_cppflags)
948 LOCAL_C_INCLUDES := $(libc_common_c_includes)
949 LOCAL_MODULE := libc_common
950 LOCAL_CLANG := $(use_clang)
951 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
952 LOCAL_WHOLE_STATIC_LIBRARIES := \
953 libc_bionic \
954 libc_cxa \
955 libc_dns \
956 libc_freebsd \
957 libc_gdtoa \
958 libc_malloc \
959 libc_netbsd \
960 libc_openbsd \
961 libc_stack_protector \
962 libc_syscalls \
963 libc_tzcode \
965 LOCAL_WHOLE_STATIC_LIBRARIES_arm := libc_aeabi
967 ifneq ($(MALLOC_IMPL),dlmalloc)
968 LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
969 endif
971 LOCAL_CXX_STL := none
972 LOCAL_SYSTEM_SHARED_LIBRARIES :=
974 # TODO: split out the asflags.
975 LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
976 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
978 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
979 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_common_src_files))
980 $(eval $(call patch-up-arch-specific-flags,LOCAL_ASFLAGS,LOCAL_CFLAGS))
981 include $(BUILD_STATIC_LIBRARY)
984 # ========================================================
985 # libc_nomalloc.a
986 # ========================================================
987 #
988 # This is a version of the static C library that does not
989 # include malloc. It's useful in situations when the user wants
990 # to provide their own malloc implementation, or wants to
991 # explicitly disallow the use of malloc, such as in the
992 # dynamic linker.
994 include $(CLEAR_VARS)
996 LOCAL_SRC_FILES := \
997 $(libc_arch_static_src_files) \
998 $(libc_static_common_src_files) \
999 bionic/libc_init_static.cpp
1001 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1002 LOCAL_CFLAGS := $(libc_common_cflags) \
1003 -DLIBC_STATIC \
1005 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1006 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1008 LOCAL_MODULE := libc_nomalloc
1009 LOCAL_CLANG := $(use_clang)
1010 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1011 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1012 LOCAL_CXX_STL := none
1013 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1014 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1016 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1017 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
1018 include $(BUILD_STATIC_LIBRARY)
1021 # ========================================================
1022 # libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1023 # ========================================================
1025 include $(CLEAR_VARS)
1026 LOCAL_SRC_FILES := $(libc_malloc_src)
1027 LOCAL_CFLAGS := $(libc_common_cflags) \
1028 -fvisibility=hidden \
1030 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1031 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1032 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1033 LOCAL_MODULE := libc_malloc
1034 LOCAL_CLANG := $(use_clang)
1035 LOCAL_CXX_STL := none
1036 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1037 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1038 include $(BUILD_STATIC_LIBRARY)
1041 # ========================================================
1042 # libc.a
1043 # ========================================================
1044 include $(CLEAR_VARS)
1046 LOCAL_SRC_FILES := \
1047 $(libc_arch_static_src_files) \
1048 $(libc_static_common_src_files) \
1049 bionic/malloc_debug_common.cpp \
1050 bionic/libc_init_static.cpp \
1052 LOCAL_CFLAGS := $(libc_common_cflags) \
1053 -DLIBC_STATIC \
1055 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1056 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1057 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1058 LOCAL_MODULE := libc
1059 LOCAL_CLANG := $(use_clang)
1060 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1061 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1062 LOCAL_CXX_STL := none
1063 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1064 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1066 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1067 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
1068 include $(BUILD_STATIC_LIBRARY)
1071 # ========================================================
1072 # libc.so
1073 # ========================================================
1074 include $(CLEAR_VARS)
1076 LOCAL_CFLAGS := $(libc_common_cflags)
1077 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1078 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1079 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1080 LOCAL_SRC_FILES := \
1081 $(libc_arch_dynamic_src_files) \
1082 $(libc_static_common_src_files) \
1083 bionic/malloc_debug_common.cpp \
1084 bionic/libc_init_dynamic.cpp \
1085 bionic/NetdClient.cpp \
1087 LOCAL_MODULE := libc
1088 LOCAL_CLANG := $(use_clang)
1089 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1090 LOCAL_REQUIRED_MODULES := tzdata
1092 # Leave the symbols in the shared library so that stack unwinders can produce
1093 # meaningful name resolution.
1094 LOCAL_STRIP_MODULE := keep_symbols
1096 # WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
1097 # make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
1098 # ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
1099 # external; if that were the case, then libc would not pull those symbols from libgcc.a as it
1100 # should, instead relying on the external symbols from the dependent libraries. That would
1101 # create a "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
1102 # you wanted!
1104 LOCAL_SHARED_LIBRARIES := libdl
1105 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1106 LOCAL_CXX_STL := none
1107 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1109 # We'd really like to do this for all architectures, but since this wasn't done
1110 # before, these symbols must continue to be exported on LP32 for binary
1111 # compatibility.
1112 LOCAL_LDFLAGS_arm64 := -Wl,--exclude-libs,libgcc.a
1113 LOCAL_LDFLAGS_mips64 := -Wl,--exclude-libs,libgcc.a
1114 LOCAL_LDFLAGS_x86_64 := -Wl,--exclude-libs,libgcc.a
1116 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1117 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src_files))
1118 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_static_common_src_files))
1119 # special for arm
1120 LOCAL_NO_CRT_arm := true
1121 LOCAL_CFLAGS_arm += -DCRT_LEGACY_WORKAROUND
1122 LOCAL_SRC_FILES_arm += \
1123 arch-common/bionic/crtbegin_so.c \
1124 arch-arm/bionic/atexit_legacy.c \
1125 arch-common/bionic/crtend_so.S
1126 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1128 include $(BUILD_SHARED_LIBRARY)
1131 # For all builds, except for the -user build we will enable memory
1132 # allocation checking (including memory leaks, buffer overwrites, etc.)
1133 # Note that all these checks are also controlled by env. settings
1134 # that can enable, or disable specific checks. Note also that some of
1135 # the checks are available only in emulator and are implemeted in
1136 # libc_malloc_qemu_instrumented.so.
1137 ifneq ($(TARGET_BUILD_VARIANT),user)
1139 # ========================================================
1140 # libc_malloc_debug_leak.so
1141 # ========================================================
1142 include $(CLEAR_VARS)
1144 LOCAL_CFLAGS := $(libc_common_cflags)
1145 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1146 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1148 # Make sure that unwind.h comes from libunwind.
1149 LOCAL_C_INCLUDES := \
1150 $(libc_common_c_includes) \
1152 LOCAL_SRC_FILES := \
1153 bionic/debug_mapinfo.cpp \
1154 bionic/debug_stacktrace.cpp \
1155 bionic/libc_logging.cpp \
1156 bionic/malloc_debug_leak.cpp \
1157 bionic/malloc_debug_check.cpp \
1159 LOCAL_MODULE := libc_malloc_debug_leak
1160 LOCAL_CLANG := $(use_clang)
1161 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1163 LOCAL_SHARED_LIBRARIES := libc libdl
1164 LOCAL_CXX_STL := none
1165 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1166 # Only need this for arm since libc++ uses its own unwind code that
1167 # doesn't mix with the other default unwind code.
1168 LOCAL_STATIC_LIBRARIES_arm := libc++_static
1169 LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
1171 # Don't install on release build
1172 LOCAL_MODULE_TAGS := eng debug
1173 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1175 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1176 include $(BUILD_SHARED_LIBRARY)
1179 # ========================================================
1180 # libc_malloc_debug_qemu.so
1181 # ========================================================
1182 include $(CLEAR_VARS)
1184 LOCAL_CFLAGS := \
1185 $(libc_common_cflags) \
1186 -DMALLOC_QEMU_INSTRUMENT \
1188 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1189 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1191 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1193 LOCAL_SRC_FILES := \
1194 bionic/libc_logging.cpp \
1195 bionic/malloc_debug_qemu.cpp \
1197 LOCAL_MODULE := libc_malloc_debug_qemu
1198 LOCAL_CLANG := $(use_clang)
1199 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1201 LOCAL_SHARED_LIBRARIES := libc libdl
1202 LOCAL_CXX_STL := none
1203 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1205 # Don't install on release build
1206 LOCAL_MODULE_TAGS := eng debug
1207 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1209 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1210 include $(BUILD_SHARED_LIBRARY)
1212 endif #!user
1214 # ========================================================
1215 # libstdc++.so
1216 # ========================================================
1217 libstdcxx_common_src_files := \
1218 bionic/__cxa_guard.cpp \
1219 bionic/__cxa_pure_virtual.cpp \
1220 bionic/new.cpp \
1221 bionic/libc_logging.cpp \
1223 include $(CLEAR_VARS)
1224 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
1225 LOCAL_CFLAGS := $(libc_common_cflags)
1226 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1227 LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1228 LOCAL_MODULE:= libstdc++
1229 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1230 LOCAL_CXX_STL := none
1231 LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1232 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1233 include $(BUILD_SHARED_LIBRARY)
1235 # ========================================================
1236 # libstdc++.a
1237 # ========================================================
1238 include $(CLEAR_VARS)
1239 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
1240 LOCAL_CFLAGS := $(libc_common_cflags)
1241 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1242 LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1243 LOCAL_MODULE:= libstdc++
1244 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1245 LOCAL_CXX_STL := none
1246 LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1247 LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
1248 include $(BUILD_STATIC_LIBRARY)
1251 # ========================================================
1252 include $(call all-makefiles-under,$(LOCAL_PATH))