about summary refs log tree commit diff
path: root/src/ldso
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-10-04 21:01:56 -0400
committerRich Felker <dalias@aerifal.cx>2012-10-04 21:01:56 -0400
commit9b153c043ea486d28f96a7e01419f650fe0e1b26 (patch)
tree33472c9ec71eb7464d4fc97a168c0dba1b20ca5c /src/ldso
parentbc6a35fb7b02f068b901f22a56559996395cfd3b (diff)
downloadmusl-9b153c043ea486d28f96a7e01419f650fe0e1b26.tar.gz
musl-9b153c043ea486d28f96a7e01419f650fe0e1b26.tar.xz
musl-9b153c043ea486d28f96a7e01419f650fe0e1b26.zip
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).
Diffstat (limited to 'src/ldso')
-rw-r--r--src/ldso/dynlink.c10
1 files changed, 10 insertions, 0 deletions
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};