| 1 |
/* Test non-duplication of tlscall insn */ |
| 2 |
|
| 3 |
/* { dg-do assemble } */ |
| 4 |
/* { dg-options "-O2 -fPIC -mtls-dialect=gnu2" } */ |
| 5 |
/* { dg-require-effective-target fpic } */ |
| 6 |
/* { dg-skip-if "FDPIC does not support gnu2 TLS dialect" { arm*-*-uclinuxfdpiceabi } "*" "" } */ |
| 7 |
/* { dg-skip-if "-mpure-code and -fPIC incompatible" { *-*-* } { "-mpure-code" } } */ |
| 8 |
|
| 9 |
typedef struct _IO_FILE FILE; |
| 10 |
|
| 11 |
extern int foo(void); |
| 12 |
extern int bar(void); |
| 13 |
|
| 14 |
void uuid__generate_time() |
| 15 |
{ |
| 16 |
static int has_init = 0; |
| 17 |
static __thread int state_fd = -2; |
| 18 |
static __thread FILE *state_f; |
| 19 |
|
| 20 |
if (!has_init) { |
| 21 |
foo(); |
| 22 |
has_init = 1; |
| 23 |
} |
| 24 |
|
| 25 |
if (state_fd == -2) { |
| 26 |
if (!state_f) { |
| 27 |
state_fd = -1; |
| 28 |
} |
| 29 |
} |
| 30 |
if (state_fd >= 0) { |
| 31 |
while (bar() < 0) {} |
| 32 |
} |
| 33 |
|
| 34 |
} |