LoongArch linker handles ignored undefined symbols better
LoongArch linker now correctly handles ignored undefined symbols, preventing assertions for call relocations.
This change modifies the LoongArch ELF linker to correctly handle ignored undefined symbols. Previously, attempting to resolve ignored undefined symbols that failed local resolution could lead to a BFD assertion when a PLT entry was requested. The fix ensures that ignored undefined symbols, especially for call relocations, are treated appropriately, preventing assertion failures.
In Details
The LoongArch ELF linker's relocation logic is updated to correctly handle ignored undefined symbols. When an undefined symbol is marked as 'ignored', it's treated as a dynamically resolved symbol. This change prevents a BFD assertion that could occur when --unresolved-symbols=ignore-all is used with call relocations, ensuring that such symbols are handled gracefully even if they lack a PLT entry.
- LoongArch
- A family of reduced instruction set computer (RISC) architectures developed in China.
- BFD
- The Binary File Descriptor library, a low-level interface for handling object code and executable files across different formats.
- ELF
- The Executable and Linkable Format, a common standard file format for object files, executables, and shared libraries on Unix-like systems.
- PLT
- The Procedure Linkage Table, a table in an executable or library used for dynamic linking, allowing indirect calls to functions.
- relocation
- The process of updating symbolic references from their assigned memory addresses to their final memory addresses after linking or loading.
- undefined symbol
- A symbol that is referenced in one object file but not defined (declared) in any object file being linked.
- --unresolved-symbols=ignore-all
- A linker option that instructs the linker to ignore all unresolved symbols, treating them as dynamically resolved.