[binutils-gdb] Re: aarch64: Add some DT_RELR ld tests

Alan Modra amodra@sourceware.org
Thu Jun 6 01:07:28 GMT 2024


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

commit 42878336131e1b90623c5e2d7d011acc9b35c950
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Jun 4 09:00:57 2024 +0930

    Re: aarch64: Add some DT_RELR ld tests
    
    aarch64-elf fails these tests due to .rela.dyn being at a different
    address to that expected, and due to the symbol table being different.
    Unexpected symbol numbering results in a mismatch of reloc r_info
    field, but these are shown decoded so the raw field doesn't really add
    anything to the test.
    
            * testsuite/ld-aarch64/relr-align.d: Accept any address for
            .relr.dyn section.  Don't match raw r_info field.
            * testsuite/ld-aarch64/relr-data-shared.d: Likewise.
            * testsuite/ld-aarch64/relr-got-shared.d: Likewise.
            * testsuite/ld-aarch64/relr-text-shared.d: Likewise.

Diff:
---
 ld/testsuite/ld-aarch64/relr-align.d       | 10 +++++-----
 ld/testsuite/ld-aarch64/relr-data-shared.d | 16 ++++++++--------
 ld/testsuite/ld-aarch64/relr-got-shared.d  | 10 +++++-----
 ld/testsuite/ld-aarch64/relr-text-shared.d |  4 ++--
 4 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/ld/testsuite/ld-aarch64/relr-align.d b/ld/testsuite/ld-aarch64/relr-align.d
index ac2fa6eff08..5ad00784b3b 100644
--- a/ld/testsuite/ld-aarch64/relr-align.d
+++ b/ld/testsuite/ld-aarch64/relr-align.d
@@ -2,13 +2,13 @@
 #ld: -shared -z pack-relative-relocs -T relocs.ld
 #readelf: -rW
 
-Relocation section '\.rela\.dyn' at offset 0x10090 contains 3 entries:
+Relocation section '\.rela\.dyn' .* contains 3 entries:
     Offset             Info             Type               Symbol's Value  Symbol's Name \+ Addend
-0000000012340011  0000000000000403 R_AARCH64_RELATIVE                        10000
-0000000012340019  0000000000000403 R_AARCH64_RELATIVE                        10000
-0000000012340041  0000000000000403 R_AARCH64_RELATIVE                        10000
+0000000012340011 .* R_AARCH64_RELATIVE                        10000
+0000000012340019 .* R_AARCH64_RELATIVE                        10000
+0000000012340041 .* R_AARCH64_RELATIVE                        10000
 
-Relocation section '\.relr\.dyn' at offset 0x100d8 contains 9 entries which relocate 10 locations:
+Relocation section '\.relr\.dyn' .* contains 9 entries which relocate 10 locations:
 Index: Entry            Address           Symbolic Address
 0000:  0000000012340000 0000000012340000  double_0
 0001:  0000000000000003 0000000012340008  double_0 \+ 0x8
diff --git a/ld/testsuite/ld-aarch64/relr-data-shared.d b/ld/testsuite/ld-aarch64/relr-data-shared.d
index d94b335fac2..4e9dbaf12e3 100644
--- a/ld/testsuite/ld-aarch64/relr-data-shared.d
+++ b/ld/testsuite/ld-aarch64/relr-data-shared.d
@@ -2,16 +2,16 @@
 #ld: -shared -z pack-relative-relocs -T relocs.ld
 #readelf: -rW
 
-Relocation section '\.rela\.dyn' at offset 0x10150 contains 6 entries:
+Relocation section '\.rela\.dyn' .* contains 6 entries:
     Offset             Info             Type               Symbol's Value  Symbol's Name \+ Addend
-0000000012340000  0000000000000403 R_AARCH64_RELATIVE                        10004
-0000000012340008  0000000000000403 R_AARCH64_RELATIVE                        10008
-0000000012340018  0000000000000403 R_AARCH64_RELATIVE                        12340050
-0000000012340010  0000000400000101 R_AARCH64_ABS64        000000000001000c sym_global \+ 0
-0000000012340030  0000000400000101 R_AARCH64_ABS64        000000000001000c sym_global \+ 0
-0000000012340040  0000000300000101 R_AARCH64_ABS64        0000000000000000 sym_weak_undef \+ 0
+0000000012340000 .* R_AARCH64_RELATIVE                        10004
+0000000012340008 .* R_AARCH64_RELATIVE                        10008
+0000000012340018 .* R_AARCH64_RELATIVE                        12340050
+0000000012340010 .* R_AARCH64_ABS64        000000000001000c sym_global \+ 0
+0000000012340030 .* R_AARCH64_ABS64        000000000001000c sym_global \+ 0
+0000000012340040 .* R_AARCH64_ABS64        0000000000000000 sym_weak_undef \+ 0
 
-Relocation section '\.relr\.dyn' at offset 0x101e0 contains 2 entries which relocate 3 locations:
+Relocation section '\.relr\.dyn' .* contains 2 entries which relocate 3 locations:
 Index: Entry            Address           Symbolic Address
 0000:  0000000012340020 0000000012340020  aligned_local
 0001:  0000000000000023 0000000012340028  aligned_hidden
diff --git a/ld/testsuite/ld-aarch64/relr-got-shared.d b/ld/testsuite/ld-aarch64/relr-got-shared.d
index 59526947a9a..5713d25a8ed 100644
--- a/ld/testsuite/ld-aarch64/relr-got-shared.d
+++ b/ld/testsuite/ld-aarch64/relr-got-shared.d
@@ -2,13 +2,13 @@
 #ld: -shared -z pack-relative-relocs -T relocs.ld
 #readelf: -rW
 
-Relocation section '\.rela\.dyn' at offset 0x10168 contains 3 entries:
+Relocation section '\.rela\.dyn' .* contains 3 entries:
     Offset             Info             Type               Symbol's Value  Symbol's Name \+ Addend
-0000000000020020  0000000300000401 R_AARCH64_GLOB_DAT     0000000000010038 sym_global \+ 0
-0000000000020028  0000000500000401 R_AARCH64_GLOB_DAT     000000000000002a sym_global_abs \+ 0
-0000000000020030  0000000200000401 R_AARCH64_GLOB_DAT     0000000000000000 sym_weak_undef \+ 0
+0000000000020020 .* R_AARCH64_GLOB_DAT     0000000000010038 sym_global \+ 0
+0000000000020028 .* R_AARCH64_GLOB_DAT     000000000000002a sym_global_abs \+ 0
+0000000000020030 .* R_AARCH64_GLOB_DAT     0000000000000000 sym_weak_undef \+ 0
 
-Relocation section '\.relr\.dyn' at offset 0x101b0 contains 2 entries which relocate 3 locations:
+Relocation section '\.relr\.dyn' .* contains 2 entries which relocate 3 locations:
 Index: Entry            Address           Symbolic Address
 0000:  0000000000020008 0000000000020008  _GLOBAL_OFFSET_TABLE_ \+ 0x8
 0001:  0000000000000007 0000000000020010  _GLOBAL_OFFSET_TABLE_ \+ 0x10
diff --git a/ld/testsuite/ld-aarch64/relr-text-shared.d b/ld/testsuite/ld-aarch64/relr-text-shared.d
index 06895d488b7..bd64b665261 100644
--- a/ld/testsuite/ld-aarch64/relr-text-shared.d
+++ b/ld/testsuite/ld-aarch64/relr-text-shared.d
@@ -5,10 +5,10 @@
 #...
  0x0000000000000016 \(TEXTREL\)            0x0
 #...
- 0x0000000000000024 \(RELR\)               0x10098
+ 0x0000000000000024 \(RELR\)               .*
  0x0000000000000023 \(RELRSZ\)             8 \(bytes\)
  0x0000000000000025 \(RELRENT\)            8 \(bytes\)
 #...
-Relocation section '.relr.dyn' at offset 0x10098 contains 1 entry which relocates 1 location:
+Relocation section '.relr.dyn' .* contains 1 entry which relocates 1 location:
 Index: Entry            Address           Symbolic Address
 0000:  0000000000010000 0000000000010000  _start


More information about the Binutils-cvs mailing list