ld/pdb: Handle bigobj input files in handle_debugs_section
Linker patch to correctly handle symbol table entries in PE bigobj files for PDB debugging information.
This patch addresses an issue in the GNU linker (ld) where it incorrectly processes symbol table entries for PE ‘bigobj’ files when generating PDB debugging information. Standard COFF symbol entries are 18 bytes, but ‘bigobj’ files use 20-byte entries. The patch updates the handle_debugs_section function to use bfd_coff_symesz to determine the correct size, ensuring compatibility with larger object files. A test case is also updated to use -mbig-obj.
- proposer
Proposes using `bfd_coff_symesz` to handle 20-byte symbol table entries in PE bigobj files, fixing PDB generation.
“symbol table entries in pe-bigobj files are 20 bytes rather than 18. Use bfd_coff_symesz instead.”
In Details
This patch for the GNU linker (ld) fixes symbol table processing for PDB debugging information when dealing with PE 'bigobj' files. The issue arises because struct external_syment is 18 bytes, but PE bigobj files use 20-byte entries. The fix uses bfd_coff_symesz to get the correct entry size and updates a test case to include -mbig-obj for x86.
- ld
- The GNU linker, responsible for combining object files and libraries into executables or other binary formats.
- PDB
- Program Database, a file format used by Microsoft Visual C++ for storing debugging and project information.
- bigobj
- A compiler and linker option that increases the size of object file structures, such as the symbol table, to support larger numbers of symbols.
- PE file
- Portable Executable, the file format used for executables, DLLs, and object files in Windows. 'bigobj' is an extension to this format.
- COFF
- Common Object File Format, a file format for object files and executables. PE is a derivative of COFF.
- symbol table
- A data structure within an object file that lists the symbols (e.g., function names, variable names) defined or referenced by the code.
- bfd_coff_symesz
- A function within the BFD library that returns the size of a COFF symbol table entry for a given BFD, accounting for platform variations.