https://sourceware.org/bugzilla/show_bug.cgi?id=34605

            Bug ID: 34605
           Summary: GNU ld 2.45.1 emits PDB with unaligned DBI file-info
                    substream
           Product: binutils
           Version: 2.45.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: mirko.mueller at wibu dot com
  Target Milestone: ---

GNU ld 2.45.1 emits PDB with unaligned DBI file-info substream

Description

GNU ld 2.45.1 generates a PDB whose DBI file-info substream is not aligned to a
four-byte boundary.

Microsoft DIA can read the generated PDB: DIA2Dump displays the main symbol.
LLVM's native PDB reader rejects the same file as corrupt, however:
"Invalid PDB Format: The PDB file is corrupt. DBI file info substream not
aligned."

Consequently, llvm-pdbutil dump --all app.pdb cannot dump the PDB or its
symbols.

The main symbol is present in both the object file and the linked executable.
This report concerns the malformed or nonconforming DBI file-info substream
layout, rather than a missing-symbol issue.

Reproducable with a minimal c++ sample:
#include <stdio.h>
int main()
{
  puts("test");
  return 0;
}

And gcc -gcodeview app.cpp -Wl,--pdb=app.pdb.

When running "llvm-pdbutil dump --all app.pdb" you will see some summary output
followed by "Has Publics: falseInvalid PDB Format: The PDB file is corrupt. DBI
file info substream not aligned."

Tool versions:
gcc.exe (Rev8, Built by MSYS2 project) 15.2.0
GNU ld (GNU Binutils) 2.45.1
LLVM version 22.1.8


The issue appears to be in GNU ld's PDB writer, likely where the DBI
source-file-information/file-info substream is serialized and its size is
recorded. The implementation should ensure that the transition from this
substream to the following DBI substream is four-byte aligned, and that the DBI
header's file-info size is consistent with the serialized layout expected by
readers.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to