[PATCH] x86-64: Remove sframe relocs against discarded sections

H.J. Lu hjl.tools@gmail.com
Tue Jul 15 08:22:55 GMT 2025


On Tue, Jul 15, 2025, 3:21 PM Jan Beulich <jbeulich@suse.com> wrote:

> On 15.07.2025 07:51, Sam James wrote:
> > From: "H.J. Lu" <hjl.tools@gmail.com>
> >
> > Since unlike eh_frame editing code, sframe editing code keeps
> > R_X86_64_NONE reloc as is, its r_offset is wrong, we must not
> > generate R_X86_64_NONE reloc in sframe section against discarded
> > sections for "ld -r".
> >
> > bfd/
> >
> >       PR ld/33156
> >       * elf64-x86-64.c (elf_x86_64_relocate_section): Also remove
> >       sframe relocations against discarded sections for "ld -r".
> >
> > ld/
> >
> >       PR ld/33156
> >       * testsuite/ld-elf/eh-group.exp (as_gsframe): New.
> >       Assemble eh-group.o with $as_gsframe.
> >
> > Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> > ---
> > Sent on H.J.'s behalf. OK?
>
> What's the relationship with what it now 5f9bf0cf711a ("sframe: Allow
> input R_*_NONE relocations")? Indu's reply there suggests to me that
> altering the number of relocs may be a problem.
>

For relocation against the discarded section,
x86-64 backend keeps the original offset.
Since sframe code simply ignores NONE relocation,
the offset of the NONE relocation is simply wrong
which causes the relocation error when
x86-64 backend resolves the NONE relocation which has the original offset
in the discarded section.



> Jan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/binutils/attachments/20250715/a065fe0a/attachment.htm>


More information about the Binutils mailing list