ld-aarch64: check support before launching dt_relr tests

Message ID 20240607140048.475191-1-chigot@adacore.com
State Committed
Headers
Series ld-aarch64: check support before launching dt_relr tests |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Testing passed

Commit Message

Clément Chigot June 7, 2024, 2 p.m. UTC
  Not all aarch64 targets supports dt_relr as this requires some
mechanisms on the OS side.

Adjust support_dt_relr helper and use it in aarch64-elf.exp.
---
 binutils/testsuite/lib/binutils-common.exp |  3 ++-
 ld/testsuite/ld-aarch64/aarch64-elf.exp    | 20 +++++++++++---------
 2 files changed, 13 insertions(+), 10 deletions(-)
  

Comments

Alan Modra June 7, 2024, 11:06 p.m. UTC | #1
On Fri, Jun 07, 2024 at 04:00:48PM +0200, Clément Chigot wrote:
> Not all aarch64 targets supports dt_relr as this requires some
> mechanisms on the OS side.
> 
> Adjust support_dt_relr helper and use it in aarch64-elf.exp.

Thanks, please apply.
  
Alan Modra June 11, 2024, 11:22 a.m. UTC | #2
On Sat, Jun 08, 2024 at 08:36:49AM +0930, Alan Modra wrote:
> On Fri, Jun 07, 2024 at 04:00:48PM +0200, Clément Chigot wrote:
> > Not all aarch64 targets supports dt_relr as this requires some
> > mechanisms on the OS side.
> > 
> > Adjust support_dt_relr helper and use it in aarch64-elf.exp.
> 
> Thanks, please apply.

Tweak commit db335d7e0a so that support_dt_relr returns false for
aarch64*-*-*ilp32.

diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index bf291d731e2..ebc4c735855 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -473,7 +473,7 @@ proc supports_dt_relr {} {
     if { ([istarget x86_64-*-*]
 	  || [istarget i?86-*-*]
 	  || [istarget powerpc64*-*-*]
-	  || [istarget aarch64*-*-*])
+	  || ([istarget aarch64*-*-*] && ![istarget *-*-*ilp32]))
 	 && ([istarget *-*-linux*]
 	     || [istarget *-*-gnu*]) } {
 	return 1
  
Szabolcs Nagy June 11, 2024, 2:50 p.m. UTC | #3
The 06/11/2024 20:52, Alan Modra wrote:
> On Sat, Jun 08, 2024 at 08:36:49AM +0930, Alan Modra wrote:
> > On Fri, Jun 07, 2024 at 04:00:48PM +0200, Cl�ment Chigot wrote:
> > > Not all aarch64 targets supports dt_relr as this requires some
> > > mechanisms on the OS side.
> > > 
> > > Adjust support_dt_relr helper and use it in aarch64-elf.exp.
> > 
> > Thanks, please apply.
> 
> Tweak commit db335d7e0a so that support_dt_relr returns false for
> aarch64*-*-*ilp32.

thanks.
  

Patch

diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 2fca43bac48..bf291d731e2 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -472,7 +472,8 @@  proc supports_persistent_section {} {
 proc supports_dt_relr {} {
     if { ([istarget x86_64-*-*]
 	  || [istarget i?86-*-*]
-	  || [istarget powerpc64*-*-*])
+	  || [istarget powerpc64*-*-*]
+	  || [istarget aarch64*-*-*])
 	 && ([istarget *-*-linux*]
 	     || [istarget *-*-gnu*]) } {
 	return 1
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index 0e70ca3e028..dc5eed50bfd 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -468,15 +468,17 @@  run_dump_test_lp64 "bti-far-2"
 run_dump_test_lp64 "bti-far-opt"
 run_dump_test_lp64 "bti-far-3"
 
-run_dump_test_lp64 "relr-align"
-run_dump_test_lp64 "relr-data-pie"
-run_dump_test_lp64 "relr-data-shared"
-run_dump_test_lp64 "relr-got-pie"
-run_dump_test_lp64 "relr-got-shared"
-run_dump_test_lp64 "relr-text-pie"
-run_dump_test_lp64 "relr-text-shared"
-run_dump_test_lp64 "relr-discard-pie"
-run_dump_test_lp64 "relr-discard-shared"
+if { [supports_dt_relr] } {
+  run_dump_test_lp64 "relr-align"
+  run_dump_test_lp64 "relr-data-pie"
+  run_dump_test_lp64 "relr-data-shared"
+  run_dump_test_lp64 "relr-got-pie"
+  run_dump_test_lp64 "relr-got-shared"
+  run_dump_test_lp64 "relr-text-pie"
+  run_dump_test_lp64 "relr-text-shared"
+  run_dump_test_lp64 "relr-discard-pie"
+  run_dump_test_lp64 "relr-discard-shared"
+}
 
 if { ![skip_sframe_tests] } {
   run_dump_test "sframe-simple-1"