optimize out setting up robust list with kernel when not needed
[musl] / src / env / __reset_tls.c
1 #ifndef SHARED
2
3 #include <string.h>
4 #include "pthread_impl.h"
5 #include "libc.h"
6
7 extern struct tls_image {
8         void *image;
9         size_t len, size, align;
10 } __static_tls ATTR_LIBC_VISIBILITY;
11
12 #define T __static_tls
13
14 void __reset_tls()
15 {
16         if (!T.size) return;
17         pthread_t self = __pthread_self();
18         memcpy(self->dtv[1], T.image, T.len);
19         memset((char *)self->dtv[1]+T.len, 0, T.size-T.len);
20 }
21
22 #endif