From 44b4d09fc0626541ca12cf96f65adc21ab1fc413 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 3 Jun 2013 16:35:59 -0400 Subject: ensure that thread dtv pointer is never null to optimize __tls_get_addr --- src/thread/pthread_self.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/thread') diff --git a/src/thread/pthread_self.c b/src/thread/pthread_self.c index c50a2fb5..aed4b5f1 100644 --- a/src/thread/pthread_self.c +++ b/src/thread/pthread_self.c @@ -17,6 +17,8 @@ static int init_main_thread() main_thread->self = main_thread; main_thread->tid = main_thread->pid = __syscall(SYS_set_tid_address, &main_thread->tid); + if (!main_thread->dtv) + main_thread->dtv = (void *)dummy; libc.main_thread = main_thread; return 0; } -- cgit v1.2.1