diff mbox series

[v8,2/4] Update math: redirect roundeven function

Message ID 20210623222846.2162301-3-hjl.tools@gmail.com
State Committed
Commit 3213ed770cbc5821920d16caa93c85e92dd7b9f6
Headers show
Series Improve roundeven function | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

H.J. Lu June 23, 2021, 10:28 p.m. UTC
Redirect target specific roundeven functions for aarch64, ldbl-128ibm
and riscv.
---
 sysdeps/aarch64/fpu/s_roundeven.c          | 2 +-
 sysdeps/aarch64/fpu/s_roundevenf.c         | 1 +
 sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c | 1 +
 sysdeps/riscv/rv64/rvd/s_roundeven.c       | 2 +-
 sysdeps/riscv/rvf/s_roundevenf.c           | 1 +
 5 files changed, 5 insertions(+), 2 deletions(-)

Comments

Andreas Schwab June 28, 2021, 8:08 a.m. UTC | #1
s390x fails to build.

gcc ../sysdeps/s390/fpu/s_roundevenl.c -c -std=gnu11 -fgnu89-inline  -O2 -g -m64 -fmessage-length=0 -funwind-tables -fasynchronous-unwind-tables -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fstack-protector -Wstrict-prototypes -Wold-style-definition -fno-math-errno -mlong-double-128           -I../include -I/home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math  -I/home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base  -I../sysdeps/unix/sysv/linux/s390/s390-64  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/unix/sysv/linux/s390/fpu  -I../sysdeps/s390/fpu  -I../sysdeps/unix/sysv/linux/s390  -I../sysdeps/s390/nptl  -I../sysdeps/ieee754/ldbl-64-128  -I../sysdeps/ieee754/ldbl-opt  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/s390/s390-64  -I../sysdeps/wordsize-64  -I../sysdeps/s390/multiarch  -I../sysdeps/s390  -I../sysdeps/ieee754/ldbl-128  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.  -D_LIBC_REENTRANT -include /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/libc-modules.h -DMODULE_NAME=libm -include ../include/libc-symbols.h  -DPIC     -DTOP_NAMESPACE=glibc -o /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o -MD -MP -MF /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o.dt -MT /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o
/tmp/ccYVXAks.s: Assembler messages:
/tmp/ccYVXAks.s:42: Error: symbol `__roundevenl' is already defined
make[2]: *** [/home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/sysd-rules:135: /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o] Error 1

Andreas.
Stefan Liebler June 28, 2021, 8:33 a.m. UTC | #2
On 28/06/2021 10:08, Andreas Schwab wrote:
> s390x fails to build.
> 
> gcc ../sysdeps/s390/fpu/s_roundevenl.c -c -std=gnu11 -fgnu89-inline  -O2 -g -m64 -fmessage-length=0 -funwind-tables -fasynchronous-unwind-tables -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fstack-protector -Wstrict-prototypes -Wold-style-definition -fno-math-errno -mlong-double-128           -I../include -I/home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math  -I/home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base  -I../sysdeps/unix/sysv/linux/s390/s390-64  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/unix/sysv/linux/s390/fpu  -I../sysdeps/s390/fpu  -I../sysdeps/unix/sysv/linux/s390  -I../sysdeps/s390/nptl  -I../sysdeps/ieee754/ldbl-64-128  -I../sysdeps/ieee754/ldbl-opt  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/s390/s390-64  -I../sysdeps/wordsize-64  -I../sysdeps/s390/multiarch  -I../sysdeps/s390  -I../sysdeps/ieee754/ldbl-128  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.  -D_LIBC_REENTRANT -include /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/libc-modules.h -DMODULE_NAME=libm -include ../include/libc-symbols.h  -DPIC     -DTOP_NAMESPACE=glibc -o /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o -MD -MP -MF /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o.dt -MT /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o
> /tmp/ccYVXAks.s: Assembler messages:
> /tmp/ccYVXAks.s:42: Error: symbol `__roundevenl' is already defined
> make[2]: *** [/home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/sysd-rules:135: /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o] Error 1
> 
> Andreas.
> 

Hi Andreas,

I've also just recognized this issue and will post a patch later.

Thanks,
Stefan
H.J. Lu June 28, 2021, 11:42 a.m. UTC | #3
On Mon, Jun 28, 2021 at 1:34 AM Stefan Liebler via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> On 28/06/2021 10:08, Andreas Schwab wrote:
> > s390x fails to build.
> >
> > gcc ../sysdeps/s390/fpu/s_roundevenl.c -c -std=gnu11 -fgnu89-inline  -O2 -g -m64 -fmessage-length=0 -funwind-tables -fasynchronous-unwind-tables -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fstack-protector -Wstrict-prototypes -Wold-style-definition -fno-math-errno -mlong-double-128           -I../include -I/home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math  -I/home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base  -I../sysdeps/unix/sysv/linux/s390/s390-64  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/unix/sysv/linux/s390/fpu  -I../sysdeps/s390/fpu  -I../sysdeps/unix/sysv/linux/s390  -I../sysdeps/s390/nptl  -I../sysdeps/ieee754/ldbl-64-128  -I../sysdeps/ieee754/ldbl-opt  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/s390/s390-64  -I../sysdeps/wordsize-64  -I../sysdeps/s390/multiarch  -I../sysdeps/s390  -I../sysdeps/ieee754/ldbl-128  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.  -D_LIBC_REENTRANT -include /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/libc-modules.h -DMODULE_NAME=libm -include ../include/libc-symbols.h  -DPIC     -DTOP_NAMESPACE=glibc -o /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o -MD -MP -MF /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o.dt -MT /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o
> > /tmp/ccYVXAks.s: Assembler messages:
> > /tmp/ccYVXAks.s:42: Error: symbol `__roundevenl' is already defined
> > make[2]: *** [/home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/sysd-rules:135: /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o] Error 1
> >
> > Andreas.
> >
>
> Hi Andreas,
>
> I've also just recognized this issue and will post a patch later.
>

Sorry for this.  Why didn't scripts/build-many-glibcs.py catch it?

$ s390x-glibc-linux-gnu-gcc ../sysdeps/s390/fpu/s_roundevenl.c -c
-std=gnu11 -fgnu89-inline  -g -O2 -Wall -Wwrite-strings -Wundef
-Werror -fmerge-all-constants -frounding-math -fno-stack-protector
-Wstrict-prototypes -Wold-style-definition -fno-math-errno
-mlong-double-128           -I../include
-I/export/project/tools-build/glibc-many/build/glibcs/s390x-linux-gnu/glibc/math
 -I/export/project/tools-build/glibc-many/build/glibcs/s390x-linux-gnu/glibc
 -I../sysdeps/unix/sysv/linux/s390/s390-64
-I../sysdeps/unix/sysv/linux/wordsize-64
-I../sysdeps/unix/sysv/linux/s390/fpu  -I../sysdeps/s390/fpu
-I../sysdeps/unix/sysv/linux/s390  -I../sysdeps/s390/nptl
-I../sysdeps/ieee754/ldbl-64-128  -I../sysdeps/ieee754/ldbl-opt
-I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux
-I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu
-I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix
-I../sysdeps/posix  -I../sysdeps/s390/s390-64
-I../sysdeps/wordsize-64  -I../sysdeps/s390/multiarch
-I../sysdeps/s390  -I../sysdeps/ieee754/ldbl-128
-I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32
-I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.
-D_LIBC_REENTRANT -include
/export/project/tools-build/glibc-many/build/glibcs/s390x-linux-gnu/glibc/libc-modules.h
-DMODULE_NAME=libm -include ../include/libc-symbols.h
-DTOP_NAMESPACE=glibc -o
/export/project/tools-build/glibc-many/build/glibcs/s390x-linux-gnu/glibc/math/s_roundevenl.o
-MD -MP -MF /export/project/tools-build/glibc-many/build/glibcs/s390x-linux-gnu/glibc/math/s_roundevenl.o.dt
-MT /export/project/tools-build/glibc-many/build/glibcs/s390x-linux-gnu/glibc/math/s_roundevenl.o

compiled fine.
Stefan Liebler June 29, 2021, 7:14 a.m. UTC | #4
On 28/06/2021 13:42, H.J. Lu wrote:
> On Mon, Jun 28, 2021 at 1:34 AM Stefan Liebler via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
>>
>> On 28/06/2021 10:08, Andreas Schwab wrote:
>>> s390x fails to build.
>>>
>>> gcc ../sysdeps/s390/fpu/s_roundevenl.c -c -std=gnu11 -fgnu89-inline  -O2 -g -m64 -fmessage-length=0 -funwind-tables -fasynchronous-unwind-tables -Wall -Wwrite-strings -Wundef -Werror -fmerge-all-constants -frounding-math -fstack-protector -Wstrict-prototypes -Wold-style-definition -fno-math-errno -mlong-double-128           -I../include -I/home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math  -I/home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base  -I../sysdeps/unix/sysv/linux/s390/s390-64  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/unix/sysv/linux/s390/fpu  -I../sysdeps/s390/fpu  -I../sysdeps/unix/sysv/linux/s390  -I../sysdeps/s390/nptl  -I../sysdeps/ieee754/ldbl-64-128  -I../sysdeps/ieee754/ldbl-opt  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/s390/s390-64  -I../sysdeps/wordsize-64  -I../sysdeps/s390/multiarch  -I../sysdeps/s390  -I../sysdeps/ieee754/ldbl-128  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.  -D_LIBC_REENTRANT -include /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/libc-modules.h -DMODULE_NAME=libm -include ../include/libc-symbols.h  -DPIC     -DTOP_NAMESPACE=glibc -o /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o -MD -MP -MF /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o.dt -MT /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o
>>> /tmp/ccYVXAks.s: Assembler messages:
>>> /tmp/ccYVXAks.s:42: Error: symbol `__roundevenl' is already defined
>>> make[2]: *** [/home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/sysd-rules:135: /home/abuild/rpmbuild/BUILD/glibc-2.33.9000.810.g5adda61f62/cc-base/math/s_roundevenl.o] Error 1
>>>
>>> Andreas.
>>>
>>
>> Hi Andreas,
>>
>> I've also just recognized this issue and will post a patch later.
>>
> 
> Sorry for this.  Why didn't scripts/build-many-glibcs.py catch it?
> 
> $ s390x-glibc-linux-gnu-gcc ../sysdeps/s390/fpu/s_roundevenl.c -c
> -std=gnu11 -fgnu89-inline  -g -O2 -Wall -Wwrite-strings -Wundef
> -Werror -fmerge-all-constants -frounding-math -fno-stack-protector
> -Wstrict-prototypes -Wold-style-definition -fno-math-errno
> -mlong-double-128           -I../include
> -I/export/project/tools-build/glibc-many/build/glibcs/s390x-linux-gnu/glibc/math
>  -I/export/project/tools-build/glibc-many/build/glibcs/s390x-linux-gnu/glibc
>  -I../sysdeps/unix/sysv/linux/s390/s390-64
> -I../sysdeps/unix/sysv/linux/wordsize-64
> -I../sysdeps/unix/sysv/linux/s390/fpu  -I../sysdeps/s390/fpu
> -I../sysdeps/unix/sysv/linux/s390  -I../sysdeps/s390/nptl
> -I../sysdeps/ieee754/ldbl-64-128  -I../sysdeps/ieee754/ldbl-opt
> -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux
> -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu
> -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix
> -I../sysdeps/posix  -I../sysdeps/s390/s390-64
> -I../sysdeps/wordsize-64  -I../sysdeps/s390/multiarch
> -I../sysdeps/s390  -I../sysdeps/ieee754/ldbl-128
> -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32
> -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.
> -D_LIBC_REENTRANT -include
> /export/project/tools-build/glibc-many/build/glibcs/s390x-linux-gnu/glibc/libc-modules.h
> -DMODULE_NAME=libm -include ../include/libc-symbols.h
> -DTOP_NAMESPACE=glibc -o
> /export/project/tools-build/glibc-many/build/glibcs/s390x-linux-gnu/glibc/math/s_roundevenl.o
> -MD -MP -MF /export/project/tools-build/glibc-many/build/glibcs/s390x-linux-gnu/glibc/math/s_roundevenl.o.dt
> -MT /export/project/tools-build/glibc-many/build/glibcs/s390x-linux-gnu/glibc/math/s_roundevenl.o
> 
> compiled fine.
> 
I assume, that the default ALS of gcc is older than z196. Then
sysdeps/ieee754/ldbl-128/s_roundevenl.c is included which builds fine.

I've wanted to add some different ALS-levels in the past, but in the
end, we only added -O3 due to more aggressive inlining on s390x:
https://sourceware.org/pipermail/libc-alpha/2020-August/116839.html

Bye,
Stefan
diff mbox series

Patch

diff --git a/sysdeps/aarch64/fpu/s_roundeven.c b/sysdeps/aarch64/fpu/s_roundeven.c
index d74b40daf5..fbce9aaded 100644
--- a/sysdeps/aarch64/fpu/s_roundeven.c
+++ b/sysdeps/aarch64/fpu/s_roundeven.c
@@ -16,6 +16,7 @@ 
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#define NO_MATH_REDIRECT
 #include <math.h>
 #include <libm-alias-double.h>
 
@@ -25,5 +26,4 @@  __roundeven (double x)
   asm volatile ("frintn \t%d0, %d1" : "=w" (x) : "w" (x));
   return x;
 }
-hidden_def (__roundeven)
 libm_alias_double (__roundeven, roundeven)
diff --git a/sysdeps/aarch64/fpu/s_roundevenf.c b/sysdeps/aarch64/fpu/s_roundevenf.c
index dfc492c2f8..7985ca5f30 100644
--- a/sysdeps/aarch64/fpu/s_roundevenf.c
+++ b/sysdeps/aarch64/fpu/s_roundevenf.c
@@ -16,6 +16,7 @@ 
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#define NO_MATH_REDIRECT
 #include <math.h>
 #include <libm-alias-float.h>
 
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c b/sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c
index 6701970f4a..90eecf496b 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c
@@ -17,6 +17,7 @@ 
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#define NO_MATH_REDIRECT
 #include <math.h>
 #include <math_private.h>
 
diff --git a/sysdeps/riscv/rv64/rvd/s_roundeven.c b/sysdeps/riscv/rv64/rvd/s_roundeven.c
index e77d8307d1..02dd0f7a9a 100644
--- a/sysdeps/riscv/rv64/rvd/s_roundeven.c
+++ b/sysdeps/riscv/rv64/rvd/s_roundeven.c
@@ -16,6 +16,7 @@ 
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#define NO_MATH_REDIRECT
 #include <math.h>
 #include <fenv_private.h>
 #include <libm-alias-double.h>
@@ -49,5 +50,4 @@  __roundeven (double x)
   return x;
 }
 
-hidden_def (__roundeven)
 libm_alias_double (__roundeven, roundeven)
diff --git a/sysdeps/riscv/rvf/s_roundevenf.c b/sysdeps/riscv/rvf/s_roundevenf.c
index fa594d46bd..be22d047e2 100644
--- a/sysdeps/riscv/rvf/s_roundevenf.c
+++ b/sysdeps/riscv/rvf/s_roundevenf.c
@@ -16,6 +16,7 @@ 
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#define NO_MATH_REDIRECT
 #include <math.h>
 #include <fenv_private.h>
 #include <libm-alias-float.h>