From: Iain Sandoe Date: Sun, 4 Aug 2019 10:06:33 +0000 (+0000) Subject: Darwin, X86, backport testsuite fix for 67958. X-Git-Tag: releases/gcc-9.2.0~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27eb6799718407070649d2784d40a04b57e7210f;p=thirdparty%2Fgcc.git Darwin, X86, backport testsuite fix for 67958. 2019-08-04 Iain Sandoe Backport from mainline. 2019-05-21 Iain Sandoe PR testsuite/67958 * gcc.target/i386/pr32219-1.c: Adjust scan-asms for Darwin, comment the differences. * gcc.target/i386/pr32219-2.c: Likewise. * gcc.target/i386/pr32219-3.c: Likewise. * gcc.target/i386/pr32219-4.c: Likewise. * gcc.target/i386/pr32219-5.c: Likewise. * gcc.target/i386/pr32219-6.c: Likewise. * gcc.target/i386/pr32219-7.c: Likewise. * gcc.target/i386/pr32219-8.c: Likewise. From-SVN: r274060 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4001043be8cc..172755ffe1ef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,19 @@ +2019-08-04 Iain Sandoe + + Backport from mainline. + 2019-05-21 Iain Sandoe + + PR testsuite/67958 + * gcc.target/i386/pr32219-1.c: Adjust scan-asms for Darwin, comment + the differences. + * gcc.target/i386/pr32219-2.c: Likewise. + * gcc.target/i386/pr32219-3.c: Likewise. + * gcc.target/i386/pr32219-4.c: Likewise. + * gcc.target/i386/pr32219-5.c: Likewise. + * gcc.target/i386/pr32219-6.c: Likewise. + * gcc.target/i386/pr32219-7.c: Likewise. + * gcc.target/i386/pr32219-8.c: Likewise. + 2019-08-04 Iain Sandoe Backport from mainline. diff --git a/gcc/testsuite/gcc.target/i386/pr32219-1.c b/gcc/testsuite/gcc.target/i386/pr32219-1.c index bb28f9f0f586..0fcb138695bb 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-1.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-1.c @@ -12,7 +12,11 @@ foo () return xxx; } -/* { dg-final { scan-assembler "movl\[ \t\]xxx\\(%rip\\), %eax" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target ia32 } } } */ +/* { dg-final { scan-assembler {movl[ \t]_?xxx\(%rip\),[ \t]%eax} { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler-not "_?xxx@GOTPCREL" { target { ! ia32 } } } } */ + +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-not "movl\[ \t\]_?xxx@GOT\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* For Darwin, we default to PIC - but that's needed for Darwin's PIE. */ +/* { dg-final { scan-assembler {movl[ \t]_xxx-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr32219-2.c b/gcc/testsuite/gcc.target/i386/pr32219-2.c index b30862d2488e..cb587db47aaf 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-2.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-2.c @@ -12,6 +12,13 @@ foo () } /* { dg-final { scan-assembler-not "movl\[ \t\]xxx\\(%rip\\), %" { target { ! ia32 } } } } */ +/* For Darwin m64 we are always PIC, but common symbols are indirected, which happens to + match the general "ELF" case. */ /* { dg-final { scan-assembler "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target ia32 } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target ia32 } } } */ + +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* Darwin m32 defaults to PIC but common symbols need to be indirected. */ +/* { dg-final { scan-assembler {movl[ \t]l_xxx\$non_lazy_ptr-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ + diff --git a/gcc/testsuite/gcc.target/i386/pr32219-3.c b/gcc/testsuite/gcc.target/i386/pr32219-3.c index 657fb7831f0d..f9cfca7d72c5 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-3.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-3.c @@ -12,7 +12,16 @@ foo () return xxx; } -/* { dg-final { scan-assembler "movl\[ \t\]xxx\\(%rip\\), %eax" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target ia32 } } } */ +/* { dg-final { scan-assembler {movl[ \t]xxx\(%rip\),[ \t]%eax} { target { { ! ia32 } && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-not "xxx@GOTPCREL" { target { { ! ia32 } && { ! *-*-darwin* } } } } } */ + +/* For Darwin m64, code is always PIC and we need to indirect through the GOT to allow + weak symbols to be interposed. The dynamic loader knows how to apply PIE to this. */ +/* { dg-final { scan-assembler {movq[ \t]_xxx@GOTPCREL\(%rip\),[ \t]%rax} { target { { ! ia32 } && *-*-darwin* } } } } */ + +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* For Darwin, we need PIC to allow PIE, but also we must indirect weak symbols so that + they can be indirected. Again, dyld knows how to deal with this. */ +/* { dg-final { scan-assembler {movl[ \t]l_xxx\$non_lazy_ptr-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr32219-4.c b/gcc/testsuite/gcc.target/i386/pr32219-4.c index ff62fa4c0510..0ac0674ae179 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-4.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-4.c @@ -13,6 +13,12 @@ foo () } /* { dg-final { scan-assembler-not "movl\[ \t\]xxx\\(%rip\\), %" { target { ! ia32 } } } } */ +/* Darwin is always PIC for PIE so no change, weak symbols need to be indirect and this + happens to match the ELF case. */ /* { dg-final { scan-assembler "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target ia32 } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target ia32 } } } */ + +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* Darwin m32 equivalent (indirect and PIC). */ +/* { dg-final { scan-assembler {movl[ \t]l_xxx\$non_lazy_ptr-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr32219-5.c b/gcc/testsuite/gcc.target/i386/pr32219-5.c index e8844c85ff08..11496dc86081 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-5.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-5.c @@ -11,7 +11,11 @@ foo () return xxx; } -/* { dg-final { scan-assembler "movl\[ \t\]xxx\\(%rip\\), %eax" { target { ! ia32 } } } } */ +/* { dg-final { scan-assembler "movl\[ \t\]_?xxx\\(%rip\\), %eax" { target { ! ia32 } } } } */ /* { dg-final { scan-assembler-not "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target ia32 } } } */ + +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* For Darwin m32, we need PIC (the default) to allow PIE. */ +/* { dg-final { scan-assembler {movl[ \t]_xxx-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr32219-6.c b/gcc/testsuite/gcc.target/i386/pr32219-6.c index 24e55ae01463..ff41ebd399ec 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-6.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-6.c @@ -11,7 +11,14 @@ foo () return xxx; } -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx\\(%rip\\), %" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target ia32 } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target ia32 } } } */ +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx\\(%rip\\), %" { target { { ! ia32 } && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler "xxx@GOTPCREL" { target { { ! ia32 } && { ! *-*-darwin* } } } } } */ + +/* Darwin m64 is always PIC, and the dynamic linker doesn't need an indirection. */ +/* { dg-final { scan-assembler {movl[ \t]_xxx\(%rip\),[ \t]%eax} { target { { ! ia32 } && *-*-darwin* } } } } */ + +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* Darwin m32 defaults to PIC, so no change. */ +/* { dg-final { scan-assembler {movl[ \t]_xxx-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr32219-7.c b/gcc/testsuite/gcc.target/i386/pr32219-7.c index 9273d3ed9bbe..469e9e38b076 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-7.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-7.c @@ -12,7 +12,15 @@ foo () return xxx; } -/* { dg-final { scan-assembler "movl\[ \t\]xxx\\(%rip\\), %eax" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target ia32 } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target ia32 } } } */ +/* { dg-final { scan-assembler "movl\[ \t\]xxx\\(%rip\\), %eax" { target { { ! ia32 } && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-not "xxx@GOTPCREL" { target { { ! ia32 } && { ! *-*-darwin* } } } } } */ + +/* For Darwin m64, code is always PIC but we need to indirect through the GOT to allow + weak symbols to be interposed. The dynamic loader knows how to apply PIE to this. */ +/* { dg-final { scan-assembler {movq[ \t]_xxx@GOTPCREL\(%rip\),[ \t]%rax} { target { { ! ia32 } && *-*-darwin* } } } } */ + +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %eax" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* Darwin m32 equivalent (indirect and PIC). */ +/* { dg-final { scan-assembler {movl[ \t]l_xxx\$non_lazy_ptr-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr32219-8.c b/gcc/testsuite/gcc.target/i386/pr32219-8.c index c44919509de4..75eb287fc595 100644 --- a/gcc/testsuite/gcc.target/i386/pr32219-8.c +++ b/gcc/testsuite/gcc.target/i386/pr32219-8.c @@ -13,6 +13,12 @@ foo () } /* { dg-final { scan-assembler-not "movl\[ \t\]xxx\\(%rip\\), %" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler "xxx@GOTPCREL" { target { ! ia32 } } } } */ -/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target ia32 } } } */ -/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target ia32 } } } */ +/* Darwin is always PIC so no change, weak symbols needs to be indirect and this + happens to match the ELF case. */ +/* { dg-final { scan-assembler "_?xxx@GOTPCREL" { target { ! ia32 } } } } */ + +/* { dg-final { scan-assembler-not "movl\[ \t\]xxx@GOTOFF\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler "movl\[ \t\]xxx@GOT\\(%\[^,\]*\\), %" { target { ia32 && { ! *-*-darwin* } } } } } */ + +/* Darwin m32 default to PIC but needs indirection for the weak symbol. */ +/* { dg-final { scan-assembler {movl[ \t]l_xxx\$non_lazy_ptr-L1\$pb\(%eax\),[ \t]%eax} { target { ia32 && *-*-darwin* } } } } */