mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-25 10:43:34 +08:00
046b40694f
2002-08-25 Ulrich Drepper <drepper@redhat.com> * elf/tst-tlsmod1.c (in_dso): Make sure the TLS variable access is not moved ahead of the fputs call. * elf/tst-tlsmod2.c (in_dso): Likewise. * elf/tst-tlsmod3.c (in_dso2): Likewise. * elf/tst-tlsmod4.c (in_dso): Likewise.
39 lines
574 B
C
39 lines
574 B
C
#include <stdio.h>
|
|
|
|
#include <tls.h>
|
|
|
|
#ifdef USE_TLS
|
|
# include "tls-macros.h"
|
|
|
|
|
|
COMMON_INT_DEF(baz);
|
|
|
|
|
|
int
|
|
in_dso (int n, int *caller_bazp)
|
|
{
|
|
int *bazp;
|
|
int result = 0;
|
|
|
|
puts ("foo"); /* Make sure PLT is used before macros. */
|
|
asm ("" ::: "memory");
|
|
|
|
bazp = TLS_GD (baz);
|
|
|
|
if (caller_bazp != NULL && bazp != caller_bazp)
|
|
{
|
|
printf ("callers address of baz differs: %p vs %p\n", caller_bazp, bazp);
|
|
result = 1;
|
|
}
|
|
else if (*bazp != n)
|
|
{
|
|
printf ("baz != %d\n", n);
|
|
result = 1;
|
|
}
|
|
|
|
*bazp = 16;
|
|
|
|
return result;
|
|
}
|
|
#endif
|