mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 21:40:12 +00: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
573 B
C
39 lines
573 B
C
#include <stdio.h>
|
|
|
|
#include <tls.h>
|
|
|
|
#ifdef USE_TLS
|
|
#include "tls-macros.h"
|
|
|
|
|
|
COMMON_INT_DEF(foo);
|
|
|
|
|
|
int
|
|
in_dso (int n, int *caller_foop)
|
|
{
|
|
int *foop;
|
|
int result = 0;
|
|
|
|
puts ("foo"); /* Make sure PLT is used before macros. */
|
|
asm ("" ::: "memory");
|
|
|
|
foop = TLS_GD (foo);
|
|
|
|
if (caller_foop != NULL && foop != caller_foop)
|
|
{
|
|
printf ("callers address of foo differs: %p vs %p\n", caller_foop, foop);
|
|
result = 1;
|
|
}
|
|
else if (*foop != n)
|
|
{
|
|
printf ("foo != %d\n", n);
|
|
result = 1;
|
|
}
|
|
|
|
*foop = 16;
|
|
|
|
return result;
|
|
}
|
|
#endif
|