I came across libgcompat library that also implements all these __*_finite functions - https://github.com/AdelieLinux/gcompat/blob/master/libgcompat/math.c.
In there these use ASSERT_FINITEF to verify if result of the operation is a finite number. So I wonder if our implementations should do it as well. On Thursday, November 22, 2018 at 10:20:08 AM UTC-5, Waldek Kozaczuk wrote: > > Some libraries like x265 fmpeg codec are linked > to reference libc aliases of some math functions like > log*, exp and pow ones. Unfortunately because our > versions of these funcions are provided by musl > and we do not modify musl code we cannot > add aliases by simple weak_alias construct. > > Therefore we add a simple stub file in libc > where we define functions with alias names that delegate > to corresponding functions provided by musl. > > Another alternative would be to copy corresponding > files from musl to libc directory and add weak_alias there. > This would be slightly more performant as we would avoid > unnecessary instructions involved in calling a function. > > Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> > --- > Makefile | 1 + > libc/math/aliases.c | 26 ++++++++++++++++++++++++++ > 2 files changed, 27 insertions(+) > create mode 100644 libc/math/aliases.c > > diff --git a/Makefile b/Makefile > index 2270206b..68043485 100644 > --- a/Makefile > +++ b/Makefile > @@ -1302,6 +1302,7 @@ musl += math/tgammal.o > musl += math/trunc.o > musl += math/truncf.o > musl += math/truncl.o > +libc += math/aliases.o > > # Issue #867: Gcc 4.8.4 has a bug where it optimizes the trivial round- > # related functions incorrectly - it appears to convert calls to any > diff --git a/libc/math/aliases.c b/libc/math/aliases.c > new file mode 100644 > index 00000000..dad3d9fe > --- /dev/null > +++ b/libc/math/aliases.c > @@ -0,0 +1,26 @@ > +#include "libm.h" > + > +double __exp_finite(double x) > +{ > + return exp(x); > +} > + > +double __log10_finite(double x) > +{ > + return log10(x); > +} > + > +double __log2_finite(double x) > +{ > + return log2(x); > +} > + > +double __log_finite(double x) > +{ > + return log(x); > +} > + > +double __pow_finite(double x, double y) > +{ > + return pow(x, y); > +} > -- > 2.19.1 > > -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.