aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgfleury <gfleury@disroot.org>2025-08-15 20:14:44 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2025-08-16 01:13:22 +0200
commit2522a3f3ae127356f15170d769398469151c786d (patch)
treea1bd4cc3bcf51c0dd0ac9c3e8d07ff99d5dd31c3
parentb586357e2a6d7245795f9904a90d6651e2f78791 (diff)
downloadglibc-2522a3f3ae127356f15170d769398469151c786d.zip
glibc-2522a3f3ae127356f15170d769398469151c786d.tar.gz
glibc-2522a3f3ae127356f15170d769398469151c786d.tar.bz2
htl: move __pthread_init_{specific, static_tls}, __pthread_{alloc}, dealloc} into libc.
Message-ID: <20250815181500.107433-4-gfleury@disroot.org>
-rw-r--r--htl/Makefile6
-rw-r--r--htl/Versions5
-rw-r--r--htl/pt-alloc.c4
-rw-r--r--htl/pt-dealloc.c3
-rw-r--r--htl/pt-internal.h5
-rw-r--r--sysdeps/htl/pt-init-specific.c2
-rw-r--r--sysdeps/htl/pthreadP.h3
7 files changed, 23 insertions, 5 deletions
diff --git a/htl/Makefile b/htl/Makefile
index f33c1dc..1b2b501 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 ad3628e..851a2a5 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 c0074b4..4b44e98 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 13417df..7a90302 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 8b37838..5438563 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 f740b12..56a49d6 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 5dea8bd..1538fde 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. */