Further harden glibc malloc metadata against 1-byte overflows.
[glibc.git] / nptl / tst-tls5.h
blob6c2e1b0d09763b33280945fd3f2e817917c55146
1 #include <stdint.h>
2 #include <stddef.h>
4 struct tls_obj
6 const char *name;
7 uintptr_t addr;
8 size_t size;
9 size_t align;
11 extern struct tls_obj tls_registry[];
13 #define TLS_REGISTER(x) \
14 static void __attribute__((constructor)) \
15 tls_register_##x (void) \
16 { \
17 size_t i; \
18 for (i = 0; tls_registry[i].name; ++i); \
19 tls_registry[i].name = #x; \
20 tls_registry[i].addr = (uintptr_t) &x; \
21 tls_registry[i].size = sizeof (x); \
22 tls_registry[i].align = __alignof__ (x); \