aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2024-06-13 13:40:35 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2024-06-25 11:07:51 +0100
commit22a8698b561094bd24d0bd620c486463ecceac2c (patch)
tree0e124be26e3261332510a26333e095aa87c6855c
parentc9cf7bdfe53a5c8446f8dc6e6f1bafa4c3636f59 (diff)
downloadgdb-22a8698b561094bd24d0bd620c486463ecceac2c.zip
gdb-22a8698b561094bd24d0bd620c486463ecceac2c.tar.gz
gdb-22a8698b561094bd24d0bd620c486463ecceac2c.tar.bz2
aarch64: Add DT_RELR tests for ILP32 ABI
-rw-r--r--binutils/testsuite/lib/binutils-common.exp2
-rw-r--r--ld/testsuite/ld-aarch64/aarch64-elf.exp4
-rw-r--r--ld/testsuite/ld-aarch64/relr-align-ilp32.d23
-rw-r--r--ld/testsuite/ld-aarch64/relr-align-ilp32.s106
-rw-r--r--ld/testsuite/ld-aarch64/relr-got-pie-ilp32.d16
-rw-r--r--ld/testsuite/ld-aarch64/relr-got-shared-ilp32.d16
6 files changed, 166 insertions, 1 deletions
diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 5bfcde5..f013657 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 dc5eed5..c7d97f3 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 0000000..d2a5982
--- /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 0000000..7e2e084
--- /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 0000000..04cb52e
--- /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 0000000..b835a0c
--- /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