Tidies for using a linker-created dynobj in binutils.
Alan Modra proposes a series of tidy-up patches to prepare for using a linker-created bfd for dynamic sections in ELF linkers.
Alan Modra proposes a series of patches to tidy up the binutils code in preparation for a larger change to use a linker-created BFD (Back-End File Descriptor) for attaching dynamic sections in ELF linkers. These cleanups address issues in ARM, CRIS, FRV, LM32, Alpha and HPPA64 targets.
- proposer
Proposes a series of patches to clean up binutils code in preparation for using a linker-created BFD for dynamic sections in ELF linkers.
“This series of patches came about as I was playing with the idea of making all the ELF linker targets use a linker created bfd for attaching dynamic sections.”
- other
Explains a change related to delaying the setting of PLT header and entry size for ARM targets.
“elf32_arm_create_dynamic_sections was used to set plt_header_size and plt_entry_size. This necessitated a hack for using_thumb_only() as the output file attributes used by that function are not set until lang_check calls bfd_merge_private_bfd_data.”
- other
Details the removal of a restriction in cris check_relocs due to access to the output bfd now being available.
“A comment in cris check_relocs bemoans not being able to access the output bfd in adjust_dynamic_symbol. A little over three years after the comment was written, commit f13a99db51c0 gave that access. So let's make use of it and remove a restriction.”
- other
Describes a change to test frvfdpic_relocs_info directly instead of dynobj in elf32_frvfdpic_late_size_sections.
“This function runs passes over frvfdpic_relocs_info if dynobj is set, which is OK since the two variables are both non-NULL or both NULL in the current linker. That may change in the future, so test frvfdpic_relocs_info directly rather than dynobj.”
- other
Explains the removal of a duplicate call to _bfd_elf_create_got_section in lm32_elf_create_dynamic_sections.
“lm32_elf_create_dynamic_sections has two calls to _bfd_elf_create_got_section. That doesn't cause a problem, but one such call suffices.”
- other
Describes a fix for testsuite failures related to discarding GOT sections in elf64-alpha.c.
“This fixes testsuite failures I noticed when changing dynobj to be linker created, but I think the bug could be triggered by suitably crafted linker scripts without any dynobj changes.”
Technical Tradeoffs
- The main tradeoff is the potential for regressions when modifying core components of the linker.
- The benefits are improved code clarity, reduced redundancy, and better handling of dynamic linking
In Details
BFD (Binary File Descriptor) is a library for working with different object file formats. dynobj refers to the dynamic object, a BFD structure used for handling dynamic linking. The patches aim to use a linker-created BFD for dynamic sections to avoid type mismatches and simplify the code.
For Context
When creating executable programs, a linker combines different parts of the code together. A dynamic object (dynobj) is used to manage how the program interacts with shared libraries at runtime. This series of patches aims to improve how the linker handles these dynamic objects, making the process more robust and less prone to errors.