[PATCH] htl: move c11 symbols into libc.
gfleury
gfleury@disroot.org
Fri Nov 21 09:10:02 GMT 2025
thrd_{create,detach,exit,join}.
mtx_{init,destroy,lock,trylock,unlock,timeelock}.
cnd_{broadcast,destroy,init,signal,timewait,wait,destroy}
tss_{create,delete,get,set}.
call_once.
For *mtx_timedlock* and *cnd_timedwait*, I kept the default implementation
because we don't seem to have TIMESIZE 64 check like in nptl
---
htl/Versions | 35 ++++++++++++++---
sysdeps/mach/hurd/i386/libc.abilist | 42 +++++++++++++++++++++
sysdeps/mach/hurd/i386/libpthread.abilist | 21 -----------
sysdeps/mach/hurd/x86_64/libc.abilist | 42 +++++++++++++++++++++
sysdeps/mach/hurd/x86_64/libpthread.abilist | 21 -----------
sysdeps/pthread/Makefile | 17 ++++-----
sysdeps/pthread/call_once.c | 9 +++--
sysdeps/pthread/cnd_broadcast.c | 9 +++--
sysdeps/pthread/cnd_destroy.c | 9 +++--
sysdeps/pthread/cnd_init.c | 9 +++--
sysdeps/pthread/cnd_signal.c | 9 +++--
sysdeps/pthread/cnd_timedwait.c | 12 +++++-
sysdeps/pthread/cnd_wait.c | 9 +++--
sysdeps/pthread/mtx_destroy.c | 9 +++--
sysdeps/pthread/mtx_init.c | 9 +++--
sysdeps/pthread/mtx_lock.c | 7 +++-
sysdeps/pthread/mtx_timedlock.c | 12 +++++-
sysdeps/pthread/mtx_trylock.c | 9 +++--
sysdeps/pthread/mtx_unlock.c | 9 +++--
sysdeps/pthread/thrd_create.c | 9 +++--
sysdeps/pthread/thrd_detach.c | 9 +++--
sysdeps/pthread/thrd_exit.c | 9 +++--
sysdeps/pthread/thrd_join.c | 9 +++--
sysdeps/pthread/tss_create.c | 9 +++--
sysdeps/pthread/tss_delete.c | 9 +++--
sysdeps/pthread/tss_get.c | 9 +++--
sysdeps/pthread/tss_set.c | 9 +++--
27 files changed, 255 insertions(+), 116 deletions(-)
diff --git a/htl/Versions b/htl/Versions
index 2228f8fd..cac34e62 100644
--- a/htl/Versions
+++ b/htl/Versions
@@ -149,6 +149,13 @@ libc {
# C11 thread symbols.
GLIBC_2.32 {
thrd_current; thrd_equal; thrd_sleep; thrd_yield;
+ thrd_create; thrd_detach; thrd_exit; thrd_join;
+
+ mtx_destroy; mtx_init; mtx_lock; mtx_timedlock; mtx_trylock; mtx_unlock;
+ cnd_broadcast; cnd_destroy; cnd_init; cnd_signal; cnd_timedwait; cnd_wait;
+ tss_create; tss_delete; tss_get; tss_set;
+
+ call_once;
pthread_cond_clockwait;
pthread_clockjoin_np;
@@ -232,6 +239,19 @@ libc {
}
GLIBC_2.43 {
+ call_once;
+ cnd_broadcast;
+ cnd_destroy;
+ cnd_init;
+ cnd_signal;
+ cnd_timedwait;
+ cnd_wait;
+ mtx_destroy;
+ mtx_init;
+ mtx_lock;
+ mtx_timedlock;
+ mtx_trylock;
+ mtx_unlock;
pthread_cancel;
pthread_clockjoin_np;
pthread_create;
@@ -268,6 +288,14 @@ libc {
sem_trywait;
sem_unlink;
sem_wait;
+ thrd_create;
+ thrd_detach;
+ thrd_exit;
+ thrd_join;
+ tss_create;
+ tss_delete;
+ tss_get;
+ tss_set;
}
GLIBC_PRIVATE {
@@ -351,12 +379,7 @@ libpthread {
}
GLIBC_2.32 {
- # C11 thread symbols.
- thrd_create; thrd_detach; thrd_exit; thrd_join;
- mtx_init; mtx_lock; mtx_timedlock; mtx_trylock; mtx_unlock; mtx_destroy;
- call_once;
- cnd_broadcast; cnd_destroy; cnd_init; cnd_signal; cnd_timedwait; cnd_wait;
- tss_create; tss_delete; tss_get; tss_set;
+ __libpthread_version_placeholder;
}
GLIBC_2.40 {
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index dbbb399f..08dcd85c 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -2334,8 +2334,21 @@ GLIBC_2.3.4 xdr_quad_t F
GLIBC_2.3.4 xdr_u_quad_t F
GLIBC_2.30 twalk_r F
GLIBC_2.32 __libc_single_threaded D 0x1
+GLIBC_2.32 call_once F
+GLIBC_2.32 cnd_broadcast F
+GLIBC_2.32 cnd_destroy F
+GLIBC_2.32 cnd_init F
+GLIBC_2.32 cnd_signal F
+GLIBC_2.32 cnd_timedwait F
+GLIBC_2.32 cnd_wait F
GLIBC_2.32 mach_print F
GLIBC_2.32 mremap F
+GLIBC_2.32 mtx_destroy F
+GLIBC_2.32 mtx_init F
+GLIBC_2.32 mtx_lock F
+GLIBC_2.32 mtx_timedlock F
+GLIBC_2.32 mtx_trylock F
+GLIBC_2.32 mtx_unlock F
GLIBC_2.32 pthread_clockjoin_np F
GLIBC_2.32 pthread_cond_clockwait F
GLIBC_2.32 pthread_mutex_clocklock F
@@ -2354,10 +2367,18 @@ GLIBC_2.32 sigabbrev_np F
GLIBC_2.32 sigdescr_np F
GLIBC_2.32 strerrordesc_np F
GLIBC_2.32 strerrorname_np F
+GLIBC_2.32 thrd_create F
GLIBC_2.32 thrd_current F
+GLIBC_2.32 thrd_detach F
GLIBC_2.32 thrd_equal F
+GLIBC_2.32 thrd_exit F
+GLIBC_2.32 thrd_join F
GLIBC_2.32 thrd_sleep F
GLIBC_2.32 thrd_yield F
+GLIBC_2.32 tss_create F
+GLIBC_2.32 tss_delete F
+GLIBC_2.32 tss_get F
+GLIBC_2.32 tss_set F
GLIBC_2.33 __x86_get_cpuid_feature_leaf F
GLIBC_2.33 fstat F
GLIBC_2.33 fstat64 F
@@ -2677,10 +2698,23 @@ GLIBC_2.42 uimaxabs F
GLIBC_2.42 ulabs F
GLIBC_2.42 ullabs F
GLIBC_2.43 __memset_explicit_chk F
+GLIBC_2.43 call_once F
+GLIBC_2.43 cnd_broadcast F
+GLIBC_2.43 cnd_destroy F
+GLIBC_2.43 cnd_init F
+GLIBC_2.43 cnd_signal F
+GLIBC_2.43 cnd_timedwait F
+GLIBC_2.43 cnd_wait F
GLIBC_2.43 free_aligned_sized F
GLIBC_2.43 free_sized F
GLIBC_2.43 memalignment F
GLIBC_2.43 memset_explicit F
+GLIBC_2.43 mtx_destroy F
+GLIBC_2.43 mtx_init F
+GLIBC_2.43 mtx_lock F
+GLIBC_2.43 mtx_timedlock F
+GLIBC_2.43 mtx_trylock F
+GLIBC_2.43 mtx_unlock F
GLIBC_2.43 pthread_cancel F
GLIBC_2.43 pthread_clockjoin_np F
GLIBC_2.43 pthread_create F
@@ -2717,6 +2751,14 @@ GLIBC_2.43 sem_timedwait F
GLIBC_2.43 sem_trywait F
GLIBC_2.43 sem_unlink F
GLIBC_2.43 sem_wait F
+GLIBC_2.43 thrd_create F
+GLIBC_2.43 thrd_detach F
+GLIBC_2.43 thrd_exit F
+GLIBC_2.43 thrd_join F
+GLIBC_2.43 tss_create F
+GLIBC_2.43 tss_delete F
+GLIBC_2.43 tss_get F
+GLIBC_2.43 tss_set F
GLIBC_2.43 umaxabs F
GLIBC_2.5 __readlinkat_chk F
GLIBC_2.5 inet6_opt_append F
diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
index ff9c2732..e69de29b 100644
--- a/sysdeps/mach/hurd/i386/libpthread.abilist
+++ b/sysdeps/mach/hurd/i386/libpthread.abilist
@@ -1,21 +0,0 @@
-GLIBC_2.32 call_once F
-GLIBC_2.32 cnd_broadcast F
-GLIBC_2.32 cnd_destroy F
-GLIBC_2.32 cnd_init F
-GLIBC_2.32 cnd_signal F
-GLIBC_2.32 cnd_timedwait F
-GLIBC_2.32 cnd_wait F
-GLIBC_2.32 mtx_destroy F
-GLIBC_2.32 mtx_init F
-GLIBC_2.32 mtx_lock F
-GLIBC_2.32 mtx_timedlock F
-GLIBC_2.32 mtx_trylock F
-GLIBC_2.32 mtx_unlock F
-GLIBC_2.32 thrd_create F
-GLIBC_2.32 thrd_detach F
-GLIBC_2.32 thrd_exit F
-GLIBC_2.32 thrd_join F
-GLIBC_2.32 tss_create F
-GLIBC_2.32 tss_delete F
-GLIBC_2.32 tss_get F
-GLIBC_2.32 tss_set F
diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist
index 7f0e601b..c17d5399 100644
--- a/sysdeps/mach/hurd/x86_64/libc.abilist
+++ b/sysdeps/mach/hurd/x86_64/libc.abilist
@@ -688,6 +688,7 @@ GLIBC_2.38 bzero F
GLIBC_2.38 c16rtomb F
GLIBC_2.38 c32rtomb F
GLIBC_2.38 c8rtomb F
+GLIBC_2.38 call_once F
GLIBC_2.38 calloc F
GLIBC_2.38 canonicalize_file_name F
GLIBC_2.38 catclose F
@@ -718,6 +719,12 @@ GLIBC_2.38 close_range F
GLIBC_2.38 closedir F
GLIBC_2.38 closefrom F
GLIBC_2.38 closelog F
+GLIBC_2.38 cnd_broadcast F
+GLIBC_2.38 cnd_destroy F
+GLIBC_2.38 cnd_init F
+GLIBC_2.38 cnd_signal F
+GLIBC_2.38 cnd_timedwait F
+GLIBC_2.38 cnd_wait F
GLIBC_2.38 confstr F
GLIBC_2.38 connect F
GLIBC_2.38 copy_file_range F
@@ -1413,6 +1420,12 @@ GLIBC_2.38 msgrcv F
GLIBC_2.38 msgsnd F
GLIBC_2.38 msync F
GLIBC_2.38 mtrace F
+GLIBC_2.38 mtx_destroy F
+GLIBC_2.38 mtx_init F
+GLIBC_2.38 mtx_lock F
+GLIBC_2.38 mtx_timedlock F
+GLIBC_2.38 mtx_trylock F
+GLIBC_2.38 mtx_unlock F
GLIBC_2.38 munlock F
GLIBC_2.38 munlockall F
GLIBC_2.38 munmap F
@@ -2033,8 +2046,12 @@ GLIBC_2.38 telldir F
GLIBC_2.38 tempnam F
GLIBC_2.38 textdomain F
GLIBC_2.38 tfind F
+GLIBC_2.38 thrd_create F
GLIBC_2.38 thrd_current F
+GLIBC_2.38 thrd_detach F
GLIBC_2.38 thrd_equal F
+GLIBC_2.38 thrd_exit F
+GLIBC_2.38 thrd_join F
GLIBC_2.38 thrd_sleep F
GLIBC_2.38 thrd_yield F
GLIBC_2.38 thread_depress_abort F
@@ -2064,6 +2081,10 @@ GLIBC_2.38 towupper_l F
GLIBC_2.38 truncate F
GLIBC_2.38 truncate64 F
GLIBC_2.38 tsearch F
+GLIBC_2.38 tss_create F
+GLIBC_2.38 tss_delete F
+GLIBC_2.38 tss_get F
+GLIBC_2.38 tss_set F
GLIBC_2.38 ttyname F
GLIBC_2.38 ttyname_r F
GLIBC_2.38 ttyslot F
@@ -2354,10 +2375,23 @@ GLIBC_2.42 uimaxabs F
GLIBC_2.42 ulabs F
GLIBC_2.42 ullabs F
GLIBC_2.43 __memset_explicit_chk F
+GLIBC_2.43 call_once F
+GLIBC_2.43 cnd_broadcast F
+GLIBC_2.43 cnd_destroy F
+GLIBC_2.43 cnd_init F
+GLIBC_2.43 cnd_signal F
+GLIBC_2.43 cnd_timedwait F
+GLIBC_2.43 cnd_wait F
GLIBC_2.43 free_aligned_sized F
GLIBC_2.43 free_sized F
GLIBC_2.43 memalignment F
GLIBC_2.43 memset_explicit F
+GLIBC_2.43 mtx_destroy F
+GLIBC_2.43 mtx_init F
+GLIBC_2.43 mtx_lock F
+GLIBC_2.43 mtx_timedlock F
+GLIBC_2.43 mtx_trylock F
+GLIBC_2.43 mtx_unlock F
GLIBC_2.43 pthread_cancel F
GLIBC_2.43 pthread_clockjoin_np F
GLIBC_2.43 pthread_create F
@@ -2394,6 +2428,14 @@ GLIBC_2.43 sem_timedwait F
GLIBC_2.43 sem_trywait F
GLIBC_2.43 sem_unlink F
GLIBC_2.43 sem_wait F
+GLIBC_2.43 thrd_create F
+GLIBC_2.43 thrd_detach F
+GLIBC_2.43 thrd_exit F
+GLIBC_2.43 thrd_join F
+GLIBC_2.43 tss_create F
+GLIBC_2.43 tss_delete F
+GLIBC_2.43 tss_get F
+GLIBC_2.43 tss_set F
GLIBC_2.43 umaxabs F
HURD_CTHREADS_0.3 __mutex_init F
HURD_CTHREADS_0.3 __mutex_lock F
diff --git a/sysdeps/mach/hurd/x86_64/libpthread.abilist b/sysdeps/mach/hurd/x86_64/libpthread.abilist
index b4f2a962..e69de29b 100644
--- a/sysdeps/mach/hurd/x86_64/libpthread.abilist
+++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist
@@ -1,21 +0,0 @@
-GLIBC_2.38 call_once F
-GLIBC_2.38 cnd_broadcast F
-GLIBC_2.38 cnd_destroy F
-GLIBC_2.38 cnd_init F
-GLIBC_2.38 cnd_signal F
-GLIBC_2.38 cnd_timedwait F
-GLIBC_2.38 cnd_wait F
-GLIBC_2.38 mtx_destroy F
-GLIBC_2.38 mtx_init F
-GLIBC_2.38 mtx_lock F
-GLIBC_2.38 mtx_timedlock F
-GLIBC_2.38 mtx_trylock F
-GLIBC_2.38 mtx_unlock F
-GLIBC_2.38 thrd_create F
-GLIBC_2.38 thrd_detach F
-GLIBC_2.38 thrd_exit F
-GLIBC_2.38 thrd_join F
-GLIBC_2.38 tss_create F
-GLIBC_2.38 tss_delete F
-GLIBC_2.38 tss_get F
-GLIBC_2.38 tss_set F
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index 1da3a9f5..c6ea59ee 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -26,15 +26,6 @@ headers += \
# headers
routines += \
- pthread_atfork \
- pthread_atfork_compat \
- thrd_current \
- thrd_equal \
- thrd_sleep \
- thrd_yield \
- # routines
-
-$(libpthread-routines-var) += \
call_once \
cnd_broadcast \
cnd_destroy \
@@ -48,15 +39,21 @@ $(libpthread-routines-var) += \
mtx_timedlock \
mtx_trylock \
mtx_unlock \
+ pthread_atfork \
+ pthread_atfork_compat \
thrd_create \
+ thrd_current \
thrd_detach \
+ thrd_equal \
thrd_exit \
thrd_join \
+ thrd_sleep \
+ thrd_yield \
tss_create \
tss_delete \
tss_get \
tss_set \
- # $(libpthread-routines-var)
+ # routines
tests += \
tst-abstime \
diff --git a/sysdeps/pthread/call_once.c b/sysdeps/pthread/call_once.c
index 9c0eb397..2b34bef8 100644
--- a/sysdeps/pthread/call_once.c
+++ b/sysdeps/pthread/call_once.c
@@ -30,11 +30,14 @@ __call_once (once_flag *flag, void (*func)(void))
"alignof (once_flag) != alignof (pthread_once_t)");
__pthread_once ((pthread_once_t *) flag, func);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __call_once, call_once, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __call_once, call_once, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__call_once, call_once)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __call_once, call_once, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __call_once, call_once, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/cnd_broadcast.c b/sysdeps/pthread/cnd_broadcast.c
index 4bef01a3..0d68bdea 100644
--- a/sysdeps/pthread/cnd_broadcast.c
+++ b/sysdeps/pthread/cnd_broadcast.c
@@ -25,11 +25,14 @@ __cnd_broadcast (cnd_t *cond)
int err_code = __pthread_cond_broadcast ((pthread_cond_t*) cond);
return thrd_err_map (err_code);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __cnd_broadcast, cnd_broadcast, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __cnd_broadcast, cnd_broadcast, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__cnd_broadcast, cnd_broadcast)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __cnd_broadcast, cnd_broadcast, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __cnd_broadcast, cnd_broadcast, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/cnd_destroy.c b/sysdeps/pthread/cnd_destroy.c
index ed5e4332..240892f3 100644
--- a/sysdeps/pthread/cnd_destroy.c
+++ b/sysdeps/pthread/cnd_destroy.c
@@ -25,11 +25,14 @@ __cnd_destroy (cnd_t *cond)
{
__pthread_cond_destroy ((pthread_cond_t *) cond);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __cnd_destroy, cnd_destroy, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __cnd_destroy, cnd_destroy, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__cnd_destroy, cnd_destroy)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __cnd_destroy, cnd_destroy, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __cnd_destroy, cnd_destroy, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/cnd_init.c b/sysdeps/pthread/cnd_init.c
index fce84dee..bd88122b 100644
--- a/sysdeps/pthread/cnd_init.c
+++ b/sysdeps/pthread/cnd_init.c
@@ -32,11 +32,14 @@ __cnd_init (cnd_t *cond)
int err_code = __pthread_cond_init ((pthread_cond_t *)cond, NULL);
return thrd_err_map (err_code);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __cnd_init, cnd_init, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __cnd_init, cnd_init, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__cnd_init, cnd_init)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __cnd_init, cnd_init, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __cnd_init, cnd_init, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/cnd_signal.c b/sysdeps/pthread/cnd_signal.c
index 2737ae14..37fbe219 100644
--- a/sysdeps/pthread/cnd_signal.c
+++ b/sysdeps/pthread/cnd_signal.c
@@ -25,11 +25,14 @@ __cnd_signal (cnd_t *cond)
int err_code = __pthread_cond_signal ((pthread_cond_t *) cond);
return thrd_err_map (err_code);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __cnd_signal, cnd_signal, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __cnd_signal, cnd_signal, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__cnd_signal, cnd_signal)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __cnd_signal, cnd_signal, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __cnd_signal, cnd_signal, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/cnd_timedwait.c b/sysdeps/pthread/cnd_timedwait.c
index f0529d8f..802a85b9 100644
--- a/sysdeps/pthread/cnd_timedwait.c
+++ b/sysdeps/pthread/cnd_timedwait.c
@@ -16,10 +16,11 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+#include <shlib-compat.h>
#include "thrd_priv.h"
int
-cnd_timedwait (cnd_t *restrict cond, mtx_t *restrict mutex,
+__cnd_timedwait (cnd_t *restrict cond, mtx_t *restrict mutex,
const struct timespec* restrict time_point)
{
int err_code = __pthread_cond_timedwait ((pthread_cond_t *) cond,
@@ -27,3 +28,12 @@ cnd_timedwait (cnd_t *restrict cond, mtx_t *restrict mutex,
time_point);
return thrd_err_map (err_code);
}
+
+#ifdef __PTHREAD_HTL
+versioned_symbol (libc, __cnd_timedwait, cnd_timedwait, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __cnd_timedwait, cnd_timedwait, GLIBC_2_32);
+#endif
+#else
+strong_alias (__cnd_timedwait, cnd_timedwait)
+#endif
diff --git a/sysdeps/pthread/cnd_wait.c b/sysdeps/pthread/cnd_wait.c
index 706466e0..03ada60e 100644
--- a/sysdeps/pthread/cnd_wait.c
+++ b/sysdeps/pthread/cnd_wait.c
@@ -26,11 +26,14 @@ __cnd_wait (cnd_t *cond, mtx_t *mutex)
(pthread_mutex_t *) mutex);
return thrd_err_map (err_code);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __cnd_wait, cnd_wait, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __cnd_wait, cnd_wait, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__cnd_wait, cnd_wait)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __cnd_wait, cnd_wait, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __cnd_wait, cnd_wait, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/mtx_destroy.c b/sysdeps/pthread/mtx_destroy.c
index f4686663..1dffb412 100644
--- a/sysdeps/pthread/mtx_destroy.c
+++ b/sysdeps/pthread/mtx_destroy.c
@@ -25,11 +25,14 @@ __mtx_destroy (mtx_t *mutex)
{
__pthread_mutex_destroy ((pthread_mutex_t *) mutex);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __mtx_destroy, mtx_destroy, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __mtx_destroy, mtx_destroy, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__mtx_destroy, mtx_destroy)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __mtx_destroy, mtx_destroy, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __mtx_destroy, mtx_destroy, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/mtx_init.c b/sysdeps/pthread/mtx_init.c
index a807eca4..80fd630f 100644
--- a/sysdeps/pthread/mtx_init.c
+++ b/sysdeps/pthread/mtx_init.c
@@ -52,11 +52,14 @@ __mtx_init (mtx_t *mutex, int type)
/* pthread_mutexattr_destroy implementation is a noop. */
return thrd_err_map (err_code);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __mtx_init, mtx_init, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __mtx_init, mtx_init, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__mtx_init, mtx_init)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __mtx_init, mtx_init, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __mtx_init, mtx_init, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/mtx_lock.c b/sysdeps/pthread/mtx_lock.c
index 7318d424..53b0b4cd 100644
--- a/sysdeps/pthread/mtx_lock.c
+++ b/sysdeps/pthread/mtx_lock.c
@@ -30,6 +30,9 @@ versioned_symbol (libc, __mtx_lock, mtx_lock, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __mtx_lock, mtx_lock, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__mtx_lock, mtx_lock)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __mtx_lock, mtx_lock, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __mtx_lock, mtx_lock, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/mtx_timedlock.c b/sysdeps/pthread/mtx_timedlock.c
index 8e7e0af7..fb64158f 100644
--- a/sysdeps/pthread/mtx_timedlock.c
+++ b/sysdeps/pthread/mtx_timedlock.c
@@ -16,13 +16,23 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+#include <shlib-compat.h>
#include "thrd_priv.h"
int
-mtx_timedlock (mtx_t *restrict mutex,
+__mtx_timedlock (mtx_t *restrict mutex,
const struct timespec *restrict time_point)
{
int err_code = __pthread_mutex_timedlock ((pthread_mutex_t *)mutex,
time_point);
return thrd_err_map (err_code);
}
+
+#ifdef __PTHREAD_HTL
+versioned_symbol (libc, __mtx_timedlock, mtx_timedlock, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __mtx_timedlock, mtx_timedlock, GLIBC_2_32);
+#endif
+#else
+strong_alias (__mtx_timedlock, mtx_timedlock)
+#endif
diff --git a/sysdeps/pthread/mtx_trylock.c b/sysdeps/pthread/mtx_trylock.c
index 57b3e6d2..6e73d302 100644
--- a/sysdeps/pthread/mtx_trylock.c
+++ b/sysdeps/pthread/mtx_trylock.c
@@ -25,11 +25,14 @@ __mtx_trylock (mtx_t *mutex)
int err_code = __pthread_mutex_trylock ((pthread_mutex_t *) mutex);
return thrd_err_map (err_code);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __mtx_trylock, mtx_trylock, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __mtx_trylock, mtx_trylock, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__mtx_trylock, mtx_trylock)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __mtx_trylock, mtx_trylock, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __mtx_trylock, mtx_trylock, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/mtx_unlock.c b/sysdeps/pthread/mtx_unlock.c
index 978a9ee1..78b5039d 100644
--- a/sysdeps/pthread/mtx_unlock.c
+++ b/sysdeps/pthread/mtx_unlock.c
@@ -25,11 +25,14 @@ __mtx_unlock (mtx_t *mutex)
int err_code = __pthread_mutex_unlock ((pthread_mutex_t *) mutex);
return thrd_err_map (err_code);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __mtx_unlock, mtx_unlock, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __mtx_unlock, mtx_unlock, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__mtx_unlock, mtx_unlock)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __mtx_unlock, mtx_unlock, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __mtx_unlock, mtx_unlock, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/thrd_create.c b/sysdeps/pthread/thrd_create.c
index 788eb62a..49e3fa47 100644
--- a/sysdeps/pthread/thrd_create.c
+++ b/sysdeps/pthread/thrd_create.c
@@ -29,11 +29,14 @@ __thrd_create (thrd_t *thr, thrd_start_t func, void *arg)
(void* (*) (void*))func, arg);
return thrd_err_map (err_code);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __thrd_create, thrd_create, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libc, __thrd_create, thrd_create, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__thrd_create, thrd_create)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __thrd_create, thrd_create, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __thrd_create, thrd_create, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/thrd_detach.c b/sysdeps/pthread/thrd_detach.c
index d1a05982..a3a3926c 100644
--- a/sysdeps/pthread/thrd_detach.c
+++ b/sysdeps/pthread/thrd_detach.c
@@ -27,11 +27,14 @@ __thrd_detach (thrd_t thr)
err_code = __pthread_detach (thr);
return thrd_err_map (err_code);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __thrd_detach, thrd_detach, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libc, __thrd_detach, thrd_detach, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__thrd_detach, thrd_detach)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __thrd_detach, thrd_detach, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __thrd_detach, thrd_detach, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/thrd_exit.c b/sysdeps/pthread/thrd_exit.c
index 9207ac2c..09d8d964 100644
--- a/sysdeps/pthread/thrd_exit.c
+++ b/sysdeps/pthread/thrd_exit.c
@@ -24,11 +24,14 @@ __thrd_exit (int res)
{
__pthread_exit ((void*)(uintptr_t) res);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __thrd_exit, thrd_exit, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __thrd_exit, thrd_exit, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__thrd_exit, thrd_exit)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __thrd_exit, thrd_exit, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __thrd_exit, thrd_exit, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/thrd_join.c b/sysdeps/pthread/thrd_join.c
index ca9cf3b5..0f401c42 100644
--- a/sysdeps/pthread/thrd_join.c
+++ b/sysdeps/pthread/thrd_join.c
@@ -29,11 +29,14 @@ __thrd_join (thrd_t thr, int *res)
return thrd_err_map (err_code);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __thrd_join, thrd_join, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libc, __thrd_join, thrd_join, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__thrd_join, thrd_join)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __thrd_join, thrd_join, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __thrd_join, thrd_join, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/tss_create.c b/sysdeps/pthread/tss_create.c
index b99e80d8..5dd23c99 100644
--- a/sysdeps/pthread/tss_create.c
+++ b/sysdeps/pthread/tss_create.c
@@ -32,11 +32,14 @@ __tss_create (tss_t *tss_id, tss_dtor_t destructor)
int err_code = __pthread_key_create (tss_id, destructor);
return thrd_err_map (err_code);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __tss_create, tss_create, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __tss_create, tss_create, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__tss_create, tss_create)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __tss_create, tss_create, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __tss_create, tss_create, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/tss_delete.c b/sysdeps/pthread/tss_delete.c
index 584f8788..d9336f2a 100644
--- a/sysdeps/pthread/tss_delete.c
+++ b/sysdeps/pthread/tss_delete.c
@@ -24,11 +24,14 @@ __tss_delete (tss_t tss_id)
{
__pthread_key_delete (tss_id);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __tss_delete, tss_delete, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __tss_delete, tss_delete, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__tss_delete, tss_delete)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __tss_delete, tss_delete, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __tss_delete, tss_delete, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/tss_get.c b/sysdeps/pthread/tss_get.c
index bb31cb16..9dcd5529 100644
--- a/sysdeps/pthread/tss_get.c
+++ b/sysdeps/pthread/tss_get.c
@@ -24,11 +24,14 @@ __tss_get (tss_t tss_id)
{
return __pthread_getspecific (tss_id);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __tss_get, tss_get, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __tss_get, tss_get, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__tss_get, tss_get)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __tss_get, tss_get, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __tss_get, tss_get, GLIBC_2_32);
+#endif
#endif
diff --git a/sysdeps/pthread/tss_set.c b/sysdeps/pthread/tss_set.c
index a751c37c..02a9bdc8 100644
--- a/sysdeps/pthread/tss_set.c
+++ b/sysdeps/pthread/tss_set.c
@@ -25,11 +25,14 @@ __tss_set (tss_t tss_id, void *val)
int err_code = __pthread_setspecific (tss_id, val);
return thrd_err_map (err_code);
}
-#if PTHREAD_IN_LIBC
+#ifndef __PTHREAD_HTL
versioned_symbol (libc, __tss_set, tss_set, GLIBC_2_34);
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_28, GLIBC_2_34)
compat_symbol (libpthread, __tss_set, tss_set, GLIBC_2_28);
# endif
-#else /* !PTHREAD_IN_LIBC */
-strong_alias (__tss_set, tss_set)
+#else /* __PTHREAD_HTL */
+versioned_symbol (libc, __tss_set, tss_set, GLIBC_2_43);
+# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_32, GLIBC_2_43)
+compat_symbol (libpthread, __tss_set, tss_set, GLIBC_2_32);
+#endif
#endif
--
2.52.0
More information about the Libc-alpha
mailing list