[binutils-gdb] PR 33743 readelf abort during RELR relocation handling
Alan Modra
amodra@sourceware.org
Fri Feb 27 10:20:43 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dfb620a09212304b9ca9ee345f2f187e2e6e2b75
commit dfb620a09212304b9ca9ee345f2f187e2e6e2b75
Author: Alan Modra <amodra@gmail.com>
Date: Fri Feb 27 18:14:36 2026 +1030
PR 33743 readelf abort during RELR relocation handling
Rather than aborting, use "unknown relative" as the reloc type should
display_elf_relocation_at want to print a relocation. Also fix
another case where readelf doesn't understand the relocation and sets
all_relocations[i].r_name to NULL.
PR 33743
* readelf.c (dump_relr_relocations): Don't abort on unknown
e_machine.
(dump_relocations): Don't assume we can pass NULL to a %s
format.
Diff:
---
binutils/readelf.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 0c3e24e8bf7..3b6d606b36c 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -1976,7 +1976,8 @@ dump_relr_relocations (Filedata * filedata,
switch (filedata->file_header.e_machine)
{
default:
- abort ();
+ rtype = "unknown relative";
+ break;
case EM_386:
case EM_IAMCU:
@@ -2888,7 +2889,7 @@ dump_relocations (Filedata * filedata,
if (do_got_section_contents)
{
all_relocations[i].r_offset = offset;
- all_relocations[i].r_name = rtype;
+ all_relocations[i].r_name = rtype ? rtype : "unknown";
all_relocations[i].r_symbol = symbol_name;
all_relocations[i].r_addend = rels[i].r_addend;
all_relocations[i].r_type = rel_type;
More information about the Binutils-cvs
mailing list