Message ID | 20240327194024.1409677-6-adhemerval.zanella@linaro.org |
---|---|
State | New |
Headers | show |
Series | Fix some libm static issues | expand |
On Wed, Mar 27, 2024 at 12:40 PM Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote: > > The commit 08ddd26814 removed the static exp10 on i386 and m68k with an > empty w_exp10.c (required for the ABIs that uses the newly > implementation). This patch fixes by adding the required symbols on the > arch-specific w_exp{f}_compat.c implementation. > > Checked on i686-linux-gnu and with a build for m68k-linux-gnu. > --- > math/Makefile | 4 +++- > sysdeps/i386/fpu/w_exp10_compat.c | 9 +++++++-- > sysdeps/m68k/m680x0/fpu/w_exp10_compat.c | 9 +++++++-- > 3 files changed, 17 insertions(+), 5 deletions(-) > > diff --git a/math/Makefile b/math/Makefile > index 964bf2be71..f1d210797d 100644 > --- a/math/Makefile > +++ b/math/Makefile > @@ -367,7 +367,9 @@ $(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: libm-test%.inc \ > $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@ > > > -libm-test-funcs-auto-static = > +libm-test-funcs-auto-static = \ > + exp10 \ > + # libm-test-funcs-auto-static This doesn't provide confidence that static libm issues are fixed. I think we should add a configure option to enable static tests for all libm functions. > libm-test-funcs-noauto-static = \ > fmod \ > # libm-test-funcs-noauto-static > diff --git a/sysdeps/i386/fpu/w_exp10_compat.c b/sysdeps/i386/fpu/w_exp10_compat.c > index b53455386e..49a0e03385 100644 > --- a/sysdeps/i386/fpu/w_exp10_compat.c > +++ b/sysdeps/i386/fpu/w_exp10_compat.c > @@ -1,3 +1,8 @@ > /* i386 provides an optimized __ieee754_exp10. */ > -#define NO_COMPAT_NEEDED 1 > -#include <math/w_exp10_compat.c> > +#ifdef SHARED > +# define NO_COMPAT_NEEDED 1 > +# include <math/w_exp10_compat.c> > +#else > +# include <math-type-macros-double.h> > +# include <w_exp10_template.c> > +#endif > diff --git a/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c b/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c > index 0d3e718626..350f2e4b4d 100644 > --- a/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c > +++ b/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c > @@ -1,3 +1,8 @@ > /* m68k provides an optimized __ieee754_exp10. */ > -#define NO_COMPAT_NEEDED 1 > -#include <math/w_exp10_compat.c> > +#ifdef SHARED > +# define NO_COMPAT_NEEDED 1 > +# include <math/w_exp10_compat.c> > +#else > +# include <math-type-macros-double.h> > +# include <w_exp10_template.c> > +#endif > -- > 2.34.1 >
On 27/03/24 16:57, H.J. Lu wrote: > On Wed, Mar 27, 2024 at 12:40 PM Adhemerval Zanella > <adhemerval.zanella@linaro.org> wrote: >> >> The commit 08ddd26814 removed the static exp10 on i386 and m68k with an >> empty w_exp10.c (required for the ABIs that uses the newly >> implementation). This patch fixes by adding the required symbols on the >> arch-specific w_exp{f}_compat.c implementation. >> >> Checked on i686-linux-gnu and with a build for m68k-linux-gnu. >> --- >> math/Makefile | 4 +++- >> sysdeps/i386/fpu/w_exp10_compat.c | 9 +++++++-- >> sysdeps/m68k/m680x0/fpu/w_exp10_compat.c | 9 +++++++-- >> 3 files changed, 17 insertions(+), 5 deletions(-) >> >> diff --git a/math/Makefile b/math/Makefile >> index 964bf2be71..f1d210797d 100644 >> --- a/math/Makefile >> +++ b/math/Makefile >> @@ -367,7 +367,9 @@ $(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: libm-test%.inc \ >> $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@ >> >> >> -libm-test-funcs-auto-static = >> +libm-test-funcs-auto-static = \ >> + exp10 \ >> + # libm-test-funcs-auto-static > > This doesn't provide confidence that static libm issues are fixed. > I think we should add a configure option to enable static tests for > all libm functions. This fixes the issue for exp10 symbol and checks that it can be used on static build for all supported type, which is the purpose of this fix. I do think the testing all static symbol with extra testing are valuable, but I also think it should be done in a different patch/thread. > >> libm-test-funcs-noauto-static = \ >> fmod \ >> # libm-test-funcs-noauto-static >> diff --git a/sysdeps/i386/fpu/w_exp10_compat.c b/sysdeps/i386/fpu/w_exp10_compat.c >> index b53455386e..49a0e03385 100644 >> --- a/sysdeps/i386/fpu/w_exp10_compat.c >> +++ b/sysdeps/i386/fpu/w_exp10_compat.c >> @@ -1,3 +1,8 @@ >> /* i386 provides an optimized __ieee754_exp10. */ >> -#define NO_COMPAT_NEEDED 1 >> -#include <math/w_exp10_compat.c> >> +#ifdef SHARED >> +# define NO_COMPAT_NEEDED 1 >> +# include <math/w_exp10_compat.c> >> +#else >> +# include <math-type-macros-double.h> >> +# include <w_exp10_template.c> >> +#endif >> diff --git a/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c b/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c >> index 0d3e718626..350f2e4b4d 100644 >> --- a/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c >> +++ b/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c >> @@ -1,3 +1,8 @@ >> /* m68k provides an optimized __ieee754_exp10. */ >> -#define NO_COMPAT_NEEDED 1 >> -#include <math/w_exp10_compat.c> >> +#ifdef SHARED >> +# define NO_COMPAT_NEEDED 1 >> +# include <math/w_exp10_compat.c> >> +#else >> +# include <math-type-macros-double.h> >> +# include <w_exp10_template.c> >> +#endif >> -- >> 2.34.1 >> > >
On Wed, 27 Mar 2024, Adhemerval Zanella Netto wrote: > I do think the testing all static symbol with extra testing are valuable, > but I also think it should be done in a different patch/thread. And testing everything with static linking shouldn't need a solution specific to math/ tests; either fixing --disable-shared, or adding an option to build *all* tests as static executables, might make more sense as a way of doing the global testing (as opposed to the tests added in this patch series for the specific bugs fixed).
diff --git a/math/Makefile b/math/Makefile index 964bf2be71..f1d210797d 100644 --- a/math/Makefile +++ b/math/Makefile @@ -367,7 +367,9 @@ $(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: libm-test%.inc \ $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@ -libm-test-funcs-auto-static = +libm-test-funcs-auto-static = \ + exp10 \ + # libm-test-funcs-auto-static libm-test-funcs-noauto-static = \ fmod \ # libm-test-funcs-noauto-static diff --git a/sysdeps/i386/fpu/w_exp10_compat.c b/sysdeps/i386/fpu/w_exp10_compat.c index b53455386e..49a0e03385 100644 --- a/sysdeps/i386/fpu/w_exp10_compat.c +++ b/sysdeps/i386/fpu/w_exp10_compat.c @@ -1,3 +1,8 @@ /* i386 provides an optimized __ieee754_exp10. */ -#define NO_COMPAT_NEEDED 1 -#include <math/w_exp10_compat.c> +#ifdef SHARED +# define NO_COMPAT_NEEDED 1 +# include <math/w_exp10_compat.c> +#else +# include <math-type-macros-double.h> +# include <w_exp10_template.c> +#endif diff --git a/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c b/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c index 0d3e718626..350f2e4b4d 100644 --- a/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c +++ b/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c @@ -1,3 +1,8 @@ /* m68k provides an optimized __ieee754_exp10. */ -#define NO_COMPAT_NEEDED 1 -#include <math/w_exp10_compat.c> +#ifdef SHARED +# define NO_COMPAT_NEEDED 1 +# include <math/w_exp10_compat.c> +#else +# include <math-type-macros-double.h> +# include <w_exp10_template.c> +#endif