1  /* { dg-do compile } */
       2  /* { dg-require-effective-target pie } */
       3  /* { dg-options "-O2 -fpie" } */
       4  
       5  /* Initialized common symbol with -fpie.  */
       6  int xxx = 5;
       7  int xxx;
       8  
       9  int
      10  foo ()
      11  {
      12    return xxx;
      13  }
      14  
      15  /* { dg-final { scan-assembler {movl[ \t]_?xxx\(%rip\),[ \t]%eax} { target { ! ia32 } } } } */
      16  /* { dg-final { scan-assembler-not "_?xxx@GOTPCREL" { target { ! ia32 } } } } */
      17  
      18  /* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */
      19  /* { dg-final { scan-assembler-not "movl\[ \t\]_?xxx@GOT\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */
      20  
      21  /* For Darwin, we default to PIC - but that's needed for Darwin's PIE.  */
      22  /* { dg-final { scan-assembler {movl[ \t]_xxx-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */