binutils Newspaper
NOVEMBER 30, 2026
sparc — Proposed

sparc: handle a local IFUNC referenced only from a non-alloc section

Fixes the SPARC linker to correctly handle local IFUNC symbols referenced from non-allocatable sections.

This patch addresses an issue on the SPARC architecture where local STT_GNU_IFUNC symbols referenced exclusively from non-allocatable sections caused the linker to abort. The relocation scan skips these sections, and _bfd_sparc_elf_relocate_section would not find the symbol. The fix implements _bfd_elf_ifunc_nonalloc_reloc for these cases, mirroring how global symbols are handled, and improves the error message to include the symbol’s name when a relocation is unresolvable. New test cases are added.

In Details

This patch addresses the linking behavior for local STT_GNU_IFUNC symbols on SPARC when they are only referenced from non-allocatable sections (like .debug_info). The standard linker relocation process, which skips non-SEC_ALLOC sections, means that _bfd_sparc_elf_relocate_section cannot find the necessary information for these symbols. This leads to a linker abort. The solution applies the generic _bfd_elf_ifunc_nonalloc_reloc handler, which is designed for such scenarios, ensuring that the symbol is processed appropriately even without a PLT entry. Additionally, the patch enhances…

For Context
SPARC
A RISC instruction set architecture developed by Sun Microsystems.
STT_GNU_IFUNC
A symbol type in the ELF format that represents an Indirect Function. IFUNCs allow for dynamic selection of function implementations at runtime, typically based on processor capabilities.
Non-alloc section
A section in an object file that is not loaded into memory when the program runs (e.g., debugging information sections). Marked by SEC_ALLOC flag being unset.
Relocation
The process of updating symbolic references in an object file to absolute addresses when linking. Relocations contain information about which parts of the code need to be modified and how.
_bfd_elf_ifunc_nonalloc_reloc
A generic BFD helper function for handling relocations of IFUNC symbols located in non-allocatable sections.
SEC_ALLOC
A flag in BFD that indicates whether a section should be allocated memory when the program is loaded.
Filed Under: sparclinkerifuncrelocationsdebugging sections