x86: Restore generic copy of special section fields
Restores generic section field copying for non-Solaris binaries, fixing secondary reloc issues.
This patch restores the generic handling of special section fields for non-Solaris binaries. A previous commit had short-circuited this generic handling, leading to incorrect zeroing of the ‘sh_link’ and ‘sh_info’ fields for ‘SHT_SECONDARY_RELOC’ sections, which is now corrected.
- proposer
Submits a patch to restore generic section field copying, resolving issues with secondary relocations on non-Solaris binaries.
“Commit f5c3ce3687f7 ("x86: Add _bfd_elf_x86_copy_special_section_fields") short-circuited the generic handling for non-Solaris binaries. Restore the generic handling for these inputs to avoid 'SHT_SECONDARY_RELOC' with zeroed 'sh_link/sh_info'.”
In Details
This patch modifies the _bfd_elf_x86_copy_special_section_fields function in the x86 ELF backend. It reverts a change that made this function return false for non-Solaris binaries, which inadvertently bypassed the generic _bfd_elf_copy_special_section_fields function. This generic function is necessary for correctly handling fields like sh_link and sh_info for sections like SHT_SECONDARY_RELOC, preventing corruption.
- sh_link
- A field in an ELF section header that provides a reference to another section, typically a symbol table.
- sh_info
- A field in an ELF section header that contains additional information about the section, its meaning depending on the section type.
- SHT_SECONDARY_RELOC
- A section type in the ELF file format that indicates secondary relocation information, often used in specific linking or patching scenarios.
- Solaris
- An operating system, formerly developed by Sun Microsystems and now by Oracle, based on UNIX.
- ELF
- Executable and Linkable Format, a common standard file format for object files, executables, and shared libraries on Unix-like systems.