From: gfleury <gfle...@disroot.org> Message-ID: <20250815181500.107433-4-gfle...@disroot.org> --- htl/Makefile | 6 +++--- htl/Versions | 5 +++++ htl/pt-alloc.c | 4 ++++ htl/pt-dealloc.c | 3 +++ htl/pt-internal.h | 5 ++++- sysdeps/htl/pt-init-specific.c | 2 ++ sysdeps/htl/pthreadP.h | 3 ++- 7 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/htl/Makefile b/htl/Makefile index f33c1dccf2..1b2b501fef 100644 --- a/htl/Makefile +++ b/htl/Makefile @@ -25,11 +25,8 @@ SYSDEPS := lockfile LCLHDRS := libpthread-routines := \ - pt-init-specific \ - pt-alloc \ pt-create \ pt-getattr \ - pt-dealloc \ pt-detach \ pt-exit \ pt-initialize \ @@ -108,6 +105,7 @@ routines := \ forward \ htlfreeres \ libc_pthread_init \ + pt-alloc \ pt-attr \ pt-attr-destroy \ pt-attr-getdetachstate \ @@ -153,10 +151,12 @@ routines := \ pt-condattr-init \ pt-condattr-setclock \ pt-condattr-setpshared \ + pt-dealloc \ pt-destroy-specific \ pt-getconcurrency \ pt-getschedparam \ pt-getspecific \ + pt-init-specific \ pt-key-create \ pt-key-delete \ pt-mutex-checklocked \ diff --git a/htl/Versions b/htl/Versions index ad3628eb3c..851a2a5398 100644 --- a/htl/Versions +++ b/htl/Versions @@ -201,9 +201,11 @@ libc { __pthread_cleanup_stack; __pthread_total; ___pthread_self; + __pthread_alloc; __pthread_block; __pthread_block_intr; __pthread_init_thread; + __pthread_init_static_tls; __pthread_default_attr; __pthread_attr_init; __pthread_attr_getstacksize; @@ -212,6 +214,8 @@ libc { __pthread_attr_setstacksize; __pthread_attr_setstackaddr; __pthread_attr_setstack; + __pthread_dealloc; + __pthread_dealloc_finish; __pthread_setcancelstate; __pthread_cond_broadcast; __pthread_cond_destroy; @@ -225,6 +229,7 @@ libc { __pthread_destroy_specific; __pthread_getspecific; __pthread_key_delete; + __pthread_max_threads; __pthread_mutex_checklocked; __pthread_mutex_destroy; __pthread_mutex_init; diff --git a/htl/pt-alloc.c b/htl/pt-alloc.c index c0074b4447..4b44e98e5b 100644 --- a/htl/pt-alloc.c +++ b/htl/pt-alloc.c @@ -23,6 +23,7 @@ #include <string.h> #include <pt-internal.h> +#include <ldsodefs.h> /* This braindamage is necessary because the standard says that some of the threads functions "shall fail" if "No thread could be found @@ -30,6 +31,7 @@ /* The size of the thread ID lookup table. */ int __pthread_max_threads; +libc_hidden_data_def (__pthread_max_threads) /* List of thread structures corresponding to free thread IDs. */ struct __pthread *__pthread_free_threads; @@ -201,6 +203,7 @@ retry: *pthread = new; return 0; } +libc_hidden_def (__pthread_alloc) void attribute_hidden @@ -230,3 +233,4 @@ __pthread_init_static_tls (struct link_map *map) } __libc_rwlock_unlock (GL (dl_pthread_threads_lock)); } +libc_hidden_def (__pthread_init_static_tls) diff --git a/htl/pt-dealloc.c b/htl/pt-dealloc.c index 13417df42f..7a90302b02 100644 --- a/htl/pt-dealloc.c +++ b/htl/pt-dealloc.c @@ -23,6 +23,7 @@ #include <pt-internal.h> #include <atomic.h> +#include <ldsodefs.h> /* List of thread structures corresponding to free thread IDs. */ extern struct __pthread *__pthread_free_threads; @@ -55,6 +56,7 @@ __pthread_dealloc (struct __pthread *pthread) __pthread_enqueue (&__pthread_free_threads, pthread); __pthread_mutex_unlock (&__pthread_free_threads_lock); } +libc_hidden_def (__pthread_dealloc) /* Confirm deallocation of the thread structure for PTHREAD. */ void @@ -69,3 +71,4 @@ __pthread_dealloc_finish (struct __pthread *pthread) which reads this variable. */ pthread->terminated = TRUE; } +libc_hidden_def (__pthread_dealloc_finish) diff --git a/htl/pt-internal.h b/htl/pt-internal.h index 8b37838b8e..54385630b1 100644 --- a/htl/pt-internal.h +++ b/htl/pt-internal.h @@ -172,6 +172,7 @@ extern int __pthread_concurrency; /* The size of the thread ID lookup table. */ extern int __pthread_max_threads; +libc_hidden_proto (__pthread_max_threads) #define __pthread_getid(thread) \ ({ struct __pthread *__t = NULL; \ @@ -209,6 +210,7 @@ extern int __pthread_create_internal (struct __pthread **__restrict pthread, /* Allocate a new thread structure and a pthread thread ID (but not a kernel thread or a stack). THREAD has one reference. */ extern int __pthread_alloc (struct __pthread **thread); +libc_hidden_proto (__pthread_alloc) /* Deallocate the content of the thread structure. This is the dual of __pthread_alloc (N.B. it does not call __pthread_stack_dealloc nor @@ -217,11 +219,12 @@ extern int __pthread_alloc (struct __pthread **thread); to call __pthread_dealloc_finish when it is really finished with using THREAD. */ extern void __pthread_dealloc (struct __pthread *thread); +libc_hidden_proto (__pthread_dealloc) /* Confirm deallocating the thread structure. Before calling this the structure will not be reused yet. */ extern void __pthread_dealloc_finish (struct __pthread *pthread); - +libc_hidden_proto (__pthread_dealloc_finish) /* Allocate a stack of size STACKSIZE. The stack base shall be returned in *STACKADDR. */ diff --git a/sysdeps/htl/pt-init-specific.c b/sysdeps/htl/pt-init-specific.c index f740b120a1..56a49d617c 100644 --- a/sysdeps/htl/pt-init-specific.c +++ b/sysdeps/htl/pt-init-specific.c @@ -20,6 +20,8 @@ #include <stdlib.h> #include <pt-internal.h> +#include <string.h> + error_t __pthread_init_specific (struct __pthread *thread) diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h index 5dea8bd172..1538fdee72 100644 --- a/sysdeps/htl/pthreadP.h +++ b/sysdeps/htl/pthreadP.h @@ -28,7 +28,8 @@ /* Attribute to indicate thread creation was issued from C11 thrd_create. */ #define ATTR_C11_THREAD ((void*)(uintptr_t)-1) -extern void __pthread_init_static_tls (struct link_map *) attribute_hidden; +extern void __pthread_init_static_tls (struct link_map *); +libc_hidden_proto (__pthread_init_static_tls) /* These represent the interface used by glibc itself. */ -- 2.47.2