This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
bfd/elf.c assertion for multiple relocations to same section
- From: Joe Lawrence <joe dot lawrence at redhat dot com>
- To: binutils at sourceware dot org
- Date: Tue, 16 Apr 2019 17:13:08 -0400
- Subject: bfd/elf.c assertion for multiple relocations to same section
I was wondering if anyone could explain the assertion in bfd/elf.c ::
bfd_section_from_shdr() where it is processing a SHT_REL/SHT_RELA
section and decides to return failure if *p_hdr is already set non-NULL:
/* PR 17512: file: 0b4f81b7. */
if (*p_hdr != NULL)
goto fail;
I opened bz-24456 [1] with some more details and links to sample ELF
objects that trip this assertion.
As far as I understand what is happening, bfd_section_from_shdr() isn't
prepared to process a (second) relocation section that targets a section
that another relocation section does, too.
ie,
Relocation section [ 4] '.rela.text' for section [ 3] '.text' ...
Relocation section [34] '.klp.rela.vmlinux..text' for section [ 3]
'.text' ...
in my case the assertion hits when we're processing section 34.
Anyone have context behind this check and whether or not binutils should
be able to handle such ELF objects?
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=24456
Thanks,
-- Joe