From 5085e91a323072e923f46bad4199e6abd9d12ae7 Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 25 Apr 2015 10:14:19 -0400 Subject: complete/fix support of ctors/dtors and tls. + do not build libc.so with -DSHARED for the midipix targets. + provide surrogate init/fini arrays that allow invocation of the ctors/dtors iteration routines. + provide a builtin tls for the first thread. + update __copy_tls to match the layout of the simplified struct __tls. signed-off by Z. Gilboa; see copying.midipix (9cd0746c) for additional information. --- src/ldso/nt32/dynlink.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/ldso/nt32/dynlink.c') diff --git a/src/ldso/nt32/dynlink.c b/src/ldso/nt32/dynlink.c index c3cb23e..edfa4a8 100644 --- a/src/ldso/nt32/dynlink.c +++ b/src/ldso/nt32/dynlink.c @@ -50,13 +50,15 @@ void *__copy_tls(unsigned char * mem) **/ pthread_t td; - void ** dtv; + uintptr_t addr; - dtv = (void **)mem; - dtv[0] = 0; + addr = (uintptr_t)mem; + addr >>= 4; + addr <<= 4; + addr += 16; - td = (void *)(dtv + 1); - td->dtv = dtv; + td = (struct __pthread *)addr; + td->dtv = 0; return td; } -- cgit v1.2.3