fix local-dynamic model TLS on mips and powerpc
[musl.git] / src / env / __reset_tls.c
blobbd61f311e7c41b2d4a277d631b46580e55fb5489
1 #ifndef SHARED
3 #include <string.h>
4 #include "pthread_impl.h"
6 extern struct tls_image {
7 void *image;
8 size_t len, size, align;
9 } __static_tls;
11 #define T __static_tls
13 void __reset_tls()
15 if (!T.size) return;
16 pthread_t self = __pthread_self();
17 memcpy(self->dtv[1], T.image, T.len);
18 memset((char *)self->dtv[1]+T.len, 0, T.size-T.len);
21 #endif