Update.
2003-09-01 Jakub Jelinek <jakub@redhat.com>
* Makefile (tests): Add tst-tls1.
(module-names): Add tst-tls1mod{,a,b,c,d,e,f}.
($(objpfx)tst-tls1mod{,a,b,c,d,e,f}.so-no-z-defs): Set to yes.
($(objpfx)tst-tls1): New.
($(objpfx)tst-tls2.out): Likewise.
(tests): Depend on $(objpfx)tst-tls2.out.
* tst-tls1.c: New test.
* tst-tls1.h: New.
* tst-tls1mod.c: New.
* tst-tls1moda.c: New.
* tst-tls1modb.c: New.
* tst-tls1modc.c: New.
* tst-tls1modd.c: New.
* tst-tls1mode.c: New.
* tst-tls1modf.c: New.
* tst-tls2.sh: New test.
2003-09-02 00:33:28 +00:00
|
|
|
#include <stdint.h>
|
2017-02-16 22:31:42 +00:00
|
|
|
#include <stddef.h>
|
Update.
2003-09-01 Jakub Jelinek <jakub@redhat.com>
* Makefile (tests): Add tst-tls1.
(module-names): Add tst-tls1mod{,a,b,c,d,e,f}.
($(objpfx)tst-tls1mod{,a,b,c,d,e,f}.so-no-z-defs): Set to yes.
($(objpfx)tst-tls1): New.
($(objpfx)tst-tls2.out): Likewise.
(tests): Depend on $(objpfx)tst-tls2.out.
* tst-tls1.c: New test.
* tst-tls1.h: New.
* tst-tls1mod.c: New.
* tst-tls1moda.c: New.
* tst-tls1modb.c: New.
* tst-tls1modc.c: New.
* tst-tls1modd.c: New.
* tst-tls1mode.c: New.
* tst-tls1modf.c: New.
* tst-tls2.sh: New test.
2003-09-02 00:33:28 +00:00
|
|
|
|
|
|
|
struct tls_obj
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
uintptr_t addr;
|
|
|
|
size_t size;
|
|
|
|
size_t align;
|
|
|
|
};
|
|
|
|
extern struct tls_obj tls_registry[];
|
|
|
|
|
|
|
|
#define TLS_REGISTER(x) \
|
|
|
|
static void __attribute__((constructor)) \
|
|
|
|
tls_register_##x (void) \
|
|
|
|
{ \
|
|
|
|
size_t i; \
|
|
|
|
for (i = 0; tls_registry[i].name; ++i); \
|
|
|
|
tls_registry[i].name = #x; \
|
|
|
|
tls_registry[i].addr = (uintptr_t) &x; \
|
|
|
|
tls_registry[i].size = sizeof (x); \
|
|
|
|
tls_registry[i].align = __alignof__ (x); \
|
|
|
|
}
|