blob: 141ee0ab1fa656810b397d5cb5bfc64c5beb9d10 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001LOCAL_PATH:= $(call my-dir)
2
3include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/syscalls.mk
Dima Zavinca122b02009-05-27 10:52:37 -07004
5# Define the common source files for all the libc instances
6# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08007libc_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 \
David 'Digit' Turnerab8b5412010-07-08 16:52:27 -070017 unistd/fstatfs.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080018 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 \
Colin Cross8c59d962010-01-13 16:39:26 -080030 unistd/killpg.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080031 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 \
Mike Chan9f691562010-03-02 10:55:58 -080051 unistd/setuid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080052 unistd/seteuid.c \
Mike Chan9f691562010-03-02 10:55:58 -080053 unistd/setreuid.c \
54 unistd/setresuid.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080055 unistd/setpgrp.c \
56 unistd/sigblock.c \
57 unistd/siginterrupt.c \
58 unistd/siglist.c \
59 unistd/signal.c \
Thorsten Glaser92b10af2009-10-02 15:39:00 +020060 unistd/signame.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080061 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 \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800179 string/index.c \
180 string/memccpy.c \
181 string/memchr.c \
182 string/memmem.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800183 string/memrchr.c \
184 string/memswap.c \
185 string/strcasecmp.c \
186 string/strcasestr.c \
187 string/strcat.c \
188 string/strchr.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800189 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 \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800198 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 \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700209 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 \
Kristian Monsen70465612010-06-16 14:51:52 +0100233 wchar/wcsxfrm.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700234 wchar/wmemchr.c \
Kristian Monsen70465612010-06-16 14:51:52 +0100235 wchar/wmemcmp.c \
David 'Digit' Turner3527fd62010-06-14 17:18:35 -0700236 wchar/wmemcpy.c \
237 wchar/wmemmove.c \
238 wchar/wmemset.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800239 inet/bindresvport.c \
240 inet/inet_addr.c \
241 inet/inet_aton.c \
242 inet/inet_ntoa.c \
243 inet/inet_ntop.c \
244 inet/inet_pton.c \
Szymon Jakubczak4032c1e2010-06-09 15:53:28 -0400245 inet/ether_aton.c \
246 inet/ether_ntoa.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800247 tzcode/asctime.c \
248 tzcode/difftime.c \
249 tzcode/localtime.c \
250 tzcode/strftime.c \
251 tzcode/strptime.c \
252 bionic/__errno.c \
253 bionic/__set_errno.c \
254 bionic/_rand48.c \
Mike Chan9f691562010-03-02 10:55:58 -0800255 bionic/cpuacct.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800256 bionic/arc4random.c \
257 bionic/basename.c \
258 bionic/basename_r.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800259 bionic/clearenv.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800260 bionic/dirname.c \
261 bionic/dirname_r.c \
262 bionic/drand48.c \
263 bionic/erand48.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800264 bionic/err.c \
Colin Crossfc10b242010-01-13 17:48:34 -0800265 bionic/fdprintf.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800266 bionic/fork.c \
Colin Cross64ceac32010-01-13 21:19:52 -0800267 bionic/fts.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800268 bionic/if_nametoindex.c \
269 bionic/if_indextoname.c \
270 bionic/ioctl.c \
271 bionic/ldexp.c \
272 bionic/libc_init_common.c \
273 bionic/logd_write.c \
274 bionic/md5.c \
275 bionic/pututline.c \
276 bionic/realpath.c \
277 bionic/semaphore.c \
278 bionic/sha1.c \
279 bionic/ssp.c \
280 bionic/stubs.c \
281 bionic/system_properties.c \
282 bionic/time64.c \
283 bionic/thread_atexit.c \
284 bionic/utime.c \
285 bionic/utmp.c \
286 netbsd/gethnamaddr.c \
287 netbsd/isc/ev_timers.c \
288 netbsd/isc/ev_streams.c \
289 netbsd/inet/nsap_addr.c \
290 netbsd/resolv/__dn_comp.c \
291 netbsd/resolv/__res_close.c \
292 netbsd/resolv/__res_send.c \
293 netbsd/resolv/herror.c \
294 netbsd/resolv/res_comp.c \
295 netbsd/resolv/res_data.c \
296 netbsd/resolv/res_debug.c \
297 netbsd/resolv/res_init.c \
298 netbsd/resolv/res_mkquery.c \
299 netbsd/resolv/res_query.c \
300 netbsd/resolv/res_send.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900301 netbsd/resolv/res_state.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800302 netbsd/resolv/res_cache.c \
303 netbsd/net/nsdispatch.c \
304 netbsd/net/getaddrinfo.c \
305 netbsd/net/getnameinfo.c \
306 netbsd/net/getservbyname.c \
307 netbsd/net/getservent.c \
308 netbsd/net/base64.c \
309 netbsd/net/getservbyport.c \
310 netbsd/nameser/ns_name.c \
311 netbsd/nameser/ns_parse.c \
312 netbsd/nameser/ns_ttl.c \
313 netbsd/nameser/ns_netint.c \
314 netbsd/nameser/ns_print.c \
Colin Cross4fa7b102010-01-12 18:59:25 -0800315 netbsd/nameser/ns_samedomain.c \
316 regex/regcomp.c \
317 regex/regerror.c \
318 regex/regexec.c \
319 regex/regfree.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800320
Dima Zavinca122b02009-05-27 10:52:37 -0700321# Architecture specific source files go here
322# =========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800323ifeq ($(TARGET_ARCH),arm)
324libc_common_src_files += \
David 'Digit' Turner97cf7f32010-01-22 18:59:05 -0800325 bionic/bionic_clone.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800326 arch-arm/bionic/__get_pc.S \
327 arch-arm/bionic/__get_sp.S \
328 arch-arm/bionic/_exit_with_stack_teardown.S \
329 arch-arm/bionic/_setjmp.S \
330 arch-arm/bionic/atomics_arm.S \
331 arch-arm/bionic/clone.S \
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700332 arch-arm/bionic/eabi.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800333 arch-arm/bionic/ffs.S \
334 arch-arm/bionic/kill.S \
David 'Digit' Turner2a7ad972009-09-29 14:43:38 -0700335 arch-arm/bionic/libgcc_compat.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800336 arch-arm/bionic/tkill.S \
337 arch-arm/bionic/memcmp.S \
338 arch-arm/bionic/memcmp16.S \
339 arch-arm/bionic/memcpy.S \
340 arch-arm/bionic/memset.S \
341 arch-arm/bionic/setjmp.S \
342 arch-arm/bionic/sigsetjmp.S \
343 arch-arm/bionic/strlen.c.arm \
344 arch-arm/bionic/syscall.S \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900345 string/memmove.c.arm \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800346 string/bcopy.c \
347 string/strcmp.c \
348 string/strncmp.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800349 unistd/socketcalls.c
350
351# These files need to be arm so that gdbserver
352# can set breakpoints in them without messing
353# up any thumb code.
354libc_common_src_files += \
355 bionic/pthread.c.arm \
Matt Fischer4f086ae2010-06-25 14:36:39 -0500356 bionic/pthread-atfork.c.arm \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700357 bionic/pthread-rwlocks.c.arm \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800358 bionic/pthread-timers.c.arm \
359 bionic/ptrace.c.arm
Dima Zavinca122b02009-05-27 10:52:37 -0700360
361# these are used by the static and dynamic versions of the libc
362# respectively
363libc_arch_static_src_files := \
364 arch-arm/bionic/exidx_static.c
365
366libc_arch_dynamic_src_files := \
367 arch-arm/bionic/exidx_dynamic.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800368else # !arm
369
370ifeq ($(TARGET_ARCH),x86)
371libc_common_src_files += \
372 arch-x86/bionic/__get_sp.S \
373 arch-x86/bionic/__get_tls.c \
374 arch-x86/bionic/__set_tls.c \
375 arch-x86/bionic/atomics_x86.S \
376 arch-x86/bionic/clone.S \
377 arch-x86/bionic/_exit_with_stack_teardown.S \
378 arch-x86/bionic/setjmp.S \
379 arch-x86/bionic/_setjmp.S \
380 arch-x86/bionic/vfork.S \
Bruce Beare3c543e12010-03-04 10:29:38 -0800381 arch-x86/bionic/syscall.S \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800382 arch-x86/string/bcopy_wrapper.S \
383 arch-x86/string/memcpy_wrapper.S \
384 arch-x86/string/memmove_wrapper.S \
385 arch-x86/string/bzero_wrapper.S \
386 arch-x86/string/memcmp_wrapper.S \
387 arch-x86/string/memset_wrapper.S \
388 arch-x86/string/strcmp_wrapper.S \
389 arch-x86/string/strncmp_wrapper.S \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800390 arch-x86/string/strlen.S \
391 bionic/pthread.c \
Matt Fischer4f086ae2010-06-25 14:36:39 -0500392 bionic/pthread-atfork.c \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700393 bionic/pthread-rwlocks.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800394 bionic/pthread-timers.c \
395 bionic/ptrace.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800396
Dima Zavinca122b02009-05-27 10:52:37 -0700397# this is needed for static versions of libc
398libc_arch_static_src_files := \
399 arch-x86/bionic/dl_iterate_phdr_static.c
400
401libc_arch_dynamic_src_files :=
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900402else # !x86
403
404ifeq ($(TARGET_ARCH),sh)
405libc_common_src_files += \
406 arch-sh/bionic/__get_pc.S \
407 arch-sh/bionic/__get_sp.S \
408 arch-sh/bionic/_exit_with_stack_teardown.S \
409 arch-sh/bionic/_setjmp.S \
410 arch-sh/bionic/atomics_sh.c \
411 arch-sh/bionic/atomic_cmpxchg.S \
412 arch-sh/bionic/clone.S \
413 arch-sh/bionic/pipe.S \
414 arch-sh/bionic/memcpy.S \
415 arch-sh/bionic/memset.S \
416 arch-sh/bionic/bzero.S \
417 arch-sh/bionic/setjmp.S \
418 arch-sh/bionic/sigsetjmp.S \
419 arch-sh/bionic/syscall.S \
420 arch-sh/bionic/memmove.S \
421 arch-sh/bionic/__set_tls.c \
422 arch-sh/bionic/__get_tls.c \
423 arch-sh/bionic/ffs.S \
Bruce Beare8ff1a272010-03-04 11:03:37 -0800424 string/bcopy.c \
425 string/strcmp.c \
426 string/strncmp.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900427 string/memcmp.c \
428 string/strlen.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900429 bionic/pthread.c \
Matt Fischer4f086ae2010-06-25 14:36:39 -0500430 bionic/pthread-atfork.c \
David 'Digit' Turner8a1d2cf2010-05-11 16:39:22 -0700431 bionic/pthread-rwlocks.c \
Shin-ichiro KAWASAKI10093272009-09-28 16:11:39 +0900432 bionic/pthread-timers.c \
433 bionic/ptrace.c \
434 unistd/socketcalls.c
435endif # sh
436
437endif # !x86
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800438endif # !arm
439
Dima Zavinca122b02009-05-27 10:52:37 -0700440# Define some common cflags
441# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800442libc_common_cflags := \
443 -DWITH_ERRLIST \
444 -DANDROID_CHANGES \
445 -DUSE_LOCKS \
446 -DREALLOC_ZERO_BYTES_FREES \
447 -D_LIBC=1 \
448 -DSOFTFLOAT \
449 -DFLOATING_POINT \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800450 -DINET6 \
451 -I$(LOCAL_PATH)/private \
Colin Cross4fa7b102010-01-12 18:59:25 -0800452 -DUSE_DL_PREFIX \
453 -DPOSIX_MISTAKE
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800454
David 'Digit' Turnerd7ed1ae2010-03-05 14:17:35 -0800455# these macro definitions are required to implement the
456# 'timezone' and 'daylight' global variables, as well as
457# properly update the 'tm_gmtoff' field in 'struct tm'.
458#
459libc_common_cflags += \
460 -DTM_GMTOFF=tm_gmtoff \
461 -DUSG_COMPAT=1
462
Dave Bortd2c9dcc2009-04-23 15:50:03 -0700463ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800464 libc_common_cflags += -DDEBUG
465endif
466
467ifeq ($(TARGET_ARCH),arm)
468 libc_common_cflags += -fstrict-aliasing
Dima Zavinca122b02009-05-27 10:52:37 -0700469 libc_crt_target_cflags := -mthumb-interwork
David 'Digit' Turner4a05d122009-09-18 13:35:05 -0700470 #
471 # Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
472 # that it should access the hardware TLS register directly in
473 # private/bionic_tls.h
474 #
475 # The value must match your kernel configuration
476 #
477 ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
478 libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
479 endif
Dima Zavinca122b02009-05-27 10:52:37 -0700480else # !arm
481 ifeq ($(TARGET_ARCH),x86)
482 libc_crt_target_cflags := -m32
Bruce Beare8ff1a272010-03-04 11:03:37 -0800483
484 # Enable recent IA friendly memory routines (such as for Atom)
485 # These will not work on the earlier x86 machines
486 libc_common_cflags += -mtune=i686 -DUSE_SSSE3 -DUSE_SSE2
Dima Zavinca122b02009-05-27 10:52:37 -0700487 endif # x86
488endif # !arm
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800489
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700490# Define ANDROID_SMP appropriately.
491ifeq ($(TARGET_CPU_SMP),true)
492 libc_common_cflags += -DANDROID_SMP=1
493else
494 libc_common_cflags += -DANDROID_SMP=0
495endif
496
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700497# Needed to access private/__dso_handle.S from
498# crtbegin_xxx.S and crtend_xxx.S
499#
500libc_crt_target_cflags += -I$(LOCAL_PATH)/private
Andy McFaddenfcd00eb2010-05-28 13:31:45 -0700501
Dima Zavinca122b02009-05-27 10:52:37 -0700502# Define some common includes
503# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800504libc_common_c_includes := \
505 $(LOCAL_PATH)/stdlib \
506 $(LOCAL_PATH)/string \
507 $(LOCAL_PATH)/stdio
508
David 'Digit' Turner3b43f872010-07-01 23:09:28 -0700509# Needed to access private/__dso_handle.S from
510# crtbegin_xxx.S and crtend_xxx.S
511#
512libc_crt_target_cflags += -I$(LOCAL_PATH)/private
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800513
Dima Zavinca122b02009-05-27 10:52:37 -0700514# Define the libc run-time (crt) support object files that must be built,
515# which are needed to build all other objects (shared/static libs and
516# executables)
517# ==========================================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800518
David 'Digit' Turner6a9b8882010-06-18 14:47:22 -0700519ifneq ($(filter arm x86,$(TARGET_ARCH)),)
520# ARM and x86 need crtbegin_so/crtend_so.
521#
522# For x86, the .init section must point to a function that calls all
523# entries in the .ctors section. (on ARM this is done through the
524# .init_array section instead).
525#
526# For both platforms, the .fini_array section must point to a function
527# that will call __cxa_finalize(&__dso_handle) in order to ensure that
528# static C++ destructors are properly called on dlclose().
529#
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800530GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o
531$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
532 @mkdir -p $(dir $@)
Dima Zavinca122b02009-05-27 10:52:37 -0700533 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800534ALL_GENERATED_SOURCES += $(GEN)
535
536GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o
537$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
538 @mkdir -p $(dir $@)
Dima Zavinca122b02009-05-27 10:52:37 -0700539 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800540ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800541endif # TARGET_ARCH == x86
542
Dima Zavinca122b02009-05-27 10:52:37 -0700543
544GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
545$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_static.S
546 @mkdir -p $(dir $@)
547 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
548ALL_GENERATED_SOURCES += $(GEN)
549
550GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
551$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_dynamic.S
552 @mkdir -p $(dir $@)
553 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
554ALL_GENERATED_SOURCES += $(GEN)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800555
556
Dima Zavinca122b02009-05-27 10:52:37 -0700557# We rename crtend.o to crtend_android.o to avoid a
558# name clash between gcc and bionic.
559GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
560$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
561 @mkdir -p $(dir $@)
562 $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
563ALL_GENERATED_SOURCES += $(GEN)
564
565
566# To enable malloc leak check for statically linked programs, add
567# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
568WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
569
570# ========================================================
571# libc_common.a
572# ========================================================
573include $(CLEAR_VARS)
574
575LOCAL_SRC_FILES := $(libc_common_src_files)
576LOCAL_CFLAGS := $(libc_common_cflags)
577LOCAL_C_INCLUDES := $(libc_common_c_includes)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800578LOCAL_MODULE := libc_common
579LOCAL_SYSTEM_SHARED_LIBRARIES :=
580
581include $(BUILD_STATIC_LIBRARY)
582
583
Dima Zavinca122b02009-05-27 10:52:37 -0700584# ========================================================
Dima Zavin49e55332009-05-27 10:52:37 -0700585# libc_nomalloc.a
586# ========================================================
587#
588# This is a version of the static C library that does not
589# include malloc. It's useful in situations when calling
590# the user wants to provide their own malloc implementation,
591# or wants to explicitly disallow the use of the use of malloc,
592# like the dynamic loader.
593
594include $(CLEAR_VARS)
595
596LOCAL_SRC_FILES := \
597 $(libc_arch_static_src_files) \
598 bionic/libc_init_static.c
599
600LOCAL_C_INCLUDES := $(libc_common_c_includes)
601LOCAL_CFLAGS := $(libc_common_cflags)
602
603LOCAL_MODULE := libc_nomalloc
604LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
605LOCAL_SYSTEM_SHARED_LIBRARIES :=
606
607include $(BUILD_STATIC_LIBRARY)
608
609
610# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800611# libc.a
612# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800613include $(CLEAR_VARS)
614
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800615LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700616 $(libc_arch_static_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800617 bionic/dlmalloc.c \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800618 bionic/malloc_debug_common.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800619 bionic/libc_init_static.c
620
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800621LOCAL_CFLAGS := $(libc_common_cflags) \
622 -DLIBC_STATIC
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800623LOCAL_C_INCLUDES := $(libc_common_c_includes)
Dima Zavinca122b02009-05-27 10:52:37 -0700624LOCAL_MODULE := libc
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800625LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800626LOCAL_SYSTEM_SHARED_LIBRARIES :=
627
628include $(BUILD_STATIC_LIBRARY)
629
630
Dima Zavinca122b02009-05-27 10:52:37 -0700631# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800632# libc.so
633# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800634include $(CLEAR_VARS)
635
636LOCAL_CFLAGS := $(libc_common_cflags)
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800637LOCAL_C_INCLUDES := $(libc_common_c_includes)
638
639LOCAL_SRC_FILES := \
Dima Zavinca122b02009-05-27 10:52:37 -0700640 $(libc_arch_dynamic_src_files) \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800641 bionic/dlmalloc.c \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800642 bionic/malloc_debug_common.c \
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800643 bionic/libc_init_dynamic.c
644
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800645LOCAL_MODULE:= libc
646
647# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
648# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
649# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
650# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
651# should, instead relying on the external symbols from the dependent libraries. That would
652# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
653# you wanted!
654
655LOCAL_SHARED_LIBRARIES := libdl
656LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
657LOCAL_SYSTEM_SHARED_LIBRARIES :=
658
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800659include $(BUILD_SHARED_LIBRARY)
660
661
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800662# For all builds, except for the -user build we will enable memory
663# allocation checking (including memory leaks, buffer overwrites, etc.)
664# Note that all these checks are also controlled by env. settings
665# that can enable, or disable specific checks. Note also that some of
666# the checks are available only in emulator and are implemeted in
667# libc_malloc_qemu_instrumented.so.
668ifneq ($(TARGET_BUILD_VARIANT),user)
669
Dima Zavinca122b02009-05-27 10:52:37 -0700670# ========================================================
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800671# libc_malloc_debug_leak.so
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800672# ========================================================
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800673include $(CLEAR_VARS)
674
Dima Zavinca122b02009-05-27 10:52:37 -0700675LOCAL_CFLAGS := \
676 $(libc_common_cflags) \
677 -DMALLOC_LEAK_CHECK
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800678
679LOCAL_C_INCLUDES := $(libc_common_c_includes)
680
681LOCAL_SRC_FILES := \
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800682 bionic/malloc_debug_leak.c
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800683
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800684LOCAL_MODULE:= libc_malloc_debug_leak
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800685
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800686LOCAL_SHARED_LIBRARIES := libc
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800687LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
688LOCAL_SYSTEM_SHARED_LIBRARIES :=
Bruce Beareaa46fa22010-07-08 14:47:50 -0700689LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800690# Don't prelink
691LOCAL_PRELINK_MODULE := false
692# Don't install on release build
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800693LOCAL_MODULE_TAGS := eng debug
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800694
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800695include $(BUILD_SHARED_LIBRARY)
696
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800697
698# ========================================================
699# libc_malloc_debug_qemu.so
700# ========================================================
701include $(CLEAR_VARS)
702
703LOCAL_CFLAGS := \
704 $(libc_common_cflags) \
705 -DMALLOC_QEMU_INSTRUMENT
706
707LOCAL_C_INCLUDES := $(libc_common_c_includes)
708
709LOCAL_SRC_FILES := \
710 bionic/malloc_debug_qemu.c
711
712LOCAL_MODULE:= libc_malloc_debug_qemu
713
714LOCAL_SHARED_LIBRARIES := libc
715LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
716LOCAL_SYSTEM_SHARED_LIBRARIES :=
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
724endif #!user
725
726
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800727# ========================================================
728include $(call all-makefiles-under,$(LOCAL_PATH))