binutils Newspaper
NOVEMBER 30, 2026
sparc — Proposed

sparc: relocate IFUNC references from non-alloc sections as STT_FUNC

Fixes binutils to correctly relocate IFUNC references from non-alloc sections on SPARC.

This patch addresses an issue where binutils on SPARC fails to relocate IFUNC references originating from non-allocatable sections like .debug_info. Previously, the relocation scan skipped these sections, causing relocation failures or aborts. The fix ensures that references from any non-alloc section are now treated as STT_FUNC, resolving PR ld/34988.

In the Thread 1 participant
  1. Harshit Kumar <harshit7kr@gmail.com> proposer

    Proposes relocating IFUNC references from non-alloc sections as STT_FUNC to fix a bug where relocation scans skip these sections.

    “A non-alloc section is not loaded and ld.so never processes it, so relocate a reference from any non-alloc section, debugging and note sections included, as against STT_FUNC: it gets the address of the resolver.”

In Details

This patch series tackles the relocation of STT_GNU_IFUNC symbols in Binutils' linker (ld). The issue arises when these symbols are referenced from sections that are not allocated in memory at runtime (e.g., debug sections). The linker's relocation logic, specifically in _bfd_sparc_elf_relocate_section, incorrectly skips these non-alloc sections, leading to failures when resolving IFUNC references. The proposed solution modifies the relocation logic to treat these references as STT_FUNC, ensuring they are resolved correctly to the IFUNC resolver's address.

For Context
STT_GNU_IFUNC
A symbol type in the ELF format used for Indirect Functions, allowing dynamic selection of function implementations at runtime.
non-alloc section
A section in an ELF object file that is not loaded into memory when the program is executed. Examples include debugging information sections.
relocation
The process by which a linker or dynamic loader resolves symbolic references and updates addresses in an object file or executable to their final locations in memory.
STT_FUNC
A symbol type in the ELF format representing a function.
PR ld/34988
A bug report filed against the GNU linker (ld) concerning the handling of IFUNC references in non-alloc sections.
Filed Under: binutilsldsparcELFrelocation