Commit Graph

542 Commits

Author SHA1 Message Date
Florian Weimer
8a229ee93c nptl: Move pthread_mutexattr_setpshared into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:51:57 +02:00
Florian Weimer
241ac38c33 nptl: Move pthread_mutexattr_setprotocol into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:51:57 +02:00
Florian Weimer
c66772281f nptl: Move pthread_mutexattr_setprioceiling into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:51:57 +02:00
Florian Weimer
506385d30e 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.
2021-04-23 09:51:56 +02:00
Florian Weimer
2a23e899e2 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.
2021-04-23 09:51:19 +02:00
Florian Weimer
9b7ab14e11 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.
2021-04-23 09:46:03 +02:00
Florian Weimer
2e825f7d5a nptl: Move pthread_mutexattr_getpshared into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:45:48 +02:00
Florian Weimer
9f2f158b35 nptl: Move pthread_mutexattr_getprotocol into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:45:29 +02:00
Florian Weimer
d236322b6f nptl: Move pthread_mutexattr_getprioceiling into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:45:09 +02:00
Florian Weimer
fd42022a10 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.
2021-04-23 09:44:49 +02:00
Florian Weimer
a2b0f2e186 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.
2021-04-23 09:44:23 +02:00
Florian Weimer
4372dc7eaa 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.
2021-04-23 09:43:24 +02:00
Florian Weimer
a2975191d0 nptl: Move pthread_mutex_setprioceiling into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:43:08 +02:00
Florian Weimer
4b85c6f55f nptl: Move pthread_mutex_getprioceiling into libc
The symbol was moved using scripts/move-symbol-to-libc.py.
2021-04-23 09:42:51 +02:00
Florian Weimer
6f3e54d404 nptl: Do not build nptl/tst-pthread-gdb-attach as PIE 2021-04-22 19:54:29 +02:00
Florian Weimer
e4f1c0de9c nptl: Move pthread_kill_other_threads_np compatibility symbol into libc
And stop including the function for new architectures.
2021-04-22 19:50:16 +02:00
Florian Weimer
33b20249b5 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.
2021-04-22 16:02:59 +02:00
Florian Weimer
1d67cf9e8a 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>
2021-04-21 19:49:51 +02:00
Florian Weimer
486010a3c8 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.
2021-04-21 19:49:51 +02:00
Florian Weimer
08129b155e 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>
2021-04-21 19:49:51 +02:00
Florian Weimer
27a448223c 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>
2021-04-21 19:49:51 +02:00
Florian Weimer
eda0c098ed 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>
2021-04-21 19:49:51 +02:00
Florian Weimer
798cacde76 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>
2021-04-21 19:49:51 +02:00
Florian Weimer
eb29dcde31 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.
2021-04-21 19:49:51 +02:00
Florian Weimer
9ce44f4675 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.
2021-04-21 19:49:51 +02:00
Florian Weimer
64a8990bdc nptl: Move pthread_setspecific, __pthread_setspecific into libc
The symbols have been moved using scripts/move-symbol-to-libc.py.
2021-04-21 19:49:51 +02:00
Florian Weimer
aae43acfd1 nptl: Move pthread_getspecific, __pthread_getspecific into libc
The symbols have been moved using scripts/move-symbol-to-libc.py.
2021-04-21 19:49:51 +02:00
Florian Weimer
6f009ea984 nptl: Move pthread_key_create, __pthread_key_create into libc
The symbols have been moved using scripts/move-symbol-to-libc.py.
2021-04-21 19:49:51 +02:00
Florian Weimer
75376a3fb8 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>
2021-04-21 19:49:50 +02:00
Florian Weimer
93d78ec1cb 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>
2021-04-21 19:49:50 +02:00
Florian Weimer
c62cef023c 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>
2021-04-21 19:49:50 +02:00
Florian Weimer
2cfef0b042 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>
2021-04-21 19:49:50 +02:00
Florian Weimer
a91bf4e0ff 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>
2021-04-21 19:49:50 +02:00
Florian Weimer
43fe356d18 nptl: Move internal __nptl_nthreads variable into libc
Reviewed-by: Adhemerval Zanella   <adhemerval.zanella@linaro.org>
2021-04-21 19:49:50 +02:00
Florian Weimer
1d95b035c7 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>
2021-04-21 19:49:50 +02:00
Florian Weimer
3fec7f18bf 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>
2021-04-21 19:49:50 +02:00
Florian Weimer
4647ce82c7 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>
2021-04-21 19:49:50 +02:00
Florian Weimer
81dfc6694c 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>
2021-04-21 19:49:50 +02:00
Florian Weimer
1f2e5bfe48 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>
2021-04-21 19:49:50 +02:00
Florian Weimer
5715c29e91 nptl: Move __pthread_cleanup_routine into libc
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-04-21 19:49:50 +02:00
Florian Weimer
f03b78fae4 nptl: Move pthread_mutex_consistent into libc
And deprecated pthread_mutex_consistent_np, its old name.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-04-21 19:49:50 +02:00
Florian Weimer
a64afc2252 nptl_db: Support different libpthread/ld.so load orders (bug 27744)
libthread_db is loaded once GDB encounters libpthread, and at this
point, ld.so may not have been processed by GDB yet. As a result,
_rtld_global cannot be accessed by regular means from libthread_db.
To make this work until GDB can be fixed, acess _rtld_global through
a pointer stored in libpthread.

The new test does not reproduce bug 27744 with
--disable-hardcoded-path-in-tests, but is still a valid smoke test.
With --enable-hardcoded-path-in-tests, it is necessary to avoid
add-symbol-file because this can tickle a GDB bug.

Fixes commit 1daccf403b ("nptl: Move
stack list variables into _rtld_global").

Tested-by: Emil Velikov <emil.velikov@collabora.com>
2021-04-21 11:50:43 +02:00
Adhemerval Zanella
7ab232e081 nptl: Remove unused rules
The wrapper are not exported by libpthread.
2021-03-26 13:37:18 -03:00
Adhemerval Zanella
09ce31eddf nptl: Remove __libc_allocate_rtsig, __libc_current_sigrtmax, and __libc_current_sigrtmin
The libc version is identical and built with same flags.

Checked on x86_64-linux-gnu.
2021-03-26 13:37:18 -03:00
Adhemerval Zanella
70a1e36cbe nptl: Move sigaction to libc
The libc version is identical and built with same flags.

Checked on x86_64-linux-gnu.
2021-03-26 13:37:18 -03:00
Adhemerval Zanella
ff1e342cd1 nptl: Remove pthread raise implementation
The Linux version already target the current thread by using tgkill
along with getpid and gettid.

For arm, libpthread does not do a intra PLT since it will call the
raise from libc.

Checked on x86_64-linux-gnu.
2021-03-26 13:37:18 -03:00
Adhemerval Zanella
b76658451c nptl: Move pthread_kill to libc
A new 2.34 version is also provided.

Checked on x86_64-linux-gnu.
2021-03-26 13:37:18 -03:00
Adhemerval Zanella
dd10230fd8 nptl: Remove sigsuspend from pthread-compat-wrappers
The symbol is not exported by libpthread.
2021-03-26 13:37:18 -03:00
Adhemerval Zanella
ea8966b965 nptl: Remove msgrcv from pthread-compat-wrappers
The symbol is not exported by libpthread.
2021-03-26 13:37:18 -03:00
Adhemerval Zanella
8562794d11 nptl: Remove msgsnd from pthread-compat-wrappers
The symbol is not exported by libpthread.
2021-03-26 13:37:18 -03:00