• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1ifneq ($(TARGET_USE_PRIVATE_LIBM),true)
2LOCAL_PATH:= $(call my-dir)
3
4bionic_coverage := false
5
6# Clang/llvm has incompatible long double (fp128) for x86_64.
7# https://llvm.org/bugs/show_bug.cgi?id=23897
8ifeq ($(TARGET_ARCH),x86_64)
9libm_clang := false
10endif
11
12# -----------------------------------------------------------------------------
13# libm.a
14# -----------------------------------------------------------------------------
15include $(CLEAR_VARS)
16
17LOCAL_MODULE := libm
18
19LOCAL_SRC_FILES := \
20    upstream-freebsd/lib/msun/bsdsrc/b_exp.c \
21    upstream-freebsd/lib/msun/bsdsrc/b_log.c \
22    upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c \
23    upstream-freebsd/lib/msun/src/catrig.c \
24    upstream-freebsd/lib/msun/src/catrigf.c \
25    upstream-freebsd/lib/msun/src/e_acos.c \
26    upstream-freebsd/lib/msun/src/e_acosf.c \
27    upstream-freebsd/lib/msun/src/e_acosh.c \
28    upstream-freebsd/lib/msun/src/e_acoshf.c \
29    upstream-freebsd/lib/msun/src/e_asin.c \
30    upstream-freebsd/lib/msun/src/e_asinf.c \
31    upstream-freebsd/lib/msun/src/e_atan2.c \
32    upstream-freebsd/lib/msun/src/e_atan2f.c \
33    upstream-freebsd/lib/msun/src/e_atanh.c \
34    upstream-freebsd/lib/msun/src/e_atanhf.c \
35    upstream-freebsd/lib/msun/src/e_cosh.c \
36    upstream-freebsd/lib/msun/src/e_coshf.c \
37    upstream-freebsd/lib/msun/src/e_exp.c \
38    upstream-freebsd/lib/msun/src/e_expf.c \
39    upstream-freebsd/lib/msun/src/e_fmod.c \
40    upstream-freebsd/lib/msun/src/e_fmodf.c \
41    upstream-freebsd/lib/msun/src/e_gamma.c \
42    upstream-freebsd/lib/msun/src/e_gammaf.c \
43    upstream-freebsd/lib/msun/src/e_gammaf_r.c \
44    upstream-freebsd/lib/msun/src/e_gamma_r.c \
45    upstream-freebsd/lib/msun/src/e_hypot.c \
46    upstream-freebsd/lib/msun/src/e_hypotf.c \
47    upstream-freebsd/lib/msun/src/e_j0.c \
48    upstream-freebsd/lib/msun/src/e_j0f.c \
49    upstream-freebsd/lib/msun/src/e_j1.c \
50    upstream-freebsd/lib/msun/src/e_j1f.c \
51    upstream-freebsd/lib/msun/src/e_jn.c \
52    upstream-freebsd/lib/msun/src/e_jnf.c \
53    upstream-freebsd/lib/msun/src/e_lgamma.c \
54    upstream-freebsd/lib/msun/src/e_lgammaf.c \
55    upstream-freebsd/lib/msun/src/e_lgammaf_r.c \
56    upstream-freebsd/lib/msun/src/e_lgamma_r.c \
57    upstream-freebsd/lib/msun/src/e_log10.c \
58    upstream-freebsd/lib/msun/src/e_log10f.c \
59    upstream-freebsd/lib/msun/src/e_log2.c \
60    upstream-freebsd/lib/msun/src/e_log2f.c \
61    upstream-freebsd/lib/msun/src/e_log.c \
62    upstream-freebsd/lib/msun/src/e_logf.c \
63    upstream-freebsd/lib/msun/src/e_pow.c \
64    upstream-freebsd/lib/msun/src/e_powf.c \
65    upstream-freebsd/lib/msun/src/e_remainder.c \
66    upstream-freebsd/lib/msun/src/e_remainderf.c \
67    upstream-freebsd/lib/msun/src/e_rem_pio2.c \
68    upstream-freebsd/lib/msun/src/e_rem_pio2f.c \
69    upstream-freebsd/lib/msun/src/e_scalb.c \
70    upstream-freebsd/lib/msun/src/e_scalbf.c \
71    upstream-freebsd/lib/msun/src/e_sinh.c \
72    upstream-freebsd/lib/msun/src/e_sinhf.c \
73    upstream-freebsd/lib/msun/src/e_sqrt.c \
74    upstream-freebsd/lib/msun/src/e_sqrtf.c \
75    upstream-freebsd/lib/msun/src/imprecise.c \
76    upstream-freebsd/lib/msun/src/k_cos.c \
77    upstream-freebsd/lib/msun/src/k_cosf.c \
78    upstream-freebsd/lib/msun/src/k_exp.c \
79    upstream-freebsd/lib/msun/src/k_expf.c \
80    upstream-freebsd/lib/msun/src/k_rem_pio2.c \
81    upstream-freebsd/lib/msun/src/k_sin.c \
82    upstream-freebsd/lib/msun/src/k_sinf.c \
83    upstream-freebsd/lib/msun/src/k_tan.c \
84    upstream-freebsd/lib/msun/src/k_tanf.c \
85    upstream-freebsd/lib/msun/src/s_asinh.c \
86    upstream-freebsd/lib/msun/src/s_asinhf.c \
87    upstream-freebsd/lib/msun/src/s_atan.c \
88    upstream-freebsd/lib/msun/src/s_atanf.c \
89    upstream-freebsd/lib/msun/src/s_carg.c \
90    upstream-freebsd/lib/msun/src/s_cargf.c \
91    upstream-freebsd/lib/msun/src/s_cargl.c \
92    upstream-freebsd/lib/msun/src/s_cbrt.c \
93    upstream-freebsd/lib/msun/src/s_cbrtf.c \
94    upstream-freebsd/lib/msun/src/s_ccosh.c \
95    upstream-freebsd/lib/msun/src/s_ccoshf.c \
96    upstream-freebsd/lib/msun/src/s_ceil.c \
97    upstream-freebsd/lib/msun/src/s_ceilf.c \
98    upstream-freebsd/lib/msun/src/s_cexp.c \
99    upstream-freebsd/lib/msun/src/s_cexpf.c \
100    upstream-freebsd/lib/msun/src/s_cimag.c \
101    upstream-freebsd/lib/msun/src/s_cimagf.c \
102    upstream-freebsd/lib/msun/src/s_cimagl.c \
103    upstream-freebsd/lib/msun/src/s_conj.c \
104    upstream-freebsd/lib/msun/src/s_conjf.c \
105    upstream-freebsd/lib/msun/src/s_conjl.c \
106    upstream-freebsd/lib/msun/src/s_copysign.c \
107    upstream-freebsd/lib/msun/src/s_copysignf.c \
108    upstream-freebsd/lib/msun/src/s_cos.c \
109    upstream-freebsd/lib/msun/src/s_cosf.c \
110    upstream-freebsd/lib/msun/src/s_cproj.c \
111    upstream-freebsd/lib/msun/src/s_cprojf.c \
112    upstream-freebsd/lib/msun/src/s_cprojl.c \
113    upstream-freebsd/lib/msun/src/s_creal.c \
114    upstream-freebsd/lib/msun/src/s_crealf.c \
115    upstream-freebsd/lib/msun/src/s_creall.c \
116    upstream-freebsd/lib/msun/src/s_csinh.c \
117    upstream-freebsd/lib/msun/src/s_csinhf.c \
118    upstream-freebsd/lib/msun/src/s_csqrt.c \
119    upstream-freebsd/lib/msun/src/s_csqrtf.c \
120    upstream-freebsd/lib/msun/src/s_csqrtl.c \
121    upstream-freebsd/lib/msun/src/s_ctanh.c \
122    upstream-freebsd/lib/msun/src/s_ctanhf.c \
123    upstream-freebsd/lib/msun/src/s_erf.c \
124    upstream-freebsd/lib/msun/src/s_erff.c \
125    upstream-freebsd/lib/msun/src/s_exp2.c \
126    upstream-freebsd/lib/msun/src/s_exp2f.c \
127    upstream-freebsd/lib/msun/src/s_expm1.c \
128    upstream-freebsd/lib/msun/src/s_expm1f.c \
129    upstream-freebsd/lib/msun/src/s_fdim.c \
130    upstream-freebsd/lib/msun/src/s_finite.c \
131    upstream-freebsd/lib/msun/src/s_finitef.c \
132    upstream-freebsd/lib/msun/src/s_floor.c \
133    upstream-freebsd/lib/msun/src/s_floorf.c \
134    upstream-freebsd/lib/msun/src/s_fma.c \
135    upstream-freebsd/lib/msun/src/s_fmaf.c \
136    upstream-freebsd/lib/msun/src/s_fmax.c \
137    upstream-freebsd/lib/msun/src/s_fmaxf.c \
138    upstream-freebsd/lib/msun/src/s_fmin.c \
139    upstream-freebsd/lib/msun/src/s_fminf.c \
140    upstream-freebsd/lib/msun/src/s_frexp.c \
141    upstream-freebsd/lib/msun/src/s_frexpf.c \
142    upstream-freebsd/lib/msun/src/s_ilogb.c \
143    upstream-freebsd/lib/msun/src/s_ilogbf.c \
144    upstream-freebsd/lib/msun/src/s_llrint.c \
145    upstream-freebsd/lib/msun/src/s_llrintf.c \
146    upstream-freebsd/lib/msun/src/s_llround.c \
147    upstream-freebsd/lib/msun/src/s_llroundf.c \
148    upstream-freebsd/lib/msun/src/s_log1p.c \
149    upstream-freebsd/lib/msun/src/s_log1pf.c \
150    upstream-freebsd/lib/msun/src/s_logb.c \
151    upstream-freebsd/lib/msun/src/s_logbf.c \
152    upstream-freebsd/lib/msun/src/s_lrint.c \
153    upstream-freebsd/lib/msun/src/s_lrintf.c \
154    upstream-freebsd/lib/msun/src/s_lround.c \
155    upstream-freebsd/lib/msun/src/s_lroundf.c \
156    upstream-freebsd/lib/msun/src/s_modf.c \
157    upstream-freebsd/lib/msun/src/s_modff.c \
158    upstream-freebsd/lib/msun/src/s_nan.c \
159    upstream-freebsd/lib/msun/src/s_nearbyint.c \
160    upstream-freebsd/lib/msun/src/s_nextafter.c \
161    upstream-freebsd/lib/msun/src/s_nextafterf.c \
162    upstream-freebsd/lib/msun/src/s_remquo.c \
163    upstream-freebsd/lib/msun/src/s_remquof.c \
164    upstream-freebsd/lib/msun/src/s_rint.c \
165    upstream-freebsd/lib/msun/src/s_rintf.c \
166    upstream-freebsd/lib/msun/src/s_round.c \
167    upstream-freebsd/lib/msun/src/s_roundf.c \
168    upstream-freebsd/lib/msun/src/s_scalbln.c \
169    upstream-freebsd/lib/msun/src/s_scalbn.c \
170    upstream-freebsd/lib/msun/src/s_scalbnf.c \
171    upstream-freebsd/lib/msun/src/s_signgam.c \
172    upstream-freebsd/lib/msun/src/s_significand.c \
173    upstream-freebsd/lib/msun/src/s_significandf.c \
174    upstream-freebsd/lib/msun/src/s_sin.c \
175    upstream-freebsd/lib/msun/src/s_sinf.c \
176    upstream-freebsd/lib/msun/src/s_tan.c \
177    upstream-freebsd/lib/msun/src/s_tanf.c \
178    upstream-freebsd/lib/msun/src/s_tanh.c \
179    upstream-freebsd/lib/msun/src/s_tanhf.c \
180    upstream-freebsd/lib/msun/src/s_tgammaf.c \
181    upstream-freebsd/lib/msun/src/s_trunc.c \
182    upstream-freebsd/lib/msun/src/s_truncf.c \
183    upstream-freebsd/lib/msun/src/w_cabs.c \
184    upstream-freebsd/lib/msun/src/w_cabsf.c \
185    upstream-freebsd/lib/msun/src/w_cabsl.c \
186    upstream-freebsd/lib/msun/src/w_drem.c \
187    upstream-freebsd/lib/msun/src/w_dremf.c \
188
189LOCAL_SRC_FILES_32 += \
190    fake_long_double.c \
191
192LOCAL_SRC_FILES_64 := \
193    upstream-freebsd/lib/msun/src/e_acosl.c \
194    upstream-freebsd/lib/msun/src/e_acoshl.c \
195    upstream-freebsd/lib/msun/src/e_asinl.c \
196    upstream-freebsd/lib/msun/src/e_atan2l.c \
197    upstream-freebsd/lib/msun/src/e_atanhl.c \
198    upstream-freebsd/lib/msun/src/e_fmodl.c \
199    upstream-freebsd/lib/msun/src/e_hypotl.c \
200    upstream-freebsd/lib/msun/src/e_lgammal.c \
201    upstream-freebsd/lib/msun/src/e_remainderl.c \
202    upstream-freebsd/lib/msun/src/e_sqrtl.c \
203    upstream-freebsd/lib/msun/src/s_asinhl.c \
204    upstream-freebsd/lib/msun/src/s_atanl.c \
205    upstream-freebsd/lib/msun/src/s_cbrtl.c \
206    upstream-freebsd/lib/msun/src/s_ceill.c \
207    upstream-freebsd/lib/msun/src/s_copysignl.c \
208    upstream-freebsd/lib/msun/src/e_coshl.c \
209    upstream-freebsd/lib/msun/src/s_cosl.c \
210    upstream-freebsd/lib/msun/src/s_floorl.c \
211    upstream-freebsd/lib/msun/src/s_fmal.c \
212    upstream-freebsd/lib/msun/src/s_fmaxl.c \
213    upstream-freebsd/lib/msun/src/s_fminl.c \
214    upstream-freebsd/lib/msun/src/s_modfl.c \
215    upstream-freebsd/lib/msun/src/s_frexpl.c \
216    upstream-freebsd/lib/msun/src/s_ilogbl.c \
217    upstream-freebsd/lib/msun/src/s_llrintl.c \
218    upstream-freebsd/lib/msun/src/s_llroundl.c \
219    upstream-freebsd/lib/msun/src/s_logbl.c \
220    upstream-freebsd/lib/msun/src/s_lrintl.c \
221    upstream-freebsd/lib/msun/src/s_lroundl.c \
222    upstream-freebsd/lib/msun/src/s_nextafterl.c \
223    upstream-freebsd/lib/msun/src/s_nexttoward.c \
224    upstream-freebsd/lib/msun/src/s_nexttowardf.c \
225    upstream-freebsd/lib/msun/src/s_remquol.c \
226    upstream-freebsd/lib/msun/src/s_rintl.c \
227    upstream-freebsd/lib/msun/src/s_roundl.c \
228    upstream-freebsd/lib/msun/src/s_scalbnl.c \
229    upstream-freebsd/lib/msun/src/e_sinhl.c \
230    upstream-freebsd/lib/msun/src/s_sinl.c \
231    upstream-freebsd/lib/msun/src/s_tanhl.c \
232    upstream-freebsd/lib/msun/src/s_tanl.c \
233    upstream-freebsd/lib/msun/src/s_truncl.c \
234
235LOCAL_SRC_FILES_64 += \
236    upstream-freebsd/lib/msun/ld128/invtrig.c \
237    upstream-freebsd/lib/msun/ld128/e_lgammal_r.c \
238    upstream-freebsd/lib/msun/ld128/k_cosl.c \
239    upstream-freebsd/lib/msun/ld128/k_sinl.c \
240    upstream-freebsd/lib/msun/ld128/k_tanl.c \
241    upstream-freebsd/lib/msun/ld128/s_erfl.c \
242    upstream-freebsd/lib/msun/ld128/s_exp2l.c \
243    upstream-freebsd/lib/msun/ld128/s_expl.c \
244    upstream-freebsd/lib/msun/ld128/s_logl.c \
245    upstream-freebsd/lib/msun/ld128/s_nanl.c \
246
247# TODO: this comes from from upstream's libc, not libm, but it's an
248# implementation detail that should have hidden visibility, so it needs
249# to be in whatever library the math code is in.
250LOCAL_SRC_FILES += \
251    digittoint.c  \
252
253# Functionality not in the BSDs.
254LOCAL_SRC_FILES += \
255    significandl.c \
256    sincos.c \
257
258# Modified versions of BSD code.
259LOCAL_SRC_FILES += \
260    signbit.c \
261
262# Home-grown stuff.
263LOCAL_SRC_FILES += \
264    fabs.cpp \
265
266# Arch specific optimizations.
267
268# -----------------------------------------------------------------------------
269# arm
270# -----------------------------------------------------------------------------
271LOCAL_SRC_FILES_arm += \
272    arm/fenv.c \
273
274# s_floor.S requires neon instructions.
275ifdef TARGET_2ND_ARCH
276arch_variant := $(TARGET_2ND_ARCH_VARIANT)
277else
278arch_variant := $(TARGET_ARCH_VARIANT)
279endif
280
281# Use the C version on armv7-a since it doesn't support neon instructions.
282ifneq ($(arch_variant),armv7-a)
283LOCAL_SRC_FILES_arm += \
284    arm/sqrt.S \
285    arm/floor.S \
286
287LOCAL_SRC_FILES_EXCLUDE_arm += \
288    upstream-freebsd/lib/msun/src/e_sqrt.c \
289    upstream-freebsd/lib/msun/src/e_sqrtf.c \
290    upstream-freebsd/lib/msun/src/s_floor.c \
291
292endif
293
294# -----------------------------------------------------------------------------
295# arm64
296# -----------------------------------------------------------------------------
297LOCAL_SRC_FILES_arm64 += \
298    arm64/ceil.S \
299    arm64/fenv.c \
300    arm64/fma.S \
301    arm64/floor.S \
302    arm64/lrint.S \
303    arm64/rint.S \
304    arm64/sqrt.S \
305    arm64/trunc.S \
306
307LOCAL_SRC_FILES_EXCLUDE_arm64 += \
308    upstream-freebsd/lib/msun/src/e_sqrt.c \
309    upstream-freebsd/lib/msun/src/e_sqrtf.c \
310    upstream-freebsd/lib/msun/src/s_ceil.c \
311    upstream-freebsd/lib/msun/src/s_ceilf.c \
312    upstream-freebsd/lib/msun/src/s_fma.c \
313    upstream-freebsd/lib/msun/src/s_fmaf.c \
314    upstream-freebsd/lib/msun/src/s_floor.c \
315    upstream-freebsd/lib/msun/src/s_floorf.c \
316    upstream-freebsd/lib/msun/src/s_llrint.c \
317    upstream-freebsd/lib/msun/src/s_llrintf.c \
318    upstream-freebsd/lib/msun/src/s_lrint.c \
319    upstream-freebsd/lib/msun/src/s_lrintf.c \
320    upstream-freebsd/lib/msun/src/s_rint.c \
321    upstream-freebsd/lib/msun/src/s_rintf.c \
322    upstream-freebsd/lib/msun/src/s_trunc.c \
323    upstream-freebsd/lib/msun/src/s_truncf.c \
324
325# -----------------------------------------------------------------------------
326# mips
327# -----------------------------------------------------------------------------
328libm_mips_arch_files := \
329    mips/fenv.c \
330
331LOCAL_SRC_FILES_mips += $(libm_mips_arch_files)
332LOCAL_SRC_FILES_mips64 += $(libm_mips_arch_files)
333
334# -----------------------------------------------------------------------------
335# x86
336# -----------------------------------------------------------------------------
337LOCAL_SRC_FILES_x86 += \
338    i387/fenv.c \
339    x86/sqrt.S \
340    x86/sqrtf.S \
341    x86/e_acos.S \
342    x86/e_asin.S \
343    x86/e_atan2.S \
344    x86/e_cosh.S \
345    x86/e_exp.S \
346    x86/e_hypot.S \
347    x86/e_log10.S \
348    x86/e_log.S \
349    x86/e_pow.S \
350    x86/e_sinh.S \
351    x86/libm_reduce_pi04l.S \
352    x86/libm_sincos_huge.S \
353    x86/libm_tancot_huge.S \
354    x86/lrint.S \
355    x86/lrintf.S \
356    x86/s_atan.S \
357    x86/s_cbrt.S \
358    x86/s_cos.S \
359    x86/s_expm1.S \
360    x86/s_log1p.S \
361    x86/s_sin.S \
362    x86/s_tanh.S \
363    x86/s_tan.S \
364
365LOCAL_SRC_FILES_EXCLUDE_x86 += \
366    upstream-freebsd/lib/msun/src/e_acos.c \
367    upstream-freebsd/lib/msun/src/e_asin.c \
368    upstream-freebsd/lib/msun/src/e_atan2.c \
369    upstream-freebsd/lib/msun/src/e_cosh.c \
370    upstream-freebsd/lib/msun/src/e_exp.c \
371    upstream-freebsd/lib/msun/src/e_hypot.c \
372    upstream-freebsd/lib/msun/src/e_log.c \
373    upstream-freebsd/lib/msun/src/e_log10.c \
374    upstream-freebsd/lib/msun/src/e_pow.c \
375    upstream-freebsd/lib/msun/src/e_sinh.c \
376    upstream-freebsd/lib/msun/src/e_sqrt.c \
377    upstream-freebsd/lib/msun/src/e_sqrtf.c \
378    upstream-freebsd/lib/msun/src/s_atan.c \
379    upstream-freebsd/lib/msun/src/s_cbrt.c \
380    upstream-freebsd/lib/msun/src/s_cos.c \
381    upstream-freebsd/lib/msun/src/s_expm1.c \
382    upstream-freebsd/lib/msun/src/s_log1p.c \
383    upstream-freebsd/lib/msun/src/s_lrint.c \
384    upstream-freebsd/lib/msun/src/s_lrintf.c \
385    upstream-freebsd/lib/msun/src/s_sin.c \
386    upstream-freebsd/lib/msun/src/s_tan.c \
387    upstream-freebsd/lib/msun/src/s_tanh.c \
388
389ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
390LOCAL_SRC_FILES_x86 += \
391    x86/ceil.S \
392    x86/ceilf.S \
393    x86/floor.S \
394    x86/floorf.S \
395    x86/rint.S \
396    x86/rintf.S \
397    x86/trunc.S \
398    x86/truncf.S \
399
400LOCAL_SRC_FILES_EXCLUDE_x86 += \
401    upstream-freebsd/lib/msun/src/s_ceil.c \
402    upstream-freebsd/lib/msun/src/s_ceilf.c \
403    upstream-freebsd/lib/msun/src/s_floor.c \
404    upstream-freebsd/lib/msun/src/s_floorf.c \
405    upstream-freebsd/lib/msun/src/s_rint.c \
406    upstream-freebsd/lib/msun/src/s_rintf.c \
407    upstream-freebsd/lib/msun/src/s_trunc.c \
408    upstream-freebsd/lib/msun/src/s_truncf.c \
409
410endif
411
412# -----------------------------------------------------------------------------
413# x86_64
414# -----------------------------------------------------------------------------
415LOCAL_SRC_FILES_x86_64 += \
416    amd64/fenv.c \
417    x86_64/sqrt.S \
418    x86_64/sqrtf.S \
419    x86_64/e_acos.S \
420    x86_64/e_asin.S \
421    x86_64/e_atan2.S \
422    x86_64/e_cosh.S \
423    x86_64/e_exp.S \
424    x86_64/e_hypot.S \
425    x86_64/e_log10.S \
426    x86_64/e_log.S \
427    x86_64/e_pow.S \
428    x86_64/e_sinh.S \
429    x86_64/lrint.S \
430    x86_64/lrintf.S \
431    x86_64/s_atan.S \
432    x86_64/s_cbrt.S \
433    x86_64/s_cos.S \
434    x86_64/s_expm1.S \
435    x86_64/s_log1p.S \
436    x86_64/s_sin.S \
437    x86_64/s_tanh.S \
438    x86_64/s_tan.S \
439
440LOCAL_SRC_FILES_EXCLUDE_x86_64 += \
441    upstream-freebsd/lib/msun/src/e_acos.c \
442    upstream-freebsd/lib/msun/src/e_asin.c \
443    upstream-freebsd/lib/msun/src/e_atan2.c \
444    upstream-freebsd/lib/msun/src/e_cosh.c \
445    upstream-freebsd/lib/msun/src/e_exp.c \
446    upstream-freebsd/lib/msun/src/e_hypot.c \
447    upstream-freebsd/lib/msun/src/e_log.c \
448    upstream-freebsd/lib/msun/src/e_log10.c \
449    upstream-freebsd/lib/msun/src/e_pow.c \
450    upstream-freebsd/lib/msun/src/e_sinh.c \
451    upstream-freebsd/lib/msun/src/e_sqrt.c \
452    upstream-freebsd/lib/msun/src/e_sqrtf.c \
453    upstream-freebsd/lib/msun/src/s_atan.c \
454    upstream-freebsd/lib/msun/src/s_cbrt.c \
455    upstream-freebsd/lib/msun/src/s_cos.c \
456    upstream-freebsd/lib/msun/src/s_expm1.c \
457    upstream-freebsd/lib/msun/src/s_log1p.c \
458    upstream-freebsd/lib/msun/src/s_llrint.c \
459    upstream-freebsd/lib/msun/src/s_llrintf.c \
460    upstream-freebsd/lib/msun/src/s_lrint.c \
461    upstream-freebsd/lib/msun/src/s_lrintf.c \
462    upstream-freebsd/lib/msun/src/s_sin.c \
463    upstream-freebsd/lib/msun/src/s_tan.c \
464    upstream-freebsd/lib/msun/src/s_tanh.c \
465
466ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
467LOCAL_SRC_FILES_x86_64 += \
468    x86_64/ceil.S \
469    x86_64/ceilf.S \
470    x86_64/floor.S \
471    x86_64/floorf.S \
472    x86_64/rint.S \
473    x86_64/rintf.S \
474    x86_64/trunc.S \
475    x86_64/truncf.S \
476
477LOCAL_SRC_FILES_EXCLUDE_x86_64 += \
478    upstream-freebsd/lib/msun/src/s_ceil.c \
479    upstream-freebsd/lib/msun/src/s_ceilf.c \
480    upstream-freebsd/lib/msun/src/s_floor.c \
481    upstream-freebsd/lib/msun/src/s_floorf.c \
482    upstream-freebsd/lib/msun/src/s_rint.c \
483    upstream-freebsd/lib/msun/src/s_rintf.c \
484    upstream-freebsd/lib/msun/src/s_trunc.c \
485    upstream-freebsd/lib/msun/src/s_truncf.c \
486
487endif
488
489LOCAL_C_INCLUDES_x86 += $(LOCAL_PATH)/i387
490
491LOCAL_C_INCLUDES += $(LOCAL_PATH)/upstream-freebsd/lib/msun/src/
492LOCAL_C_INCLUDES_64 += $(LOCAL_PATH)/upstream-freebsd/lib/msun/ld128/
493
494LOCAL_CLANG := $(libm_clang)
495LOCAL_ARM_MODE := arm
496LOCAL_CFLAGS := \
497    -D__BIONIC_NO_MATH_INLINES \
498    -DFLT_EVAL_METHOD=0 \
499    -include $(LOCAL_PATH)/freebsd-compat.h \
500    -Werror \
501    -Wno-missing-braces \
502    -Wno-parentheses \
503    -Wno-sign-compare \
504    -Wno-uninitialized \
505    -Wno-unknown-pragmas \
506    -fvisibility=hidden \
507
508LOCAL_ASFLAGS := \
509    -Ibionic/libc \
510
511# Workaround the GCC "(long)fn -> lfn" optimization bug which will result in
512# self recursions for lrint, lrintf, and lrintl.
513# BUG: 14225968
514LOCAL_CFLAGS += \
515    -fno-builtin-rint \
516    -fno-builtin-rintf \
517    -fno-builtin-rintl \
518
519LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
520LOCAL_SANITIZE := never
521include $(BUILD_STATIC_LIBRARY)
522
523# -----------------------------------------------------------------------------
524# libm.so
525# -----------------------------------------------------------------------------
526include $(CLEAR_VARS)
527
528LOCAL_ADDITIONAL_DEPENDENCIES := \
529    $(LOCAL_PATH)/libm.arm.map \
530    $(LOCAL_PATH)/libm.arm64.map \
531    $(LOCAL_PATH)/libm.mips.map \
532    $(LOCAL_PATH)/libm.mips64.map \
533    $(LOCAL_PATH)/libm.x86.map \
534    $(LOCAL_PATH)/libm.x86_64.map \
535
536# TODO: This is to work around b/24465209. Remove after root cause is fixed
537LOCAL_LDFLAGS_arm := -Wl,--hash-style=both
538LOCAL_LDFLAGS_x86 := -Wl,--hash-style=both
539
540LOCAL_LDFLAGS_arm    += -Wl,--version-script,$(LOCAL_PATH)/libm.arm.map
541LOCAL_LDFLAGS_arm64  += -Wl,--version-script,$(LOCAL_PATH)/libm.arm64.map
542LOCAL_LDFLAGS_mips   += -Wl,--version-script,$(LOCAL_PATH)/libm.mips.map
543LOCAL_LDFLAGS_mips64 += -Wl,--version-script,$(LOCAL_PATH)/libm.mips64.map
544LOCAL_LDFLAGS_x86    += -Wl,--version-script,$(LOCAL_PATH)/libm.x86.map
545LOCAL_LDFLAGS_x86_64 += -Wl,--version-script,$(LOCAL_PATH)/libm.x86_64.map
546
547
548LOCAL_MODULE := libm
549LOCAL_CLANG := $(libm_clang)
550LOCAL_SYSTEM_SHARED_LIBRARIES := libc
551LOCAL_WHOLE_STATIC_LIBRARIES := libm
552
553LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
554LOCAL_SANITIZE := never
555
556LOCAL_CXX_STL := none
557
558# We'd really like to do this for all architectures, but since this wasn't done
559# before, these symbols must continue to be exported on LP32 for binary
560# compatibility.
561LOCAL_LDFLAGS_64 := -Wl,--exclude-libs,libgcc.a
562
563include $(BUILD_SHARED_LIBRARY)
564endif
565