binutils Newspaper
NOVEMBER 30, 2026
aarch64 — Proposed

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

Fixes binutils to correctly handle local IFUNC symbols when referenced only from non-alloc sections.

This patch addresses an issue in the aarch64 linker where local STT_GNU_IFUNC symbols are not handled correctly if they are only referenced from non-allocatable sections (like .debug_info). The linker previously aborted because the relocation scan skips these sections, preventing the creation of a hash entry. The fix introduces the use of _bfd_elf_ifunc_nonalloc_reloc to handle these cases, providing a more informative error message when resolution fails.

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

    Proposes to handle local STT_GNU_IFUNC symbols referenced only from non-alloc sections by using _bfd_elf_ifunc_nonalloc_reloc, similar to global symbols, to provide a more consistent error message.

    “A local STT_GNU_IFUNC symbol gets its hash entry from the relocation scan, which skips non-SEC_ALLOC sections (PR ld/26080). When only such a section, for example .debug_info, refers to it, elfNN_aarch64_relocate_section finds no entry and aborts. Handle it with _bfd_elf_ifunc_nonalloc_reloc, like a global symbol, giving the same "unresolvable ... relocation" error in the reject case.”

In Details

This patch series aims to fix a bug in the binutils linker where local IFUNC symbols (symbols that resolve to different function pointers at runtime) are not handled correctly when they are only referenced from sections that are not allocated in memory (e.g., debug sections). The existing relocation scan skips these non-alloc sections, leading to missing hash entries for IFUNC symbols. This series introduces a common helper function _bfd_elf_ifunc_nonalloc_reloc and applies it to various architectures (x86, aarch64, RISC-V, SPARC) to ensure these local IFUNCs are processed correctly, either…

For Context
STT_GNU_IFUNC
A symbol type in the ELF format that represents an indirect function. The linker and dynamic loader resolve this symbol to a specific function pointer at runtime, allowing for architecture-specific or version-specific function implementations.
non-alloc section
An ELF section that is not loaded into memory when the program is executed. These sections are often used for debugging information, notes, or other metadata.
relocation scan
The process by which the linker identifies and resolves references between different parts of an executable or library. This involves examining relocation entries in object files.
hash entry
A data structure within an ELF file that helps speed up symbol lookups, particularly for dynamic linking. For IFUNC symbols, a hash entry is important for runtime resolution.
IFUNC
Indirect Function. Similar to STT_GNU_IFUNC, it's a mechanism to select a function implementation at runtime based on certain criteria.
Filed Under: linkeraarch64ELFIFUNC