aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-4.c
blob: 413cdf381c3a1ba6546ba21c0445b11b73f3748d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* Check that GOTPCREL is used to access glob_a.  */
/* { dg-do compile { target *-*-linux* } } */
/* { dg-require-effective-target pie_copyreloc } */
/* { dg-options "-O2 -fpie" } */

extern int glob_a  __attribute__((weak));

int foo ()
{
  if (&glob_a != 0)
    return glob_a;
  else
    return 0;
}

/* weak glob_a should be accessed with a GOTPCREL.  */
/* { dg-final { scan-assembler "glob_a@GOTPCREL" { target { ! ia32 } } } } */