platform/upstream/glibc.git
5 years agoS390: Refactor wcsncmp ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:21 +0000 (13:57 +0100)]
S390: Refactor wcsncmp ifunc handling.

The ifunc handling for wcsncmp is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove wcsncmp variants.
* sysdeps/s390/Makefile (sysdep_routines): Add wcsncmp variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for wcsncmp.
* sysdeps/s390/multiarch/wcsncmp-c.c: Move to ...
* sysdeps/s390/wcsncmp-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcsncmp-vx.S: Move to ...
* sysdeps/s390/wcsncmp-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcsncmp.c: Move to ...
* sysdeps/s390/wcsncmp.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-wcsncmp.h: New file.

5 years agoS390: Refactor wcscmp ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:21 +0000 (13:57 +0100)]
S390: Refactor wcscmp ifunc handling.

The ifunc handling for wcscmp is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove wcscmp variants.
* sysdeps/s390/Makefile (sysdep_routines): Add wcscmp variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for wcscmp.
* sysdeps/s390/multiarch/wcscmp-c.c: Move to ...
* sysdeps/s390/wcscmp-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcscmp-vx.S: Move to ...
* sysdeps/s390/wcscmp-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcscmp.c: Move to ...
* sysdeps/s390/wcscmp.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-wcscmp.h: New file.

5 years agoS390: Refactor wcsncat ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:20 +0000 (13:57 +0100)]
S390: Refactor wcsncat ifunc handling.

The ifunc handling for wcsncat is adjusted in order to omit ifunc
if the minimum architecture level already supports newer CPUs by default.
Unfortunately the c ifunc variant can't be omitted at all as it is used
by the z13 ifunc variant as fallback if the pointers are not 4-byte aligned.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove wcsncat variants.
* sysdeps/s390/Makefile (sysdep_routines): Add wcsncat variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for wcsncat.
* sysdeps/s390/multiarch/wcsncat-c.c: Move to ...
* sysdeps/s390/wcsncat-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcsncat-vx.S: Move to ...
* sysdeps/s390/wcsncat-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcsncat.c: Move to ...
* sysdeps/s390/wcsncat.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-wcsncat.h: New file.

5 years agoS390: Refactor wcscat ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:20 +0000 (13:57 +0100)]
S390: Refactor wcscat ifunc handling.

The ifunc handling for wcscat is adjusted in order to omit ifunc
if the minimum architecture level already supports newer CPUs by default.
Unfortunately the c ifunc variant can't be omitted at all as it is used
by the z13 ifunc variant as fallback if the pointers are not 4-byte aligned.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove wcscat variants.
* sysdeps/s390/Makefile (sysdep_routines): Add wcscat variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for wcscat.
* sysdeps/s390/multiarch/wcscat-c.c: Move to ...
* sysdeps/s390/wcscat-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcscat-vx.S: Move to ...
* sysdeps/s390/wcscat-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcscat.c: Move to ...
* sysdeps/s390/wcscat.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-wcscat.h: New file.

5 years agoS390: Refactor wcpncpy ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:19 +0000 (13:57 +0100)]
S390: Refactor wcpncpy ifunc handling.

The ifunc handling for wcpncpy is adjusted in order to omit ifunc
if the minimum architecture level already supports newer CPUs by default.
Unfortunately the c ifunc variant can't be omitted at all as it is used
by the z13 ifunc variant as fallback if the pointers are not 4-byte aligned.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove wcpncpy variants.
* sysdeps/s390/Makefile (sysdep_routines): Add wcpncpy variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for wcpncpy.
* sysdeps/s390/multiarch/wcpncpy-c.c: Move to ...
* sysdeps/s390/wcpncpy-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcpncpy-vx.S: Move to ...
* sysdeps/s390/wcpncpy-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcpncpy.c: Move to ...
* sysdeps/s390/wcpncpy.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-wcpncpy.h: New file.

5 years agoS390: Refactor wcsncpy ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:19 +0000 (13:57 +0100)]
S390: Refactor wcsncpy ifunc handling.

The ifunc handling for wcsncpy is adjusted in order to omit ifunc
if the minimum architecture level already supports newer CPUs by default.
Unfortunately the c ifunc variant can't be omitted at all as it is used
by the z13 ifunc variant as fallback if the pointers are not 4-byte aligned.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove wcsncpy variants.
* sysdeps/s390/Makefile (sysdep_routines): Add wcsncpy variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for wcsncpy.
* sysdeps/s390/multiarch/wcsncpy-c.c: Move to ...
* sysdeps/s390/wcsncpy-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcsncpy-vx.S: Move to ...
* sysdeps/s390/wcsncpy-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcsncpy.c: Move to ...
* sysdeps/s390/wcsncpy.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-wcsncpy.h: New file.

5 years agoS390: Refactor wcpcpy ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:19 +0000 (13:57 +0100)]
S390: Refactor wcpcpy ifunc handling.

The ifunc handling for wcpcpy is adjusted in order to omit ifunc
if the minimum architecture level already supports newer CPUs by default.
Unfortunately the c ifunc variant can't be omitted at all as it is used
by the z13 ifunc variant as fallback if the pointers are not 4-byte aligned.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove wcpcpy variants.
* sysdeps/s390/Makefile (sysdep_routines): Add wcpcpy variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for wcpcpy.
* sysdeps/s390/multiarch/wcpcpy-c.c: Move to ...
* sysdeps/s390/wcpcpy-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcpcpy-vx.S: Move to ...
* sysdeps/s390/wcpcpy-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcpcpy.c: Move to ...
* sysdeps/s390/wcpcpy.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-wcpcpy.h: New file.

5 years agoS390: Refactor wcscpy ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:18 +0000 (13:57 +0100)]
S390: Refactor wcscpy ifunc handling.

The ifunc handling for wcscpy is adjusted in order to omit ifunc
if the minimum architecture level already supports newer CPUs by default.
Unfortunately the c ifunc variant can't be omitted at all as it is used
by the z13 ifunc variant as fallback if the pointers are not 4-byte aligned.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove wcscpy variants.
* sysdeps/s390/Makefile (sysdep_routines): Add wcscpy variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for wcscpy.
* sysdeps/s390/multiarch/wcscpy-c.c: Move to ...
* sysdeps/s390/wcscpy-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcscpy-vx.S: Move to ...
* sysdeps/s390/wcscpy-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcscpy.c: Move to ...
* sysdeps/s390/wcscpy.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-wcscpy.h: New file.

5 years agoS390: Refactor wcsnlen ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:18 +0000 (13:57 +0100)]
S390: Refactor wcsnlen ifunc handling.

The ifunc handling for wcsnlen is adjusted in order to omit ifunc
if the minimum architecture level already supports newer CPUs by default.
Unfortunately the c ifunc variant can't be omitted at all as it is used
by the z13 ifunc variant as fallback if the pointers are not 4-byte aligned.
Glibc internal calls will use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove wcsnlen variants.
* sysdeps/s390/Makefile (sysdep_routines): Add wcsnlen variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for wcsnlen.
* sysdeps/s390/multiarch/wcsnlen-c.c: Move to ...
* sysdeps/s390/wcsnlen-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcsnlen-vx.S: Move to ...
* sysdeps/s390/wcsnlen-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcsnlen.c: Move to ...
* sysdeps/s390/wcsnlen.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-wcsnlen.h: New file.

5 years agoS390: Refactor wcslen ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:17 +0000 (13:57 +0100)]
S390: Refactor wcslen ifunc handling.

The ifunc handling for wcslen is adjusted in order to omit ifunc
if the minimum architecture level already supports newer CPUs by default.
Unfortunately the c ifunc variant can't be omitted at all as it is used
by the z13 ifunc variant as fallback if the pointers are not 4-byte aligned.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove wcslen variants.
* sysdeps/s390/Makefile (sysdep_routines): Add wcslen variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for wcslen.
* sysdeps/s390/multiarch/wcslen-c.c: Move to ...
* sysdeps/s390/wcslen-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcslen-vx.S: Move to ...
* sysdeps/s390/wcslen-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/wcslen.c: Move to ...
* sysdeps/s390/wcslen.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-wcslen.h: New file.

5 years agoS390: Refactor memrchr ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:17 +0000 (13:57 +0100)]
S390: Refactor memrchr ifunc handling.

The ifunc handling for memrchr is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove memrchr variants.
* sysdeps/s390/Makefile (sysdep_routines): Add memrchr variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for memrchr.
* sysdeps/s390/multiarch/memrchr-c.c: Move to ...
* sysdeps/s390/memrchr-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/memrchr-vx.S: Move to ...
* sysdeps/s390/memrchr-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/memrchr.c: Move to ...
* sysdeps/s390/memrchr.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-memrchr.h: New file.

5 years agoS390: Refactor memccpy ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:16 +0000 (13:57 +0100)]
S390: Refactor memccpy ifunc handling.

The ifunc handling for memccpy is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove memccpy variants.
* sysdeps/s390/Makefile (sysdep_routines): Add memccpy variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for memccpy.
* sysdeps/s390/multiarch/memccpy-c.c: Move to ...
* sysdeps/s390/memccpy-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/memccpy-vx.S: Move to ...
* sysdeps/s390/memccpy-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/memccpy.c: Move to ...
* sysdeps/s390/memccpy.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-memccpy.h: New file.

5 years agoS390: Refactor rawmemchr ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:16 +0000 (13:57 +0100)]
S390: Refactor rawmemchr ifunc handling.

The ifunc handling for rawmemchr is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove rawmemchr variants.
* sysdeps/s390/Makefile (sysdep_routines): Add rawmemchr variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for rawmemchr.
* sysdeps/s390/multiarch/rawmemchr-c.c: Move to ...
* sysdeps/s390/rawmemchr-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/rawmemchr-vx.S: Move to ...
* sysdeps/s390/rawmemchr-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/rawmemchr.c: Move to ...
* sysdeps/s390/rawmemchr.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-rawmemchr.h: New file.

5 years agoS390: Refactor memchr ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:16 +0000 (13:57 +0100)]
S390: Refactor memchr ifunc handling.

The ifunc handling for memchr is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

Note: The fallback s390-32/s390-64 ifunc variants with srst instruction
are now moved to the unified memchr-z900.S file which can be used for
31/64bit. The s390-32/s390-64 files multiarch/memchr.c and memchr.S
are deleted.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove memchr variants.
* sysdeps/s390/Makefile (sysdep_routines): Add memchr variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for memchr.
* sysdeps/s390/multiarch/memchr-vx.S: Move to ...
* sysdeps/s390/memchr-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/memchr.c: Move to ...
* sysdeps/s390/memchr.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-memchr.h: New file.
* sysdeps/s390/s390-64/memchr.S: Move to ...
* sysdeps/s390/memchr-z900.S: ... here and adjust to be usable
for 31/64bit and ifunc handling.
* sysdeps/s390/s390-32/multiarch/memchr.c: Delete file.
* sysdeps/s390/s390-64/multiarch/memchr.c: Likewise.
* sysdeps/s390/s390-32/memchr.S: Likewise.

5 years agoS390: Refactor strcspn ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:15 +0000 (13:57 +0100)]
S390: Refactor strcspn ifunc handling.

The ifunc handling for strcspn is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove strcspn variants.
* sysdeps/s390/Makefile (sysdep_routines): Add strcspn variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for strcspn.
* sysdeps/s390/multiarch/strcspn-c.c: Move to ...
* sysdeps/s390/strcspn-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strcspn-vx.S: Move to ...
* sysdeps/s390/strcspn-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strcspn.c: Move to ...
* sysdeps/s390/strcspn.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-strcspn.h: New file.

5 years agoS390: Refactor strpbrk ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:15 +0000 (13:57 +0100)]
S390: Refactor strpbrk ifunc handling.

The ifunc handling for strpbrk is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove strpbrk variants.
* sysdeps/s390/Makefile (sysdep_routines): Add strpbrk variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for strpbrk.
* sysdeps/s390/multiarch/strpbrk-c.c: Move to ...
* sysdeps/s390/strpbrk-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strpbrk-vx.S: Move to ...
* sysdeps/s390/strpbrk-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strpbrk.c: Move to ...
* sysdeps/s390/strpbrk.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-strpbrk.h: New file.

5 years agoS390: Refactor strspn ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:15 +0000 (13:57 +0100)]
S390: Refactor strspn ifunc handling.

The ifunc handling for strspn is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove strspn variants.
* sysdeps/s390/Makefile (sysdep_routines): Add strspn variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for strspn.
* sysdeps/s390/multiarch/strspn-c.c: Move to ...
* sysdeps/s390/strspn-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strspn-vx.S: Move to ...
* sysdeps/s390/strspn-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strspn.c: Move to ...
* sysdeps/s390/strspn.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-strspn.h: New file.

5 years agoS390: Refactor strrchr ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:14 +0000 (13:57 +0100)]
S390: Refactor strrchr ifunc handling.

The ifunc handling for strrchr is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove strrchr variants.
* sysdeps/s390/Makefile (sysdep_routines): Add strrchr variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for strrchr.
* sysdeps/s390/multiarch/strrchr-c.c: Move to ...
* sysdeps/s390/strrchr-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strrchr-vx.S: Move to ...
* sysdeps/s390/strrchr-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strrchr.c: Move to ...
* sysdeps/s390/strrchr.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-strrchr.h: New file.

5 years agoS390: Refactor strchrnul ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:14 +0000 (13:57 +0100)]
S390: Refactor strchrnul ifunc handling.

The ifunc handling for strchrnul is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove strchrnul variants.
* sysdeps/s390/Makefile (sysdep_routines): Add strchrnul variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for strchrnul.
* sysdeps/s390/multiarch/strchrnul-c.c: Move to ...
* sysdeps/s390/strchrnul-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strchrnul-vx.S: Move to ...
* sysdeps/s390/strchrnul-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strchrnul.c: Move to ...
* sysdeps/s390/strchrnul.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-strchrnul.h: New file.

5 years agoS390: Refactor strchr ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:14 +0000 (13:57 +0100)]
S390: Refactor strchr ifunc handling.

The ifunc handling for strchr is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove strchr variants.
* sysdeps/s390/Makefile (sysdep_routines): Add strchr variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for strchr.
* sysdeps/s390/multiarch/strchr-c.c: Move to ...
* sysdeps/s390/strchr-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strchr-vx.S: Move to ...
* sysdeps/s390/strchr-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strchr.c: Move to ...
* sysdeps/s390/strchr.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-strchr.h: New file.

5 years agoS390: Refactor strncmp ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:13 +0000 (13:57 +0100)]
S390: Refactor strncmp ifunc handling.

The ifunc handling for strncmp is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove strncmp variants.
* sysdeps/s390/Makefile (sysdep_routines): Add strncmp variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for strncmp.
* sysdeps/s390/multiarch/strncmp-c.c: Move to ...
* sysdeps/s390/strncmp-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strncmp-vx.S: Move to ...
* sysdeps/s390/strncmp-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strncmp.c: Move to ...
* sysdeps/s390/strncmp.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-strncmp.h: New file.

5 years agoS390: Refactor strcmp ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:13 +0000 (13:57 +0100)]
S390: Refactor strcmp ifunc handling.

The ifunc handling for strcmp is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

Note: The fallback s390-32/s390-64 ifunc variants with clst instruction
are now moved to the unified strcmp-z900.S file which can be used for
31/64bit. The s390-32/s390-64 files multiarch/strcmp.c and strcmp.S
are deleted.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove strcmp variants.
* sysdeps/s390/Makefile (sysdep_routines): Add strcmp variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for strcmp.
* sysdeps/s390/multiarch/strcmp-vx.S: Move to ...
* sysdeps/s390/strcmp-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strcmp.c: Move to ...
* sysdeps/s390/strcmp.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-strcmp.h: New file.
* sysdeps/s390/s390-64/strcmp.S: Move to ...
* sysdeps/s390/strcmp-z900.S: ... here and adjust to be usable
for 31/64bit and ifunc handling.
* sysdeps/s390/s390-32/multiarch/strcmp.c: Delete file.
* sysdeps/s390/s390-64/multiarch/strcmp.c: Likewise.
* sysdeps/s390/s390-32/strcmp.S: Likewise.

5 years agoS390: Refactor strncat ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:12 +0000 (13:57 +0100)]
S390: Refactor strncat ifunc handling.

The ifunc handling for strncat is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove strncat variants.
* sysdeps/s390/Makefile (sysdep_routines): Add strncat variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for strncat.
* sysdeps/s390/multiarch/strncat-c.c: Move to ...
* sysdeps/s390/strncat-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strncat-vx.S: Move to ...
* sysdeps/s390/strncat-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strncat.c: Move to ...
* sysdeps/s390/strncat.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-strncat.h: New file.

5 years agoS390: Refactor strcat ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:12 +0000 (13:57 +0100)]
S390: Refactor strcat ifunc handling.

The ifunc handling for strcat is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove strcat variants.
* sysdeps/s390/Makefile (sysdep_routines): Add strcat variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for strcat.
* sysdeps/s390/multiarch/strcat-c.c: Move to ...
* sysdeps/s390/strcat-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strcat-vx.S: Move to ...
* sysdeps/s390/strcat-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strcat.c: Move to ...
* sysdeps/s390/strcat.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-strcat.h: New file.

5 years agoS390: Refactor stpncpy ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:11 +0000 (13:57 +0100)]
S390: Refactor stpncpy ifunc handling.

The ifunc handling for stpncpy is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove stpncpy variants.
* sysdeps/s390/Makefile (sysdep_routines): Add stpncpy variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for stpncpy.
* sysdeps/s390/multiarch/stpncpy-c.c: Move to ...
* sysdeps/s390/stpncpy-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/stpncpy-vx.S: Move to ...
* sysdeps/s390/stpncpy-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/stpncpy.c: Move to ...
* sysdeps/s390/stpncpy.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-stpncpy.h: New file.

5 years agoS390: Refactor strncpy ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:11 +0000 (13:57 +0100)]
S390: Refactor strncpy ifunc handling.

The ifunc handling for strncpy is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

Note: The fallback s390-32/s390-64 ifunc variants are now moved to
the strncpy-z900.S files. The s390-32/s390-64 files multiarch/strncpy.c
and strncpy.S are deleted.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove strncpy variants.
* sysdeps/s390/Makefile (sysdep_routines): Add strncpy variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for strncpy.
* sysdeps/s390/multiarch/strncpy-vx.S: Move to ...
* sysdeps/s390/strncpy-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strncpy.c: Move to ...
* sysdeps/s390/strncpy.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-strncpy.h: New file.
* sysdeps/s390/s390-64/strncpy.S: Move to ...
* sysdeps/s390/s390-64/strncpy-z900.S: ... here
and adjust ifunc handling.
* sysdeps/s390/s390-32/strncpy.S: Move to ...
* sysdeps/s390/s390-32/strncpy-z900.S: ... here
and adjust ifunc handling.
* sysdeps/s390/s390-32/multiarch/strncpy.c: Delete file.
* sysdeps/s390/s390-64/multiarch/strncpy.c: Likewise.

5 years agoS390: Refactor stpcpy ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:11 +0000 (13:57 +0100)]
S390: Refactor stpcpy ifunc handling.

The ifunc handling for stpcpy is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove stpcpy variants.
* sysdeps/s390/Makefile (sysdep_routines): Add stpcpy variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for stpcpy.
* sysdeps/s390/multiarch/stpcpy-c.c: Move to ...
* sysdeps/s390/stpcpy-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/stpcpy-vx.S: Move to ...
* sysdeps/s390/stpcpy-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/stpcpy.c: Move to ...
* sysdeps/s390/stpcpy.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-stpcpy.h: New file.

5 years agoS390: Refactor strcpy ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:10 +0000 (13:57 +0100)]
S390: Refactor strcpy ifunc handling.

The ifunc handling for strcpy is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

Note: The fallback s390-32/s390-64 ifunc variants with mvst instruction
are now moved to the unified strcpy-z900.S file which can be used for
31/64bit. The s390-32/s390-64 files multiarch/strcpy.c and strcpy.S
are deleted.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove strcpy variants.
* sysdeps/s390/Makefile (sysdep_routines): Add strcpy variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for strcpy.
* sysdeps/s390/multiarch/strcpy-vx.S: Move to ...
* sysdeps/s390/strcpy-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strcpy.c: Move to ...
* sysdeps/s390/strcpy.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-strcpy.h: New file.
* sysdeps/s390/s390-64/strcpy.S: Move to ...
* sysdeps/s390/strcpy-z900.S: ... here and adjust to be usable
for 31/64bit and ifunc handling.
* sysdeps/s390/s390-32/multiarch/strcpy.c: Delete file.
* sysdeps/s390/s390-64/multiarch/strcpy.c: Likewise.
* sysdeps/s390/s390-32/strcpy.S: Likewise.

5 years agoS390: Refactor strnlen ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:10 +0000 (13:57 +0100)]
S390: Refactor strnlen ifunc handling.

The ifunc handling for strnlen is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove strnlen variants.
* sysdeps/s390/Makefile (sysdep_routines): Add strnlen variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for strnlen.
* sysdeps/s390/multiarch/strnlen-c.c: Move to ...
* sysdeps/s390/strnlen-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strnlen-vx.S: Move to ...
* sysdeps/s390/strnlen-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strnlen.c: Move to ...
* sysdeps/s390/strnlen.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-strnlen.h: New file.

5 years agoS390: Refactor strlen ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:10 +0000 (13:57 +0100)]
S390: Refactor strlen ifunc handling.

The ifunc handling for strlen is adjusted in order to omit ifunc
variants if those will never be used as the minimum architecture level
already supports newer CPUs by default.
Glibc internal calls will then also use the "newer" ifunc variant.

ChangeLog:

* sysdeps/s390/multiarch/Makefile
(sysdep_routines): Remove strlen variants.
* sysdeps/s390/Makefile (sysdep_routines): Add strlen variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Refactor ifunc handling for strlen.
* sysdeps/s390/multiarch/strlen-c.c: Move to ...
* sysdeps/s390/strlen-c.c: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strlen-vx.S: Move to ...
* sysdeps/s390/strlen-vx.S: ... here and adjust ifunc handling.
* sysdeps/s390/multiarch/strlen.c: Move to ...
* sysdeps/s390/strlen.c: ... here and adjust ifunc handling.
* sysdeps/s390/ifunc-strlen.h: New file.

5 years agoS390: Add z13 memmem ifunc variant.
Stefan Liebler [Tue, 18 Dec 2018 12:57:09 +0000 (13:57 +0100)]
S390: Add z13 memmem ifunc variant.

The new vector variant of memmem is using the common code
implementation, but instead of calling the default
mem* functions, the vector variants are called.

ChangeLog:

* sysdeps/s390/Makefile (sysdep_routines): Add memmem variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc variants for memmem.
* sysdeps/s390/ifunc-memmem.h: New file.
* sysdeps/s390/memmem.c: Likewise.
* sysdeps/s390/memmem-c.c: Likewise.
* sysdeps/s390/memmem-vx.c: Likewise.

5 years agoS390: Add z13 strstr ifunc variant.
Stefan Liebler [Tue, 18 Dec 2018 12:57:09 +0000 (13:57 +0100)]
S390: Add z13 strstr ifunc variant.

The new vector variant of strstr is using the common code
implementation, but instead of calling the default
str* / mem* functions, the vector variants are called.

ChangeLog:

* sysdeps/s390/Makefile (sysdep_routines): Add strstr variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc variants for strstr.
* sysdeps/s390/ifunc-strstr.h: New file.
* sysdeps/s390/strstr.c: Likewise.
* sysdeps/s390/strstr-c.c: Likewise.
* sysdeps/s390/strstr-vx.c: Likewise.

5 years agoS390: Add z13 memmove ifunc variant.
Stefan Liebler [Tue, 18 Dec 2018 12:57:08 +0000 (13:57 +0100)]
S390: Add z13 memmove ifunc variant.

This patch introduces a z13 specific ifunc variant for memmove.
As the common code implementation, it checks if we can copy from
the beginning to the end - with z196 memcpy implementation - or
if we have to copy from the end to the beginning.
The latter case is done by using vector load/store instructions.

If vector instructions are not available, the common-code is
used as fallback.  Therefore it is implemented in memmove-c with
a different name.
Furthermore the ifunc logic decides if we need the common-code
implementation at all.  If vector instructions are supported
due to the minimum architecture level set we can skip the
common-code ifunc variant.

ChangeLog:

* sysdeps/s390/Makefile (sysdep_routines): Add memmove-c.
* sysdeps/s390/ifunc-memcpy.h (HAVE_MEMMOVE_IFUNC,
HAVE_MEMMOVE_IFUNC_AND_VX_SUPPORT, MEMMOVE_DEFAULT,
HAVE_MEMMOVE_C, MEMMOVE_C,  HAVE_MEMMOVE_Z13, MEMMOVE_Z13):
New defines.
* sysdeps/s390/memcpy-z900.S: Add z13 memmove implementation.
* sysdeps/s390/memmove-c.c: New file.
* sysdeps/s390/memmove.c: Likewise.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add ifunc variants for memmove.

5 years agoS390: Add configure check to detect z13 as mininum architecture level set.
Stefan Liebler [Tue, 18 Dec 2018 12:57:08 +0000 (13:57 +0100)]
S390: Add configure check to detect z13 as mininum architecture level set.

Add a configure check for z13 in the same way as done for z196.

ChangeLog:

* config.h.in (HAVE_S390_MIN_Z13_ZARCH_ASM_SUPPORT): New undefine.
* sysdeps/s390/configure.ac: Add check for z13 support.
* sysdeps/s390/configure: Regenerated.

5 years agoS390: Use memcpy for forward cases in memmove.
Stefan Liebler [Tue, 18 Dec 2018 12:57:07 +0000 (13:57 +0100)]
S390: Use memcpy for forward cases in memmove.

The s390/s390x memcpy implementations are safe to be
used by memmove.  Starting with this commit, memmove is
using memcpy for the forward cases on s390.

ChangeLog:

* sysdeps/s390/memcopy.h: New file.

5 years agoS390: Remove s390 specific implementation of bcopy.
Stefan Liebler [Tue, 18 Dec 2018 12:57:07 +0000 (13:57 +0100)]
S390: Remove s390 specific implementation of bcopy.

Nowadays gcc is automatically replacing a call to bcopy
with a call to memmove.  Thus only old binaries will call
the s390 specific bcopy implementation.

The s390 specific implementation is using an own
implementation for memcpy in the forward case and is
relying on memmove in the backward case.

After removing the s390 specific bcopy, the common code
bcopy is used.  It just performs a tail call to memmove.

ChangeLog:
* sysdeps/s390/s390-32/bcopy.S: Remove.
* sysdeps/s390/s390-64/bcopy.S: Likewise.

5 years agoS390: Refactor memcpy/mempcpy ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:06 +0000 (13:57 +0100)]
S390: Refactor memcpy/mempcpy ifunc handling.

This patch moves all ifunc variants for memcpy/mempcpy
to sysdeps/s390/memcpy-z900.S. The configure-check/preprocessor logic
in sysdeps/s390/ifunc-memcpy.h decides if ifunc is needed at all
and which ifunc variants should be available.
E.g. if the compiler/assembler already supports z196 by default,
the older ifunc variants are not included.
If we only need the newest ifunc variant,
then we can skip ifunc at all.

Therefore the ifunc-resolvers and __libc_ifunc_impl_list are adjusted
in order to handle only the available ifunc variants.

ChangeLog:

* sysdeps/s390/ifunc-memcpy.h: New File.
* sysdeps/s390/memcpy.S: Move to ...
* sysdeps/s390/memcpy-z900.S ... here.
Move implementations from memcpy-s390x.s to here.
* sysdeps/s390/multiarch/memcpy-s390x.S: Delete File.
* sysdeps/s390/multiarch/Makefile (sysdep_routines):
Remove memcpy/mempcpy variants.
* sysdeps/s390/Makefile (sysdep_routines):
Add memcpy/mempcpy variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Adjust ifunc variants for
memcpy and mempcpy.
* sysdeps/s390/multiarch/memcpy.c: Move ifunc resolver
to ...
* sysdeps/s390/memcpy.c: ... here.
Adjust ifunc variants for memcpy.
* sysdeps/s390/multiarch/mempcpy.c: Move to ...
* sysdeps/s390/mempcpy.c: ... here.
Adjust ifunc variants for mempcpy.
* sysdeps/s390/mempcpy.S: Delete file.

5 years agoS390: Unify 31/64bit memcpy.
Stefan Liebler [Tue, 18 Dec 2018 12:57:06 +0000 (13:57 +0100)]
S390: Unify 31/64bit memcpy.

The implementation of memcpy/mempcpy for s390-32 (31bit)
and s390-64 (64bit) is nearly the same.
This patch unifies it for maintability reasons.

__mem[p]cpy_z10 and __mem[p]cpy_z196 differs between 31 and 64bit:
-31bit needs .machinemode "zarch_nohighgprs" and llgfr   %r4,%r4
-lr vs lgr; lgr can be also used on 31bit as this ifunc variant
is only called if we are on a zarch machine.

__mem[p]cpy_default differs between 31 and 64bit:
-Some 31bit vs 64bit instructions (e.g. ltr vs ltgr.
Solved with 31/64 specific instruction macros).
-The address of mvc instruction is setup in different ways
(larl vs bras). Solved with #if defined __s390x__.

__memcpy_mvcle differs between 31 and 64bit:
-lr vs lgr; ahi vs aghi;
Solved with 31/64bit specific instruction macros.

Otherwise 31/64bit implementation has the same structure of the code.

ChangeLog:

* sysdeps/s390/s390-64/memcpy.S: Move to ...
* sysdeps/s390/memcpy.S: ... here.
Adjust to be usable for 31/64bit.
* sysdeps/s390/s390-32/memcpy.S: Delete File.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add memcpy.
* sysdeps/s390/s390-32/multiarch/Makefile: Delete file.
* sysdeps/s390/s390-64/multiarch/Makefile: Likewise.
* sysdeps/s390/s390-64/multiarch/memcpy-s390x.S: Move to ...
* sysdeps/s390/multiarch/memcpy-s390x.S: ... here.
Adjust to be usable for 31/64bit.
* sysdeps/s390/s390-32/multiarch/memcpy-s390.S: Delete File.
* sysdeps/s390/s390-64/multiarch/memcpy.c: Move to ...
* sysdeps/s390/multiarch/memcpy.c: ... here.
* sysdeps/s390/s390-32/multiarch/memcpy.c: Delete File.

5 years agoS390: Refactor memcmp ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:05 +0000 (13:57 +0100)]
S390: Refactor memcmp ifunc handling.

This patch moves all ifunc variants for memcmp
to sysdeps/s390/memcmp-z900.S. The configure-check/preprocessor logic
in sysdeps/s390/ifunc-memcmp.h decides if ifunc is needed at all
and which ifunc variants should be available.
E.g. if the compiler/assembler already supports z196 by default,
the older ifunc variants are not included.
If we only need the newest ifunc variant,
then we can skip ifunc at all.

Therefore the ifunc-resolvers and __libc_ifunc_impl_list are adjusted
in order to handle only the available ifunc variants.

ChangeLog:

* sysdeps/s390/ifunc-memcmp.h: New File.
* sysdeps/s390/memcmp.S: Move to ...
* sysdeps/s390/memcmp-z900.S ... here.
Move implementations from memcmp-s390x.s to here.
* sysdeps/s390/multiarch/memcmp-s390x.S: Delete File.
* sysdeps/s390/multiarch/Makefile (sysdep_routines):
Remove memcmp variants.
* sysdeps/s390/Makefile (sysdep_routines):
Add memcmp variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Adjust ifunc variants for
memcmp.
* sysdeps/s390/multiarch/memcmp.c: Move ifunc resolver
to ...
* sysdeps/s390/memcmp.c: ... here.
Adjust ifunc variants for memcmp.

5 years agoS390: Unify 31/64bit memcmp.
Stefan Liebler [Tue, 18 Dec 2018 12:57:05 +0000 (13:57 +0100)]
S390: Unify 31/64bit memcmp.

The implementation of memcmp for s390-32 (31bit) and
s390-64 (64bit) is nearly the same.
This patch unifies it for maintability reasons.

__memcmp_z10 and __memcmp_z196 differs between 31 and 64bit:
-31bit needs .machinemode "zarch_nohighgprs" and llgfr   %r4,%r4
-lr vs lgr and some other instructions:
But lgr and co can be also used on 31bit as this ifunc variant
is only called if we are on a zarch machine.

__memcmp_default differs between 31 and 64bit:
-Some 31bit vs 64bit instructions (e.g. ltr vs ltgr.
Solved with 31/64 specific instruction macros).
-The address of mvc instruction is setup in different ways
(larl vs bras). Solved with #if defined __s390x__.

Otherwise 31/64bit implementation has the same structure of the code.

ChangeLog:

* sysdeps/s390/s390-64/memcmp.S: Move to ...
* sysdeps/s390/memcmp.S: ... here.
Adjust to be usable for 31/64bit.
* sysdeps/s390/s390-32/memcmp.S: Delete File.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add memcmp.
* sysdeps/s390/s390-32/multiarch/Makefile (sysdep_routines):
Remove memcmp.
* sysdeps/s390/s390-64/multiarch/Makefile: Likewise.
* sysdeps/s390/s390-64/multiarch/memcmp-s390x.S: Move to ...
* sysdeps/s390/multiarch/memcmp-s390x.S: ... here.
Adjust to be usable for 31/64bit.
* sysdeps/s390/s390-32/multiarch/memcmp-s390.S: Delete File.
* sysdeps/s390/s390-64/multiarch/memcmp.c: Move to ...
* sysdeps/s390/multiarch/memcmp.c: ... here.
* sysdeps/s390/s390-32/multiarch/memcmp.c: Delete File.

5 years agoS390: Implement bzero with memset.
Stefan Liebler [Tue, 18 Dec 2018 12:57:05 +0000 (13:57 +0100)]
S390: Implement bzero with memset.

This patch removes the bzero s390 implementation with mvcle and
adds entry points for bzero in memset ifunc variants.
Therefore an ifunc resolver is implemented for bzero, too.

ChangeLog:

* sysdeps/s390/s390-32/bzero.S: Delete file.
* sysdeps/s390/s390-64/bzero.S: Likewise.
* sysdeps/s390/Makefile (sysdep_routines): Add bzero.
* sysdeps/s390/bzero.c: New file.
* sysdeps/s390/memset-z900.S: Add bzero entry points.
* sysdeps/s390/ifunc-memset.h: Add bzero function macros.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add bzero ifunc variants.

5 years agoS390: Refactor memset ifunc handling.
Stefan Liebler [Tue, 18 Dec 2018 12:57:04 +0000 (13:57 +0100)]
S390: Refactor memset ifunc handling.

This patch moves all ifunc variants for memset
to sysdeps/s390/memset-z900.S. The configure-check/preprocessor logic
in sysdeps/s390/ifunc-memset.h decides if ifunc is needed at all
and which ifunc variants should be available.
E.g. if the compiler/assembler already supports z196 by default,
the older ifunc variants are not included.
If we only need the newest ifunc variant,
then we can skip ifunc at all.

Therefore the ifunc-resolvers and __libc_ifunc_impl_list are adjusted
in order to handle only the available ifunc variants.

ChangeLog:

* sysdeps/s390/ifunc-memset.h: New File.
* sysdeps/s390/memset.S: Move to ...
* sysdeps/s390/memset-z900.S ... here.
Move implementations from memset-s390x.s to here.
* sysdeps/s390/multiarch/memset-s390x.S: Delete File.
* sysdeps/s390/multiarch/Makefile (sysdep_routines):
Remove memset variants.
* sysdeps/s390/Makefile (sysdep_routines):
Add memset variants.
* sysdeps/s390/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Adjust ifunc variants for
memset.
* sysdeps/s390/multiarch/memset.c: Move ifunc resolver
to ...
* sysdeps/s390/memset.c: ... here.
Adjust ifunc variants for memset.

5 years agoS390: Unify 31/64bit memset.
Stefan Liebler [Tue, 18 Dec 2018 12:57:04 +0000 (13:57 +0100)]
S390: Unify 31/64bit memset.

The implementation of memset for s390-32 (31bit) and
s390-64 (64bit) is nearly the same.
This patch unifies it for maintability reasons.

__memset_z10 and __memset_z196 differs between 31 and 64bit:
-31bit needs .machinemode "zarch_nohighgprs" and llgfr   %r4,%r4
-lr vs lgr and some other instructions:
But lgr and co can be also used on 31bit as this ifunc variant
is only called if we are on a zarch machine.

__memset_default differs between 31 and 64bit:
-Some 31bit vs 64bit instructions (e.g. ltr vs ltgr.
Solved with 31/64 specific instruction macros).
-The address of mvc instruction is setup in different ways
(larl vs bras). Solved with #if defined __s390x__.

Otherwise 31/64bit implementation has the same structure of the code.

ChangeLog:

* sysdeps/s390/s390-64/memset.S: Move to ...
* sysdeps/s390/memset.S: ... here.
Adjust to be usable for 31/64bit.
* sysdeps/s390/s390-32/memset.S: Delete File.
* sysdeps/s390/multiarch/Makefile (sysdep_routines): Add memset.
* sysdeps/s390/s390-32/multiarch/Makefile (sysdep_routines):
Remove memset.
* sysdeps/s390/s390-64/multiarch/Makefile: Likewise.
* sysdeps/s390/s390-64/multiarch/memset-s390x.S: Move to ...
* sysdeps/s390/multiarch/memset-s390x.S: ... here.
Adjust to be usable for 31/64bit.
* sysdeps/s390/s390-32/multiarch/memset-s390.S: Delete File.
* sysdeps/s390/s390-64/multiarch/memset.c: Move to ...
* sysdeps/s390/multiarch/memset.c: ... here.
* sysdeps/s390/s390-32/multiarch/memset.c: Delete File.

5 years agoS390: Use hwcap instead of dl_hwcap in ifunc-resolvers.
Stefan Liebler [Tue, 18 Dec 2018 12:57:03 +0000 (13:57 +0100)]
S390: Use hwcap instead of dl_hwcap in ifunc-resolvers.

The renaming of hwcap arguments in ifunc-resolvers is needed
in order to prepare for further commits which refactors
ifunc handling for memset, memcmp, and memcpy.  Now you are able
to use s390_libc_ifunc_init which stores the stfle bits
within the expression for an ifunc-resolver generated by
s390_libc_ifunc_expr.

ChangeLog:

* sysdeps/s390/multiarch/ifunc-resolve.h
(s390_libc_ifunc_init, s390_libc_ifunc,
s390_vx_libc_ifunc2_redirected): Use hwcap instead of dl_hwcap.

5 years agoS390: Add configure check to detect z10 as mininum architecture level set.
Stefan Liebler [Tue, 18 Dec 2018 12:57:03 +0000 (13:57 +0100)]
S390: Add configure check to detect z10 as mininum architecture level set.

Add a configure check for z10 in the same way as done for z196.

ChangeLog:

* config.h.in (HAVE_S390_MIN_Z10_ZARCH_ASM_SUPPORT): New undefine.
* sysdeps/s390/configure.ac: Add check for z10 support.
* sysdeps/s390/configure: Regenerated.

5 years agox86: Merge i386/x86_64 atomic-machine.h
H.J. Lu [Tue, 18 Dec 2018 12:25:12 +0000 (04:25 -0800)]
x86: Merge i386/x86_64 atomic-machine.h

Merge i386 and x86_64 atomic-machine.h to x86 atomic-machine.h.

Tested on i686 and x86_64 as well as with build-many-glibcs.py.

* sysdeps/i386/atomic-machine.h: Merged with ...
* sysdeps/x86_64/atomic-machine.h: To ...
* sysdeps/x86/atomic-machine.h: This.  New file.

5 years agolocale: Rewrite locale/gen-translit.pl in Python
Florian Weimer [Tue, 18 Dec 2018 10:36:29 +0000 (11:36 +0100)]
locale: Rewrite locale/gen-translit.pl in Python

This commit does not change the generated output file.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agolocaledata: Remove executable bit from localedata/locales/bi_VU [BZ #23995]
Florian Weimer [Tue, 18 Dec 2018 09:33:12 +0000 (10:33 +0100)]
localedata: Remove executable bit from localedata/locales/bi_VU [BZ #23995]

5 years agoFix __TIMERSIZE and @theglibcadj typos
Albert ARIBAUD (3ADEV) [Tue, 20 Nov 2018 22:57:23 +0000 (23:57 +0100)]
Fix __TIMERSIZE and @theglibcadj typos

Fix following typos in parent commit:
- ChangeLog: __TIMERSIZE should be __TIMESIZE
- manual/maint.texi: @theglibcadj should be @glibcadj

5 years agoY2038: add function __localtime64
Albert ARIBAUD (3ADEV) [Tue, 20 Nov 2018 22:57:23 +0000 (23:57 +0100)]
Y2038: add function __localtime64

Tested with 'make check' on x86_64-linux-gnu and i686-linux.gnu.

* include/time.h
(__localtime64): Add.
* manual/maint.texi: Document Y2038 symbol handling.
* time/localtime.c
(__localtime64): Add.
[__TIMERSIZE != 64] (__localtime): Turn into a wrapper.

5 years agoDo not clobber r12 for ia64 syscalls.
Joseph Myers [Mon, 17 Dec 2018 18:31:50 +0000 (18:31 +0000)]
Do not clobber r12 for ia64 syscalls.

GCC mainline now gives errors for an asm that clobbers the stack
pointer.  According to
<https://gcc.gnu.org/ml/gcc-patches/2018-12/msg00932.html> GCC
previously ignored such a clobber; thus, this patch removes it from
the clobbers for ia64 syscalls.

Tested with build-many-glibcs.py for ia64-linux-gnu.

* sysdeps/unix/sysv/linux/ia64/sysdep.h (ASM_CLOBBERS_6_COMMON):
Do not clobber r12.

5 years agoAdd test that MAP_* constants agree with kernel.
Joseph Myers [Mon, 17 Dec 2018 18:29:36 +0000 (18:29 +0000)]
Add test that MAP_* constants agree with kernel.

Continuing the process of building up and using Python infrastructure
for extracting and using values in headers, this patch adds a test
that MAP_* constants from sys/mman.h agree with those in the Linux
kernel headers.  (Other sys/mman.h constants could be added to the
test separately.)

This set of constants has grown over time, so the generic code is
enhanced to allow saying extra constants are OK on either side of the
comparison (where the caller sets those parameters based on the Linux
kernel headers version, compared with the version the headers were
last updated from).  Although the test is a custom Python file, my
intention is to move in future to a single Python script for such
tests and text files it takes as inputs, once there are enough
examples to provide a guide to the common cases in such tests (I'd
like to end up with most or all such sets of constants copied from
kernel headers having such tests, and likewise for structure layouts
from the kernel).

The Makefile code is essentially the same as for tst-signal-numbers,
but I didn't try to find an object file to depend on to represent the
dependency on the headers used by the test (the conform/ tests don't
try to represent such header dependencies at all, for example).

Tested with build-many-glibcs.py, and also for x86_64 with older
kernel headers.

* scripts/glibcextract.py (compare_macro_consts): Take parameters
to allow extra macros from first or second sources.
* sysdeps/unix/sysv/linux/tst-mman-consts.py: New file.
* sysdeps/unix/sysv/linux/Makefile [$(subdir) = misc]
(tests-special): Add $(objpfx)tst-mman-consts.out.
($(objpfx)tst-mman-consts.out): New makefile target.

5 years agoAdd statx conditionals for wordsize-32 *xstat.c
Mao Han [Mon, 26 Nov 2018 03:13:32 +0000 (11:13 +0800)]
Add statx conditionals for wordsize-32 *xstat.c

Linux kernel have remove stat64 family from default syscall set, new
implementations with statx is needed when __ARCH_WANT_STAT64 is not
define. This patch add conditionals for relevant functions, using statx
system call to get information and then copy to the return buf, ref to
include/linux/fs.h from linux kernel.

* sysdeps/unix/sysv/linux/Makefile: Add statx_cp.c.
* sysdeps/unix/sysv/linux/fxstat64.c: Add conditionals for kernel
without stat64 system call support.
* sysdeps/unix/sysv/linux/fxstatat64.c: Likewise.
* sysdeps/unix/sysv/linux/generic/wordsize-32/fxstat.c: Likewise.
* sysdeps/unix/sysv/linux/generic/wordsize-32/fxstatat.c: Likewise.
* sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat.c: Likewise.
* sysdeps/unix/sysv/linux/generic/wordsize-32/lxstat64.c: Likewise.
* sysdeps/unix/sysv/linux/generic/wordsize-32/xstat.c: Likewise.
* sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/statx_cp.c: New file.
* sysdeps/unix/sysv/linux/statx_cp.c: Likewise.
* sysdeps/unix/sysv/linux/statx_cp.h: Likewise.
* sysdeps/unix/sysv/linux/wordsize-64/statx_cp.c: Likewise.

5 years agoregex: fix storage-exhaustion error
Paul Eggert [Thu, 6 Sep 2018 06:57:08 +0000 (23:57 -0700)]
regex: fix storage-exhaustion error

[BZ #18040]
* posix/regexec.c (get_subexp):
Do not continue if storage is exhausted.

5 years agoregex: fix heap-use-after-free error
Assaf Gordon [Thu, 6 Sep 2018 06:25:07 +0000 (23:25 -0700)]
regex: fix heap-use-after-free error

[BZ #18040]
Problem reported by Saito Takaaki <tails.saito@gmail.com> in
https://debbugs.gnu.org/32592
Call stack get_subexp->get_subexp_sub->clean_state_log_if_needed may
call extend_buffers which reallocates the re_string_t internal buffer.
Local variable 'buf' was not updated in such case, resulting in
use-after-free.
* posix/regexec.c (get_subexp): Update 'buf' after call to
get_subexp_sub.

5 years agosupport: Do not require overflow builtin in support/blob_repeat.c
Florian Weimer [Sat, 15 Dec 2018 17:58:09 +0000 (18:58 +0100)]
support: Do not require overflow builtin in support/blob_repeat.c

It is only available in GCC 5 and later.

Tested-by: Romain Naour <romain.naour@gmail.com>
5 years agoRemove x86 mathinline.h asinh, acosh, atanh inlines.
Joseph Myers [Fri, 14 Dec 2018 22:35:57 +0000 (22:35 +0000)]
Remove x86 mathinline.h asinh, acosh, atanh inlines.

Continuing the removal of bits/mathinline.h inlines that would better
be done by the compiler, this patch removes x86 inlines for asinh,
acosh and atanh functions (only for fast-math, non-SSE 32-bit x86).
I've filed <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88502> for
adding such inlines as an optimization in GCC.

Tested for x86_64 and x86.

* sysdeps/x86/fpu/bits/mathinline.h (asinh): Remove inline
definition.
(acosh): Likewise.
(atanh): Likewise.

5 years agomanual: Document thread/task IDs for Linux
Florian Weimer [Fri, 14 Dec 2018 20:11:09 +0000 (21:11 +0100)]
manual: Document thread/task IDs for Linux

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agoAdd tests for the long double version of ecvt and fcvt
Gabriel F. T. Gomes [Tue, 30 Oct 2018 18:04:18 +0000 (15:04 -0300)]
Add tests for the long double version of ecvt and fcvt

The test case misc/tst-efgcvt.c only tests the double variants of the
Old-fashioned System V number-to-string functions: ecvt, fcvt, and their
re-entrant counterparts.  With a few macros, the code can be reused for
the long double versions of these functions.  A future patch will reuse
it again for IEEE long double on powerpc64le.

Tested for powerpc and powerpc64le.

5 years agoAdd missing libnss_testX.so requirement for tst-nss-test3.
Stefan Liebler [Fri, 14 Dec 2018 08:50:53 +0000 (09:50 +0100)]
Add missing libnss_testX.so requirement for tst-nss-test3.

Sometimes tst-nss-test3 fails with:
error: test-container.c:386: unable to open .../nss/libnss_test1.so for reading

The test tst-nss-test3 which runs in a container needs
libnss_test[12].so. (see e.g. tst-nss-test3.script).
Before this test was moved from tests to tests-container variable,
the requirement was met.  Thus this patch adds this requirement
also for tests in tests-container.

ChangeLog:

* nss/Makefile (tst-nss-test3.out): New rule.

5 years agoDo not clobber sp in _hurd_stack_setup.
Joseph Myers [Thu, 13 Dec 2018 22:36:33 +0000 (22:36 +0000)]
Do not clobber sp in _hurd_stack_setup.

GCC mainline now gives errors for an asm that clobbers the stack
pointer.  According to
<https://gcc.gnu.org/ml/gcc-patches/2018-12/msg00932.html> GCC
previously ignored such a clobber; thus, this patch removes it from
_hurd_stack_setup.

Tested with build-many-glibcs.py for i686-gnu.

* sysdeps/mach/hurd/i386/init-first.c (_hurd_stack_setup): Do not
clobber sp.

5 years agox86: Add Hygon Dhyana support.
Carlos O'Donell [Wed, 12 Dec 2018 14:24:17 +0000 (09:24 -0500)]
x86: Add Hygon Dhyana support.

This patch fix Hygon Dhyana processor CPU Vendor ID detection
problem in glibc sysdep module, current glibc codes doesn't
recognize Dhyana CPU Vendor ID("HygonGenuine") and set kind to
arch_kind_other, which result to incorrect zero value for
__cache_sysconf() syscall. As Hygon Dhyana share most
architecture feature as AMD Family 17h, this patch add Hygon CPU
Vendor ID check and setup kind to arch_kind_amd and reuse AMD
code path, which lead to correct return value in
__cache_sysconf() syscall. we run the glibc test suite for both
Hygon Dhyana and AMD EPYC and found no failure case.

Background:
Chengdu Haiguang IC Design Co., Ltd (Hygon) is a Joint Venture
between AMD and Haiguang Information Technology Co.,Ltd., aims at
providing high performance x86 processor for China server market.
Its first generation processor codename is Dhyana, which
originates from AMD technology and shares most of the
architecture with AMD's family 17h, but with different CPU Vendor
ID("HygonGenuine")/Family series number(Family 18h).

Related Hygon kernel patch can be found on
http://lkml.kernel.org/r/5ce86123a7b9dad925ac583d88d2f921040e859b.1538583282.git.puwen@hygon.cn

Signed-off-by: fanjinke <fanjinke@hygon.cn>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agoFix rwlock stall with PREFER_WRITER_NONRECURSIVE_NP (bug 23861)
Andreas Schwab [Thu, 8 Nov 2018 13:28:22 +0000 (14:28 +0100)]
Fix rwlock stall with PREFER_WRITER_NONRECURSIVE_NP (bug 23861)

In the read lock function (__pthread_rwlock_rdlock_full) there was a
code path which would fail to reload __readers while waiting for
PTHREAD_RWLOCK_RWAITING to change. This failure to reload __readers
into a local value meant that various conditionals used the old value
of __readers and with only two threads left it could result in an
indefinite stall of one of the readers (waiting for PTHREAD_RWLOCK_RWAITING
to go to zero, but it never would).

5 years agoReindent nptl/pthread_rwlock_common.c
Andreas Schwab [Mon, 12 Nov 2018 10:11:40 +0000 (11:11 +0100)]
Reindent nptl/pthread_rwlock_common.c

5 years agoRemove x86 mathinline.h hypot inline.
Joseph Myers [Wed, 12 Dec 2018 22:33:06 +0000 (22:33 +0000)]
Remove x86 mathinline.h hypot inline.

Continuing the removal of bits/mathinline.h inlines that would better
be done by the compiler, this patch removes an x86 inline for hypot
functions (only for fast-math, only for non-SSE 32-bit x86).  I've
filed <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88474> for adding
such an inline as an optimization in GCC.

Tested for x86_64 and x86.

* sysdeps/x86/fpu/bits/mathinline.h (hypot): Remove inline
definition.

5 years agobenchtests: send non-consumable data to stderr
Leonardo Sandoval [Mon, 10 Dec 2018 21:20:23 +0000 (15:20 -0600)]
benchtests: send non-consumable data to stderr

Non-consumable data, alias data not related to benchmarks, should be sent to
the standard error, thus pipelines can work as expected.

* benchtests/scripts/compare_bench.py (do_compare): write to stderr in case
    stat is not present.
* benchtests/scripts/compare_bench.py (plot_graphs): write to stderr in case
    timings field is not present. Also string showing the output filename goes
    into the stderr.

5 years agobenchtests: include --stats parameter
Leonardo Sandoval [Mon, 10 Dec 2018 21:15:34 +0000 (15:15 -0600)]
benchtests: include --stats parameter

Allows user to pick a statistic, defaulting to min and mean, from command
line. At the same time, if stat does not exit, catch the run-time exception
and keep comparing the rest of benchmarked functions. Finally, take care of
division-by-zero exceptions and as the latter, keep comparing the rest of the
functions, turning the script a bit more fault tolerant thus useful.

* benchtests/scripts/compare_bench.py (do_compare): Catch KeyError and
    ZeroDivisorError exceptions.
* benchtests/scripts/compare_bench.py (compare_runs): Use stats argument to
    loop through user provided statistics.
* benchtests/scripts/compare_bench.py (main): Include the --stats argument.

5 years agobenchtests: keep comparing even if function timings do not match
Leonardo Sandoval [Mon, 10 Dec 2018 20:52:23 +0000 (14:52 -0600)]
benchtests: keep comparing even if function timings do not match

Allows other functions to be processed, making the script a bit more fault
tolerant thus useful.

* benchtests/scripts/compare_bench.py (compare_runs): Continue instead of return.

5 years agotimespec_get (posix): Fix copyright header
Florian Weimer [Wed, 12 Dec 2018 16:13:17 +0000 (17:13 +0100)]
timespec_get (posix): Fix copyright header

The “any later version” clause was missing.  This change was approved
in principle by the FSF in RT ticket #1316403.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
5 years agopowerpc: Add missing CFI register information (bug #23614)
Tulio Magno Quites Machado Filho [Wed, 12 Dec 2018 12:41:52 +0000 (10:41 -0200)]
powerpc: Add missing CFI register information (bug #23614)

Add CFI information about the offset of registers stored in the stack
frame.

[BZ #23614]
* sysdeps/powerpc/powerpc64/addmul_1.S (FUNC): Add CFI offset for
registers saved in the stack frame.
* sysdeps/powerpc/powerpc64/lshift.S (__mpn_lshift): Likewise.
* sysdeps/powerpc/powerpc64/mul_1.S (__mpn_mul_1): Likewise.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Reviewed-by: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
5 years agoAdd *-ldbl.h headers to include/bits
Gabriel F. T. Gomes [Fri, 23 Nov 2018 16:00:06 +0000 (14:00 -0200)]
Add *-ldbl.h headers to include/bits

On some platforms, long double may have either the same format as double
or another, wider format, such as the Quadruple IEC 60559 long double
format or the IBM Extended Precision format (both 128-bits wide).
Selecting between the available formats is done by using one of the
following compiler switches: -mlong-double-128, for the wider format, or
-mlong-double-64, for the narrower.  On all platforms that provide this
choice, the wider format is the default.

When the non-default format is selected by user code (i.e.: when
building with -mlong-double-64) calls to functions that take long double
parameters or return a long double type (e.g.: strfroml) are redirected
to a compat function, via assembler redirection, by headers such as
bits/stdlib-ldbl.h or bits/misc-ldbl.h.

In glibc builds, however, these headers are currently being read from
the system directories (/usr/include/bits) rather than from the source
directory.  Although this works correctly today, it raises
reproducibility concerns.  Besides that, builds for powerpc64le will
need these files from the source directory, because on powerpc64le, the
new redirections for long double with IEEE binary128 format will be
implemented in these headers.

Tested for powerpc64 and powerpc64le.

5 years agoRemove redirection of _IO_vfprintf
Gabriel F. T. Gomes [Wed, 5 Dec 2018 21:16:12 +0000 (19:16 -0200)]
Remove redirection of _IO_vfprintf

Since the commit

commit 698fb75b9ff5ae454a1344b5f9fafa0ca367c555
Author: Zack Weinberg <zackw@panix.com>
Date:   Wed Mar 7 14:32:01 2018 -0500

    Add __v*printf_internal with flags arguments

_IO_vfprintf is gone.  This did not trigger any test case failures on
powerpc and powerpc64le, because there were no tests that covered it.
However, new test cases for nldbl versions of argp.h functions exposed
the problem.

Tested for powerpc64 and powerpc64le.

5 years agoRemove support for abilist-pattern
Andreas Schwab [Wed, 28 Nov 2018 16:23:59 +0000 (17:23 +0100)]
Remove support for abilist-pattern

5 years agoFix powf overflow handling in non-nearest rounding mode [BZ #23961]
Szabolcs Nagy [Mon, 10 Dec 2018 11:08:36 +0000 (11:08 +0000)]
Fix powf overflow handling in non-nearest rounding mode [BZ #23961]

The threshold value at which powf overflows depends on the rounding mode
and the current check did not take this into account. So when the result
was rounded away from zero it could become infinity without setting
errno to ERANGE.

Example: pow(0x1.7ac7cp+5, 23) is 0x1.fffffep+127 + 0.1633ulp

If the result goes above 0x1.fffffep+127 + 0.5ulp then errno is set,
which is fine in nearest rounding mode, but

  powf(0x1.7ac7cp+5, 23) is inf in upward rounding mode
  powf(-0x1.7ac7cp+5, 23) is -inf in downward rounding mode

and the previous implementation did not set errno in these cases.

The fix tries to avoid affecting the common code path or calling a
function that may introduce a stack frame, so float arithmetics is used
to check the rounding mode and the threshold is selected accordingly.

[BZ #23961]
* math/auto-libm-test-in: Add new test case.
* math/auto-libm-test-out-pow: Regenerated.
* sysdeps/ieee754/flt-32/e_powf.c (__powf): Fix overflow check.

5 years agotest-container: move postclean outside of namespace changes
DJ Delorie [Wed, 5 Dec 2018 17:39:47 +0000 (12:39 -0500)]
test-container: move postclean outside of namespace changes

During postclean.req testing it was found that the fork in the
parent process (after the unshare syscall) would fail with ENOMEM
(see recursive_remove() in test-container.c).  While failing with
ENOMEM is certainly unexpected, it is simply easier to refactor
the design and have the parent remain outside of the namespace.
This change moves the postclean.req processing to a distinct
process (the parent) that then forks the test process (which will
have to fork once more to complete uid/gid transitions). When the
test process exists the cleanup process will ensure all files are
deleted when a post clean is requested.

Signed-off-by: DJ Delorie <dj@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
[BZ #23948]
* support/test-container.c: Move postclean step to before we
change namespaces.

5 years agoUse gen-as-const.py to process .pysym files.
Joseph Myers [Mon, 10 Dec 2018 22:56:59 +0000 (22:56 +0000)]
Use gen-as-const.py to process .pysym files.

This patch eliminates the gen-py-const.awk variant of gen-as-const,
switching to use of gnu-as-const.py (with a new --python option) to
process .pysym files (i.e., to generate nptl_lock_constants.py), as
the syntax of those files is identical to that of .sym files.

Note that the generated nptl_lock_constants.py is *not* identical to
the version generated by the awk script.  Apart from the trivial
changes (comment referencing the new script, and output being sorted),
the constant FUTEX_WAITERS, PTHREAD_MUTEXATTR_FLAG_BITS,
PTHREAD_MUTEXATTR_FLAG_PSHARED and PTHREAD_MUTEX_PRIO_CEILING_MASK are
now output as positive rather than negative constants (on x86_64
anyway; maybe not necessarily on 32-bit systems):

< FUTEX_WAITERS = -2147483648
---
> FUTEX_WAITERS = 2147483648

< PTHREAD_MUTEXATTR_FLAG_BITS = -251662336
< PTHREAD_MUTEXATTR_FLAG_PSHARED = -2147483648
---
> PTHREAD_MUTEXATTR_FLAG_BITS = 4043304960
> PTHREAD_MUTEXATTR_FLAG_PSHARED = 2147483648

< PTHREAD_MUTEX_PRIO_CEILING_MASK = -524288
---
> PTHREAD_MUTEX_PRIO_CEILING_MASK = 4294443008

This is because gen-as-const has a cast of the constant value to long
int, which gen-py-const lacks.

I think the positive values are more logically correct, since the
constants in question are in fact unsigned in C.  But to reliably
produce gen-as-const.py output for constants that always (in C and
Python) reflects the signedness of values with the high bit of "long
int" set would mean more complicated logic needs to be used in
computing values.

The more correct positive values by themselves produce a failure of
nptl/test-mutexattr-printers, because masking with
~PTHREAD_MUTEXATTR_FLAG_BITS & ~PTHREAD_MUTEX_NO_ELISION_NP now leaves
a bit -1 << 32 in the Python value, resulting in a KeyError exception.
To avoid that, places masking with ~ of one of the constants in
question are changed to mask with 0xffffffff as well (this reflects
how ~ in Python applies to an infinite-precision integer whereas ~ in
C does not do any promotions beyond the width of int).

Tested for x86_64.

* scripts/gen-as-const.py (main): Handle --python option.
* scripts/gen-py-const.awk: Remove.
* Makerules (py-const-script): Use gen-as-const.py.
($(py-const)): Likewise.
* nptl/nptl-printers.py (MutexPrinter.read_status_no_robust): Mask
with 0xffffffff together with ~(PTHREAD_MUTEX_PRIO_CEILING_MASK).
(MutexAttributesPrinter.read_values): Mask with 0xffffffff
together with ~PTHREAD_MUTEXATTR_FLAG_BITS and
~PTHREAD_MUTEX_NO_ELISION_NP.
* manual/README.pretty-printers: Update reference to
gen-py-const.awk.

5 years agoMove tst-signal-numbers to Python.
Joseph Myers [Mon, 10 Dec 2018 22:27:13 +0000 (22:27 +0000)]
Move tst-signal-numbers to Python.

This patch converts the tst-signal-numbers test from shell + awk to
Python.

As with gen-as-const, the point is not so much that shell and awk are
problematic for this code, as that it's useful to build up general
infrastructure in Python for use of a range of code involving
extracting values from C headers.  This patch moves some code from
gen-as-const.py to a new glibcextract.py, which also gains functions
relating to listing macros, and comparing the values of a set of
macros from compiling two different pieces of code.

It's not just signal numbers that should have such tests; pretty much
any case where glibc copies constants from Linux kernel headers should
have such tests that the values and sets of constants agree except
where differences are known to be OK.  Much the same also applies to
structure layouts (although testing those without hardcoding lists of
fields to test will be more complicated).

Given this patch, another test for a set of macros would essentially
be just a call to glibcextract.compare_macro_consts (plus boilerplate
code - and we could move to having separate text files defining such
tests, like the .sym inputs to gen-as-const, so that only a single
Python script is needed for most such tests).  Some such tests would
of course need new features, e.g. where the set of macros changes in
new kernel versions (so you need to allow new macro names on the
kernel side if the kernel headers are newer than the version known to
glibc, and extra macros on the glibc side if the kernel headers are
older).  tst-syscall-list.sh could become a Python script that uses
common code to generate lists of macros but does other things with its
own custom logic.

There are a few differences from the existing shell + awk test.
Because the new test evaluates constants using the compiler, no
special handling is needed any more for one signal name being defined
to another.  Because asm/signal.h now needs to pass through the
compiler, not just the preprocessor, stddef.h is included as well
(given the asm/signal.h issue that it requires an externally provided
definition of size_t).  The previous code defined __ASSEMBLER__ with
asm/signal.h; this is removed (__ASSEMBLY__, a different macro,
eliminates the requirement for stddef.h on some but not all
architectures).

Tested for x86_64, and with build-many-glibcs.py.

* scripts/glibcextract.py: New file.
* scripts/gen-as-const.py: Do not import os.path, re, subprocess
or tempfile.  Import glibcexctract.
(compute_c_consts): Remove.  Moved to glibcextract.py.
(gen_test): Update reference to compute_c_consts.
(main): Likewise.
* sysdeps/unix/sysv/linux/tst-signal-numbers.py: New file.
* sysdeps/unix/sysv/linux/tst-signal-numbers.sh: Remove.
* sysdeps/unix/sysv/linux/Makefile
($(objpfx)tst-signal-numbers.out): Use tst-signal-numbers.py.
Redirect stderr as well as stdout.

5 years agoEnable VDSO for static linking on mips
Rafael Ávila de Espíndola [Mon, 10 Dec 2018 21:27:54 +0000 (21:27 +0000)]
Enable VDSO for static linking on mips

I have tested that this builds and the resulting program still work.

This was tested on gcc23.fsffrance.org, and for some reason the vdso
there seems unused even when using shared libraries.

[BZ #19767]
* sysdeps/unix/sysv/linux/mips/init-first.c: Remove #ifdef SHARED.
        * sysdeps/unix/sysv/linux/mips/libc-vdso.h: Remove #ifdef SHARED.
        * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h: Define
ALWAYS_USE_VSYSCALL.
        * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h: Define
ALWAYS_USE_VSYSCALL.
* sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h: Define
ALWAYS_USE_VSYSCALL.

5 years agocompat getdents64: Use correct offset for retry [BZ #23972]
Florian Weimer [Mon, 10 Dec 2018 13:14:45 +0000 (14:14 +0100)]
compat getdents64: Use correct offset for retry [BZ #23972]

d_off is the offset of the *next* entry, not the offset of the current
entry.

5 years agoMove *-le.abilist to le/*.abilist
Andreas Schwab [Wed, 28 Nov 2018 15:19:39 +0000 (16:19 +0100)]
Move *-le.abilist to le/*.abilist

Now that powerpc is using separate sysdep dirs for BE vs LE ABI, there is
no need for abilist-pattern any more.

5 years agoUpdate timezone code from tzcode 2018g.
Joseph Myers [Mon, 10 Dec 2018 13:11:58 +0000 (13:11 +0000)]
Update timezone code from tzcode 2018g.

This patch updates files coming from tzcode to the versions in tzcode
2018g.  No changes elsewhere in glibc were needed.

Tested for x86_64.

* timezone/private.h: Update from tzcode 2018g.
* timezone/tzfile.h: Likewise.
* timezone/tzselect.ksh: Likewise.
* timezone/zdump.c: Likewise.
* timezone/zic.c: Likewise.

5 years agoFix potential stack overflow [BZ #23490]
Paul Pluzhnikov [Sat, 8 Dec 2018 18:46:59 +0000 (10:46 -0800)]
Fix potential stack overflow [BZ #23490]

Since we are expecting the exact "IBT" string, adjust stack buffer size
and scanf format accordingly.

5 years agomalloc: Add another test for tcache double free check.
DJ Delorie [Sat, 1 Dec 2018 03:13:09 +0000 (22:13 -0500)]
malloc: Add another test for tcache double free check.

This one tests for BZ#23907 where the double free
test didn't check the tcache bin bounds before dereferencing
the bin.

[BZ #23907]
* malloc/tst-tcfree3.c: New.
* malloc/Makefile: Add it.

5 years agoDon't use __typeof__ (getcpu)
H.J. Lu [Fri, 7 Dec 2018 20:47:30 +0000 (12:47 -0800)]
Don't use __typeof__ (getcpu)

We can't use "__typeof__ (getcpu)" since getcpu is Linux specific and
Hurd doesn't have it.

Tested with build-many-glibcs.py.

* include/sched.h (__getcpu): Don't use __typeof__ (getcpu).

5 years agoPrepare vfscanf to use __strtof128_internal
Gabriel F. T. Gomes [Mon, 11 Jun 2018 01:42:34 +0000 (22:42 -0300)]
Prepare vfscanf to use __strtof128_internal

On powerpc64le, long double can currently take two formats: the same as
double (-mlong-double-64) or IBM Extended Precision (default with
-mlong-double-128 or explicitly with -mabi=ibmlongdouble).  The internal
implementation of scanf-like functions is aware of these possibilites
and, based on the format in use, properly calls __strtold_internal or
__strtod_internal, saving the return to a variable of type double or
long double.

When library support for TS 18661-3 was added to glibc, a new function,
__strtof128_internal, was added to enable reading of floating-point
values with IEEE binary128 format into the _Float128 type.  Now that
powerpc64le is getting support for its third long double format, and
taking into account that this format is the same as the format of
_Float128, this patch extends __vfscanf_internal and __vfwscanf_internal
to call __strtof128_internal or __wcstof128_internal when appropriate.
The result gets saved into a variable of _Float128 type.

Tested for powerpc64le.

5 years agohurd: Fix linknamespace of spawni
Samuel Thibault [Wed, 5 Dec 2018 22:24:03 +0000 (23:24 +0100)]
hurd: Fix linknamespace of spawni

* include/unistd.h (__confstr): Add prototype and hidden prototype.
* posix/confstr.c (confstr): Rename to __confstr.
(__confstr): Add hidden def.
(confstr): Add weak alias for __confstr.
* sysdeps/mach/hurd/spawni.c (__spawni): Call __confstr instead of
confstr.

5 years agoAdd getcpu
H.J. Lu [Fri, 7 Dec 2018 17:17:37 +0000 (09:17 -0800)]
Add getcpu

Add

  #include <sched.h>

  int getcpu (unsigned int *cpu, unsigned int *node);

to return currently used CPU and NUMA node.

Tested on x86-64, x32 and i686 as well as with build-many-glibcs.py.

* NEWS: Mention getcpu.
* include/sched.h (__getcpu): New libc_hidden_proto.
* manual/resource.texi: Document getcpu.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add getcpu.
* sysdeps/unix/sysv/linux/Versions (GLIBC_2.29): Add getcpu.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add getcpu.
* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/bits/sched.h (getcpu): New prototype.
* sysdeps/unix/sysv/linux/getcpu.c: New file.
* sysdeps/unix/sysv/linux/tst-skeleton-affinity.c (test_size):
Also check getcpu.

5 years agohurd: Implement support for posix_spawn_file_actions_addfchdir_np
Samuel Thibault [Fri, 7 Dec 2018 14:01:40 +0000 (15:01 +0100)]
hurd: Implement support for posix_spawn_file_actions_addfchdir_np

5 years agoposix: New function posix_spawn_file_actions_addfchdir_np [BZ #17405]
Florian Weimer [Fri, 7 Dec 2018 14:00:04 +0000 (15:00 +0100)]
posix: New function posix_spawn_file_actions_addfchdir_np [BZ #17405]

Along with posix_spawn_file_actions_addchdir,
posix_spawn_file_actions_addfchdir is the subject of a change proposal
for POSIX: <http://austingroupbugs.net/view.php?id=1208>

5 years agoUpdate miscellaneous files from upstream sources.
Joseph Myers [Thu, 6 Dec 2018 17:21:47 +0000 (17:21 +0000)]
Update miscellaneous files from upstream sources.

This patch updates various miscellaneous files from their upstream
sources.

Tested for x86_64, including "make pdf".

* manual/texinfo.tex: Update to version 2018-09-21.20 with
trailing whitespace removed.
* scripts/config.guess: Update to version 2018-11-28.
* scripts/config.sub: Update to version 2018-11-28.
* scripts/install-sh: Update to version 2018-03-11.20.
* scripts/mkinstalldirs: Update to version 2018-03-07.03.
* scripts/move-if-change: Update to version 2018-03-07 03:47.

5 years agoinet/tst-if_index-long: New test case for CVE-2018-19591 [BZ #23927]
Florian Weimer [Thu, 6 Dec 2018 14:39:50 +0000 (15:39 +0100)]
inet/tst-if_index-long: New test case for CVE-2018-19591 [BZ #23927]

5 years agosupport: Implement <support/descriptors.h> to track file descriptors
Florian Weimer [Thu, 6 Dec 2018 14:39:42 +0000 (15:39 +0100)]
support: Implement <support/descriptors.h> to track file descriptors

5 years agoUse PRINTF_LDBL_IS_DBL instead of __ldbl_is_dbl.
Zack Weinberg [Wed, 7 Mar 2018 19:32:04 +0000 (14:32 -0500)]
Use PRINTF_LDBL_IS_DBL instead of __ldbl_is_dbl.

After all that prep work, nldbl-compat.c can now use PRINTF_LDBL_IS_DBL
instead of __no_long_double to control the behavior of printf-like
functions; this is the last thing we needed __no_long_double for, so it
can go away entirely.

Tested for powerpc and powerpc64le.

5 years agoUse PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319)
Zack Weinberg [Wed, 7 Mar 2018 19:32:03 +0000 (14:32 -0500)]
Use PRINTF_FORTIFY instead of _IO_FLAGS2_FORTIFY (bug 11319)

The _chk variants of all of the printf functions become much simpler.
This is the last thing that we needed _IO_acquire_lock_clear_flags2
for, so it can go as well.  I took the opportunity to make the headers
included and the names of all local variables consistent across all the
affected files.

Since we ultimately want to get rid of __no_long_double as well, it
must be possible to get all of the nontrivial effects of the _chk
functions by calling the _internal functions with appropriate flags.
For most of the __(v)xprintf_chk functions, this is covered by
PRINTF_FORTIFY plus some up-front argument checks that can be
duplicated.  However, __(v)sprintf_chk installs a custom jump table so
that it can crash instead of overflowing the output buffer.  This
functionality is moved to __vsprintf_internal, which now has a
'maxlen' argument like __vsnprintf_internal; to get the unsafe
behavior of ordinary (v)sprintf, pass -1 for that argument.

obstack_printf_chk and obstack_vprintf_chk are no longer in the same
file.

As a side-effect of the unification of both fortified and non-fortified
vdprintf initialization, this patch fixes bug 11319 for __dprintf_chk
and __vdprintf_chk, which was previously fixed only for dprintf and
vdprintf by the commit

commit 7ca890b88e6ab7624afb1742a9fffb37ad5b3fc3
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Wed Feb 24 16:07:57 2010 -0800

    Fix reporting of I/O errors in *dprintf functions.

This patch adds a test case to avoid regressions.

Tested for powerpc and powerpc64le.

5 years agoAdd __vsyslog_internal, with same flags as __v*printf_internal.
Zack Weinberg [Wed, 7 Mar 2018 19:32:02 +0000 (14:32 -0500)]
Add __vsyslog_internal, with same flags as __v*printf_internal.

__nldbl___vsyslog_chk will ultimately want to pass PRINTF_LDBL_IS_DBL
down to __vfprintf_internal *as well as* possibly setting PRINTF_FORTIFY.
To make that possible, we need a __vsyslog_internal that takes the
same flags as printf.  The code in misc/syslog.c does also get a
little simpler.

Tested for powerpc and powerpc64le.

5 years agoAdd __v*printf_internal with flags arguments
Zack Weinberg [Wed, 7 Mar 2018 19:32:01 +0000 (14:32 -0500)]
Add __v*printf_internal with flags arguments

There are a lot more printf variants than there are scanf variants,
and the code for setting up and tearing down their custom FILE
variants around the call to __vf(w)printf is more complicated and
variable.  Therefore, I have added _internal versions of all the
v*printf variants, rather than introducing helper routines so that
they can all directly call __vf(w)printf_internal, as was done with
scanf.

As with the scanf changes, in this patch the _internal functions still
look at the environmental mode bits and all callers pass 0 for the
flags parameter.

Several of the affected public functions had _IO_ name aliases that
were not exported (but, in one case, appeared in libio.h anyway);
I was originally planning to leave them as aliases to avoid having
to touch internal callers, but it turns out ldbl_*_alias only work
for exported symbols, so they've all been removed instead.  It also
turns out there were hardly any internal callers.  _IO_vsprintf and
_IO_vfprintf *are* exported, so those two stick around.

Summary for the changes to each of the affected symbols:

  _IO_vfprintf, _IO_vsprintf:
    All internal calls removed, thus the internal declarations, as well
    as uses of libc_hidden_proto and libc_hidden_def, were also removed.
    The external symbol is now exposed via uses of ldbl_strong_alias
    to __vfprintf_internal and __vsprintf_internal, respectively.

  _IO_vasprintf, _IO_vdprintf, _IO_vsnprintf,
  _IO_vfwprintf, _IO_vswprintf,
  _IO_obstack_vprintf, _IO_obstack_printf:
    All internal calls removed, thus declaration in internal headers
    were also removed.  They were never exported, so there are no
    aliases tying them to the internal functions.  I.e.: entirely gone.

  __vsnprintf:
    Internal calls were always preceded by macros such as
      #define __vsnprintf _IO_vsnprintf, and
      #define __vsnprintf vsnprintf
    The macros were removed and their uses replaced with calls to the
    new internal function __vsnprintf_internal.  Since there were no
    internal calls, the internal declaration was also removed.  The
    external symbol is preserved with ldbl_weak_alias to ___vsnprintf.

  __vfwprintf:
    All internal calls converted into calls to __vfwprintf_internal,
    thus the internal declaration was removed.  The function is now a
    wrapper that calls __vfwprintf_internal.  The external symbol is
    preserved.

  __vswprintf:
    Similarly, but no external symbol.

  __vasprintf, __vdprintf, __vfprintf, __vsprintf:
    New internal wrappers.  Not exported.

  vasprintf, vdprintf, vfprintf, vsprintf, vsnprintf,
  vfwprintf, vswprintf,
  obstack_vprintf, obstack_printf:
    These functions used to be aliases to the respective _IO_* function,
    they are now aliases to their respective __* functions.

Tested for powerpc and powerpc64le.

5 years agoUse SCANF_LDBL_IS_DBL instead of __ldbl_is_dbl.
Zack Weinberg [Wed, 7 Mar 2018 19:32:00 +0000 (14:32 -0500)]
Use SCANF_LDBL_IS_DBL instead of __ldbl_is_dbl.

Change the callers of __vfscanf_internal and __vfwscanf_internal that
want to treat 'long double' as another name for 'double' (all of which
happen to be in sysdeps/ieee754/ldbl-opt/nldbl-compat.c) to communicate
this via the new flags argument, instead of the per-thread variable
__no_long_double and its __ldbl_is_dbl wrapper macro.

Tested for powerpc and powerpc64le.

5 years agoUse SCANF_ISOC99_A instead of _IO_FLAGS2_SCANF_STD.
Zack Weinberg [Wed, 7 Mar 2018 19:31:59 +0000 (14:31 -0500)]
Use SCANF_ISOC99_A instead of _IO_FLAGS2_SCANF_STD.

Change the callers of __vfscanf_internal and __vfwscanf_internal that
want C99-compliant behavior to communicate this via the new flags
argument, rather than setting bits on the FILE object.  This also
means these functions do not need to do their own locking.

Tested for powerpc and powerpc64le.

5 years agoAdd __vfscanf_internal and __vfwscanf_internal with flags arguments.
Zack Weinberg [Wed, 7 Mar 2018 19:31:58 +0000 (14:31 -0500)]
Add __vfscanf_internal and __vfwscanf_internal with flags arguments.

There are two flags currently defined: SCANF_LDBL_IS_DBL is the mode
used by __nldbl_ scanf variants, and SCANF_ISOC99_A is the mode used
by __isoc99_ scanf variants.  In this patch, the new functions honor
these flag bits if they're set, but they still also look at the
corresponding bits of environmental state, and callers all pass zero.

The new functions do *not* have the "errp" argument possessed by
_IO_vfscanf and _IO_vfwscanf.  All internal callers passed NULL for
that argument.  External callers could theoretically exist, so I
preserved wrappers, but they are flagged as compat symbols and they
don't preserve the three-way distinction among types of errors that
was formerly exposed.  These functions probably should have been in
the list of deprecated _IO_ symbols in 2.27 NEWS -- they're not just
aliases for vfscanf and vfwscanf.

(It was necessary to introduce ldbl_compat_symbol for _IO_vfscanf.
Please check that part of the patch very carefully, I am still not
confident I understand all of the details of ldbl-opt.)

This patch also introduces helper inlines in libio/strfile.h that
encapsulate the process of initializing an _IO_strfile object for
reading.  This allows us to call __vfscanf_internal directly from
sscanf, and __vfwscanf_internal directly from swscanf, without
duplicating the initialization code.  (Previously, they called their
v-counterparts, but that won't work if we want to control *both* C99
mode and ldbl-is-dbl mode using the flags argument to__vfscanf_internal.)
It's still a little awkward, especially for wide strfiles, but it's
much better than what we had.

Tested for powerpc and powerpc64le.

5 years agoY2038: make __tz_convert compatible with 64-bit-time
Albert ARIBAUD (3ADEV) [Wed, 5 Dec 2018 20:01:22 +0000 (21:01 +0100)]
Y2038: make __tz_convert compatible with 64-bit-time

Now that __time64_t exists, we can switch internal function
__tz_convert from 32-bit to 64-bit time. This involves switching
some other internal functions as well, namely __tz_compute and
__offtime.

Tested with 'make check' on x86_64-linux-gnu and i686-linux.gnu.

* include/time.h
(__tz_compute): Replace time_t with __time64_t.
(__tz_convert): Replace time_t* with __time64_t.
(__offtime): Replace time_t* with __time64_t.
* time/gmtime.c
(__gmtime_r): Adjust call to __tz_convert.
(gmtime): Likewise.
* time/localtime.c
(__localtime_r): Likewise.
(localtime): Likewise.
* time/offtime.c: Replace time_t with __time64_t.
* time/tzset.c: Likewise.