Back to index

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