glibc/elf/tst-tlsmod4.c
Roland McGrath e6f526809d * elf/tst-tlsmod4.c (in_dso): Insert a random library call before use
of the TLS macros, otherwise the compiler might not have initialized
	the PIC register yet when we use the PLT via asm.
	* elf/tst-tlsmod3.c (in_dso2): Likewise.
	* elf/tst-tlsmod2.c (in_dso): Likewise.
2002-08-12 06:25:47 +00:00

38 lines
549 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. */
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