2002-02-14 15:57:19 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2002-02-14 18:34:55 +08:00
|
|
|
|
2002-02-14 15:57:19 +08:00
|
|
|
extern int in_dso (int n, int *caller_foop);
|
|
|
|
|
2021-08-17 00:59:30 +08:00
|
|
|
extern __thread int foo;
|
|
|
|
__thread int comm_n;
|
2002-02-14 15:57:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2021-08-17 00:59:30 +08:00
|
|
|
foop = &foo;
|
|
|
|
np = &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;
|
|
|
|
}
|