Android.mk revision e0b4844a20ffd022a568abb4203b3f7c759c7ff5
1LOCAL_PATH:= $(call my-dir)
2
3include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/syscalls.mk
4
5# Define the common source files for all the libc instances
6# =========================================================
7libc_common_src_files := \
8	$(syscall_src) \
9	unistd/abort.c \
10	unistd/alarm.c \
11	unistd/brk.c \
12	unistd/creat.c \
13	unistd/daemon.c \
14	unistd/eventfd.c \
15	unistd/exec.c \
16	unistd/fcntl.c \
17	unistd/fnmatch.c \
18	unistd/fstatfs.c \
19	unistd/ftime.c \
20	unistd/ftok.c \
21	unistd/getcwd.c \
22	unistd/getdtablesize.c \
23	unistd/gethostname.c \
24	unistd/getopt_long.c \
25	unistd/getpgrp.c \
26	unistd/getpriority.c \
27	unistd/getpt.c \
28	unistd/initgroups.c \
29	unistd/isatty.c \
30	unistd/issetugid.c \
31	unistd/killpg.c \
32	unistd/lseek64.c \
33	unistd/mmap.c \
34	unistd/nice.c \
35	unistd/open.c \
36	unistd/openat.c \
37	unistd/opendir.c \
38	unistd/pathconf.c \
39	unistd/perror.c \
40	unistd/popen.c \
41	unistd/pread.c \
42	unistd/pselect.c \
43	unistd/ptsname.c \
44	unistd/ptsname_r.c \
45	unistd/pwrite.c \
46	unistd/raise.c \
47	unistd/reboot.c \
48	unistd/recv.c \
49	unistd/sbrk.c \
50	unistd/send.c \
51	unistd/setegid.c \
52	unistd/setuid.c \
53	unistd/seteuid.c \
54	unistd/setreuid.c \
55	unistd/setresuid.c \
56	unistd/setpgrp.c \
57	unistd/sigblock.c \
58	unistd/siginterrupt.c \
59	unistd/siglist.c \
60	unistd/signal.c \
61	unistd/signame.c \
62	unistd/sigsetmask.c \
63	unistd/sigsuspend.c \
64	unistd/sigwait.c \
65	unistd/sleep.c \
66	unistd/statfs.c \
67	unistd/strsignal.c \
68	unistd/syslog.c \
69	unistd/system.c \
70	unistd/tcgetpgrp.c \
71	unistd/tcsetpgrp.c \
72	unistd/time.c \
73	unistd/umount.c \
74	unistd/unlockpt.c \
75	unistd/usleep.c \
76	unistd/wait.c \
77	stdio/asprintf.c \
78	stdio/clrerr.c \
79	stdio/fclose.c \
80	stdio/fdopen.c \
81	stdio/feof.c \
82	stdio/ferror.c \
83	stdio/fflush.c \
84	stdio/fgetc.c \
85	stdio/fgetln.c \
86	stdio/fgetpos.c \
87	stdio/fgets.c \
88	stdio/fileno.c \
89	stdio/findfp.c \
90	stdio/flags.c \
91	stdio/flockfile.c \
92	stdio/fopen.c \
93	stdio/fprintf.c \
94	stdio/fpurge.c \
95	stdio/fputc.c \
96	stdio/fputs.c \
97	stdio/fread.c \
98	stdio/freopen.c \
99	stdio/fscanf.c \
100	stdio/fseek.c \
101	stdio/fsetpos.c \
102	stdio/ftell.c \
103	stdio/funopen.c \
104	stdio/fvwrite.c \
105	stdio/fwalk.c \
106	stdio/fwrite.c \
107	stdio/getc.c \
108	stdio/getchar.c \
109	stdio/gets.c \
110	stdio/makebuf.c \
111	stdio/mktemp.c \
112	stdio/printf.c \
113	stdio/putc.c \
114	stdio/putchar.c \
115	stdio/puts.c \
116	stdio/putw.c \
117	stdio/refill.c \
118	stdio/remove.c \
119	stdio/rewind.c \
120	stdio/rget.c \
121	stdio/scanf.c \
122	stdio/setbuf.c \
123	stdio/setbuffer.c \
124	stdio/setvbuf.c \
125	stdio/snprintf.c\
126	stdio/sprintf.c \
127	stdio/sscanf.c \
128	stdio/stdio.c \
129	stdio/tempnam.c \
130	stdio/tmpfile.c \
131	stdio/tmpnam.c \
132	stdio/ungetc.c \
133	stdio/vasprintf.c \
134	stdio/vfprintf.c \
135	stdio/vfscanf.c \
136	stdio/vprintf.c \
137	stdio/vsnprintf.c \
138	stdio/vsprintf.c \
139	stdio/vscanf.c \
140	stdio/vsscanf.c \
141	stdio/wbuf.c \
142	stdio/wsetup.c \
143	stdlib/_rand48.c \
144	stdlib/assert.c \
145	stdlib/atexit.c \
146	stdlib/atoi.c \
147	stdlib/atol.c \
148	stdlib/atoll.c \
149	stdlib/bsearch.c \
150	stdlib/ctype_.c \
151	stdlib/div.c \
152	stdlib/exit.c \
153	stdlib/getenv.c \
154	stdlib/jrand48.c \
155	stdlib/ldiv.c \
156	stdlib/lldiv.c \
157	stdlib/locale.c \
158	stdlib/lrand48.c \
159	stdlib/mrand48.c \
160	stdlib/nrand48.c \
161	stdlib/putenv.c \
162	stdlib/qsort.c \
163	stdlib/seed48.c \
164	stdlib/setenv.c \
165	stdlib/setjmperr.c \
166	stdlib/srand48.c \
167	stdlib/strntoimax.c \
168	stdlib/strntoumax.c \
169	stdlib/strtod.c \
170	stdlib/strtoimax.c \
171	stdlib/strtol.c \
172	stdlib/strtoll.c \
173	stdlib/strtoul.c \
174	stdlib/strtoull.c \
175	stdlib/strtoumax.c \
176	stdlib/tolower_.c \
177	stdlib/toupper_.c \
178	stdlib/wchar.c \
179	string/index.c \
180	string/memccpy.c \
181	string/memchr.c \
182	string/memmem.c \
183	string/memrchr.c \
184	string/memswap.c \
185	string/strcasecmp.c \
186	string/strcasestr.c \
187	string/strcat.c \
188	string/strchr.c \
189	string/strcoll.c \
190	string/strcspn.c \
191	string/strdup.c \
192	string/strerror.c \
193	string/strerror_r.c \
194	string/strlcat.c \
195	string/strlcpy.c \
196	string/strncat.c \
197	string/strncpy.c \
198	string/strndup.c \
199	string/strnlen.c \
200	string/strpbrk.c \
201	string/strrchr.c \
202	string/strsep.c \
203	string/strspn.c \
204	string/strstr.c \
205	string/strtok.c \
206	string/strtotimeval.c \
207	string/strxfrm.c \
208	wchar/wcpcpy.c \
209	wchar/wcpncpy.c \
210	wchar/wcscasecmp.c \
211	wchar/wcscat.c \
212	wchar/wcschr.c \
213	wchar/wcscmp.c \
214	wchar/wcscoll.c \
215	wchar/wcscpy.c \
216	wchar/wcscspn.c \
217	wchar/wcsdup.c \
218	wchar/wcslcat.c \
219	wchar/wcslcpy.c \
220	wchar/wcslen.c \
221	wchar/wcsncasecmp.c \
222	wchar/wcsncat.c \
223	wchar/wcsncmp.c \
224	wchar/wcsncpy.c \
225	wchar/wcsnlen.c \
226	wchar/wcspbrk.c \
227	wchar/wcsrchr.c \
228	wchar/wcsspn.c \
229	wchar/wcsstr.c \
230	wchar/wcstok.c \
231	wchar/wcswidth.c \
232	wchar/wcsxfrm.c \
233	wchar/wmemchr.c \
234	wchar/wmemcmp.c \
235	wchar/wmemcpy.c \
236	wchar/wmemmove.c \
237	wchar/wmemset.c \
238	inet/bindresvport.c \
239	inet/inet_addr.c \
240	inet/inet_aton.c \
241	inet/inet_ntoa.c \
242	inet/inet_ntop.c \
243	inet/inet_pton.c \
244	inet/ether_aton.c \
245	inet/ether_ntoa.c \
246	tzcode/asctime.c \
247	tzcode/difftime.c \
248	tzcode/localtime.c \
249	tzcode/strftime.c \
250	tzcode/strptime.c \
251	bionic/__set_errno.c \
252	bionic/cpuacct.c \
253	bionic/arc4random.c \
254	bionic/basename.c \
255	bionic/basename_r.c \
256	bionic/clearenv.c \
257	bionic/dirname.c \
258	bionic/dirname_r.c \
259	bionic/drand48.c \
260	bionic/erand48.c \
261	bionic/err.c \
262	bionic/fdprintf.c \
263	bionic/fork.c \
264	bionic/fts.c \
265	bionic/if_nametoindex.c \
266	bionic/if_indextoname.c \
267	bionic/ioctl.c \
268	bionic/ldexp.c \
269	bionic/libc_init_common.c \
270	bionic/logd_write.c \
271	bionic/md5.c \
272	bionic/pututline.c \
273	bionic/realpath.c \
274	bionic/sched_getaffinity.c \
275	bionic/sched_getcpu.c \
276	bionic/sched_cpualloc.c \
277	bionic/sched_cpucount.c \
278	bionic/semaphore.c \
279	bionic/sha1.c \
280	bionic/ssp.c \
281	bionic/stubs.c \
282	bionic/system_properties.c \
283	bionic/time64.c \
284	bionic/thread_atexit.c \
285	bionic/utime.c \
286	bionic/utmp.c \
287	netbsd/gethnamaddr.c \
288	netbsd/isc/ev_timers.c \
289	netbsd/isc/ev_streams.c \
290	netbsd/inet/nsap_addr.c \
291	netbsd/resolv/__dn_comp.c \
292	netbsd/resolv/__res_close.c \
293	netbsd/resolv/__res_send.c \
294	netbsd/resolv/herror.c \
295	netbsd/resolv/res_comp.c \
296	netbsd/resolv/res_data.c \
297	netbsd/resolv/res_debug.c \
298	netbsd/resolv/res_init.c \
299	netbsd/resolv/res_mkquery.c \
300	netbsd/resolv/res_query.c \
301	netbsd/resolv/res_send.c \
302	netbsd/resolv/res_state.c \
303	netbsd/resolv/res_cache.c \
304	netbsd/net/nsdispatch.c \
305	netbsd/net/getaddrinfo.c \
306	netbsd/net/getnameinfo.c \
307	netbsd/net/getservbyname.c \
308	netbsd/net/getservent.c \
309	netbsd/net/base64.c \
310	netbsd/net/getservbyport.c \
311	netbsd/nameser/ns_name.c \
312	netbsd/nameser/ns_parse.c \
313	netbsd/nameser/ns_ttl.c \
314	netbsd/nameser/ns_netint.c \
315	netbsd/nameser/ns_print.c \
316	netbsd/nameser/ns_samedomain.c \
317	regex/regcomp.c \
318	regex/regerror.c \
319	regex/regexec.c \
320	regex/regfree.c \
321
322# The following files are common, but must be compiled
323# with different C flags when building a static C library.
324#
325# The reason for this is the implementation of __get_tls()
326# that will differ between the shared and static versions
327# of the library.
328#
329# See comments in private/bionic_tls.h for more details.
330#
331# NOTE: bionic/pthread.c is added later to this list
332#       because it needs special handling on ARM, see
333#       below.
334#
335libc_static_common_src_files := \
336        unistd/sysconf.c \
337        bionic/__errno.c \
338
339# Architecture specific source files go here
340# =========================================================
341ifeq ($(TARGET_ARCH),arm)
342libc_common_src_files += \
343	bionic/bionic_clone.c \
344	arch-arm/bionic/__get_pc.S \
345	arch-arm/bionic/__get_sp.S \
346	arch-arm/bionic/_exit_with_stack_teardown.S \
347	arch-arm/bionic/_setjmp.S \
348	arch-arm/bionic/atomics_arm.S \
349	arch-arm/bionic/clone.S \
350	arch-arm/bionic/eabi.c \
351	arch-arm/bionic/ffs.S \
352	arch-arm/bionic/kill.S \
353	arch-arm/bionic/libgcc_compat.c \
354	arch-arm/bionic/tkill.S \
355	arch-arm/bionic/memcmp.S \
356	arch-arm/bionic/memcmp16.S \
357	arch-arm/bionic/memcpy.S \
358	arch-arm/bionic/memset.S \
359	arch-arm/bionic/setjmp.S \
360	arch-arm/bionic/sigsetjmp.S \
361	arch-arm/bionic/strlen.c.arm \
362	arch-arm/bionic/strcpy.S \
363	arch-arm/bionic/strcmp.S \
364	arch-arm/bionic/syscall.S \
365	string/memmove.c.arm \
366	string/bcopy.c \
367	string/strncmp.c \
368	unistd/socketcalls.c
369
370# These files need to be arm so that gdbserver
371# can set breakpoints in them without messing
372# up any thumb code.
373libc_common_src_files += \
374	bionic/pthread-atfork.c.arm \
375	bionic/pthread-rwlocks.c.arm \
376	bionic/pthread-timers.c.arm \
377	bionic/ptrace.c.arm
378
379libc_static_common_src_files += \
380        bionic/pthread.c.arm \
381
382# these are used by the static and dynamic versions of the libc
383# respectively
384libc_arch_static_src_files := \
385	arch-arm/bionic/exidx_static.c
386
387libc_arch_dynamic_src_files := \
388	arch-arm/bionic/exidx_dynamic.c
389else # !arm
390
391ifeq ($(TARGET_ARCH),x86)
392libc_common_src_files += \
393	arch-x86/bionic/__get_sp.S \
394	arch-x86/bionic/__get_tls.c \
395	arch-x86/bionic/__set_tls.c \
396	arch-x86/bionic/atomics_x86.S \
397	arch-x86/bionic/clone.S \
398	arch-x86/bionic/_exit_with_stack_teardown.S \
399	arch-x86/bionic/setjmp.S \
400	arch-x86/bionic/_setjmp.S \
401	arch-x86/bionic/sigsetjmp.S \
402	arch-x86/bionic/vfork.S \
403	arch-x86/bionic/syscall.S \
404	arch-x86/string/bcopy_wrapper.S \
405	arch-x86/string/memcpy_wrapper.S \
406	arch-x86/string/memmove_wrapper.S \
407	arch-x86/string/bzero_wrapper.S \
408	arch-x86/string/memcmp_wrapper.S \
409	arch-x86/string/memset_wrapper.S \
410	arch-x86/string/strcmp_wrapper.S \
411	arch-x86/string/strncmp_wrapper.S \
412	arch-x86/string/strlen_wrapper.S \
413	string/strcpy.c \
414	bionic/pthread-atfork.c \
415	bionic/pthread-rwlocks.c \
416	bionic/pthread-timers.c \
417	bionic/ptrace.c
418
419libc_static_common_src_files += \
420        bionic/pthread.c \
421
422# this is needed for static versions of libc
423libc_arch_static_src_files := \
424	arch-x86/bionic/dl_iterate_phdr_static.c
425
426libc_arch_dynamic_src_files :=
427else # !x86
428
429ifeq ($(TARGET_ARCH),sh)
430libc_common_src_files += \
431	arch-sh/bionic/__get_pc.S \
432	arch-sh/bionic/__get_sp.S \
433	arch-sh/bionic/_exit_with_stack_teardown.S \
434	arch-sh/bionic/_setjmp.S \
435	arch-sh/bionic/atomics_sh.c \
436	arch-sh/bionic/atomic_cmpxchg.S \
437	arch-sh/bionic/clone.S \
438	arch-sh/bionic/pipe.S \
439	arch-sh/bionic/memcpy.S \
440	arch-sh/bionic/memset.S \
441	arch-sh/bionic/bzero.S \
442	arch-sh/bionic/setjmp.S \
443	arch-sh/bionic/sigsetjmp.S \
444	arch-sh/bionic/syscall.S \
445	arch-sh/bionic/memmove.S \
446	arch-sh/bionic/__set_tls.c \
447	arch-sh/bionic/__get_tls.c \
448	arch-sh/bionic/ffs.S \
449	string/bcopy.c \
450	string/strcmp.c \
451	string/strncmp.c \
452	string/memcmp.c \
453	string/strlen.c \
454	string/strcpy.c \
455	bionic/pthread-atfork.c \
456	bionic/pthread-rwlocks.c \
457	bionic/pthread-timers.c \
458	bionic/ptrace.c \
459	unistd/socketcalls.c
460
461libc_static_common_src_files += \
462        bionic/pthread.c \
463
464endif # sh
465
466endif # !x86
467endif # !arm
468
469# Define some common cflags
470# ========================================================
471libc_common_cflags := \
472		-DWITH_ERRLIST			\
473		-DANDROID_CHANGES		\
474		-DUSE_LOCKS 			\
475		-DREALLOC_ZERO_BYTES_FREES 	\
476		-D_LIBC=1 			\
477		-DSOFTFLOAT                     \
478		-DFLOATING_POINT		\
479		-DINET6 \
480		-I$(LOCAL_PATH)/private \
481		-DUSE_DL_PREFIX \
482		-DPOSIX_MISTAKE
483
484# these macro definitions are required to implement the
485# 'timezone' and 'daylight' global variables, as well as
486# properly update the 'tm_gmtoff' field in 'struct tm'.
487#
488libc_common_cflags += \
489    -DTM_GMTOFF=tm_gmtoff \
490    -DUSG_COMPAT=1
491
492ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
493  libc_common_cflags += -DDEBUG
494endif
495
496ifeq ($(TARGET_ARCH),arm)
497  libc_common_cflags += -fstrict-aliasing
498  libc_crt_target_cflags := -mthumb-interwork
499  #
500  # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
501  # that it should access the hardware TLS register directly in
502  # private/bionic_tls.h
503  #
504  # The value must match your kernel configuration
505  #
506  ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
507    libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
508  endif
509else # !arm
510  libc_crt_target_cflags :=
511endif # !arm
512
513# Define ANDROID_SMP appropriately.
514ifeq ($(TARGET_CPU_SMP),true)
515    libc_common_cflags += -DANDROID_SMP=1
516else
517    libc_common_cflags += -DANDROID_SMP=0
518endif
519
520# Needed to access private/__dso_handle.S from
521# crtbegin_xxx.S and crtend_xxx.S
522#
523libc_crt_target_cflags += -I$(LOCAL_PATH)/private
524
525# Define some common includes
526# ========================================================
527libc_common_c_includes := \
528		$(LOCAL_PATH)/stdlib  \
529		$(LOCAL_PATH)/string  \
530		$(LOCAL_PATH)/stdio
531
532# Needed to access private/__dso_handle.S from
533# crtbegin_xxx.S and crtend_xxx.S
534#
535libc_crt_target_cflags += -I$(LOCAL_PATH)/private
536
537# Define the libc run-time (crt) support object files that must be built,
538# which are needed to build all other objects (shared/static libs and
539# executables)
540# ==========================================================================
541
542ifneq ($(filter arm x86,$(TARGET_ARCH)),)
543# ARM and x86 need crtbegin_so/crtend_so.
544#
545# For x86, the .init section must point to a function that calls all
546# entries in the .ctors section. (on ARM this is done through the
547# .init_array section instead).
548#
549# For both platforms, the .fini_array section must point to a function
550# that will call __cxa_finalize(&__dso_handle) in order to ensure that
551# static C++ destructors are properly called on dlclose().
552#
553GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o
554$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
555	@mkdir -p $(dir $@)
556	$(TARGET_CC) $(libc_crt_target_cflags) -fPIC -o $@ -c $<
557ALL_GENERATED_SOURCES += $(GEN)
558
559GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o
560$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
561	@mkdir -p $(dir $@)
562	$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
563ALL_GENERATED_SOURCES += $(GEN)
564endif # TARGET_ARCH == x86
565
566
567GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
568$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_static.S
569	@mkdir -p $(dir $@)
570	$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
571ALL_GENERATED_SOURCES += $(GEN)
572
573GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
574$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_dynamic.S
575	@mkdir -p $(dir $@)
576	$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
577ALL_GENERATED_SOURCES += $(GEN)
578
579
580# We rename crtend.o to crtend_android.o to avoid a
581# name clash between gcc and bionic.
582GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
583$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
584	@mkdir -p $(dir $@)
585	$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
586ALL_GENERATED_SOURCES += $(GEN)
587
588
589# To enable malloc leak check for statically linked programs, add
590# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
591WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
592
593# ========================================================
594# libc_common.a
595# ========================================================
596include $(CLEAR_VARS)
597
598LOCAL_SRC_FILES := $(libc_common_src_files)
599LOCAL_CFLAGS := $(libc_common_cflags)
600LOCAL_C_INCLUDES := $(libc_common_c_includes)
601LOCAL_MODULE := libc_common
602LOCAL_SYSTEM_SHARED_LIBRARIES :=
603
604include $(BUILD_STATIC_LIBRARY)
605
606
607# ========================================================
608# libc_nomalloc.a
609# ========================================================
610#
611# This is a version of the static C library that does not
612# include malloc. It's useful in situations when calling
613# the user wants to provide their own malloc implementation,
614# or wants to explicitly disallow the use of the use of malloc,
615# like the dynamic loader.
616
617include $(CLEAR_VARS)
618
619LOCAL_SRC_FILES := \
620	$(libc_arch_static_src_files) \
621	$(libc_static_common_src_files) \
622	bionic/libc_init_static.c
623
624LOCAL_C_INCLUDES := $(libc_common_c_includes)
625LOCAL_CFLAGS := $(libc_common_cflags) \
626                -DLIBC_STATIC
627
628LOCAL_MODULE := libc_nomalloc
629LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
630LOCAL_SYSTEM_SHARED_LIBRARIES :=
631
632include $(BUILD_STATIC_LIBRARY)
633
634
635# ========================================================
636# libc.a
637# ========================================================
638include $(CLEAR_VARS)
639
640LOCAL_SRC_FILES := \
641	$(libc_arch_static_src_files) \
642	$(libc_static_common_src_files) \
643	bionic/dlmalloc.c \
644	bionic/malloc_debug_common.c \
645	bionic/libc_init_static.c
646
647LOCAL_CFLAGS := $(libc_common_cflags) \
648                -DLIBC_STATIC
649LOCAL_C_INCLUDES := $(libc_common_c_includes)
650LOCAL_MODULE := libc
651LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
652LOCAL_SYSTEM_SHARED_LIBRARIES :=
653
654include $(BUILD_STATIC_LIBRARY)
655
656
657# ========================================================
658# libc.so
659# ========================================================
660include $(CLEAR_VARS)
661
662LOCAL_CFLAGS := $(libc_common_cflags)
663LOCAL_C_INCLUDES := $(libc_common_c_includes)
664
665LOCAL_SRC_FILES := \
666	$(libc_arch_dynamic_src_files) \
667	$(libc_static_common_src_files) \
668	bionic/dlmalloc.c \
669	bionic/malloc_debug_common.c \
670	bionic/libc_init_dynamic.c
671
672LOCAL_MODULE:= libc
673
674# WARNING: The only library libc.so should depend on is libdl.so!  If you add other libraries,
675# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries.  This
676# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
677# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
678# should, instead relying on the external symbols from the dependent libraries.  That would
679# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
680# you wanted!
681
682LOCAL_SHARED_LIBRARIES := libdl
683LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
684LOCAL_SYSTEM_SHARED_LIBRARIES :=
685
686include $(BUILD_SHARED_LIBRARY)
687
688
689# For all builds, except for the -user build we will enable memory
690# allocation checking (including memory leaks, buffer overwrites, etc.)
691# Note that all these checks are also controlled by env. settings
692# that can enable, or disable specific checks. Note also that some of
693# the checks are available only in emulator and are implemeted in
694# libc_malloc_qemu_instrumented.so.
695ifneq ($(TARGET_BUILD_VARIANT),user)
696
697# ========================================================
698# libc_malloc_debug_leak.so
699# ========================================================
700include $(CLEAR_VARS)
701
702LOCAL_CFLAGS := \
703	$(libc_common_cflags) \
704	-DMALLOC_LEAK_CHECK
705
706LOCAL_C_INCLUDES := $(libc_common_c_includes)
707
708LOCAL_SRC_FILES := \
709	bionic/malloc_debug_leak.c
710
711LOCAL_MODULE:= libc_malloc_debug_leak
712
713LOCAL_SHARED_LIBRARIES := libc
714LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
715LOCAL_SYSTEM_SHARED_LIBRARIES :=
716LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
717# Don't prelink
718LOCAL_PRELINK_MODULE := false
719# Don't install on release build
720LOCAL_MODULE_TAGS := eng debug
721
722include $(BUILD_SHARED_LIBRARY)
723
724
725# ========================================================
726# libc_malloc_debug_qemu.so
727# ========================================================
728include $(CLEAR_VARS)
729
730LOCAL_CFLAGS := \
731	$(libc_common_cflags) \
732	-DMALLOC_QEMU_INSTRUMENT
733
734LOCAL_C_INCLUDES := $(libc_common_c_includes)
735
736LOCAL_SRC_FILES := \
737	bionic/malloc_debug_qemu.c
738
739LOCAL_MODULE:= libc_malloc_debug_qemu
740
741LOCAL_SHARED_LIBRARIES := libc
742LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
743LOCAL_SYSTEM_SHARED_LIBRARIES :=
744# Don't prelink
745LOCAL_PRELINK_MODULE := false
746# Don't install on release build
747LOCAL_MODULE_TAGS := eng debug
748
749include $(BUILD_SHARED_LIBRARY)
750
751endif	#!user
752
753
754# ========================================================
755include $(call all-makefiles-under,$(LOCAL_PATH))
756