libio: Fix fmemopen append mode failure (BZ# 20012)
[glibc.git] / elf / tst-tlsmod2.c
blob40eb1407f864f64aba34e5307fbd5426554aff61
1 #include <stdio.h>
3 #include "tls-macros.h"
6 COMMON_INT_DEF(foo);
9 int
10 in_dso (int n, int *caller_foop)
12 int *foop;
13 int result = 0;
15 puts ("foo"); /* Make sure PLT is used before macros. */
16 asm ("" ::: "memory");
18 foop = TLS_GD (foo);
20 if (caller_foop != NULL && foop != caller_foop)
22 printf ("callers address of foo differs: %p vs %p\n", caller_foop, foop);
23 result = 1;
25 else if (*foop != n)
27 printf ("foo != %d\n", n);
28 result = 1;
31 *foop = 16;
33 return result;