powerpc: Cleanup: use actual power8 assembly mnemonics
Some implementations in sysdeps/powerpc/powerpc64/power8/*.S still had
pre power8 compatible binutils hardcoded macros and were not using
.machine power8.
This patch should not have semantic changes, in fact it should have the
same exact code generated.
Tested that generated stripped shared objects are identical when
using "strip --remove-section=.note.gnu.build-id".
The changes introduce a memory leak for gconv steps arrays whose
first element is an internal conversion, which has a fixed
reference count which is not decremented. As a result, after the
change in commit 50ce3eae5ba304650459d4441d7d246a7cefc26f, the steps
array is never freed, resulting in an unbounded memory leak.
This reverts commit 50ce3eae5ba304650459d4441d7d246a7cefc26f
("gconv: Check reference count in __gconv_release_cache
[BZ #24677]") and commit 7e740ab2e7be7d83b75513aa406e0b10875f7f9c
("libio: Fix gconv-related memory leak [BZ #24583]"). It
reintroduces bug 24583. (Bug 24677 was just a regression caused by
the second commit.)
Joseph Myers [Tue, 30 Jul 2019 14:05:11 +0000 (14:05 +0000)]
Restore r31 setting in powerpc32 swapcontext.
Commit ffe8a9a8318e1db225b22da8bc067408494bac5c, "powerpc: Remove
rt_sigreturn usage on context function", removed from powerpc32
swapcontext a setting of r31 that is relied upon in subsequent code.
I'm not sure why this didn't produce test failures in Adhemerval's
32-bit testing; in my (soft-float) testing in preparation for 2.30
release, I see several context-related failures
nptl: Use uintptr_t for address diagnostic in nptl/tst-pthread-getattr
Recent GCC versions warn about the attempt to return the address of a
local variable:
tst-pthread-getattr.c: In function ‘allocate_and_test’:
tst-pthread-getattr.c:54:10: error: function returns address of local variable [-Werror=return-local-addr]
54 | return mem;
| ^~~
In file included from ../include/alloca.h:3,
from tst-pthread-getattr.c:26:
../stdlib/alloca.h:35:23: note: declared here
35 | # define alloca(size) __builtin_alloca (size)
| ^~~~~~~~~~~~~~~~~~~~~~~
tst-pthread-getattr.c:51:9: note: in expansion of macro ‘alloca’
51 | mem = alloca ((size_t) (mem - target));
| ^~~~~~
The address itself is used in a check in the caller, so using
uintptr_t instead is reasonable.
test-container: Install with $(sorted-subdirs) [BZ #24794]
Commit 35e038c1d2ccb3a75395662f9c4f28d85a61444f started to use an
incomplete list of subdirs based on $(all-subdirs) causing
testroot.pristine to miss files from nss.
Tested if the list of files in testroot.pristine remains the same.
[BZ #24794]
* Makeconfig (all-subdirs): Improved source comments.
* Makefile (testroot.pristine/install.stamp): Pass
subdirs='$(sorted-subdirs)' to make install.
__gconv_release_cache is only ever called with heap-allocated
arrays which contain at least one member. The statically allocated
ASCII steps are filtered out by __wcsmbs_close_conv.
H.J. Lu [Wed, 24 Jul 2019 21:48:33 +0000 (14:48 -0700)]
x86-64: Compile branred.c with -mprefer-vector-width=128 [BZ #24603]
When compiled with -O3 and AVX, GCC 8 and 9 optimize some loops in
sysdeps/ieee754/dbl-64/branred.c with 256-bit vector instructions,
which leads to store forward stall:
There is no easy fix in compiler. This patch limits vector width to
128 bits to work around this issue. It improves performance of sin
and cos by more than 40% on Skylake compiled with -O3 -march=skylake.
Tested with GCC 7/8/9 on x86-64.
[BZ #24603]
* sysdeps/x86_64/configure.ac: Check if -mprefer-vector-width=128
works.
* sysdeps/x86_64/configure: Regenerated.
* sysdeps/x86_64/fpu/Makefile (CFLAGS-branred.c): New. Set
to -mprefer-vector-width=128 if supported.
Linux: Use in-tree copy of SO_ constants for !__USE_MISC [BZ #24532]
The kernel changes for a 64-bit time_t on 32-bit architectures
resulted in <asm/socket.h> indirectly including <linux/posix_types.h>.
The latter is not namespace-clean for the POSIX version of
<sys/socket.h>.
This issue has persisted across several Linux releases, so this commit
creates our own copy of the SO_* definitions for !__USE_MISC mode.
The new test socket/tst-socket-consts ensures that the copy is
consistent with the kernel definitions (which vary across
architectures). The test is tricky to get right because CPPFLAGS
includes include/libc-symbols.h, which in turn defines _GNU_SOURCE
unconditionally.
Tested with build-many-glibcs.py. I verified that a discrepancy in
the definitions actually results in a failure of the
socket/tst-socket-consts test.
test-container: Install with $(all-subdirs) [BZ #24794]
Whenever a sub-make is created, it inherits the variable subdirs from its
parent. This is also true when make check is called with a restricted
list of subdirs. In this scenario, make install is executed "partially"
and testroot.pristine ends up with an incomplete installation.
[BZ #24794]
* Makefile (testroot.pristine/install.stamp): Pass
subdirs='$(all-subdirs)' to make install.
test-container: Avoid copying unintended system libraries
Some DSOs are distributed in hardware capability directories, e.g.
/usr/lib64/power7/libc.so.6
Whenever the processor is able to use one of these hardware-enabled
DSOs, testroot.pristine ends up with copies of glibc-provided libraries
from the system because it can't overwrite or remove them.
This patch avoids the unintended copies by executing ld.so with the same
arguments passed to each glibc test.
* Makefile (testroot.pristine/install.stamp): Execute ld.so with
the same arguments used in all tests.
nptl: Add POSIX-proposed _clock functions to hppa pthread.h
The pthread _clock functions that were recently added to nptl need to be
declared in hppa's pthread.h too. After this change, the function
declaration part of sysdeps/nptl/pthread.h and
sysdeps/unix/sysv/linux/hppa/pthread.h are identical.
* sysdeps/unix/sysv/linux/hppa/pthread.h: Add declarations of
functions recently added to sysdeps/nptl/pthread.h:
pthread_mutex_clocklock, pthread_rwlock_clockrdlock,
pthread_rwlock_clockwrlock and pthread_cond_clockwait.
Mike Crowe [Wed, 17 Jul 2019 17:51:08 +0000 (14:51 -0300)]
nptl: Remove unnecessary forwarding of pthread_cond_clockwait from libc
In afe4de7d283ebd88157126c5494ce1796194c16e, I added forwarding functions
from libc to libpthread for __pthread_cond_clockwait and
pthread_cond_clockwait to mirror those for pthread_cond_timedwait. These
are unnecessary[1], since these functions aren't (yet) being called from
within libc itself. Let's remove them.
* nptl/forward.c: Remove unnecessary __pthread_cond_clockwait and
pthread_cond_clockwait forwarding functions. There are no internal
users, so it is unnecessary to expose these functions in libc.so.
* sysdeps/nptl/pthread-functions.h (pthread_functions): Remove
unnecessary ptr___pthread_cond_clockwait member.
* nptl/nptl-init.c (pthread_functions): Remove assignment of
removed member.
Afar locales: Months and days updated from CLDR (bug 21897).
This commit updates month and weekday names (full and abbreviated)
from CLDR 35.1 with the following exceptions.
It was not clear why the full name of February in aa_DJ and aa_ER was
"Kudo" while the abbreviated version is "Nah" but some additional
sources [1] [2] as well as the content of aa_ER and aa_ER@saaho
suggest it should be "Naharsi Kudo". This commit consequently sets
the translation of February to "Naharsi Kudo" in aa_DJ and aa_ET.
aa_ER@saaho is not supported by CLDR but since the month names were
identical to aa_ER before this commit, the same values have been copied
from aa_ER.
[BZ #21897]
* localedata/locales/aa_DJ (abday): Update from CLDR, all words
begin with an uppercase letter now.
(abmon): Likewise.
(mon): Update from CLDR, reword February from "Kudo" to
"Naharsi Kudo", April from "Agda Baxisso" to "Agda Baxis",
and August from "Liiqen" to "Leqeeni".
* localedata/locales/aa_ER (mon): Update from CLDR, reword
April from "Agda Baxisso" to "Agda Baxis" and August from
"Leqeeni" to "Liiqen".
* localedata/locales/aa_ER@saaho (mon): Likewise.
* localedata/locales/aa_ET (abmon): Update from CLDR, reword
abbreviated February from "Kud" to "Nah".
(mon): Update from CLDR, reword February from "Kudo" to
"Naharsi Kudo" and April from "Agda Baxisso" to "Agda Baxis".
The only implementation of futex_supports_exact_relative_timeouts always
returns true. Let's remove it and all its callers.
* nptl/pthread_cond_wait.c: (__pthread_cond_clockwait): Remove code
that is only useful if futex_supports_exact_relative_timeouts ()
returns false.
* nptl/pthread_condattr_setclock.c: (pthread_condattr_setclock):
Likewise.
* sysdeps/nptl/futex-internal.h: Remove comment about relative
timeouts potentially being imprecise since it's no longer true.
Remove declaration of futex_supports_exact_relative_timeouts.
* sysdeps/unix/sysv/linux/futex-internal.h: Remove implementation
of futex_supports_exact_relative_timeouts.
Mike Crowe [Mon, 24 Jun 2019 19:48:14 +0000 (19:48 +0000)]
nptl: Add POSIX-proposed pthread_mutex_clocklock
Add POSIX-proposed pthread_mutex_clocklock function that works like
pthread_mutex_timedlock but takes a clockid parameter to measure the
abstime parameter against.
* sysdeps/nptl/pthread.h: Add pthread_mutex_clocklock.
* nptl/DESIGN-systemtap-probes.txt: Likewise.
* nptl/pthread_mutex_timedlock.c
(__pthread_mutex_clocklock_common): Rename from
__pthread_mutex_timedlock and add clockid parameter. Pass this
parameter to lll_clocklock and lll_clocklock_elision in place of
CLOCK_REALTIME. (__pthread_mutex_clocklock): New function to add
LIBC_PROBE and validate clockid parameter before calling
__pthread_mutex_clocklock_common. (__pthread_mutex_timedlock): New
implementation to add LIBC_PROBE and calls
__pthread_mutex_clocklock_common passing CLOCK_REALTIME as the
clockid.
* nptl/Makefile: Add tst-mutex11.c.
* nptl/tst-abstime.c (th): Add tests for pthread_mutex_clocklock.
* nptl/tst-mutex11.c: New tests for passing invalid and unsupported
clockid parameters to pthread_mutex_clocklock.
* nptl/tst-mutex5.c (do_test_clock): Rename from do_test and take
clockid parameter to indicate which clock to be used. Call
pthread_mutex_timedlock or pthread_mutex_clocklock as appropriate.
(do_test): Call do_test_clock to separately test
pthread_mutex_timedlock, pthread_mutex_clocklock(CLOCK_REALTIME)
and pthread_mutex_clocklock(CLOCK_MONOTONIC).
* nptl/tst-mutex9.c: Likewise.
* nptl/Versions (GLIBC_2.30): Add pthread_mutex_clocklock.
* sysdeps/unix/sysv/linux/aarch64/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/alpha/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/arm/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/csky/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/hppa/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/i386/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/ia64/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/microblaze/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/nios2/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sh/libpthread.abilist (GLIBC_2.30):
Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
(GLIBC_2.30): Likewise.
Mike Crowe [Mon, 24 Jun 2019 13:08:25 +0000 (13:08 +0000)]
nptl: Rename lll_timedlock to lll_clocklock and add clockid parameter
Rename lll_timedlock to lll_clocklock and add clockid
parameter to indicate the clock that the abstime parameter should
be measured against in preparation for adding
pthread_mutex_clocklock.
The name change mirrors the naming for the exposed pthread functions:
timed => absolute timeout measured against CLOCK_REALTIME (or clock
specified by attribute in the case of pthread_cond_timedwait.)
clock => absolute timeout measured against clock specified in preceding
parameter.
* sysdeps/nptl/lowlevellock.h (lll_clocklock): Rename from
lll_timedlock and add clockid parameter. (__lll_clocklock): Rename
from __lll_timedlock and add clockid parameter.
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_clocklock):
Likewise.
* nptl/lll_timedlock_wait.c (__lll_clocklock_wait): Rename from
__lll_timedlock_wait and add clockid parameter. Use __clock_gettime
rather than __gettimeofday so that clockid can be used. This means
that conversion from struct timeval is no longer required.
* sysdeps/sparc/sparc32/lowlevellock.c (lll_clocklock_wait):
Likewise.
* sysdeps/sparc/sparc32/lll_timedlock_wait.c: Update comment to
refer to __lll_clocklock_wait rather than __lll_timedlock_wait.
* nptl/pthread_mutex_timedlock.c (lll_clocklock_elision): Rename
from lll_timedlock_elision, add clockid parameter and use
meaningful names for other parameters. (__pthread_mutex_timedlock):
Pass CLOCK_REALTIME where necessary to lll_clocklock and
lll_clocklock_elision.
* sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
(lll_clocklock_elision): Rename from lll_timedlock_elision and add
clockid parameter. (__lll_clocklock_elision): Rename from
__lll_timedlock_elision and add clockid parameter.
* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/x86/lowlevellock.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/elision-timed.c
(__lll_lock_elision): Call __lll_clocklock_elision rather than
__lll_timedlock_elision. (EXTRAARG): Add clockid parameter.
(LLL_LOCK): Likewise.
* sysdeps/unix/sysv/linux/s390/elision-timed.c: Likewise.
* sysdeps/unix/sysv/linux/x86/elision-timed.c: Likewise.
which behave like pthread_rwlock_timedrdlock and
pthread_rwlock_timedwrlock respectively, except they always measure
abstime against the supplied clockid. The functions currently support
CLOCK_REALTIME and CLOCK_MONOTONIC and return EINVAL if any other
clock is specified.
* sysdeps/nptl/pthread.h: Add pthread_rwlock_clockrdlock and
pthread_wrlock_clockwrlock.
* nptl/Makefile: Build pthread_rwlock_clockrdlock.c and
pthread_rwlock_clockwrlock.c.
* nptl/pthread_rwlock_clockrdlock.c: Implement
pthread_rwlock_clockrdlock.
* nptl/pthread_rwlock_clockwrlock.c: Implement
pthread_rwlock_clockwrlock.
* nptl/pthread_rwlock_common.c (__pthread_rwlock_rdlock_full): Add
clockid parameter and verify that it indicates a supported clock on
entry so that we fail even if it doesn't end up being used. Pass
that clock on to futex_abstimed_wait when necessary.
(__pthread_rwlock_wrlock_full): Likewise.
* nptl/pthread_rwlock_rdlock.c: (__pthread_rwlock_rdlock): Pass
CLOCK_REALTIME to __pthread_rwlock_rdlock_full even though it won't
be used because there's no timeout.
* nptl/pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock): Pass
CLOCK_REALTIME to __pthread_rwlock_wrlock_full even though it won't
be used because there is no timeout.
* nptl/pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock):
Pass CLOCK_REALTIME to __pthread_rwlock_rdlock_full since abstime
uses that clock.
* nptl/pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock):
Pass CLOCK_REALTIME to __pthread_rwlock_wrlock_full since abstime
uses that clock.
* sysdeps/unix/sysv/linux/aarch64/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/alpha/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/arm/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/csky/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/hppa/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/i386/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/ia64/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/microblaze/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/nios2/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sh/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
(GLIBC_2.30): Likewise.
* nptl/tst-abstime.c (th): Add pthread_rwlock_clockrdlock and
pthread_rwlock_clockwrlock timeout tests to match the existing
pthread_rwlock_timedrdloock and pthread_rwlock_timedwrlock tests.
* nptl/tst-rwlock14.c (do_test): Likewise.
* nptl/tst-rwlock6.c Invent verbose_printf macro, and use for
ancillary output throughout. (tf): Accept thread_args structure so
that rwlock, a clockid and function name can be passed to the
thread. (do_test_clock): Rename from do_test. Accept clockid
parameter to specify test clock. Use the magic clockid value of
CLOCK_USE_TIMEDLOCK to indicate that pthread_rwlock_timedrdlock and
pthread_rwlock_timedwrlock should be tested, otherwise pass the
specified clockid to pthread_rwlock_clockrdlock and
pthread_rwlock_clockwrlock. Use xpthread_create and xpthread_join.
(do_test): Call do_test_clock to test each clockid in turn.
* nptl/tst-rwlock7.c: Likewise.
* nptl/tst-rwlock9.c (writer_thread, reader_thread): Accept
thread_args structure so that the (now int) thread number, the
clockid and the function name can be passed to the thread.
(do_test_clock): Renamed from do_test. Pass the necessary
thread_args when creating the reader and writer threads. Use
xpthread_create and xpthread_join.
(do_test): Call do_test_clock to test each clockid in turn.
* manual/threads.texi: Add documentation for
pthread_rwlock_clockrdlock and pthread_rwlock_clockwrclock.
Mike Crowe [Mon, 24 Jun 2019 12:39:02 +0000 (12:39 +0000)]
nptl: pthread_rwlock: Move timeout validation into _full functions
As recommended by the comments in the implementations of
pthread_rwlock_timedrdlock and pthread_rwlock_timedwrlock, let's move
the timeout validity checks into the corresponding pthread_rwlock_rdlock_full
and pthread_rwlock_wrlock_full functions. Since these functions may be
called with abstime == NULL, an extra check for that is necessary too.
* nptl/pthread_rwlock_common.c (__pthread_rwlock_rdlock_full):
Check validity of abstime parameter.
(__pthread_rwlock_rwlock_full): Likewise.
* nptl/pthread_rwlock_timedrdlock.c
* (pthread_rwlock_timedrdlock):
Remove check for validity of abstime parameter.
* nptl/pthread_rwlock_timedwrlock.c
* (pthread_rwlock_timedwrlock):
Likewise.
which behaves just like pthread_cond_timedwait except it always measures
abstime against the supplied clockid. Currently supports CLOCK_REALTIME
and
CLOCK_MONOTONIC and returns EINVAL if any other clock is specified.
Includes feedback from many others. This function was originally
proposed[1] as pthread_cond_timedwaitonclock_np, but The Austin Group
preferred the new name.
* nptl/Makefile: Add tst-cond26 and tst-cond27
* nptl/Versions (GLIBC_2.30): Add pthread_cond_clockwait
* sysdeps/nptl/pthread.h: Likewise
* nptl/forward.c: Add __pthread_cond_clockwait
* nptl/forward.c: Likewise
* nptl/pthreadP.h: Likewise
* sysdeps/nptl/pthread-functions.h: Likewise
* nptl/pthread_cond_wait.c (__pthread_cond_wait_common): Add
clockid parameter and comment describing why we don't need to
check
its value. Use that value when calling
futex_abstimed_wait_cancelable rather than reading the clock
from
the flags. (__pthread_cond_wait): Pass unused clockid parameter.
(__pthread_cond_timedwait): Read clock from flags and pass it to
__pthread_cond_wait_common. (__pthread_cond_clockwait): Add new
function with weak alias from pthread_cond_clockwait.
* sysdeps/mach/hurd/i386/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/aarch64/libpthread.abilist
* (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/alpha/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/arm/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/csky/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/hppa/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/i386/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/ia64/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/microblaze/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/nios2/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sh/libpthread.abilist (GLIBC_2.30):
* Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
(GLIBC_2.30): Likewise.
* nptl/tst-cond11.c (run_test): Support testing
pthread_cond_clockwait too by using a special magic
CLOCK_USE_ATTR_CLOCK value to determine whether to call
pthread_cond_timedwait or pthread_cond_clockwait. (do_test):
Pass
CLOCK_USE_ATTR_CLOCK for existing tests, and add new tests using
all combinations of CLOCK_MONOTONIC and CLOCK_REALTIME.
* ntpl/tst-cond26.c: New test for passing unsupported and
* invalid
clocks to pthread_cond_clockwait.
* nptl/tst-cond27.c: Add test similar to tst-cond5.c, but using
struct timespec and pthread_cond_clockwait.
* manual/threads.texi: Document pthread_cond_clockwait. The
* comment
was provided by Carlos O'Donell.
Mike Crowe [Fri, 21 Jun 2019 15:57:41 +0000 (15:57 +0000)]
nptl: Add POSIX-proposed sem_clockwait
Add:
int sem_clockwait (sem_t *sem, clockid_t clock, const struct timespec
*abstime)
which behaves just like sem_timedwait, but measures abstime against the
specified clock. Currently supports CLOCK_REALTIME and CLOCK_MONOTONIC
and sets errno == EINVAL if any other clock is specified.
* nptl/sem_waitcommon.c (do_futex_wait, __new_sem_wait_slow): Add
clockid parameters to indicate the clock which abstime should be
measured against.
* nptl/sem_timedwait.c (sem_timedwait), nptl/sem_wait.c
(__new_sem_wait): Pass CLOCK_REALTIME as clockid to
__new_sem_wait_slow.
* nptl/sem_clockwait.c: New file to implement sem_clockwait based
on sem_timedwait.c.
* nptl/Makefile: Add sem_clockwait.c source file. Add CFLAGS for
sem_clockwait.c to match those used for sem_timedwait.c.
* sysdeps/pthread/semaphore.h: Add sem_clockwait.
* nptl/Versions (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/aarch64/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/alpha/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/arm/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/csky/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/hppa/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/i386/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/ia64/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/microblaze/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/nios2/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/riscv/rv64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sh/libpthread.abilist (GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
(GLIBC_2.30): Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libpthread.abilist
(GLIBC_2.30): Likewise.
* nptl/tst-sem17.c: Add new test for passing invalid clock to
sem_clockwait.
* nptl/tst-sem13.c, nptl/tst-sem5.c: Modify existing sem_timedwait
tests to also test sem_clockwait.
* manual/threads.texi: Document sem_clockwait.
Mike Crowe [Fri, 21 Jun 2019 14:53:40 +0000 (14:53 +0000)]
nptl: Add clockid parameter to futex timed wait calls
In preparation for adding POSIX clockwait variants of timedwait functions,
add a clockid_t parameter to futex_abstimed_wait functions and pass
CLOCK_REALTIME from all callers for the time being.
Replace lll_futex_timed_wait_bitset with lll_futex_clock_wait_bitset
which takes a clockid_t parameter rather than the magic clockbit.
* sysdeps/nptl/lowlevellock-futex.h,
sysdeps/unix/sysv/linux/lowlevellock-futex.h: Replace
lll_futex_timed_wait_bitset with lll_futex_clock_wait_bitset that
takes a clockid rather than a special clockbit.
* sysdeps/nptl/lowlevellock-futex.h: Add
lll_futex_supported_clockid so that client functions can check
whether their clockid parameter is valid even if they don't
ultimately end up calling lll_futex_clock_wait_bitset.
* sysdeps/nptl/futex-internal.h,
sysdeps/unix/sysv/linux/futex-internal.h
(futex_abstimed_wait, futex_abstimed_wait_cancelable): Add
clockid_t parameter to indicate which clock the absolute time
passed should be measured against. Pass that clockid onto
lll_futex_clock_wait_bitset. Add invalid clock as reason for
returning -EINVAL.
* sysdeps/nptl/futex-internal.h,
sysdeps/unix/sysv/linux/futex-internal.h: Introduce
futex_abstimed_supported_clockid so that client functions can check
whether their clockid parameter is valid even if they don't
ultimately end up calling futex_abstimed_wait.
* nptl/pthread_cond_wait.c (__pthread_cond_wait_common): Remove
code to calculate relative timeout for
__PTHREAD_COND_CLOCK_MONOTONIC_MASK and just pass CLOCK_MONOTONIC
or CLOCK_REALTIME as required to futex_abstimed_wait_cancelable.
* nptl/pthread_rwlock_common (__pthread_rwlock_rdlock_full)
(__pthread_wrlock_full), nptl/sem_waitcommon (do_futex_wait): Pass
additional CLOCK_REALTIME to futex_abstimed_wait_cancelable.
* nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock):
Switch to lll_futex_clock_wait_bitset and pass CLOCK_REALTIME
posix: Fix large mmap64 offset for mips64n32 (BZ#24699)
The fix for BZ#21270 (commit 158d5fa0e19) added a mask to avoid offset larger
than 1^44 to be used along __NR_mmap2. However mips64n32 users __NR_mmap,
as mips64n64, but still defines off_t as old non-LFS type (other ILP32, such
x32, defines off_t being equal to off64_t). This leads to use the same
mask meant only for __NR_mmap2 call for __NR_mmap, thus limiting the maximum
offset it can use with mmap64.
This patch fixes by setting the high mask only for __NR_mmap2 usage. The
posix/tst-mmap-offset.c already tests it and also fails for mips64n32. The
patch also change the test to check for an arch-specific header that defines
the maximum supported offset.
Checked on x86_64-linux-gnu, i686-linux-gnu, and I also tests tst-mmap-offset
on qemu simulated mips64 with kernel 3.2.0 kernel for both mips-linux-gnu and
mips64-n32-linux-gnu.
[BZ #24699]
* posix/tst-mmap-offset.c: Mention BZ #24699.
(do_test_bz21270): Rename to do_test_large_offset and use
mmap64_maximum_offset to check for maximum expected offset value.
* sysdeps/generic/mmap_info.h: New file.
* sysdeps/unix/sysv/linux/mips/mmap_info.h: Likewise.
* sysdeps/unix/sysv/linux/mmap64.c (MMAP_OFF_HIGH_MASK): Define iff
__NR_mmap2 is used.
nss_db allows for getpwent et al to be called without a set*ent,
but it only works once. After the last get*ent a set*ent is
required to restart, because the end*ent did not properly reset
the module. Resetting it to NULL allows for a proper restart.
If the database doesn't exist, however, end*ent erroniously called
munmap which set errno.
The test case runs "makedb" inside the testroot, so needs selinux
DSOs installed.
Mao Han [Wed, 10 Jul 2019 06:09:51 +0000 (14:09 +0800)]
locale/tst-locale-locpath: Fix arguments passing
The arguments passed by Makefile are missing match with the arguments
taken by locale/tst-locale-locpath.sh. Without this patch
cross-test-ssh.sh will be called twice in a single command while
doing the make check test wish ssh test wrapper.
Paul A. Clarke [Mon, 8 Jul 2019 22:06:19 +0000 (17:06 -0500)]
[powerpc] fenv_libc.h: protect use of __builtin_cpu_supports
Using __builtin_cpu_supports() requires support in GCC and Glibc.
My recent patch to fenv_libc.h added an unprotected use of
__builtin_cpu_supports(). Compilation of Glibc itself will fail
with a sufficiently new GCC and sufficiently old Glibc:
../sysdeps/powerpc/fpu/fegetexcept.c: In function ‘__fegetexcept’:
../sysdeps/powerpc/fpu/fenv_libc.h:52:20: error: builtin ‘__builtin_cpu_supports’ needs GLIBC (2.23 and newer) that exports hardware capability bits [-Werror]
The power7 logb implementation does not show a performance gain on
ISA 2.07+ chips with faster floating-point to GRP instructions
(currently POWER8 and POWER9).
This patch moves the POWER7 implementation to generic one and enables
it for POWER7. It also add some cleanup to use inline floating-point
number instead of define them using static const.
The ifunc implementation is also enabled only for powerpc64.
Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).
* sysdeps/powerpc/power7/fpu/s_logb.c: Move to ...
* sysdeps/powerpc/fpu/s_logb.c: ... here. Use inline FP constants.
* sysdeps/powerpc/power7/fpu/s_logbf.c: Move to ...
* sysdeps/powerpc/fpu/s_logbf.c: ... here. Use inline FP constants.
* sysdeps/powerpc/power7/fpu/s_logbl.c: Move to ...
* sysdeps/powerpc/fpu/s_logbl.c: ... here. Use inline FP constants.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logb-power7.c:
Adjust implementation path.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbf-power7.c:
Adjust implementation path.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_logbl-power7.c:
Adjust implementation path.
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
(libm-sysdep_routines): Add s_log* objects.
(CFLAGS-s_logbf-power7.c, CFLAGS-s_logbl-power7.c,
CFLAGS-s_logb-power7.c): New fule.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-power7.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb-power7.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb-ppc64.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb-ppc64.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logb.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logb.c: ... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-power7.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf-power7.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf-ppc64.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf-ppc64.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbf.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbf.c: ... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-power7.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl-power7.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl-ppc64.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl-ppc64.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_logbl.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_logbl.c: ... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile: Remove file.
* sysdeps/powerpc/powerpc64/power7/fpu/s_logb.c: Remove file.
* sysdeps/powerpc/powerpc64/power7/fpu/s_logbf.c: Likewise.
* sysdeps/powerpc/powerpc64/power7/fpu/s_logbl.c: Likewise.
Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
- The resulting binary difference on 32 bits architecture is
minimum. On i686-linux-gnu (with architecture optimization
routine removed) there is no different using logb benchtests
- It helps wordsize-64 architectures that use ldbl-opt.
- It add some code simplification with reduction of duplicated
implementations.
Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).
* sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c: Move to ...
* sysdeps/ieee754/dbl-64/s_logb.c: ... here. Add work around for
powerpc32 integer 0 converting to -0.
Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
The modf{f} optimization is not an optimization for ISA 2.07+. This
patch move the IFUNC for powerpc64 only, move the power5+ to generic
location, and include the generic implementation for ISA 2.07+.
The performance changes are based on modf benchtests:
Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).
* sysdeps/powerpc/power5+/fpu/s_modf.c: Move to ...
* sysdeps/powerpc/fpu/s_modf.c: ... here. Add ISA 2.07 optimization.
* sysdeps/powerpc/power5+/fpu/s_modff.c: Move to ...
* sysdeps/powerpc/fpu/s_modff.c: ... here. Add ISA 2.07 optimization.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf-power5+.c:
Adjust include.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modff-power5+.c:
Likewise.
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile (sysdep_calls,
sysdep_routines): Add s_modf* objects.
(CFLAGS-s_modf-power5+.c, CFLAGS-s_modff-power5+.c,
CFLAGS-s_modf-ppc64.c, CFLAGS-s_modff-ppc64.c): New rule.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf-power5+.c: Movo
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c: Move
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf.c: ... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-power5+.c: Move
to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff-ppc64.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-ppc64.c:
... here.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_modff.c: Move to ...
* sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff.c: ... here.
Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
- Commit 8df4e219e43, both isnan and isinf are always inlined and thus
the check TEST_INF_NAN does not make sense anymore. The generic
check for POWER7 should be faster on all powerpc configuration.
- The redundant check 'y > two60factor && (x / y) > two60' is removed.
Both changes leads to unrequired ifunc especialization for power7 and
thus they are removed. Finally The code is also cleanup a bit by inlining
the constants floating points.
The performance changes using the hypot benchtests are:
Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).
Szabolcs Nagy [Tue, 23 Apr 2019 14:59:34 +0000 (15:59 +0100)]
aarch64: new ifunc resolver ABI
Passing a second argument to the ifunc resolver allows accessing
AT_HWCAP2 values from the resolver. AArch64 will start using AT_HWCAP2
on linux because for ilp32 to remain compatible with lp64 ABI no more
than 32bit hwcap flags can be in AT_HWCAP which is already used up.
Currently the relocation ordering logic does not guarantee that ifunc
resolvers can call libc apis or access libc objects, so only the
resolver arguments and runtime environment dependent instructions can
be used to do the dispatch (this affects ifunc resolvers outside of
the libc).
Since ifunc resolver is target specific and only supposed to be
called by the dynamic linker, the call ABI can be changed in a
backward compatible way:
Old call ABI passed hwcap as uint64_t, new abi sets the
_IFUNC_ARG_HWCAP flag in the hwcap and passes a second argument
that's a pointer to an extendible struct. A resolver has to check
the _IFUNC_ARG_HWCAP flag before accessing the second argument.
The new sys/ifunc.h installed header has the definitions for the
new ABI, everything is in the implementation reserved namespace.
An alternative approach is to try to support extern calls from ifunc
resolvers such as getauxval, but that seems non-trivial
https://sourceware.org/ml/libc-alpha/2017-01/msg00468.html
* sysdeps/aarch64/Makefile: Install sys/ifunc.h and add tests.
* sysdeps/aarch64/dl-irel.h (elf_ifunc_invoke): Update to new ABI.
* sysdeps/aarch64/sys/ifunc.h: New file.
* sysdeps/aarch64/tst-ifunc-arg-1.c: New file.
* sysdeps/aarch64/tst-ifunc-arg-2.c: New file.
nptl: Remove vfork IFUNC-based forwarder from libpthread [BZ #20188]
With commit f0b2132b35248c1f4a80f62a2c38cddcc802aa8c ("ld.so:
Support moving versioned symbols between sonames [BZ #24741]"), the
dynamic linker will find the definition of vfork in libc and binds
a vfork reference to that symbol, even if the soname in the version
reference says that the symbol should be located in libpthread.
As a result, the forwarder (whether it's IFUNC-based or a duplicate
of the libc implementation) is no longer necessary.
On older architectures, a placeholder symbol is required, to make sure
that the GLIBC_2.1.2 symbol version does not go away, or is turned in
to a weak symbol definition by the link editor. (The symbol version
needs to preserved so that the symbol coverage check in
elf/dl-version.c does not fail for old binaries.)
mips32 is an outlier: It defined __vfork@@GLIBC_2.2, but the
baseline is GLIBC_2.0. Since there are other @@GLIBC_2.2 symbols,
the placeholder symbol is not needed there.
malloc: Add nptl, htl dependency for the subdirectory [BZ #24757]
memusagestat may indirectly link against libpthread. The built
libpthread should be used, but that is only possible if it has been
built before the malloc programs.
Stefan Liebler [Tue, 2 Jul 2019 12:07:44 +0000 (14:07 +0200)]
Fix build warnings in resolv/res_send.c
This patch fixes the gcc warnings seen with gcc 9 -march>=z13 on s390x:
res_send.c: In function ‘__res_context_send’:
res_send.c:498:7: error: ‘resplen’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
498 | if (n == 0 && (buf2 == NULL || *resplen2 == 0))
| ^
In this case send_vc is inlined into __res_context_send
and the maybe uninitialized resplen belongs to the one in send_vc.
In send_vc there is already a DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized")
and a comment which explains that this is a false-positive.
Note that resplen is used as return value.
This patch adds a further DIAG_IGNORE_NEEDS_COMMENT around the declaration of n
in __res_context_send and the comparison after n was set to the return value of send_vc.
H.J. Lu [Mon, 1 Jul 2019 19:23:10 +0000 (12:23 -0700)]
Call _dl_open_check after relocation [BZ #24259]
This is a workaround for [BZ #20839] which doesn't remove the NODELETE
object when _dl_open_check throws an exception. Move it after relocation
in dl_open_worker to avoid leaving the NODELETE object mapped without
relocation.
Paul A. Clarke [Thu, 20 Jun 2019 16:57:18 +0000 (11:57 -0500)]
powerpc: Use faster means to access FPSCR when possible in some cases
Using 'mffs' instruction to read the Floating Point Status Control Register
(FPSCR) can force a processor flush in some cases, with undesirable
performance impact. If the values of the bits in the FPSCR which force the
flush are not needed, an instruction that is new to POWER9 (ISA version 3.0),
'mffsl' can be used instead.
Wilco Dijkstra [Fri, 28 Jun 2019 12:42:36 +0000 (13:42 +0100)]
Further improve string bench timing
Further improve the timings of the string benchmarks. Ensure most take
between 1 and 4 seconds to improve accuracy. Overall time taken increases
by 35%. Tested on AArch64.
Some benchmarks with a very short runtime show significantly
different results across runs on Aarch64 - up to tens of percents.
Increasing the runtime to 100ms+ makes the deviation under 5%.
Florian Weimer [Fri, 28 Jun 2019 08:12:50 +0000 (10:12 +0200)]
ld.so: Support moving versioned symbols between sonames [BZ #24741]
This change should be fully backwards-compatible because the old
code aborted the load if a soname mismatch was encountered
(instead of searching further for a matching symbol). This means
that no different symbols are found.
The soname check was explicitly disabled for the skip_map != NULL
case. However, this only happens with dl(v)sym and RTLD_NEXT,
and those lookups do not come with a verneed entry that could be used
for the check.
The error check was already explicitly disabled for the skip_map !=
NULL case, that is, when dl(v)sym was called with RTLD_NEXT. But
_dl_vsym always sets filename in the struct r_found_version argument
to NULL, so the check was not active anyway. This means that
symbol lookup results for the skip_map != NULL case do not change,
either.
Florian Weimer [Fri, 28 Jun 2019 07:39:21 +0000 (09:39 +0200)]
io: Remove copy_file_range emulation [BZ #24744]
The kernel is evolving this interface (e.g., removal of the
restriction on cross-device copies), and keeping up with that
is difficult. Applications which need the function should
run kernels which support the system call instead of relying on
the imperfect glibc emulation.
Prepare vfprintf to use __printf_fp/__printf_fphex with float128 arg
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 printf-like functions is aware of these possibilities
and properly parses floating-point values from the variable arguments,
before making calls to __printf_fp and __printf_fphex. These functions
are also aware of the format possibilities and know how to convert both
formats to string.
When library support for TS 18661-3 was added to glibc, __printf_fp and
__printf_fphex were extended with support for an additional type
(__float128/_Float128) with a different format (binary128). 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/_Float128, this patch extends __vfprintf_internal to properly
call __printf_fp and __printf_fphex with this new format.
Tested for powerpc64le (with additional patches to actually enable the
use of these preparations) and for x86_64.
Florian Weimer [Thu, 27 Jun 2019 13:08:40 +0000 (15:08 +0200)]
Linux: Adjust gedents64 buffer size to int range [BZ #24740]
The kernel interface uses type unsigned int, but there is an
internal conversion to int, so INT_MAX is the correct limit.
Part of the buffer will always be unused, but this is not a
problem. Such huge buffers do not occur in practice anyway.
Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).
This patches consolidates all the powerpc llround{f} implementations on
the generic sysdeps/powerpc/powerpc32/fpu/s_llround{f}.
Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).
Vincent Chen [Wed, 26 Jun 2019 09:30:11 +0000 (17:30 +0800)]
Linux: Add nds32 specific syscalls to syscall-names.list
The nds32 creates two specific syscalls, udftrap and fp_udfiex_crtl, in
kernel v5.0 and v5.2, respectively. Add these two syscalls to
syscall-names.list.
Stefan Liebler [Wed, 26 Jun 2019 10:29:50 +0000 (12:29 +0200)]
Fix build warnings in nptl/tst-eintr1.c
This patch fixes the gcc warnings seen with gcc 9.1 -O3 on s390x:
tst-eintr1.c: In function ‘tf1’:
tst-eintr1.c:46:1: error: no return statement in function returning non-void [-Werror=return-type]
46 | }
| ^
tst-eintr1.c: In function ‘do_test’:
tst-eintr1.c:57:17: error: unused variable ‘th’ [-Werror=unused-variable]
57 | pthread_t th = xpthread_create (NULL, tf1, NULL);
| ^~
Stefan Liebler [Wed, 26 Jun 2019 06:34:25 +0000 (08:34 +0200)]
Fix build warnings in locale/programs/ld-ctype.c
This patch fixes the gcc warnings seen with gcc 9 -march>=z13 on s390x:
programs/ld-ctype.c: In function ‘ctype_read’:
programs/ld-ctype.c:1392:13: error: ‘wch’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
1392 | uint32_t wch;
| ^~~
programs/ld-ctype.c:1401:7: error: ‘seq’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
1401 | if (seq != NULL && seq->nbytes == 1)
| ^
programs/ld-ctype.c:1391:20: note: ‘seq’ was declared here
1391 | struct charseq *seq;
| ^~~
Both seq and wch are uninitialized if get_character fails.
Thus we are now returning with an error.
ChangeLog:
* locale/programs/ld-ctype.c (charclass_symbolic_ellipsis):
Return error if get_character fails.
Grzegorz Kulik [Tue, 18 Jun 2019 16:41:19 +0000 (18:41 +0200)]
szl_PL locale: Spelling corrections (bug 24652).
This commit also provides the correct month names in both nominative
and genitive case for Silesian language, as required by the fix for
the bug 10871.
[BZ #24652]
* localedata/locales/szl_PL (abday): Spelling corrections.
(day): Likewise.
(abmon): Likewise.
(mon): Rename to...
(alt_mon): This, then apply spelling corrections.
(mon): New entry, month names in the genitive case.
Rafal Luzynski [Fri, 21 Jun 2019 18:18:48 +0000 (20:18 +0200)]
nl_{AW,NL}: Correct the thousands separator and grouping (bug 23831).
According to CLDR 35.1 and the bug report the thousands grouping
separator should be always "." (a single dot) and digits should be
grouped by 3.
[BZ #23831]
* localedata/locales/nl_AW (mon_thousands_sep): Set to ".".
* localedata/locales/nl_NL (mon_thousands_sep): Likewise.
(thousands_sep): Likewise.
(grouping): Set to 3;3.
Tobias Klauser [Fri, 21 Jun 2019 13:36:52 +0000 (10:36 -0300)]
Add missing VDSO_{NAME,HASH}_* macros and use them for PREPARE_VERSION_KNOWN
Define all currently used Linux versions used for
PREPARE_VERSION{,_KNOWN} in sysdeps/unix/sysv/linux/dl-vdso.h and use
them instead of duplicating the versions and precomputed hashes across
architecture specific files.
Dmitry V. Levin [Wed, 13 Feb 2019 01:20:51 +0000 (01:20 +0000)]
libio: do not attempt to free wide buffers of legacy streams [BZ #24228]
Commit a601b74d31ca086de38441d316a3dee24c866305 aka glibc-2.23~693
("In preparation for fixing BZ#16734, fix failure in misc/tst-error1-mem
when _G_HAVE_MMAP is turned off.") introduced a regression:
_IO_unbuffer_all now invokes _IO_wsetb to free wide buffers of all
files, including legacy standard files which are small statically
allocated objects that do not have wide buffers and the _mode member,
causing memory corruption.
Another memory corruption in _IO_unbuffer_all happens when -1
is assigned to the _mode member of legacy standard files that
do not have it.
[BZ #24228]
* libio/genops.c (_IO_unbuffer_all)
[SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)]: Do not attempt to free wide
buffers and access _IO_FILE_complete members of legacy libio streams.
* libio/tst-bz24228.c: New file.
* libio/tst-bz24228.map: Likewise.
* libio/Makefile [build-shared] (tests): Add tst-bz24228.
[build-shared] (generated): Add tst-bz24228.mtrace and
tst-bz24228.check.
[run-built-tests && build-shared] (tests-special): Add
$(objpfx)tst-bz24228-mem.out.
(LDFLAGS-tst-bz24228, tst-bz24228-ENV): New variables.
($(objpfx)tst-bz24228-mem.out): New rule.
int main() {
uint64_t freq = __ppc_get_timebase_freq();
printf("Time Base frequency = %"PRIu64" Hz\n", freq);
if (freq == 0)
return -1;
return 0;
}
/******************************/
Compile command: gcc -static example.c
This bug has been reproduced, fixed and tested on all powerpc platforms
(ppc32, ppc64 and ppc64le).
The underlying code of __ppc_get_timebase_freq uses __get_timebase_freq
that has a different implementation for shared and static version of
glibc. In the static version, there is an incorrect sense in the if
check for the fd returned when opening /proc/cpuinfo.
This solution is mostly a cherry-pick from:
commit 4791e4f773d060c1a37b27aac5b03cdfa9327afc
Author: Stan Shebs <stanshebs@google.com>
Date: Fri May 17 12:25:19 2019 -0700
Subject: Fix sense of a test in the static-linking version of ppc get_clockfreq
That is in branch glibc/google/grte/v5-2.27/master and was mentioned for
inclusion on master here:
Adapted from original fix for get_clockfreq. That code was moved to
get_timebase_freq.
Also added a static-build testcase for __ppc_get_timebase_freq since the
underlying function has different implementations for shared and static
build.
[BZ #24640]
* sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c
[!SHARED] (__get_timebase_freq): Fix sense of a test in the
static-linking version.
* sysdeps/unix/sysv/linux/powerpc/Makefile
(tests-static): Add test-gettimebasefreq-static.
(tests): Likewise.
* sysdeps/unix/sysv/linux/powerpc/test-gettimebasefreq-static.c:
New file.
Rafal Luzynski [Mon, 17 Jun 2019 23:20:11 +0000 (01:20 +0200)]
nl_AW locale: Correct the negative monetary format (bug 24614).
Follow the same changes as made in the commit 02d8b5ab1c because the
respective entries in nl_NL and nl_AW had been the same before the change
so they should be the same after. CLDR does not provide complete data
for nl_AW, it says it is missing and displays a copy of nl_NL.
[BZ #24614]
* localedata/locales/nl_AW (n_sep_by_space): Set to 2 (a space
between the currency symbol and the minus sign).
(n_sign_posn): Set to 4 (the minus sign after the currency symbol).
Stefan Liebler [Wed, 19 Jun 2019 10:32:04 +0000 (12:32 +0200)]
Fix gcc 9 build errors for make xcheck. [BZ #24556]
This patch fixes the following gcc 9 warnings for "make xcheck" / "make bench":
-string/tst-strcasestr.c:
../include/bits/../../misc/bits/error.h:42:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
-argp/argp-test.c:
argp-test.c:130:20: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Werror=format-overflow=]
argp-test.c:130:19: note: directive argument in the range [-2147483648, 122]
argp-test.c:130:5: note: ‘sprintf’ output between 2 and 12 bytes into a destination of size 10
-nss/tst-field.c:
tst-field.c:52:7: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
-benchtests/bench-strstr.c:
../include/bits/../../misc/bits/error.h:42:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
Florian Weimer [Wed, 19 Jun 2019 08:13:50 +0000 (10:13 +0200)]
dlfcn: Avoid one-element flexible array in Dl_serinfo [BZ #24166]
The dls_serpath path field, as an array of length 1, introduces
unexpected array subscript checks with some compilers.
GCC versions before 3.0 treat the nested anonymous union as a
declaration of an unnamed type, and not as a member declaration,
so this construct cannot be used for these compilers.
Rafal Luzynski [Wed, 5 Jun 2019 22:22:54 +0000 (00:22 +0200)]
nl_NL locale: Correct the negative monetary format (bug 24614).
According to CLDR 35.1 and the bug report the correct monetary format
for negative amounts should be "EUR -1 234,56" while previously it was
"EUR 1 234,56-".
This patch does not change the thousands (grouping) separator.
[BZ #24614]
* localedata/Makefile (LOCALES): Add nl_NL.UTF-8.
* localedata/locales/nl_NL (n_sep_by_space): Set to 2 (a space
between the currency symbol and the minus sign).
(n_sign_posn): Set to 4 (the minus sign after the currency symbol).
* localedata/tst-strfmon1.c (tests): Add test data for nl_NL.UTF-8.
Although defined in initial TLS/NPTL ABI for m68k and ColdFire [1], kernel
support was never pushed upstream. This patch removes the unused m68k
vDSO support.
Checked with a build against m68k and m68k-coldfire and some basic
tests on ARAnyM.
This patches consolidates all the powerpc {l}lround{f} implementations
on the generic sysdeps/powerpc/fpu/s_{l}lround{f}.c.
The IFUNC support is also moved only to powerpc64 only, since for
powerpc64le generic implementation resulting in optimized code.
Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).
This patches consolidates all the powerpc llrint{f} implementations on
the generic sysdeps/powerpc/powerpc32/fpu/s_llrint{f}.
Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cpu and with --with-cpu=power5+
and --disable-multi-arch).
This patches consolidates all the powerpc llrint{f} implementations on
the generic sysdeps/powerpc/fpu/s_llrint{f}.
The IFUNC support is also moved only to powerpc64 only, since for
powerpc64le generic implementation resulting in optimized code.
Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).
Florian Weimer [Fri, 14 Jun 2019 14:28:41 +0000 (16:28 +0200)]
Linux: Fix __glibc_has_include use for <sys/stat.h> and statx
The identifier linux is used as a predefined macro, so the actually
used path is 1/stat.h or 1/stat64.h. Using the quote-based version
triggers a file lookup for /usr/include/bits/linux/stat.h (or whatever
directory is used to store bits/statx.h), but since bits/ is pretty
much reserved by glibc, this appears to be acceptable.
This is related to GCC PR 80005: incorrect macro expansion of the
argument of __has_include.
Joseph Myers [Thu, 13 Jun 2019 12:21:50 +0000 (12:21 +0000)]
Allow memset local PLT reference for powerpc soft-float.
Some recent change on GCC mainline resulted in the localplt test
failing for powerpc soft-float (not sure exactly when, as the failure
appeared when there were other build test failures as well;
<https://sourceware.org/ml/libc-testresults/2019-q2/msg00261.html>
shows it remaining when other failures went away). The problem is a
call to memset that GCC now generates in the libgcc long double code.
Since memset is documented as a function GCC may always implicitly
generate calls to, it seems reasonable to allow that local PLT
reference (just like those for libgcc functions that GCC implicitly
generates calls to and that are also exported from libc.so), which
this patch does.
Tested for powerpc soft-float with build-many-glibcs.py.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/localplt.data:
Allow memset in libc.so.