From 2e776effa260a42bb825ecaeac8866ea54532df4 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sun, 26 May 2019 19:35:14 +0000 Subject: [PATCH] darwin, x86, testsuite - Amend three PIE tests, Darwin requires PIC code in order to support PIE, amend the test scan-asms to match this. 2019-05-26 Iain Sandoe * gcc.target/i386/pr39013-1.c: Adjust scan-asms for PIE to account for PIC code on Darwin. * gcc.target/i386/pr39013-2.c: Likewise. * gcc.target/i386/pr64317.c: Likewise. From-SVN: r271634 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.target/i386/pr39013-1.c | 8 ++++++-- gcc/testsuite/gcc.target/i386/pr39013-2.c | 8 ++++++-- gcc/testsuite/gcc.target/i386/pr64317.c | 11 ++++++++--- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1866afe21bc..fe3b4d96217 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2019-05-26 Iain Sandoe + + * gcc.target/i386/pr39013-1.c: Adjust scan-asms for PIE to + account for PIC code on Darwin. + * gcc.target/i386/pr39013-2.c: Likewise. + * gcc.target/i386/pr64317.c: Likewise. + 2019-05-25 Iain Sandoe * gcc.target/i386/pr59874-3.c: Use the spelling of popcnt diff --git a/gcc/testsuite/gcc.target/i386/pr39013-1.c b/gcc/testsuite/gcc.target/i386/pr39013-1.c index ac22746772b..78b17028a11 100644 --- a/gcc/testsuite/gcc.target/i386/pr39013-1.c +++ b/gcc/testsuite/gcc.target/i386/pr39013-1.c @@ -12,5 +12,9 @@ main (void) return foo () + bar (); } -/* { dg-final { scan-assembler "foo@PLT" } } */ -/* { dg-final { scan-assembler "bar@PLT" } } */ +/* { dg-final { scan-assembler "foo@PLT" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "bar@PLT" { target { ! *-*-darwin* } } } } */ + +/* Darwin's dynamic linker does PIE without indirection. */ +/* { dg-final { scan-assembler {call[ \t]_foo} { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler {call[ \t]_bar} { target *-*-darwin* } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr39013-2.c b/gcc/testsuite/gcc.target/i386/pr39013-2.c index 3040d81a44d..f4412909bfe 100644 --- a/gcc/testsuite/gcc.target/i386/pr39013-2.c +++ b/gcc/testsuite/gcc.target/i386/pr39013-2.c @@ -12,5 +12,9 @@ main (void) return foo () + bar (); } -/* { dg-final { scan-assembler "foo@PLT" } } */ -/* { dg-final { scan-assembler "bar@PLT" } } */ +/* { dg-final { scan-assembler "foo@PLT" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "bar@PLT" { target { ! *-*-darwin* } } } } */ + +/* Darwin's dynamic linker does PIE without indirection. */ +/* { dg-final { scan-assembler {call[ \t]_foo} { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler {call[ \t]_bar} { target *-*-darwin* } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr64317.c b/gcc/testsuite/gcc.target/i386/pr64317.c index 9e13da63885..3fbdccd36f2 100644 --- a/gcc/testsuite/gcc.target/i386/pr64317.c +++ b/gcc/testsuite/gcc.target/i386/pr64317.c @@ -2,9 +2,14 @@ /* { dg-require-effective-target ia32 } */ /* { dg-require-effective-target pie } */ /* { dg-options "-O2 -fpie" } */ -/* { dg-final { scan-assembler "addl\[ \\t\]+\[$\]_GLOBAL_OFFSET_TABLE_, %ebx" } } */ -/* { dg-final { scan-assembler "movl\[ \\t\]+c@GOTOFF\[(\]%ebx\[)\]" } } */ -/* { dg-final { scan-assembler-not "movl\[ \\t\]+\[0-9]+\[(\]%esp\[)\], %ebx" } } */ +/* { dg-final { scan-assembler "addl\[ \\t\]+\[$\]_GLOBAL_OFFSET_TABLE_, %ebx" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "movl\[ \\t\]+c@GOTOFF\[(\]%ebx\[)\]" { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-not "movl\[ \\t\]+\[0-9]+\[(\]%esp\[)\], %ebx" { target { ! *-*-darwin* } } } } */ + +/* Check PIC access to c and t1 on Darwin (PIC is default, needed for PIE). */ +/* { dg-final { scan-assembler {_c-L1\$pb\(%} { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler {_t1.[0-9]+-L1\$pb\(%} { target *-*-darwin* } } } */ + long c = 1; int bar(); -- 2.30.2