Back to index

glibc  2.9
tst-tlsmod4.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 
00008 COMMON_INT_DEF(baz);
00009 
00010 
00011 int
00012 in_dso (int n, int *caller_bazp)
00013 {
00014   int *bazp;
00015   int result = 0;
00016 
00017   puts ("foo");                    /* Make sure PLT is used before macros.  */
00018   asm ("" ::: "memory");
00019 
00020   bazp = TLS_GD (baz);
00021 
00022   if (caller_bazp != NULL && bazp != caller_bazp)
00023     {
00024       printf ("callers address of baz differs: %p vs %p\n", caller_bazp, bazp);
00025       result = 1;
00026     }
00027   else if (*bazp != n)
00028     {
00029       printf ("baz != %d\n", n);
00030       result = 1;
00031     }
00032 
00033   *bazp = 16;
00034 
00035   return result;
00036 }