Skip to content
Permalink
Browse files

Upgrade libm.

This brings us up to date with FreeBSD HEAD, fixes various bugs, unifies
the set of functions we support on ARM, MIPS, and x86, fixes "long double",
adds ISO C99 support, and adds basic unit tests.

It turns out that our "long double" functions have always been broken
for non-normal numbers. This patch fixes that by not using the upstream
implementations and just forwarding to the regular "double" implementation
instead (since "long double" on Android is just "double" anyway, which is
what BSD doesn't support).

All the tests pass on ARM, MIPS, and x86, plus glibc on x86-64.

Bug: 3169850
Bug: 8012787
Bug: https://code.google.com/p/android/issues/detail?id=6697
Change-Id: If0c343030959c24bfc50d4d21c9530052c581837
  • Loading branch information
enh-google committed Feb 1, 2013
1 parent a990cf5 commit a0ee07829a9ba7e99ef68e8c12551301cc797f0f
Showing with 8,348 additions and 7,946 deletions.
  1. +2 −0 libc/arch-arm/include/machine/_types.h
  2. +2 −0 libc/arch-x86/include/machine/_types.h
  3. +15 −0 libc/include/sys/cdefs.h
  4. +64 −0 libc/tools/check-symbols.py
  5. +241 −216 libm/Android.mk
  6. +16 −4 libm/arm/_fpmath.h
  7. +46 −0 libm/digittoint.c
  8. +68 −0 libm/fake_long_double.c
  9. +1 −1 libm/fpclassify.c
  10. +13 −1 libm/{src → }/fpmath.h
  11. +7 −2 libm/i386/_fpmath.h
  12. +92 −0 libm/include/complex.h
  13. +77 −93 libm/include/math.h
  14. +1 −2 libm/isinf.c
  15. +0 −92 libm/man/acos.3
  16. +0 −82 libm/man/acosh.3
  17. +0 −94 libm/man/asin.3
  18. +0 −78 libm/man/asinh.3
  19. +0 −84 libm/man/atan.3
  20. +0 −187 libm/man/atan2.3
  21. +0 −85 libm/man/atanh.3
  22. +0 −82 libm/man/ceil.3
  23. +0 −96 libm/man/cimag.3
  24. +0 −90 libm/man/copysign.3
  25. +0 −83 libm/man/cos.3
  26. +0 −72 libm/man/cosh.3
  27. +0 −97 libm/man/erf.3
  28. +0 −236 libm/man/exp.3
  29. +0 −87 libm/man/fabs.3
  30. +0 −86 libm/man/fdim.3
  31. +0 −139 libm/man/feclearexcept.3
  32. +0 −98 libm/man/feenableexcept.3
  33. +0 −113 libm/man/fegetenv.3
  34. +0 −83 libm/man/fegetround.3
  35. +0 −289 libm/man/fenv.3
  36. +0 −82 libm/man/floor.3
  37. +0 −116 libm/man/fma.3
  38. +0 −97 libm/man/fmax.3
  39. +0 −87 libm/man/fmod.3
  40. +0 −134 libm/man/hypot.3
  41. +0 −448 libm/man/ieee.3
  42. +0 −93 libm/man/ieee_test.3
  43. +0 −127 libm/man/ilogb.3
  44. +0 −142 libm/man/j0.3
  45. +0 −185 libm/man/lgamma.3
  46. +0 −94 libm/man/lrint.3
  47. +0 −112 libm/man/lround.3
  48. +0 −242 libm/man/math.3
  49. +0 −100 libm/man/nextafter.3
  50. +0 −146 libm/man/remainder.3
  51. +0 −103 libm/man/rint.3
  52. +0 −80 libm/man/round.3
  53. +0 −95 libm/man/scalbn.3
  54. +0 −57 libm/man/signbit.3
  55. +0 −82 libm/man/sin.3
  56. +0 −71 libm/man/sinh.3
  57. +0 −100 libm/man/sqrt.3
  58. +0 −81 libm/man/tan.3
  59. +0 −80 libm/man/tanh.3
  60. +0 −80 libm/man/trunc.3
  61. +1 −1 libm/mips/_fpmath.h
  62. +0 −84 libm/src/e_asinf.c
  63. +0 −22 libm/src/e_ldexpf.c
  64. +0 −87 libm/src/e_log10.c
  65. +0 −55 libm/src/e_log10f.c
  66. +0 −98 libm/src/e_rem_pio2f.c
  67. +0 −304 libm/src/k_rem_pio2.c
  68. +0 −197 libm/src/k_rem_pio2f.c
  69. +0 −92 libm/src/s_cbrt.c
  70. +0 −202 libm/src/s_fma.c
  71. +0 −182 libm/src/s_fmal.c
  72. +0 −11 libm/src/s_llround.c
  73. +0 −11 libm/src/s_llroundf.c
  74. +0 −11 libm/src/s_llroundl.c
  75. +0 −28 libm/src/w_cabs.c
  76. +2 −4 libm/{ → upstream-freebsd/lib/msun}/bsdsrc/b_exp.c
  77. +2 −4 libm/{ → upstream-freebsd/lib/msun}/bsdsrc/b_log.c
  78. +22 −21 libm/{ → upstream-freebsd/lib/msun}/bsdsrc/b_tgamma.c
  79. +1 −1 libm/{ → upstream-freebsd/lib/msun}/bsdsrc/mathimpl.h
  80. +12 −5 libm/{ → upstream-freebsd/lib/msun}/src/e_acos.c
  81. +24 −28 libm/{ → upstream-freebsd/lib/msun}/src/e_acosf.c
  82. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_acosh.c
  83. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_acoshf.c
  84. +87 −0 libm/upstream-freebsd/lib/msun/src/e_acosl.c
  85. +14 −10 libm/{ → upstream-freebsd/lib/msun}/src/e_asin.c
  86. +65 −0 libm/upstream-freebsd/lib/msun/src/e_asinf.c
  87. +77 −0 libm/upstream-freebsd/lib/msun/src/e_asinl.c
  88. +19 −14 libm/{ → upstream-freebsd/lib/msun}/src/e_atan2.c
  89. +12 −13 libm/{ → upstream-freebsd/lib/msun}/src/e_atan2f.c
  90. +120 −0 libm/upstream-freebsd/lib/msun/src/e_atan2l.c
  91. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_atanh.c
  92. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_atanhf.c
  93. +4 −11 libm/{ → upstream-freebsd/lib/msun}/src/e_cosh.c
  94. +4 −8 libm/{ → upstream-freebsd/lib/msun}/src/e_coshf.c
  95. +19 −14 libm/{ → upstream-freebsd/lib/msun}/src/e_exp.c
  96. +24 −22 libm/{ → upstream-freebsd/lib/msun}/src/e_expf.c
  97. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_fmod.c
  98. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_fmodf.c
  99. +149 −0 libm/upstream-freebsd/lib/msun/src/e_fmodl.c
  100. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_gamma.c
  101. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_gamma_r.c
  102. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_gammaf.c
  103. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_gammaf_r.c
  104. +13 −7 libm/{ → upstream-freebsd/lib/msun}/src/e_hypot.c
  105. +8 −8 libm/{ → upstream-freebsd/lib/msun}/src/e_hypotf.c
  106. +124 −0 libm/upstream-freebsd/lib/msun/src/e_hypotl.c
  107. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_j0.c
  108. +5 −7 libm/{ → upstream-freebsd/lib/msun}/src/e_j0f.c
  109. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_j1.c
  110. +3 −5 libm/{ → upstream-freebsd/lib/msun}/src/e_j1f.c
  111. +8 −4 libm/{ → upstream-freebsd/lib/msun}/src/e_jn.c
  112. +9 −6 libm/{ → upstream-freebsd/lib/msun}/src/e_jnf.c
  113. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_lgamma.c
  114. +10 −10 libm/{ → upstream-freebsd/lib/msun}/src/e_lgamma_r.c
  115. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_lgammaf.c
  116. +5 −6 libm/{ → upstream-freebsd/lib/msun}/src/e_lgammaf_r.c
  117. +11 −6 libm/{ → upstream-freebsd/lib/msun}/src/e_log.c
  118. +87 −0 libm/upstream-freebsd/lib/msun/src/e_log10.c
  119. +71 −0 libm/upstream-freebsd/lib/msun/src/e_log10f.c
  120. +110 −0 libm/upstream-freebsd/lib/msun/src/e_log2.c
  121. +81 −0 libm/upstream-freebsd/lib/msun/src/e_log2f.c
  122. +11 −6 libm/{ → upstream-freebsd/lib/msun}/src/e_logf.c
  123. +8 −6 libm/{ → upstream-freebsd/lib/msun}/src/e_pow.c
  124. +10 −8 libm/{ → upstream-freebsd/lib/msun}/src/e_powf.c
  125. +83 −65 libm/{ → upstream-freebsd/lib/msun}/src/e_rem_pio2.c
  126. +84 −0 libm/upstream-freebsd/lib/msun/src/e_rem_pio2f.c
  127. +10 −4 libm/{ → upstream-freebsd/lib/msun}/src/e_remainder.c
  128. +4 −4 libm/{ → upstream-freebsd/lib/msun}/src/e_remainderf.c
  129. +38 −0 libm/upstream-freebsd/lib/msun/src/e_remainderl.c
  130. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_scalb.c
  131. +2 −5 libm/{ → upstream-freebsd/lib/msun}/src/e_scalbf.c
  132. +5 −11 libm/{ → upstream-freebsd/lib/msun}/src/e_sinh.c
  133. +5 −9 libm/{ → upstream-freebsd/lib/msun}/src/e_sinhf.c
  134. +8 −3 libm/{ → upstream-freebsd/lib/msun}/src/e_sqrt.c
  135. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/e_sqrtf.c
  136. +159 −0 libm/upstream-freebsd/lib/msun/src/e_sqrtl.c
  137. +184 −0 libm/upstream-freebsd/lib/msun/src/fenv-softfloat.h
  138. +5 −5 libm/{ → upstream-freebsd/lib/msun}/src/k_cos.c
  139. +3 −4 libm/{ → upstream-freebsd/lib/msun}/src/k_cosf.c
  140. +108 −0 libm/upstream-freebsd/lib/msun/src/k_exp.c
  141. +87 −0 libm/upstream-freebsd/lib/msun/src/k_expf.c
  142. +100 −0 libm/upstream-freebsd/lib/msun/src/k_log.h
  143. +39 −0 libm/upstream-freebsd/lib/msun/src/k_logf.h
  144. +443 −0 libm/upstream-freebsd/lib/msun/src/k_rem_pio2.c
  145. +5 −5 libm/{ → upstream-freebsd/lib/msun}/src/k_sin.c
  146. +3 −4 libm/{ → upstream-freebsd/lib/msun}/src/k_sinf.c
  147. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/k_tan.c
  148. +3 −4 libm/{ → upstream-freebsd/lib/msun}/src/k_tanf.c
  149. +220 −21 libm/{ → upstream-freebsd/lib/msun}/src/math_private.h
  150. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_asinh.c
  151. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_asinhf.c
  152. +11 −6 libm/{ → upstream-freebsd/lib/msun}/src/s_atan.c
  153. +15 −22 libm/{ → upstream-freebsd/lib/msun}/src/s_atanf.c
  154. +85 −0 libm/upstream-freebsd/lib/msun/src/s_atanl.c
  155. +38 −0 libm/upstream-freebsd/lib/msun/src/s_carg.c
  156. +38 −0 libm/upstream-freebsd/lib/msun/src/s_cargf.c
  157. +38 −0 libm/upstream-freebsd/lib/msun/src/s_cargl.c
  158. +117 −0 libm/upstream-freebsd/lib/msun/src/s_cbrt.c
  159. +23 −29 libm/{ → upstream-freebsd/lib/msun}/src/s_cbrtf.c
  160. +143 −0 libm/upstream-freebsd/lib/msun/src/s_cbrtl.c
  161. +155 −0 libm/upstream-freebsd/lib/msun/src/s_ccosh.c
  162. +104 −0 libm/upstream-freebsd/lib/msun/src/s_ccoshf.c
  163. +8 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_ceil.c
  164. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_ceilf.c
  165. +3 −4 libm/{ → upstream-freebsd/lib/msun}/src/s_ceill.c
  166. +89 −0 libm/upstream-freebsd/lib/msun/src/s_cexp.c
  167. +89 −0 libm/upstream-freebsd/lib/msun/src/s_cexpf.c
  168. +5 −2 libm/{ → upstream-freebsd/lib/msun}/src/s_cimag.c
  169. +5 −2 libm/{ → upstream-freebsd/lib/msun}/src/s_cimagf.c
  170. +5 −2 libm/{ → upstream-freebsd/lib/msun}/src/s_cimagl.c
  171. +5 −2 libm/{ → upstream-freebsd/lib/msun}/src/s_conj.c
  172. +5 −2 libm/{ → upstream-freebsd/lib/msun}/src/s_conjf.c
  173. +5 −2 libm/{ → upstream-freebsd/lib/msun}/src/s_conjl.c
  174. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_copysign.c
  175. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_copysignf.c
  176. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_copysignl.c
  177. +11 −4 libm/{ → upstream-freebsd/lib/msun}/src/s_cos.c
  178. +12 −9 libm/{ → upstream-freebsd/lib/msun}/src/s_cosf.c
  179. +95 −0 libm/upstream-freebsd/lib/msun/src/s_cosl.c
  180. +47 −0 libm/upstream-freebsd/lib/msun/src/s_cproj.c
  181. +43 −0 libm/upstream-freebsd/lib/msun/src/s_cprojf.c
  182. +43 −0 libm/upstream-freebsd/lib/msun/src/s_cprojl.c
  183. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_creal.c
  184. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_crealf.c
  185. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_creall.c
  186. +157 −0 libm/upstream-freebsd/lib/msun/src/s_csinh.c
  187. +105 −0 libm/upstream-freebsd/lib/msun/src/s_csinhf.c
  188. +112 −0 libm/upstream-freebsd/lib/msun/src/s_csqrt.c
  189. +88 −0 libm/upstream-freebsd/lib/msun/src/s_csqrtf.c
  190. +108 −0 libm/upstream-freebsd/lib/msun/src/s_csqrtl.c
  191. +144 −0 libm/upstream-freebsd/lib/msun/src/s_ctanh.c
  192. +84 −0 libm/upstream-freebsd/lib/msun/src/s_ctanhf.c
  193. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_erf.c
  194. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_erff.c
  195. +21 −14 libm/{ → upstream-freebsd/lib/msun}/src/s_exp2.c
  196. +19 −24 libm/{ → upstream-freebsd/lib/msun}/src/s_exp2f.c
  197. +15 −18 libm/{ → upstream-freebsd/lib/msun}/src/s_expm1.c
  198. +21 −23 libm/{ → upstream-freebsd/lib/msun}/src/s_expm1f.c
  199. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_fabs.c
  200. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_fabsf.c
  201. 0 libm/{ → upstream-freebsd/lib/msun}/src/s_fabsl.c
  202. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_fdim.c
  203. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_finite.c
  204. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_finitef.c
  205. +8 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_floor.c
  206. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_floorf.c
  207. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_floorl.c
  208. +284 −0 libm/upstream-freebsd/lib/msun/src/s_fma.c
  209. +32 −10 libm/{ → upstream-freebsd/lib/msun}/src/s_fmaf.c
  210. +268 −0 libm/upstream-freebsd/lib/msun/src/s_fmal.c
  211. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_fmax.c
  212. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_fmaxf.c
  213. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_fmaxl.c
  214. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_fmin.c
  215. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_fminf.c
  216. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_fminl.c
  217. +2 −4 libm/{ → upstream-freebsd/lib/msun}/src/s_frexp.c
  218. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_frexpf.c
  219. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_frexpl.c
  220. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_ilogb.c
  221. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_ilogbf.c
  222. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_ilogbl.c
  223. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_isfinite.c
  224. +9 −6 libm/{ → upstream-freebsd/lib/msun}/src/s_isnan.c
  225. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_isnormal.c
  226. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_llrint.c
  227. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_llrintf.c
  228. +9 −0 libm/upstream-freebsd/lib/msun/src/s_llrintl.c
  229. +11 −0 libm/upstream-freebsd/lib/msun/src/s_llround.c
  230. +11 −0 libm/upstream-freebsd/lib/msun/src/s_llroundf.c
  231. +11 −0 libm/upstream-freebsd/lib/msun/src/s_llroundl.c
  232. +13 −6 libm/{ → upstream-freebsd/lib/msun}/src/s_log1p.c
  233. +15 −8 libm/{ → upstream-freebsd/lib/msun}/src/s_log1pf.c
  234. +8 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_logb.c
  235. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_logbf.c
  236. +55 −0 libm/upstream-freebsd/lib/msun/src/s_logbl.c
  237. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_lrint.c
  238. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_lrintf.c
  239. +9 −0 libm/upstream-freebsd/lib/msun/src/s_lrintl.c
  240. +2 −2 libm/{ → upstream-freebsd/lib/msun}/src/s_lround.c
  241. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_lroundf.c
  242. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_lroundl.c
  243. +5 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_modf.c
  244. +4 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_modff.c
  245. +101 −0 libm/upstream-freebsd/lib/msun/src/s_modfl.c
  246. +1 −22 libm/{ → upstream-freebsd/lib/msun}/src/s_nan.c
  247. +2 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_nearbyint.c
  248. +2 −4 libm/{ → upstream-freebsd/lib/msun}/src/s_nextafter.c
  249. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_nextafterf.c
  250. +2 −4 libm/{ → upstream-freebsd/lib/msun}/src/s_nextafterl.c
  251. +4 −5 libm/{ → upstream-freebsd/lib/msun}/src/s_nexttoward.c
  252. +4 −5 libm/{ → upstream-freebsd/lib/msun}/src/s_nexttowardf.c
  253. +12 −6 libm/{ → upstream-freebsd/lib/msun}/src/s_remquo.c
  254. +4 −4 libm/{ → upstream-freebsd/lib/msun}/src/s_remquof.c
  255. +178 −0 libm/upstream-freebsd/lib/msun/src/s_remquol.c
  256. +10 −5 libm/{ → upstream-freebsd/lib/msun}/src/s_rint.c
  257. +8 −7 libm/{ → upstream-freebsd/lib/msun}/src/s_rintf.c
  258. +90 −0 libm/upstream-freebsd/lib/msun/src/s_rintl.c
  259. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_round.c
  260. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_roundf.c
  261. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_roundl.c
  262. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_scalbln.c
  263. +2 −15 libm/{ → upstream-freebsd/lib/msun}/src/s_scalbn.c
  264. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_scalbnf.c
  265. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_scalbnl.c
  266. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_signbit.c
  267. 0 libm/{ → upstream-freebsd/lib/msun}/src/s_signgam.c
  268. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_significand.c
  269. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_significandf.c
  270. +11 −4 libm/{ → upstream-freebsd/lib/msun}/src/s_sin.c
  271. +12 −9 libm/{ → upstream-freebsd/lib/msun}/src/s_sinf.c
  272. +93 −0 libm/upstream-freebsd/lib/msun/src/s_sinl.c
  273. +11 −4 libm/{ → upstream-freebsd/lib/msun}/src/s_tan.c
  274. +9 −6 libm/{ → upstream-freebsd/lib/msun}/src/s_tanf.c
  275. +12 −13 libm/{ → upstream-freebsd/lib/msun}/src/s_tanh.c
  276. +2 −3 libm/{ → upstream-freebsd/lib/msun}/src/s_tanhf.c
  277. +95 −0 libm/upstream-freebsd/lib/msun/src/s_tanl.c
  278. 0 libm/{ → upstream-freebsd/lib/msun}/src/s_tgammaf.c
  279. +8 −2 libm/{ → upstream-freebsd/lib/msun}/src/s_trunc.c
  280. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/s_truncf.c
  281. +4 −4 libm/{ → upstream-freebsd/lib/msun}/src/s_truncl.c
  282. +23 −0 libm/upstream-freebsd/lib/msun/src/w_cabs.c
  283. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/w_cabsf.c
  284. +20 −0 libm/upstream-freebsd/lib/msun/src/w_cabsl.c
  285. 0 libm/{ → upstream-freebsd/lib/msun}/src/w_drem.c
  286. +1 −1 libm/{ → upstream-freebsd/lib/msun}/src/w_dremf.c
  287. +2 −0 tests/Android.mk
  288. +4 −0 tests/fenv_test.cpp
  289. +1,176 −0 tests/math_test.cpp
@@ -87,6 +87,8 @@ typedef unsigned long __psize_t;
/* Standard system types */
typedef int __clock_t;
typedef int __clockid_t;
typedef double __double_t;
typedef float __float_t;
typedef long __ptrdiff_t;
typedef int __time_t;
typedef int __timer_t;
@@ -87,6 +87,8 @@ typedef unsigned long __psize_t;
/* Standard system types */
typedef int __clock_t;
typedef int __clockid_t;
typedef double __double_t;
typedef float __float_t;
typedef long __ptrdiff_t;
typedef int __time_t;
typedef int __timer_t;
@@ -177,6 +177,8 @@
#define __unused /* delete */
#endif

#define __pure2 __attribute__((__const__)) /* Android-added: used by FreeBSD libm */

#if __GNUC_PREREQ__(3, 1)
#define __used __attribute__((__used__))
#else
@@ -313,6 +315,12 @@
#define __purefunc
#endif

#if __GNUC_PREREQ__(3, 1)
#define __always_inline __attribute__((__always_inline__))
#else
#define __always_inline
#endif

/*
* Macros for manipulating "link sets". Link sets are arrays of pointers
* to objects, which are gathered up by the linker.
@@ -510,4 +518,11 @@
#define __BIONIC_FORTIFY_UNKNOWN_SIZE ((size_t) -1)
#endif

/* Android-added: for FreeBSD's libm. */
#define __weak_reference(sym,alias) \
__asm__(".weak " #alias); \
__asm__(".equ " #alias ", " #sym)
#define __strong_reference(sym,aliassym) \
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))

#endif /* !_SYS_CDEFS_H_ */
@@ -0,0 +1,64 @@
#!/usr/bin/python

import glob
import os
import re
import string
import subprocess
import sys

toolchain = os.environ['ANDROID_TOOLCHAIN']
arch = re.sub(r'.*/linux-x86/([^/]+)/.*', r'\1', toolchain)

sys.stderr.write('Checking symbols for arch "%s"...\n' % arch)

def GetSymbols(library, functions_or_variables):
api = '9'
if library == 'libm' and arch == 'arm':
api = '3'
path = '%s/development/ndk/platforms/android-%s/arch-%s/symbols/%s.so.%s.txt' % (os.environ['ANDROID_BUILD_TOP'], api, arch, library, functions_or_variables)
symbols = set()
for line in open(path, 'r'):
symbols.add(line.rstrip())
#sys.stdout.write('%d %s in %s for %s\n' % (len(symbols), functions_or_variables, library, arch))
return symbols

def CheckSymbols(library, functions_or_variables):
expected_symbols = GetSymbols(library, functions_or_variables)

so_file = '%s/system/lib/%s.so' % (os.environ['ANDROID_PRODUCT_OUT'], library)

# Example readelf output:
# 264: 0001623c 4 FUNC GLOBAL DEFAULT 8 cabsf
# 266: 00016244 4 FUNC GLOBAL DEFAULT 8 dremf
# 267: 00019018 4 OBJECT GLOBAL DEFAULT 11 __fe_dfl_env
# 268: 00000000 0 FUNC GLOBAL DEFAULT UND __aeabi_dcmplt


r = re.compile(r' +\d+: [0-9a-f]+ +\d+ (FUNC|OBJECT) +\S+ +\S+ +\d+ (\S+)')

actual_symbols = set()
for line in subprocess.check_output(['readelf', '--dyn-syms', so_file]).split('\n'):
m = r.match(line)
if m:
if m.group(1) == 'FUNC' and functions_or_variables == 'functions':
actual_symbols.add(m.group(2))
elif m.group(1) == 'OBJECT' and functions_or_variables == 'variables':
actual_symbols.add(m.group(2))
#else:
#print 'ignoring: ' % line

missing = expected_symbols - actual_symbols
if len(missing) > 0:
sys.stderr.write('%d missing %s in %s for %s:\n' % (len(missing), functions_or_variables, library, arch))
for miss in sorted(missing):
sys.stderr.write(' %s\n' % miss)

return len(missing) == 0

CheckSymbols("libc", "functions")
CheckSymbols("libc", "variables")
CheckSymbols("libm", "functions")
CheckSymbols("libm", "variables")

sys.exit(0)

0 comments on commit a0ee078

Please sign in to comment.