x86: Improve relocation error reporting
The linker now provides more descriptive error messages for out-of-range relocations on x86 architectures.
This patch improves error reporting in the linker for x86 relocations that are out of range. Instead of a generic error code (e.g., “error 4”), the linker now provides a more informative message, specifying the relocation type (e.g., R_X86_64_64) and indicating that it’s “out of section range.” This change enhances diagnostics for developers debugging relocation issues, particularly for PR ld/34448.
- proposer
Announces the checking in of a patch that improves relocation error reporting for x86.
“This is the patch I am checking in.”
In Details
The x86 linker support in binutils is being updated to provide more context-aware error messages for relocation failures. Previously, errors like bfd_reloc_outofrange were reported with a generic code. The updated code now includes architecture-specific logic (_bfd_x86_elf_link_report_relocation_error) to generate human-readable messages that specify the relocation type and the nature of the out-of-range error, improving the debugging experience for users encountering these issues.
- relocation
- Information in an object file that tells the linker how to modify code or data addresses after linking.
- out of range
- An error condition where a relocation value exceeds the valid addressable range for the target instruction or data.
- x86
- A family of instruction set architectures developed by Intel, commonly used in personal computers and servers.
- linker
- A program that combines various object files and libraries into a single executable file or library.
- R_X86_64_64
- A specific type of relocation for the x86-64 architecture, typically used for absolute addressing.
- PR ld/34448
- Problem Report number 34448 in the binutils linker component, related to relocation errors.
- bfd_reloc_outofrange
- An error code from the BFD library indicating a relocation address is outside the allowed range.