aarch64: relocate IFUNC references from non-alloc sections as STT_FUNC
Fixes binutils to correctly relocate IFUNC references from non-alloc sections on AArch64.
This patch series corrects binutils’ handling of IFUNC references within non-allocatable sections on AArch64. Previously, the linker would abort or fail to relocate these references, particularly those in debug or note sections, due to skipping non-alloc sections. The changes ensure that such references are treated as STT_FUNC, resolving the issue described in PR ld/34988.
- 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 targets the AArch64 architecture within Binutils, specifically addressing STT_GNU_IFUNC relocation from non-allocatable sections. The core problem lies in elfNN_aarch64_relocate_section not handling references in sections like .debug_info or .note that are not loaded at runtime. The patch modifies the relocation logic to treat these references as STT_FUNC, aligning with the solution for other architectures and fixing PR ld/34988.
- 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.