From: gfleury Date: Fri, 13 Jun 2025 18:43:48 +0000 (+0200) Subject: htl: move pthread_key_*, pthread_get/setspecific X-Git-Tag: glibc-2.42~142 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=27360ab9ea637de80ded9f0e0fe23ac0cc621b29;p=thirdparty%2Fglibc.git htl: move pthread_key_*, pthread_get/setspecific Signed-off-by: gfleury Reviewed-by: Samuel Thibault Message-ID: <20250613184440.1660335-1-gfleury@disroot.org> --- diff --git a/htl/Makefile b/htl/Makefile index 603af24ce4..c4780479e3 100644 --- a/htl/Makefile +++ b/htl/Makefile @@ -25,12 +25,7 @@ SYSDEPS := lockfile LCLHDRS := libpthread-routines := \ - pt-destroy-specific \ pt-init-specific \ - pt-key-create \ - pt-key-delete \ - pt-getspecific \ - pt-setspecific \ pt-alloc \ pt-create \ pt-getattr \ @@ -161,7 +156,11 @@ routines := \ pt-condattr-init \ pt-condattr-setclock \ pt-condattr-setpshared \ + pt-destroy-specific \ pt-getschedparam \ + pt-getspecific \ + pt-key-create \ + pt-key-delete \ pt-mutex-checklocked \ pt-mutex-consistent \ pt-mutex-destroy \ @@ -205,6 +204,7 @@ routines := \ pt-setcancelstate \ pt-setcanceltype \ pt-setschedparam \ + pt-setspecific \ pt-sigmask \ pt-sigstate \ pt-sigstate-destroy \ diff --git a/htl/Versions b/htl/Versions index a07a3b3708..0052f82264 100644 --- a/htl/Versions +++ b/htl/Versions @@ -2,6 +2,7 @@ libc { GLIBC_2.12 { pthread_self; + __pthread_key_create; __pthread_self; pthread_attr_getdetachstate; pthread_attr_getinheritsched; @@ -12,6 +13,7 @@ libc { pthread_attr_setschedpolicy; pthread_equal; pthread_getschedparam; + pthread_getspecific; pthread_setschedparam; pthread_attr_destroy; pthread_attr_getguardsize; @@ -45,6 +47,8 @@ libc { pthread_condattr_getpshared; pthread_condattr_setclock; pthread_condattr_setpshared; + pthread_key_create; + pthread_key_delete; pthread_mutex_destroy; pthread_mutex_getprioceiling; pthread_mutex_init; @@ -79,6 +83,7 @@ libc { pthread_rwlockattr_setpshared; pthread_setcancelstate; pthread_setcanceltype; + pthread_setspecific; pthread_sigmask; } @@ -154,6 +159,9 @@ libc { pthread_barrierattr_getpshared; pthread_barrierattr_init; pthread_barrierattr_setpshared; + pthread_getspecific; + pthread_key_create; + pthread_key_delete; pthread_mutex_consistent; pthread_mutex_consistent_np; pthread_mutex_getprioceiling; pthread_mutex_setprioceiling; @@ -174,6 +182,7 @@ libc { pthread_rwlockattr_getpshared; pthread_rwlockattr_init; pthread_rwlockattr_setpshared; + pthread_setspecific; } GLIBC_PRIVATE { @@ -203,6 +212,9 @@ libc { __pthread_cond_wait; __pthread_condattr_init; __pthread_default_condattr; + __pthread_destroy_specific; + __pthread_getspecific; + __pthread_key_delete; __pthread_mutex_checklocked; __pthread_mutex_destroy; __pthread_mutex_init; @@ -214,6 +226,7 @@ libc { __pthread_mutexattr_init; __pthread_mutexattr_settype; __pthread_once; + __pthread_setspecific; __pthread_sigstate; __pthread_sigstate_destroy; __pthread_sigmask; @@ -255,20 +268,16 @@ libpthread { pthread_getattr_np; pthread_getconcurrency; pthread_getcpuclockid; - pthread_getspecific; pthread_join; - pthread_key_create; pthread_key_delete; - __pthread_key_create; - pthread_kill; __pthread_kill; pthread_mutex_transfer_np; pthread_setconcurrency; - pthread_setschedprio; pthread_setspecific; + pthread_setschedprio; pthread_testcancel; pthread_yield; @@ -315,8 +324,6 @@ libpthread { __cthread_keycreate; __cthread_getspecific; __cthread_setspecific; - __pthread_getspecific; - __pthread_setspecific; __pthread_getattr_np; __pthread_enable_asynccancel; __pthread_disable_asynccancel; diff --git a/htl/pt-initialize.c b/htl/pt-initialize.c index 658ba1eaf3..cd8b4678cd 100644 --- a/htl/pt-initialize.c +++ b/htl/pt-initialize.c @@ -30,9 +30,6 @@ static const struct pthread_functions pthread_functions = { .ptr___pthread_exit = __pthread_exit, .ptr___pthread_get_cleanup_stack = __pthread_get_cleanup_stack, .ptr_pthread_once = __pthread_once, - .ptr___pthread_key_create = __pthread_key_create, - .ptr___pthread_getspecific = __pthread_getspecific, - .ptr___pthread_setspecific = __pthread_setspecific, .ptr__IO_flockfile = _cthreads_flockfile, .ptr__IO_funlockfile = _cthreads_funlockfile, .ptr__IO_ftrylockfile = _cthreads_ftrylockfile, diff --git a/htl/pt-internal.h b/htl/pt-internal.h index d19579b33b..8b37838b8e 100644 --- a/htl/pt-internal.h +++ b/htl/pt-internal.h @@ -299,6 +299,7 @@ extern error_t __pthread_init_specific (struct __pthread *thread); /* Call the destructors on all of the thread specific data in THREAD. THREAD must be the calling thread. */ extern void __pthread_destroy_specific (struct __pthread *thread); +libc_hidden_proto (__pthread_destroy_specific) /* Initialize newly create thread *THREAD's signal state data diff --git a/sysdeps/htl/libc-lockP.h b/sysdeps/htl/libc-lockP.h index 092eb35831..e9977e46a1 100644 --- a/sysdeps/htl/libc-lockP.h +++ b/sysdeps/htl/libc-lockP.h @@ -126,15 +126,9 @@ libc_hidden_proto (__pthread_setcancelstate) single-threaded processes. */ #if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread) # ifdef weak_extern -weak_extern (__pthread_key_create) -weak_extern (__pthread_setspecific) -weak_extern (__pthread_getspecific) weak_extern (__pthread_initialize) weak_extern (__pthread_atfork) # else -# pragma weak __pthread_key_create -# pragma weak __pthread_setspecific -# pragma weak __pthread_getspecific # pragma weak __pthread_initialize # pragma weak __pthread_atfork # endif diff --git a/sysdeps/htl/pt-destroy-specific.c b/sysdeps/htl/pt-destroy-specific.c index e63b8075d1..b5eb0ba37a 100644 --- a/sysdeps/htl/pt-destroy-specific.c +++ b/sysdeps/htl/pt-destroy-specific.c @@ -20,6 +20,7 @@ #include #include +#include void __pthread_destroy_specific (struct __pthread *thread) @@ -100,3 +101,4 @@ __pthread_destroy_specific (struct __pthread *thread) memset (&thread->static_thread_specifics, 0, sizeof (thread->static_thread_specifics)); } +libc_hidden_def (__pthread_destroy_specific) diff --git a/sysdeps/htl/pt-getspecific.c b/sysdeps/htl/pt-getspecific.c index 0052ce8f7a..d3ebb31dd4 100644 --- a/sysdeps/htl/pt-getspecific.c +++ b/sysdeps/htl/pt-getspecific.c @@ -19,6 +19,7 @@ #include #include +#include void * __pthread_getspecific (pthread_key_t key) @@ -42,5 +43,9 @@ __pthread_getspecific (pthread_key_t key) return self->thread_specifics[key]; } -weak_alias (__pthread_getspecific, pthread_getspecific); -hidden_def (__pthread_getspecific) +libc_hidden_def (__pthread_getspecific) +versioned_symbol (libc, __pthread_getspecific, pthread_getspecific, GLIBC_2_42); + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_42) +compat_symbol (libpthread, __pthread_getspecific, pthread_getspecific, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pt-key-create.c b/sysdeps/htl/pt-key-create.c index cf8a8d15a5..92a9db8f1e 100644 --- a/sysdeps/htl/pt-key-create.c +++ b/sysdeps/htl/pt-key-create.c @@ -22,6 +22,9 @@ #include #include +#include +#include + pthread_mutex_t __pthread_key_lock; pthread_once_t __pthread_key_once = PTHREAD_ONCE_INIT; @@ -116,5 +119,9 @@ do_search: __pthread_mutex_unlock (&__pthread_key_lock); return 0; } -weak_alias (__pthread_key_create, pthread_key_create) -hidden_def (__pthread_key_create) +libc_hidden_def (__pthread_key_create) +versioned_symbol (libc, __pthread_key_create, pthread_key_create, GLIBC_2_42); + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_42) +compat_symbol (libpthread, __pthread_key_create, pthread_key_create, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pt-key-delete.c b/sysdeps/htl/pt-key-delete.c index 79879e99b7..666314f286 100644 --- a/sysdeps/htl/pt-key-delete.c +++ b/sysdeps/htl/pt-key-delete.c @@ -19,6 +19,8 @@ #include #include +#include +#include int __pthread_key_delete (pthread_key_t key) @@ -69,4 +71,9 @@ __pthread_key_delete (pthread_key_t key) return err; } -weak_alias (__pthread_key_delete, pthread_key_delete) +libc_hidden_def (__pthread_key_delete) +versioned_symbol (libc, __pthread_key_delete, pthread_key_delete, GLIBC_2_42); + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_42) +compat_symbol (libpthread, __pthread_key_delete, pthread_key_delete, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pt-setspecific.c b/sysdeps/htl/pt-setspecific.c index dfd55b6225..0535225264 100644 --- a/sysdeps/htl/pt-setspecific.c +++ b/sysdeps/htl/pt-setspecific.c @@ -19,6 +19,8 @@ #include #include +#include +#include int __pthread_setspecific (pthread_key_t key, const void *value) @@ -68,5 +70,9 @@ __pthread_setspecific (pthread_key_t key, const void *value) self->thread_specifics[key] = (void *) value; return 0; } -weak_alias (__pthread_setspecific, pthread_setspecific); -hidden_def (__pthread_setspecific) +libc_hidden_def (__pthread_setspecific) +versioned_symbol (libc, __pthread_setspecific, pthread_setspecific, GLIBC_2_42); + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_42) +compat_symbol (libpthread, __pthread_setspecific, pthread_setspecific, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pthread-functions.h b/sysdeps/htl/pthread-functions.h index 467d0312e1..31d85cc80c 100644 --- a/sysdeps/htl/pthread-functions.h +++ b/sysdeps/htl/pthread-functions.h @@ -24,9 +24,6 @@ void __pthread_exit (void *) __attribute__ ((__noreturn__)); struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void); int __pthread_once (pthread_once_t *, void (*) (void)); -int __pthread_key_create (pthread_key_t *, void (*) (void *)); -void *__pthread_getspecific (pthread_key_t); -int __pthread_setspecific (pthread_key_t, const void *); void _cthreads_flockfile (FILE *); void _cthreads_funlockfile (FILE *); @@ -40,9 +37,6 @@ struct pthread_functions void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__)); struct __pthread_cancelation_handler **(*ptr___pthread_get_cleanup_stack) (void); int (*ptr_pthread_once) (pthread_once_t *, void (*) (void)); - int (*ptr___pthread_key_create) (pthread_key_t *, void (*) (void *)); - void *(*ptr___pthread_getspecific) (pthread_key_t); - int (*ptr___pthread_setspecific) (pthread_key_t, const void *); void (*ptr__IO_flockfile) (FILE *); void (*ptr__IO_funlockfile) (FILE *); int (*ptr__IO_ftrylockfile) (FILE *); diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h index 535deeb89f..64db024cc8 100644 --- a/sysdeps/htl/pthreadP.h +++ b/sysdeps/htl/pthreadP.h @@ -182,9 +182,13 @@ int __cthread_keycreate (__cthread_key_t *); int __cthread_getspecific (__cthread_key_t, void **); int __cthread_setspecific (__cthread_key_t, void *); int __pthread_key_create (pthread_key_t *key, void (*destr) (void *)); +libc_hidden_proto (__pthread_key_create) void *__pthread_getspecific (pthread_key_t key); +libc_hidden_proto (__pthread_getspecific) int __pthread_setspecific (pthread_key_t key, const void *value); +libc_hidden_proto (__pthread_setspecific) int __pthread_key_delete (pthread_key_t key); +libc_hidden_proto (__pthread_key_delete) int __pthread_once (pthread_once_t *once_control, void (*init_routine) (void)); int __pthread_getattr_np (pthread_t, pthread_attr_t *); @@ -216,9 +220,6 @@ libc_hidden_proto (__pthread_condattr_init) #if IS_IN (libpthread) hidden_proto (__pthread_create) hidden_proto (__pthread_detach) -hidden_proto (__pthread_key_create) -hidden_proto (__pthread_getspecific) -hidden_proto (__pthread_setspecific) hidden_proto (__pthread_get_cleanup_stack) #endif diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index 3e183f5c02..89a41a30c6 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist +++ b/sysdeps/mach/hurd/i386/libc.abilist @@ -28,6 +28,7 @@ GLIBC_2.11 mkostemps F GLIBC_2.11 mkostemps64 F GLIBC_2.11 mkstemps F GLIBC_2.11 mkstemps64 F +GLIBC_2.12 __pthread_key_create F GLIBC_2.12 __pthread_self F GLIBC_2.12 pthread_attr_destroy F GLIBC_2.12 pthread_attr_getdetachstate F @@ -70,6 +71,9 @@ GLIBC_2.12 pthread_condattr_setclock F GLIBC_2.12 pthread_condattr_setpshared F GLIBC_2.12 pthread_equal F GLIBC_2.12 pthread_getschedparam F +GLIBC_2.12 pthread_getspecific F +GLIBC_2.12 pthread_key_create F +GLIBC_2.12 pthread_key_delete F GLIBC_2.12 pthread_mutex_destroy F GLIBC_2.12 pthread_mutex_getprioceiling F GLIBC_2.12 pthread_mutex_init F @@ -106,6 +110,7 @@ GLIBC_2.12 pthread_self F GLIBC_2.12 pthread_setcancelstate F GLIBC_2.12 pthread_setcanceltype F GLIBC_2.12 pthread_setschedparam F +GLIBC_2.12 pthread_setspecific F GLIBC_2.12 pthread_sigmask F GLIBC_2.13 __fentry__ F GLIBC_2.14 syncfs F @@ -2593,6 +2598,9 @@ GLIBC_2.42 pthread_barrierattr_destroy F GLIBC_2.42 pthread_barrierattr_getpshared F GLIBC_2.42 pthread_barrierattr_init F GLIBC_2.42 pthread_barrierattr_setpshared F +GLIBC_2.42 pthread_getspecific F +GLIBC_2.42 pthread_key_create F +GLIBC_2.42 pthread_key_delete F GLIBC_2.42 pthread_mutex_consistent F GLIBC_2.42 pthread_mutex_consistent_np F GLIBC_2.42 pthread_mutex_getprioceiling F @@ -2614,6 +2622,7 @@ GLIBC_2.42 pthread_rwlockattr_destroy F GLIBC_2.42 pthread_rwlockattr_getpshared F GLIBC_2.42 pthread_rwlockattr_init F GLIBC_2.42 pthread_rwlockattr_setpshared F +GLIBC_2.42 pthread_setspecific F GLIBC_2.42 uabs F GLIBC_2.42 uimaxabs F GLIBC_2.42 ulabs F diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist index b067d377b3..51535ac1c4 100644 --- a/sysdeps/mach/hurd/i386/libpthread.abilist +++ b/sysdeps/mach/hurd/i386/libpthread.abilist @@ -1,7 +1,6 @@ GLIBC_2.12 __mutex_lock_solid F GLIBC_2.12 __mutex_unlock_solid F GLIBC_2.12 __pthread_get_cleanup_stack F -GLIBC_2.12 __pthread_key_create F GLIBC_2.12 __pthread_kill F GLIBC_2.12 __pthread_mutex_transfer_np F GLIBC_2.12 __pthread_spin_destroy F @@ -29,15 +28,11 @@ GLIBC_2.12 pthread_exit F GLIBC_2.12 pthread_getattr_np F GLIBC_2.12 pthread_getconcurrency F GLIBC_2.12 pthread_getcpuclockid F -GLIBC_2.12 pthread_getspecific F GLIBC_2.12 pthread_join F -GLIBC_2.12 pthread_key_create F -GLIBC_2.12 pthread_key_delete F GLIBC_2.12 pthread_kill F GLIBC_2.12 pthread_mutex_transfer_np F GLIBC_2.12 pthread_setconcurrency F GLIBC_2.12 pthread_setschedprio F -GLIBC_2.12 pthread_setspecific F GLIBC_2.12 pthread_spin_destroy F GLIBC_2.12 pthread_spin_init F GLIBC_2.12 pthread_spin_lock F diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist index 688ee26f4b..3e9ce8ba9c 100644 --- a/sysdeps/mach/hurd/x86_64/libc.abilist +++ b/sysdeps/mach/hurd/x86_64/libc.abilist @@ -392,6 +392,7 @@ GLIBC_2.38 __profile_frequency F GLIBC_2.38 __progname D 0x8 GLIBC_2.38 __progname_full D 0x8 GLIBC_2.38 __pthread_get_cleanup_stack F +GLIBC_2.38 __pthread_key_create F GLIBC_2.38 __pthread_self F GLIBC_2.38 __ptsname_r_chk F GLIBC_2.38 __pwrite64 F @@ -1554,6 +1555,9 @@ GLIBC_2.38 pthread_condattr_setpshared F GLIBC_2.38 pthread_equal F GLIBC_2.38 pthread_exit F GLIBC_2.38 pthread_getschedparam F +GLIBC_2.38 pthread_getspecific F +GLIBC_2.38 pthread_key_create F +GLIBC_2.38 pthread_key_delete F GLIBC_2.38 pthread_mutex_clocklock F GLIBC_2.38 pthread_mutex_consistent F GLIBC_2.38 pthread_mutex_consistent_np F @@ -1599,6 +1603,7 @@ GLIBC_2.38 pthread_self F GLIBC_2.38 pthread_setcancelstate F GLIBC_2.38 pthread_setcanceltype F GLIBC_2.38 pthread_setschedparam F +GLIBC_2.38 pthread_setspecific F GLIBC_2.38 pthread_sigmask F GLIBC_2.38 ptrace F GLIBC_2.38 ptsname F @@ -2276,6 +2281,9 @@ GLIBC_2.42 pthread_barrierattr_destroy F GLIBC_2.42 pthread_barrierattr_getpshared F GLIBC_2.42 pthread_barrierattr_init F GLIBC_2.42 pthread_barrierattr_setpshared F +GLIBC_2.42 pthread_getspecific F +GLIBC_2.42 pthread_key_create F +GLIBC_2.42 pthread_key_delete F GLIBC_2.42 pthread_mutex_consistent F GLIBC_2.42 pthread_mutex_consistent_np F GLIBC_2.42 pthread_mutex_getprioceiling F @@ -2297,6 +2305,7 @@ GLIBC_2.42 pthread_rwlockattr_destroy F GLIBC_2.42 pthread_rwlockattr_getpshared F GLIBC_2.42 pthread_rwlockattr_init F GLIBC_2.42 pthread_rwlockattr_setpshared F +GLIBC_2.42 pthread_setspecific F GLIBC_2.42 uabs F GLIBC_2.42 uimaxabs F GLIBC_2.42 ulabs F diff --git a/sysdeps/mach/hurd/x86_64/libpthread.abilist b/sysdeps/mach/hurd/x86_64/libpthread.abilist index 6b8acec832..a1ff462ba9 100644 --- a/sysdeps/mach/hurd/x86_64/libpthread.abilist +++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist @@ -6,7 +6,6 @@ GLIBC_2.38 __h_errno_location F GLIBC_2.38 __mutex_lock_solid F GLIBC_2.38 __mutex_unlock_solid F GLIBC_2.38 __pthread_get_cleanup_stack F -GLIBC_2.38 __pthread_key_create F GLIBC_2.38 __pthread_kill F GLIBC_2.38 __pthread_mutex_transfer_np F GLIBC_2.38 __pthread_spin_destroy F @@ -47,17 +46,13 @@ GLIBC_2.38 pthread_exit F GLIBC_2.38 pthread_getattr_np F GLIBC_2.38 pthread_getconcurrency F GLIBC_2.38 pthread_getcpuclockid F -GLIBC_2.38 pthread_getspecific F GLIBC_2.38 pthread_hurd_cond_timedwait_np F GLIBC_2.38 pthread_hurd_cond_wait_np F GLIBC_2.38 pthread_join F -GLIBC_2.38 pthread_key_create F -GLIBC_2.38 pthread_key_delete F GLIBC_2.38 pthread_kill F GLIBC_2.38 pthread_mutex_transfer_np F GLIBC_2.38 pthread_setconcurrency F GLIBC_2.38 pthread_setschedprio F -GLIBC_2.38 pthread_setspecific F GLIBC_2.38 pthread_spin_destroy F GLIBC_2.38 pthread_spin_init F GLIBC_2.38 pthread_spin_lock F