lto: Skip format check for IR dummy files
Improves linker's LTO handling by skipping format checks on IR dummy files, preventing unnecessary errors.
This commit modifies the linker’s Language Support module to skip format checks for IR dummy files. Previously, the linker attempted to check the format of these files, which could lead to errors or unexpected behavior, as documented in PR ld/34572. The changes also allow empty DESTLIST in lang_list_remove_tail and introduce new test cases to ensure correct handling of IR dummy files.
In Details
The lang_check function in ld/ldlang.c is responsible for validating input files during the linking process, particularly in the context of LTO. This commit modifies it to skip the format check for files identified as IR dummy files (those with BFD_PLUGIN flag set). This prevents spurious errors when such files are encountered and ensures that the linker can proceed correctly with LTO processing. Additionally, lang_list_remove_tail is updated to handle potentially empty destination lists.
- LTO
- Link-Time Optimization. A compilation technique where the linker performs optimizations across multiple object files, often using an intermediate representation (IR) generated by the compiler.
- IR dummy file
- A placeholder or auxiliary file used within the LTO process, often representing intermediate code or data structures that do not need a full format validation.
- BFD_PLUGIN
- A flag within the BFD (Binary File Descriptor) library indicating that a file is being handled as a plugin, often relevant for LTO or custom file formats.
- DESTLIST
- Likely refers to a 'destination list' within the linker's language support module, possibly used for managing output sections or symbol lists.