]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/test/tls/tst-tlsmod3.c
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / test / tls / tst-tlsmod3.c
1 #include <stdio.h>
2
3 #include <tls.h>
4
5 #ifdef USE_TLS
6 # include "tls-macros.h"
7
8 extern int in_dso (int n, int *caller_foop);
9
10 COMMON_INT_DEF(comm_n);
11
12
13
14
15 int
16 in_dso2 (void)
17 {
18   int *foop;
19   int result = 0;
20   static int n;
21   int *np;
22
23   puts ("foo");                 /* Make sure PLT is used before macros.  */
24   __asm__ ("" ::: "memory");
25
26   foop = TLS_GD (foo);
27   np = TLS_GD (comm_n);
28
29   if (n != *np)
30     {
31       printf ("n = %d != comm_n = %d\n", n, *np);
32       result = 1;
33     }
34
35   result |= in_dso (*foop = 42 + n++, foop);
36
37   *foop = 16;
38
39   return result;
40 }
41 #endif