source: vendor/glibc-tests/2005-06-14/elf/tst-tlsmod9.c

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: 1.3 KB
Line 
1#include "tst-tls10.h"
2
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 };
8extern __thread struct A a4 __attribute__((tls_model("initial-exec")));
9static __thread struct A local1 = { 16, 17, 18 };
10static __thread struct A local2 __attribute__((tls_model("initial-exec")))
11 = { 19, 20, 21 };
12
13void
14check1 (void)
15{
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 ();
28}
29
30struct A *
31f1a (void)
32{
33 return &a1;
34}
35
36struct A *
37f2a (void)
38{
39 return &a2;
40}
41
42struct A *
43f3a (void)
44{
45 return &a3;
46}
47
48struct A *
49f4a (void)
50{
51 return &a4;
52}
53
54struct A *
55f5a (void)
56{
57 return &local1;
58}
59
60struct A *
61f6a (void)
62{
63 return &local2;
64}
65
66int
67f1b (void)
68{
69 return a1.a;
70}
71
72int
73f2b (void)
74{
75 return a2.b;
76}
77
78int
79f3b (void)
80{
81 return a3.c;
82}
83
84int
85f4b (void)
86{
87 return a4.a;
88}
89
90int
91f5b (void)
92{
93 return local1.b;
94}
95
96int
97f6b (void)
98{
99 return local2.c;
100}
101#endif
Note: See TracBrowser for help on using the repository browser.