1 LOCAL_PATH := $(call my-dir)
3 # Make everything depend on any changes to included makefiles.
4 libc_common_additional_dependencies := $(LOCAL_PATH)/Android.mk
6 # Load config for TARGET_ARCH
7 my_2nd_arch_prefix :=
8 include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
9 libc_common_additional_dependencies += \
10 $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
13 ifdef TARGET_2ND_ARCH
14 # Load config for TARGET_2ND_ARCH
15 my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
16 include $(LOCAL_PATH)/arch-$(TARGET_2ND_ARCH)/$(TARGET_2ND_ARCH).mk
17 my_2nd_arch_prefix :=
18 libc_common_additional_dependencies += \
19 $(LOCAL_PATH)/arch-$(TARGET_2ND_ARCH)/$(TARGET_2ND_ARCH).mk
20 endif
22 # crt obj files
23 # ========================================================
24 # crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
25 libc_crt_target_cflags := \
26 -I$(LOCAL_PATH)/include \
27 -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \
29 my_2nd_arch_prefix :=
30 include $(LOCAL_PATH)/crt.mk
31 ifdef TARGET_2ND_ARCH
32 my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
33 include $(LOCAL_PATH)/crt.mk
34 my_2nd_arch_prefix :=
35 endif
37 # Define the common source files for all the libc instances
38 # =========================================================
39 libc_common_src_files := \
40 bionic/bindresvport.c \
41 bionic/ether_aton.c \
42 bionic/ether_ntoa.c \
43 bionic/fts.c \
44 bionic/gethostname.c \
45 bionic/getpriority.c \
46 bionic/if_indextoname.c \
47 bionic/if_nametoindex.c \
48 bionic/initgroups.c \
49 bionic/ioctl.c \
50 bionic/isatty.c \
51 bionic/memmem.c \
52 bionic/pathconf.c \
53 bionic/pututline.c \
54 bionic/sched_cpualloc.c \
55 bionic/sched_cpucount.c \
56 bionic/semaphore.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/pause.cpp \
147 bionic/pipe.cpp \
148 bionic/poll.cpp \
149 bionic/posix_fadvise.cpp \
150 bionic/posix_fallocate.cpp \
151 bionic/posix_timers.cpp \
152 bionic/pthread_atfork.cpp \
153 bionic/pthread_attr.cpp \
154 bionic/pthread_cond.cpp \
155 bionic/pthread_create.cpp \
156 bionic/pthread_detach.cpp \
157 bionic/pthread_equal.cpp \
158 bionic/pthread_exit.cpp \
159 bionic/pthread_getcpuclockid.cpp \
160 bionic/pthread_getschedparam.cpp \
161 bionic/pthread_gettid_np.cpp \
162 bionic/pthread_internals.cpp \
163 bionic/pthread_join.cpp \
164 bionic/pthread_key.cpp \
165 bionic/pthread_kill.cpp \
166 bionic/pthread_mutex.cpp \
167 bionic/pthread_once.cpp \
168 bionic/pthread_rwlock.cpp \
169 bionic/pthread_self.cpp \
170 bionic/pthread_setname_np.cpp \
171 bionic/pthread_setschedparam.cpp \
172 bionic/pthread_sigmask.cpp \
173 bionic/ptrace.cpp \
174 bionic/pty.cpp \
175 bionic/raise.cpp \
176 bionic/rand.cpp \
177 bionic/readlink.cpp \
178 bionic/reboot.cpp \
179 bionic/recv.cpp \
180 bionic/rename.cpp \
181 bionic/rmdir.cpp \
182 bionic/scandir.cpp \
183 bionic/sched_getaffinity.cpp \
184 bionic/sched_getcpu.cpp \
185 bionic/send.cpp \
186 bionic/setegid.cpp \
187 bionic/__set_errno.cpp \
188 bionic/seteuid.cpp \
189 bionic/setpgrp.cpp \
190 bionic/sigaction.cpp \
191 bionic/sigaddset.cpp \
192 bionic/sigdelset.cpp \
193 bionic/sigemptyset.cpp \
194 bionic/sigfillset.cpp \
195 bionic/sigismember.cpp \
196 bionic/signal.cpp \
197 bionic/signalfd.cpp \
198 bionic/sigpending.cpp \
199 bionic/sigprocmask.cpp \
200 bionic/sigsuspend.cpp \
201 bionic/sigwait.cpp \
202 bionic/socket.cpp \
203 bionic/stat.cpp \
204 bionic/statvfs.cpp \
205 bionic/strcoll_l.cpp \
206 bionic/strerror.cpp \
207 bionic/strerror_r.cpp \
208 bionic/strftime_l.cpp \
209 bionic/strsignal.cpp \
210 bionic/strtold.cpp \
211 bionic/strtold_l.cpp \
212 bionic/strtoll_l.cpp \
213 bionic/strtoull_l.cpp \
214 bionic/strxfrm_l.cpp \
215 bionic/stubs.cpp \
216 bionic/symlink.cpp \
217 bionic/sysconf.cpp \
218 bionic/syslog.cpp \
219 bionic/sys_siglist.c \
220 bionic/sys_signame.c \
221 bionic/system_properties.cpp \
222 bionic/tdestroy.cpp \
223 bionic/termios.cpp \
224 bionic/thread_private.cpp \
225 bionic/tmpfile.cpp \
226 bionic/umount.cpp \
227 bionic/unlink.cpp \
228 bionic/utimes.cpp \
229 bionic/vdso.cpp \
230 bionic/wait.cpp \
231 bionic/wchar.cpp \
232 bionic/wctype.cpp \
234 libc_cxa_src_files := \
235 bionic/__cxa_guard.cpp \
236 bionic/__cxa_pure_virtual.cpp \
237 bionic/new.cpp \
239 libc_upstream_freebsd_src_files := \
240 upstream-freebsd/lib/libc/gen/ldexp.c \
241 upstream-freebsd/lib/libc/gen/sleep.c \
242 upstream-freebsd/lib/libc/gen/usleep.c \
243 upstream-freebsd/lib/libc/stdio/fclose.c \
244 upstream-freebsd/lib/libc/stdio/flags.c \
245 upstream-freebsd/lib/libc/stdio/fopen.c \
246 upstream-freebsd/lib/libc/stdlib/abs.c \
247 upstream-freebsd/lib/libc/stdlib/getopt_long.c \
248 upstream-freebsd/lib/libc/stdlib/imaxabs.c \
249 upstream-freebsd/lib/libc/stdlib/imaxdiv.c \
250 upstream-freebsd/lib/libc/stdlib/labs.c \
251 upstream-freebsd/lib/libc/stdlib/llabs.c \
252 upstream-freebsd/lib/libc/stdlib/qsort.c \
253 upstream-freebsd/lib/libc/stdlib/quick_exit.c \
254 upstream-freebsd/lib/libc/stdlib/realpath.c \
255 upstream-freebsd/lib/libc/string/wcpcpy.c \
256 upstream-freebsd/lib/libc/string/wcpncpy.c \
257 upstream-freebsd/lib/libc/string/wcscasecmp.c \
258 upstream-freebsd/lib/libc/string/wcscspn.c \
259 upstream-freebsd/lib/libc/string/wcsdup.c \
260 upstream-freebsd/lib/libc/string/wcslcat.c \
261 upstream-freebsd/lib/libc/string/wcsncasecmp.c \
262 upstream-freebsd/lib/libc/string/wcsncat.c \
263 upstream-freebsd/lib/libc/string/wcsncmp.c \
264 upstream-freebsd/lib/libc/string/wcsncpy.c \
265 upstream-freebsd/lib/libc/string/wcsnlen.c \
266 upstream-freebsd/lib/libc/string/wcspbrk.c \
267 upstream-freebsd/lib/libc/string/wcsspn.c \
268 upstream-freebsd/lib/libc/string/wcstok.c \
269 upstream-freebsd/lib/libc/string/wmemchr.c \
270 upstream-freebsd/lib/libc/string/wmemcpy.c \
271 upstream-freebsd/lib/libc/string/wmemset.c \
273 libc_upstream_netbsd_src_files := \
274 upstream-netbsd/common/lib/libc/stdlib/random.c \
275 upstream-netbsd/lib/libc/gen/ftw.c \
276 upstream-netbsd/lib/libc/gen/nftw.c \
277 upstream-netbsd/lib/libc/gen/nice.c \
278 upstream-netbsd/lib/libc/gen/popen.c \
279 upstream-netbsd/lib/libc/gen/psignal.c \
280 upstream-netbsd/lib/libc/gen/utime.c \
281 upstream-netbsd/lib/libc/gen/utmp.c \
282 upstream-netbsd/lib/libc/inet/nsap_addr.c \
283 upstream-netbsd/lib/libc/regex/regcomp.c \
284 upstream-netbsd/lib/libc/regex/regerror.c \
285 upstream-netbsd/lib/libc/regex/regexec.c \
286 upstream-netbsd/lib/libc/regex/regfree.c \
287 upstream-netbsd/lib/libc/stdlib/bsearch.c \
288 upstream-netbsd/lib/libc/stdlib/div.c \
289 upstream-netbsd/lib/libc/stdlib/drand48.c \
290 upstream-netbsd/lib/libc/stdlib/erand48.c \
291 upstream-netbsd/lib/libc/stdlib/insque.c \
292 upstream-netbsd/lib/libc/stdlib/jrand48.c \
293 upstream-netbsd/lib/libc/stdlib/ldiv.c \
294 upstream-netbsd/lib/libc/stdlib/lldiv.c \
295 upstream-netbsd/lib/libc/stdlib/lrand48.c \
296 upstream-netbsd/lib/libc/stdlib/mrand48.c \
297 upstream-netbsd/lib/libc/stdlib/nrand48.c \
298 upstream-netbsd/lib/libc/stdlib/_rand48.c \
299 upstream-netbsd/lib/libc/stdlib/rand_r.c \
300 upstream-netbsd/lib/libc/stdlib/remque.c \
301 upstream-netbsd/lib/libc/stdlib/seed48.c \
302 upstream-netbsd/lib/libc/stdlib/srand48.c \
303 upstream-netbsd/lib/libc/string/memccpy.c \
304 upstream-netbsd/lib/libc/string/strcasestr.c \
305 upstream-netbsd/lib/libc/string/strcoll.c \
306 upstream-netbsd/lib/libc/string/strxfrm.c \
307 upstream-netbsd/lib/libc/unistd/killpg.c \
309 libc_upstream_openbsd_gdtoa_src_files := \
310 upstream-openbsd/android/gdtoa_support.cpp \
311 upstream-openbsd/lib/libc/gdtoa/dmisc.c \
312 upstream-openbsd/lib/libc/gdtoa/dtoa.c \
313 upstream-openbsd/lib/libc/gdtoa/gdtoa.c \
314 upstream-openbsd/lib/libc/gdtoa/gethex.c \
315 upstream-openbsd/lib/libc/gdtoa/gmisc.c \
316 upstream-openbsd/lib/libc/gdtoa/hd_init.c \
317 upstream-openbsd/lib/libc/gdtoa/hdtoa.c \
318 upstream-openbsd/lib/libc/gdtoa/hexnan.c \
319 upstream-openbsd/lib/libc/gdtoa/ldtoa.c \
320 upstream-openbsd/lib/libc/gdtoa/misc.c \
321 upstream-openbsd/lib/libc/gdtoa/smisc.c \
322 upstream-openbsd/lib/libc/gdtoa/strtod.c \
323 upstream-openbsd/lib/libc/gdtoa/strtodg.c \
324 upstream-openbsd/lib/libc/gdtoa/strtof.c \
325 upstream-openbsd/lib/libc/gdtoa/strtord.c \
326 upstream-openbsd/lib/libc/gdtoa/sum.c \
327 upstream-openbsd/lib/libc/gdtoa/ulp.c \
329 libc_upstream_openbsd_gdtoa_src_files_32 := \
330 $(libc_upstream_openbsd_gdtoa_src_files) \
332 libc_upstream_openbsd_gdtoa_src_files_64 := \
333 $(libc_upstream_openbsd_gdtoa_src_files) \
334 upstream-openbsd/lib/libc/gdtoa/strtorQ.c \
336 libc_upstream_openbsd_src_files := \
337 upstream-openbsd/lib/libc/crypt/arc4random.c \
338 upstream-openbsd/lib/libc/crypt/arc4random_uniform.c \
339 upstream-openbsd/lib/libc/gen/alarm.c \
340 upstream-openbsd/lib/libc/gen/ctype_.c \
341 upstream-openbsd/lib/libc/gen/daemon.c \
342 upstream-openbsd/lib/libc/gen/err.c \
343 upstream-openbsd/lib/libc/gen/errx.c \
344 upstream-openbsd/lib/libc/gen/exec.c \
345 upstream-openbsd/lib/libc/gen/fnmatch.c \
346 upstream-openbsd/lib/libc/gen/ftok.c \
347 upstream-openbsd/lib/libc/gen/getprogname.c \
348 upstream-openbsd/lib/libc/gen/isctype.c \
349 upstream-openbsd/lib/libc/gen/setprogname.c \
350 upstream-openbsd/lib/libc/gen/time.c \
351 upstream-openbsd/lib/libc/gen/tolower_.c \
352 upstream-openbsd/lib/libc/gen/toupper_.c \
353 upstream-openbsd/lib/libc/gen/verr.c \
354 upstream-openbsd/lib/libc/gen/verrx.c \
355 upstream-openbsd/lib/libc/gen/vwarn.c \
356 upstream-openbsd/lib/libc/gen/vwarnx.c \
357 upstream-openbsd/lib/libc/gen/warn.c \
358 upstream-openbsd/lib/libc/gen/warnx.c \
359 upstream-openbsd/lib/libc/locale/btowc.c \
360 upstream-openbsd/lib/libc/locale/mbrlen.c \
361 upstream-openbsd/lib/libc/locale/mbstowcs.c \
362 upstream-openbsd/lib/libc/locale/mbtowc.c \
363 upstream-openbsd/lib/libc/locale/wcscoll.c \
364 upstream-openbsd/lib/libc/locale/wcstod.c \
365 upstream-openbsd/lib/libc/locale/wcstof.c \
366 upstream-openbsd/lib/libc/locale/wcstoimax.c \
367 upstream-openbsd/lib/libc/locale/wcstol.c \
368 upstream-openbsd/lib/libc/locale/wcstold.c \
369 upstream-openbsd/lib/libc/locale/wcstoll.c \
370 upstream-openbsd/lib/libc/locale/wcstombs.c \
371 upstream-openbsd/lib/libc/locale/wcstoul.c \
372 upstream-openbsd/lib/libc/locale/wcstoull.c \
373 upstream-openbsd/lib/libc/locale/wcstoumax.c \
374 upstream-openbsd/lib/libc/locale/wcsxfrm.c \
375 upstream-openbsd/lib/libc/locale/wctob.c \
376 upstream-openbsd/lib/libc/locale/wctomb.c \
377 upstream-openbsd/lib/libc/net/htonl.c \
378 upstream-openbsd/lib/libc/net/htons.c \
379 upstream-openbsd/lib/libc/net/inet_addr.c \
380 upstream-openbsd/lib/libc/net/inet_lnaof.c \
381 upstream-openbsd/lib/libc/net/inet_makeaddr.c \
382 upstream-openbsd/lib/libc/net/inet_netof.c \
383 upstream-openbsd/lib/libc/net/inet_network.c \
384 upstream-openbsd/lib/libc/net/inet_ntoa.c \
385 upstream-openbsd/lib/libc/net/inet_ntop.c \
386 upstream-openbsd/lib/libc/net/inet_pton.c \
387 upstream-openbsd/lib/libc/net/ntohl.c \
388 upstream-openbsd/lib/libc/net/ntohs.c \
389 upstream-openbsd/lib/libc/stdio/asprintf.c \
390 upstream-openbsd/lib/libc/stdio/clrerr.c \
391 upstream-openbsd/lib/libc/stdio/dprintf.c \
392 upstream-openbsd/lib/libc/stdio/fdopen.c \
393 upstream-openbsd/lib/libc/stdio/feof.c \
394 upstream-openbsd/lib/libc/stdio/ferror.c \
395 upstream-openbsd/lib/libc/stdio/fflush.c \
396 upstream-openbsd/lib/libc/stdio/fgetc.c \
397 upstream-openbsd/lib/libc/stdio/fgetln.c \
398 upstream-openbsd/lib/libc/stdio/fgetpos.c \
399 upstream-openbsd/lib/libc/stdio/fgets.c \
400 upstream-openbsd/lib/libc/stdio/fgetwc.c \
401 upstream-openbsd/lib/libc/stdio/fgetws.c \
402 upstream-openbsd/lib/libc/stdio/fileno.c \
403 upstream-openbsd/lib/libc/stdio/findfp.c \
404 upstream-openbsd/lib/libc/stdio/fmemopen.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/lsearch.c \
484 upstream-openbsd/lib/libc/stdlib/setenv.c \
485 upstream-openbsd/lib/libc/stdlib/strtoimax.c \
486 upstream-openbsd/lib/libc/stdlib/strtol.c \
487 upstream-openbsd/lib/libc/stdlib/strtoll.c \
488 upstream-openbsd/lib/libc/stdlib/strtoul.c \
489 upstream-openbsd/lib/libc/stdlib/strtoull.c \
490 upstream-openbsd/lib/libc/stdlib/strtoumax.c \
491 upstream-openbsd/lib/libc/stdlib/system.c \
492 upstream-openbsd/lib/libc/stdlib/tfind.c \
493 upstream-openbsd/lib/libc/stdlib/tsearch.c \
494 upstream-openbsd/lib/libc/string/strcasecmp.c \
495 upstream-openbsd/lib/libc/string/strcspn.c \
496 upstream-openbsd/lib/libc/string/strdup.c \
497 upstream-openbsd/lib/libc/string/strndup.c \
498 upstream-openbsd/lib/libc/string/strpbrk.c \
499 upstream-openbsd/lib/libc/string/strsep.c \
500 upstream-openbsd/lib/libc/string/strspn.c \
501 upstream-openbsd/lib/libc/string/strstr.c \
502 upstream-openbsd/lib/libc/string/strtok.c \
503 upstream-openbsd/lib/libc/string/wcslcpy.c \
504 upstream-openbsd/lib/libc/string/wcsstr.c \
505 upstream-openbsd/lib/libc/string/wcswidth.c \
507 libc_arch_static_src_files := \
508 bionic/dl_iterate_phdr_static.cpp \
510 # Define some common cflags
511 # ========================================================
512 libc_common_cflags := \
513 -D_LIBC=1 \
514 -Wall -Wextra -Wunused \
516 ifneq ($(TARGET_USES_LOGD),false)
517 libc_common_cflags += -DTARGET_USES_LOGD
518 endif
520 use_clang := $(USE_CLANG_PLATFORM_BUILD)
521 ifeq ($(use_clang),)
522 use_clang := false
523 endif
525 # Try to catch typical 32-bit assumptions that break with 64-bit pointers.
526 libc_common_cflags += \
527 -Werror=pointer-to-int-cast \
528 -Werror=int-to-pointer-cast \
529 -Werror=type-limits \
530 -Werror \
532 ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
533 libc_common_cflags += -DDEBUG
534 endif
536 ifeq ($(MALLOC_IMPL),dlmalloc)
537 libc_common_cflags += -DUSE_DLMALLOC
538 libc_malloc_src := bionic/dlmalloc.c
539 else
540 libc_common_cflags += -DUSE_JEMALLOC
541 libc_malloc_src := bionic/jemalloc_wrapper.cpp
542 libc_common_c_includes += external/jemalloc/include
543 endif
545 # To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
546 # the appropriate BoardConfig.mk file.
547 #
548 ifneq ($(BOARD_MALLOC_ALIGNMENT),)
549 libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
550 endif
552 # Define ANDROID_SMP appropriately.
553 ifeq ($(TARGET_CPU_SMP),true)
554 libc_common_cflags += -DANDROID_SMP=1
555 else
556 libc_common_cflags += -DANDROID_SMP=0
557 endif
559 # Define some common conlyflags
560 libc_common_conlyflags := \
561 -std=gnu99
563 # Define some common cppflags
564 libc_common_cppflags := \
565 -std=gnu++11
567 # Define some common includes
568 # ========================================================
569 libc_common_c_includes += \
570 $(LOCAL_PATH)/stdio \
572 # ========================================================
573 # Add in the arch-specific flags.
574 # Must be called with $(eval).
575 # $(1): the LOCAL_ variable name
576 # $(2): the bionic variable name to pull in
577 define patch-up-arch-specific-flags
578 $(1)_$(TARGET_ARCH) += $($(2)_$(TARGET_ARCH))
579 ifdef TARGET_2ND_ARCH
580 $(1)_$(TARGET_2ND_ARCH) += $($(2)_$(TARGET_2ND_ARCH))
581 endif
582 endef
585 # ========================================================
586 # libc_stack_protector.a - stack protector code
587 # ========================================================
588 #
589 # The stack protector code needs to be compiled
590 # with -fno-stack-protector, since it modifies the
591 # stack canary.
593 include $(CLEAR_VARS)
595 LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
596 LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
597 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
598 LOCAL_CPPFLAGS := $(libc_common_cppflags)
599 LOCAL_C_INCLUDES := $(libc_common_c_includes)
600 LOCAL_MODULE := libc_stack_protector
601 LOCAL_CLANG := $(use_clang)
602 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
603 LOCAL_CXX_STL := none
604 LOCAL_SYSTEM_SHARED_LIBRARIES :=
606 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
607 include $(BUILD_STATIC_LIBRARY)
610 # ========================================================
611 # libc_tzcode.a - upstream 'tzcode' code
612 # ========================================================
614 include $(CLEAR_VARS)
616 LOCAL_SRC_FILES := $(call all-c-files-under,tzcode)
617 # tzcode doesn't include wcsftime, so we use the OpenBSD one.
618 LOCAL_SRC_FILES += upstream-openbsd/lib/libc/time/wcsftime.c
620 LOCAL_CFLAGS := $(libc_common_cflags) \
621 -fvisibility=hidden \
623 # Don't use ridiculous amounts of stack.
624 LOCAL_CFLAGS += -DALL_STATE
625 # Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
626 LOCAL_CFLAGS += -DSTD_INSPIRED
627 # The name of the tm_gmtoff field in our struct tm.
628 LOCAL_CFLAGS += -DTM_GMTOFF=tm_gmtoff
629 # Where we store our tzdata.
630 LOCAL_CFLAGS += -DTZDIR=\"/system/usr/share/zoneinfo\"
631 # Include timezone and daylight globals.
632 LOCAL_CFLAGS += -DUSG_COMPAT=1
633 LOCAL_CFLAGS += -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
634 LOCAL_CFLAGS += -Dlint
636 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
637 LOCAL_CPPFLAGS := $(libc_common_cppflags)
638 LOCAL_C_INCLUDES := $(libc_common_c_includes) $(LOCAL_PATH)/tzcode/
639 LOCAL_MODULE := libc_tzcode
640 LOCAL_CLANG := $(use_clang)
641 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
642 LOCAL_CXX_STL := none
643 LOCAL_SYSTEM_SHARED_LIBRARIES :=
645 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
646 include $(BUILD_STATIC_LIBRARY)
649 # ========================================================
650 # libc_dns.a - modified NetBSD DNS code
651 # ========================================================
653 include $(CLEAR_VARS)
655 LOCAL_SRC_FILES := \
656 $(call all-c-files-under,dns) \
657 upstream-netbsd/lib/libc/isc/ev_streams.c \
658 upstream-netbsd/lib/libc/isc/ev_timers.c \
659 upstream-netbsd/lib/libc/resolv/mtctxres.c \
661 # We use the OpenBSD res_random.
662 LOCAL_CFLAGS += \
663 -Dres_randomid=__res_randomid
664 LOCAL_SRC_FILES += \
665 upstream-openbsd/lib/libc/net/res_random.c \
667 LOCAL_CFLAGS += \
668 $(libc_common_cflags) \
669 -DANDROID_CHANGES \
670 -DINET6 \
671 -fvisibility=hidden \
672 -Wno-unused-parameter \
673 -I$(LOCAL_PATH)/dns/include \
674 -I$(LOCAL_PATH)/private \
675 -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
676 -I$(LOCAL_PATH)/upstream-netbsd/android/include \
677 -include netbsd-compat.h \
679 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
680 LOCAL_CPPFLAGS := $(libc_common_cppflags)
681 LOCAL_C_INCLUDES := $(libc_common_c_includes)
682 LOCAL_MODULE := libc_dns
683 LOCAL_CLANG := $(use_clang)
684 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
685 LOCAL_CXX_STL := none
686 LOCAL_SYSTEM_SHARED_LIBRARIES :=
688 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
689 include $(BUILD_STATIC_LIBRARY)
692 # ========================================================
693 # libc_freebsd.a - upstream FreeBSD C library code
694 # ========================================================
695 #
696 # These files are built with the freebsd-compat.h header file
697 # automatically included.
699 include $(CLEAR_VARS)
701 LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files)
702 LOCAL_CFLAGS := \
703 $(libc_common_cflags) \
704 -Wno-sign-compare -Wno-uninitialized \
705 -I$(LOCAL_PATH)/upstream-freebsd/android/include \
706 -I$(LOCAL_PATH)/upstream-freebsd/lib/libc/include \
707 -include freebsd-compat.h \
709 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
710 LOCAL_CPPFLAGS := $(libc_common_cppflags)
711 LOCAL_C_INCLUDES := $(libc_common_c_includes)
712 LOCAL_MODULE := libc_freebsd
713 LOCAL_CLANG := $(use_clang)
714 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
715 LOCAL_CXX_STL := none
716 LOCAL_SYSTEM_SHARED_LIBRARIES :=
718 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
719 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_freebsd_src_files))
720 include $(BUILD_STATIC_LIBRARY)
723 # ========================================================
724 # libc_netbsd.a - upstream NetBSD C library code
725 # ========================================================
726 #
727 # These files are built with the netbsd-compat.h header file
728 # automatically included.
730 include $(CLEAR_VARS)
732 LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
733 LOCAL_CFLAGS := \
734 $(libc_common_cflags) \
735 -Wno-sign-compare -Wno-uninitialized \
736 -DPOSIX_MISTAKE \
737 -I$(LOCAL_PATH)/upstream-netbsd/android/include \
738 -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
739 -include netbsd-compat.h \
741 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
742 LOCAL_CPPFLAGS := $(libc_common_cppflags)
743 LOCAL_C_INCLUDES := $(libc_common_c_includes)
744 LOCAL_MODULE := libc_netbsd
745 LOCAL_CLANG := $(use_clang)
746 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
747 LOCAL_CXX_STL := none
748 LOCAL_SYSTEM_SHARED_LIBRARIES :=
750 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
751 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_netbsd_src_files))
752 include $(BUILD_STATIC_LIBRARY)
755 # ========================================================
756 # libc_openbsd.a - upstream OpenBSD C library code
757 # ========================================================
758 #
759 # These files are built with the openbsd-compat.h header file
760 # automatically included.
762 include $(CLEAR_VARS)
764 LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files)
765 ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
766 # Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
767 LOCAL_CLANG := false
768 else
769 LOCAL_CLANG := $(use_clang)
770 endif
772 LOCAL_CFLAGS := \
773 $(libc_common_cflags) \
774 -Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter \
775 -I$(LOCAL_PATH)/private \
776 -I$(LOCAL_PATH)/upstream-openbsd/android/include \
777 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
778 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/gdtoa/ \
779 -include openbsd-compat.h \
781 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
782 LOCAL_CPPFLAGS := $(libc_common_cppflags)
783 LOCAL_C_INCLUDES := $(libc_common_c_includes)
784 LOCAL_MODULE := libc_openbsd
785 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
786 LOCAL_CXX_STL := none
787 LOCAL_SYSTEM_SHARED_LIBRARIES :=
789 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
790 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_openbsd_src_files))
791 include $(BUILD_STATIC_LIBRARY)
794 # ========================================================
795 # libc_gdtoa.a - upstream OpenBSD C library gdtoa code
796 # ========================================================
797 #
798 # These files are built with the openbsd-compat.h header file
799 # automatically included.
801 include $(CLEAR_VARS)
803 LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32)
804 LOCAL_SRC_FILES_64 := $(libc_upstream_openbsd_gdtoa_src_files_64)
805 ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
806 # Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
807 LOCAL_CLANG := false
808 else
809 LOCAL_CLANG := $(use_clang)
810 endif
812 LOCAL_CFLAGS := \
813 $(libc_common_cflags) \
814 -Wno-sign-compare -Wno-uninitialized \
815 -fvisibility=hidden \
816 -I$(LOCAL_PATH)/private \
817 -I$(LOCAL_PATH)/upstream-openbsd/android/include \
818 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
819 -include openbsd-compat.h \
821 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
822 LOCAL_CPPFLAGS := $(libc_common_cppflags)
823 LOCAL_C_INCLUDES := $(libc_common_c_includes)
824 LOCAL_MODULE := libc_gdtoa
825 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
826 LOCAL_CXX_STL := none
827 LOCAL_SYSTEM_SHARED_LIBRARIES :=
829 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
830 include $(BUILD_STATIC_LIBRARY)
833 # ========================================================
834 # libc_bionic.a - home-grown C library code
835 # ========================================================
837 include $(CLEAR_VARS)
839 LOCAL_SRC_FILES := $(libc_bionic_src_files)
840 LOCAL_CFLAGS := $(libc_common_cflags) \
841 -Wframe-larger-than=2048 \
843 ifeq ($(TARGET_ARCH),x86_64)
844 # Clang assembler has problem with ssse3-strcmp-slm.S, http://b/17302991
845 LOCAL_CLANG_ASFLAGS += -no-integrated-as
846 endif
848 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
849 LOCAL_CPPFLAGS := $(libc_common_cppflags)
850 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
851 LOCAL_MODULE := libc_bionic
852 LOCAL_CLANG := $(use_clang)
853 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
854 LOCAL_CXX_STL := none
855 LOCAL_SYSTEM_SHARED_LIBRARIES :=
857 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
858 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_bionic_src_files))
859 include $(BUILD_STATIC_LIBRARY)
862 # ========================================================
863 # libc_cxa.a - Things traditionally in libstdc++
864 # ========================================================
866 include $(CLEAR_VARS)
868 LOCAL_SRC_FILES := $(libc_cxa_src_files)
869 LOCAL_CFLAGS := $(libc_common_cflags) \
870 -fvisibility=hidden \
872 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
873 LOCAL_CPPFLAGS := $(libc_common_cppflags)
874 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
875 LOCAL_MODULE := libc_cxa
876 LOCAL_CLANG := true # GCC refuses to hide new/delete
877 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
878 LOCAL_CXX_STL := none
879 LOCAL_SYSTEM_SHARED_LIBRARIES :=
881 include $(BUILD_STATIC_LIBRARY)
884 # ========================================================
885 # libc_syscalls.a
886 # ========================================================
888 include $(CLEAR_VARS)
890 LOCAL_SRC_FILES_$(TARGET_ARCH) := $(call all-S-files-under,arch-$(TARGET_ARCH)/syscalls)
891 ifdef TARGET_2ND_ARCH
892 LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) := $(call all-S-files-under,arch-$(TARGET_2ND_ARCH)/syscalls)
893 endif
894 LOCAL_MODULE := libc_syscalls
895 LOCAL_CLANG := $(use_clang)
896 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
897 LOCAL_CXX_STL := none
898 LOCAL_SYSTEM_SHARED_LIBRARIES :=
900 include $(BUILD_STATIC_LIBRARY)
903 # ========================================================
904 # libc_aeabi.a
905 # This is an LP32 ARM-only library that needs to be built with -fno-builtin
906 # to avoid infinite recursion. For the other architectures we just build an
907 # empty library to keep this makefile simple.
908 # ========================================================
910 include $(CLEAR_VARS)
912 LOCAL_SRC_FILES_arm := arch-arm/bionic/__aeabi.c
913 LOCAL_MODULE := libc_aeabi
914 LOCAL_CLANG := $(use_clang)
915 LOCAL_CFLAGS := $(libc_common_cflags) -fno-builtin
916 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
917 LOCAL_CXX_STL := none
918 LOCAL_SYSTEM_SHARED_LIBRARIES :=
920 include $(BUILD_STATIC_LIBRARY)
922 # ========================================================
923 # libc_common.a
924 # ========================================================
926 include $(CLEAR_VARS)
928 LOCAL_SRC_FILES := $(libc_common_src_files)
929 LOCAL_CFLAGS := $(libc_common_cflags)
930 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
931 LOCAL_CPPFLAGS := $(libc_common_cppflags)
932 LOCAL_C_INCLUDES := $(libc_common_c_includes)
933 LOCAL_MODULE := libc_common
934 LOCAL_CLANG := $(use_clang)
935 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
936 LOCAL_WHOLE_STATIC_LIBRARIES := \
937 libc_bionic \
938 libc_cxa \
939 libc_dns \
940 libc_freebsd \
941 libc_gdtoa \
942 libc_malloc \
943 libc_netbsd \
944 libc_openbsd \
945 libc_stack_protector \
946 libc_syscalls \
947 libc_tzcode \
949 LOCAL_WHOLE_STATIC_LIBRARIES_arm := libc_aeabi
951 ifneq ($(MALLOC_IMPL),dlmalloc)
952 LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
953 endif
955 LOCAL_CXX_STL := none
956 LOCAL_SYSTEM_SHARED_LIBRARIES :=
958 # TODO: split out the asflags.
959 LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
961 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
962 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_common_src_files))
963 $(eval $(call patch-up-arch-specific-flags,LOCAL_ASFLAGS,LOCAL_CFLAGS))
964 include $(BUILD_STATIC_LIBRARY)
967 # ========================================================
968 # libc_nomalloc.a
969 # ========================================================
970 #
971 # This is a version of the static C library that does not
972 # include malloc. It's useful in situations when the user wants
973 # to provide their own malloc implementation, or wants to
974 # explicitly disallow the use of malloc, such as in the
975 # dynamic linker.
977 include $(CLEAR_VARS)
979 LOCAL_SRC_FILES := \
980 $(libc_arch_static_src_files) \
981 $(libc_static_common_src_files) \
982 bionic/libc_init_static.cpp
984 LOCAL_C_INCLUDES := $(libc_common_c_includes)
985 LOCAL_CFLAGS := $(libc_common_cflags) \
986 -DLIBC_STATIC \
988 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
989 LOCAL_CPPFLAGS := $(libc_common_cppflags)
991 LOCAL_MODULE := libc_nomalloc
992 LOCAL_CLANG := $(use_clang)
993 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
994 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
995 LOCAL_CXX_STL := none
996 LOCAL_SYSTEM_SHARED_LIBRARIES :=
998 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
999 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
1000 include $(BUILD_STATIC_LIBRARY)
1003 # ========================================================
1004 # libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
1005 # ========================================================
1007 include $(CLEAR_VARS)
1008 LOCAL_SRC_FILES := $(libc_malloc_src)
1009 LOCAL_CFLAGS := $(libc_common_cflags) \
1010 -fvisibility=hidden \
1012 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1013 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1014 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1015 LOCAL_MODULE := libc_malloc
1016 LOCAL_CLANG := $(use_clang)
1017 LOCAL_CXX_STL := none
1018 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1019 include $(BUILD_STATIC_LIBRARY)
1022 # ========================================================
1023 # libc.a
1024 # ========================================================
1025 include $(CLEAR_VARS)
1027 LOCAL_SRC_FILES := \
1028 $(libc_arch_static_src_files) \
1029 $(libc_static_common_src_files) \
1030 bionic/malloc_debug_common.cpp \
1031 bionic/libc_init_static.cpp \
1033 LOCAL_CFLAGS := $(libc_common_cflags) \
1034 -DLIBC_STATIC \
1036 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1037 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1038 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1039 LOCAL_MODULE := libc
1040 LOCAL_CLANG := $(use_clang)
1041 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1042 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1043 LOCAL_CXX_STL := none
1044 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1046 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1047 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
1048 include $(BUILD_STATIC_LIBRARY)
1051 # ========================================================
1052 # libc.so
1053 # ========================================================
1054 include $(CLEAR_VARS)
1056 LOCAL_CFLAGS := $(libc_common_cflags)
1057 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1058 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1059 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1060 LOCAL_SRC_FILES := \
1061 $(libc_arch_dynamic_src_files) \
1062 $(libc_static_common_src_files) \
1063 bionic/malloc_debug_common.cpp \
1064 bionic/libc_init_dynamic.cpp \
1065 bionic/NetdClient.cpp \
1067 LOCAL_MODULE := libc
1068 LOCAL_CLANG := $(use_clang)
1069 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1070 LOCAL_REQUIRED_MODULES := tzdata
1072 # Leave the symbols in the shared library so that stack unwinders can produce
1073 # meaningful name resolution.
1074 LOCAL_STRIP_MODULE := keep_symbols
1076 # WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
1077 # make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
1078 # ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
1079 # external; if that were the case, then libc would not pull those symbols from libgcc.a as it
1080 # should, instead relying on the external symbols from the dependent libraries. That would
1081 # create a "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
1082 # you wanted!
1084 LOCAL_SHARED_LIBRARIES := libdl
1085 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1086 LOCAL_CXX_STL := none
1087 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1089 # We'd really like to do this for all architectures, but since this wasn't done
1090 # before, these symbols must continue to be exported on LP32 for binary
1091 # compatibility.
1092 LOCAL_LDFLAGS_arm64 := -Wl,--exclude-libs,libgcc.a
1093 LOCAL_LDFLAGS_mips64 := -Wl,--exclude-libs,libgcc.a
1094 LOCAL_LDFLAGS_x86_64 := -Wl,--exclude-libs,libgcc.a
1096 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1097 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src_files))
1098 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_static_common_src_files))
1099 # special for arm
1100 LOCAL_NO_CRT_arm := true
1101 LOCAL_CFLAGS_arm += -DCRT_LEGACY_WORKAROUND
1102 LOCAL_SRC_FILES_arm += \
1103 arch-common/bionic/crtbegin_so.c \
1104 arch-arm/bionic/atexit_legacy.c \
1105 arch-common/bionic/crtend_so.S
1107 include $(BUILD_SHARED_LIBRARY)
1110 # For all builds, except for the -user build we will enable memory
1111 # allocation checking (including memory leaks, buffer overwrites, etc.)
1112 # Note that all these checks are also controlled by env. settings
1113 # that can enable, or disable specific checks. Note also that some of
1114 # the checks are available only in emulator and are implemeted in
1115 # libc_malloc_qemu_instrumented.so.
1116 ifneq ($(TARGET_BUILD_VARIANT),user)
1118 # ========================================================
1119 # libc_malloc_debug_leak.so
1120 # ========================================================
1121 include $(CLEAR_VARS)
1123 LOCAL_CFLAGS := \
1124 $(libc_common_cflags) \
1125 -DMALLOC_LEAK_CHECK \
1127 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1128 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1130 # Make sure that unwind.h comes from libunwind.
1131 LOCAL_C_INCLUDES := \
1132 $(libc_common_c_includes) \
1134 LOCAL_SRC_FILES := \
1135 bionic/debug_mapinfo.cpp \
1136 bionic/debug_stacktrace.cpp \
1137 bionic/libc_logging.cpp \
1138 bionic/malloc_debug_leak.cpp \
1139 bionic/malloc_debug_check.cpp \
1141 LOCAL_MODULE := libc_malloc_debug_leak
1142 LOCAL_CLANG := $(use_clang)
1143 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1145 LOCAL_SHARED_LIBRARIES := libc libdl
1146 LOCAL_CXX_STL := none
1147 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1148 # Only need this for arm since libc++ uses its own unwind code that
1149 # doesn't mix with the other default unwind code.
1150 LOCAL_STATIC_LIBRARIES_arm := libc++
1151 LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
1153 # Don't install on release build
1154 LOCAL_MODULE_TAGS := eng debug
1156 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1157 include $(BUILD_SHARED_LIBRARY)
1160 # ========================================================
1161 # libc_malloc_debug_qemu.so
1162 # ========================================================
1163 include $(CLEAR_VARS)
1165 LOCAL_CFLAGS := \
1166 $(libc_common_cflags) \
1167 -DMALLOC_QEMU_INSTRUMENT \
1169 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1170 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1172 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1174 LOCAL_SRC_FILES := \
1175 bionic/libc_logging.cpp \
1176 bionic/malloc_debug_qemu.cpp \
1178 LOCAL_MODULE := libc_malloc_debug_qemu
1179 LOCAL_CLANG := $(use_clang)
1180 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1182 LOCAL_SHARED_LIBRARIES := libc libdl
1183 LOCAL_CXX_STL := none
1184 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1186 # Don't install on release build
1187 LOCAL_MODULE_TAGS := eng debug
1189 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1190 include $(BUILD_SHARED_LIBRARY)
1192 endif #!user
1194 # ========================================================
1195 # libstdc++.so
1196 # ========================================================
1197 libstdcxx_common_src_files := \
1198 bionic/__cxa_guard.cpp \
1199 bionic/__cxa_pure_virtual.cpp \
1200 bionic/new.cpp \
1201 bionic/libc_logging.cpp \
1203 include $(CLEAR_VARS)
1204 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
1205 LOCAL_CFLAGS := $(libc_common_cflags)
1206 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1207 LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1208 LOCAL_MODULE:= libstdc++
1209 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1210 LOCAL_CXX_STL := none
1211 LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1212 include $(BUILD_SHARED_LIBRARY)
1214 # ========================================================
1215 # libstdc++.a
1216 # ========================================================
1217 include $(CLEAR_VARS)
1218 LOCAL_C_INCLUDES := $(libc_common_c_includes) bionic/libstdc++/include
1219 LOCAL_CFLAGS := $(libc_common_cflags)
1220 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1221 LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1222 LOCAL_MODULE:= libstdc++
1223 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1224 LOCAL_CXX_STL := none
1225 LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1226 include $(BUILD_STATIC_LIBRARY)
1229 # ========================================================
1230 include $(call all-makefiles-under,$(LOCAL_PATH))