[binutils-gdb] Re: readelf: Support SHT_RELR/DT_RELR for -r

Alan Modra amodra@sourceware.org
Mon May 22 08:39:19 GMT 2023


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

commit bc227f4ccb0778a56ca3d9f27652fd9e5e2747ea
Author: Alan Modra <amodra@gmail.com>
Date:   Mon May 22 17:25:36 2023 +0930

    Re: readelf: Support SHT_RELR/DT_RELR for -r
    
    Revert value of DT_ENCODING to as it was before commit a7fd118627, and
    adjust readelf.
    
    include/
            * elf/common.h (DT_ENCODING): Set back to 32.
    binutils/
            * readelf.c (struct filedata): Don't size dynamic_info array
            using DT_ENCODING.

Diff:
---
 binutils/readelf.c   | 2 +-
 include/elf/common.h | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/binutils/readelf.c b/binutils/readelf.c
index b872876a8b6..d8ad58b15dc 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -304,7 +304,7 @@ typedef struct filedata
   uint64_t *           mipsxlat;
   uint64_t             gnusymidx;
   char *               program_interpreter;
-  uint64_t             dynamic_info[DT_ENCODING];
+  uint64_t             dynamic_info[DT_RELRENT + 1];
   uint64_t             dynamic_info_DT_GNU_HASH;
   uint64_t             dynamic_info_DT_MIPS_XHASH;
   elf_section_list *   symtab_shndx_list;
diff --git a/include/elf/common.h b/include/elf/common.h
index 6f64f05890c..ffa6b60bd2b 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -1135,13 +1135,16 @@
 #define DT_FINI_ARRAYSZ 28
 #define DT_RUNPATH	29
 #define DT_FLAGS	30
+
+/* Values in the range [DT_ENCODING, DT_LOOS) use d_un.d_ptr if the
+   value is even, d_un.d_val if odd.  */
+#define DT_ENCODING	32
 #define DT_PREINIT_ARRAY   32
 #define DT_PREINIT_ARRAYSZ 33
 #define DT_SYMTAB_SHNDX    34
 #define DT_RELRSZ	35
 #define DT_RELR		36
 #define DT_RELRENT	37
-#define DT_ENCODING	38
 
 /* Note, the Oct 4, 1999 draft of the ELF ABI changed the values
    for DT_LOOS and DT_HIOS.  Some implementations however, use


More information about the Binutils-cvs mailing list