2.3.5-9
[glibc.git] / linuxthreads / tst-tls1.h
blob0060e5727bd273bc4dd8b4ca0f11b7038017eab7
1 #include <stdint.h>
2 #include <stdlib.h>
3 #include <tls.h>
5 #if USE_TLS && (0 || HAVE___THREAD)
7 struct tls_obj
9 const char *name;
10 uintptr_t addr;
11 size_t size;
12 size_t align;
14 extern struct tls_obj tls_registry[];
16 #define TLS_REGISTER(x) \
17 static void __attribute__((constructor)) \
18 tls_register_##x (void) \
19 { \
20 size_t i; \
21 for (i = 0; tls_registry[i].name; ++i); \
22 tls_registry[i].name = #x; \
23 tls_registry[i].addr = (uintptr_t) &x; \
24 tls_registry[i].size = sizeof (x); \
25 tls_registry[i].align = __alignof__ (x); \
28 #endif