gcc/testsuite/gcc.target/i386/pie-copyrelocs-4.c
raw| 1 | /* Check that GOTPCREL is used to access glob_a. */ |
| 2 | /* { dg-do compile { target *-*-linux* } } */ |
| 3 | /* { dg-require-effective-target pie_copyreloc } */ |
| 4 | /* { dg-options "-O2 -fpie" } */ |
| 5 | |
| 6 | extern int glob_a __attribute__((weak)); |
| 7 | |
| 8 | int foo () |
| 9 | { |
| 10 | if (&glob_a != 0) |
| 11 | return glob_a; |
| 12 | else |
| 13 | return 0; |
| 14 | } |
| 15 | |
| 16 | /* weak glob_a should be accessed with a GOTPCREL. */ |
| 17 | /* { dg-final { scan-assembler "glob_a@GOTPCREL" { target { ! ia32 } } } } */ |