1 #include "tst-tls10.h" 2 3 __thread int dummy __attribute__((visibility ("hidden"))) = 12; 4 __thread struct A a1 = { 4, 5, 6 }; 5 __thread struct A a3 __attribute__((tls_model("initial-exec"))) 6 = { 10, 11, 12 }; 7 extern __thread struct A a4 __attribute__((tls_model("initial-exec"))); 8 static __thread struct A local1 = { 16, 17, 18 }; 9 static __thread struct A local2 __attribute__((tls_model("initial-exec"))) 10 = { 19, 20, 21 }; 11 12 void check1(void)13check1 (void) 14 { 15 if (a1.a != 4 || a1.b != 5 || a1.c != 6) 16 abort (); 17 if (a2.a != 22 || a2.b != 23 || a2.c != 24) 18 abort (); 19 if (a3.a != 10 || a3.b != 11 || a3.c != 12) 20 abort (); 21 if (a4.a != 25 || a4.b != 26 || a4.c != 27) 22 abort (); 23 if (local1.a != 16 || local1.b != 17 || local1.c != 18) 24 abort (); 25 if (local2.a != 19 || local2.b != 20 || local2.c != 21) 26 abort (); 27 } 28 29 struct A * f1a(void)30f1a (void) 31 { 32 return &a1; 33 } 34 35 struct A * f2a(void)36f2a (void) 37 { 38 return &a2; 39 } 40 41 struct A * f3a(void)42f3a (void) 43 { 44 return &a3; 45 } 46 47 struct A * f4a(void)48f4a (void) 49 { 50 return &a4; 51 } 52 53 struct A * f5a(void)54f5a (void) 55 { 56 return &local1; 57 } 58 59 struct A * f6a(void)60f6a (void) 61 { 62 return &local2; 63 } 64 65 int f1b(void)66f1b (void) 67 { 68 return a1.a; 69 } 70 71 int f2b(void)72f2b (void) 73 { 74 return a2.b; 75 } 76 77 int f3b(void)78f3b (void) 79 { 80 return a3.c; 81 } 82 83 int f4b(void)84f4b (void) 85 { 86 return a4.a; 87 } 88 89 int f5b(void)90f5b (void) 91 { 92 return local1.b; 93 } 94 95 int f6b(void)96f6b (void) 97 { 98 return local2.c; 99 } 100