NPTL/arc: notify kernel of the TP value
[uClibc.git] / test / tls / tst-tlsmod-at-ctor.c
blobbd04b50814142cae349f719be5c5bbc2713876aa
1 #include <stdio.h>
2 #include <tls.h>
4 #define TLS_VAR_INIT_VALUE 99
6 #ifdef USE_TLS
7 __thread int tls_var __attribute__((tls_model("global-dynamic")));
8 static __thread int local_tls_var __attribute__((tls_model("local-dynamic")));
9 #endif
11 void __attribute__((constructor)) libtls_ctor(void);
12 void libtls_ctor(void)
14 printf("libtls: constructor!\n");
15 #ifdef USE_TLS
16 local_tls_var = TLS_VAR_INIT_VALUE;
17 tls_var = local_tls_var;
18 #endif
21 void __attribute__((destructor)) libtls_dtor(void);
22 void libtls_dtor(void)
24 printf("libtls: destructor!\n");