aboutsummaryrefslogtreecommitdiff
path: root/include/elf
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2021-11-16 13:03:57 -0800
committerFangrui Song <maskray@google.com>2021-11-16 13:04:33 -0800
commita7fd11862703e45d2774981a4888bc127d473b06 (patch)
tree6caa5fcbd7a7b71a0b6ab895a2bf9a4a00193fa9 /include/elf
parent830070c66d25e6749b7159009f1d87d85f02eaa3 (diff)
downloadgdb-a7fd11862703e45d2774981a4888bc127d473b06.zip
gdb-a7fd11862703e45d2774981a4888bc127d473b06.tar.gz
gdb-a7fd11862703e45d2774981a4888bc127d473b06.tar.bz2
readelf: Support SHT_RELR/DT_RELR for -r
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. binutils/ * readelf.c (enum relocation_type): New. (slurp_relr_relocs): New. (dump_relocations): Change is_rela to rel_type. Dump RELR. (dynamic_relocations): Add DT_RELR. (process_relocs): Check SHT_RELR and DT_RELR. (process_dynamic_section): Store into dynamic_info for DT_RELR/DT_RELRENT/DT_RELRSZ.
Diffstat (limited to 'include/elf')
-rw-r--r--include/elf/common.h2
-rw-r--r--include/elf/external.h8
2 files changed, 9 insertions, 1 deletions
diff --git a/include/elf/common.h b/include/elf/common.h
index 4da28fa..5d31e35 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -1102,13 +1102,13 @@
#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
diff --git a/include/elf/external.h b/include/elf/external.h
index b249856..815e39c 100644
--- a/include/elf/external.h
+++ b/include/elf/external.h
@@ -212,6 +212,10 @@ typedef struct {
} 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 */
} Elf64_External_Rel;
@@ -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 {