1 /* { dg-do compile } */
2 /* { dg-require-effective-target pie } */
3 /* { dg-options "-O2 -fpic" } */
4 
5 /* Weak common symbol with -fpic.  */
6 __attribute__((weak))
7 int xxx;
8 
9 int
foo()10 foo ()
11 {
12   return xxx;
13 }
14 
15 /* { dg-final { scan-assembler-not "movl\[ \t\]xxx\\(%rip\\), %" { target { ! ia32 } } } } */
16 /* Darwin is always PIC for PIE so no change, weak symbols need to be indirect and this
17    happens to match the ELF case.  */
18 /* { dg-final { scan-assembler "xxx@GOTPCREL" { target { ! ia32 } } } } */
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 equivalent (indirect and PIC).  */
24 /* { dg-final { scan-assembler {movl[ \t][Ll]_xxx\$non_lazy_ptr-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */
25