platform/upstream/glibc.git
3 years agonptl: Move tss_delete into libc
Florian Weimer [Mon, 3 May 2021 06:12:12 +0000 (08:12 +0200)]
nptl: Move tss_delete into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

__pthread_key_delete@@GLIBC_PRIVATE is no longer needed after that,
so it is removed as well.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move tss_create into libc
Florian Weimer [Mon, 3 May 2021 06:12:12 +0000 (08:12 +0200)]
nptl: Move tss_create into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

__pthread_key_create@@GLIBC_2.34 is no longer needed by glibc
itself with this change, but __pthread_key_create is used by
libstdc++, so it still has to be exported as a public symbol.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move thrd_exit into libc
Florian Weimer [Mon, 3 May 2021 06:12:12 +0000 (08:12 +0200)]
nptl: Move thrd_exit into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_exit@@GLIBC_PRIVATE symbol is no longer needed
after this change, so remove it.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move mtx_unlock into libc
Florian Weimer [Mon, 3 May 2021 06:12:12 +0000 (08:12 +0200)]
nptl: Move mtx_unlock into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

__pthread_mutex_unlock@GLIBC_2.34 is not removed in this commit
because it is still used from nptl/nptl-init.c.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move mtx_trylock into libc
Florian Weimer [Mon, 3 May 2021 06:12:11 +0000 (08:12 +0200)]
nptl: Move mtx_trylock into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_mutex_trylock@@GLIBC_2.34 symbol version is no longer
needed because the call is now internal to libc, so remove it with
this commit.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move mtx_timedlock into libc
Florian Weimer [Mon, 3 May 2021 06:12:11 +0000 (08:12 +0200)]
nptl: Move mtx_timedlock into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_mutex_timedlock@@GLIBC_PRIVATE export is no longer
needed, so it is removed with this commit.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move mtx_lock into libc
Florian Weimer [Mon, 3 May 2021 06:12:11 +0000 (08:12 +0200)]
nptl: Move mtx_lock into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

__pthread_mutex_lock@GLIBC_2.34 is not removed in this commit
because it is still used from nptl/nptl-init.c.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move mtx_init into libc
Florian Weimer [Mon, 3 May 2021 06:12:11 +0000 (08:12 +0200)]
nptl: Move mtx_init into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

The calls to __pthread_mutex_init, __pthread_mutexattr_init,
__pthread_mutexattr_settype are now private and no longer need
to be exported.  This allows the removal of the newly added
GLIBC_2.34 symbol versions for those functions.

Also clean up some weak declarations in <libc-lockP.h> for
these functions.  They are not needed and potentially incorrect
for static linking of mtx_init.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move mtx_destroy into libc
Florian Weimer [Mon, 3 May 2021 06:12:11 +0000 (08:12 +0200)]
nptl: Move mtx_destroy into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_mutex_destroy@@GLIBC_2.34 symbol is no longer
neded because this commit makes __pthread_mutex_destroy@GLIBC_2.0
a compatibility symbol, so remove the new symbol version.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move cnd_wait into libc
Florian Weimer [Mon, 3 May 2021 06:12:11 +0000 (08:12 +0200)]
nptl: Move cnd_wait into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_cond_wait@@GLIBC_PRIVATE symbol is no longer
neded, so remove that as well.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move cnd_timedwait into libc
Florian Weimer [Mon, 3 May 2021 06:12:11 +0000 (08:12 +0200)]
nptl: Move cnd_timedwait into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_cond_timedwait@@GLIBC_PRIVATE symbol is no longer
neded, so remove that as well.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move cnd_signal into libc
Florian Weimer [Mon, 3 May 2021 06:12:11 +0000 (08:12 +0200)]
nptl: Move cnd_signal into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_cond_signal@@GLIBC_PRIVATE symbol is no longer
neded, so remove that as well.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move cnd_init into libc
Florian Weimer [Mon, 3 May 2021 06:12:11 +0000 (08:12 +0200)]
nptl: Move cnd_init into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_cond_init@@GLIBC_PRIVATE symbol is no longer
neded, so remove that as well.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move cnd_destroy into libc
Florian Weimer [Mon, 3 May 2021 06:12:11 +0000 (08:12 +0200)]
nptl: Move cnd_destroy into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_cond_destroy@@GLIBC_PRIVATE symbol is no longer
neded, so remove that as well.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move cnd_broadcast into libc
Florian Weimer [Mon, 3 May 2021 06:12:11 +0000 (08:12 +0200)]
nptl: Move cnd_broadcast into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

The __pthread_cond_broadcast@@GLIBC_PRIVATE symbol is no longer
neded, so remove that as well.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agonptl: Move call_once into libc
Florian Weimer [Mon, 3 May 2021 06:12:11 +0000 (08:12 +0200)]
nptl: Move call_once into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

This change also turns __pthread_once into a compatibility symbol
because after the call_once move, an internal call to __pthread_once
can be used.  This an adjustment to __libc_once: Outside libc (e.g.,
in nscd), it has to call pthread_once.  With __pthread_once as a
compatibility symbol, it is no longer to add a new GLIBC_2.34
version after the move from libpthread, and this commit removes
the new __pthread_once@@GLIBC_2.34 version.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agoAdd pthread-in-libc, libpthread-routines-var, librt-routines-var
Florian Weimer [Mon, 3 May 2021 06:12:11 +0000 (08:12 +0200)]
Add pthread-in-libc, libpthread-routines-var, librt-routines-var

These make variables can be used to add routines to different
libraries for the Hurd and Linux builds.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
3 years agopowerpc64le: Optimize memset for POWER10
Raoni Fassina Firmino [Fri, 30 Apr 2021 21:12:08 +0000 (18:12 -0300)]
powerpc64le: Optimize memset for POWER10

This implementation is based on __memset_power8 and integrates a lot
of suggestions from Anton Blanchard.

The biggest difference is that it makes extensive use of stxvl to
alignment and tail code to avoid branches and small stores.  It has
three main execution paths:

a) "Short lengths" for lengths up to 64 bytes, avoiding as many
   branches as possible.

b) "General case" for larger lengths, it has an alignment section
   using stxvl to avoid branches, a 128 bytes loop and then a tail
   code, again using stxvl with few branches.

c) "Zeroing cache blocks" for lengths from 256 bytes upwards and set
   value being zero.  It is mostly the __memset_power8 code but the
   alignment phase was simplified because, at this point, address is
   already 16-bytes aligned and also changed to use vector stores.
   The tail code was also simplified to reuse the general case tail.

All unaligned stores use stxvl instructions that do not generate
alignment interrupts on POWER10, making it safe to use on
caching-inhibited memory.

On average, this implementation provides something around 30%
improvement when compared to __memset_power8.

Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
3 years agopowerpc64le: Optimize memcpy for POWER10
Tulio Magno Quites Machado Filho [Fri, 30 Apr 2021 21:12:08 +0000 (18:12 -0300)]
powerpc64le: Optimize memcpy for POWER10

This implementation is based on __memcpy_power8_cached and integrates
suggestions from Anton Blanchard.
It benefits from loads and stores with length for short lengths and for
tail code, simplifying the code.

All unaligned memory accesses use instructions that do not generate
alignment interrupts on POWER10, making it safe to use on
caching-inhibited memory.

The main loop has also been modified in order to increase instruction
throughput by reducing the dependency on updates from previous iterations.

On average, this implementation provides around 30% improvement when
compared to __memcpy_power7 and 10% improvement in comparison to
__memcpy_power8_cached.

3 years agopowerpc64le: Optimized memmove for POWER10
Lucas A. M. Magalhaes [Fri, 30 Apr 2021 21:12:08 +0000 (18:12 -0300)]
powerpc64le: Optimized memmove for POWER10

This patch was initially based on the __memmove_power7 with some ideas
from strncpy implementation for Power 9.

Improvements from __memmove_power7:

1. Use lxvl/stxvl for alignment code.

   The code for Power 7 uses branches when the input is not naturally
   aligned to the width of a vector. The new implementation uses
   lxvl/stxvl instead which reduces pressure on GPRs. It also allows
   the removal of branch instructions, implicitly removing branch stalls
   and mispredictions.

2. Use of lxv/stxv and lxvl/stxvl pair is safe to use on Cache Inhibited
   memory.

   On Power 10 vector load and stores are safe to use on CI memory for
   addresses unaligned to 16B. This code takes advantage of this to
   do unaligned loads.

   The unaligned loads don't have a significant performance impact by
   themselves. However doing so decreases register pressure on GPRs
   and interdependence stalls on load/store pairs. This also improved
   readability as there are now less code paths for different alignments.
   Finally this reduces the overall code size.

3. Improved performance.

   This version runs on average about 30% better than memmove_power7
   for lengths  larger than 8KB. For input lengths shorter than 8KB
   the improvement is smaller, it has on average about 17% better
   performance.

   This version has a degradation of about 50% for input lengths
   in the 0 to 31 bytes range when dest is unaligned.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
3 years agoUpdate kernel version to 5.12 in tst-mman-consts.py.
Joseph Myers [Thu, 29 Apr 2021 10:50:11 +0000 (10:50 +0000)]
Update kernel version to 5.12 in tst-mman-consts.py.

This patch updates the kernel version in the test tst-mman-consts.py
to 5.12.  (There are no new MAP_* constants covered by this test in
5.12 that need any other header changes.)

Tested with build-many-glibcs.py.

3 years agoUpdate syscall lists for Linux 5.12.
Joseph Myers [Wed, 28 Apr 2021 17:19:24 +0000 (17:19 +0000)]
Update syscall lists for Linux 5.12.

Linux 5.12 has one new syscall, mount_setattr.  Update
syscall-names.list and regenerate the arch-syscall.h headers with
build-many-glibcs.py update-syscalls.

Tested with build-many-glibcs.py.

3 years agoregenerate ulps on x86_64 with -march=native
Paul Zimmermann [Wed, 28 Apr 2021 09:02:00 +0000 (11:02 +0200)]
regenerate ulps on x86_64 with -march=native

On x86_64, when configuring glibc with CFLAGS="-O2 -g -march=native",
some tests fail. After this patch, "make check" succeeds.

Tested on Intel Core i5-4590 with gcc 10.2.1.

3 years agoPass a valid pointer to pthread_setspecific to avoid GCC 11 warning.
Martin Sebor [Wed, 28 Apr 2021 01:05:30 +0000 (19:05 -0600)]
Pass a valid pointer to pthread_setspecific to avoid GCC 11 warning.

3 years agoAdd __attribute_access_none to disable GCC warnings [BZ #27714]
Martin Sebor [Tue, 27 Apr 2021 19:01:55 +0000 (13:01 -0600)]
Add __attribute_access_none to disable GCC warnings [BZ #27714]

GCC 11 warns when a pointer to an uninitialized object is passed
to a function that takes a const-qualified argument.  This is done
on the assumption that most such functions read from the object.
For the rare case of a function that doesn't, GCC 11 extends
attribute access to add a new mode called none.

POSIX pthread_setspecific() is one such rare function that takes
a const void* argument but that doesn't read from the object it
points to.  To suppress the -Wmaybe-uninitialized issued by GCC
11 when the address of an uninitialized object is passed to it
(e.g., the result of malloc()), this change #defines
__attr_access_none in cdefs.h and uses the macro on the function
in sysdeps/htl/pthread.h and sysdeps/nptl/pthread.h.

3 years agoUse Linux 5.12 and GCC 11 branch in build-many-glibcs.py.
Joseph Myers [Tue, 27 Apr 2021 15:19:08 +0000 (15:19 +0000)]
Use Linux 5.12 and GCC 11 branch in build-many-glibcs.py.

This patch makes build-many-glibcs.py use Linux 5.12 and GCC 11
branch.

Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
builds).

3 years agopowerpc: Add log IFUNC multiarch support for POWER10
Raphael Moreira Zinsly [Thu, 25 Feb 2021 13:42:27 +0000 (10:42 -0300)]
powerpc: Add log IFUNC multiarch support for POWER10

Checked on ppc64le built without --with-cpu, with --with-cpu=power9
and with --disable-multi-arch.

Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
3 years agoLC_COLLATE: Fix last character ellipsis handling (Bug 22668)
Hanataka Shinya [Thu, 18 Feb 2021 04:00:48 +0000 (23:00 -0500)]
LC_COLLATE: Fix last character ellipsis handling (Bug 22668)

During ellipsis processing the collation cursor was not correctly
moved to the end of the ellipsis after processing.

The code inserted the new entry after the cursor, but before the
real end of the ellipsis:
                                [cursor]
... element_t <-> element_t <-> element_t <-> element_t
                  "<U0000>"     "<U0001>"     "<U007F>"
                  startp                      endp

At the end of the function we have:

                  [cursor]
... element_t <-> element_t <-> element_t
                  "<U007E>"     "<U007F>"
                                endp

The cursor should be pointing at endp, the last element in the
doubly-linked list, otherwise when execution returns to the
caller we will start inserting the next line after <U007E>.

Subsequent operations end up unlinking the ellipsis end entry or
just leaving it in the list dangling from the end.  This kind of
dangling is immediately visible in C.UTF-8 with the following
sorting from strcoll:
<U0010FFFF>
<U0000FFFF>
<U000007FF>
<U0000007F>

With the cursor correctly adjusted the end entry is correctly given
the right location and thus the right weight.

Retested and no regressions on x86_64 and i686.

Co-authored-by: Carlos O'Donell <carlos@redhat.com>
3 years agox86: Optimize strchr-evex.S
Noah Goldstein [Fri, 23 Apr 2021 19:56:25 +0000 (15:56 -0400)]
x86: Optimize strchr-evex.S

No bug. This commit optimizes strchr-evex.S. The optimizations are
mostly small things such as save an ALU in the alignment process,
saving a few instructions in the loop return. The one significant
change is saving 2 instructions in the 4x loop. test-strchr,
test-strchrnul, test-wcschr, and test-wcschrnul are all passing.

Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
3 years agox86: Optimize strchr-avx2.S
Noah Goldstein [Fri, 23 Apr 2021 19:56:24 +0000 (15:56 -0400)]
x86: Optimize strchr-avx2.S

No bug. This commit optimizes strchr-avx2.S. The optimizations are all
small things such as save an ALU in the alignment process, saving a
few instructions in the loop return, saving some bytes in the main
loop, and increasing the ILP in the return cases. test-strchr,
test-strchrnul, test-wcschr, and test-wcschrnul are all passing.

Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
3 years agonptl: Remove __h_errno_location from libpthread
Florian Weimer [Fri, 23 Apr 2021 16:08:38 +0000 (18:08 +0200)]
nptl: Remove __h_errno_location from libpthread

The existing definition in libc will be used instead.

The symbol was moved (that is, removed) using
scripts/move-symbol-to-libc.py.

3 years agonptl: Remove __res_state from libpthread
Florian Weimer [Fri, 23 Apr 2021 16:08:37 +0000 (18:08 +0200)]
nptl: Remove __res_state from libpthread

The existing definition in libc will be used instead.

The symbol was moved (that is, removed) using
scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_spin_trylock into libc
Florian Weimer [Fri, 23 Apr 2021 08:23:24 +0000 (10:23 +0200)]
nptl: Move pthread_spin_trylock into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_spin_lock into libc
Florian Weimer [Fri, 23 Apr 2021 08:11:51 +0000 (10:11 +0200)]
nptl: Move pthread_spin_lock into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_spin_init, Move pthread_spin_unlock into libc
Florian Weimer [Thu, 22 Apr 2021 13:18:12 +0000 (15:18 +0200)]
nptl: Move pthread_spin_init, Move pthread_spin_unlock  into libc

For some architectures, the two functions are aliased, so these
symbols need to be moved at the same time.

The symbols were moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_spin_destroy into libc
Florian Weimer [Thu, 22 Apr 2021 13:12:09 +0000 (15:12 +0200)]
nptl: Move pthread_spin_destroy into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_condattr_setpshared into libc
Florian Weimer [Fri, 23 Apr 2021 09:17:10 +0000 (11:17 +0200)]
nptl: Move pthread_condattr_setpshared into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_condattr_setclock into libc
Florian Weimer [Fri, 23 Apr 2021 09:02:54 +0000 (11:02 +0200)]
nptl: Move pthread_condattr_setclock into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_condattr_getpshared into libc
Florian Weimer [Fri, 23 Apr 2021 09:00:53 +0000 (11:00 +0200)]
nptl: Move pthread_condattr_getpshared into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_condattr_getclock into libc
Florian Weimer [Fri, 23 Apr 2021 08:55:07 +0000 (10:55 +0200)]
nptl: Move pthread_condattr_getclock into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_mutexattr_settype, __pthread_mutexattr_settype into libc
Florian Weimer [Fri, 23 Apr 2021 07:49:00 +0000 (09:49 +0200)]
nptl: Move pthread_mutexattr_settype, __pthread_mutexattr_settype into libc

And pthread_mutexattr_setkind_np as a compatibility symbol.

__pthread_mutexattr_settype is used in mtx_init from libpthread,
so this commit adds a GLIBC_2.34 symbol version for it.

The symbols were moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_mutexattr_setrobust into libc
Florian Weimer [Fri, 23 Apr 2021 07:48:36 +0000 (09:48 +0200)]
nptl: Move pthread_mutexattr_setrobust into libc

And pthread_mutexattr_getrobust_np as a compat symbol.

The symbols were moved using scripts/move-symbol-to-libc.py.

3 years agopthread: Use pthread_mutexattr_setrobust in tests
Florian Weimer [Fri, 23 Apr 2021 07:48:10 +0000 (09:48 +0200)]
pthread: Use pthread_mutexattr_setrobust in tests

pthread_mutexattr_setrobust_np is about to be deprecated.

3 years agonptl: Move pthread_mutexattr_setpshared into libc
Florian Weimer [Fri, 23 Apr 2021 07:48:09 +0000 (09:48 +0200)]
nptl: Move pthread_mutexattr_setpshared into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_mutexattr_setprotocol into libc
Florian Weimer [Fri, 23 Apr 2021 07:47:37 +0000 (09:47 +0200)]
nptl: Move pthread_mutexattr_setprotocol into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_mutexattr_setprioceiling into libc
Florian Weimer [Fri, 23 Apr 2021 07:47:15 +0000 (09:47 +0200)]
nptl: Move pthread_mutexattr_setprioceiling into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_mutexattr_init, __pthread_mutexattr_init into libc
Florian Weimer [Fri, 23 Apr 2021 07:46:57 +0000 (09:46 +0200)]
nptl: Move pthread_mutexattr_init, __pthread_mutexattr_init into libc

__pthread_mutexattr_init cannot be be made a compat symbol because
it is used in mtx_init, which is still in libpthread.

The symbols were moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_mutexattr_gettype into libc
Florian Weimer [Fri, 23 Apr 2021 07:46:15 +0000 (09:46 +0200)]
nptl: Move pthread_mutexattr_gettype into libc

And pthread_mutexattr_getkind_np as a compatibility symbol.
(There is no declaration in <pthread.h>, so there is no need
to add an alias or a deprecation warning there.)

The symbols were moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_mutexattr_getrobust into libc
Florian Weimer [Fri, 23 Apr 2021 07:46:03 +0000 (09:46 +0200)]
nptl: Move pthread_mutexattr_getrobust into libc

And pthread_mutexattr_getrobust_np as a compat symbol.

The symbols were moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_mutexattr_getpshared into libc
Florian Weimer [Fri, 23 Apr 2021 07:45:48 +0000 (09:45 +0200)]
nptl: Move pthread_mutexattr_getpshared into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_mutexattr_getprotocol into libc
Florian Weimer [Fri, 23 Apr 2021 07:45:29 +0000 (09:45 +0200)]
nptl: Move pthread_mutexattr_getprotocol into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_mutexattr_getprioceiling into libc
Florian Weimer [Fri, 23 Apr 2021 07:45:09 +0000 (09:45 +0200)]
nptl: Move pthread_mutexattr_getprioceiling into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_mutexattr_destroy into libc
Florian Weimer [Fri, 23 Apr 2021 07:44:49 +0000 (09:44 +0200)]
nptl: Move pthread_mutexattr_destroy into libc

And __pthread_mutexattr_destroy as a compat symbol (so no
GLIBC_2.34 symbol version is added for it).

The symbols were moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_mutex_trylock, __pthread_mutex_trylock into libc
Florian Weimer [Fri, 23 Apr 2021 07:44:23 +0000 (09:44 +0200)]
nptl: Move pthread_mutex_trylock, __pthread_mutex_trylock into libc

The symbols were moved using scripts/move-symbol-to-libc.py.

__pthread_mutex_trylock is used to implement mtx_timedlock,
which still resides in libpthread, so add a GLIBC_2.34 version
for it, to match the existing GLIBC_2.0 version.

3 years agonptl: Move pthread_mutex_timedlock, pthread_mutex_clocklock to libc
Florian Weimer [Fri, 23 Apr 2021 07:43:24 +0000 (09:43 +0200)]
nptl: Move pthread_mutex_timedlock, pthread_mutex_clocklock to libc

The symbols were moved using scripts/move-symbol-to-libc.py.
The symbol aliasing follows pthread_cond_timedwait et al.
Missing hidden prototypes had to be added to nptl/pthreadP.h
for consistency.

3 years agonptl: Move pthread_mutex_setprioceiling into libc
Florian Weimer [Fri, 23 Apr 2021 07:43:08 +0000 (09:43 +0200)]
nptl: Move pthread_mutex_setprioceiling into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_mutex_getprioceiling into libc
Florian Weimer [Fri, 23 Apr 2021 07:42:51 +0000 (09:42 +0200)]
nptl: Move pthread_mutex_getprioceiling into libc

The symbol was moved using scripts/move-symbol-to-libc.py.

3 years agopowerpc: Add optimized strlen for POWER10
Matheus Castanho [Tue, 29 Sep 2020 18:40:08 +0000 (15:40 -0300)]
powerpc: Add optimized strlen for POWER10

Improvements compared to POWER9 version:

1. Take into account first 16B comparison for aligned strings

   The previous version compares the first 16B and increments r4 by the number
   of bytes until the address is 16B-aligned, then starts doing aligned loads at
   that address. For aligned strings, this causes the first 16B to be compared
   twice, because the increment is 0. Here we calculate the next 16B-aligned
   address differently, which avoids that issue.

2. Use simple comparisons for the first ~192 bytes

   The main loop is good for big strings, but comparing 16B each time is better
   for smaller strings.  So after aligning the address to 16 Bytes, we check
   more 176B in 16B chunks.  There may be some overlaps with the main loop for
   unaligned strings, but we avoid using the more aggressive strategy too soon,
   and also allow the loop to start at a 64B-aligned address.  This greatly
   benefits smaller strings and avoids overlapping checks if the string is
   already aligned at a 64B boundary.

3. Reduce dependencies between load blocks caused by address calculation on loop

   Doing a precise time tracing on the code showed many loads in the loop were
   stalled waiting for updates to r4 from previous code blocks.  This
   implementation avoids that as much as possible by using 2 registers (r4 and
   r5) to hold addresses to be used by different parts of the code.

   Also, the previous code aligned the address to 16B, then to 64B by doing a
   few 48B loops (if needed) until the address was aligned. The main loop could
   not start until that 48B loop had finished and r4 was updated with the
   current address. Here we calculate the address used by the loop very early,
   so it can start sooner.

   The main loop now uses 2 pointers 128B apart to make pointer updates less
   frequent, and also unrolls 1 iteration to guarantee there is enough time
   between iterations to update the pointers, reducing stalled cycles.

4. Use new P10 instructions

   lxvp is used to load 32B with a single instruction, reducing contention in
   the load queue.

   vextractbm allows simplifying the tail code for the loop, replacing
   vbpermq and avoiding having to generate a permute control vector.

Reviewed-by: Paul E Murphy <murphyp@linux.ibm.com>
Reviewed-by: Raphael M Zinsly <rzinsly@linux.ibm.com>
Reviewed-by: Lucas A. M. Magalhaes <lamm@linux.ibm.com>
3 years agonptl: Do not build nptl/tst-pthread-gdb-attach as PIE
Florian Weimer [Thu, 22 Apr 2021 17:53:15 +0000 (19:53 +0200)]
nptl: Do not build nptl/tst-pthread-gdb-attach as PIE

3 years agonptl: Move pthread_kill_other_threads_np compatibility symbol into libc
Florian Weimer [Thu, 22 Apr 2021 17:50:16 +0000 (19:50 +0200)]
nptl: Move pthread_kill_other_threads_np compatibility symbol into libc

And stop including the function for new architectures.

3 years agox86: tst-cpu-features-supports.c: Update AMX check
H.J. Lu [Thu, 22 Apr 2021 01:40:08 +0000 (18:40 -0700)]
x86: tst-cpu-features-supports.c: Update AMX check

Pass "amx-bf16", "amx-int8" and "amx-tile", instead of "amx_bf16",
"amx_int8" and "amx_tile", to __builtin_cpu_supports for GCC 11.

3 years agonptl: Move pthread_atfork compatibility symbol to libc
Florian Weimer [Thu, 22 Apr 2021 14:02:59 +0000 (16:02 +0200)]
nptl: Move pthread_atfork compatibility symbol to libc

The symbol was moved using scripts/move-symbol-to-libc.py.

There is no new symbol version because of the compatibility symbol
status.  The __pthread_atfork reference in nptl/Versions was unused.

3 years agonptl: Check for compatible GDB in nptl/tst-pthread-gdb-attach
Florian Weimer [Thu, 22 Apr 2021 09:07:43 +0000 (11:07 +0200)]
nptl: Check for compatible GDB in nptl/tst-pthread-gdb-attach

Also do not clear the subprocess environment, in case running
GDB needs certain environment variables.

3 years agonptl: __nptl_set_robust_list_avail must be nocommon
Florian Weimer [Thu, 22 Apr 2021 07:56:37 +0000 (09:56 +0200)]
nptl: __nptl_set_robust_list_avail must be nocommon

This is required for GCC versions before 10 which default to -fcommon.

Fixes commit 442e8a40da9dfa24aeebf4f1a163f0a58b12cf7e ("nptl: Move part
of TCB initialization from libpthread to __tls_init_tp").

3 years agonptl: Remove remnants of the libc/libpthread forwarder interface
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
nptl: Remove remnants of the libc/libpthread forwarder interface

All previously forwarded functions are now implemented in libc.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move setxid broadcast implementation into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
nptl: Move setxid broadcast implementation into libc

The signal handler is exported as __nptl_setxid_sighandler, so
that the libpthread initialization code can install it.  This
is sufficient for now because it is guarantueed to happen before
the first pthread_create call.

3 years agonptl: Move core condition variable functions into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
nptl: Move core condition variable functions into libc

Onl pthread_cond_clockwait did not have a forwarder, so it needs
a new symbol version.

Some complications arise due to the need to supply hidden aliases,
GLIBC_PRIVATE exports (for the C11 condition variable implementation
that still remains in libpthread) and 64-bit time_t stubs.

pthread_cond_broadcast, pthread_cond_signal,  pthread_cond_timedwait,
pthread_cond_wait, pthread_cond_clockwait have been moved using
scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move core mutex functions into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
nptl: Move core mutex functions into libc

This is complicated because of a second compilation of
nptl/pthread_mutex_lock.c via nptl/pthread_mutex_cond_lock.c.
PTHREAD_MUTEX_VERSIONS is introduced to suppress symbol versions
in that case.

The symbols __pthread_mutex_lock, __pthread_mutex_unlock,
__pthread_mutex_init, __pthread_mutex_destroy, pthread_mutex_lock,
pthread_mutex_unlock, pthread_mutex_init, pthread_mutex_destroy
have been moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agox86: Remove low-level lock optimization
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
x86: Remove low-level lock optimization

The current approach is to do this optimizations at a higher level,
in generic code, so that single-threaded cases can be specifically
targeted.

Furthermore, using IS_IN (libc) as a compile-time indicator that
all locks are private is no longer correct once process-shared lock
implementations are moved into libc.

The generic <lowlevellock.h> is not compatible with assembler code
(obviously), so it's necessary to remove two long-unused #includes.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: pthread_mutex_lock, pthread_mutex_unock single-threaded optimization
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
nptl: pthread_mutex_lock, pthread_mutex_unock single-threaded optimization

This is optimization is similar in spirit to the SINGLE_THREAD_P check
in the malloc implementation.  Doing this in generic code allows us
to prioritize those cases which are likely to occur in single-threaded
programs (normal and recursive mutexes).

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move internal symbol __mutex_aconf into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
nptl: Move internal symbol __mutex_aconf into libc

This is in preparation of moving the mutex code into libc.

__pthread_tunables_init is now called via __pthread_early_init.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agopthread: Introduce __pthread_early_init
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
pthread: Introduce __pthread_early_init

This function is called from __libc_early_init to initialize the
pthread subsystem.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move the internal thread priority protection symbols into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
nptl: Move the internal thread priority protection symbols into libc

This is a prerequisite for moving the mutex implementation.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move rwlock functions with forwarders into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
nptl: Move rwlock functions with forwarders into libc

The forwarders were only used internally, so new symbol versions
are needed.  All symbols are moved at once because the forwarders
are no-ops if libpthread is not loaded, leading to inconsistencies
in case of a partial migration.

The symbols __pthread_rwlock_rdlock, __pthread_rwlock_unlock,
__pthread_rwlock_wrlock, pthread_rwlock_rdlock,
pthread_rwlock_unlock, pthread_rwlock_wrlock have been moved using
scripts/move-symbol-to-libc.py.

The __ symbol variants are turned into compat symbols, which is why they
do not receive a GLIBC_2.34 version.

3 years agonptl: Move pthread_key_delete into libc.
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
nptl: Move pthread_key_delete into libc.

The symbol was moved using scripts/move-symbol-to-libc.py.

tss_delete (still in libpthread) uses the __pthread_key_create
alias, so that is now exported under GLIBC_PRIVATE.

3 years agonptl: Move pthread_setspecific, __pthread_setspecific into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
nptl: Move pthread_setspecific, __pthread_setspecific into libc

The symbols have been moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_getspecific, __pthread_getspecific into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
nptl: Move pthread_getspecific, __pthread_getspecific into libc

The symbols have been moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move pthread_key_create, __pthread_key_create into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
nptl: Move pthread_key_create, __pthread_key_create into libc

The symbols have been moved using scripts/move-symbol-to-libc.py.

3 years agonptl: Move part of TCB initialization from libpthread to __tls_init_tp
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
nptl: Move part of TCB initialization from libpthread to __tls_init_tp

This initalization should only happen once for the main thread's TCB.
At present, auditors can achieve this by not linking against
libpthread.  If libpthread becomes part of libc, doing this
initialization in libc would happen for every audit namespace,
or too late (if it happens from the main libc only).  That's why
moving this code into ld.so seems the right thing to do, right after
the TCB initialization.

For !__ASSUME_SET_ROBUST_LIST ports, this also moves the symbol
__set_robust_list_avail into ld.so, as __nptl_set_robust_list_avail.
It also turned into a proper boolean flag.

Inline the __pthread_initialize_pids function because it seems no
longer useful as a separate function.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoelf: Introduce __tls_init_tp for second-phase TCB initialization
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
elf: Introduce __tls_init_tp for second-phase TCB initialization

TLS_INIT_TP is processor-specific, so it is not a good place to
put thread library initialization code (it would have to be repeated
for all CPUs).  Introduce __tls_init_tp as a separate function,
to be called immediately after TLS_INIT_TP.  Move the existing
stack list setup code for NPTL to this function.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agoRemove pthread_key_create-related internals from libc-lock.h
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
Remove pthread_key_create-related internals from libc-lock.h

And libc-lockP.h.  This is no longer used because all internal
TLS use goes directly to the thread descriptor/TCB or uses ELF TLS.

3 years agodlfcn: dlerror needs to call free from the base namespace [BZ #24773]
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
dlfcn: dlerror needs to call free from the base namespace [BZ #24773]

Calling free directly may end up freeing a pointer allocated by the
dynamic loader using malloc from libc.so in the base namespace using
the allocator from libc.so in a secondary namespace, which results in
crashes.

This commit redirects the free call through GLRO and the dynamic
linker, to reach the correct namespace.  It also cleans up the dlerror
handling along the way, so that pthread_setspecific is no longer
needed (which avoids triggering bug 24774).

3 years agodlfcn: Failures after dlmopen should not terminate process [BZ #24772]
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
dlfcn: Failures after dlmopen should not terminate process [BZ #24772]

Commit 9e78f6f6e7134a5f299cc8de77370218f8019237 ("Implement
_dl_catch_error, _dl_signal_error in libc.so [BZ #16628]") has the
side effect that distinct namespaces, as created by dlmopen, now have
separate implementations of the rtld exception mechanism.  This means
that the call to _dl_catch_error from libdl in a secondary namespace
does not actually install an exception handler because the
thread-local variable catch_hook in the libc.so copy in the secondary
namespace is distinct from that of the base namepace.  As a result, a
dlsym/dlopen/... failure in a secondary namespace terminates the process
with a dynamic linker error because it looks to the exception handler
mechanism as if no handler has been installed.

This commit restores GLRO (dl_catch_error) and uses it to set the
handler in the base namespace.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Invoke the set_robust_list system call directly in fork
Florian Weimer [Wed, 21 Apr 2021 17:49:51 +0000 (19:49 +0200)]
nptl: Invoke the set_robust_list system call directly in fork

This removes one of the pthread forwarder functions.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move pthread_setcanceltype into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
nptl: Move pthread_setcanceltype into libc

No new symbol version is required because there was a forwarder.

The symbol has been moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move pthread_setcancelstate into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
nptl: Move pthread_setcancelstate into libc

No new symbol version is required because there was a forwarder.

The symbol has been moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move pthread_exit into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
nptl: Move pthread_exit into libc

The pthread_exit symbol was moved using
scripts/move-symbol-to-libc.py.  No new symbol version is needed
because there was a forwarder.

The new tests nptl/tst-pthread_exit-nothreads and
nptl/tst-pthread_exit-nothreads-static exercise the scenario
that pthread_exit is called without libpthread having been linked in.
This is not possible for the generic code, so these tests do not
live in sysdeps/pthread for now.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move __nptl_deallocate_tsd into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
nptl: Move __nptl_deallocate_tsd into libc

This prepares moving pthread_exit, and later the pthread_key_create
infrastructure.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move __pthread_keys global variable into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
nptl: Move __pthread_keys global variable into libc

This prepares moving pthread_exit, and later the pthread_key_create
infrastructure.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl_db: Introduce DB_MAIN_ARRAY_VARIABLE
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
nptl_db: Introduce DB_MAIN_ARRAY_VARIABLE

And document the reason for DB_ARRAY_VARIABLE.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move internal __nptl_nthreads variable into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
nptl: Move internal __nptl_nthreads variable into libc

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agocsu: Move calling main out of __libc_start_main_impl
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
csu: Move calling main out of __libc_start_main_impl

This code depends on whether glibc has unwinding support for
a particular port.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move __pthread_unwind_next into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
nptl: Move __pthread_unwind_next into libc

It's necessary to stub out __libc_disable_asynccancel and
__libc_enable_asynccancel via rtld-stubbed-symbols because the new
direct references to the unwinder result in symbol conflicts when the
rtld exception handling from libc is linked in during the construction
of librtld.map.

unwind-forcedunwind.c is merged into unwind-resume.c.  libc now needs
the functions that were previously only used in libpthread.

The GLIBC_PRIVATE exports of __libc_longjmp and __libc_siglongjmp are
no longer needed, so switch them to hidden symbols.

The symbol __pthread_unwind_next has been moved using
scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerva Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move pthread_once and __pthread_once into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
nptl: Move pthread_once and __pthread_once into libc

And also the fork generation counter, __fork_generation.  This
eliminates the need for __fork_generation_pointer.

call_once remains in libpthread and calls the exported __pthread_once
symbol.

pthread_once and __pthread_once have been moved using
scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move __pthread_cleanup_upto into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
nptl: Move __pthread_cleanup_upto into libc

This internal symbol is used as part of the longjmp implementation.
Rename the file from nptl/pt-cleanup.c to nptl/pthread_cleanup_upto.c
so that the pt-* files remain restricted to libpthread.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agox86: Restore compile-time check for shadow stack pointer in longjmp
Adhemerval Zanella [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
x86: Restore compile-time check for shadow stack pointer in longjmp

3 years agonptl: Remove longjmp, siglongjmp from libpthread
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
nptl: Remove longjmp, siglongjmp from libpthread

The definitions in libc are sufficient, the forwarders are no longer
needed.

The symbols have been moved using scripts/move-symbol-to-libc.py.
s390-linux-gnu and s390x-linux-gnu need a new version placeholder
to keep the GLIBC_2.19 symbol version in libpthread.

Tested on i386-linux-gnu, powerpc64le-linux-gnu, s390x-linux-gnu,
x86_64-linux-gnu.  Built with build-many-glibcs.py.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move legacy cancelation handling into libc as compat symbols
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
nptl: Move legacy cancelation handling into libc as compat symbols

This affects _pthread_cleanup_pop, _pthread_cleanup_pop_restore,
_pthread_cleanup_push, _pthread_cleanup_push_defer.  The symbols
have been moved using scripts/move-symbol-to-libc.py.

No new symbol versions are added because the symbols are turned into
compatibility symbols at the same time.

__pthread_cleanup_pop and __pthread_cleanup_push are added as
GLIBC_PRIVATE symbols because they are also used internally, for
glibc's own cancellation handling.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move legacy unwinding implementation into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
nptl: Move legacy unwinding implementation into libc

It is still used internally.  Since unwinding is now available
unconditionally, avoid indirect calls through function pointers loaded
from the stack by inlining the non-cancellation cleanup code.  This
avoids a regression in security hardening.

The out-of-line  __libc_cleanup_routine implementation is no longer
needed because the inline definition is now static __always_inline.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
3 years agonptl: Move __pthread_cleanup_routine into libc
Florian Weimer [Wed, 21 Apr 2021 17:49:50 +0000 (19:49 +0200)]
nptl: Move __pthread_cleanup_routine into libc

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>