1LOCAL_DIR := $(GET_LOCAL_DIR)
2
3MODULE := $(LOCAL_DIR)
4
5# Clang currently generates incorrect code when it simplifies calls to libc
6# and then inlines them.  The simplification pass does not set a calling
7# convention on the new call, leading to problems when inlining.
8# Avoid this bug by disabling LTO for libc.  See: b/161257552
9MODULE_DISABLE_LTO := true
10
11MUSL_DIR := external/trusty/musl
12
13MODULE_EXPORT_INCLUDES += \
14	$(MUSL_DIR)/arch/$(STANDARD_ARCH_NAME) \
15	$(MUSL_DIR)/arch/generic \
16	$(MUSL_DIR)/include  \
17
18# Internal includes. Should mask public includes - but -isystem guarentees this.
19MODULE_INCLUDES += \
20	$(MUSL_DIR)/src/internal \
21	$(MUSL_DIR)/src/include \
22
23MODULE_EXPORT_INCLUDES += $(LOCAL_DIR)/include
24
25# Musl is scrupulous about exposing prototypes and defines based on what
26# standard is requested. When compiling C++ code, however, Clang defines
27# _GNU_SOURCE because libcxx's header files depend on prototypes that are only
28# available with _GNU_SOURCE specified. To avoid skew where prototypes are
29# defined for C++ but not C, turn everything on always.
30MODULE_EXPORT_COMPILEFLAGS += -D_ALL_SOURCE
31
32# Musl declares global variables with names like "index" that can conflict with
33# function names when _ALL_SOURCE is turned on. Compile Musl as it expects to be
34# compiled.
35MODULE_COMPILEFLAGS += -U_ALL_SOURCE -D_XOPEN_SOURCE=700
36
37# libc should be freestanding, but the rest of the app should not be.
38MODULE_COMPILEFLAGS += -ffreestanding
39
40# Musl's source is not warning clean. Suppress warnings we know about.
41MODULE_COMPILEFLAGS += \
42	-Wno-parentheses \
43	-Wno-sign-compare \
44	-Wno-incompatible-pointer-types-discards-qualifiers \
45	-Wno-string-plus-int \
46	-Wno-missing-braces \
47	-Wno-implicit-fallthrough \
48	-Wno-unused-but-set-variable \
49
50# Musl is generally not strict about its function prototypes.
51# This could be fixed, except for "main". The prototype for main is deliberately
52# ill-defined.
53MODULE_CFLAGS += -Wno-strict-prototypes
54
55# Musl's math code uses pragma STDC FENV_ACCESS ON.
56# Neither Clang nor GCC support this pragma.
57# https://wiki.musl-libc.org/mathematical-library.html
58MODULE_COMPILEFLAGS += \
59	-Wno-unknown-pragmas \
60	-Wno-ignored-pragmas \
61
62# Musl will do something like this:
63# weak_alias(a, b); weak_alias(b, c);
64# But it appears the second statement will get eagerly evaluated to:
65# weak_alias(a, c);
66# and overriding b will not affect c.  This is likely not intended behavior, but
67# it does not matter for us so ignore it.
68MODULE_COMPILEFLAGS += \
69	-Wno-ignored-attributes \
70
71# The are compares that make sense in 64-bit but do not make sense in 32-bit.
72MODULE_COMPILEFLAGS += \
73	-Wno-tautological-constant-compare
74
75# NOTE eabi_unwind_stubs.c because libgcc pulls in unwinding stuff.
76MODULE_SRCS := \
77	$(LKROOT)/lib/libc/eabi_unwind_stubs.c \
78	$(LOCAL_DIR)/__dso_handle.c \
79	$(LOCAL_DIR)/__set_thread_area.c \
80	$(LOCAL_DIR)/file_stubs.c \
81	$(LOCAL_DIR)/locale_stubs.c \
82	$(LOCAL_DIR)/time_stubs.c \
83
84
85# Trusty-specific syscalls
86MODULE_SRCS += \
87	$(LOCAL_DIR)/ipc.c \
88	$(LOCAL_DIR)/logging.c \
89	$(LOCAL_DIR)/memref.c \
90	$(LOCAL_DIR)/mman.c \
91	$(LOCAL_DIR)/time.c \
92	$(LOCAL_DIR)/trusty_err.c \
93	$(LOCAL_DIR)/trusty_uio.c \
94
95ifeq ($(ASLR),false)
96MODULE_SRCS_FIRST := $(MUSL_DIR)/crt/crt1.c
97else
98MODULE_SRCS_FIRST := $(MUSL_DIR)/crt/rcrt1.c
99endif
100
101# Musl
102MODULE_SRCS += \
103	$(MUSL_DIR)/src/env/__environ.c \
104	$(MUSL_DIR)/src/env/__init_tls.c \
105	$(MUSL_DIR)/src/env/__libc_start_main.c \
106	$(MUSL_DIR)/src/env/__stack_chk_fail.c \
107	$(MUSL_DIR)/src/env/getenv.c \
108	$(MUSL_DIR)/src/internal/defsysinfo.c \
109	$(MUSL_DIR)/src/internal/floatscan.c \
110	$(MUSL_DIR)/src/internal/intscan.c \
111	$(MUSL_DIR)/src/internal/libc.c \
112	$(MUSL_DIR)/src/internal/shgetc.c \
113	$(MUSL_DIR)/src/ctype/__ctype_b_loc.c \
114	$(MUSL_DIR)/src/ctype/__ctype_get_mb_cur_max.c \
115	$(MUSL_DIR)/src/ctype/__ctype_tolower_loc.c \
116	$(MUSL_DIR)/src/ctype/__ctype_toupper_loc.c \
117	$(MUSL_DIR)/src/ctype/isalnum.c \
118	$(MUSL_DIR)/src/ctype/isalpha.c \
119	$(MUSL_DIR)/src/ctype/isascii.c \
120	$(MUSL_DIR)/src/ctype/isblank.c \
121	$(MUSL_DIR)/src/ctype/iscntrl.c \
122	$(MUSL_DIR)/src/ctype/isdigit.c \
123	$(MUSL_DIR)/src/ctype/isgraph.c \
124	$(MUSL_DIR)/src/ctype/islower.c \
125	$(MUSL_DIR)/src/ctype/isprint.c \
126	$(MUSL_DIR)/src/ctype/ispunct.c \
127	$(MUSL_DIR)/src/ctype/isspace.c \
128	$(MUSL_DIR)/src/ctype/isupper.c \
129	$(MUSL_DIR)/src/ctype/iswalnum.c \
130	$(MUSL_DIR)/src/ctype/iswalpha.c \
131	$(MUSL_DIR)/src/ctype/iswblank.c \
132	$(MUSL_DIR)/src/ctype/iswcntrl.c \
133	$(MUSL_DIR)/src/ctype/iswctype.c \
134	$(MUSL_DIR)/src/ctype/iswdigit.c \
135	$(MUSL_DIR)/src/ctype/iswgraph.c \
136	$(MUSL_DIR)/src/ctype/iswlower.c \
137	$(MUSL_DIR)/src/ctype/iswprint.c \
138	$(MUSL_DIR)/src/ctype/iswpunct.c \
139	$(MUSL_DIR)/src/ctype/iswspace.c \
140	$(MUSL_DIR)/src/ctype/iswupper.c \
141	$(MUSL_DIR)/src/ctype/iswxdigit.c \
142	$(MUSL_DIR)/src/ctype/isxdigit.c \
143	$(MUSL_DIR)/src/ctype/toascii.c \
144	$(MUSL_DIR)/src/ctype/tolower.c \
145	$(MUSL_DIR)/src/ctype/toupper.c \
146	$(MUSL_DIR)/src/ctype/towctrans.c \
147	$(MUSL_DIR)/src/ctype/wcswidth.c \
148	$(MUSL_DIR)/src/ctype/wctrans.c \
149	$(MUSL_DIR)/src/ctype/wcwidth.c \
150	$(MUSL_DIR)/src/errno/strerror.c \
151	$(MUSL_DIR)/src/errno/__errno_location.c \
152	$(MUSL_DIR)/src/exit/abort.c \
153	$(MUSL_DIR)/src/exit/assert.c \
154	$(MUSL_DIR)/src/exit/atexit.c \
155	$(MUSL_DIR)/src/exit/exit.c \
156	$(MUSL_DIR)/src/exit/_Exit.c \
157	$(MUSL_DIR)/src/misc/getauxval.c \
158	$(MUSL_DIR)/src/multibyte/btowc.c \
159	$(MUSL_DIR)/src/multibyte/c16rtomb.c \
160	$(MUSL_DIR)/src/multibyte/c32rtomb.c \
161	$(MUSL_DIR)/src/multibyte/internal.c \
162	$(MUSL_DIR)/src/multibyte/mblen.c \
163	$(MUSL_DIR)/src/multibyte/mbrlen.c \
164	$(MUSL_DIR)/src/multibyte/mbrtoc16.c \
165	$(MUSL_DIR)/src/multibyte/mbrtoc32.c \
166	$(MUSL_DIR)/src/multibyte/mbrtowc.c \
167	$(MUSL_DIR)/src/multibyte/mbsinit.c \
168	$(MUSL_DIR)/src/multibyte/mbsnrtowcs.c \
169	$(MUSL_DIR)/src/multibyte/mbsrtowcs.c \
170	$(MUSL_DIR)/src/multibyte/mbstowcs.c \
171	$(MUSL_DIR)/src/multibyte/mbtowc.c \
172	$(MUSL_DIR)/src/multibyte/wcrtomb.c \
173	$(MUSL_DIR)/src/multibyte/wcsnrtombs.c \
174	$(MUSL_DIR)/src/multibyte/wcsrtombs.c \
175	$(MUSL_DIR)/src/multibyte/wcstombs.c \
176	$(MUSL_DIR)/src/multibyte/wctob.c \
177	$(MUSL_DIR)/src/multibyte/wctomb.c \
178	$(MUSL_DIR)/src/network/htonl.c \
179	$(MUSL_DIR)/src/network/htons.c \
180	$(MUSL_DIR)/src/network/ntohl.c \
181	$(MUSL_DIR)/src/network/ntohs.c \
182	$(MUSL_DIR)/src/prng/rand.c \
183	$(MUSL_DIR)/src/stdlib/abs.c \
184	$(MUSL_DIR)/src/stdlib/atof.c \
185	$(MUSL_DIR)/src/stdlib/atoi.c \
186	$(MUSL_DIR)/src/stdlib/atol.c \
187	$(MUSL_DIR)/src/stdlib/atoll.c \
188	$(MUSL_DIR)/src/stdlib/bsearch.c \
189	$(MUSL_DIR)/src/stdlib/div.c \
190	$(MUSL_DIR)/src/stdlib/ecvt.c \
191	$(MUSL_DIR)/src/stdlib/fcvt.c \
192	$(MUSL_DIR)/src/stdlib/gcvt.c \
193	$(MUSL_DIR)/src/stdlib/imaxabs.c \
194	$(MUSL_DIR)/src/stdlib/imaxdiv.c \
195	$(MUSL_DIR)/src/stdlib/labs.c \
196	$(MUSL_DIR)/src/stdlib/ldiv.c \
197	$(MUSL_DIR)/src/stdlib/llabs.c \
198	$(MUSL_DIR)/src/stdlib/lldiv.c \
199	$(MUSL_DIR)/src/stdlib/qsort.c \
200	$(MUSL_DIR)/src/stdlib/strtod.c \
201	$(MUSL_DIR)/src/stdlib/strtol.c \
202	$(MUSL_DIR)/src/stdlib/wcstod.c \
203	$(MUSL_DIR)/src/stdlib/wcstol.c \
204	$(MUSL_DIR)/src/string/bcmp.c \
205	$(MUSL_DIR)/src/string/explicit_bzero.c \
206	$(MUSL_DIR)/src/string/memccpy.c \
207	$(MUSL_DIR)/src/string/memchr.c \
208	$(MUSL_DIR)/src/string/memcmp.c \
209	$(MUSL_DIR)/src/string/memcpy.c \
210	$(MUSL_DIR)/src/string/memmem.c \
211	$(MUSL_DIR)/src/string/memmove.c \
212	$(MUSL_DIR)/src/string/mempcpy.c \
213	$(MUSL_DIR)/src/string/memrchr.c \
214	$(MUSL_DIR)/src/string/memset.c \
215	$(MUSL_DIR)/src/string/stpcpy.c \
216	$(MUSL_DIR)/src/string/stpncpy.c \
217	$(MUSL_DIR)/src/string/strcasecmp.c \
218	$(MUSL_DIR)/src/string/strcasestr.c \
219	$(MUSL_DIR)/src/string/strcat.c \
220	$(MUSL_DIR)/src/string/strchr.c \
221	$(MUSL_DIR)/src/string/strchrnul.c \
222	$(MUSL_DIR)/src/string/strcmp.c \
223	$(MUSL_DIR)/src/string/strcpy.c \
224	$(MUSL_DIR)/src/string/strcspn.c \
225	$(MUSL_DIR)/src/string/strdup.c \
226	$(MUSL_DIR)/src/string/strerror_r.c \
227	$(MUSL_DIR)/src/string/strlen.c \
228	$(MUSL_DIR)/src/string/strncasecmp.c \
229	$(MUSL_DIR)/src/string/strncat.c \
230	$(MUSL_DIR)/src/string/strncmp.c \
231	$(MUSL_DIR)/src/string/strncpy.c \
232	$(MUSL_DIR)/src/string/strndup.c \
233	$(MUSL_DIR)/src/string/strnlen.c \
234	$(MUSL_DIR)/src/string/strpbrk.c \
235	$(MUSL_DIR)/src/string/strrchr.c \
236	$(MUSL_DIR)/src/string/strsep.c \
237	$(MUSL_DIR)/src/string/strsignal.c \
238	$(MUSL_DIR)/src/string/strspn.c \
239	$(MUSL_DIR)/src/string/strstr.c \
240	$(MUSL_DIR)/src/string/strtok.c \
241	$(MUSL_DIR)/src/string/strtok_r.c \
242	$(MUSL_DIR)/src/string/strverscmp.c \
243	$(MUSL_DIR)/src/string/swab.c \
244	$(MUSL_DIR)/src/string/wcpcpy.c \
245	$(MUSL_DIR)/src/string/wcpncpy.c \
246	$(MUSL_DIR)/src/string/wcscasecmp.c \
247	$(MUSL_DIR)/src/string/wcscasecmp_l.c \
248	$(MUSL_DIR)/src/string/wcscat.c \
249	$(MUSL_DIR)/src/string/wcschr.c \
250	$(MUSL_DIR)/src/string/wcscmp.c \
251	$(MUSL_DIR)/src/string/wcscpy.c \
252	$(MUSL_DIR)/src/string/wcscspn.c \
253	$(MUSL_DIR)/src/string/wcsdup.c \
254	$(MUSL_DIR)/src/string/wcslen.c \
255	$(MUSL_DIR)/src/string/wcsncasecmp.c \
256	$(MUSL_DIR)/src/string/wcsncasecmp_l.c \
257	$(MUSL_DIR)/src/string/wcsncat.c \
258	$(MUSL_DIR)/src/string/wcsncmp.c \
259	$(MUSL_DIR)/src/string/wcsncpy.c \
260	$(MUSL_DIR)/src/string/wcsnlen.c \
261	$(MUSL_DIR)/src/string/wcspbrk.c \
262	$(MUSL_DIR)/src/string/wcsrchr.c \
263	$(MUSL_DIR)/src/string/wcsspn.c \
264	$(MUSL_DIR)/src/string/wcsstr.c \
265	$(MUSL_DIR)/src/string/wcstok.c \
266	$(MUSL_DIR)/src/string/wcswcs.c \
267	$(MUSL_DIR)/src/string/wmemchr.c \
268	$(MUSL_DIR)/src/string/wmemcmp.c \
269	$(MUSL_DIR)/src/string/wmemcpy.c \
270	$(MUSL_DIR)/src/string/wmemmove.c \
271	$(MUSL_DIR)/src/string/wmemset.c \
272	$(MUSL_DIR)/src/stdio/asprintf.c \
273	$(MUSL_DIR)/src/stdio/fclose.c \
274	$(MUSL_DIR)/src/stdio/fflush.c \
275	$(MUSL_DIR)/src/stdio/fileno.c \
276	$(MUSL_DIR)/src/stdio/fputc.c \
277	$(MUSL_DIR)/src/stdio/fputs.c \
278	$(MUSL_DIR)/src/stdio/fprintf.c \
279	$(MUSL_DIR)/src/stdio/fread.c \
280	$(MUSL_DIR)/src/stdio/fseek.c \
281	$(MUSL_DIR)/src/stdio/ftell.c \
282	$(MUSL_DIR)/src/stdio/fwrite.c \
283	$(MUSL_DIR)/src/stdio/getc.c \
284	$(MUSL_DIR)/src/stdio/ofl.c \
285	$(MUSL_DIR)/src/stdio/printf.c \
286	$(MUSL_DIR)/src/stdio/putc_unlocked.c \
287	$(MUSL_DIR)/src/stdio/putchar.c \
288	$(MUSL_DIR)/src/stdio/puts.c \
289	$(MUSL_DIR)/src/stdio/sscanf.c \
290	$(MUSL_DIR)/src/stdio/snprintf.c \
291	$(MUSL_DIR)/src/stdio/sprintf.c \
292	$(MUSL_DIR)/src/stdio/stderr.c \
293	$(MUSL_DIR)/src/stdio/stdin.c \
294	$(MUSL_DIR)/src/stdio/stdout.c \
295	$(MUSL_DIR)/src/stdio/ungetc.c \
296	$(MUSL_DIR)/src/stdio/vasprintf.c \
297	$(MUSL_DIR)/src/stdio/vprintf.c \
298	$(MUSL_DIR)/src/stdio/vfprintf.c \
299	$(MUSL_DIR)/src/stdio/vsnprintf.c \
300	$(MUSL_DIR)/src/stdio/vsprintf.c \
301	$(MUSL_DIR)/src/stdio/vfscanf.c \
302	$(MUSL_DIR)/src/stdio/vsscanf.c \
303	$(MUSL_DIR)/src/stdio/__lockfile.c \
304	$(MUSL_DIR)/src/stdio/__overflow.c \
305	$(MUSL_DIR)/src/stdio/__stdio_close.c \
306	$(MUSL_DIR)/src/stdio/__stdio_exit.c \
307	$(MUSL_DIR)/src/stdio/__stdio_read.c \
308	$(MUSL_DIR)/src/stdio/__stdio_write.c \
309	$(MUSL_DIR)/src/stdio/__stdio_seek.c \
310	$(MUSL_DIR)/src/stdio/__string_read.c \
311	$(MUSL_DIR)/src/stdio/__toread.c \
312	$(MUSL_DIR)/src/stdio/__towrite.c \
313	$(MUSL_DIR)/src/stdio/__uflow.c \
314	$(MUSL_DIR)/src/thread/__lock.c \
315	$(MUSL_DIR)/src/thread/__wait.c \
316	$(MUSL_DIR)/src/thread/default_attr.c \
317	$(MUSL_DIR)/src/thread/pthread_once.c \
318	$(MUSL_DIR)/src/thread/pthread_cleanup_push.c \
319	$(MUSL_DIR)/src/time/gettimeofday.c \
320	$(MUSL_DIR)/src/time/localtime.c \
321	$(MUSL_DIR)/src/time/localtime_r.c \
322	$(MUSL_DIR)/src/time/gmtime.c \
323	$(MUSL_DIR)/src/time/gmtime_r.c \
324	$(MUSL_DIR)/src/time/time.c \
325	$(MUSL_DIR)/src/time/__secs_to_tm.c \
326	$(MUSL_DIR)/src/unistd/sleep.c \
327	$(MUSL_DIR)/src/unistd/usleep.c \
328
329# Math
330MODULE_SRCS += \
331	$(MUSL_DIR)/src/math/acos.c \
332	$(MUSL_DIR)/src/math/acosf.c \
333	$(MUSL_DIR)/src/math/acosh.c \
334	$(MUSL_DIR)/src/math/acoshf.c \
335	$(MUSL_DIR)/src/math/acoshl.c \
336	$(MUSL_DIR)/src/math/acosl.c \
337	$(MUSL_DIR)/src/math/asin.c \
338	$(MUSL_DIR)/src/math/asinf.c \
339	$(MUSL_DIR)/src/math/asinh.c \
340	$(MUSL_DIR)/src/math/asinhf.c \
341	$(MUSL_DIR)/src/math/asinhl.c \
342	$(MUSL_DIR)/src/math/asinl.c \
343	$(MUSL_DIR)/src/math/atan2.c \
344	$(MUSL_DIR)/src/math/atan2f.c \
345	$(MUSL_DIR)/src/math/atan2l.c \
346	$(MUSL_DIR)/src/math/atan.c \
347	$(MUSL_DIR)/src/math/atanf.c \
348	$(MUSL_DIR)/src/math/atanh.c \
349	$(MUSL_DIR)/src/math/atanhf.c \
350	$(MUSL_DIR)/src/math/atanhl.c \
351	$(MUSL_DIR)/src/math/atanl.c \
352	$(MUSL_DIR)/src/math/cbrt.c \
353	$(MUSL_DIR)/src/math/cbrtf.c \
354	$(MUSL_DIR)/src/math/cbrtl.c \
355	$(MUSL_DIR)/src/math/ceil.c \
356	$(MUSL_DIR)/src/math/ceilf.c \
357	$(MUSL_DIR)/src/math/ceill.c \
358	$(MUSL_DIR)/src/math/copysign.c \
359	$(MUSL_DIR)/src/math/copysignf.c \
360	$(MUSL_DIR)/src/math/copysignl.c \
361	$(MUSL_DIR)/src/math/__cos.c \
362	$(MUSL_DIR)/src/math/cos.c \
363	$(MUSL_DIR)/src/math/__cosdf.c \
364	$(MUSL_DIR)/src/math/cosf.c \
365	$(MUSL_DIR)/src/math/cosh.c \
366	$(MUSL_DIR)/src/math/coshf.c \
367	$(MUSL_DIR)/src/math/coshl.c \
368	$(MUSL_DIR)/src/math/__cosl.c \
369	$(MUSL_DIR)/src/math/cosl.c \
370	$(MUSL_DIR)/src/math/erf.c \
371	$(MUSL_DIR)/src/math/erff.c \
372	$(MUSL_DIR)/src/math/erfl.c \
373	$(MUSL_DIR)/src/math/exp10.c \
374	$(MUSL_DIR)/src/math/exp10f.c \
375	$(MUSL_DIR)/src/math/exp10l.c \
376	$(MUSL_DIR)/src/math/exp2.c \
377	$(MUSL_DIR)/src/math/exp2f.c \
378	$(MUSL_DIR)/src/math/exp2f_data.c \
379	$(MUSL_DIR)/src/math/exp2l.c \
380	$(MUSL_DIR)/src/math/exp.c \
381	$(MUSL_DIR)/src/math/exp_data.c \
382	$(MUSL_DIR)/src/math/expf.c \
383	$(MUSL_DIR)/src/math/expl.c \
384	$(MUSL_DIR)/src/math/expm1.c \
385	$(MUSL_DIR)/src/math/expm1f.c \
386	$(MUSL_DIR)/src/math/expm1l.c \
387	$(MUSL_DIR)/src/math/__expo2.c \
388	$(MUSL_DIR)/src/math/__expo2f.c \
389	$(MUSL_DIR)/src/math/fabs.c \
390	$(MUSL_DIR)/src/math/fabsf.c \
391	$(MUSL_DIR)/src/math/fabsl.c \
392	$(MUSL_DIR)/src/math/fdim.c \
393	$(MUSL_DIR)/src/math/fdimf.c \
394	$(MUSL_DIR)/src/math/fdiml.c \
395	$(MUSL_DIR)/src/math/finite.c \
396	$(MUSL_DIR)/src/math/finitef.c \
397	$(MUSL_DIR)/src/math/floor.c \
398	$(MUSL_DIR)/src/math/floorf.c \
399	$(MUSL_DIR)/src/math/floorl.c \
400	$(MUSL_DIR)/src/math/fma.c \
401	$(MUSL_DIR)/src/math/fmaf.c \
402	$(MUSL_DIR)/src/math/fmal.c \
403	$(MUSL_DIR)/src/math/fmax.c \
404	$(MUSL_DIR)/src/math/fmaxf.c \
405	$(MUSL_DIR)/src/math/fmaxl.c \
406	$(MUSL_DIR)/src/math/fmin.c \
407	$(MUSL_DIR)/src/math/fminf.c \
408	$(MUSL_DIR)/src/math/fminl.c \
409	$(MUSL_DIR)/src/math/fmod.c \
410	$(MUSL_DIR)/src/math/fmodf.c \
411	$(MUSL_DIR)/src/math/fmodl.c \
412	$(MUSL_DIR)/src/math/__fpclassify.c \
413	$(MUSL_DIR)/src/math/__fpclassifyf.c \
414	$(MUSL_DIR)/src/math/__fpclassifyl.c \
415	$(MUSL_DIR)/src/math/frexp.c \
416	$(MUSL_DIR)/src/math/frexpf.c \
417	$(MUSL_DIR)/src/math/frexpl.c \
418	$(MUSL_DIR)/src/math/hypot.c \
419	$(MUSL_DIR)/src/math/hypotf.c \
420	$(MUSL_DIR)/src/math/hypotl.c \
421	$(MUSL_DIR)/src/math/ilogb.c \
422	$(MUSL_DIR)/src/math/ilogbf.c \
423	$(MUSL_DIR)/src/math/ilogbl.c \
424	$(MUSL_DIR)/src/math/__invtrigl.c \
425	$(MUSL_DIR)/src/math/j0.c \
426	$(MUSL_DIR)/src/math/j0f.c \
427	$(MUSL_DIR)/src/math/j1.c \
428	$(MUSL_DIR)/src/math/j1f.c \
429	$(MUSL_DIR)/src/math/jn.c \
430	$(MUSL_DIR)/src/math/jnf.c \
431	$(MUSL_DIR)/src/math/ldexp.c \
432	$(MUSL_DIR)/src/math/ldexpf.c \
433	$(MUSL_DIR)/src/math/ldexpl.c \
434	$(MUSL_DIR)/src/math/lgamma.c \
435	$(MUSL_DIR)/src/math/lgammaf.c \
436	$(MUSL_DIR)/src/math/lgammaf_r.c \
437	$(MUSL_DIR)/src/math/lgammal.c \
438	$(MUSL_DIR)/src/math/lgamma_r.c \
439	$(MUSL_DIR)/src/math/llrint.c \
440	$(MUSL_DIR)/src/math/llrintf.c \
441	$(MUSL_DIR)/src/math/llrintl.c \
442	$(MUSL_DIR)/src/math/llround.c \
443	$(MUSL_DIR)/src/math/llroundf.c \
444	$(MUSL_DIR)/src/math/llroundl.c \
445	$(MUSL_DIR)/src/math/log10.c \
446	$(MUSL_DIR)/src/math/log10f.c \
447	$(MUSL_DIR)/src/math/log10l.c \
448	$(MUSL_DIR)/src/math/log1p.c \
449	$(MUSL_DIR)/src/math/log1pf.c \
450	$(MUSL_DIR)/src/math/log1pl.c \
451	$(MUSL_DIR)/src/math/log2.c \
452	$(MUSL_DIR)/src/math/log2_data.c \
453	$(MUSL_DIR)/src/math/log2f.c \
454	$(MUSL_DIR)/src/math/log2f_data.c \
455	$(MUSL_DIR)/src/math/log2l.c \
456	$(MUSL_DIR)/src/math/logb.c \
457	$(MUSL_DIR)/src/math/logbf.c \
458	$(MUSL_DIR)/src/math/logbl.c \
459	$(MUSL_DIR)/src/math/log.c \
460	$(MUSL_DIR)/src/math/log_data.c \
461	$(MUSL_DIR)/src/math/logf.c \
462	$(MUSL_DIR)/src/math/logf_data.c \
463	$(MUSL_DIR)/src/math/logl.c \
464	$(MUSL_DIR)/src/math/lrint.c \
465	$(MUSL_DIR)/src/math/lrintf.c \
466	$(MUSL_DIR)/src/math/lrintl.c \
467	$(MUSL_DIR)/src/math/lround.c \
468	$(MUSL_DIR)/src/math/lroundf.c \
469	$(MUSL_DIR)/src/math/lroundl.c \
470	$(MUSL_DIR)/src/math/__math_divzero.c \
471	$(MUSL_DIR)/src/math/__math_divzerof.c \
472	$(MUSL_DIR)/src/math/__math_invalid.c \
473	$(MUSL_DIR)/src/math/__math_invalidf.c \
474	$(MUSL_DIR)/src/math/__math_oflow.c \
475	$(MUSL_DIR)/src/math/__math_oflowf.c \
476	$(MUSL_DIR)/src/math/__math_uflow.c \
477	$(MUSL_DIR)/src/math/__math_uflowf.c \
478	$(MUSL_DIR)/src/math/__math_xflow.c \
479	$(MUSL_DIR)/src/math/__math_xflowf.c \
480	$(MUSL_DIR)/src/math/modf.c \
481	$(MUSL_DIR)/src/math/modff.c \
482	$(MUSL_DIR)/src/math/modfl.c \
483	$(MUSL_DIR)/src/math/nan.c \
484	$(MUSL_DIR)/src/math/nanf.c \
485	$(MUSL_DIR)/src/math/nanl.c \
486	$(MUSL_DIR)/src/math/nearbyint.c \
487	$(MUSL_DIR)/src/math/nearbyintf.c \
488	$(MUSL_DIR)/src/math/nearbyintl.c \
489	$(MUSL_DIR)/src/math/nextafter.c \
490	$(MUSL_DIR)/src/math/nextafterf.c \
491	$(MUSL_DIR)/src/math/nextafterl.c \
492	$(MUSL_DIR)/src/math/nexttoward.c \
493	$(MUSL_DIR)/src/math/nexttowardf.c \
494	$(MUSL_DIR)/src/math/nexttowardl.c \
495	$(MUSL_DIR)/src/math/__polevll.c \
496	$(MUSL_DIR)/src/math/pow.c \
497	$(MUSL_DIR)/src/math/pow_data.c \
498	$(MUSL_DIR)/src/math/powf.c \
499	$(MUSL_DIR)/src/math/powf_data.c \
500	$(MUSL_DIR)/src/math/powl.c \
501	$(MUSL_DIR)/src/math/remainder.c \
502	$(MUSL_DIR)/src/math/remainderf.c \
503	$(MUSL_DIR)/src/math/remainderl.c \
504	$(MUSL_DIR)/src/math/__rem_pio2.c \
505	$(MUSL_DIR)/src/math/__rem_pio2f.c \
506	$(MUSL_DIR)/src/math/__rem_pio2_large.c \
507	$(MUSL_DIR)/src/math/__rem_pio2l.c \
508	$(MUSL_DIR)/src/math/remquo.c \
509	$(MUSL_DIR)/src/math/remquof.c \
510	$(MUSL_DIR)/src/math/remquol.c \
511	$(MUSL_DIR)/src/math/rint.c \
512	$(MUSL_DIR)/src/math/rintf.c \
513	$(MUSL_DIR)/src/math/rintl.c \
514	$(MUSL_DIR)/src/math/round.c \
515	$(MUSL_DIR)/src/math/roundf.c \
516	$(MUSL_DIR)/src/math/roundl.c \
517	$(MUSL_DIR)/src/math/scalb.c \
518	$(MUSL_DIR)/src/math/scalbf.c \
519	$(MUSL_DIR)/src/math/scalbln.c \
520	$(MUSL_DIR)/src/math/scalblnf.c \
521	$(MUSL_DIR)/src/math/scalblnl.c \
522	$(MUSL_DIR)/src/math/scalbn.c \
523	$(MUSL_DIR)/src/math/scalbnf.c \
524	$(MUSL_DIR)/src/math/scalbnl.c \
525	$(MUSL_DIR)/src/math/__signbit.c \
526	$(MUSL_DIR)/src/math/__signbitf.c \
527	$(MUSL_DIR)/src/math/__signbitl.c \
528	$(MUSL_DIR)/src/math/signgam.c \
529	$(MUSL_DIR)/src/math/significand.c \
530	$(MUSL_DIR)/src/math/significandf.c \
531	$(MUSL_DIR)/src/math/__sin.c \
532	$(MUSL_DIR)/src/math/sin.c \
533	$(MUSL_DIR)/src/math/sincos.c \
534	$(MUSL_DIR)/src/math/sincosf.c \
535	$(MUSL_DIR)/src/math/sincosl.c \
536	$(MUSL_DIR)/src/math/__sindf.c \
537	$(MUSL_DIR)/src/math/sinf.c \
538	$(MUSL_DIR)/src/math/sinh.c \
539	$(MUSL_DIR)/src/math/sinhf.c \
540	$(MUSL_DIR)/src/math/sinhl.c \
541	$(MUSL_DIR)/src/math/__sinl.c \
542	$(MUSL_DIR)/src/math/sinl.c \
543	$(MUSL_DIR)/src/math/sqrt.c \
544	$(MUSL_DIR)/src/math/sqrtf.c \
545	$(MUSL_DIR)/src/math/sqrtl.c \
546	$(MUSL_DIR)/src/math/__tan.c \
547	$(MUSL_DIR)/src/math/tan.c \
548	$(MUSL_DIR)/src/math/__tandf.c \
549	$(MUSL_DIR)/src/math/tanf.c \
550	$(MUSL_DIR)/src/math/tanh.c \
551	$(MUSL_DIR)/src/math/tanhf.c \
552	$(MUSL_DIR)/src/math/tanhl.c \
553	$(MUSL_DIR)/src/math/__tanl.c \
554	$(MUSL_DIR)/src/math/tanl.c \
555	$(MUSL_DIR)/src/math/tgamma.c \
556	$(MUSL_DIR)/src/math/tgammaf.c \
557	$(MUSL_DIR)/src/math/tgammal.c \
558	$(MUSL_DIR)/src/math/trunc.c \
559	$(MUSL_DIR)/src/math/truncf.c \
560	$(MUSL_DIR)/src/math/truncl.c \
561
562
563# Locale
564MODULE_SRCS += \
565	$(MUSL_DIR)/src/locale/bind_textdomain_codeset.c \
566	$(MUSL_DIR)/src/locale/catclose.c \
567	$(MUSL_DIR)/src/locale/catgets.c \
568	$(MUSL_DIR)/src/locale/catopen.c \
569	$(MUSL_DIR)/src/locale/c_locale.c \
570	$(MUSL_DIR)/src/locale/iconv.c \
571	$(MUSL_DIR)/src/locale/iconv_close.c \
572	$(MUSL_DIR)/src/locale/langinfo.c \
573	$(MUSL_DIR)/src/locale/__lctrans.c \
574	$(MUSL_DIR)/src/locale/localeconv.c \
575	$(MUSL_DIR)/src/locale/__mo_lookup.c \
576	$(MUSL_DIR)/src/locale/pleval.c \
577	$(MUSL_DIR)/src/locale/strcoll.c \
578	$(MUSL_DIR)/src/locale/strfmon.c \
579	$(MUSL_DIR)/src/locale/strxfrm.c \
580	$(MUSL_DIR)/src/locale/textdomain.c \
581	$(MUSL_DIR)/src/locale/wcscoll.c \
582	$(MUSL_DIR)/src/locale/wcsxfrm.c \
583
584
585# Uses VLAs.
586#	$(MUSL_DIR)/src/locale/dcngettext.c \
587
588# Implicitly loads files, stub out.
589#	$(MUSL_DIR)/src/locale/duplocale.c \
590#	$(MUSL_DIR)/src/locale/freelocale.c \
591#	$(MUSL_DIR)/src/locale/locale_map.c \
592#	$(MUSL_DIR)/src/locale/newlocale.c \
593#	$(MUSL_DIR)/src/locale/setlocale.c \
594#	$(MUSL_DIR)/src/locale/uselocale.c \
595
596# Fake pthreads
597MODULE_SRCS += $(LOCAL_DIR)/pthreads.c
598
599# TODO extract the early startup code from this module and turn on the stack
600# protector for most of libc.
601MODULE_DISABLE_STACK_PROTECTOR := true
602
603# Do not include implicit dependencies to avoid recursively depending on libc
604MODULE_ADD_IMPLICIT_DEPS := false
605
606# Defined by kernel/lib/ubsan/enable.mk if in use for the build
607ifeq ($(UBSAN_ENABLED), true)
608MODULE_LIBRARY_DEPS += trusty/kernel/lib/ubsan
609endif
610
611# Add Trusty libc extensions (separated due to use both in the kernel and here)
612MODULE_LIBRARY_EXPORTED_DEPS += trusty/kernel/lib/libc-ext
613
614# Add dependency on syscall-stubs
615MODULE_LIBRARY_DEPS += trusty/user/base/lib/syscall-stubs
616
617# Add src dependency on syscall header to ensure it is generated before we try
618# to build
619include trusty/user/base/lib/syscall-stubs/common-inc.mk
620MODULE_SRCDEPS += $(SYSCALL_H)
621
622MODULE_LICENSES += $(MUSL_DIR)/LICENSE
623
624include make/library.mk
625