gcc/testsuite/gcc.target/i386/noplt-gd-2.c
raw| 1 | /* { dg-do run { target *-*-linux* } } */ |
| 2 | /* { dg-options "-O2 -fpic -fno-plt" } */ |
| 3 | /* { dg-additional-sources noplt-gd-1.c } */ |
| 4 | |
| 5 | __thread int gd = 1; |
| 6 | extern void abort (void); |
| 7 | extern int * get_gd (void); |
| 8 | extern void set_gd (int); |
| 9 | extern int test_gd (int); |
| 10 | |
| 11 | int |
| 12 | main () |
| 13 | { |
| 14 | int *p; |
| 15 | |
| 16 | if (gd != 1) |
| 17 | abort (); |
| 18 | |
| 19 | p = get_gd (); |
| 20 | if (*p != gd) |
| 21 | abort (); |
| 22 | |
| 23 | set_gd (4); |
| 24 | if (*p != 4 || !test_gd (4)) |
| 25 | abort (); |
| 26 | |
| 27 | return 0; |
| 28 | } |