1  /* { dg-do compile } */
       2  /* { dg-require-effective-target pie } */
       3  /* { dg-options "-O2 -fpic" } */
       4  
       5  /* Initialized symbol with -fpic.  */
       6  int xxx = -1;
       7  
       8  int
       9  foo ()
      10  {
      11    return xxx;
      12  }
      13  
      14  /* { dg-final { scan-assembler-not "movl\[ \t\]xxx\\(%rip\\), %" { target { { ! ia32 } && { ! *-*-darwin* } } } } } */
      15  /* { dg-final { scan-assembler "xxx@GOTPCREL" { target { { ! ia32 } && { ! *-*-darwin* } } } } } */
      16  
      17  /* Darwin m64 is always PIC, and the dynamic linker doesn't need an indirection.  */
      18  /* { dg-final { scan-assembler {movl[ \t]_xxx\(%rip\),[ \t]%eax} { target { { ! ia32 } && *-*-darwin* } } } } */
      19  
      20  /* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */
      21  /* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */
      22  
      23  /* Darwin m32 defaults to PIC, so no change.  */
      24  /* { dg-final { scan-assembler {movl[ \t]_xxx-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */