x86: Restore generic copy of special section fields.
Fixes incorrect handling of section fields for non-Solaris x86 ELF binaries.
This commit restores the generic ELF section field copying logic for non-Solaris x86 binaries. A previous change had incorrectly short-circuited this generic handling for such binaries, leading to issues like SHT_SECONDARY_RELOC sections having zeroed sh_link and sh_info fields. This fix ensures these fields are correctly populated, resolving a bug in the BFD library.
In Details
The BFD library's _bfd_elf_x86_copy_special_section_fields function was modified in commit f5c3ce3687f7 to specifically handle Solaris binaries by returning false and falling back to _bfd_elf_copy_special_section_fields. However, this change inadvertently bypassed the generic copy logic for all non-Solaris x86 ELF binaries. This commit corrects that by explicitly checking for ELFOSABI_SOLARIS and otherwise invoking the generic _bfd_elf_copy_special_section_fields function, thus restoring proper handling of section fields like sh_link and sh_info for common x86 ELF files.
- x86
- A family of instruction set architectures (ISAs) developed by Intel and widely used in desktop and server computers.
- ELF
- Executable and Linkable Format, a common standard file format for object files, executables, and shared libraries on Unix-like operating systems.
- BFD
- Binary File Descriptor library, a part of GNU Binutils that provides a common interface to various object file formats.
- section fields
- Metadata within an ELF file that describes different segments of the file, such as code, data, or symbol tables. Key fields include
sh_link(index of a related section) andsh_info(section-specific information). - SHT_SECONDARY_RELOC
- A section type in ELF that contains relocation information for other sections. Issues with this type can lead to incorrect linking.
- sh_link
- An ELF section header field that holds the section header index of an associated section. For example, in a symbol table section, sh_link might point to the string table section.
- sh_info
- An ELF section header field that contains information that is section-specific. For example, for a relocation section, it might indicate the symbol table it refers to.
- Bugzilla
- An open-source bug tracking system used by many projects, including GCC and Binutils, to manage reported issues and feature requests.