[PATCH 0/7] bfd: local IFUNC symbols referenced only from non-alloc sections
Alan Modra
amodra@gmail.com
Fri Nov 13 21:52:25 GMT 2026
On Fri, Nov 13, 2026 at 01:39:33PM +0100, Jan Beulich wrote:
> On 13.11.2026 13:36, Harshit Kumar wrote:
> >> I have some doubt that x86 and the others that have followed x86 are
> >> correct regarding not applying relocs in debug sections. Debug
> >> sections certainly should not generate dynamic relocations, but why
> >> would you not apply the reloc to the debug section?
> >
> > I could not find a reason either. PR ld/18808 was an abort () on such a
> > relocation; the first fix (97dc35c88d) used "break", and the same day
> > 0eace2105d changed it to "continue", without saying why skipping is
> > the right outcome. The series only copied that.
> >
> > It also gives wrong debug info. With a global IFUNC "ifn" at 0x10001,
> > "ld -e _start -Ttext=0x10000" leaves ".quad ifn" in .debug_info as 0
> > on x86-64, while the same reference in a non-alloc note gets 0x10001.
> > On i386 ".long ifn+4" stays 4. arm, ppc32, ppc64, alpha, arc, csky,
> > hppa, s390 and LoongArch already apply the reloc there, with the
> > resolver address.
> >
> > So I'd apply it the way the SHT_NOTE case does, as against an STT_FUNC
> > symbol. If you and Jan agree, v2 would do that for debugging
> > sections, for global and local symbols alike, on x86, AArch64, RISC-V
> > and SPARC.
Yes, that should happen for all non-alloc sections. You shouldn't
need to distinguish SHT_NOTE or SEC_DEBUGGING from other non-alloc in
the way relocations are handled, with a very few exceptions where
SEC_DEBUGGING silences an error. I see many wrong tests of
SEC_DEBUGGING in elf_x86_64_relocate_section.
> Sgtm, fwiw.
>
> Jan
--
Alan Modra
More information about the Binutils
mailing list