Back to index

glibc  2.9
tst-tlsmod3.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 
00003 #include <tls.h>
00004 
00005 #include "tls-macros.h"
00006 
00007 extern int in_dso (int n, int *caller_foop);
00008 
00009 COMMON_INT_DEF(comm_n);
00010 
00011 
00012 
00013 
00014 int
00015 in_dso2 (void)
00016 {
00017   int *foop;
00018   int result = 0;
00019   static int n;
00020   int *np;
00021 
00022   puts ("foo");                    /* Make sure PLT is used before macros.  */
00023   asm ("" ::: "memory");
00024 
00025   foop = TLS_GD (foo);
00026   np = TLS_GD (comm_n);
00027 
00028   if (n != *np)
00029     {
00030       printf ("n = %d != comm_n = %d\n", n, *np);
00031       result = 1;
00032     }
00033 
00034   result |= in_dso (*foop = 42 + n++, foop);
00035 
00036   *foop = 16;
00037 
00038   return result;
00039 }