[PATCH] elf: Avoid relocating non-allocated code sections
Alan Modra
amodra@gmail.com
Thu Jul 30 11:47:29 GMT 2026
On Thu, Jul 30, 2026 at 01:21:34PM +0200, Jan Beulich wrote:
> On 30.07.2026 12:48, H.J. Lu wrote:
> > When non-alloced sections use GOT or PLT, their
> > usages aren't counted. Then elf_link_input_bfd
> > calls relocate_section on these sections. When
> > x86 backend tries to use GOT or PLT to resolve
> > relocations in non-alloced sections, everything goes
> > downhill from there.
>
> So that may be where a correction is needed then.
Exactly. Also, don't rely on check_relocs to validate relocs. Checks
must be repeated in relocate_section precisely because non-alloc
sections are not and should not be handled by check_relocs. It is
fine to error on relocs that don't make sense in non-alloc sections.
--
Alan Modra
More information about the Binutils
mailing list