From 9b153c043ea486d28f96a7e01419f650fe0e1b26 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 4 Oct 2012 21:01:56 -0400 Subject: beginnings of full TLS support in shared libraries this code will not work yet because the necessary relocations are not supported, and cannot be supported without some internal changes to how relocation processing works (coming soon). --- src/ldso/dynlink.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/ldso') diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c index 4e0b9f4e..774ab849 100644 --- a/src/ldso/dynlink.c +++ b/src/ldso/dynlink.c @@ -654,6 +654,16 @@ void *__copy_tls(unsigned char *mem, size_t cnt) return mem; } +void *__tls_get_addr(size_t *p) +{ + pthread_t self = __pthread_self(); + if ((size_t)self->dtv[0] < p[0]) { + // FIXME: obtain new DTV and TLS from the DSO + a_crash(); + } + return (char *)self->dtv[p[0]] + p[1]; +} + void *__dynlink(int argc, char **argv) { size_t aux[AUX_CNT] = {0}; -- cgit v1.2.1