2002-02-14 15:57:19 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <tls.h>
|
|
|
|
|
|
|
|
#ifdef USE_TLS
|
2002-02-14 18:34:55 +08:00
|
|
|
# include "tls-macros.h"
|
|
|
|
|
2002-02-14 15:57:19 +08:00
|
|
|
extern int in_dso (int n, int *caller_foop);
|
|
|
|
|
|
|
|
COMMON_INT_DEF(comm_n);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
in_dso2 (void)
|
|
|
|
{
|
2002-08-12 14:25:47 +08:00
|
|
|
int *foop;
|
2002-02-14 15:57:19 +08:00
|
|
|
int result = 0;
|
|
|
|
static int n;
|
2002-08-12 14:25:47 +08:00
|
|
|
int *np;
|
|
|
|
|
|
|
|
puts ("foo"); /* Make sure PLT is used before macros. */
|
2002-08-26 06:34:57 +08:00
|
|
|
asm ("" ::: "memory");
|
2002-08-12 14:25:47 +08:00
|
|
|
|
|
|
|
foop = TLS_GD (foo);
|
|
|
|
np = TLS_GD (comm_n);
|
2002-02-14 15:57:19 +08:00
|
|
|
|
|
|
|
if (n != *np)
|
|
|
|
{
|
|
|
|
printf ("n = %d != comm_n = %d\n", n, *np);
|
|
|
|
result = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
result |= in_dso (*foop = 42 + n++, foop);
|
|
|
|
|
|
|
|
*foop = 16;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
#endif
|