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/daemon.c \
42 bionic/err.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/pathconf.c \
55 bionic/pututline.c \
56 bionic/sched_cpualloc.c \
57 bionic/sched_cpucount.c \
58 bionic/semaphore.c \
59 bionic/sigblock.c \
60 bionic/siginterrupt.c \
61 bionic/sigsetmask.c \
62 bionic/system_properties_compat.c \
63 stdio/snprintf.c\
64 stdio/sprintf.c \
66 # Fortify implementations of libc functions.
67 libc_common_src_files += \
68 bionic/__FD_chk.cpp \
69 bionic/__fgets_chk.cpp \
70 bionic/__memmove_chk.cpp \
71 bionic/__read_chk.cpp \
72 bionic/__recvfrom_chk.cpp \
73 bionic/__stpcpy_chk.cpp \
74 bionic/__stpncpy_chk.cpp \
75 bionic/__strchr_chk.cpp \
76 bionic/__strlcat_chk.cpp \
77 bionic/__strlcpy_chk.cpp \
78 bionic/__strlen_chk.cpp \
79 bionic/__strncat_chk.cpp \
80 bionic/__strncpy_chk.cpp \
81 bionic/__strrchr_chk.cpp \
82 bionic/__umask_chk.cpp \
83 bionic/__vsnprintf_chk.cpp \
84 bionic/__vsprintf_chk.cpp \
86 libc_bionic_src_files := \
87 bionic/abort.cpp \
88 bionic/accept.cpp \
89 bionic/accept4.cpp \
90 bionic/access.cpp \
91 bionic/assert.cpp \
92 bionic/atof.cpp \
93 bionic/bionic_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/inotify_init.cpp \
125 bionic/lchown.cpp \
126 bionic/lfs64_support.cpp \
127 bionic/__libc_current_sigrtmax.cpp \
128 bionic/__libc_current_sigrtmin.cpp \
129 bionic/libc_init_common.cpp \
130 bionic/libc_logging.cpp \
131 bionic/libgen.cpp \
132 bionic/link.cpp \
133 bionic/locale.cpp \
134 bionic/lstat.cpp \
135 bionic/mbrtoc16.cpp \
136 bionic/mbrtoc32.cpp \
137 bionic/mbstate.cpp \
138 bionic/mkdir.cpp \
139 bionic/mkfifo.cpp \
140 bionic/mknod.cpp \
141 bionic/mntent.cpp \
142 bionic/NetdClientDispatch.cpp \
143 bionic/open.cpp \
144 bionic/pause.cpp \
145 bionic/pipe.cpp \
146 bionic/poll.cpp \
147 bionic/posix_fadvise.cpp \
148 bionic/posix_fallocate.cpp \
149 bionic/posix_timers.cpp \
150 bionic/pthread_atfork.cpp \
151 bionic/pthread_attr.cpp \
152 bionic/pthread_cond.cpp \
153 bionic/pthread_create.cpp \
154 bionic/pthread_detach.cpp \
155 bionic/pthread_equal.cpp \
156 bionic/pthread_exit.cpp \
157 bionic/pthread_getcpuclockid.cpp \
158 bionic/pthread_getschedparam.cpp \
159 bionic/pthread_gettid_np.cpp \
160 bionic/pthread_internals.cpp \
161 bionic/pthread_join.cpp \
162 bionic/pthread_key.cpp \
163 bionic/pthread_kill.cpp \
164 bionic/pthread_mutex.cpp \
165 bionic/pthread_once.cpp \
166 bionic/pthread_rwlock.cpp \
167 bionic/pthread_self.cpp \
168 bionic/pthread_setname_np.cpp \
169 bionic/pthread_setschedparam.cpp \
170 bionic/pthread_sigmask.cpp \
171 bionic/ptrace.cpp \
172 bionic/pty.cpp \
173 bionic/raise.cpp \
174 bionic/rand.cpp \
175 bionic/readlink.cpp \
176 bionic/reboot.cpp \
177 bionic/recv.cpp \
178 bionic/rename.cpp \
179 bionic/rmdir.cpp \
180 bionic/scandir.cpp \
181 bionic/sched_getaffinity.cpp \
182 bionic/sched_getcpu.cpp \
183 bionic/send.cpp \
184 bionic/setegid.cpp \
185 bionic/__set_errno.cpp \
186 bionic/seteuid.cpp \
187 bionic/setpgrp.cpp \
188 bionic/sigaction.cpp \
189 bionic/sigaddset.cpp \
190 bionic/sigdelset.cpp \
191 bionic/sigemptyset.cpp \
192 bionic/sigfillset.cpp \
193 bionic/sigismember.cpp \
194 bionic/signal.cpp \
195 bionic/signalfd.cpp \
196 bionic/sigpending.cpp \
197 bionic/sigprocmask.cpp \
198 bionic/sigsuspend.cpp \
199 bionic/sigwait.cpp \
200 bionic/socket.cpp \
201 bionic/stat.cpp \
202 bionic/statvfs.cpp \
203 bionic/strcoll_l.cpp \
204 bionic/strerror.cpp \
205 bionic/strerror_r.cpp \
206 bionic/strftime_l.cpp \
207 bionic/strsignal.cpp \
208 bionic/strtold.cpp \
209 bionic/strtold_l.cpp \
210 bionic/strtoll_l.cpp \
211 bionic/strtoull_l.cpp \
212 bionic/strxfrm_l.cpp \
213 bionic/stubs.cpp \
214 bionic/symlink.cpp \
215 bionic/sysconf.cpp \
216 bionic/syslog.cpp \
217 bionic/sys_siglist.c \
218 bionic/sys_signame.c \
219 bionic/system_properties.cpp \
220 bionic/tdestroy.cpp \
221 bionic/termios.cpp \
222 bionic/thread_private.cpp \
223 bionic/tmpfile.cpp \
224 bionic/umount.cpp \
225 bionic/unlink.cpp \
226 bionic/utimes.cpp \
227 bionic/vdso.cpp \
228 bionic/wait.cpp \
229 bionic/wchar.cpp \
230 bionic/wctype.cpp \
232 libc_cxa_src_files := \
233 bionic/__cxa_guard.cpp \
234 bionic/__cxa_pure_virtual.cpp \
235 bionic/new.cpp \
237 libc_upstream_freebsd_src_files := \
238 upstream-freebsd/lib/libc/gen/ldexp.c \
239 upstream-freebsd/lib/libc/gen/sleep.c \
240 upstream-freebsd/lib/libc/gen/usleep.c \
241 upstream-freebsd/lib/libc/stdio/fclose.c \
242 upstream-freebsd/lib/libc/stdio/flags.c \
243 upstream-freebsd/lib/libc/stdio/fopen.c \
244 upstream-freebsd/lib/libc/stdlib/abs.c \
245 upstream-freebsd/lib/libc/stdlib/getopt_long.c \
246 upstream-freebsd/lib/libc/stdlib/imaxabs.c \
247 upstream-freebsd/lib/libc/stdlib/imaxdiv.c \
248 upstream-freebsd/lib/libc/stdlib/labs.c \
249 upstream-freebsd/lib/libc/stdlib/llabs.c \
250 upstream-freebsd/lib/libc/stdlib/qsort.c \
251 upstream-freebsd/lib/libc/stdlib/quick_exit.c \
252 upstream-freebsd/lib/libc/stdlib/realpath.c \
253 upstream-freebsd/lib/libc/string/wcpcpy.c \
254 upstream-freebsd/lib/libc/string/wcpncpy.c \
255 upstream-freebsd/lib/libc/string/wcscasecmp.c \
256 upstream-freebsd/lib/libc/string/wcscspn.c \
257 upstream-freebsd/lib/libc/string/wcsdup.c \
258 upstream-freebsd/lib/libc/string/wcslcat.c \
259 upstream-freebsd/lib/libc/string/wcsncasecmp.c \
260 upstream-freebsd/lib/libc/string/wcsncat.c \
261 upstream-freebsd/lib/libc/string/wcsncmp.c \
262 upstream-freebsd/lib/libc/string/wcsncpy.c \
263 upstream-freebsd/lib/libc/string/wcsnlen.c \
264 upstream-freebsd/lib/libc/string/wcspbrk.c \
265 upstream-freebsd/lib/libc/string/wcsspn.c \
266 upstream-freebsd/lib/libc/string/wcstok.c \
267 upstream-freebsd/lib/libc/string/wmemchr.c \
268 upstream-freebsd/lib/libc/string/wmemcpy.c \
269 upstream-freebsd/lib/libc/string/wmemset.c \
271 libc_upstream_netbsd_src_files := \
272 upstream-netbsd/common/lib/libc/stdlib/random.c \
273 upstream-netbsd/lib/libc/gen/ftw.c \
274 upstream-netbsd/lib/libc/gen/nftw.c \
275 upstream-netbsd/lib/libc/gen/nice.c \
276 upstream-netbsd/lib/libc/gen/popen.c \
277 upstream-netbsd/lib/libc/gen/psignal.c \
278 upstream-netbsd/lib/libc/gen/utime.c \
279 upstream-netbsd/lib/libc/gen/utmp.c \
280 upstream-netbsd/lib/libc/inet/nsap_addr.c \
281 upstream-netbsd/lib/libc/regex/regcomp.c \
282 upstream-netbsd/lib/libc/regex/regerror.c \
283 upstream-netbsd/lib/libc/regex/regexec.c \
284 upstream-netbsd/lib/libc/regex/regfree.c \
285 upstream-netbsd/lib/libc/stdlib/bsearch.c \
286 upstream-netbsd/lib/libc/stdlib/div.c \
287 upstream-netbsd/lib/libc/stdlib/drand48.c \
288 upstream-netbsd/lib/libc/stdlib/erand48.c \
289 upstream-netbsd/lib/libc/stdlib/insque.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/remque.c \
299 upstream-netbsd/lib/libc/stdlib/seed48.c \
300 upstream-netbsd/lib/libc/stdlib/srand48.c \
301 upstream-netbsd/lib/libc/string/memccpy.c \
302 upstream-netbsd/lib/libc/string/strcasestr.c \
303 upstream-netbsd/lib/libc/string/strcoll.c \
304 upstream-netbsd/lib/libc/string/strxfrm.c \
305 upstream-netbsd/lib/libc/unistd/killpg.c \
307 libc_upstream_openbsd_gdtoa_src_files := \
308 upstream-openbsd/android/gdtoa_support.cpp \
309 upstream-openbsd/lib/libc/gdtoa/dmisc.c \
310 upstream-openbsd/lib/libc/gdtoa/dtoa.c \
311 upstream-openbsd/lib/libc/gdtoa/gdtoa.c \
312 upstream-openbsd/lib/libc/gdtoa/gethex.c \
313 upstream-openbsd/lib/libc/gdtoa/gmisc.c \
314 upstream-openbsd/lib/libc/gdtoa/hd_init.c \
315 upstream-openbsd/lib/libc/gdtoa/hdtoa.c \
316 upstream-openbsd/lib/libc/gdtoa/hexnan.c \
317 upstream-openbsd/lib/libc/gdtoa/ldtoa.c \
318 upstream-openbsd/lib/libc/gdtoa/misc.c \
319 upstream-openbsd/lib/libc/gdtoa/smisc.c \
320 upstream-openbsd/lib/libc/gdtoa/strtod.c \
321 upstream-openbsd/lib/libc/gdtoa/strtodg.c \
322 upstream-openbsd/lib/libc/gdtoa/strtof.c \
323 upstream-openbsd/lib/libc/gdtoa/strtord.c \
324 upstream-openbsd/lib/libc/gdtoa/sum.c \
325 upstream-openbsd/lib/libc/gdtoa/ulp.c \
327 libc_upstream_openbsd_gdtoa_src_files_32 := \
328 $(libc_upstream_openbsd_gdtoa_src_files) \
330 libc_upstream_openbsd_gdtoa_src_files_64 := \
331 $(libc_upstream_openbsd_gdtoa_src_files) \
332 upstream-openbsd/lib/libc/gdtoa/strtorQ.c \
334 libc_upstream_openbsd_src_files := \
335 upstream-openbsd/lib/libc/crypt/arc4random.c \
336 upstream-openbsd/lib/libc/crypt/arc4random_uniform.c \
337 upstream-openbsd/lib/libc/gen/alarm.c \
338 upstream-openbsd/lib/libc/gen/ctype_.c \
339 upstream-openbsd/lib/libc/gen/exec.c \
340 upstream-openbsd/lib/libc/gen/fnmatch.c \
341 upstream-openbsd/lib/libc/gen/ftok.c \
342 upstream-openbsd/lib/libc/gen/getprogname.c \
343 upstream-openbsd/lib/libc/gen/isctype.c \
344 upstream-openbsd/lib/libc/gen/setprogname.c \
345 upstream-openbsd/lib/libc/gen/time.c \
346 upstream-openbsd/lib/libc/gen/tolower_.c \
347 upstream-openbsd/lib/libc/gen/toupper_.c \
348 upstream-openbsd/lib/libc/locale/btowc.c \
349 upstream-openbsd/lib/libc/locale/mbrlen.c \
350 upstream-openbsd/lib/libc/locale/mbstowcs.c \
351 upstream-openbsd/lib/libc/locale/mbtowc.c \
352 upstream-openbsd/lib/libc/locale/wcscoll.c \
353 upstream-openbsd/lib/libc/locale/wcstod.c \
354 upstream-openbsd/lib/libc/locale/wcstof.c \
355 upstream-openbsd/lib/libc/locale/wcstoimax.c \
356 upstream-openbsd/lib/libc/locale/wcstol.c \
357 upstream-openbsd/lib/libc/locale/wcstold.c \
358 upstream-openbsd/lib/libc/locale/wcstoll.c \
359 upstream-openbsd/lib/libc/locale/wcstombs.c \
360 upstream-openbsd/lib/libc/locale/wcstoul.c \
361 upstream-openbsd/lib/libc/locale/wcstoull.c \
362 upstream-openbsd/lib/libc/locale/wcstoumax.c \
363 upstream-openbsd/lib/libc/locale/wcsxfrm.c \
364 upstream-openbsd/lib/libc/locale/wctob.c \
365 upstream-openbsd/lib/libc/locale/wctomb.c \
366 upstream-openbsd/lib/libc/net/htonl.c \
367 upstream-openbsd/lib/libc/net/htons.c \
368 upstream-openbsd/lib/libc/net/inet_addr.c \
369 upstream-openbsd/lib/libc/net/inet_lnaof.c \
370 upstream-openbsd/lib/libc/net/inet_makeaddr.c \
371 upstream-openbsd/lib/libc/net/inet_netof.c \
372 upstream-openbsd/lib/libc/net/inet_network.c \
373 upstream-openbsd/lib/libc/net/inet_ntoa.c \
374 upstream-openbsd/lib/libc/net/inet_ntop.c \
375 upstream-openbsd/lib/libc/net/inet_pton.c \
376 upstream-openbsd/lib/libc/net/ntohl.c \
377 upstream-openbsd/lib/libc/net/ntohs.c \
378 upstream-openbsd/lib/libc/stdio/asprintf.c \
379 upstream-openbsd/lib/libc/stdio/clrerr.c \
380 upstream-openbsd/lib/libc/stdio/dprintf.c \
381 upstream-openbsd/lib/libc/stdio/fdopen.c \
382 upstream-openbsd/lib/libc/stdio/feof.c \
383 upstream-openbsd/lib/libc/stdio/ferror.c \
384 upstream-openbsd/lib/libc/stdio/fflush.c \
385 upstream-openbsd/lib/libc/stdio/fgetc.c \
386 upstream-openbsd/lib/libc/stdio/fgetln.c \
387 upstream-openbsd/lib/libc/stdio/fgetpos.c \
388 upstream-openbsd/lib/libc/stdio/fgets.c \
389 upstream-openbsd/lib/libc/stdio/fgetwc.c \
390 upstream-openbsd/lib/libc/stdio/fgetws.c \
391 upstream-openbsd/lib/libc/stdio/fileno.c \
392 upstream-openbsd/lib/libc/stdio/findfp.c \
393 upstream-openbsd/lib/libc/stdio/fprintf.c \
394 upstream-openbsd/lib/libc/stdio/fpurge.c \
395 upstream-openbsd/lib/libc/stdio/fputc.c \
396 upstream-openbsd/lib/libc/stdio/fputs.c \
397 upstream-openbsd/lib/libc/stdio/fputwc.c \
398 upstream-openbsd/lib/libc/stdio/fputws.c \
399 upstream-openbsd/lib/libc/stdio/fread.c \
400 upstream-openbsd/lib/libc/stdio/freopen.c \
401 upstream-openbsd/lib/libc/stdio/fscanf.c \
402 upstream-openbsd/lib/libc/stdio/fseek.c \
403 upstream-openbsd/lib/libc/stdio/fsetpos.c \
404 upstream-openbsd/lib/libc/stdio/ftell.c \
405 upstream-openbsd/lib/libc/stdio/funopen.c \
406 upstream-openbsd/lib/libc/stdio/fvwrite.c \
407 upstream-openbsd/lib/libc/stdio/fwalk.c \
408 upstream-openbsd/lib/libc/stdio/fwide.c \
409 upstream-openbsd/lib/libc/stdio/fwprintf.c \
410 upstream-openbsd/lib/libc/stdio/fwrite.c \
411 upstream-openbsd/lib/libc/stdio/fwscanf.c \
412 upstream-openbsd/lib/libc/stdio/getc.c \
413 upstream-openbsd/lib/libc/stdio/getchar.c \
414 upstream-openbsd/lib/libc/stdio/getdelim.c \
415 upstream-openbsd/lib/libc/stdio/getline.c \
416 upstream-openbsd/lib/libc/stdio/gets.c \
417 upstream-openbsd/lib/libc/stdio/getwc.c \
418 upstream-openbsd/lib/libc/stdio/getwchar.c \
419 upstream-openbsd/lib/libc/stdio/makebuf.c \
420 upstream-openbsd/lib/libc/stdio/mktemp.c \
421 upstream-openbsd/lib/libc/stdio/perror.c \
422 upstream-openbsd/lib/libc/stdio/printf.c \
423 upstream-openbsd/lib/libc/stdio/putc.c \
424 upstream-openbsd/lib/libc/stdio/putchar.c \
425 upstream-openbsd/lib/libc/stdio/puts.c \
426 upstream-openbsd/lib/libc/stdio/putwc.c \
427 upstream-openbsd/lib/libc/stdio/putwchar.c \
428 upstream-openbsd/lib/libc/stdio/refill.c \
429 upstream-openbsd/lib/libc/stdio/remove.c \
430 upstream-openbsd/lib/libc/stdio/rewind.c \
431 upstream-openbsd/lib/libc/stdio/rget.c \
432 upstream-openbsd/lib/libc/stdio/scanf.c \
433 upstream-openbsd/lib/libc/stdio/setbuf.c \
434 upstream-openbsd/lib/libc/stdio/setbuffer.c \
435 upstream-openbsd/lib/libc/stdio/setvbuf.c \
436 upstream-openbsd/lib/libc/stdio/sscanf.c \
437 upstream-openbsd/lib/libc/stdio/stdio.c \
438 upstream-openbsd/lib/libc/stdio/swprintf.c \
439 upstream-openbsd/lib/libc/stdio/swscanf.c \
440 upstream-openbsd/lib/libc/stdio/tempnam.c \
441 upstream-openbsd/lib/libc/stdio/tmpnam.c \
442 upstream-openbsd/lib/libc/stdio/ungetc.c \
443 upstream-openbsd/lib/libc/stdio/ungetwc.c \
444 upstream-openbsd/lib/libc/stdio/vasprintf.c \
445 upstream-openbsd/lib/libc/stdio/vdprintf.c \
446 upstream-openbsd/lib/libc/stdio/vfprintf.c \
447 upstream-openbsd/lib/libc/stdio/vfscanf.c \
448 upstream-openbsd/lib/libc/stdio/vfwprintf.c \
449 upstream-openbsd/lib/libc/stdio/vfwscanf.c \
450 upstream-openbsd/lib/libc/stdio/vprintf.c \
451 upstream-openbsd/lib/libc/stdio/vscanf.c \
452 upstream-openbsd/lib/libc/stdio/vsnprintf.c \
453 upstream-openbsd/lib/libc/stdio/vsprintf.c \
454 upstream-openbsd/lib/libc/stdio/vsscanf.c \
455 upstream-openbsd/lib/libc/stdio/vswprintf.c \
456 upstream-openbsd/lib/libc/stdio/vswscanf.c \
457 upstream-openbsd/lib/libc/stdio/vwprintf.c \
458 upstream-openbsd/lib/libc/stdio/vwscanf.c \
459 upstream-openbsd/lib/libc/stdio/wbuf.c \
460 upstream-openbsd/lib/libc/stdio/wprintf.c \
461 upstream-openbsd/lib/libc/stdio/wscanf.c \
462 upstream-openbsd/lib/libc/stdio/wsetup.c \
463 upstream-openbsd/lib/libc/stdlib/atexit.c \
464 upstream-openbsd/lib/libc/stdlib/atoi.c \
465 upstream-openbsd/lib/libc/stdlib/atol.c \
466 upstream-openbsd/lib/libc/stdlib/atoll.c \
467 upstream-openbsd/lib/libc/stdlib/exit.c \
468 upstream-openbsd/lib/libc/stdlib/getenv.c \
469 upstream-openbsd/lib/libc/stdlib/lsearch.c \
470 upstream-openbsd/lib/libc/stdlib/setenv.c \
471 upstream-openbsd/lib/libc/stdlib/strtoimax.c \
472 upstream-openbsd/lib/libc/stdlib/strtol.c \
473 upstream-openbsd/lib/libc/stdlib/strtoll.c \
474 upstream-openbsd/lib/libc/stdlib/strtoul.c \
475 upstream-openbsd/lib/libc/stdlib/strtoull.c \
476 upstream-openbsd/lib/libc/stdlib/strtoumax.c \
477 upstream-openbsd/lib/libc/stdlib/system.c \
478 upstream-openbsd/lib/libc/stdlib/tfind.c \
479 upstream-openbsd/lib/libc/stdlib/tsearch.c \
480 upstream-openbsd/lib/libc/string/strcasecmp.c \
481 upstream-openbsd/lib/libc/string/strcspn.c \
482 upstream-openbsd/lib/libc/string/strdup.c \
483 upstream-openbsd/lib/libc/string/strndup.c \
484 upstream-openbsd/lib/libc/string/strpbrk.c \
485 upstream-openbsd/lib/libc/string/strsep.c \
486 upstream-openbsd/lib/libc/string/strspn.c \
487 upstream-openbsd/lib/libc/string/strstr.c \
488 upstream-openbsd/lib/libc/string/strtok.c \
489 upstream-openbsd/lib/libc/string/wcslcpy.c \
490 upstream-openbsd/lib/libc/string/wcsstr.c \
491 upstream-openbsd/lib/libc/string/wcswidth.c \
493 libc_arch_static_src_files := \
494 bionic/dl_iterate_phdr_static.cpp \
496 # Define some common cflags
497 # ========================================================
498 libc_common_cflags := \
499 -D_LIBC=1 \
500 -Wall -Wextra -Wunused \
502 ifneq ($(TARGET_USES_LOGD),false)
503 libc_common_cflags += -DTARGET_USES_LOGD
504 endif
506 use_clang := false
508 # Try to catch typical 32-bit assumptions that break with 64-bit pointers.
509 libc_common_cflags += \
510 -Werror=pointer-to-int-cast \
511 -Werror=int-to-pointer-cast \
512 -Werror=type-limits \
513 -Werror \
515 ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
516 libc_common_cflags += -DDEBUG
517 endif
519 ifeq ($(MALLOC_IMPL),dlmalloc)
520 libc_common_cflags += -DUSE_DLMALLOC
521 libc_malloc_src := bionic/dlmalloc.c
522 else
523 libc_common_cflags += -DUSE_JEMALLOC
524 libc_malloc_src := bionic/jemalloc_wrapper.cpp
525 libc_common_c_includes += external/jemalloc/include
526 endif
528 # To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in
529 # the appropriate BoardConfig.mk file.
530 #
531 ifneq ($(BOARD_MALLOC_ALIGNMENT),)
532 libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT)
533 endif
535 # Define ANDROID_SMP appropriately.
536 ifeq ($(TARGET_CPU_SMP),true)
537 libc_common_cflags += -DANDROID_SMP=1
538 else
539 libc_common_cflags += -DANDROID_SMP=0
540 endif
542 # Define some common conlyflags
543 libc_common_conlyflags := \
544 -std=gnu99
546 # Define some common cppflags
547 libc_common_cppflags := \
548 -std=gnu++11
550 # Define some common includes
551 # ========================================================
552 libc_common_c_includes += \
553 $(LOCAL_PATH)/stdio \
555 # ========================================================
556 # Add in the arch-specific flags.
557 # Must be called with $(eval).
558 # $(1): the LOCAL_ variable name
559 # $(2): the bionic variable name to pull in
560 define patch-up-arch-specific-flags
561 $(1)_$(TARGET_ARCH) += $($(2)_$(TARGET_ARCH))
562 ifdef TARGET_2ND_ARCH
563 $(1)_$(TARGET_2ND_ARCH) += $($(2)_$(TARGET_2ND_ARCH))
564 endif
565 endef
568 # ========================================================
569 # libc_stack_protector.a - stack protector code
570 # ========================================================
571 #
572 # The stack protector code needs to be compiled
573 # with -fno-stack-protector, since it modifies the
574 # stack canary.
576 include $(CLEAR_VARS)
578 LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
579 LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
580 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
581 LOCAL_CPPFLAGS := $(libc_common_cppflags)
582 LOCAL_C_INCLUDES := $(libc_common_c_includes)
583 LOCAL_MODULE := libc_stack_protector
584 LOCAL_CLANG := $(use_clang)
585 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
586 LOCAL_SYSTEM_SHARED_LIBRARIES :=
588 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
589 include $(BUILD_STATIC_LIBRARY)
592 # ========================================================
593 # libc_tzcode.a - upstream 'tzcode' code
594 # ========================================================
596 include $(CLEAR_VARS)
598 LOCAL_SRC_FILES := $(call all-c-files-under,tzcode)
599 # tzcode doesn't include wcsftime, so we use the OpenBSD one.
600 LOCAL_SRC_FILES += upstream-openbsd/lib/libc/time/wcsftime.c
602 LOCAL_CFLAGS := $(libc_common_cflags) \
603 -fvisibility=hidden \
605 # Don't use ridiculous amounts of stack.
606 LOCAL_CFLAGS += -DALL_STATE
607 # Include tzsetwall, timelocal, timegm, time2posix, and posix2time.
608 LOCAL_CFLAGS += -DSTD_INSPIRED
609 # The name of the tm_gmtoff field in our struct tm.
610 LOCAL_CFLAGS += -DTM_GMTOFF=tm_gmtoff
611 # Where we store our tzdata.
612 LOCAL_CFLAGS += -DTZDIR=\"/system/usr/share/zoneinfo\"
613 # Include timezone and daylight globals.
614 LOCAL_CFLAGS += -DUSG_COMPAT=1
615 LOCAL_CFLAGS += -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
616 LOCAL_CFLAGS += -Dlint
618 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
619 LOCAL_CPPFLAGS := $(libc_common_cppflags)
620 LOCAL_C_INCLUDES := $(libc_common_c_includes) $(LOCAL_PATH)/tzcode/
621 LOCAL_MODULE := libc_tzcode
622 LOCAL_CLANG := $(use_clang)
623 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
624 LOCAL_SYSTEM_SHARED_LIBRARIES :=
626 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
627 include $(BUILD_STATIC_LIBRARY)
630 # ========================================================
631 # libc_dns.a - modified NetBSD DNS code
632 # ========================================================
634 include $(CLEAR_VARS)
636 LOCAL_SRC_FILES := \
637 $(call all-c-files-under,dns) \
638 upstream-netbsd/lib/libc/isc/ev_streams.c \
639 upstream-netbsd/lib/libc/isc/ev_timers.c \
640 upstream-netbsd/lib/libc/resolv/mtctxres.c \
642 LOCAL_CFLAGS := \
643 $(libc_common_cflags) \
644 -DANDROID_CHANGES \
645 -DINET6 \
646 -fvisibility=hidden \
647 -Wno-unused-parameter \
648 -I$(LOCAL_PATH)/dns/include \
649 -I$(LOCAL_PATH)/private \
650 -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
651 -I$(LOCAL_PATH)/upstream-netbsd/android/include \
652 -include netbsd-compat.h \
654 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
655 LOCAL_CPPFLAGS := $(libc_common_cppflags)
656 LOCAL_C_INCLUDES := $(libc_common_c_includes)
657 LOCAL_MODULE := libc_dns
658 LOCAL_CLANG := $(use_clang)
659 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
660 LOCAL_SYSTEM_SHARED_LIBRARIES :=
662 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
663 include $(BUILD_STATIC_LIBRARY)
666 # ========================================================
667 # libc_freebsd.a - upstream FreeBSD C library code
668 # ========================================================
669 #
670 # These files are built with the freebsd-compat.h header file
671 # automatically included.
673 include $(CLEAR_VARS)
675 LOCAL_SRC_FILES := $(libc_upstream_freebsd_src_files)
676 LOCAL_CFLAGS := \
677 $(libc_common_cflags) \
678 -Wno-sign-compare -Wno-uninitialized \
679 -I$(LOCAL_PATH)/upstream-freebsd/android/include \
680 -I$(LOCAL_PATH)/upstream-freebsd/lib/libc/include \
681 -include freebsd-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_freebsd
687 LOCAL_CLANG := $(use_clang)
688 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
689 LOCAL_SYSTEM_SHARED_LIBRARIES :=
691 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
692 include $(BUILD_STATIC_LIBRARY)
695 # ========================================================
696 # libc_netbsd.a - upstream NetBSD C library code
697 # ========================================================
698 #
699 # These files are built with the netbsd-compat.h header file
700 # automatically included.
702 include $(CLEAR_VARS)
704 LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
705 LOCAL_CFLAGS := \
706 $(libc_common_cflags) \
707 -Wno-sign-compare -Wno-uninitialized \
708 -DPOSIX_MISTAKE \
709 -I$(LOCAL_PATH)/upstream-netbsd/android/include \
710 -I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
711 -include netbsd-compat.h \
713 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
714 LOCAL_CPPFLAGS := $(libc_common_cppflags)
715 LOCAL_C_INCLUDES := $(libc_common_c_includes)
716 LOCAL_MODULE := libc_netbsd
717 LOCAL_CLANG := $(use_clang)
718 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
719 LOCAL_SYSTEM_SHARED_LIBRARIES :=
721 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
722 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_netbsd_src_files))
723 include $(BUILD_STATIC_LIBRARY)
726 # ========================================================
727 # libc_openbsd.a - upstream OpenBSD C library code
728 # ========================================================
729 #
730 # These files are built with the openbsd-compat.h header file
731 # automatically included.
733 include $(CLEAR_VARS)
735 LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files)
736 LOCAL_CFLAGS := \
737 $(libc_common_cflags) \
738 -Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter \
739 -I$(LOCAL_PATH)/private \
740 -I$(LOCAL_PATH)/upstream-openbsd/android/include \
741 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
742 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/gdtoa/ \
743 -include openbsd-compat.h \
745 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
746 LOCAL_CPPFLAGS := $(libc_common_cppflags)
747 LOCAL_C_INCLUDES := $(libc_common_c_includes)
748 LOCAL_MODULE := libc_openbsd
749 LOCAL_CLANG := $(use_clang)
750 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
751 LOCAL_SYSTEM_SHARED_LIBRARIES :=
753 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
754 include $(BUILD_STATIC_LIBRARY)
757 # ========================================================
758 # libc_gdtoa.a - upstream OpenBSD C library gdtoa code
759 # ========================================================
760 #
761 # These files are built with the openbsd-compat.h header file
762 # automatically included.
764 include $(CLEAR_VARS)
766 LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32)
767 LOCAL_SRC_FILES_64 := $(libc_upstream_openbsd_gdtoa_src_files_64)
768 LOCAL_CFLAGS := \
769 $(libc_common_cflags) \
770 -Wno-sign-compare -Wno-uninitialized \
771 -fvisibility=hidden \
772 -I$(LOCAL_PATH)/private \
773 -I$(LOCAL_PATH)/upstream-openbsd/android/include \
774 -I$(LOCAL_PATH)/upstream-openbsd/lib/libc/include \
775 -include openbsd-compat.h \
777 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
778 LOCAL_CPPFLAGS := $(libc_common_cppflags)
779 LOCAL_C_INCLUDES := $(libc_common_c_includes)
780 LOCAL_MODULE := libc_gdtoa
781 LOCAL_CLANG := $(use_clang)
782 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
783 LOCAL_SYSTEM_SHARED_LIBRARIES :=
785 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
786 include $(BUILD_STATIC_LIBRARY)
789 # ========================================================
790 # libc_bionic.a - home-grown C library code
791 # ========================================================
793 include $(CLEAR_VARS)
795 LOCAL_SRC_FILES := $(libc_bionic_src_files)
796 LOCAL_CFLAGS := $(libc_common_cflags) \
797 -Wframe-larger-than=2048 \
799 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
800 LOCAL_CPPFLAGS := $(libc_common_cppflags)
801 LOCAL_C_INCLUDES := $(libc_common_c_includes)
802 LOCAL_MODULE := libc_bionic
803 LOCAL_CLANG := $(use_clang)
804 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
805 LOCAL_SYSTEM_SHARED_LIBRARIES :=
807 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
808 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_bionic_src_files))
809 include $(BUILD_STATIC_LIBRARY)
812 # ========================================================
813 # libc_cxa.a - Things traditionally in libstdc++
814 # ========================================================
816 include $(CLEAR_VARS)
818 LOCAL_SRC_FILES := $(libc_cxa_src_files)
819 LOCAL_CFLAGS := $(libc_common_cflags) \
820 -fvisibility=hidden \
822 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
823 LOCAL_CPPFLAGS := $(libc_common_cppflags)
824 LOCAL_C_INCLUDES := $(libc_common_c_includes)
825 LOCAL_MODULE := libc_cxa
826 # GCC refuses to hide new/delete
827 LOCAL_CLANG := true
828 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
829 LOCAL_SYSTEM_SHARED_LIBRARIES :=
831 include $(BUILD_STATIC_LIBRARY)
834 # ========================================================
835 # libc_syscalls.a
836 # ========================================================
838 include $(CLEAR_VARS)
840 LOCAL_SRC_FILES_$(TARGET_ARCH) := $(call all-S-files-under,arch-$(TARGET_ARCH)/syscalls)
841 ifdef TARGET_2ND_ARCH
842 LOCAL_SRC_FILES_$(TARGET_2ND_ARCH) := $(call all-S-files-under,arch-$(TARGET_2ND_ARCH)/syscalls)
843 endif
844 LOCAL_MODULE := libc_syscalls
845 LOCAL_CLANG := $(use_clang)
846 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
847 LOCAL_SYSTEM_SHARED_LIBRARIES :=
849 include $(BUILD_STATIC_LIBRARY)
852 # ========================================================
853 # libc_aeabi.a
854 # This is an LP32 ARM-only library that needs to be built with -fno-builtin
855 # to avoid infinite recursion. For the other architectures we just build an
856 # empty library to keep this makefile simple.
857 # ========================================================
859 include $(CLEAR_VARS)
861 LOCAL_SRC_FILES_arm := arch-arm/bionic/__aeabi.c
862 LOCAL_MODULE := libc_aeabi
863 LOCAL_CLANG := $(use_clang)
864 LOCAL_CFLAGS := $(libc_common_cflags) -fno-builtin
865 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
866 LOCAL_SYSTEM_SHARED_LIBRARIES :=
868 include $(BUILD_STATIC_LIBRARY)
870 # ========================================================
871 # libc_common.a
872 # ========================================================
874 include $(CLEAR_VARS)
876 LOCAL_SRC_FILES := $(libc_common_src_files)
877 LOCAL_CFLAGS := $(libc_common_cflags)
878 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
879 LOCAL_CPPFLAGS := $(libc_common_cppflags)
880 LOCAL_C_INCLUDES := $(libc_common_c_includes)
881 LOCAL_MODULE := libc_common
882 LOCAL_CLANG := $(use_clang)
883 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
884 LOCAL_WHOLE_STATIC_LIBRARIES := \
885 libc_bionic \
886 libc_cxa \
887 libc_dns \
888 libc_freebsd \
889 libc_gdtoa \
890 libc_malloc \
891 libc_netbsd \
892 libc_openbsd \
893 libc_stack_protector \
894 libc_syscalls \
895 libc_tzcode \
897 LOCAL_WHOLE_STATIC_LIBRARIES_arm := libc_aeabi
899 ifneq ($(MALLOC_IMPL),dlmalloc)
900 LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
901 endif
903 LOCAL_SYSTEM_SHARED_LIBRARIES :=
905 # TODO: split out the asflags.
906 LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
908 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
909 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_common_src_files))
910 $(eval $(call patch-up-arch-specific-flags,LOCAL_ASFLAGS,LOCAL_CFLAGS))
911 include $(BUILD_STATIC_LIBRARY)
914 # ========================================================
915 # libc_nomalloc.a
916 # ========================================================
917 #
918 # This is a version of the static C library that does not
919 # include malloc. It's useful in situations when the user wants
920 # to provide their own malloc implementation, or wants to
921 # explicitly disallow the use of malloc, such as in the
922 # dynamic linker.
924 include $(CLEAR_VARS)
926 LOCAL_SRC_FILES := \
927 $(libc_arch_static_src_files) \
928 $(libc_static_common_src_files) \
929 bionic/libc_init_static.cpp
931 LOCAL_C_INCLUDES := $(libc_common_c_includes)
932 LOCAL_CFLAGS := $(libc_common_cflags) \
933 -DLIBC_STATIC \
935 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
936 LOCAL_CPPFLAGS := $(libc_common_cppflags)
938 LOCAL_MODULE := libc_nomalloc
939 LOCAL_CLANG := $(use_clang)
940 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
941 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
942 LOCAL_SYSTEM_SHARED_LIBRARIES :=
944 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
945 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
946 include $(BUILD_STATIC_LIBRARY)
949 # ========================================================
950 # libc_malloc.a: the _prefixed_ malloc functions (like dlcalloc).
951 # ========================================================
953 include $(CLEAR_VARS)
954 LOCAL_SRC_FILES := $(libc_malloc_src)
955 LOCAL_CFLAGS := $(libc_common_cflags) \
956 -fvisibility=hidden \
958 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
959 LOCAL_CPPFLAGS := $(libc_common_cppflags)
960 LOCAL_C_INCLUDES := $(libc_common_c_includes)
961 LOCAL_MODULE := libc_malloc
962 LOCAL_CLANG := $(use_clang)
963 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
964 include $(BUILD_STATIC_LIBRARY)
967 # ========================================================
968 # libc.a
969 # ========================================================
970 include $(CLEAR_VARS)
972 LOCAL_SRC_FILES := \
973 $(libc_arch_static_src_files) \
974 $(libc_static_common_src_files) \
975 bionic/malloc_debug_common.cpp \
976 bionic/libc_init_static.cpp \
978 LOCAL_CFLAGS := $(libc_common_cflags) \
979 -DLIBC_STATIC \
981 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
982 LOCAL_CPPFLAGS := $(libc_common_cppflags)
983 LOCAL_C_INCLUDES := $(libc_common_c_includes)
984 LOCAL_MODULE := libc
985 LOCAL_CLANG := $(use_clang)
986 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
987 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
988 LOCAL_SYSTEM_SHARED_LIBRARIES :=
990 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
991 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_static_src_files))
992 include $(BUILD_STATIC_LIBRARY)
995 # ========================================================
996 # libc.so
997 # ========================================================
998 include $(CLEAR_VARS)
1000 LOCAL_CFLAGS := $(libc_common_cflags)
1001 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1002 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1003 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1004 LOCAL_SRC_FILES := \
1005 $(libc_arch_dynamic_src_files) \
1006 $(libc_static_common_src_files) \
1007 bionic/malloc_debug_common.cpp \
1008 bionic/libc_init_dynamic.cpp \
1009 bionic/NetdClient.cpp \
1011 LOCAL_MODULE := libc
1012 LOCAL_CLANG := $(use_clang)
1013 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1014 LOCAL_REQUIRED_MODULES := tzdata
1016 # Leave the symbols in the shared library so that stack unwinders can produce
1017 # meaningful name resolution.
1018 LOCAL_STRIP_MODULE := keep_symbols
1020 # WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
1021 # make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
1022 # ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
1023 # external; if that were the case, then libc would not pull those symbols from libgcc.a as it
1024 # should, instead relying on the external symbols from the dependent libraries. That would
1025 # create a "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
1026 # you wanted!
1028 LOCAL_SHARED_LIBRARIES := libdl
1029 LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
1030 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1032 # We'd really like to do this for all architectures, but since this wasn't done
1033 # before, these symbols must continue to be exported on LP32 for binary
1034 # compatibility.
1035 LOCAL_LDFLAGS_arm64 := -Wl,--exclude-libs,libgcc.a
1036 LOCAL_LDFLAGS_mips64 := -Wl,--exclude-libs,libgcc.a
1037 LOCAL_LDFLAGS_x86_64 := -Wl,--exclude-libs,libgcc.a
1039 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1040 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src_files))
1041 $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_static_common_src_files))
1042 # special for arm
1043 LOCAL_NO_CRT_arm := true
1044 LOCAL_CFLAGS_arm += -DCRT_LEGACY_WORKAROUND
1045 LOCAL_SRC_FILES_arm += \
1046 arch-common/bionic/crtbegin_so.c \
1047 arch-arm/bionic/atexit_legacy.c \
1048 arch-common/bionic/crtend_so.S
1050 include $(BUILD_SHARED_LIBRARY)
1053 # For all builds, except for the -user build we will enable memory
1054 # allocation checking (including memory leaks, buffer overwrites, etc.)
1055 # Note that all these checks are also controlled by env. settings
1056 # that can enable, or disable specific checks. Note also that some of
1057 # the checks are available only in emulator and are implemeted in
1058 # libc_malloc_qemu_instrumented.so.
1059 ifneq ($(TARGET_BUILD_VARIANT),user)
1061 # ========================================================
1062 # libc_malloc_debug_leak.so
1063 # ========================================================
1064 include $(CLEAR_VARS)
1066 LOCAL_CFLAGS := \
1067 $(libc_common_cflags) \
1068 -DMALLOC_LEAK_CHECK \
1070 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1071 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1073 # Make sure that unwind.h comes from libunwind.
1074 LOCAL_C_INCLUDES := \
1075 $(libc_common_c_includes) \
1077 LOCAL_SRC_FILES := \
1078 bionic/debug_mapinfo.cpp \
1079 bionic/debug_stacktrace.cpp \
1080 bionic/libc_logging.cpp \
1081 bionic/malloc_debug_leak.cpp \
1082 bionic/malloc_debug_check.cpp \
1084 LOCAL_MODULE := libc_malloc_debug_leak
1085 LOCAL_CLANG := $(use_clang)
1086 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1088 LOCAL_SHARED_LIBRARIES := libc libdl
1089 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1090 # Only need this for arm since libc++ uses its own unwind code that
1091 # doesn't mix with the other default unwind code.
1092 LOCAL_STATIC_LIBRARIES_arm := libc++
1093 LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
1095 # Don't install on release build
1096 LOCAL_MODULE_TAGS := eng debug
1098 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1099 include $(BUILD_SHARED_LIBRARY)
1102 # ========================================================
1103 # libc_malloc_debug_qemu.so
1104 # ========================================================
1105 include $(CLEAR_VARS)
1107 LOCAL_CFLAGS := \
1108 $(libc_common_cflags) \
1109 -DMALLOC_QEMU_INSTRUMENT \
1111 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
1112 LOCAL_CPPFLAGS := $(libc_common_cppflags)
1114 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1116 LOCAL_SRC_FILES := \
1117 bionic/libc_logging.cpp \
1118 bionic/malloc_debug_qemu.cpp \
1120 LOCAL_MODULE := libc_malloc_debug_qemu
1121 LOCAL_CLANG := $(use_clang)
1122 LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
1124 LOCAL_SHARED_LIBRARIES := libc libdl
1125 LOCAL_SYSTEM_SHARED_LIBRARIES :=
1127 # Don't install on release build
1128 LOCAL_MODULE_TAGS := eng debug
1130 $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
1131 include $(BUILD_SHARED_LIBRARY)
1133 endif #!user
1135 # ========================================================
1136 # libstdc++.so
1137 # ========================================================
1138 libstdcxx_common_src_files := \
1139 bionic/__cxa_guard.cpp \
1140 bionic/__cxa_pure_virtual.cpp \
1141 bionic/new.cpp \
1142 bionic/libc_logging.cpp \
1144 include $(CLEAR_VARS)
1145 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1146 LOCAL_CFLAGS := $(libc_common_cflags)
1147 LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1148 LOCAL_MODULE:= libstdc++
1149 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1150 LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1151 include $(BUILD_SHARED_LIBRARY)
1153 # ========================================================
1154 # libstdc++.a
1155 # ========================================================
1156 include $(CLEAR_VARS)
1157 LOCAL_C_INCLUDES := $(libc_common_c_includes)
1158 LOCAL_CFLAGS := $(libc_common_cflags)
1159 LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
1160 LOCAL_MODULE:= libstdc++
1161 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
1162 LOCAL_SYSTEM_SHARED_LIBRARIES := libc
1163 include $(BUILD_STATIC_LIBRARY)
1166 # ========================================================
1167 include $(call all-makefiles-under,$(LOCAL_PATH))