]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
aarch64: Add DT_RELR tests for ILP32 ABI
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 13 Jun 2024 12:40:35 +0000 (13:40 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Tue, 25 Jun 2024 10:07:51 +0000 (11:07 +0100)
binutils/testsuite/lib/binutils-common.exp
ld/testsuite/ld-aarch64/aarch64-elf.exp
ld/testsuite/ld-aarch64/relr-align-ilp32.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/relr-align-ilp32.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/relr-got-pie-ilp32.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/relr-got-shared-ilp32.d [new file with mode: 0644]

index 5bfcde5153136e7e6c0abd1a8c9e748db3c4f179..f0136577b6cf22ba7fd3925dd4dfd8d76a870882 100644 (file)
@@ -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
index dc5eed50bfd3e6b67b1978711ce0e8c751261401..c7d97f3ced99cc5b8da8182e31a78bb77778499c 100644 (file)
@@ -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 (file)
index 0000000..d2a5982
--- /dev/null
@@ -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 (file)
index 0000000..7e2e084
--- /dev/null
@@ -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 (file)
index 0000000..04cb52e
--- /dev/null
@@ -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 (file)
index 0000000..b835a0c
--- /dev/null
@@ -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