[testsuite] fix pr70321.c PIC expectations

Message ID orttculd7w.fsf@lxoliva.fsfla.org
State Committed
Commit d17a2e8bfc91a8e401a2d8c61e23fba36e28a43d
Headers
Series [testsuite] fix pr70321.c PIC expectations |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 success Test passed

Commit Message

Alexandre Oliva Oct. 29, 2024, 11:08 p.m. UTC
  When we select a non-bx get_pc_thunk, we get an extra mov to set up
the PIC register before the abort call.  Expect that mov or a
get_pc_thunk.bx call.

Regstrapped on x86_64-linux-gnu; also tested on i686-linux-gnu with
-fPIE.  Ok to install?


for  gcc/testsuite/ChangeLog

	* gcc.target/i386/pr70321.c: Cope with non-bx get_pc_thunk.
---
 gcc/testsuite/gcc.target/i386/pr70321.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Mike Stump Nov. 4, 2024, 9:53 p.m. UTC | #1
On Oct 29, 2024, at 4:08 PM, Alexandre Oliva <oliva@adacore.com> wrote:
> 
> When we select a non-bx get_pc_thunk, we get an extra mov to set up
> the PIC register before the abort call.  Expect that mov or a
> get_pc_thunk.bx call.
> 
> Regstrapped on x86_64-linux-gnu; also tested on i686-linux-gnu with
> -fPIE.  Ok to install?

Ok.  Usually I leave view to target folks for target specific changes that are well understood by target on well maintained targets.

Target folks sometimes want to weigh in with obscure stuff.

> for  gcc/testsuite/ChangeLog
> 
> 	* gcc.target/i386/pr70321.c: Cope with non-bx get_pc_thunk.
> ---
> gcc/testsuite/gcc.target/i386/pr70321.c |    6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/gcc/testsuite/gcc.target/i386/pr70321.c b/gcc/testsuite/gcc.target/i386/pr70321.c
> index 58f5f5661c7a2..287b7da1b9501 100644
> --- a/gcc/testsuite/gcc.target/i386/pr70321.c
> +++ b/gcc/testsuite/gcc.target/i386/pr70321.c
> @@ -9,4 +9,8 @@ void foo (long long ixi)
> 
> /* { dg-final { scan-assembler-times "mov" 1 { target nonpic } } } */
> /* get_pc_thunk adds an extra mov insn.  */
> -/* { dg-final { scan-assembler-times "mov" 2 { target { ! nonpic } } } } */
> +/* Choosing a non-bx get_pc_thunk requires another mov before the abort call.
> +   So we require a match of either that mov or the get_pc_thunk.bx call, in
> +   addition to the other 2 movs.  (Hopefully there won't be more calls for a
> +   false positive.)  */
> +/* { dg-final { scan-assembler-times "mov|call\[^\n\r]*get_pc_thunk\.bx" 3 { target { ! nonpic } } } } */
  

Patch

diff --git a/gcc/testsuite/gcc.target/i386/pr70321.c b/gcc/testsuite/gcc.target/i386/pr70321.c
index 58f5f5661c7a2..287b7da1b9501 100644
--- a/gcc/testsuite/gcc.target/i386/pr70321.c
+++ b/gcc/testsuite/gcc.target/i386/pr70321.c
@@ -9,4 +9,8 @@  void foo (long long ixi)
 
 /* { dg-final { scan-assembler-times "mov" 1 { target nonpic } } } */
 /* get_pc_thunk adds an extra mov insn.  */
-/* { dg-final { scan-assembler-times "mov" 2 { target { ! nonpic } } } } */
+/* Choosing a non-bx get_pc_thunk requires another mov before the abort call.
+   So we require a match of either that mov or the get_pc_thunk.bx call, in
+   addition to the other 2 movs.  (Hopefully there won't be more calls for a
+   false positive.)  */
+/* { dg-final { scan-assembler-times "mov|call\[^\n\r]*get_pc_thunk\.bx" 3 { target { ! nonpic } } } } */