Many ELF linker functions now implicitly access the output BFD.
Binutils ELF linker functions now access `info->output_bfd` directly instead of taking it as a parameter, reducing code size.
This commit refactors numerous ELF linker functions in Binutils by removing the explicit bfd parameter. Instead, these functions now access the output BFD object via info->output_bfd, which is always available through the bfd_link_info structure. This change, which streamlines function signatures and slightly reduces the final linker binary size, applies to functions that are consistently passed a non-NULL bfd_link_info and are not invoked directly through a BFD_SEND macro using the output BFD.
In Details
This Binutils commit optimizes the elflink subsystem by removing redundant bfd *output_bfd parameters from a large number of ELF linker functions. These functions invariably receive a bfd_link_info *info parameter, from which the output_bfd can be directly accessed as info->output_bfd. This refactoring applies to functions not invoked through the BFD_SEND macro, where the output_bfd would be implicitly passed. The reduction in parameter passing contributes to a marginal code size reduction in the static ld binary.
For Context
When a program is linked, the Binutils linker (ld) brings together various code and data components into a final executable file, represented by a 'Binary File Descriptor' (BFD). This commit streamlines how different parts of the linker interact with this final executable's BFD. Previously, many internal linker functions were explicitly passed the BFD as a separate parameter, even though they could already access it through a larger 'linking information' structure. By having these functions directly retrieve the BFD from the information structure, the code becomes slightly cleaner and the linker's executable size is reduced. This is a common optimization technique in large software systems to reduce redundancy.