Android.mk revision 3871d57ba581236142c9bf2f8be2d34cce7c5829
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/exec.c \
15	unistd/fcntl.c \
16	unistd/fnmatch.c \
17	unistd/fstatfs.c \
18	unistd/ftime.c \
19	unistd/ftok.c \
20	unistd/getcwd.c \
21	unistd/getdtablesize.c \
22	unistd/gethostname.c \
23	unistd/getopt_long.c \
24	unistd/getpgrp.c \
25	unistd/getpriority.c \
26	unistd/getpt.c \
27	unistd/initgroups.c \
28	unistd/isatty.c \
29	unistd/issetugid.c \
30	unistd/killpg.c \
31	unistd/lseek64.c \
32	unistd/mmap.c \
33	unistd/nice.c \
34	unistd/open.c \
35	unistd/openat.c \
36	unistd/opendir.c \
37	unistd/pathconf.c \
38	unistd/perror.c \
39	unistd/popen.c \
40	unistd/pread.c \
41	unistd/pselect.c \
42	unistd/ptsname.c \
43	unistd/ptsname_r.c \
44	unistd/pwrite.c \
45	unistd/raise.c \
46	unistd/reboot.c \
47	unistd/recv.c \
48	unistd/sbrk.c \
49	unistd/send.c \
50	unistd/setegid.c \
51	unistd/setuid.c \
52	unistd/seteuid.c \
53	unistd/setreuid.c \
54	unistd/setresuid.c \
55	unistd/setpgrp.c \
56	unistd/sigblock.c \
57	unistd/siginterrupt.c \
58	unistd/siglist.c \
59	unistd/signal.c \
60	unistd/signame.c \
61	unistd/sigsetmask.c \
62	unistd/sigsuspend.c \
63	unistd/sigwait.c \
64	unistd/sleep.c \
65	unistd/statfs.c \
66	unistd/strsignal.c \
67	unistd/sysconf.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/strcpy.c \
191	string/strcspn.c \
192	string/strdup.c \
193	string/strerror.c \
194	string/strerror_r.c \
195	string/strlcat.c \
196	string/strlcpy.c \
197	string/strncat.c \
198	string/strncpy.c \
199	string/strndup.c \
200	string/strnlen.c \
201	string/strpbrk.c \
202	string/strrchr.c \
203	string/strsep.c \
204	string/strspn.c \
205	string/strstr.c \
206	string/strtok.c \
207	string/strtotimeval.c \
208	string/strxfrm.c \
209	wchar/wcpcpy.c \
210	wchar/wcpncpy.c \
211	wchar/wcscasecmp.c \
212	wchar/wcscat.c \
213	wchar/wcschr.c \
214	wchar/wcscmp.c \
215	wchar/wcscoll.c \
216	wchar/wcscpy.c \
217	wchar/wcscspn.c \
218	wchar/wcsdup.c \
219	wchar/wcslcat.c \
220	wchar/wcslcpy.c \
221	wchar/wcslen.c \
222	wchar/wcsncasecmp.c \
223	wchar/wcsncat.c \
224	wchar/wcsncmp.c \
225	wchar/wcsncpy.c \
226	wchar/wcsnlen.c \
227	wchar/wcspbrk.c \
228	wchar/wcsrchr.c \
229	wchar/wcsspn.c \
230	wchar/wcsstr.c \
231	wchar/wcstok.c \
232	wchar/wcswidth.c \
233	wchar/wmemchr.c \
234	wchar/wmemcpy.c \
235	wchar/wmemmove.c \
236	wchar/wmemset.c \
237	inet/bindresvport.c \
238	inet/inet_addr.c \
239	inet/inet_aton.c \
240	inet/inet_ntoa.c \
241	inet/inet_ntop.c \
242	inet/inet_pton.c \
243	tzcode/asctime.c \
244	tzcode/difftime.c \
245	tzcode/localtime.c \
246	tzcode/strftime.c \
247	tzcode/strptime.c \
248	bionic/__errno.c \
249	bionic/__set_errno.c \
250	bionic/_rand48.c \
251	bionic/cpuacct.c \
252	bionic/arc4random.c \
253	bionic/basename.c \
254	bionic/basename_r.c \
255	bionic/clearenv.c \
256	bionic/dirname.c \
257	bionic/dirname_r.c \
258	bionic/drand48.c \
259	bionic/erand48.c \
260	bionic/err.c \
261	bionic/fdprintf.c \
262	bionic/fork.c \
263	bionic/fts.c \
264	bionic/if_nametoindex.c \
265	bionic/if_indextoname.c \
266	bionic/ioctl.c \
267	bionic/ldexp.c \
268	bionic/libc_init_common.c \
269	bionic/logd_write.c \
270	bionic/md5.c \
271	bionic/pututline.c \
272	bionic/realpath.c \
273	bionic/semaphore.c \
274	bionic/sha1.c \
275	bionic/ssp.c \
276	bionic/stubs.c \
277	bionic/system_properties.c \
278	bionic/time64.c \
279	bionic/thread_atexit.c \
280	bionic/utime.c \
281	bionic/utmp.c \
282	netbsd/gethnamaddr.c \
283	netbsd/isc/ev_timers.c \
284	netbsd/isc/ev_streams.c \
285	netbsd/inet/nsap_addr.c \
286	netbsd/resolv/__dn_comp.c \
287	netbsd/resolv/__res_close.c \
288	netbsd/resolv/__res_send.c \
289	netbsd/resolv/herror.c \
290	netbsd/resolv/res_comp.c \
291	netbsd/resolv/res_data.c \
292	netbsd/resolv/res_debug.c \
293	netbsd/resolv/res_init.c \
294	netbsd/resolv/res_mkquery.c \
295	netbsd/resolv/res_query.c \
296	netbsd/resolv/res_send.c \
297	netbsd/resolv/res_state.c \
298	netbsd/resolv/res_cache.c \
299	netbsd/net/nsdispatch.c \
300	netbsd/net/getaddrinfo.c \
301	netbsd/net/getnameinfo.c \
302	netbsd/net/getservbyname.c \
303	netbsd/net/getservent.c \
304	netbsd/net/base64.c \
305	netbsd/net/getservbyport.c \
306	netbsd/nameser/ns_name.c \
307	netbsd/nameser/ns_parse.c \
308	netbsd/nameser/ns_ttl.c \
309	netbsd/nameser/ns_netint.c \
310	netbsd/nameser/ns_print.c \
311	netbsd/nameser/ns_samedomain.c \
312	regex/regcomp.c \
313	regex/regerror.c \
314	regex/regexec.c \
315	regex/regfree.c \
316
317# Architecture specific source files go here
318# =========================================================
319ifeq ($(TARGET_ARCH),arm)
320libc_common_src_files += \
321	bionic/bionic_clone.c \
322	arch-arm/bionic/__get_pc.S \
323	arch-arm/bionic/__get_sp.S \
324	arch-arm/bionic/_exit_with_stack_teardown.S \
325	arch-arm/bionic/_setjmp.S \
326	arch-arm/bionic/atomics_arm.S \
327	arch-arm/bionic/clone.S \
328	arch-arm/bionic/eabi.c \
329	arch-arm/bionic/ffs.S \
330	arch-arm/bionic/kill.S \
331	arch-arm/bionic/libgcc_compat.c \
332	arch-arm/bionic/tkill.S \
333	arch-arm/bionic/memcmp.S \
334	arch-arm/bionic/memcmp16.S \
335	arch-arm/bionic/memcpy.S \
336	arch-arm/bionic/memset.S \
337	arch-arm/bionic/setjmp.S \
338	arch-arm/bionic/sigsetjmp.S \
339	arch-arm/bionic/strlen.c.arm \
340	arch-arm/bionic/syscall.S \
341	string/memmove.c.arm \
342	string/bcopy.c \
343	string/strcmp.c \
344	string/strncmp.c \
345	unistd/socketcalls.c
346
347# These files need to be arm so that gdbserver
348# can set breakpoints in them without messing
349# up any thumb code.
350libc_common_src_files += \
351	bionic/pthread.c.arm \
352	bionic/pthread-atfork.c.arm \
353	bionic/pthread-rwlocks.c.arm \
354	bionic/pthread-timers.c.arm \
355	bionic/ptrace.c.arm
356
357# these are used by the static and dynamic versions of the libc
358# respectively
359libc_arch_static_src_files := \
360	arch-arm/bionic/exidx_static.c
361
362libc_arch_dynamic_src_files := \
363	arch-arm/bionic/exidx_dynamic.c
364else # !arm
365
366ifeq ($(TARGET_ARCH),x86)
367libc_common_src_files += \
368	arch-x86/bionic/__get_sp.S \
369	arch-x86/bionic/__get_tls.c \
370	arch-x86/bionic/__set_tls.c \
371	arch-x86/bionic/atomics_x86.S \
372	arch-x86/bionic/clone.S \
373	arch-x86/bionic/_exit_with_stack_teardown.S \
374	arch-x86/bionic/setjmp.S \
375	arch-x86/bionic/_setjmp.S \
376	arch-x86/bionic/vfork.S \
377	arch-x86/bionic/syscall.S \
378	arch-x86/string/bcopy_wrapper.S \
379	arch-x86/string/memcpy_wrapper.S \
380	arch-x86/string/memmove_wrapper.S \
381	arch-x86/string/bzero_wrapper.S \
382	arch-x86/string/memcmp_wrapper.S \
383	arch-x86/string/memset_wrapper.S \
384	arch-x86/string/strcmp_wrapper.S \
385	arch-x86/string/strncmp_wrapper.S \
386	arch-x86/string/strlen.S \
387	bionic/pthread.c \
388	bionic/pthread-atfork.c \
389	bionic/pthread-rwlocks.c \
390	bionic/pthread-timers.c \
391	bionic/ptrace.c
392
393# this is needed for static versions of libc
394libc_arch_static_src_files := \
395	arch-x86/bionic/dl_iterate_phdr_static.c
396
397libc_arch_dynamic_src_files :=
398else # !x86
399
400ifeq ($(TARGET_ARCH),sh)
401libc_common_src_files += \
402	arch-sh/bionic/__get_pc.S \
403	arch-sh/bionic/__get_sp.S \
404	arch-sh/bionic/_exit_with_stack_teardown.S \
405	arch-sh/bionic/_setjmp.S \
406	arch-sh/bionic/atomics_sh.c \
407	arch-sh/bionic/atomic_cmpxchg.S \
408	arch-sh/bionic/clone.S \
409	arch-sh/bionic/pipe.S \
410	arch-sh/bionic/memcpy.S \
411	arch-sh/bionic/memset.S \
412	arch-sh/bionic/bzero.S \
413	arch-sh/bionic/setjmp.S \
414	arch-sh/bionic/sigsetjmp.S \
415	arch-sh/bionic/syscall.S \
416	arch-sh/bionic/memmove.S \
417	arch-sh/bionic/__set_tls.c \
418	arch-sh/bionic/__get_tls.c \
419	arch-sh/bionic/ffs.S \
420	string/bcopy.c \
421	string/strcmp.c \
422	string/strncmp.c \
423	string/memcmp.c \
424	string/strlen.c \
425	bionic/pthread.c \
426	bionic/pthread-atfork.c \
427	bionic/pthread-rwlocks.c \
428	bionic/pthread-timers.c \
429	bionic/ptrace.c \
430	unistd/socketcalls.c
431endif # sh
432
433endif # !x86
434endif # !arm
435
436# Define some common cflags
437# ========================================================
438libc_common_cflags := \
439		-DWITH_ERRLIST			\
440		-DANDROID_CHANGES		\
441		-DUSE_LOCKS 			\
442		-DREALLOC_ZERO_BYTES_FREES 	\
443		-D_LIBC=1 			\
444		-DSOFTFLOAT                     \
445		-DFLOATING_POINT		\
446		-DINET6 \
447		-I$(LOCAL_PATH)/private \
448		-DUSE_DL_PREFIX \
449		-DPOSIX_MISTAKE
450
451# these macro definitions are required to implement the
452# 'timezone' and 'daylight' global variables, as well as
453# properly update the 'tm_gmtoff' field in 'struct tm'.
454#
455libc_common_cflags += \
456    -DTM_GMTOFF=tm_gmtoff \
457    -DUSG_COMPAT=1
458
459ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
460  libc_common_cflags += -DDEBUG
461endif
462
463ifeq ($(TARGET_ARCH),arm)
464  libc_common_cflags += -fstrict-aliasing
465  libc_crt_target_cflags := -mthumb-interwork
466  #
467  # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
468  # that it should access the hardware TLS register directly in
469  # private/bionic_tls.h
470  #
471  # The value must match your kernel configuration
472  #
473  ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
474    libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
475  endif
476else # !arm
477  ifeq ($(TARGET_ARCH),x86)
478    libc_crt_target_cflags := -m32
479
480    # Enable recent IA friendly memory routines (such as for Atom)
481    # These will not work on the earlier x86 machines
482    libc_common_cflags += -mtune=i686 -DUSE_SSSE3 -DUSE_SSE2
483  endif # x86
484endif # !arm
485
486# Define ANDROID_SMP appropriately.
487ifeq ($(TARGET_CPU_SMP),true)
488    libc_common_cflags += -DANDROID_SMP=1
489else
490    libc_common_cflags += -DANDROID_SMP=0
491endif
492
493# Needed to access private/__dso_handle.S from
494# crtbegin_xxx.S and crtend_xxx.S
495#
496libc_crt_target_cflags += -I$(LOCAL_PATH)/private
497
498# Define some common includes
499# ========================================================
500libc_common_c_includes := \
501		$(LOCAL_PATH)/stdlib  \
502		$(LOCAL_PATH)/string  \
503		$(LOCAL_PATH)/stdio
504
505# Needed to access private/__dso_handle.S from
506# crtbegin_xxx.S and crtend_xxx.S
507#
508libc_crt_target_cflags += -I$(LOCAL_PATH)/private
509
510# Define the libc run-time (crt) support object files that must be built,
511# which are needed to build all other objects (shared/static libs and
512# executables)
513# ==========================================================================
514
515ifneq ($(filter arm x86,$(TARGET_ARCH)),)
516# ARM and x86 need crtbegin_so/crtend_so.
517#
518# For x86, the .init section must point to a function that calls all
519# entries in the .ctors section. (on ARM this is done through the
520# .init_array section instead).
521#
522# For both platforms, the .fini_array section must point to a function
523# that will call __cxa_finalize(&__dso_handle) in order to ensure that
524# static C++ destructors are properly called on dlclose().
525#
526GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o
527$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
528	@mkdir -p $(dir $@)
529	$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
530ALL_GENERATED_SOURCES += $(GEN)
531
532GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o
533$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
534	@mkdir -p $(dir $@)
535	$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
536ALL_GENERATED_SOURCES += $(GEN)
537endif # TARGET_ARCH == x86
538
539
540GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
541$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_static.S
542	@mkdir -p $(dir $@)
543	$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
544ALL_GENERATED_SOURCES += $(GEN)
545
546GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
547$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_dynamic.S
548	@mkdir -p $(dir $@)
549	$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
550ALL_GENERATED_SOURCES += $(GEN)
551
552
553# We rename crtend.o to crtend_android.o to avoid a
554# name clash between gcc and bionic.
555GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
556$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
557	@mkdir -p $(dir $@)
558	$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
559ALL_GENERATED_SOURCES += $(GEN)
560
561
562# To enable malloc leak check for statically linked programs, add
563# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
564WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
565
566# ========================================================
567# libc_common.a
568# ========================================================
569include $(CLEAR_VARS)
570
571LOCAL_SRC_FILES := $(libc_common_src_files)
572LOCAL_CFLAGS := $(libc_common_cflags)
573LOCAL_C_INCLUDES := $(libc_common_c_includes)
574LOCAL_MODULE := libc_common
575LOCAL_SYSTEM_SHARED_LIBRARIES :=
576
577include $(BUILD_STATIC_LIBRARY)
578
579
580# ========================================================
581# libc_nomalloc.a
582# ========================================================
583#
584# This is a version of the static C library that does not
585# include malloc. It's useful in situations when calling
586# the user wants to provide their own malloc implementation,
587# or wants to explicitly disallow the use of the use of malloc,
588# like the dynamic loader.
589
590include $(CLEAR_VARS)
591
592LOCAL_SRC_FILES := \
593	$(libc_arch_static_src_files) \
594	bionic/libc_init_static.c
595
596LOCAL_C_INCLUDES := $(libc_common_c_includes)
597LOCAL_CFLAGS := $(libc_common_cflags)
598
599LOCAL_MODULE := libc_nomalloc
600LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
601LOCAL_SYSTEM_SHARED_LIBRARIES :=
602
603include $(BUILD_STATIC_LIBRARY)
604
605
606# ========================================================
607# libc.a
608# ========================================================
609include $(CLEAR_VARS)
610
611LOCAL_SRC_FILES := \
612	$(libc_arch_static_src_files) \
613	bionic/dlmalloc.c \
614	bionic/malloc_debug_common.c \
615	bionic/libc_init_static.c
616
617LOCAL_CFLAGS := $(libc_common_cflags) \
618                -DLIBC_STATIC
619LOCAL_C_INCLUDES := $(libc_common_c_includes)
620LOCAL_MODULE := libc
621LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
622LOCAL_SYSTEM_SHARED_LIBRARIES :=
623
624include $(BUILD_STATIC_LIBRARY)
625
626
627# ========================================================
628# libc.so
629# ========================================================
630include $(CLEAR_VARS)
631
632LOCAL_CFLAGS := $(libc_common_cflags)
633LOCAL_C_INCLUDES := $(libc_common_c_includes)
634
635LOCAL_SRC_FILES := \
636	$(libc_arch_dynamic_src_files) \
637	bionic/dlmalloc.c \
638	bionic/malloc_debug_common.c \
639	bionic/libc_init_dynamic.c
640
641LOCAL_MODULE:= libc
642
643# WARNING: The only library libc.so should depend on is libdl.so!  If you add other libraries,
644# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries.  This
645# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
646# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
647# should, instead relying on the external symbols from the dependent libraries.  That would
648# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
649# you wanted!
650
651LOCAL_SHARED_LIBRARIES := libdl
652LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
653LOCAL_SYSTEM_SHARED_LIBRARIES :=
654
655include $(BUILD_SHARED_LIBRARY)
656
657
658# For all builds, except for the -user build we will enable memory
659# allocation checking (including memory leaks, buffer overwrites, etc.)
660# Note that all these checks are also controlled by env. settings
661# that can enable, or disable specific checks. Note also that some of
662# the checks are available only in emulator and are implemeted in
663# libc_malloc_qemu_instrumented.so.
664ifneq ($(TARGET_BUILD_VARIANT),user)
665
666# ========================================================
667# libc_malloc_debug_leak.so
668# ========================================================
669include $(CLEAR_VARS)
670
671LOCAL_CFLAGS := \
672	$(libc_common_cflags) \
673	-DMALLOC_LEAK_CHECK
674
675LOCAL_C_INCLUDES := $(libc_common_c_includes)
676
677LOCAL_SRC_FILES := \
678	bionic/malloc_debug_leak.c
679
680LOCAL_MODULE:= libc_malloc_debug_leak
681
682LOCAL_SHARED_LIBRARIES := libc
683LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
684LOCAL_SYSTEM_SHARED_LIBRARIES :=
685LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
686# Don't prelink
687LOCAL_PRELINK_MODULE := false
688# Don't install on release build
689LOCAL_MODULE_TAGS := eng debug
690
691include $(BUILD_SHARED_LIBRARY)
692
693
694# ========================================================
695# libc_malloc_debug_qemu.so
696# ========================================================
697include $(CLEAR_VARS)
698
699LOCAL_CFLAGS := \
700	$(libc_common_cflags) \
701	-DMALLOC_QEMU_INSTRUMENT
702
703LOCAL_C_INCLUDES := $(libc_common_c_includes)
704
705LOCAL_SRC_FILES := \
706	bionic/malloc_debug_qemu.c
707
708LOCAL_MODULE:= libc_malloc_debug_qemu
709
710LOCAL_SHARED_LIBRARIES := libc
711LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
712LOCAL_SYSTEM_SHARED_LIBRARIES :=
713# Don't prelink
714LOCAL_PRELINK_MODULE := false
715# Don't install on release build
716LOCAL_MODULE_TAGS := eng debug
717
718include $(BUILD_SHARED_LIBRARY)
719
720endif	#!user
721
722
723# ========================================================
724include $(call all-makefiles-under,$(LOCAL_PATH))
725