Linker uses linker-created stub bfd for dynamic objects
Binutils linker now uses a dedicated stub bfd for dynamic objects, improving stability and correctness.
Binutils linker has been updated to use a dedicated stub BFD (Binary File Descriptor) created by the linker itself when handling dynamic objects. This ensures the correct format and prevents potential confusion with existing information in object file BFds, leading to more robust linking of dynamic executables and libraries.
In Details
The _bfd_elf_link_dynobj function in elflink.c is modified to preferentially use a linker-created stub bfd, if available, for representing the dynamic object. This stub bfd is guaranteed to be in the correct format and only contains linker-generated information, avoiding potential conflicts or misunderstandings that could arise from using an object file's existing bfd. This change impacts ELF targets that support dynamic linking.
- BFD
- Binary File Descriptor. A data structure used by the GNU Binutils to represent and manipulate object files and executables in a generic way, abstracting underlying formats like ELF or COFF.
- stub bfd
- A special BFD created by the linker that serves as a placeholder or container for linker-generated information, particularly for dynamic linking.
- dynamic object
- A shared library or executable that relies on dynamic linking, where external symbols are resolved at runtime rather than compile time.
- ELF
- Executable and Linkable Format. A standard file format for object files, executables, and shared libraries on many Unix-like systems.