]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.target/i386/pr32219-7.c
darwin, testsuite - fix PR 67958
[thirdparty/gcc.git] / gcc / testsuite / gcc.target / i386 / pr32219-7.c
CommitLineData
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))
7int xxx = -1;
8
9int
10foo ()
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* } } } } */