X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fenv%2F__init_tls.c;h=eb2a6e4ada4559f626801042bcbd1eca7490e8de;hb=f78cdbe8993d072bf60a65754544199016a1fe29;hp=ab5992ce1c928eaccddc44bd8f301f2a5b98a981;hpb=9ec4283b28cf676292fd5c6f681bef1e90e30c18;p=musl diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c index ab5992ce..eb2a6e4a 100644 --- a/src/env/__init_tls.c +++ b/src/env/__init_tls.c @@ -1,5 +1,7 @@ #include #include +#include +#include #include "pthread_impl.h" #include "libc.h" #include "atomic.h" @@ -21,7 +23,7 @@ void *__copy_tls(unsigned char *mem) td = (pthread_t)mem; mem += sizeof(struct pthread); #else - mem += __libc.tls_size - sizeof(struct pthread); + mem += libc.tls_size - sizeof(struct pthread); mem -= (uintptr_t)mem & (align-1); td = (pthread_t)mem; td->dtv = dtv; @@ -56,10 +58,12 @@ typedef Elf64_Phdr Phdr; void __init_tls(size_t *aux) { unsigned char *p, *mem; - size_t n, d; + size_t n; Phdr *phdr, *tls_phdr=0; size_t base = 0; + libc.tls_size = sizeof(struct pthread); + for (p=(void *)aux[AT_PHDR],n=aux[AT_PHNUM]; n; n--,p+=aux[AT_PHENT]) { phdr = (void *)p; if (phdr->p_type == PT_PHDR)