mirror of git://git.musl-libc.org/musl
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).
This commit is contained in:
parent
bc6a35fb7b
commit
9b153c043e
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
struct pthread {
|
struct pthread {
|
||||||
struct pthread *self;
|
struct pthread *self;
|
||||||
void *dtv, *unused1, *unused2;
|
void **dtv, *unused1, *unused2;
|
||||||
uintptr_t sysinfo;
|
uintptr_t sysinfo;
|
||||||
uintptr_t canary;
|
uintptr_t canary;
|
||||||
pid_t tid, pid;
|
pid_t tid, pid;
|
||||||
|
|
|
@ -654,6 +654,16 @@ void *__copy_tls(unsigned char *mem, size_t cnt)
|
||||||
return mem;
|
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)
|
void *__dynlink(int argc, char **argv)
|
||||||
{
|
{
|
||||||
size_t aux[AUX_CNT] = {0};
|
size_t aux[AUX_CNT] = {0};
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
.text
|
||||||
|
.global ___tls_get_addr
|
||||||
|
.type ___tls_get_addr,@function
|
||||||
|
___tls_get_addr:
|
||||||
|
push %eax
|
||||||
|
call __tls_get_addr
|
||||||
|
pop %edx
|
||||||
|
ret
|
Loading…
Reference in New Issue