[BZ #5184]
[glibc.git] / elf / tst-tlsmod9.c
blobe124144e478814886ac9e94389b7ecda11fc1040
1 #include "tst-tls10.h"
3 #ifdef USE_TLS__THREAD
4 __thread int dummy __attribute__((visibility ("hidden"))) = 12;
5 __thread struct A a1 = { 4, 5, 6 };
6 __thread struct A a3 __attribute__((tls_model("initial-exec")))
7 = { 10, 11, 12 };
8 extern __thread struct A a4 __attribute__((tls_model("initial-exec")));
9 static __thread struct A local1 = { 16, 17, 18 };
10 static __thread struct A local2 __attribute__((tls_model("initial-exec")))
11 = { 19, 20, 21 };
13 void
14 check1 (void)
16 if (a1.a != 4 || a1.b != 5 || a1.c != 6)
17 abort ();
18 if (a2.a != 22 || a2.b != 23 || a2.c != 24)
19 abort ();
20 if (a3.a != 10 || a3.b != 11 || a3.c != 12)
21 abort ();
22 if (a4.a != 25 || a4.b != 26 || a4.c != 27)
23 abort ();
24 if (local1.a != 16 || local1.b != 17 || local1.c != 18)
25 abort ();
26 if (local2.a != 19 || local2.b != 20 || local2.c != 21)
27 abort ();
30 struct A *
31 f1a (void)
33 return &a1;
36 struct A *
37 f2a (void)
39 return &a2;
42 struct A *
43 f3a (void)
45 return &a3;
48 struct A *
49 f4a (void)
51 return &a4;
54 struct A *
55 f5a (void)
57 return &local1;
60 struct A *
61 f6a (void)
63 return &local2;
66 int
67 f1b (void)
69 return a1.a;
72 int
73 f2b (void)
75 return a2.b;
78 int
79 f3b (void)
81 return a3.c;
84 int
85 f4b (void)
87 return a4.a;
90 int
91 f5b (void)
93 return local1.b;
96 int
97 f6b (void)
99 return local2.c;
101 #endif