[binutils-gdb] ld/pdb: Skip auxiliary symbol entries in handle_debugs_section

Jan Beulich jbeulich@sourceware.org
Fri Nov 6 13:16:25 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=33aa632d8e16c34c9974c57d721fd2bab1a19d10

commit 33aa632d8e16c34c9974c57d721fd2bab1a19d10
Author: Oleg Tolmatcev <oleg.tolmatcev@gmail.com>
Date:   Fri Nov 6 14:15:27 2026 +0100

    ld/pdb: Skip auxiliary symbol entries in handle_debugs_section
    
    handle_debugs_section treated every raw symbol table entry, including
    auxiliary entries, as a symbol and looked up a section for its n_scnum.
    In auxiliary entries that field holds unrelated data, so the lookup
    often missed and fell back to a linear scan over all sections.  With
    objects containing thousands of sections this took about 10% of the
    link time for a large executable with --pdb.
    
    ld/
            * pdb.c (handle_debugs_section): Skip auxiliary symbol entries.

Diff:
---
 ld/pdb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ld/pdb.c b/ld/pdb.c
index 7e9218d21f1..4083a7d17ba 100644
--- a/ld/pdb.c
+++ b/ld/pdb.c
@@ -1957,6 +1957,9 @@ handle_debugs_section (asection *s, bfd *mod, struct string_table *strings,
 
 	  if (symbols[i].n_scnum > 0)
 	    sectlist[i] = coff_section_from_bfd_index (mod, symbols[i].n_scnum);
+
+	  memset (&symbols[i + 1], 0, symbols[i].n_numaux * sizeof (*symbols));
+	  i += symbols[i].n_numaux;
 	}
 
       if (!bfd_coff_relocate_section (abfd, coff_data (abfd)->link_info, mod,


More information about the Binutils-cvs mailing list