Last change
on this file was 2036, checked in by bird, 20 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
559 bytes
|
Line | |
---|
1 | #include <stdint.h>
|
---|
2 | #include <stdlib.h>
|
---|
3 | #include <tls.h>
|
---|
4 |
|
---|
5 | #if USE_TLS && HAVE___THREAD
|
---|
6 |
|
---|
7 | struct tls_obj
|
---|
8 | {
|
---|
9 | const char *name;
|
---|
10 | uintptr_t addr;
|
---|
11 | size_t size;
|
---|
12 | size_t align;
|
---|
13 | };
|
---|
14 | extern struct tls_obj tls_registry[];
|
---|
15 |
|
---|
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); \
|
---|
26 | }
|
---|
27 |
|
---|
28 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.