I'm using various things that uses numpy. I have had a problem with long double versions of log functions on x86, and with other functions on arm. I don't actually need these functions, but numpy wraps them and thus the shlib won't load. The numpy package build succeeds. I think it's a bug by inspection that they are missing so the why I care bit is not important.
1) One case is log1pl log2l expm1l being missing in libm. I've worked around that by a too-gross-too-commit kludge that I've appended; basically implementing them by calling the double version. I now realize that I should perhaps instead define aliases, following how long double function are provided on arm, and perhaps actually have code the processes long doubles, perhaps stealing from FreeBSD. 2) The other case is frexpl. It seems the plan is for each function to have a fool impl that is #ifdef HAVE_LONG_DOUBLE, and for the foo impl to have aliases from fool #ifndef HAVE_LONG_DOUBLE. But some of these, include frexpl, are missing. I have appended a patch that adds this. There appear to be multiple similar cases of missing long double variants on arm. 3) I'm boggled at how this works in the sources. s_frexp.c is not included in libm; a comment says it is in libc. I can't find it in C sources or arm assembly. On earmv7hf-el, I find frexp and frexpf in libm and frexp in libc. Trying to rebuild libm and libc after my change results in nothing happening. I would appreciate: clues to how frexp flows from source to libs advice on the right way to address this. ---------------------------------------- frexpl Index: s_frexp.c =================================================================== RCS file: /cvsroot/src/lib/libm/src/s_frexp.c,v retrieving revision 1.13 diff -u -p -r1.13 s_frexp.c --- s_frexp.c 28 Sep 2008 18:54:55 -0000 1.13 +++ s_frexp.c 28 Jun 2023 17:05:46 -0000 @@ -31,6 +31,11 @@ __RCSID("$NetBSD: s_frexp.c,v 1.13 2008/ static const double two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */ +#ifndef __HAVE_LONG_DOUBLE +__strong_alias(_frexpl, frexp) +__weak_alias(frexpl, _frexpl) +#endif + double frexp(double x, int *eptr) { ---------------------------------------- log1pl etc. Index: src/b_exp.c =================================================================== RCS file: /cvsroot/src/lib/libm/src/b_exp.c,v retrieving revision 1.1 diff -u -p -r1.1 b_exp.c --- src/b_exp.c 5 May 2012 17:54:14 -0000 1.1 +++ src/b_exp.c 28 Jun 2023 16:58:41 -0000 @@ -135,3 +135,41 @@ __exp__D(double x, double c) /* exp(INF) is INF, exp(+big#) overflows to INF */ return( finite(x) ? scalb(1.0,5000) : x); } + + +/* + * Fake up long double version to let numpy build, and blow off it + * being more accurate. Put it here because s_log1p.c is really in + * asm. + * gdt, 20220811 + */ +long double +log1pl(long double x) +{ + long double y; + + y = log1p(x); + + return y; +} + +long double +log2l(long double x) +{ + long double y; + + y = log2l(x); + + return y; +} + +long double +expm1l(long double x) +{ + long double y; + + y = expm1l(x); + + return y; +} +