<https://www.gnu.org/licenses/>. */
#include <pt-sysdep.h>
+#include <pt-internal.h>
-__thread struct __pthread *___pthread_self;
+/* Initial thread structure used before libpthread is initialized, so various
+ * functions can already work at least basically. */
+struct __pthread __pthread_init_thread = {
+ .thread = 1,
+};
+
+__thread struct __pthread *___pthread_self = &__pthread_init_thread;
libc_hidden_tls_def (___pthread_self)
#include <pt-internal.h>
#include <pthreadP.h>
-/* Initial thread structure used temporarily during initialization, so various
- * functions can already work at least basically. */
-static struct __pthread init_thread;
-
static void
reset_pthread_total (void)
{
/* Already initialized */
return;
- /* Initialize early thread structure. */
- init_thread.thread = 1;
- ___pthread_self = &init_thread;
-
/* Initialize the library. */
___pthread_init ();
#endif
/* Copy over the thread-specific state */
- assert (!init_thread.thread_specifics);
+ assert (!__pthread_init_thread.thread_specifics);
memcpy (&thread->static_thread_specifics,
- &init_thread.static_thread_specifics,
+ &__pthread_init_thread.static_thread_specifics,
sizeof (thread->static_thread_specifics));
___pthread_self = thread;
extern __thread struct __pthread *___pthread_self;
libc_hidden_tls_proto (___pthread_self)
+extern struct __pthread ___pthread_init_thread;
+libc_hidden_proto (___pthread_init_thread)
#ifdef DEBUG
#define _pthread_self() \