1 #include <stdio.h> 2 3 4 __thread int baz; 5 6 7 int in_dso(int n,int * caller_bazp)8in_dso (int n, int *caller_bazp) 9 { 10 int *bazp; 11 int result = 0; 12 13 puts ("foo"); /* Make sure PLT is used before macros. */ 14 asm ("" ::: "memory"); 15 16 bazp = &baz; 17 18 if (caller_bazp != NULL && bazp != caller_bazp) 19 { 20 printf ("callers address of baz differs: %p vs %p\n", caller_bazp, bazp); 21 result = 1; 22 } 23 else if (*bazp != n) 24 { 25 printf ("baz != %d\n", n); 26 result = 1; 27 } 28 29 *bazp = 16; 30 31 return result; 32 } 33