about summary refs log tree commit diff
path: root/src/thread
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-06-03 16:35:59 -0400
committerRich Felker <dalias@aerifal.cx>2013-06-03 16:35:59 -0400
commit44b4d09fc0626541ca12cf96f65adc21ab1fc413 (patch)
tree5ef32eaf4dc0e507a69fb9bb4cca14d8b2cab35a /src/thread
parentd9265653552a2b667bf3e84407a06edaa7e9f74f (diff)
downloadmusl-44b4d09fc0626541ca12cf96f65adc21ab1fc413.tar.gz
musl-44b4d09fc0626541ca12cf96f65adc21ab1fc413.tar.xz
musl-44b4d09fc0626541ca12cf96f65adc21ab1fc413.zip
ensure that thread dtv pointer is never null to optimize __tls_get_addr
Diffstat (limited to 'src/thread')
-rw-r--r--src/thread/pthread_self.c2
1 files changed, 2 insertions, 0 deletions
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;
 }