Back to index

glibc  2.9
tst-tlsmod9.c
Go to the documentation of this file.
00001 #include "tst-tls10.h"
00002 
00003 #ifdef USE_TLS__THREAD
00004 __thread int dummy __attribute__((visibility ("hidden"))) = 12;
00005 __thread struct A a1 = { 4, 5, 6 };
00006 __thread struct A a3 __attribute__((tls_model("initial-exec")))
00007   = { 10, 11, 12 };
00008 extern __thread struct A a4 __attribute__((tls_model("initial-exec")));
00009 static __thread struct A local1 = { 16, 17, 18 };
00010 static __thread struct A local2 __attribute__((tls_model("initial-exec")))
00011   = { 19, 20, 21 };
00012 
00013 void
00014 check1 (void)
00015 {
00016   if (a1.a != 4 || a1.b != 5 || a1.c != 6)
00017     abort ();
00018   if (a2.a != 22 || a2.b != 23 || a2.c != 24)
00019     abort ();
00020   if (a3.a != 10 || a3.b != 11 || a3.c != 12)
00021     abort ();
00022   if (a4.a != 25 || a4.b != 26 || a4.c != 27)
00023     abort ();
00024   if (local1.a != 16 || local1.b != 17 || local1.c != 18)
00025     abort ();
00026   if (local2.a != 19 || local2.b != 20 || local2.c != 21)
00027     abort ();
00028 }
00029 
00030 struct A *
00031 f1a (void)
00032 {
00033   return &a1;
00034 }
00035 
00036 struct A *
00037 f2a (void)
00038 {
00039   return &a2;
00040 }
00041 
00042 struct A *
00043 f3a (void)
00044 {
00045   return &a3;
00046 }
00047 
00048 struct A *
00049 f4a (void)
00050 {
00051   return &a4;
00052 }
00053 
00054 struct A *
00055 f5a (void)
00056 {
00057   return &local1;
00058 }
00059 
00060 struct A *
00061 f6a (void)
00062 {
00063   return &local2;
00064 }
00065 
00066 int
00067 f1b (void)
00068 {
00069   return a1.a;
00070 }
00071 
00072 int
00073 f2b (void)
00074 {
00075   return a2.b;
00076 }
00077 
00078 int
00079 f3b (void)
00080 {
00081   return a3.c;
00082 }
00083 
00084 int
00085 f4b (void)
00086 {
00087   return a4.a;
00088 }
00089 
00090 int
00091 f5b (void)
00092 {
00093   return local1.b;
00094 }
00095 
00096 int
00097 f6b (void)
00098 {
00099   return local2.c;
00100 }
00101 #endif