* [PATCH v3 0/7] Fix some libm static issues
@ 2024-04-02 14:06 Adhemerval Zanella
2024-04-02 14:06 ` [PATCH v3 1/7] math: Add support for auto static math tests Adhemerval Zanella
` (7 more replies)
0 siblings, 8 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2024-04-02 14:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Joseph Myers, Florian Weimer, H . J . Lu
Some recent math optimizations removed some symbols from the static
build and due to the limited static build check, along with
--disable-shared being broken for some time [1], this issue has slipped
some releases.
Although the fix is straightforward, I added an extra framework to
enable static build for math libraries using the generic type
framework (which autogenerated the tests for all supported types using
the C template files). I have not enabled it for all tests due to the
required extra size constraint, this is done with a new define that
can be used with make check (build-math-static-tests).
As an experiment, I enabled static build for all autogenerated math
tests. This has uncovered some extra missing symbols on some ABIs, along
with some issues with implementation used on static for some ABIs. On
x86_64/i686 it shows that the assembly optimizations for acos, log10,
log2, and ldbl-96 y0/y1 show some issues:
x86_64-linux-gnu$ grep ^FAIL math/subdir-tests.sum
FAIL: math/test-float64x-acos-static
FAIL: math/test-float64x-log10-static
FAIL: math/test-float64x-log2-static
FAIL: math/test-float64x-y0-static
FAIL: math/test-float64x-y1-static
FAIL: math/test-ldouble-acos-static
FAIL: math/test-ldouble-log10-static
FAIL: math/test-ldouble-log2-static
FAIL: math/test-ldouble-y0-static
FAIL: math/test-ldouble-y1-static
i686-linux-gnu$ grep ^FAIL math/subdir-tests.sum
FAIL: math/test-double-atanh-static
FAIL: math/test-float-atanh-static
FAIL: math/test-float32-atanh-static
FAIL: math/test-float32x-atanh-static
FAIL: math/test-float64-atanh-static
FAIL: math/test-float64x-acos-static
FAIL: math/test-float64x-acosh-static
FAIL: math/test-float64x-atanh-static
FAIL: math/test-float64x-log10-static
FAIL: math/test-float64x-log2-static
FAIL: math/test-float64x-y0-static
FAIL: math/test-float64x-y1-static
FAIL: math/test-ldouble-acos-static
FAIL: math/test-ldouble-acosh-static
FAIL: math/test-ldouble-atanh-static
FAIL: math/test-ldouble-log10-static
FAIL: math/test-ldouble-log2-static
FAIL: math/test-ldouble-y0-static
FAIL: math/test-ldouble-y1-static
The powerpc64le also shows multiple issues with the static linking
(using gcc 13.1):
FAIL: math/test-float128-exp10-static
FAIL: math/test-float64x-exp10-static
FAIL: math/test-ibm128-acos-static
FAIL: math/test-ibm128-copysign-static
FAIL: math/test-ibm128-exp10-static
FAIL: math/test-ibm128-fmod-static
FAIL: math/test-ibm128-frexp-static
FAIL: math/test-ibm128-modf-static
[...]
I have not analyzed what is happening, but it might be due to the
'-mabi=ibmlongdouble' along with how libgcc.a was built (I saw some
issues on GCC bugzilla).
I also tested this patchset with build-math-static-tests=yes for all
ABIs, and there is not more build failures.
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=20845
Adhemerval Zanella (7):
math: Add support for auto static math tests
math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)
math: Fix i386 and m68k exp10 on static build
math: Fix isnanf128 static build
math: Provided copysignf128 for static libm on alpha, s390, and
sparcv9
math: Provide frexpf128 for static libm on alpha, s390, and sparcv9
math: Provide modf128 for static libm on alpha, s390, and sparcv9
Makeconfig | 5 +
Makefile.help | 4 +
math/Makefile | 113 +++++++++++++++++++-
math/test-double-static.h | 1 +
math/test-float-static.h | 1 +
math/test-float128-static.h | 1 +
math/test-float32-static.h | 1 +
math/test-float32x-static.h | 1 +
math/test-float64-static.h | 1 +
math/test-float64x-static.h | 1 +
math/test-ibm128-static.h | 1 +
math/test-ldouble-static.h | 1 +
sysdeps/i386/fpu/w_exp10_compat.c | 9 +-
sysdeps/i386/fpu/w_fmod_compat.c | 7 +-
sysdeps/i386/fpu/w_fmodf_compat.c | 7 +-
sysdeps/ieee754/float128/float128_private.h | 2 +-
sysdeps/ieee754/float128/s_isnanf128.c | 4 +
sysdeps/ieee754/ldbl-64-128/s_copysignl.c | 4 +-
sysdeps/ieee754/ldbl-64-128/s_frexpl.c | 4 +-
sysdeps/ieee754/ldbl-64-128/s_modfl.c | 4 +-
sysdeps/ieee754/ldbl-opt/s_ldexpl.c | 4 +-
sysdeps/m68k/m680x0/fpu/w_exp10_compat.c | 9 +-
sysdeps/m68k/m680x0/fpu/w_fmod_compat.c | 5 +-
sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c | 7 +-
24 files changed, 170 insertions(+), 27 deletions(-)
create mode 100644 math/test-double-static.h
create mode 100644 math/test-float-static.h
create mode 100644 math/test-float128-static.h
create mode 100644 math/test-float32-static.h
create mode 100644 math/test-float32x-static.h
create mode 100644 math/test-float64-static.h
create mode 100644 math/test-float64x-static.h
create mode 100644 math/test-ibm128-static.h
create mode 100644 math/test-ldouble-static.h
--
2.34.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 1/7] math: Add support for auto static math tests
2024-04-02 14:06 [PATCH v3 0/7] Fix some libm static issues Adhemerval Zanella
@ 2024-04-02 14:06 ` Adhemerval Zanella
2024-05-20 16:48 ` H.J. Lu
2024-04-02 14:06 ` [PATCH v3 2/7] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488) Adhemerval Zanella
` (6 subsequent siblings)
7 siblings, 1 reply; 31+ messages in thread
From: Adhemerval Zanella @ 2024-04-02 14:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Joseph Myers, Florian Weimer, H . J . Lu
It basically copy the already in place rules for dynamic tests for
auto-generated math functions for all support types. To avoid the
need to duplicate .inc files, a .SECONDEXPANSION rules is adeed for
the gen-libm-test.py generation.
New tests are added on the new rules 'libm-test-funcs-auto-static',
'libm-test-funcs-noauto-static', and 'libm-test-funcs-narrow-static';
similar to the non-static counterparts.
To avoid add extra build and disk requirement, the new math static
tests are only enable with a new define 'build-math-static-tests'.
---
Makeconfig | 5 ++
Makefile.help | 4 ++
math/Makefile | 113 +++++++++++++++++++++++++++++++++++-
math/test-double-static.h | 1 +
math/test-float-static.h | 1 +
math/test-float128-static.h | 1 +
math/test-float32-static.h | 1 +
math/test-float32x-static.h | 1 +
math/test-float64-static.h | 1 +
math/test-float64x-static.h | 1 +
math/test-ibm128-static.h | 1 +
math/test-ldouble-static.h | 1 +
12 files changed, 128 insertions(+), 3 deletions(-)
create mode 100644 math/test-double-static.h
create mode 100644 math/test-float-static.h
create mode 100644 math/test-float128-static.h
create mode 100644 math/test-float32-static.h
create mode 100644 math/test-float32x-static.h
create mode 100644 math/test-float64-static.h
create mode 100644 math/test-float64x-static.h
create mode 100644 math/test-ibm128-static.h
create mode 100644 math/test-ldouble-static.h
diff --git a/Makeconfig b/Makeconfig
index 85e00cef94..9d287da67b 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -742,6 +742,11 @@ run-built-tests = yes
endif
endif
+# Whether to build the static math tests
+ifndef build-math-static-tests
+build-math-static-tests = no
+endif
+
# Whether to stop immediately when a test fails. Nonempty means to
# stop, empty means not to stop.
ifndef stop-on-test-failure
diff --git a/Makefile.help b/Makefile.help
index b49df9c5c9..17e7154797 100644
--- a/Makefile.help
+++ b/Makefile.help
@@ -33,6 +33,10 @@ test
Note that this will rebuild the test if needed, but will not
rebuild what "make all" would have rebuilt.
+build-math-static-tests
+ Enable extra math tests for static linking. Use like this:
+ make test t=math/test-float-exp10-static build-math-static-tests=yes
+
--
Other useful hints:
diff --git a/math/Makefile b/math/Makefile
index 79ef4ebb65..98a98d6851 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -274,8 +274,10 @@ endif
libm-vec-tests = $(addprefix test-,$(libmvec-tests))
libm-test-support = $(foreach t,$(test-types),libm-test-support-$(t))
-test-extras += $(libm-test-support)
-extra-test-objs += $(addsuffix .o, $(libm-test-support))
+libm-test-support-static = $(foreach t,$(test-types),libm-test-support-$(t)-static)
+test-extras += $(libm-test-support) $(libm-test-support-static)
+extra-test-objs += $(addsuffix .o, $(libm-test-support)) \
+ $(addsuffix .o, $(libm-test-support-static))
libm-vec-test-wrappers = $(addsuffix -wrappers, $(libm-vec-tests))
test-extras += $(libm-vec-test-wrappers)
extra-test-objs += $(addsuffix .o, $(libm-vec-test-wrappers))
@@ -305,7 +307,7 @@ libm-test-funcs-noauto = canonicalize ceil cimag conj copysign cproj creal \
nextup remainder remquo rint round roundeven scalb \
scalbln scalbn setpayload setpayloadsig signbit \
significand totalorder totalordermag trunc ufromfp \
- ufromfpx compat_totalorder compat_totalordermag
+ ufromfpx
libm-test-funcs-compat = compat_totalorder compat_totalordermag
libm-test-funcs-narrow = add div fma mul sqrt sub
libm-test-funcs-all = $(libm-test-funcs-auto) $(libm-test-funcs-noauto)
@@ -364,6 +366,71 @@ $(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: libm-test%.inc \
$(make-target-directory)
$(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@
+
+libm-test-funcs-auto-static = \
+ $(libm-test-funcs-auto) \
+ # libm-test-funcs-auto-static
+libm-test-funcs-noauto-static = \
+ $(libm-test-funcs-noauto) \
+ # libm-test-funcs-noauto-static
+libm-test-funcs-narrow-static = \
+ $(libm-test-funcs-narrow) \
+ # libm-test-funcs-narrow-static
+libm-test-funcs-all-static = $(libm-test-funcs-auto-static) $(libm-test-funcs-noauto-static)
+
+libm-test-c-auto-static = $(foreach f,$(libm-test-funcs-auto-static),libm-test-$(f)-static.c)
+libm-test-c-noauto-static = $(foreach f,$(libm-test-funcs-noauto-static),libm-test-$(f)-static.c)
+libm-test-c-narrow-static = $(foreach f,$(libm-test-funcs-narrow-static),\
+ libm-test-narrow-$(f)-static.c)
+generated += $(libm-test-c-auto-static) $(libm-test-c-noauto-static) $(libm-test-c-narrow-static)
+
+libm-tests-normal-static = $(foreach t,$(libm-tests-base-normal),\
+ $(foreach f,$(libm-test-funcs-all-static),\
+ $(t)-$(f)-static))
+libm-tests-narrow-static = $(foreach t,$(libm-tests-base-narrow-static),\
+ $(foreach f,$(libm-test-funcs-narrow-static),\
+ $(t)-$(f)-static))
+libm-tests-vector-static = $(foreach t,$(libmvec-tests-static),\
+ $(foreach f,$($(t)-funcs),test-$(t)-$(f)-static))
+libm-tests-static = $(libm-tests-normal-static) $(libm-tests-narrow-static) $(libm-tests-vector-static)
+libm-tests-for-type-static = $(foreach f,$(libm-test-funcs-all-static),\
+ test-$(1)-$(f)-static test-i$(1)-$(f)-static) \
+ $(filter test-$(1)-%,$(libm-tests-vector-static) \
+ $(libm-tests-narrow-static))
+
+libm-tests.o += $(addsuffix .o,$(libm-tests-static))
+
+ifeq ($(build-math-static-tests),yes)
+tests-static += $(libm-tests-static)
+generated += $(addsuffix .c,$(libm-tests)) \
+ $(foreach t,$(test-types),libm-test-support-$(t)-static.c)
+endif
+
+libm-test-c-auto-obj-static = $(addprefix $(objpfx),$(libm-test-c-auto-static))
+libm-test-c-noauto-obj-static = $(addprefix $(objpfx),$(libm-test-c-noauto-static))
+libm-test-c-narrow-obj-static = $(addprefix $(objpfx),$(libm-test-c-narrow-static))
+
+# Use the same input test definitions for both dynamic and static tests.
+.SECONDEXPANSION:
+$(libm-test-c-noauto-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
+ gen-libm-test.py
+ $(make-target-directory)
+ $(PYTHON) gen-libm-test.py -c $< -a /dev/null -C $@
+
+.SECONDEXPANSION:
+$(libm-test-c-auto-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
+ gen-libm-test.py \
+ auto-libm-test-out$$(subst -static,,%)
+ $(make-target-directory)
+ $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out`echo $* | sed 's/-static//'` -C $@
+
+.SECONDEXPANSION:
+$(libm-test-c-narrow-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
+ gen-libm-test.py \
+ auto-libm-test-out$$(subst -static,,%)
+ $(make-target-directory)
+ $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out`echo $* | sed 's/-static//'` -C $@
+
# Tests for totalorder compat symbols reuse the table of tests as
# processed by gen-libm-test.py, so add dependencies on the generated
# .c files.
@@ -505,6 +572,18 @@ $(foreach t,$(libm-tests-normal),$(objpfx)$(t).c): $(objpfx)test-%.c:
echo "#include <libm-test-$$func.c>"; \
) > $@
+$(foreach t,$(libm-tests-normal-static),$(objpfx)$(t).c): $(objpfx)test-%.c:
+ type_func=$*; \
+ type=$${type_func%%-*}; \
+ func=$${type_func#*-}; \
+ ( \
+ echo "#include <test-$$type.h>"; \
+ echo "#include <test-math-exceptions.h>"; \
+ echo "#include <test-math-errno.h>"; \
+ echo "#include <test-math-scalar.h>"; \
+ echo "#include <libm-test-$$func.c>"; \
+ ) > $@
+
$(foreach t,$(libm-tests-narrow),$(objpfx)$(t).c): $(objpfx)test-%.c:
type_pair_func=$*; \
type_pair=$${type_pair_func%-*}; \
@@ -539,6 +618,13 @@ $(foreach t,$(test-types),\
echo "#include <libm-test-support.c>"; \
) > $@
+$(foreach t,$(test-types),\
+ $(objpfx)libm-test-support-$(t)-static.c): $(objpfx)libm-test-support-%.c:
+ ( \
+ echo "#include <test-$*.h>"; \
+ echo "#include <libm-test-support.c>"; \
+ ) > $@
+
$(addprefix $(objpfx), $(libm-tests.o)): $(objpfx)libm-test-ulps.h
define o-iterator-doit
@@ -548,6 +634,13 @@ endef
object-suffixes-left := $(libm-tests-base)
include $(o-iterator)
+define o-iterator-doit
+$(foreach f,$(libm-test-funcs-all-static),\
+ $(objpfx)$(o)-$(f)-static.o): $(objpfx)$(o)%.o: $(objpfx)libm-test%.c
+endef
+object-suffixes-left := $(libm-tests-base)
+include $(o-iterator)
+
define o-iterator-doit
$(foreach f,$(libm-test-funcs-narrow),\
$(objpfx)$(o)-$(f).o): $(objpfx)$(o)%.o: \
@@ -563,6 +656,13 @@ endef
object-suffixes-left := $(libm-tests-base-normal)
include $(o-iterator)
+define o-iterator-doit
+$(foreach f,$(libm-test-funcs-all-static),\
+ $(objpfx)$(o)-$(f)-static.o): CFLAGS += $(libm-test-no-inline-cflags)
+endef
+object-suffixes-left := $(libm-tests-base-normal)
+include $(o-iterator)
+
define o-iterator-doit
$(foreach f,$(libm-test-funcs-narrow),\
$(objpfx)$(o)-$(f).o): CFLAGS += $(libm-test-no-inline-cflags)
@@ -584,6 +684,13 @@ endef
object-suffixes-left := $(test-types)
include $(o-iterator)
+define o-iterator-doit
+$(addprefix $(objpfx),\
+ $(call libm-tests-for-type-static,$(o))): $(objpfx)libm-test-support-$(o)-static.o
+endef
+object-suffixes-left := $(test-types)
+include $(o-iterator)
+
define o-iterator-doit
$(objpfx)libm-test-support-$(o).o: CFLAGS += $(libm-test-no-inline-cflags)
endef
diff --git a/math/test-double-static.h b/math/test-double-static.h
new file mode 100644
index 0000000000..d53f46819f
--- /dev/null
+++ b/math/test-double-static.h
@@ -0,0 +1 @@
+#include "test-double.h"
diff --git a/math/test-float-static.h b/math/test-float-static.h
new file mode 100644
index 0000000000..7834c9e1f1
--- /dev/null
+++ b/math/test-float-static.h
@@ -0,0 +1 @@
+#include "test-float.h"
diff --git a/math/test-float128-static.h b/math/test-float128-static.h
new file mode 100644
index 0000000000..5f8206456a
--- /dev/null
+++ b/math/test-float128-static.h
@@ -0,0 +1 @@
+#include "test-float128.h"
diff --git a/math/test-float32-static.h b/math/test-float32-static.h
new file mode 100644
index 0000000000..2df27d1ca0
--- /dev/null
+++ b/math/test-float32-static.h
@@ -0,0 +1 @@
+#include "test-float32.h"
diff --git a/math/test-float32x-static.h b/math/test-float32x-static.h
new file mode 100644
index 0000000000..62f78b49d8
--- /dev/null
+++ b/math/test-float32x-static.h
@@ -0,0 +1 @@
+#include "test-float32x.h"
diff --git a/math/test-float64-static.h b/math/test-float64-static.h
new file mode 100644
index 0000000000..807c174df1
--- /dev/null
+++ b/math/test-float64-static.h
@@ -0,0 +1 @@
+#include "test-float64.h"
diff --git a/math/test-float64x-static.h b/math/test-float64x-static.h
new file mode 100644
index 0000000000..a7801dbc10
--- /dev/null
+++ b/math/test-float64x-static.h
@@ -0,0 +1 @@
+#include "test-float64x.h"
diff --git a/math/test-ibm128-static.h b/math/test-ibm128-static.h
new file mode 100644
index 0000000000..b66a57050b
--- /dev/null
+++ b/math/test-ibm128-static.h
@@ -0,0 +1 @@
+#include "test-ibm128.h"
diff --git a/math/test-ldouble-static.h b/math/test-ldouble-static.h
new file mode 100644
index 0000000000..beabedb817
--- /dev/null
+++ b/math/test-ldouble-static.h
@@ -0,0 +1 @@
+#include "test-ldouble.h"
--
2.34.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 2/7] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)
2024-04-02 14:06 [PATCH v3 0/7] Fix some libm static issues Adhemerval Zanella
2024-04-02 14:06 ` [PATCH v3 1/7] math: Add support for auto static math tests Adhemerval Zanella
@ 2024-04-02 14:06 ` Adhemerval Zanella
2024-05-11 9:59 ` Aurelien Jarno
2024-05-21 12:40 ` H.J. Lu
2024-04-02 14:06 ` [PATCH v3 3/7] math: Fix i386 and m68k exp10 on static build Adhemerval Zanella
` (5 subsequent siblings)
7 siblings, 2 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2024-04-02 14:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Joseph Myers, Florian Weimer, H . J . Lu
The commit 16439f419b removed the static fmod/fmodf on i386 and m68k
with and empty w_fmod.c (required for the ABIs that uses the newly
implementation). This patch fixes by adding the required symbols on
the arch-specific w_fmod{f}_compat.c implementation.
To statically build fmod fails on some ABI (alpha, s390, sparc) because
it does not export the ldexpf128, this is also fixed by this patch.
Checked on i686-linux-gnu and with a build for m68k-linux-gnu with
'make test t=math/test-{float,double}-modf-static build-math-static-tests=yes'.
---
sysdeps/i386/fpu/w_fmod_compat.c | 7 ++++---
sysdeps/i386/fpu/w_fmodf_compat.c | 7 ++++---
sysdeps/ieee754/ldbl-opt/s_ldexpl.c | 4 ++--
sysdeps/m68k/m680x0/fpu/w_fmod_compat.c | 5 +++--
sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c | 7 ++++---
5 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/sysdeps/i386/fpu/w_fmod_compat.c b/sysdeps/i386/fpu/w_fmod_compat.c
index 5ac9995ffd..528bfc2a13 100644
--- a/sysdeps/i386/fpu/w_fmod_compat.c
+++ b/sysdeps/i386/fpu/w_fmod_compat.c
@@ -7,8 +7,9 @@
# define LIBM_SVID_COMPAT 1
# undef compat_symbol
# define compat_symbol(a, b, c, d)
-#endif
-#include <math/w_fmod_compat.c>
-#ifdef SHARED
+# include <math/w_fmod_compat.c>
libm_alias_double (__fmod_compat, fmod)
+#else
+#include <math-type-macros-double.h>
+#include <w_fmod_template.c>
#endif
diff --git a/sysdeps/i386/fpu/w_fmodf_compat.c b/sysdeps/i386/fpu/w_fmodf_compat.c
index cc417e07d3..5a61693e51 100644
--- a/sysdeps/i386/fpu/w_fmodf_compat.c
+++ b/sysdeps/i386/fpu/w_fmodf_compat.c
@@ -7,8 +7,9 @@
# define LIBM_SVID_COMPAT 1
# undef compat_symbol
# define compat_symbol(a, b, c, d)
-#endif
-#include <math/w_fmodf_compat.c>
-#ifdef SHARED
+# include <math/w_fmodf_compat.c>
libm_alias_float (__fmod_compat, fmod)
+#else
+#include <math-type-macros-float.h>
+#include <w_fmod_template.c>
#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
index 1afbe7d8ad..932cc4341c 100644
--- a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
+++ b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
@@ -17,13 +17,13 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#if IS_IN (libc)
+#if IS_IN (libc) && defined SHARED
# define declare_mgen_alias(f,t)
#endif
#include <math-type-macros-ldouble.h>
#include <s_ldexp_template.c>
-#if IS_IN (libc)
+#if IS_IN (libc) && defined SHARED
long_double_symbol (libc, __ldexpl, ldexpl);
long_double_symbol (libc, __wrap_scalbnl, scalbnl);
#endif
diff --git a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
index 527d4fbed2..57f38091e6 100644
--- a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
+++ b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
@@ -7,8 +7,9 @@
# define LIBM_SVID_COMPAT 1
# undef compat_symbol
# define compat_symbol(a, b, c, d)
-#endif
#include <math/w_fmod_compat.c>
-#ifdef SHARED
libm_alias_double (__fmod_compat, fmod)
+#else
+#include <math-type-macros-double.h>
+#include <w_fmod_template.c>
#endif
diff --git a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
index 5043586b91..88db07f443 100644
--- a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
+++ b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
@@ -7,8 +7,9 @@
# define LIBM_SVID_COMPAT 1
# undef compat_symbol
# define compat_symbol(a, b, c, d)
-#endif
-#include <math/w_fmodf_compat.c>
-#ifdef SHARED
+# include <math/w_fmodf_compat.c>
libm_alias_float (__fmod_compat, fmod)
+#else
+#include <math-type-macros-float.h>
+#include <w_fmod_template.c>
#endif
--
2.34.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 3/7] math: Fix i386 and m68k exp10 on static build
2024-04-02 14:06 [PATCH v3 0/7] Fix some libm static issues Adhemerval Zanella
2024-04-02 14:06 ` [PATCH v3 1/7] math: Add support for auto static math tests Adhemerval Zanella
2024-04-02 14:06 ` [PATCH v3 2/7] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488) Adhemerval Zanella
@ 2024-04-02 14:06 ` Adhemerval Zanella
2024-05-11 9:59 ` Aurelien Jarno
2024-05-21 12:48 ` H.J. Lu
2024-04-02 14:06 ` [PATCH v3 4/7] math: Fix isnanf128 " Adhemerval Zanella
` (4 subsequent siblings)
7 siblings, 2 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2024-04-02 14:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Joseph Myers, Florian Weimer, H . J . Lu
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 with
'make test t=math/test-{float,double}-exp10-static build-math-static-tests=yes'
---
sysdeps/i386/fpu/w_exp10_compat.c | 9 +++++++--
sysdeps/m68k/m680x0/fpu/w_exp10_compat.c | 9 +++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
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
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 4/7] math: Fix isnanf128 static build
2024-04-02 14:06 [PATCH v3 0/7] Fix some libm static issues Adhemerval Zanella
` (2 preceding siblings ...)
2024-04-02 14:06 ` [PATCH v3 3/7] math: Fix i386 and m68k exp10 on static build Adhemerval Zanella
@ 2024-04-02 14:06 ` Adhemerval Zanella
2024-05-20 16:51 ` H.J. Lu
2024-05-20 21:34 ` H.J. Lu
2024-04-02 14:06 ` [PATCH v3 5/7] math: Provided copysignf128 for static libm on alpha, s390, and sparcv9 Adhemerval Zanella
` (3 subsequent siblings)
7 siblings, 2 replies; 31+ messages in thread
From: Adhemerval Zanella @ 2024-04-02 14:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Joseph Myers, Florian Weimer, H . J . Lu
Some static implementation of float128 routines might call __isnanf128,
which is not provided by the static object.
Checked on x86_64-linux-gnu.
---
sysdeps/ieee754/float128/float128_private.h | 2 +-
sysdeps/ieee754/float128/s_isnanf128.c | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h
index 38a8bdd0fe..672bf3cccf 100644
--- a/sysdeps/ieee754/float128/float128_private.h
+++ b/sysdeps/ieee754/float128/float128_private.h
@@ -352,7 +352,7 @@
#define frexpl frexpf128
#define getpayloadl getpayloadf128
#define isinfl isinff128_do_not_use
-#define isnanl isnanf128_do_not_use
+#define isnanl isnanf128
#define ldexpl ldexpf128
#define llrintl llrintf128
#define llroundl llroundf128
diff --git a/sysdeps/ieee754/float128/s_isnanf128.c b/sysdeps/ieee754/float128/s_isnanf128.c
index 59f71533ce..b73a4e80d7 100644
--- a/sysdeps/ieee754/float128/s_isnanf128.c
+++ b/sysdeps/ieee754/float128/s_isnanf128.c
@@ -11,7 +11,11 @@
#include "../ldbl-128/s_isnanl.c"
#if !IS_IN (libm)
#include <float128-abi.h>
+#ifdef SHARED
hidden_ver (__isnanf128_impl, __isnanf128)
+#else
+strong_alias (__isnanf128_impl, __isnanf128)
+#endif
_weak_alias (__isnanf128_impl, isnanl)
versioned_symbol (libc, __isnanf128_impl, __isnanf128, GLIBC_2_34);
#if (SHLIB_COMPAT (libc, FLOAT128_VERSION_M, GLIBC_2_34))
--
2.34.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 5/7] math: Provided copysignf128 for static libm on alpha, s390, and sparcv9
2024-04-02 14:06 [PATCH v3 0/7] Fix some libm static issues Adhemerval Zanella
` (3 preceding siblings ...)
2024-04-02 14:06 ` [PATCH v3 4/7] math: Fix isnanf128 " Adhemerval Zanella
@ 2024-04-02 14:06 ` Adhemerval Zanella
2024-05-20 16:55 ` H.J. Lu
2024-04-02 14:06 ` [PATCH v3 6/7] math: Provide frexpf128 " Adhemerval Zanella
` (2 subsequent siblings)
7 siblings, 1 reply; 31+ messages in thread
From: Adhemerval Zanella @ 2024-04-02 14:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Joseph Myers, Florian Weimer, H . J . Lu
Checked with a static build for the affected ABIs.
---
sysdeps/ieee754/ldbl-64-128/s_copysignl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sysdeps/ieee754/ldbl-64-128/s_copysignl.c b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
index 11b42d04ba..80137847d3 100644
--- a/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
+++ b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
@@ -1,10 +1,10 @@
#include <math_ldbl_opt.h>
#include <libm-alias-ldouble.h>
-#if IS_IN (libc)
+#if IS_IN (libc) && defined SHARED
# undef libm_alias_ldouble
# define libm_alias_ldouble(from, to)
#endif
#include <sysdeps/ieee754/ldbl-128/s_copysignl.c>
-#if IS_IN (libc)
+#if IS_IN (libc) && defined SHARED
long_double_symbol (libc, __copysignl, copysignl);
#endif
--
2.34.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 6/7] math: Provide frexpf128 for static libm on alpha, s390, and sparcv9
2024-04-02 14:06 [PATCH v3 0/7] Fix some libm static issues Adhemerval Zanella
` (4 preceding siblings ...)
2024-04-02 14:06 ` [PATCH v3 5/7] math: Provided copysignf128 for static libm on alpha, s390, and sparcv9 Adhemerval Zanella
@ 2024-04-02 14:06 ` Adhemerval Zanella
2024-05-20 16:57 ` H.J. Lu
2024-04-02 14:06 ` [PATCH v3 7/7] math: Provide modf128 " Adhemerval Zanella
2024-05-20 16:31 ` [PATCH v3 0/7] Fix some libm static issues Adhemerval Zanella Netto
7 siblings, 1 reply; 31+ messages in thread
From: Adhemerval Zanella @ 2024-04-02 14:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Joseph Myers, Florian Weimer, H . J . Lu
hecked with a build for the affected ABIs.
---
sysdeps/ieee754/ldbl-64-128/s_frexpl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sysdeps/ieee754/ldbl-64-128/s_frexpl.c b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
index 73ac41e40c..f5f7d349f7 100644
--- a/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
+++ b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
@@ -1,10 +1,10 @@
#include <math_ldbl_opt.h>
#include <libm-alias-ldouble.h>
-#if IS_IN (libc)
+#if IS_IN (libc) && defined SHARED
# undef libm_alias_ldouble
# define libm_alias_ldouble(from, to)
#endif
#include <sysdeps/ieee754/ldbl-128/s_frexpl.c>
-#if IS_IN (libc)
+#if IS_IN (libc) && defined SHARED
long_double_symbol (libc, __frexpl, frexpl);
#endif
--
2.34.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v3 7/7] math: Provide modf128 for static libm on alpha, s390, and sparcv9
2024-04-02 14:06 [PATCH v3 0/7] Fix some libm static issues Adhemerval Zanella
` (5 preceding siblings ...)
2024-04-02 14:06 ` [PATCH v3 6/7] math: Provide frexpf128 " Adhemerval Zanella
@ 2024-04-02 14:06 ` Adhemerval Zanella
2024-05-20 16:59 ` H.J. Lu
2024-05-20 16:31 ` [PATCH v3 0/7] Fix some libm static issues Adhemerval Zanella Netto
7 siblings, 1 reply; 31+ messages in thread
From: Adhemerval Zanella @ 2024-04-02 14:06 UTC (permalink / raw)
To: libc-alpha; +Cc: Joseph Myers, Florian Weimer, H . J . Lu
Checked with a build for the affected ABIs
---
sysdeps/ieee754/ldbl-64-128/s_modfl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sysdeps/ieee754/ldbl-64-128/s_modfl.c b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
index 7d7aeae111..ba3d31334a 100644
--- a/sysdeps/ieee754/ldbl-64-128/s_modfl.c
+++ b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
@@ -1,10 +1,10 @@
#include <math_ldbl_opt.h>
#include <libm-alias-ldouble.h>
-#if IS_IN (libc)
+#if IS_IN (libc) && defined SHARED
# undef libm_alias_ldouble
# define libm_alias_ldouble(from, to)
#endif
#include <sysdeps/ieee754/ldbl-128/s_modfl.c>
-#if IS_IN (libc)
+#if IS_IN (libc) && defined SHARED
long_double_symbol (libc, __modfl, modfl);
#endif
--
2.34.1
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 2/7] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)
2024-04-02 14:06 ` [PATCH v3 2/7] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488) Adhemerval Zanella
@ 2024-05-11 9:59 ` Aurelien Jarno
2024-05-21 12:40 ` H.J. Lu
1 sibling, 0 replies; 31+ messages in thread
From: Aurelien Jarno @ 2024-05-11 9:59 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, Joseph Myers, Florian Weimer, H . J . Lu
On 2024-04-02 11:06, Adhemerval Zanella wrote:
> The commit 16439f419b removed the static fmod/fmodf on i386 and m68k
> with and empty w_fmod.c (required for the ABIs that uses the newly
> implementation). This patch fixes by adding the required symbols on
> the arch-specific w_fmod{f}_compat.c implementation.
>
> To statically build fmod fails on some ABI (alpha, s390, sparc) because
> it does not export the ldexpf128, this is also fixed by this patch.
>
> Checked on i686-linux-gnu and with a build for m68k-linux-gnu with
> 'make test t=math/test-{float,double}-modf-static build-math-static-tests=yes'.
> ---
> sysdeps/i386/fpu/w_fmod_compat.c | 7 ++++---
> sysdeps/i386/fpu/w_fmodf_compat.c | 7 ++++---
> sysdeps/ieee754/ldbl-opt/s_ldexpl.c | 4 ++--
> sysdeps/m68k/m680x0/fpu/w_fmod_compat.c | 5 +++--
> sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c | 7 ++++---
> 5 files changed, 17 insertions(+), 13 deletions(-)
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://aurel32.net
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 3/7] math: Fix i386 and m68k exp10 on static build
2024-04-02 14:06 ` [PATCH v3 3/7] math: Fix i386 and m68k exp10 on static build Adhemerval Zanella
@ 2024-05-11 9:59 ` Aurelien Jarno
2024-05-21 12:48 ` H.J. Lu
1 sibling, 0 replies; 31+ messages in thread
From: Aurelien Jarno @ 2024-05-11 9:59 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, Joseph Myers, Florian Weimer, H . J . Lu
On 2024-04-02 11:06, Adhemerval Zanella 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 with
> 'make test t=math/test-{float,double}-exp10-static build-math-static-tests=yes'
> ---
> sysdeps/i386/fpu/w_exp10_compat.c | 9 +++++++--
> sysdeps/m68k/m680x0/fpu/w_exp10_compat.c | 9 +++++++--
> 2 files changed, 14 insertions(+), 4 deletions(-)
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://aurel32.net
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 0/7] Fix some libm static issues
2024-04-02 14:06 [PATCH v3 0/7] Fix some libm static issues Adhemerval Zanella
` (6 preceding siblings ...)
2024-04-02 14:06 ` [PATCH v3 7/7] math: Provide modf128 " Adhemerval Zanella
@ 2024-05-20 16:31 ` Adhemerval Zanella Netto
7 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella Netto @ 2024-05-20 16:31 UTC (permalink / raw)
To: libc-alpha; +Cc: Joseph Myers, Florian Weimer, H . J . Lu
Ping on this serie (the 2/7 and 3/7 were already reviewed).
On 02/04/24 11:06, Adhemerval Zanella wrote:
> Some recent math optimizations removed some symbols from the static
> build and due to the limited static build check, along with
> --disable-shared being broken for some time [1], this issue has slipped
> some releases.
>
> Although the fix is straightforward, I added an extra framework to
> enable static build for math libraries using the generic type
> framework (which autogenerated the tests for all supported types using
> the C template files). I have not enabled it for all tests due to the
> required extra size constraint, this is done with a new define that
> can be used with make check (build-math-static-tests).
>
> As an experiment, I enabled static build for all autogenerated math
> tests. This has uncovered some extra missing symbols on some ABIs, along
> with some issues with implementation used on static for some ABIs. On
> x86_64/i686 it shows that the assembly optimizations for acos, log10,
> log2, and ldbl-96 y0/y1 show some issues:
>
> x86_64-linux-gnu$ grep ^FAIL math/subdir-tests.sum
> FAIL: math/test-float64x-acos-static
> FAIL: math/test-float64x-log10-static
> FAIL: math/test-float64x-log2-static
> FAIL: math/test-float64x-y0-static
> FAIL: math/test-float64x-y1-static
> FAIL: math/test-ldouble-acos-static
> FAIL: math/test-ldouble-log10-static
> FAIL: math/test-ldouble-log2-static
> FAIL: math/test-ldouble-y0-static
> FAIL: math/test-ldouble-y1-static
>
> i686-linux-gnu$ grep ^FAIL math/subdir-tests.sum
> FAIL: math/test-double-atanh-static
> FAIL: math/test-float-atanh-static
> FAIL: math/test-float32-atanh-static
> FAIL: math/test-float32x-atanh-static
> FAIL: math/test-float64-atanh-static
> FAIL: math/test-float64x-acos-static
> FAIL: math/test-float64x-acosh-static
> FAIL: math/test-float64x-atanh-static
> FAIL: math/test-float64x-log10-static
> FAIL: math/test-float64x-log2-static
> FAIL: math/test-float64x-y0-static
> FAIL: math/test-float64x-y1-static
> FAIL: math/test-ldouble-acos-static
> FAIL: math/test-ldouble-acosh-static
> FAIL: math/test-ldouble-atanh-static
> FAIL: math/test-ldouble-log10-static
> FAIL: math/test-ldouble-log2-static
> FAIL: math/test-ldouble-y0-static
> FAIL: math/test-ldouble-y1-static
>
> The powerpc64le also shows multiple issues with the static linking
> (using gcc 13.1):
>
> FAIL: math/test-float128-exp10-static
> FAIL: math/test-float64x-exp10-static
> FAIL: math/test-ibm128-acos-static
> FAIL: math/test-ibm128-copysign-static
> FAIL: math/test-ibm128-exp10-static
> FAIL: math/test-ibm128-fmod-static
> FAIL: math/test-ibm128-frexp-static
> FAIL: math/test-ibm128-modf-static
> [...]
>
> I have not analyzed what is happening, but it might be due to the
> '-mabi=ibmlongdouble' along with how libgcc.a was built (I saw some
> issues on GCC bugzilla).
>
> I also tested this patchset with build-math-static-tests=yes for all
> ABIs, and there is not more build failures.
>
> [1] https://sourceware.org/bugzilla/show_bug.cgi?id=20845
>
> Adhemerval Zanella (7):
> math: Add support for auto static math tests
> math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)
> math: Fix i386 and m68k exp10 on static build
> math: Fix isnanf128 static build
> math: Provided copysignf128 for static libm on alpha, s390, and
> sparcv9
> math: Provide frexpf128 for static libm on alpha, s390, and sparcv9
> math: Provide modf128 for static libm on alpha, s390, and sparcv9
>
> Makeconfig | 5 +
> Makefile.help | 4 +
> math/Makefile | 113 +++++++++++++++++++-
> math/test-double-static.h | 1 +
> math/test-float-static.h | 1 +
> math/test-float128-static.h | 1 +
> math/test-float32-static.h | 1 +
> math/test-float32x-static.h | 1 +
> math/test-float64-static.h | 1 +
> math/test-float64x-static.h | 1 +
> math/test-ibm128-static.h | 1 +
> math/test-ldouble-static.h | 1 +
> sysdeps/i386/fpu/w_exp10_compat.c | 9 +-
> sysdeps/i386/fpu/w_fmod_compat.c | 7 +-
> sysdeps/i386/fpu/w_fmodf_compat.c | 7 +-
> sysdeps/ieee754/float128/float128_private.h | 2 +-
> sysdeps/ieee754/float128/s_isnanf128.c | 4 +
> sysdeps/ieee754/ldbl-64-128/s_copysignl.c | 4 +-
> sysdeps/ieee754/ldbl-64-128/s_frexpl.c | 4 +-
> sysdeps/ieee754/ldbl-64-128/s_modfl.c | 4 +-
> sysdeps/ieee754/ldbl-opt/s_ldexpl.c | 4 +-
> sysdeps/m68k/m680x0/fpu/w_exp10_compat.c | 9 +-
> sysdeps/m68k/m680x0/fpu/w_fmod_compat.c | 5 +-
> sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c | 7 +-
> 24 files changed, 170 insertions(+), 27 deletions(-)
> create mode 100644 math/test-double-static.h
> create mode 100644 math/test-float-static.h
> create mode 100644 math/test-float128-static.h
> create mode 100644 math/test-float32-static.h
> create mode 100644 math/test-float32x-static.h
> create mode 100644 math/test-float64-static.h
> create mode 100644 math/test-float64x-static.h
> create mode 100644 math/test-ibm128-static.h
> create mode 100644 math/test-ldouble-static.h
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 1/7] math: Add support for auto static math tests
2024-04-02 14:06 ` [PATCH v3 1/7] math: Add support for auto static math tests Adhemerval Zanella
@ 2024-05-20 16:48 ` H.J. Lu
2024-05-20 17:21 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 31+ messages in thread
From: H.J. Lu @ 2024-05-20 16:48 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On Tue, Apr 2, 2024 at 7:06 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> It basically copy the already in place rules for dynamic tests for
> auto-generated math functions for all support types. To avoid the
> need to duplicate .inc files, a .SECONDEXPANSION rules is adeed for
> the gen-libm-test.py generation.
>
> New tests are added on the new rules 'libm-test-funcs-auto-static',
> 'libm-test-funcs-noauto-static', and 'libm-test-funcs-narrow-static';
> similar to the non-static counterparts.
>
> To avoid add extra build and disk requirement, the new math static
> tests are only enable with a new define 'build-math-static-tests'.
> ---
> Makeconfig | 5 ++
> Makefile.help | 4 ++
> math/Makefile | 113 +++++++++++++++++++++++++++++++++++-
> math/test-double-static.h | 1 +
> math/test-float-static.h | 1 +
> math/test-float128-static.h | 1 +
> math/test-float32-static.h | 1 +
> math/test-float32x-static.h | 1 +
> math/test-float64-static.h | 1 +
> math/test-float64x-static.h | 1 +
> math/test-ibm128-static.h | 1 +
> math/test-ldouble-static.h | 1 +
> 12 files changed, 128 insertions(+), 3 deletions(-)
> create mode 100644 math/test-double-static.h
> create mode 100644 math/test-float-static.h
> create mode 100644 math/test-float128-static.h
> create mode 100644 math/test-float32-static.h
> create mode 100644 math/test-float32x-static.h
> create mode 100644 math/test-float64-static.h
> create mode 100644 math/test-float64x-static.h
> create mode 100644 math/test-ibm128-static.h
> create mode 100644 math/test-ldouble-static.h
>
> diff --git a/Makeconfig b/Makeconfig
> index 85e00cef94..9d287da67b 100644
> --- a/Makeconfig
> +++ b/Makeconfig
> @@ -742,6 +742,11 @@ run-built-tests = yes
> endif
> endif
>
> +# Whether to build the static math tests
> +ifndef build-math-static-tests
> +build-math-static-tests = no
> +endif
> +
> # Whether to stop immediately when a test fails. Nonempty means to
> # stop, empty means not to stop.
> ifndef stop-on-test-failure
> diff --git a/Makefile.help b/Makefile.help
> index b49df9c5c9..17e7154797 100644
> --- a/Makefile.help
> +++ b/Makefile.help
> @@ -33,6 +33,10 @@ test
> Note that this will rebuild the test if needed, but will not
> rebuild what "make all" would have rebuilt.
>
> +build-math-static-tests
> + Enable extra math tests for static linking. Use like this:
> + make test t=math/test-float-exp10-static build-math-static-tests=yes
> +
> --
> Other useful hints:
>
> diff --git a/math/Makefile b/math/Makefile
> index 79ef4ebb65..98a98d6851 100644
> --- a/math/Makefile
> +++ b/math/Makefile
> @@ -274,8 +274,10 @@ endif
>
> libm-vec-tests = $(addprefix test-,$(libmvec-tests))
> libm-test-support = $(foreach t,$(test-types),libm-test-support-$(t))
> -test-extras += $(libm-test-support)
> -extra-test-objs += $(addsuffix .o, $(libm-test-support))
> +libm-test-support-static = $(foreach t,$(test-types),libm-test-support-$(t)-static)
> +test-extras += $(libm-test-support) $(libm-test-support-static)
> +extra-test-objs += $(addsuffix .o, $(libm-test-support)) \
> + $(addsuffix .o, $(libm-test-support-static))
> libm-vec-test-wrappers = $(addsuffix -wrappers, $(libm-vec-tests))
> test-extras += $(libm-vec-test-wrappers)
> extra-test-objs += $(addsuffix .o, $(libm-vec-test-wrappers))
> @@ -305,7 +307,7 @@ libm-test-funcs-noauto = canonicalize ceil cimag conj copysign cproj creal \
> nextup remainder remquo rint round roundeven scalb \
> scalbln scalbn setpayload setpayloadsig signbit \
> significand totalorder totalordermag trunc ufromfp \
> - ufromfpx compat_totalorder compat_totalordermag
> + ufromfpx
Please submit a separate patch to sort Makefile first.
> libm-test-funcs-compat = compat_totalorder compat_totalordermag
> libm-test-funcs-narrow = add div fma mul sqrt sub
> libm-test-funcs-all = $(libm-test-funcs-auto) $(libm-test-funcs-noauto)
> @@ -364,6 +366,71 @@ $(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: libm-test%.inc \
> $(make-target-directory)
> $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@
>
> +
> +libm-test-funcs-auto-static = \
> + $(libm-test-funcs-auto) \
> + # libm-test-funcs-auto-static
> +libm-test-funcs-noauto-static = \
> + $(libm-test-funcs-noauto) \
> + # libm-test-funcs-noauto-static
> +libm-test-funcs-narrow-static = \
> + $(libm-test-funcs-narrow) \
> + # libm-test-funcs-narrow-static
> +libm-test-funcs-all-static = $(libm-test-funcs-auto-static) $(libm-test-funcs-noauto-static)
> +
> +libm-test-c-auto-static = $(foreach f,$(libm-test-funcs-auto-static),libm-test-$(f)-static.c)
> +libm-test-c-noauto-static = $(foreach f,$(libm-test-funcs-noauto-static),libm-test-$(f)-static.c)
> +libm-test-c-narrow-static = $(foreach f,$(libm-test-funcs-narrow-static),\
> + libm-test-narrow-$(f)-static.c)
> +generated += $(libm-test-c-auto-static) $(libm-test-c-noauto-static) $(libm-test-c-narrow-static)
> +
> +libm-tests-normal-static = $(foreach t,$(libm-tests-base-normal),\
> + $(foreach f,$(libm-test-funcs-all-static),\
> + $(t)-$(f)-static))
> +libm-tests-narrow-static = $(foreach t,$(libm-tests-base-narrow-static),\
> + $(foreach f,$(libm-test-funcs-narrow-static),\
> + $(t)-$(f)-static))
> +libm-tests-vector-static = $(foreach t,$(libmvec-tests-static),\
> + $(foreach f,$($(t)-funcs),test-$(t)-$(f)-static))
> +libm-tests-static = $(libm-tests-normal-static) $(libm-tests-narrow-static) $(libm-tests-vector-static)
> +libm-tests-for-type-static = $(foreach f,$(libm-test-funcs-all-static),\
> + test-$(1)-$(f)-static test-i$(1)-$(f)-static) \
> + $(filter test-$(1)-%,$(libm-tests-vector-static) \
> + $(libm-tests-narrow-static))
> +
> +libm-tests.o += $(addsuffix .o,$(libm-tests-static))
> +
> +ifeq ($(build-math-static-tests),yes)
> +tests-static += $(libm-tests-static)
> +generated += $(addsuffix .c,$(libm-tests)) \
> + $(foreach t,$(test-types),libm-test-support-$(t)-static.c)
> +endif
> +
> +libm-test-c-auto-obj-static = $(addprefix $(objpfx),$(libm-test-c-auto-static))
> +libm-test-c-noauto-obj-static = $(addprefix $(objpfx),$(libm-test-c-noauto-static))
> +libm-test-c-narrow-obj-static = $(addprefix $(objpfx),$(libm-test-c-narrow-static))
> +
> +# Use the same input test definitions for both dynamic and static tests.
> +.SECONDEXPANSION:
> +$(libm-test-c-noauto-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
> + gen-libm-test.py
> + $(make-target-directory)
> + $(PYTHON) gen-libm-test.py -c $< -a /dev/null -C $@
> +
> +.SECONDEXPANSION:
> +$(libm-test-c-auto-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
> + gen-libm-test.py \
> + auto-libm-test-out$$(subst -static,,%)
> + $(make-target-directory)
> + $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out`echo $* | sed 's/-static//'` -C $@
> +
> +.SECONDEXPANSION:
> +$(libm-test-c-narrow-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
> + gen-libm-test.py \
> + auto-libm-test-out$$(subst -static,,%)
> + $(make-target-directory)
> + $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out`echo $* | sed 's/-static//'` -C $@
> +
> # Tests for totalorder compat symbols reuse the table of tests as
> # processed by gen-libm-test.py, so add dependencies on the generated
> # .c files.
> @@ -505,6 +572,18 @@ $(foreach t,$(libm-tests-normal),$(objpfx)$(t).c): $(objpfx)test-%.c:
> echo "#include <libm-test-$$func.c>"; \
> ) > $@
>
> +$(foreach t,$(libm-tests-normal-static),$(objpfx)$(t).c): $(objpfx)test-%.c:
> + type_func=$*; \
> + type=$${type_func%%-*}; \
> + func=$${type_func#*-}; \
> + ( \
> + echo "#include <test-$$type.h>"; \
> + echo "#include <test-math-exceptions.h>"; \
> + echo "#include <test-math-errno.h>"; \
> + echo "#include <test-math-scalar.h>"; \
> + echo "#include <libm-test-$$func.c>"; \
> + ) > $@
> +
> $(foreach t,$(libm-tests-narrow),$(objpfx)$(t).c): $(objpfx)test-%.c:
> type_pair_func=$*; \
> type_pair=$${type_pair_func%-*}; \
> @@ -539,6 +618,13 @@ $(foreach t,$(test-types),\
> echo "#include <libm-test-support.c>"; \
> ) > $@
>
> +$(foreach t,$(test-types),\
> + $(objpfx)libm-test-support-$(t)-static.c): $(objpfx)libm-test-support-%.c:
> + ( \
> + echo "#include <test-$*.h>"; \
> + echo "#include <libm-test-support.c>"; \
> + ) > $@
> +
> $(addprefix $(objpfx), $(libm-tests.o)): $(objpfx)libm-test-ulps.h
>
> define o-iterator-doit
> @@ -548,6 +634,13 @@ endef
> object-suffixes-left := $(libm-tests-base)
> include $(o-iterator)
>
> +define o-iterator-doit
> +$(foreach f,$(libm-test-funcs-all-static),\
> + $(objpfx)$(o)-$(f)-static.o): $(objpfx)$(o)%.o: $(objpfx)libm-test%.c
> +endef
> +object-suffixes-left := $(libm-tests-base)
> +include $(o-iterator)
> +
> define o-iterator-doit
> $(foreach f,$(libm-test-funcs-narrow),\
> $(objpfx)$(o)-$(f).o): $(objpfx)$(o)%.o: \
> @@ -563,6 +656,13 @@ endef
> object-suffixes-left := $(libm-tests-base-normal)
> include $(o-iterator)
>
> +define o-iterator-doit
> +$(foreach f,$(libm-test-funcs-all-static),\
> + $(objpfx)$(o)-$(f)-static.o): CFLAGS += $(libm-test-no-inline-cflags)
> +endef
> +object-suffixes-left := $(libm-tests-base-normal)
> +include $(o-iterator)
> +
> define o-iterator-doit
> $(foreach f,$(libm-test-funcs-narrow),\
> $(objpfx)$(o)-$(f).o): CFLAGS += $(libm-test-no-inline-cflags)
> @@ -584,6 +684,13 @@ endef
> object-suffixes-left := $(test-types)
> include $(o-iterator)
>
> +define o-iterator-doit
> +$(addprefix $(objpfx),\
> + $(call libm-tests-for-type-static,$(o))): $(objpfx)libm-test-support-$(o)-static.o
> +endef
> +object-suffixes-left := $(test-types)
> +include $(o-iterator)
> +
> define o-iterator-doit
> $(objpfx)libm-test-support-$(o).o: CFLAGS += $(libm-test-no-inline-cflags)
> endef
> diff --git a/math/test-double-static.h b/math/test-double-static.h
> new file mode 100644
> index 0000000000..d53f46819f
> --- /dev/null
> +++ b/math/test-double-static.h
> @@ -0,0 +1 @@
> +#include "test-double.h"
> diff --git a/math/test-float-static.h b/math/test-float-static.h
> new file mode 100644
> index 0000000000..7834c9e1f1
> --- /dev/null
> +++ b/math/test-float-static.h
> @@ -0,0 +1 @@
> +#include "test-float.h"
> diff --git a/math/test-float128-static.h b/math/test-float128-static.h
> new file mode 100644
> index 0000000000..5f8206456a
> --- /dev/null
> +++ b/math/test-float128-static.h
> @@ -0,0 +1 @@
> +#include "test-float128.h"
> diff --git a/math/test-float32-static.h b/math/test-float32-static.h
> new file mode 100644
> index 0000000000..2df27d1ca0
> --- /dev/null
> +++ b/math/test-float32-static.h
> @@ -0,0 +1 @@
> +#include "test-float32.h"
> diff --git a/math/test-float32x-static.h b/math/test-float32x-static.h
> new file mode 100644
> index 0000000000..62f78b49d8
> --- /dev/null
> +++ b/math/test-float32x-static.h
> @@ -0,0 +1 @@
> +#include "test-float32x.h"
> diff --git a/math/test-float64-static.h b/math/test-float64-static.h
> new file mode 100644
> index 0000000000..807c174df1
> --- /dev/null
> +++ b/math/test-float64-static.h
> @@ -0,0 +1 @@
> +#include "test-float64.h"
> diff --git a/math/test-float64x-static.h b/math/test-float64x-static.h
> new file mode 100644
> index 0000000000..a7801dbc10
> --- /dev/null
> +++ b/math/test-float64x-static.h
> @@ -0,0 +1 @@
> +#include "test-float64x.h"
> diff --git a/math/test-ibm128-static.h b/math/test-ibm128-static.h
> new file mode 100644
> index 0000000000..b66a57050b
> --- /dev/null
> +++ b/math/test-ibm128-static.h
> @@ -0,0 +1 @@
> +#include "test-ibm128.h"
> diff --git a/math/test-ldouble-static.h b/math/test-ldouble-static.h
> new file mode 100644
> index 0000000000..beabedb817
> --- /dev/null
> +++ b/math/test-ldouble-static.h
> @@ -0,0 +1 @@
> +#include "test-ldouble.h"
> --
> 2.34.1
>
--
H.J.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 4/7] math: Fix isnanf128 static build
2024-04-02 14:06 ` [PATCH v3 4/7] math: Fix isnanf128 " Adhemerval Zanella
@ 2024-05-20 16:51 ` H.J. Lu
2024-05-20 18:53 ` Adhemerval Zanella Netto
2024-05-20 21:34 ` H.J. Lu
1 sibling, 1 reply; 31+ messages in thread
From: H.J. Lu @ 2024-05-20 16:51 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On Tue, Apr 2, 2024 at 7:06 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> Some static implementation of float128 routines might call __isnanf128,
Which targets do this?
> which is not provided by the static object.
>
> Checked on x86_64-linux-gnu.
> ---
> sysdeps/ieee754/float128/float128_private.h | 2 +-
> sysdeps/ieee754/float128/s_isnanf128.c | 4 ++++
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h
> index 38a8bdd0fe..672bf3cccf 100644
> --- a/sysdeps/ieee754/float128/float128_private.h
> +++ b/sysdeps/ieee754/float128/float128_private.h
> @@ -352,7 +352,7 @@
> #define frexpl frexpf128
> #define getpayloadl getpayloadf128
> #define isinfl isinff128_do_not_use
> -#define isnanl isnanf128_do_not_use
> +#define isnanl isnanf128
> #define ldexpl ldexpf128
> #define llrintl llrintf128
> #define llroundl llroundf128
> diff --git a/sysdeps/ieee754/float128/s_isnanf128.c b/sysdeps/ieee754/float128/s_isnanf128.c
> index 59f71533ce..b73a4e80d7 100644
> --- a/sysdeps/ieee754/float128/s_isnanf128.c
> +++ b/sysdeps/ieee754/float128/s_isnanf128.c
> @@ -11,7 +11,11 @@
> #include "../ldbl-128/s_isnanl.c"
> #if !IS_IN (libm)
> #include <float128-abi.h>
> +#ifdef SHARED
> hidden_ver (__isnanf128_impl, __isnanf128)
> +#else
> +strong_alias (__isnanf128_impl, __isnanf128)
> +#endif
> _weak_alias (__isnanf128_impl, isnanl)
> versioned_symbol (libc, __isnanf128_impl, __isnanf128, GLIBC_2_34);
> #if (SHLIB_COMPAT (libc, FLOAT128_VERSION_M, GLIBC_2_34))
> --
> 2.34.1
>
--
H.J.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 5/7] math: Provided copysignf128 for static libm on alpha, s390, and sparcv9
2024-04-02 14:06 ` [PATCH v3 5/7] math: Provided copysignf128 for static libm on alpha, s390, and sparcv9 Adhemerval Zanella
@ 2024-05-20 16:55 ` H.J. Lu
2024-05-20 19:04 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 31+ messages in thread
From: H.J. Lu @ 2024-05-20 16:55 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On Tue, Apr 2, 2024 at 7:07 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> Checked with a static build for the affected ABIs.
> ---
> sysdeps/ieee754/ldbl-64-128/s_copysignl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sysdeps/ieee754/ldbl-64-128/s_copysignl.c b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
> index 11b42d04ba..80137847d3 100644
> --- a/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
> +++ b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
> @@ -1,10 +1,10 @@
> #include <math_ldbl_opt.h>
> #include <libm-alias-ldouble.h>
> -#if IS_IN (libc)
> +#if IS_IN (libc) && defined SHARED
> # undef libm_alias_ldouble
> # define libm_alias_ldouble(from, to)
> #endif
> #include <sysdeps/ieee754/ldbl-128/s_copysignl.c>
> -#if IS_IN (libc)
> +#if IS_IN (libc) && defined SHARED
Doesn't this remove copysignl from libm.a?
> long_double_symbol (libc, __copysignl, copysignl);
> #endif
> --
> 2.34.1
>
--
H.J.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 6/7] math: Provide frexpf128 for static libm on alpha, s390, and sparcv9
2024-04-02 14:06 ` [PATCH v3 6/7] math: Provide frexpf128 " Adhemerval Zanella
@ 2024-05-20 16:57 ` H.J. Lu
2024-05-20 19:06 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 31+ messages in thread
From: H.J. Lu @ 2024-05-20 16:57 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On Tue, Apr 2, 2024 at 7:07 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> hecked with a build for the affected ABIs.
> ---
> sysdeps/ieee754/ldbl-64-128/s_frexpl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sysdeps/ieee754/ldbl-64-128/s_frexpl.c b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
> index 73ac41e40c..f5f7d349f7 100644
> --- a/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
> +++ b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
> @@ -1,10 +1,10 @@
> #include <math_ldbl_opt.h>
> #include <libm-alias-ldouble.h>
> -#if IS_IN (libc)
> +#if IS_IN (libc) && defined SHARED
> # undef libm_alias_ldouble
> # define libm_alias_ldouble(from, to)
> #endif
> #include <sysdeps/ieee754/ldbl-128/s_frexpl.c>
> -#if IS_IN (libc)
> +#if IS_IN (libc) && defined SHARED
> long_double_symbol (libc, __frexpl, frexpl);
Doesn't this remove frexpl from libm.a?
> #endif
> --
> 2.34.1
>
--
H.J.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 7/7] math: Provide modf128 for static libm on alpha, s390, and sparcv9
2024-04-02 14:06 ` [PATCH v3 7/7] math: Provide modf128 " Adhemerval Zanella
@ 2024-05-20 16:59 ` H.J. Lu
2024-05-20 19:07 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 31+ messages in thread
From: H.J. Lu @ 2024-05-20 16:59 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On Tue, Apr 2, 2024 at 7:07 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> Checked with a build for the affected ABIs
> ---
> sysdeps/ieee754/ldbl-64-128/s_modfl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sysdeps/ieee754/ldbl-64-128/s_modfl.c b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
> index 7d7aeae111..ba3d31334a 100644
> --- a/sysdeps/ieee754/ldbl-64-128/s_modfl.c
> +++ b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
> @@ -1,10 +1,10 @@
> #include <math_ldbl_opt.h>
> #include <libm-alias-ldouble.h>
> -#if IS_IN (libc)
> +#if IS_IN (libc) && defined SHARED
> # undef libm_alias_ldouble
> # define libm_alias_ldouble(from, to)
> #endif
> #include <sysdeps/ieee754/ldbl-128/s_modfl.c>
> -#if IS_IN (libc)
> +#if IS_IN (libc) && defined SHARED
> long_double_symbol (libc, __modfl, modfl);
Doesn't this remove modfl from static library?
> #endif
> --
> 2.34.1
>
--
H.J.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 1/7] math: Add support for auto static math tests
2024-05-20 16:48 ` H.J. Lu
@ 2024-05-20 17:21 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella Netto @ 2024-05-20 17:21 UTC (permalink / raw)
To: H.J. Lu; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On 20/05/24 13:48, H.J. Lu wrote:
> On Tue, Apr 2, 2024 at 7:06 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>> It basically copy the already in place rules for dynamic tests for
>> auto-generated math functions for all support types. To avoid the
>> need to duplicate .inc files, a .SECONDEXPANSION rules is adeed for
>> the gen-libm-test.py generation.
>>
>> New tests are added on the new rules 'libm-test-funcs-auto-static',
>> 'libm-test-funcs-noauto-static', and 'libm-test-funcs-narrow-static';
>> similar to the non-static counterparts.
>>
>> To avoid add extra build and disk requirement, the new math static
>> tests are only enable with a new define 'build-math-static-tests'.
>> ---
>> Makeconfig | 5 ++
>> Makefile.help | 4 ++
>> math/Makefile | 113 +++++++++++++++++++++++++++++++++++-
>> math/test-double-static.h | 1 +
>> math/test-float-static.h | 1 +
>> math/test-float128-static.h | 1 +
>> math/test-float32-static.h | 1 +
>> math/test-float32x-static.h | 1 +
>> math/test-float64-static.h | 1 +
>> math/test-float64x-static.h | 1 +
>> math/test-ibm128-static.h | 1 +
>> math/test-ldouble-static.h | 1 +
>> 12 files changed, 128 insertions(+), 3 deletions(-)
>> create mode 100644 math/test-double-static.h
>> create mode 100644 math/test-float-static.h
>> create mode 100644 math/test-float128-static.h
>> create mode 100644 math/test-float32-static.h
>> create mode 100644 math/test-float32x-static.h
>> create mode 100644 math/test-float64-static.h
>> create mode 100644 math/test-float64x-static.h
>> create mode 100644 math/test-ibm128-static.h
>> create mode 100644 math/test-ldouble-static.h
>>
>> diff --git a/Makeconfig b/Makeconfig
>> index 85e00cef94..9d287da67b 100644
>> --- a/Makeconfig
>> +++ b/Makeconfig
>> @@ -742,6 +742,11 @@ run-built-tests = yes
>> endif
>> endif
>>
>> +# Whether to build the static math tests
>> +ifndef build-math-static-tests
>> +build-math-static-tests = no
>> +endif
>> +
>> # Whether to stop immediately when a test fails. Nonempty means to
>> # stop, empty means not to stop.
>> ifndef stop-on-test-failure
>> diff --git a/Makefile.help b/Makefile.help
>> index b49df9c5c9..17e7154797 100644
>> --- a/Makefile.help
>> +++ b/Makefile.help
>> @@ -33,6 +33,10 @@ test
>> Note that this will rebuild the test if needed, but will not
>> rebuild what "make all" would have rebuilt.
>>
>> +build-math-static-tests
>> + Enable extra math tests for static linking. Use like this:
>> + make test t=math/test-float-exp10-static build-math-static-tests=yes
>> +
>> --
>> Other useful hints:
>>
>> diff --git a/math/Makefile b/math/Makefile
>> index 79ef4ebb65..98a98d6851 100644
>> --- a/math/Makefile
>> +++ b/math/Makefile
>> @@ -274,8 +274,10 @@ endif
>>
>> libm-vec-tests = $(addprefix test-,$(libmvec-tests))
>> libm-test-support = $(foreach t,$(test-types),libm-test-support-$(t))
>> -test-extras += $(libm-test-support)
>> -extra-test-objs += $(addsuffix .o, $(libm-test-support))
>> +libm-test-support-static = $(foreach t,$(test-types),libm-test-support-$(t)-static)
>> +test-extras += $(libm-test-support) $(libm-test-support-static)
>> +extra-test-objs += $(addsuffix .o, $(libm-test-support)) \
>> + $(addsuffix .o, $(libm-test-support-static))
>> libm-vec-test-wrappers = $(addsuffix -wrappers, $(libm-vec-tests))
>> test-extras += $(libm-vec-test-wrappers)
>> extra-test-objs += $(addsuffix .o, $(libm-vec-test-wrappers))
>> @@ -305,7 +307,7 @@ libm-test-funcs-noauto = canonicalize ceil cimag conj copysign cproj creal \
>> nextup remainder remquo rint round roundeven scalb \
>> scalbln scalbn setpayload setpayloadsig signbit \
>> significand totalorder totalordermag trunc ufromfp \
>> - ufromfpx compat_totalorder compat_totalordermag
>> + ufromfpx
>
> Please submit a separate patch to sort Makefile first.
The Makefile is already sorted since c0d59e3e0da12b294b85acf055e6e75b18d8dd2a,
I will rebase and send a new version.
>
>> libm-test-funcs-compat = compat_totalorder compat_totalordermag
>> libm-test-funcs-narrow = add div fma mul sqrt sub
>> libm-test-funcs-all = $(libm-test-funcs-auto) $(libm-test-funcs-noauto)
>> @@ -364,6 +366,71 @@ $(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: libm-test%.inc \
>> $(make-target-directory)
>> $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@
>>
>> +
>> +libm-test-funcs-auto-static = \
>> + $(libm-test-funcs-auto) \
>> + # libm-test-funcs-auto-static
>> +libm-test-funcs-noauto-static = \
>> + $(libm-test-funcs-noauto) \
>> + # libm-test-funcs-noauto-static
>> +libm-test-funcs-narrow-static = \
>> + $(libm-test-funcs-narrow) \
>> + # libm-test-funcs-narrow-static
>> +libm-test-funcs-all-static = $(libm-test-funcs-auto-static) $(libm-test-funcs-noauto-static)
>> +
>> +libm-test-c-auto-static = $(foreach f,$(libm-test-funcs-auto-static),libm-test-$(f)-static.c)
>> +libm-test-c-noauto-static = $(foreach f,$(libm-test-funcs-noauto-static),libm-test-$(f)-static.c)
>> +libm-test-c-narrow-static = $(foreach f,$(libm-test-funcs-narrow-static),\
>> + libm-test-narrow-$(f)-static.c)
>> +generated += $(libm-test-c-auto-static) $(libm-test-c-noauto-static) $(libm-test-c-narrow-static)
>> +
>> +libm-tests-normal-static = $(foreach t,$(libm-tests-base-normal),\
>> + $(foreach f,$(libm-test-funcs-all-static),\
>> + $(t)-$(f)-static))
>> +libm-tests-narrow-static = $(foreach t,$(libm-tests-base-narrow-static),\
>> + $(foreach f,$(libm-test-funcs-narrow-static),\
>> + $(t)-$(f)-static))
>> +libm-tests-vector-static = $(foreach t,$(libmvec-tests-static),\
>> + $(foreach f,$($(t)-funcs),test-$(t)-$(f)-static))
>> +libm-tests-static = $(libm-tests-normal-static) $(libm-tests-narrow-static) $(libm-tests-vector-static)
>> +libm-tests-for-type-static = $(foreach f,$(libm-test-funcs-all-static),\
>> + test-$(1)-$(f)-static test-i$(1)-$(f)-static) \
>> + $(filter test-$(1)-%,$(libm-tests-vector-static) \
>> + $(libm-tests-narrow-static))
>> +
>> +libm-tests.o += $(addsuffix .o,$(libm-tests-static))
>> +
>> +ifeq ($(build-math-static-tests),yes)
>> +tests-static += $(libm-tests-static)
>> +generated += $(addsuffix .c,$(libm-tests)) \
>> + $(foreach t,$(test-types),libm-test-support-$(t)-static.c)
>> +endif
>> +
>> +libm-test-c-auto-obj-static = $(addprefix $(objpfx),$(libm-test-c-auto-static))
>> +libm-test-c-noauto-obj-static = $(addprefix $(objpfx),$(libm-test-c-noauto-static))
>> +libm-test-c-narrow-obj-static = $(addprefix $(objpfx),$(libm-test-c-narrow-static))
>> +
>> +# Use the same input test definitions for both dynamic and static tests.
>> +.SECONDEXPANSION:
>> +$(libm-test-c-noauto-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
>> + gen-libm-test.py
>> + $(make-target-directory)
>> + $(PYTHON) gen-libm-test.py -c $< -a /dev/null -C $@
>> +
>> +.SECONDEXPANSION:
>> +$(libm-test-c-auto-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
>> + gen-libm-test.py \
>> + auto-libm-test-out$$(subst -static,,%)
>> + $(make-target-directory)
>> + $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out`echo $* | sed 's/-static//'` -C $@
>> +
>> +.SECONDEXPANSION:
>> +$(libm-test-c-narrow-obj-static): $(objpfx)libm-test%.c: libm-test$$(subst -static,,%).inc \
>> + gen-libm-test.py \
>> + auto-libm-test-out$$(subst -static,,%)
>> + $(make-target-directory)
>> + $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out`echo $* | sed 's/-static//'` -C $@
>> +
>> # Tests for totalorder compat symbols reuse the table of tests as
>> # processed by gen-libm-test.py, so add dependencies on the generated
>> # .c files.
>> @@ -505,6 +572,18 @@ $(foreach t,$(libm-tests-normal),$(objpfx)$(t).c): $(objpfx)test-%.c:
>> echo "#include <libm-test-$$func.c>"; \
>> ) > $@
>>
>> +$(foreach t,$(libm-tests-normal-static),$(objpfx)$(t).c): $(objpfx)test-%.c:
>> + type_func=$*; \
>> + type=$${type_func%%-*}; \
>> + func=$${type_func#*-}; \
>> + ( \
>> + echo "#include <test-$$type.h>"; \
>> + echo "#include <test-math-exceptions.h>"; \
>> + echo "#include <test-math-errno.h>"; \
>> + echo "#include <test-math-scalar.h>"; \
>> + echo "#include <libm-test-$$func.c>"; \
>> + ) > $@
>> +
>> $(foreach t,$(libm-tests-narrow),$(objpfx)$(t).c): $(objpfx)test-%.c:
>> type_pair_func=$*; \
>> type_pair=$${type_pair_func%-*}; \
>> @@ -539,6 +618,13 @@ $(foreach t,$(test-types),\
>> echo "#include <libm-test-support.c>"; \
>> ) > $@
>>
>> +$(foreach t,$(test-types),\
>> + $(objpfx)libm-test-support-$(t)-static.c): $(objpfx)libm-test-support-%.c:
>> + ( \
>> + echo "#include <test-$*.h>"; \
>> + echo "#include <libm-test-support.c>"; \
>> + ) > $@
>> +
>> $(addprefix $(objpfx), $(libm-tests.o)): $(objpfx)libm-test-ulps.h
>>
>> define o-iterator-doit
>> @@ -548,6 +634,13 @@ endef
>> object-suffixes-left := $(libm-tests-base)
>> include $(o-iterator)
>>
>> +define o-iterator-doit
>> +$(foreach f,$(libm-test-funcs-all-static),\
>> + $(objpfx)$(o)-$(f)-static.o): $(objpfx)$(o)%.o: $(objpfx)libm-test%.c
>> +endef
>> +object-suffixes-left := $(libm-tests-base)
>> +include $(o-iterator)
>> +
>> define o-iterator-doit
>> $(foreach f,$(libm-test-funcs-narrow),\
>> $(objpfx)$(o)-$(f).o): $(objpfx)$(o)%.o: \
>> @@ -563,6 +656,13 @@ endef
>> object-suffixes-left := $(libm-tests-base-normal)
>> include $(o-iterator)
>>
>> +define o-iterator-doit
>> +$(foreach f,$(libm-test-funcs-all-static),\
>> + $(objpfx)$(o)-$(f)-static.o): CFLAGS += $(libm-test-no-inline-cflags)
>> +endef
>> +object-suffixes-left := $(libm-tests-base-normal)
>> +include $(o-iterator)
>> +
>> define o-iterator-doit
>> $(foreach f,$(libm-test-funcs-narrow),\
>> $(objpfx)$(o)-$(f).o): CFLAGS += $(libm-test-no-inline-cflags)
>> @@ -584,6 +684,13 @@ endef
>> object-suffixes-left := $(test-types)
>> include $(o-iterator)
>>
>> +define o-iterator-doit
>> +$(addprefix $(objpfx),\
>> + $(call libm-tests-for-type-static,$(o))): $(objpfx)libm-test-support-$(o)-static.o
>> +endef
>> +object-suffixes-left := $(test-types)
>> +include $(o-iterator)
>> +
>> define o-iterator-doit
>> $(objpfx)libm-test-support-$(o).o: CFLAGS += $(libm-test-no-inline-cflags)
>> endef
>> diff --git a/math/test-double-static.h b/math/test-double-static.h
>> new file mode 100644
>> index 0000000000..d53f46819f
>> --- /dev/null
>> +++ b/math/test-double-static.h
>> @@ -0,0 +1 @@
>> +#include "test-double.h"
>> diff --git a/math/test-float-static.h b/math/test-float-static.h
>> new file mode 100644
>> index 0000000000..7834c9e1f1
>> --- /dev/null
>> +++ b/math/test-float-static.h
>> @@ -0,0 +1 @@
>> +#include "test-float.h"
>> diff --git a/math/test-float128-static.h b/math/test-float128-static.h
>> new file mode 100644
>> index 0000000000..5f8206456a
>> --- /dev/null
>> +++ b/math/test-float128-static.h
>> @@ -0,0 +1 @@
>> +#include "test-float128.h"
>> diff --git a/math/test-float32-static.h b/math/test-float32-static.h
>> new file mode 100644
>> index 0000000000..2df27d1ca0
>> --- /dev/null
>> +++ b/math/test-float32-static.h
>> @@ -0,0 +1 @@
>> +#include "test-float32.h"
>> diff --git a/math/test-float32x-static.h b/math/test-float32x-static.h
>> new file mode 100644
>> index 0000000000..62f78b49d8
>> --- /dev/null
>> +++ b/math/test-float32x-static.h
>> @@ -0,0 +1 @@
>> +#include "test-float32x.h"
>> diff --git a/math/test-float64-static.h b/math/test-float64-static.h
>> new file mode 100644
>> index 0000000000..807c174df1
>> --- /dev/null
>> +++ b/math/test-float64-static.h
>> @@ -0,0 +1 @@
>> +#include "test-float64.h"
>> diff --git a/math/test-float64x-static.h b/math/test-float64x-static.h
>> new file mode 100644
>> index 0000000000..a7801dbc10
>> --- /dev/null
>> +++ b/math/test-float64x-static.h
>> @@ -0,0 +1 @@
>> +#include "test-float64x.h"
>> diff --git a/math/test-ibm128-static.h b/math/test-ibm128-static.h
>> new file mode 100644
>> index 0000000000..b66a57050b
>> --- /dev/null
>> +++ b/math/test-ibm128-static.h
>> @@ -0,0 +1 @@
>> +#include "test-ibm128.h"
>> diff --git a/math/test-ldouble-static.h b/math/test-ldouble-static.h
>> new file mode 100644
>> index 0000000000..beabedb817
>> --- /dev/null
>> +++ b/math/test-ldouble-static.h
>> @@ -0,0 +1 @@
>> +#include "test-ldouble.h"
>> --
>> 2.34.1
>>
>
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 4/7] math: Fix isnanf128 static build
2024-05-20 16:51 ` H.J. Lu
@ 2024-05-20 18:53 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella Netto @ 2024-05-20 18:53 UTC (permalink / raw)
To: H.J. Lu; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On 20/05/24 13:51, H.J. Lu wrote:
> On Tue, Apr 2, 2024 at 7:06 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>> Some static implementation of float128 routines might call __isnanf128,
>
> Which targets do this?
I will need to recheck all the targets affected by this, but at least
x86_64 and i686 are. Using the the 'build-math-static-tests=yes' rule
(provided by the first patch in this set):
x86_64-linux-gnu$ make test t=math/test-float128-isnan-static build-math-static-tests=yes
[...]
/home/azanella/toolchain/install/compilers/14/x86_64-linux-gnu/bin/../lib/gcc/x86_64-glibc-linux-gnu/14.1.1/../../../../x86_64-glibc-linux-gnu/bin/ld: /home/azanella/Projects/glibc/build/x86_64-linux-gnu/math/test-float128-isnan-static.o: in function `isnan_test':
/home/azanella/Projects/glibc/build/x86_64-linux-gnu/math/libm-test-isnan-static.c:56:(.text+0xa9): undefined reference to `__isnanf128'
/home/azanella/toolchain/install/compilers/14/x86_64-linux-gnu/bin/../lib/gcc/x86_64-glibc-linux-gnu/14.1.1/../../../../x86_64-glibc-linux-gnu/bin/ld: /home/azanella/Projects/glibc/build/x86_64-linux-gnu/math/libm-test-isnan-static.c:56:(.text+0x169): undefined reference to `__isnanf128'
[...]
For aarch64, for instance, the isnan with _Float128 generated a call to
__isnanl which is provided by libc.a:
$ readelf -sW libc.a | grep -w "FUNC.*GLOBAL" | grep __isnanl
18: 0000000000000000 120 FUNC GLOBAL HIDDEN 1 __isnanl
With this patch, x86_64 now also provides the __isnanf128:
x86_64-linux-gnu$ readelf -sW libc.a | grep -w "FUNC.*GLOBAL" | grep -w __isnanf128
12: 0000000000000000 99 FUNC GLOBAL HIDDEN 1 __isnanf128
>
>> which is not provided by the static object.
>>
>> Checked on x86_64-linux-gnu.
>> ---
>> sysdeps/ieee754/float128/float128_private.h | 2 +-
>> sysdeps/ieee754/float128/s_isnanf128.c | 4 ++++
>> 2 files changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h
>> index 38a8bdd0fe..672bf3cccf 100644
>> --- a/sysdeps/ieee754/float128/float128_private.h
>> +++ b/sysdeps/ieee754/float128/float128_private.h
>> @@ -352,7 +352,7 @@
>> #define frexpl frexpf128
>> #define getpayloadl getpayloadf128
>> #define isinfl isinff128_do_not_use
>> -#define isnanl isnanf128_do_not_use
>> +#define isnanl isnanf128
>> #define ldexpl ldexpf128
>> #define llrintl llrintf128
>> #define llroundl llroundf128
>> diff --git a/sysdeps/ieee754/float128/s_isnanf128.c b/sysdeps/ieee754/float128/s_isnanf128.c
>> index 59f71533ce..b73a4e80d7 100644
>> --- a/sysdeps/ieee754/float128/s_isnanf128.c
>> +++ b/sysdeps/ieee754/float128/s_isnanf128.c
>> @@ -11,7 +11,11 @@
>> #include "../ldbl-128/s_isnanl.c"
>> #if !IS_IN (libm)
>> #include <float128-abi.h>
>> +#ifdef SHARED
>> hidden_ver (__isnanf128_impl, __isnanf128)
>> +#else
>> +strong_alias (__isnanf128_impl, __isnanf128)
>> +#endif
>> _weak_alias (__isnanf128_impl, isnanl)
>> versioned_symbol (libc, __isnanf128_impl, __isnanf128, GLIBC_2_34);
>> #if (SHLIB_COMPAT (libc, FLOAT128_VERSION_M, GLIBC_2_34))
>> --
>> 2.34.1
>>
>
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 5/7] math: Provided copysignf128 for static libm on alpha, s390, and sparcv9
2024-05-20 16:55 ` H.J. Lu
@ 2024-05-20 19:04 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella Netto @ 2024-05-20 19:04 UTC (permalink / raw)
To: H.J. Lu; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On 20/05/24 13:55, H.J. Lu wrote:
> On Tue, Apr 2, 2024 at 7:07 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>> Checked with a static build for the affected ABIs.
>> ---
>> sysdeps/ieee754/ldbl-64-128/s_copysignl.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/sysdeps/ieee754/ldbl-64-128/s_copysignl.c b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
>> index 11b42d04ba..80137847d3 100644
>> --- a/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
>> +++ b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c
>> @@ -1,10 +1,10 @@
>> #include <math_ldbl_opt.h>
>> #include <libm-alias-ldouble.h>
>> -#if IS_IN (libc)
>> +#if IS_IN (libc) && defined SHARED
>> # undef libm_alias_ldouble
>> # define libm_alias_ldouble(from, to)
>> #endif
>> #include <sysdeps/ieee754/ldbl-128/s_copysignl.c>
>> -#if IS_IN (libc)
>> +#if IS_IN (libc) && defined SHARED
>
> Doesn't this remove copysignl from libm.a?
There is no copysignl from libm.a, it is provided by libc.a for such
ABIs. Without this path:
alpha-linux-gnu$ readelf -sW libc.a | grep -w copysign.*
14: 0000000000000000 52 FUNC WEAK DEFAULT [NOPV] 1 copysignl
14: 0000000000000000 8 FUNC WEAK DEFAULT [NOPV] 1 copysignf32x
15: 0000000000000000 8 FUNC WEAK DEFAULT [NOPV] 1 copysignf64
16: 0000000000000000 8 FUNC WEAK DEFAULT [NOPV] 1 copysign
14: 0000000000000000 8 FUNC WEAK DEFAULT [NOPV] 1 copysignf32
15: 0000000000000000 8 FUNC WEAK DEFAULT [NOPV] 1 copysignf
After this patch:
alpha-linux-gnu$ readelf -sW libc.a | grep -w copysign.*
14: 0000000000000000 52 FUNC WEAK DEFAULT [NOPV] 1 copysignf64x
15: 0000000000000000 52 FUNC WEAK DEFAULT [NOPV] 1 copysignf128
16: 0000000000000000 52 FUNC WEAK DEFAULT [NOPV] 1 copysignl
14: 0000000000000000 8 FUNC WEAK DEFAULT [NOPV] 1 copysignf32x
15: 0000000000000000 8 FUNC WEAK DEFAULT [NOPV] 1 copysignf64
16: 0000000000000000 8 FUNC WEAK DEFAULT [NOPV] 1 copysign
14: 0000000000000000 8 FUNC WEAK DEFAULT [NOPV] 1 copysignf32
15: 0000000000000000 8 FUNC WEAK DEFAULT [NOPV] 1 copysignf
>
>> long_double_symbol (libc, __copysignl, copysignl);
>> #endif
>> --
>> 2.34.1
>>
>
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 6/7] math: Provide frexpf128 for static libm on alpha, s390, and sparcv9
2024-05-20 16:57 ` H.J. Lu
@ 2024-05-20 19:06 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella Netto @ 2024-05-20 19:06 UTC (permalink / raw)
To: H.J. Lu; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On 20/05/24 13:57, H.J. Lu wrote:
> On Tue, Apr 2, 2024 at 7:07 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>> hecked with a build for the affected ABIs.
>> ---
>> sysdeps/ieee754/ldbl-64-128/s_frexpl.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/sysdeps/ieee754/ldbl-64-128/s_frexpl.c b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
>> index 73ac41e40c..f5f7d349f7 100644
>> --- a/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
>> +++ b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c
>> @@ -1,10 +1,10 @@
>> #include <math_ldbl_opt.h>
>> #include <libm-alias-ldouble.h>
>> -#if IS_IN (libc)
>> +#if IS_IN (libc) && defined SHARED
>> # undef libm_alias_ldouble
>> # define libm_alias_ldouble(from, to)
>> #endif
>> #include <sysdeps/ieee754/ldbl-128/s_frexpl.c>
>> -#if IS_IN (libc)
>> +#if IS_IN (libc) && defined SHARED
>> long_double_symbol (libc, __frexpl, frexpl);
>
> Doesn't this remove frexpl from libm.a?
As for copysignf128, this symbol is also provided by libc.a. Before this
patch:
alpha-linux-gnu$ readelf -sW libc.a | grep -w frexp.*
19: 0000000000000000 312 FUNC WEAK DEFAULT [STD GPLOAD] 1 frexpl
17: 0000000000000000 216 FUNC WEAK DEFAULT [STD GPLOAD] 1 frexpf32x
18: 0000000000000000 216 FUNC WEAK DEFAULT [STD GPLOAD] 1 frexpf64
19: 0000000000000000 216 FUNC WEAK DEFAULT [STD GPLOAD] 1 frexp
17: 0000000000000000 204 FUNC WEAK DEFAULT [STD GPLOAD] 1 frexpf32
18: 0000000000000000 204 FUNC WEAK DEFAULT [STD GPLOAD] 1 frexpf
After this patch:
alpha-linux-gnu$ readelf -sW libc.a | grep -w frexp.*
19: 0000000000000000 312 FUNC WEAK DEFAULT [STD GPLOAD] 1 frexpf64x
20: 0000000000000000 312 FUNC WEAK DEFAULT [STD GPLOAD] 1 frexpf128
21: 0000000000000000 312 FUNC WEAK DEFAULT [STD GPLOAD] 1 frexpl
17: 0000000000000000 216 FUNC WEAK DEFAULT [STD GPLOAD] 1 frexpf32x
18: 0000000000000000 216 FUNC WEAK DEFAULT [STD GPLOAD] 1 frexpf64
19: 0000000000000000 216 FUNC WEAK DEFAULT [STD GPLOAD] 1 frexp
17: 0000000000000000 204 FUNC WEAK DEFAULT [STD GPLOAD] 1 frexpf32
18: 0000000000000000 204 FUNC WEAK DEFAULT [STD GPLOAD] 1 frexpf
>
>> #endif
>> --
>> 2.34.1
>>
>
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 7/7] math: Provide modf128 for static libm on alpha, s390, and sparcv9
2024-05-20 16:59 ` H.J. Lu
@ 2024-05-20 19:07 ` Adhemerval Zanella Netto
2024-05-21 15:40 ` H.J. Lu
0 siblings, 1 reply; 31+ messages in thread
From: Adhemerval Zanella Netto @ 2024-05-20 19:07 UTC (permalink / raw)
To: H.J. Lu; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On 20/05/24 13:59, H.J. Lu wrote:
> On Tue, Apr 2, 2024 at 7:07 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>> Checked with a build for the affected ABIs
>> ---
>> sysdeps/ieee754/ldbl-64-128/s_modfl.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/sysdeps/ieee754/ldbl-64-128/s_modfl.c b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
>> index 7d7aeae111..ba3d31334a 100644
>> --- a/sysdeps/ieee754/ldbl-64-128/s_modfl.c
>> +++ b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
>> @@ -1,10 +1,10 @@
>> #include <math_ldbl_opt.h>
>> #include <libm-alias-ldouble.h>
>> -#if IS_IN (libc)
>> +#if IS_IN (libc) && defined SHARED
>> # undef libm_alias_ldouble
>> # define libm_alias_ldouble(from, to)
>> #endif
>> #include <sysdeps/ieee754/ldbl-128/s_modfl.c>
>> -#if IS_IN (libc)
>> +#if IS_IN (libc) && defined SHARED
>> long_double_symbol (libc, __modfl, modfl);
>
> Doesn't this remove modfl from static library?
As for copysignf128 and frexp128, this symbol is also provided by libc.a.
Before this patch:
alpha-linux-gnu$ readelf -sW libc.a | grep -w modf.*
19: 0000000000000000 572 FUNC WEAK DEFAULT [STD GPLOAD] 1 modfl
17: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff32x
18: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff64
19: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modf
17: 0000000000000000 244 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff32
18: 0000000000000000 244 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff
After this patch:
alpha-linux-gnu$ readelf -sW libc.a | grep -w modf.*
19: 0000000000000000 572 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff64x
20: 0000000000000000 572 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff128
21: 0000000000000000 572 FUNC WEAK DEFAULT [STD GPLOAD] 1 modfl
17: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff32x
18: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff64
19: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modf
17: 0000000000000000 244 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff32
18: 0000000000000000 244 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff
>
>> #endif
>> --
>> 2.34.1
>>
>
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 4/7] math: Fix isnanf128 static build
2024-04-02 14:06 ` [PATCH v3 4/7] math: Fix isnanf128 " Adhemerval Zanella
2024-05-20 16:51 ` H.J. Lu
@ 2024-05-20 21:34 ` H.J. Lu
2024-05-21 12:32 ` Adhemerval Zanella Netto
1 sibling, 1 reply; 31+ messages in thread
From: H.J. Lu @ 2024-05-20 21:34 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On Tue, Apr 2, 2024 at 7:06 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> Some static implementation of float128 routines might call __isnanf128,
> which is not provided by the static object.
>
> Checked on x86_64-linux-gnu.
> ---
> sysdeps/ieee754/float128/float128_private.h | 2 +-
> sysdeps/ieee754/float128/s_isnanf128.c | 4 ++++
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h
> index 38a8bdd0fe..672bf3cccf 100644
> --- a/sysdeps/ieee754/float128/float128_private.h
> +++ b/sysdeps/ieee754/float128/float128_private.h
> @@ -352,7 +352,7 @@
> #define frexpl frexpf128
> #define getpayloadl getpayloadf128
> #define isinfl isinff128_do_not_use
> -#define isnanl isnanf128_do_not_use
Why is this change needed? Will the issue be fixed by
https://patchwork.sourceware.org/project/glibc/list/?series=34121
> +#define isnanl isnanf128
> #define ldexpl ldexpf128
> #define llrintl llrintf128
> #define llroundl llroundf128
> diff --git a/sysdeps/ieee754/float128/s_isnanf128.c b/sysdeps/ieee754/float128/s_isnanf128.c
> index 59f71533ce..b73a4e80d7 100644
> --- a/sysdeps/ieee754/float128/s_isnanf128.c
> +++ b/sysdeps/ieee754/float128/s_isnanf128.c
> @@ -11,7 +11,11 @@
> #include "../ldbl-128/s_isnanl.c"
> #if !IS_IN (libm)
> #include <float128-abi.h>
> +#ifdef SHARED
> hidden_ver (__isnanf128_impl, __isnanf128)
> +#else
> +strong_alias (__isnanf128_impl, __isnanf128)
> +#endif
> _weak_alias (__isnanf128_impl, isnanl)
> versioned_symbol (libc, __isnanf128_impl, __isnanf128, GLIBC_2_34);
> #if (SHLIB_COMPAT (libc, FLOAT128_VERSION_M, GLIBC_2_34))
> --
> 2.34.1
>
--
H.J.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 4/7] math: Fix isnanf128 static build
2024-05-20 21:34 ` H.J. Lu
@ 2024-05-21 12:32 ` Adhemerval Zanella Netto
2024-05-21 12:36 ` H.J. Lu
0 siblings, 1 reply; 31+ messages in thread
From: Adhemerval Zanella Netto @ 2024-05-21 12:32 UTC (permalink / raw)
To: H.J. Lu; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On 20/05/24 18:34, H.J. Lu wrote:
> On Tue, Apr 2, 2024 at 7:06 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>> Some static implementation of float128 routines might call __isnanf128,
>> which is not provided by the static object.
>>
>> Checked on x86_64-linux-gnu.
>> ---
>> sysdeps/ieee754/float128/float128_private.h | 2 +-
>> sysdeps/ieee754/float128/s_isnanf128.c | 4 ++++
>> 2 files changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h
>> index 38a8bdd0fe..672bf3cccf 100644
>> --- a/sysdeps/ieee754/float128/float128_private.h
>> +++ b/sysdeps/ieee754/float128/float128_private.h
>> @@ -352,7 +352,7 @@
>> #define frexpl frexpf128
>> #define getpayloadl getpayloadf128
>> #define isinfl isinff128_do_not_use
>> -#define isnanl isnanf128_do_not_use
>
> Why is this change needed? Will the issue be fixed by
This is not required indeed, I will remove it.
>
> https://patchwork.sourceware.org/project/glibc/list/?series=34121
But unfortunately this patch does not fix the missing isnanf128 symbol on libc.a.
>
>> +#define isnanl isnanf128
>> #define ldexpl ldexpf128
>> #define llrintl llrintf128
>> #define llroundl llroundf128
>> diff --git a/sysdeps/ieee754/float128/s_isnanf128.c b/sysdeps/ieee754/float128/s_isnanf128.c
>> index 59f71533ce..b73a4e80d7 100644
>> --- a/sysdeps/ieee754/float128/s_isnanf128.c
>> +++ b/sysdeps/ieee754/float128/s_isnanf128.c
>> @@ -11,7 +11,11 @@
>> #include "../ldbl-128/s_isnanl.c"
>> #if !IS_IN (libm)
>> #include <float128-abi.h>
>> +#ifdef SHARED
>> hidden_ver (__isnanf128_impl, __isnanf128)
>> +#else
>> +strong_alias (__isnanf128_impl, __isnanf128)
>> +#endif
>> _weak_alias (__isnanf128_impl, isnanl)
>> versioned_symbol (libc, __isnanf128_impl, __isnanf128, GLIBC_2_34);
>> #if (SHLIB_COMPAT (libc, FLOAT128_VERSION_M, GLIBC_2_34))
>> --
>> 2.34.1
>>
>
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 4/7] math: Fix isnanf128 static build
2024-05-21 12:32 ` Adhemerval Zanella Netto
@ 2024-05-21 12:36 ` H.J. Lu
2024-05-21 12:56 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 31+ messages in thread
From: H.J. Lu @ 2024-05-21 12:36 UTC (permalink / raw)
To: Adhemerval Zanella Netto; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On Tue, May 21, 2024 at 5:32 AM Adhemerval Zanella Netto
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 20/05/24 18:34, H.J. Lu wrote:
> > On Tue, Apr 2, 2024 at 7:06 AM Adhemerval Zanella
> > <adhemerval.zanella@linaro.org> wrote:
> >>
> >> Some static implementation of float128 routines might call __isnanf128,
> >> which is not provided by the static object.
> >>
> >> Checked on x86_64-linux-gnu.
> >> ---
> >> sysdeps/ieee754/float128/float128_private.h | 2 +-
> >> sysdeps/ieee754/float128/s_isnanf128.c | 4 ++++
> >> 2 files changed, 5 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h
> >> index 38a8bdd0fe..672bf3cccf 100644
> >> --- a/sysdeps/ieee754/float128/float128_private.h
> >> +++ b/sysdeps/ieee754/float128/float128_private.h
> >> @@ -352,7 +352,7 @@
> >> #define frexpl frexpf128
> >> #define getpayloadl getpayloadf128
> >> #define isinfl isinff128_do_not_use
> >> -#define isnanl isnanf128_do_not_use
> >
> > Why is this change needed? Will the issue be fixed by
>
> This is not required indeed, I will remove it.
Please mention:
https://sourceware.org/bugzilla/show_bug.cgi?id=31774
in the commit log.
> >
> > https://patchwork.sourceware.org/project/glibc/list/?series=34121
>
> But unfortunately this patch does not fix the missing isnanf128 symbol on libc.a.
That is not what I meant. I thought your isnanl change fixed some
issue you found.
> >
> >> +#define isnanl isnanf128
> >> #define ldexpl ldexpf128
> >> #define llrintl llrintf128
> >> #define llroundl llroundf128
> >> diff --git a/sysdeps/ieee754/float128/s_isnanf128.c b/sysdeps/ieee754/float128/s_isnanf128.c
> >> index 59f71533ce..b73a4e80d7 100644
> >> --- a/sysdeps/ieee754/float128/s_isnanf128.c
> >> +++ b/sysdeps/ieee754/float128/s_isnanf128.c
> >> @@ -11,7 +11,11 @@
> >> #include "../ldbl-128/s_isnanl.c"
> >> #if !IS_IN (libm)
> >> #include <float128-abi.h>
> >> +#ifdef SHARED
> >> hidden_ver (__isnanf128_impl, __isnanf128)
> >> +#else
> >> +strong_alias (__isnanf128_impl, __isnanf128)
> >> +#endif
> >> _weak_alias (__isnanf128_impl, isnanl)
> >> versioned_symbol (libc, __isnanf128_impl, __isnanf128, GLIBC_2_34);
> >> #if (SHLIB_COMPAT (libc, FLOAT128_VERSION_M, GLIBC_2_34))
> >> --
> >> 2.34.1
> >>
> >
> >
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 2/7] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)
2024-04-02 14:06 ` [PATCH v3 2/7] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488) Adhemerval Zanella
2024-05-11 9:59 ` Aurelien Jarno
@ 2024-05-21 12:40 ` H.J. Lu
2024-05-21 12:54 ` Adhemerval Zanella Netto
1 sibling, 1 reply; 31+ messages in thread
From: H.J. Lu @ 2024-05-21 12:40 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On Tue, Apr 2, 2024 at 7:06 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> The commit 16439f419b removed the static fmod/fmodf on i386 and m68k
> with and empty w_fmod.c (required for the ABIs that uses the newly
> implementation). This patch fixes by adding the required symbols on
> the arch-specific w_fmod{f}_compat.c implementation.
>
> To statically build fmod fails on some ABI (alpha, s390, sparc) because
> it does not export the ldexpf128, this is also fixed by this patch.
>
> Checked on i686-linux-gnu and with a build for m68k-linux-gnu with
> 'make test t=math/test-{float,double}-modf-static build-math-static-tests=yes'.
> ---
> sysdeps/i386/fpu/w_fmod_compat.c | 7 ++++---
> sysdeps/i386/fpu/w_fmodf_compat.c | 7 ++++---
> sysdeps/ieee754/ldbl-opt/s_ldexpl.c | 4 ++--
> sysdeps/m68k/m680x0/fpu/w_fmod_compat.c | 5 +++--
> sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c | 7 ++++---
> 5 files changed, 17 insertions(+), 13 deletions(-)
>
> diff --git a/sysdeps/i386/fpu/w_fmod_compat.c b/sysdeps/i386/fpu/w_fmod_compat.c
> index 5ac9995ffd..528bfc2a13 100644
> --- a/sysdeps/i386/fpu/w_fmod_compat.c
> +++ b/sysdeps/i386/fpu/w_fmod_compat.c
> @@ -7,8 +7,9 @@
> # define LIBM_SVID_COMPAT 1
> # undef compat_symbol
> # define compat_symbol(a, b, c, d)
> -#endif
> -#include <math/w_fmod_compat.c>
> -#ifdef SHARED
> +# include <math/w_fmod_compat.c>
> libm_alias_double (__fmod_compat, fmod)
> +#else
> +#include <math-type-macros-double.h>
> +#include <w_fmod_template.c>
> #endif
> diff --git a/sysdeps/i386/fpu/w_fmodf_compat.c b/sysdeps/i386/fpu/w_fmodf_compat.c
> index cc417e07d3..5a61693e51 100644
> --- a/sysdeps/i386/fpu/w_fmodf_compat.c
> +++ b/sysdeps/i386/fpu/w_fmodf_compat.c
> @@ -7,8 +7,9 @@
> # define LIBM_SVID_COMPAT 1
> # undef compat_symbol
> # define compat_symbol(a, b, c, d)
> -#endif
> -#include <math/w_fmodf_compat.c>
> -#ifdef SHARED
> +# include <math/w_fmodf_compat.c>
> libm_alias_float (__fmod_compat, fmod)
> +#else
> +#include <math-type-macros-float.h>
> +#include <w_fmod_template.c>
> #endif
> diff --git a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
> index 1afbe7d8ad..932cc4341c 100644
> --- a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
> +++ b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
> @@ -17,13 +17,13 @@
> License along with the GNU C Library; if not, see
> <https://www.gnu.org/licenses/>. */
>
> -#if IS_IN (libc)
> +#if IS_IN (libc) && defined SHARED
> # define declare_mgen_alias(f,t)
> #endif
> #include <math-type-macros-ldouble.h>
> #include <s_ldexp_template.c>
>
> -#if IS_IN (libc)
> +#if IS_IN (libc) && defined SHARED
> long_double_symbol (libc, __ldexpl, ldexpl);
> long_double_symbol (libc, __wrap_scalbnl, scalbnl);
> #endif
> diff --git a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
> index 527d4fbed2..57f38091e6 100644
> --- a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
> +++ b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
> @@ -7,8 +7,9 @@
> # define LIBM_SVID_COMPAT 1
> # undef compat_symbol
> # define compat_symbol(a, b, c, d)
> -#endif
> #include <math/w_fmod_compat.c>
> -#ifdef SHARED
> libm_alias_double (__fmod_compat, fmod)
> +#else
> +#include <math-type-macros-double.h>
> +#include <w_fmod_template.c>
> #endif
> diff --git a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
> index 5043586b91..88db07f443 100644
> --- a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
> +++ b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
> @@ -7,8 +7,9 @@
> # define LIBM_SVID_COMPAT 1
> # undef compat_symbol
> # define compat_symbol(a, b, c, d)
> -#endif
> -#include <math/w_fmodf_compat.c>
> -#ifdef SHARED
> +# include <math/w_fmodf_compat.c>
> libm_alias_float (__fmod_compat, fmod)
> +#else
> +#include <math-type-macros-float.h>
> +#include <w_fmod_template.c>
> #endif
> --
> 2.34.1
>
My WIP static ABI check identified exp10 exp10f32x exp10f64 fmod fmodf fmodf32
fmodf32x fmodf64 are missing in i386 libm.a:
https://sourceware.org/bugzilla/show_bug.cgi?id=31775
Does your patch fix all of them?
--
H.J.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 3/7] math: Fix i386 and m68k exp10 on static build
2024-04-02 14:06 ` [PATCH v3 3/7] math: Fix i386 and m68k exp10 on static build Adhemerval Zanella
2024-05-11 9:59 ` Aurelien Jarno
@ 2024-05-21 12:48 ` H.J. Lu
2024-05-21 12:54 ` Adhemerval Zanella Netto
1 sibling, 1 reply; 31+ messages in thread
From: H.J. Lu @ 2024-05-21 12:48 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On Tue, Apr 2, 2024 at 7:06 AM 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 with
> 'make test t=math/test-{float,double}-exp10-static build-math-static-tests=yes'
> ---
> sysdeps/i386/fpu/w_exp10_compat.c | 9 +++++++--
> sysdeps/m68k/m680x0/fpu/w_exp10_compat.c | 9 +++++++--
> 2 files changed, 14 insertions(+), 4 deletions(-)
>
> 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
>
Please mention:
https://sourceware.org/bugzilla/show_bug.cgi?id=31775
in the commit log.
--
H.J.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 2/7] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)
2024-05-21 12:40 ` H.J. Lu
@ 2024-05-21 12:54 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella Netto @ 2024-05-21 12:54 UTC (permalink / raw)
To: H.J. Lu; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On 21/05/24 09:40, H.J. Lu wrote:
> On Tue, Apr 2, 2024 at 7:06 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>> The commit 16439f419b removed the static fmod/fmodf on i386 and m68k
>> with and empty w_fmod.c (required for the ABIs that uses the newly
>> implementation). This patch fixes by adding the required symbols on
>> the arch-specific w_fmod{f}_compat.c implementation.
>>
>> To statically build fmod fails on some ABI (alpha, s390, sparc) because
>> it does not export the ldexpf128, this is also fixed by this patch.
>>
>> Checked on i686-linux-gnu and with a build for m68k-linux-gnu with
>> 'make test t=math/test-{float,double}-modf-static build-math-static-tests=yes'.
>> ---
>> sysdeps/i386/fpu/w_fmod_compat.c | 7 ++++---
>> sysdeps/i386/fpu/w_fmodf_compat.c | 7 ++++---
>> sysdeps/ieee754/ldbl-opt/s_ldexpl.c | 4 ++--
>> sysdeps/m68k/m680x0/fpu/w_fmod_compat.c | 5 +++--
>> sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c | 7 ++++---
>> 5 files changed, 17 insertions(+), 13 deletions(-)
>>
>> diff --git a/sysdeps/i386/fpu/w_fmod_compat.c b/sysdeps/i386/fpu/w_fmod_compat.c
>> index 5ac9995ffd..528bfc2a13 100644
>> --- a/sysdeps/i386/fpu/w_fmod_compat.c
>> +++ b/sysdeps/i386/fpu/w_fmod_compat.c
>> @@ -7,8 +7,9 @@
>> # define LIBM_SVID_COMPAT 1
>> # undef compat_symbol
>> # define compat_symbol(a, b, c, d)
>> -#endif
>> -#include <math/w_fmod_compat.c>
>> -#ifdef SHARED
>> +# include <math/w_fmod_compat.c>
>> libm_alias_double (__fmod_compat, fmod)
>> +#else
>> +#include <math-type-macros-double.h>
>> +#include <w_fmod_template.c>
>> #endif
>> diff --git a/sysdeps/i386/fpu/w_fmodf_compat.c b/sysdeps/i386/fpu/w_fmodf_compat.c
>> index cc417e07d3..5a61693e51 100644
>> --- a/sysdeps/i386/fpu/w_fmodf_compat.c
>> +++ b/sysdeps/i386/fpu/w_fmodf_compat.c
>> @@ -7,8 +7,9 @@
>> # define LIBM_SVID_COMPAT 1
>> # undef compat_symbol
>> # define compat_symbol(a, b, c, d)
>> -#endif
>> -#include <math/w_fmodf_compat.c>
>> -#ifdef SHARED
>> +# include <math/w_fmodf_compat.c>
>> libm_alias_float (__fmod_compat, fmod)
>> +#else
>> +#include <math-type-macros-float.h>
>> +#include <w_fmod_template.c>
>> #endif
>> diff --git a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
>> index 1afbe7d8ad..932cc4341c 100644
>> --- a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
>> +++ b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c
>> @@ -17,13 +17,13 @@
>> License along with the GNU C Library; if not, see
>> <https://www.gnu.org/licenses/>. */
>>
>> -#if IS_IN (libc)
>> +#if IS_IN (libc) && defined SHARED
>> # define declare_mgen_alias(f,t)
>> #endif
>> #include <math-type-macros-ldouble.h>
>> #include <s_ldexp_template.c>
>>
>> -#if IS_IN (libc)
>> +#if IS_IN (libc) && defined SHARED
>> long_double_symbol (libc, __ldexpl, ldexpl);
>> long_double_symbol (libc, __wrap_scalbnl, scalbnl);
>> #endif
>> diff --git a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
>> index 527d4fbed2..57f38091e6 100644
>> --- a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
>> +++ b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
>> @@ -7,8 +7,9 @@
>> # define LIBM_SVID_COMPAT 1
>> # undef compat_symbol
>> # define compat_symbol(a, b, c, d)
>> -#endif
>> #include <math/w_fmod_compat.c>
>> -#ifdef SHARED
>> libm_alias_double (__fmod_compat, fmod)
>> +#else
>> +#include <math-type-macros-double.h>
>> +#include <w_fmod_template.c>
>> #endif
>> diff --git a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
>> index 5043586b91..88db07f443 100644
>> --- a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
>> +++ b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
>> @@ -7,8 +7,9 @@
>> # define LIBM_SVID_COMPAT 1
>> # undef compat_symbol
>> # define compat_symbol(a, b, c, d)
>> -#endif
>> -#include <math/w_fmodf_compat.c>
>> -#ifdef SHARED
>> +# include <math/w_fmodf_compat.c>
>> libm_alias_float (__fmod_compat, fmod)
>> +#else
>> +#include <math-type-macros-float.h>
>> +#include <w_fmod_template.c>
>> #endif
>> --
>> 2.34.1
>>
>
> My WIP static ABI check identified exp10 exp10f32x exp10f64 fmod fmodf fmodf32
> fmodf32x fmodf64 are missing in i386 libm.a:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=31775
>
> Does your patch fix all of them?
>
Yes, that the idea of this patchset:
i686-linux-gnu$ readelf -sW math/libm.a | grep -E -w 'exp10|exp10f32x|exp10f64|fmod|fmodf|fmodf32|fmodf32x|fmodf64'
17: 00000000 160 FUNC WEAK DEFAULT 2 exp10f32x
18: 00000000 160 FUNC WEAK DEFAULT 2 exp10f64
19: 00000000 160 FUNC WEAK DEFAULT 2 exp10
17: 00000000 140 FUNC WEAK DEFAULT 2 fmodf32x
18: 00000000 140 FUNC WEAK DEFAULT 2 fmodf64
19: 00000000 140 FUNC WEAK DEFAULT 2 fmod
17: 00000000 140 FUNC WEAK DEFAULT 2 fmodf32
18: 00000000 140 FUNC WEAK DEFAULT 2 fmodf
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 3/7] math: Fix i386 and m68k exp10 on static build
2024-05-21 12:48 ` H.J. Lu
@ 2024-05-21 12:54 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella Netto @ 2024-05-21 12:54 UTC (permalink / raw)
To: H.J. Lu; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On 21/05/24 09:48, H.J. Lu wrote:
> On Tue, Apr 2, 2024 at 7:06 AM 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 with
>> 'make test t=math/test-{float,double}-exp10-static build-math-static-tests=yes'
>> ---
>> sysdeps/i386/fpu/w_exp10_compat.c | 9 +++++++--
>> sysdeps/m68k/m680x0/fpu/w_exp10_compat.c | 9 +++++++--
>> 2 files changed, 14 insertions(+), 4 deletions(-)
>>
>> 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
>>
>
> Please mention:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=31775
>
> in the commit log.
>
Ack.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 4/7] math: Fix isnanf128 static build
2024-05-21 12:36 ` H.J. Lu
@ 2024-05-21 12:56 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella Netto @ 2024-05-21 12:56 UTC (permalink / raw)
To: H.J. Lu; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On 21/05/24 09:36, H.J. Lu wrote:
> On Tue, May 21, 2024 at 5:32 AM Adhemerval Zanella Netto
> <adhemerval.zanella@linaro.org> wrote:
>>
>>
>>
>> On 20/05/24 18:34, H.J. Lu wrote:
>>> On Tue, Apr 2, 2024 at 7:06 AM Adhemerval Zanella
>>> <adhemerval.zanella@linaro.org> wrote:
>>>>
>>>> Some static implementation of float128 routines might call __isnanf128,
>>>> which is not provided by the static object.
>>>>
>>>> Checked on x86_64-linux-gnu.
>>>> ---
>>>> sysdeps/ieee754/float128/float128_private.h | 2 +-
>>>> sysdeps/ieee754/float128/s_isnanf128.c | 4 ++++
>>>> 2 files changed, 5 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h
>>>> index 38a8bdd0fe..672bf3cccf 100644
>>>> --- a/sysdeps/ieee754/float128/float128_private.h
>>>> +++ b/sysdeps/ieee754/float128/float128_private.h
>>>> @@ -352,7 +352,7 @@
>>>> #define frexpl frexpf128
>>>> #define getpayloadl getpayloadf128
>>>> #define isinfl isinff128_do_not_use
>>>> -#define isnanl isnanf128_do_not_use
>>>
>>> Why is this change needed? Will the issue be fixed by
>>
>> This is not required indeed, I will remove it.
>
> Please mention:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=31774
>
> in the commit log.
Ack.
>
>>>
>>> https://patchwork.sourceware.org/project/glibc/list/?series=34121
>>
>> But unfortunately this patch does not fix the missing isnanf128 symbol on libc.a.
>
> That is not what I meant. I thought your isnanl change fixed some
> issue you found.
Right, to make it clear your patch https://patchwork.sourceware.org/project/glibc/list/?series=34121
does not fix the missing isnanf128 required for static build of math tests. This is
fixed by this patch.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 7/7] math: Provide modf128 for static libm on alpha, s390, and sparcv9
2024-05-20 19:07 ` Adhemerval Zanella Netto
@ 2024-05-21 15:40 ` H.J. Lu
2024-05-21 16:41 ` Adhemerval Zanella Netto
0 siblings, 1 reply; 31+ messages in thread
From: H.J. Lu @ 2024-05-21 15:40 UTC (permalink / raw)
To: Adhemerval Zanella Netto; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On Mon, May 20, 2024 at 12:07 PM Adhemerval Zanella Netto
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 20/05/24 13:59, H.J. Lu wrote:
> > On Tue, Apr 2, 2024 at 7:07 AM Adhemerval Zanella
> > <adhemerval.zanella@linaro.org> wrote:
> >>
> >> Checked with a build for the affected ABIs
> >> ---
> >> sysdeps/ieee754/ldbl-64-128/s_modfl.c | 4 ++--
> >> 1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/sysdeps/ieee754/ldbl-64-128/s_modfl.c b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
> >> index 7d7aeae111..ba3d31334a 100644
> >> --- a/sysdeps/ieee754/ldbl-64-128/s_modfl.c
> >> +++ b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
> >> @@ -1,10 +1,10 @@
> >> #include <math_ldbl_opt.h>
> >> #include <libm-alias-ldouble.h>
> >> -#if IS_IN (libc)
> >> +#if IS_IN (libc) && defined SHARED
> >> # undef libm_alias_ldouble
> >> # define libm_alias_ldouble(from, to)
> >> #endif
> >> #include <sysdeps/ieee754/ldbl-128/s_modfl.c>
> >> -#if IS_IN (libc)
> >> +#if IS_IN (libc) && defined SHARED
> >> long_double_symbol (libc, __modfl, modfl);
> >
> > Doesn't this remove modfl from static library?
>
> As for copysignf128 and frexp128, this symbol is also provided by libc.a.
> Before this patch:
>
> alpha-linux-gnu$ readelf -sW libc.a | grep -w modf.*
> 19: 0000000000000000 572 FUNC WEAK DEFAULT [STD GPLOAD] 1 modfl
> 17: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff32x
> 18: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff64
> 19: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modf
> 17: 0000000000000000 244 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff32
> 18: 0000000000000000 244 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff
>
> After this patch:
>
> alpha-linux-gnu$ readelf -sW libc.a | grep -w modf.*
> 19: 0000000000000000 572 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff64x
> 20: 0000000000000000 572 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff128
> 21: 0000000000000000 572 FUNC WEAK DEFAULT [STD GPLOAD] 1 modfl
> 17: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff32x
> 18: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff64
> 19: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modf
> 17: 0000000000000000 244 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff32
> 18: 0000000000000000 244 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff
>
>
I am working on a patch to check missing symbols in static libraries.
I opened:
https://sourceware.org/bugzilla/show_bug.cgi?id=31781
scalbnf128 seems also missing in alpha libm.a.
--
H.J.
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v3 7/7] math: Provide modf128 for static libm on alpha, s390, and sparcv9
2024-05-21 15:40 ` H.J. Lu
@ 2024-05-21 16:41 ` Adhemerval Zanella Netto
0 siblings, 0 replies; 31+ messages in thread
From: Adhemerval Zanella Netto @ 2024-05-21 16:41 UTC (permalink / raw)
To: H.J. Lu; +Cc: libc-alpha, Joseph Myers, Florian Weimer
On 21/05/24 12:40, H.J. Lu wrote:
> On Mon, May 20, 2024 at 12:07 PM Adhemerval Zanella Netto
> <adhemerval.zanella@linaro.org> wrote:
>>
>>
>>
>> On 20/05/24 13:59, H.J. Lu wrote:
>>> On Tue, Apr 2, 2024 at 7:07 AM Adhemerval Zanella
>>> <adhemerval.zanella@linaro.org> wrote:
>>>>
>>>> Checked with a build for the affected ABIs
>>>> ---
>>>> sysdeps/ieee754/ldbl-64-128/s_modfl.c | 4 ++--
>>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/sysdeps/ieee754/ldbl-64-128/s_modfl.c b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
>>>> index 7d7aeae111..ba3d31334a 100644
>>>> --- a/sysdeps/ieee754/ldbl-64-128/s_modfl.c
>>>> +++ b/sysdeps/ieee754/ldbl-64-128/s_modfl.c
>>>> @@ -1,10 +1,10 @@
>>>> #include <math_ldbl_opt.h>
>>>> #include <libm-alias-ldouble.h>
>>>> -#if IS_IN (libc)
>>>> +#if IS_IN (libc) && defined SHARED
>>>> # undef libm_alias_ldouble
>>>> # define libm_alias_ldouble(from, to)
>>>> #endif
>>>> #include <sysdeps/ieee754/ldbl-128/s_modfl.c>
>>>> -#if IS_IN (libc)
>>>> +#if IS_IN (libc) && defined SHARED
>>>> long_double_symbol (libc, __modfl, modfl);
>>>
>>> Doesn't this remove modfl from static library?
>>
>> As for copysignf128 and frexp128, this symbol is also provided by libc.a.
>> Before this patch:
>>
>> alpha-linux-gnu$ readelf -sW libc.a | grep -w modf.*
>> 19: 0000000000000000 572 FUNC WEAK DEFAULT [STD GPLOAD] 1 modfl
>> 17: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff32x
>> 18: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff64
>> 19: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modf
>> 17: 0000000000000000 244 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff32
>> 18: 0000000000000000 244 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff
>>
>> After this patch:
>>
>> alpha-linux-gnu$ readelf -sW libc.a | grep -w modf.*
>> 19: 0000000000000000 572 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff64x
>> 20: 0000000000000000 572 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff128
>> 21: 0000000000000000 572 FUNC WEAK DEFAULT [STD GPLOAD] 1 modfl
>> 17: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff32x
>> 18: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff64
>> 19: 0000000000000000 304 FUNC WEAK DEFAULT [STD GPLOAD] 1 modf
>> 17: 0000000000000000 244 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff32
>> 18: 0000000000000000 244 FUNC WEAK DEFAULT [STD GPLOAD] 1 modff
>>
>>
>
> I am working on a patch to check missing symbols in static libraries.
> I opened:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=31781
>
> scalbnf128 seems also missing in alpha libm.a.
>
It seems so, the static tests I have added only cover for the auto-generated
function from the libm-test-funcs-auto, libm-test-funcs-noauto, and
libm-test-funcs-narrow; and the are some function that are not covered by
these (scalbn for instance).
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2024-05-21 16:41 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-02 14:06 [PATCH v3 0/7] Fix some libm static issues Adhemerval Zanella
2024-04-02 14:06 ` [PATCH v3 1/7] math: Add support for auto static math tests Adhemerval Zanella
2024-05-20 16:48 ` H.J. Lu
2024-05-20 17:21 ` Adhemerval Zanella Netto
2024-04-02 14:06 ` [PATCH v3 2/7] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488) Adhemerval Zanella
2024-05-11 9:59 ` Aurelien Jarno
2024-05-21 12:40 ` H.J. Lu
2024-05-21 12:54 ` Adhemerval Zanella Netto
2024-04-02 14:06 ` [PATCH v3 3/7] math: Fix i386 and m68k exp10 on static build Adhemerval Zanella
2024-05-11 9:59 ` Aurelien Jarno
2024-05-21 12:48 ` H.J. Lu
2024-05-21 12:54 ` Adhemerval Zanella Netto
2024-04-02 14:06 ` [PATCH v3 4/7] math: Fix isnanf128 " Adhemerval Zanella
2024-05-20 16:51 ` H.J. Lu
2024-05-20 18:53 ` Adhemerval Zanella Netto
2024-05-20 21:34 ` H.J. Lu
2024-05-21 12:32 ` Adhemerval Zanella Netto
2024-05-21 12:36 ` H.J. Lu
2024-05-21 12:56 ` Adhemerval Zanella Netto
2024-04-02 14:06 ` [PATCH v3 5/7] math: Provided copysignf128 for static libm on alpha, s390, and sparcv9 Adhemerval Zanella
2024-05-20 16:55 ` H.J. Lu
2024-05-20 19:04 ` Adhemerval Zanella Netto
2024-04-02 14:06 ` [PATCH v3 6/7] math: Provide frexpf128 " Adhemerval Zanella
2024-05-20 16:57 ` H.J. Lu
2024-05-20 19:06 ` Adhemerval Zanella Netto
2024-04-02 14:06 ` [PATCH v3 7/7] math: Provide modf128 " Adhemerval Zanella
2024-05-20 16:59 ` H.J. Lu
2024-05-20 19:07 ` Adhemerval Zanella Netto
2024-05-21 15:40 ` H.J. Lu
2024-05-21 16:41 ` Adhemerval Zanella Netto
2024-05-20 16:31 ` [PATCH v3 0/7] Fix some libm static issues Adhemerval Zanella Netto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).