readelf: Support SHT_RELR/DT_RELR for -r
authorFangrui Song <maskray@google.com>
Tue, 16 Nov 2021 21:03:57 +0000 (13:03 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 10 Jan 2022 13:05:22 +0000 (05:05 -0800)
The -r output for SHT_RELR looks like:

Relocation section '.relr.dyn' at offset 0x530 contains 4 entries:
  7 offsets
00000000000028c0
00000000000028c8
0000000000003ad0
0000000000003ad8
0000000000003ae0
0000000000003ae8
0000000000003af0

For --use-dynamic, the header looks like

    'RELR' relocation section at offset 0x530 contains 32 bytes:

include/
    * elf/common.h (DT_ENCODING): Bump to 38.
    * elf/external.h (Elf32_External_Relr): New.
    (Elf64_External_Relr): New.

(cherry picked from commit a7fd11862703e45d2774981a4888bc127d473b06)

include/elf/common.h
include/elf/external.h

index 8c6a595fea4f5e33f5cf100481e81033e80b26ac..dff90c4d9e14f449c9d16f0e38e6362d5034404c 100644 (file)
 #define DT_FINI_ARRAYSZ 28
 #define DT_RUNPATH     29
 #define DT_FLAGS       30
-#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
index b24985687e6774f05badbb414285b1eaead38647..815e39c2837690330409d2694fb93025887a6e20 100644 (file)
@@ -211,6 +211,10 @@ typedef struct {
   unsigned char        r_addend[4];    /* Constant addend used to compute value */
 } Elf32_External_Rela;
 
+typedef struct {
+  unsigned char r_data[4];     /* RELR entry */
+} Elf32_External_Relr;
+
 typedef struct {
   unsigned char r_offset[8];   /* Location at which to apply the action */
   unsigned char        r_info[8];      /* index and type of relocation */
@@ -222,6 +226,10 @@ typedef struct {
   unsigned char        r_addend[8];    /* Constant addend used to compute value */
 } Elf64_External_Rela;
 
+typedef struct {
+  unsigned char r_data[8];     /* RELR entry */
+} Elf64_External_Relr;
+
 /* dynamic section structure */
 
 typedef struct {
This page took 0.026944 seconds and 4 git commands to generate.