]>
Commit | Line | Data |
---|---|---|
8d84a498 | 1 | /* { dg-do compile } */ |
2 | /* { dg-require-effective-target pie } */ | |
78db4b4d | 3 | /* { dg-options "-O2 -fpie" } */ |
4 | ||
5 | /* Weak initialized symbol with -fpie. */ | |
6 | __attribute__((weak)) | |
7 | int xxx = -1; | |
8 | ||
9 | int | |
10 | foo () | |
11 | { | |
12 | return xxx; | |
13 | } | |
14 | ||
5f53d1f4 | 15 | /* { dg-final { scan-assembler "movl\[ \t\]xxx\\(%rip\\), %eax" { target { { ! ia32 } && { ! *-*-darwin* } } } } } */ |
16 | /* { dg-final { scan-assembler-not "xxx@GOTPCREL" { target { { ! ia32 } && { ! *-*-darwin* } } } } } */ | |
17 | ||
18 | /* For Darwin m64, code is always PIC but we need to indirect through the GOT to allow | |
19 | weak symbols to be interposed. The dynamic loader knows how to apply PIE to this. */ | |
20 | /* { dg-final { scan-assembler {movq[ \t]_xxx@GOTPCREL\(%rip\),[ \t]%rax} { target { { ! ia32 } && *-*-darwin* } } } } */ | |
21 | ||
22 | /* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ | |
23 | /* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ | |
24 | ||
25 | /* Darwin m32 equivalent (indirect and PIC). */ | |
26 | /* { dg-final { scan-assembler {movl[ \t]l_xxx\$non_lazy_ptr-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ |