From 310e59e64cbc95bff299825b2b7f38b88f82ba4e Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 17 May 2021 09:59:14 +0200 Subject: nptl: Move pthread_getcpuclockid into libc The symbol was moved using scripts/move-symbol-to-libc.py. __libpthread_version_placeholder@@GLIBC_2.2 is needed by this change; the Versions entry for GLIBC_2.2 in libpthread had leftover symbols due to an error in a previous conflict resolution. The condition for the placeholder symbol is complicated because some architectures have earlier symbols at the GLIBC_2.2 symbol versions, so the placeholder is not required there (yet). Reviewed-by: Adhemerval Zanella --- nptl/Makefile | 2 +- nptl/Versions | 7 +++---- nptl/libpthread-compat.c | 10 ++++++++++ nptl/pthread_getcpuclockid.c | 11 +++++++++-- 4 files changed, 23 insertions(+), 7 deletions(-) (limited to 'nptl') diff --git a/nptl/Makefile b/nptl/Makefile index a7c1932332..9c810b2b6c 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -116,6 +116,7 @@ routines = \ pthread_getattr_default_np \ pthread_getattr_np \ pthread_getconcurrency \ + pthread_getcpuclockid \ pthread_getschedparam \ pthread_getspecific \ pthread_join \ @@ -206,7 +207,6 @@ libpthread-routines = \ nptl-init \ pt-interp \ pthread_create \ - pthread_getcpuclockid \ pthread_getname \ pthread_setaffinity \ pthread_setname \ diff --git a/nptl/Versions b/nptl/Versions index c76efffe37..9afbb028f2 100644 --- a/nptl/Versions +++ b/nptl/Versions @@ -127,6 +127,7 @@ libc { pthread_barrierattr_setpshared; pthread_condattr_getpshared; pthread_condattr_setpshared; + pthread_getcpuclockid; pthread_mutex_timedlock; pthread_mutexattr_getpshared; pthread_mutexattr_setpshared; @@ -285,6 +286,7 @@ libc { pthread_detach; pthread_getattr_default_np; pthread_getconcurrency; + pthread_getcpuclockid; pthread_getspecific; pthread_join; pthread_key_create; @@ -434,10 +436,7 @@ libpthread { } GLIBC_2.2 { - pthread_getcpuclockid; - pthread_yield; - pthread_rwlock_timedrdlock; - pthread_rwlock_timedwrlock; + __libpthread_version_placeholder; } GLIBC_2.2.3 { diff --git a/nptl/libpthread-compat.c b/nptl/libpthread-compat.c index c828fd8f9e..18069870d1 100644 --- a/nptl/libpthread-compat.c +++ b/nptl/libpthread-compat.c @@ -45,6 +45,16 @@ compat_symbol (libpthread, __libpthread_version_placeholder_1, __libpthread_version_placeholder, GLIBC_2_1_2); #endif +/* Do not create the placeholder symbol version if there are other + symbols left that keep the version around (because GLIBC_2.0 got + promoted to GLIBC_2.2). */ +#if SHLIB_COMPAT (libpthread, GLIBC_2_2, GLIBC_2_2_3) \ + && ABI_libpthread_GLIBC_2_2 != ABI_libpthread_GLIBC_2_0 \ + && ABI_libpthread_GLIBC_2_2 != ABI_libpthread_GLIBC_2_1_3 +compat_symbol (libpthread, __libpthread_version_placeholder_1, + __libpthread_version_placeholder, GLIBC_2_2); +#endif + #if (SHLIB_COMPAT (libpthread, GLIBC_2_2_3, GLIBC_2_2_4)) compat_symbol (libpthread, __libpthread_version_placeholder_1, __libpthread_version_placeholder, GLIBC_2_2_3); diff --git a/nptl/pthread_getcpuclockid.c b/nptl/pthread_getcpuclockid.c index ae7122cb5f..0a6656ea4c 100644 --- a/nptl/pthread_getcpuclockid.c +++ b/nptl/pthread_getcpuclockid.c @@ -21,10 +21,10 @@ #include #include #include - +#include int -pthread_getcpuclockid (pthread_t threadid, clockid_t *clockid) +__pthread_getcpuclockid (pthread_t threadid, clockid_t *clockid) { struct pthread *pd = (struct pthread *) threadid; @@ -40,3 +40,10 @@ pthread_getcpuclockid (pthread_t threadid, clockid_t *clockid) *clockid = tidclock; return 0; } +versioned_symbol (libc, __pthread_getcpuclockid, pthread_getcpuclockid, + GLIBC_2_34); + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_2, GLIBC_2_34) +compat_symbol (libpthread, __pthread_getcpuclockid, pthread_getcpuclockid, + GLIBC_2_2); +#endif -- cgit v1.2.3-70-g09d2