[PATCH 0/7] bfd: local IFUNC symbols referenced only from non-alloc sections
Harshit Kumar
harshit7kr@gmail.com
Fri Nov 13 12:36:14 GMT 2026
Hi Alan,
> 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.
Thanks,
Harshit
On Fri, 13 Nov 2026 at 17:45, Alan Modra <amodra@gmail.com> wrote:
>
> On Wed, Nov 11, 2026 at 04:33:43PM +0530, Harshit Kumar wrote:
> > The scan skips these sections on purpose since c4b126b87a (PR ld/26080),
> > so creating the entry or scanning them again is not the fix. For a
> > global symbol, x86 treats the symbol as STT_FUNC in a non-alloc SHT_NOTE
> > section (347a87745e, PR ld/22929) and leaves the relocation unapplied in
> > a debugging section, which ld.so never processes (97dc35c88d and
> > 0eace2105d, PR ld/18808); AArch64, RISC-V and SPARC do the same. The
> > series applies that rule to the local symbol:
>
> 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?
>
> --
> Alan Modra
More information about the Binutils
mailing list