aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/mach
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2024-03-23 20:32:59 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2024-03-23 23:00:30 +0100
commitdc1a77269c971652a8a5167ec366792eae052e65 (patch)
tree5da3b6767ba21b2405404f9c9228a7af5b67decb /sysdeps/mach
parenta4273efa219480a7f2c9c8fa7bc8bb71c48c3604 (diff)
downloadglibc-dc1a77269c971652a8a5167ec366792eae052e65.zip
glibc-dc1a77269c971652a8a5167ec366792eae052e65.tar.gz
glibc-dc1a77269c971652a8a5167ec366792eae052e65.tar.bz2
htl: Implement some support for TLS_DTV_AT_TP
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> Message-ID: <20240323173301.151066-19-bugaevc@gmail.com>
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/hurd/htl/pt-sysdep.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.c b/sysdeps/mach/hurd/htl/pt-sysdep.c
index 270e775..5372cbf 100644
--- a/sysdeps/mach/hurd/htl/pt-sysdep.c
+++ b/sysdeps/mach/hurd/htl/pt-sysdep.c
@@ -100,7 +100,16 @@ _init_routine (void *stack)
to the new stack. Pretend it wasn't allocated so that it remains
valid if the main thread terminates. */
thread->stack = 0;
+#if TLS_TCB_AT_TP
thread->tcb = THREAD_SELF;
+#elif TLS_DTV_AT_TP
+ /* Assuming THREAD_SELF is implemented as subtracting TLS_PRE_TCB_SIZE
+ from the value of a thread pointer regsiter, this should optimize
+ down to simply reading that register. */
+ thread->tcb = (tcbhead_t *) (((char *) THREAD_SELF) + TLS_PRE_TCB_SIZE);
+#else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+#endif
#ifndef PAGESIZE
__pthread_default_attr.__guardsize = __vm_page_size;