public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] aarch64: Add DT_RELR tests for ILP32 ABI
@ 2024-06-25 10:09 Szabolcs Nagy
  0 siblings, 0 replies; only message in thread
From: Szabolcs Nagy @ 2024-06-25 10:09 UTC (permalink / raw)
  To: binutils-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=22a8698b561094bd24d0bd620c486463ecceac2c

commit 22a8698b561094bd24d0bd620c486463ecceac2c
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Thu Jun 13 13:40:35 2024 +0100

    aarch64: Add DT_RELR tests for ILP32 ABI

Diff:
---
 binutils/testsuite/lib/binutils-common.exp      |   2 +-
 ld/testsuite/ld-aarch64/aarch64-elf.exp         |   4 +
 ld/testsuite/ld-aarch64/relr-align-ilp32.d      |  23 +++++
 ld/testsuite/ld-aarch64/relr-align-ilp32.s      | 106 ++++++++++++++++++++++++
 ld/testsuite/ld-aarch64/relr-got-pie-ilp32.d    |  16 ++++
 ld/testsuite/ld-aarch64/relr-got-shared-ilp32.d |  16 ++++
 6 files changed, 166 insertions(+), 1 deletion(-)

diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 5bfcde51531..f0136577b6c 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 *-*-*ilp32]))
+	  || [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 dc5eed50bfd..c7d97f3ced9 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -478,6 +478,10 @@ if { [supports_dt_relr] } {
   run_dump_test_lp64 "relr-text-shared"
   run_dump_test_lp64 "relr-discard-pie"
   run_dump_test_lp64 "relr-discard-shared"
+
+  run_dump_test "relr-align-ilp32"
+  run_dump_test "relr-got-pie-ilp32"
+  run_dump_test "relr-got-shared-ilp32"
 }
 
 if { ![skip_sframe_tests] } {
diff --git a/ld/testsuite/ld-aarch64/relr-align-ilp32.d b/ld/testsuite/ld-aarch64/relr-align-ilp32.d
new file mode 100644
index 00000000000..d2a5982a3f3
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/relr-align-ilp32.d
@@ -0,0 +1,23 @@
+#source: relr-align-ilp32.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -shared -z pack-relative-relocs -T relocs-ilp32.ld
+#readelf: -rW
+
+Relocation section '\.rela\.dyn' at offset 0x1.* contains 3 entries:
+ Offset     Info    Type                Sym. Value  Symbol's Name \+ Addend
+12340009  000000b7 R_AARCH64_P32_RELATIVE            10000
+1234000d  000000b7 R_AARCH64_P32_RELATIVE            10000
+12340025  000000b7 R_AARCH64_P32_RELATIVE            10000
+
+Relocation section '\.relr\.dyn' at offset 0x1.* contains 10 entries which relocate 10 locations:
+Index: Entry    Address   Symbolic Address
+0000:  12340000 12340000  double_0
+0001:  00000003 12340004  double_0 \+ 0x4
+0002:  12340012 12340012  double_2
+0003:  00000003 12340016  double_2 \+ 0x4
+0004:  12340020 12340020  single_0
+0005:  1234002a 1234002a  single_2
+0006:  12340034 12340034  big
+0007:  123400b4 123400b4  big \+ 0x80
+0008:  80000001 12340130  big \+ 0xfc
+0009:  00000003 12340134  big \+ 0x100
diff --git a/ld/testsuite/ld-aarch64/relr-align-ilp32.s b/ld/testsuite/ld-aarch64/relr-align-ilp32.s
new file mode 100644
index 00000000000..7e2e084d7cb
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/relr-align-ilp32.s
@@ -0,0 +1,106 @@
+// Test DT_RELR with differently aligned relative relocs.
+
+.text
+.global _start
+_start:
+foo:
+
+.data
+.p2align 3
+double_0:
+.word foo
+.word foo
+.byte 0
+double_1:
+.word foo
+.word foo
+.byte 0
+double_2:
+.word foo
+.word foo
+.byte 0
+.byte 0
+.byte 0
+.byte 0
+.byte 0
+.byte 0
+single_0:
+.word foo
+.byte 0
+single_1:
+.word foo
+.byte 0
+single_2:
+.word foo
+.byte 0
+.byte 0
+.byte 0
+.byte 0
+.byte 0
+.byte 0
+big:
+.word foo
+.word 1
+.word 2
+.word 3
+.word 4
+.word 5
+.word 6
+.word 7
+.word 8
+.word 9
+.word 10
+.word 11
+.word 12
+.word 13
+.word 14
+.word 15
+.word 16
+.word 17
+.word 18
+.word 19
+.word 20
+.word 21
+.word 22
+.word 23
+.word 24
+.word 25
+.word 26
+.word 27
+.word 28
+.word 29
+.word 30
+.word 31
+.word foo + 32
+.word 33
+.word 34
+.word 35
+.word 36
+.word 37
+.word 38
+.word 39
+.word 40
+.word 41
+.word 42
+.word 43
+.word 44
+.word 45
+.word 46
+.word 47
+.word 48
+.word 49
+.word 50
+.word 51
+.word 52
+.word 53
+.word 54
+.word 55
+.word 56
+.word 57
+.word 58
+.word 59
+.word 60
+.word 61
+.word 62
+.word foo + 63
+.word foo + 64
diff --git a/ld/testsuite/ld-aarch64/relr-got-pie-ilp32.d b/ld/testsuite/ld-aarch64/relr-got-pie-ilp32.d
new file mode 100644
index 00000000000..04cb52ef3a2
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/relr-got-pie-ilp32.d
@@ -0,0 +1,16 @@
+#source: relr-got.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -pie -z pack-relative-relocs -T relocs-ilp32.ld
+#readelf: -rW
+
+Relocation section '\.rela\.dyn' at offset 0x1.* contains 2 entries:
+ Offset     Info    Type                Sym\. Value  Symbol's Name \+ Addend
+00000000  .* R_AARCH64_NONE                    0
+00020018  .* R_AARCH64_P32_GLOB_DAT 00000000   sym_weak_undef \+ 0
+
+Relocation section '\.relr\.dyn' at offset 0x1.* contains 2 entries which relocate 4 locations:
+Index: Entry    Address   Symbolic Address
+0000:  00020004 00020004  _GLOBAL_OFFSET_TABLE_ \+ 0x4
+0001:  0000000f 00020008  _GLOBAL_OFFSET_TABLE_ \+ 0x8
+                0002000c  _GLOBAL_OFFSET_TABLE_ \+ 0xc
+                00020010  _GLOBAL_OFFSET_TABLE_ \+ 0x10
diff --git a/ld/testsuite/ld-aarch64/relr-got-shared-ilp32.d b/ld/testsuite/ld-aarch64/relr-got-shared-ilp32.d
new file mode 100644
index 00000000000..b835a0c792e
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/relr-got-shared-ilp32.d
@@ -0,0 +1,16 @@
+#source: relr-got.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -shared -z pack-relative-relocs -T relocs-ilp32.ld
+#readelf: -rW
+
+Relocation section '\.rela\.dyn' at offset 0x1.* contains 3 entries:
+ Offset     Info    Type                Sym. Value  Symbol's Name \+ Addend
+00020010  .* R_AARCH64_P32_GLOB_DAT 00010038   sym_global \+ 0
+00020014  .* R_AARCH64_P32_GLOB_DAT 0000002a   sym_global_abs \+ 0
+00020018  .* R_AARCH64_P32_GLOB_DAT 00000000   sym_weak_undef \+ 0
+
+Relocation section '\.relr\.dyn' at offset 0x1.* contains 2 entries which relocate 3 locations:
+Index: Entry    Address   Symbolic Address
+0000:  00020004 00020004  _GLOBAL_OFFSET_TABLE_ \+ 0x4
+0001:  00000007 00020008  _GLOBAL_OFFSET_TABLE_ \+ 0x8
+                0002000c  _GLOBAL_OFFSET_TABLE_ \+ 0xc

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-06-25 10:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25 10:09 [binutils-gdb] aarch64: Add DT_RELR tests for ILP32 ABI Szabolcs Nagy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).