[PATCH] D36426: [PDB] Fix linking of function symbols and local variables

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 7 13:32:56 PDT 2017


zturner created this revision.
Herald added a subscriber: hiraditya.

  [PDB] Fix linking of function symbols and local variables.
  
  The compiler outputs PROC32_ID symbols into the object files
  for functions, and these symbols have an embedded type index
  which, when copied to the PDB, refer to the IPI stream.  However,
  the symbols themselves are also converted into regular symbols
  (e.g. S_GPROC32_ID -> S_GPROC32), and type indices in the regular
  symbol records refer to the TPI stream.  So this patch applies
  two fixes to function records.
    1. It converts ID symbols to the proper non-ID record type.
    2. After remapping the type index from the object file's index
       space to the PDB file/IPI stream's index space, it then
       remaps that index to the TPI stream's index space by.
  
  Besides functions, during the remapping process we were also
  discarding symbol record types which we did not recognize.  In
  particular, we were discarding S_BPREL32 records, which is what
  MSVC uses to describe local variables on the stack.  So this
  patch fixes that as well by copying them to the PDB.


https://reviews.llvm.org/D36426

Files:
  lld/COFF/PDB.cpp
  lld/test/COFF/pdb-comdat.test
  lld/test/COFF/pdb-invalid-func-type.yaml
  lld/test/COFF/pdb-procid-remapping.test
  lld/test/COFF/pdb-scopes.test
  lld/test/COFF/pdb-symbol-types.yaml
  lld/test/COFF/pdb-type-server-simple.test
  llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
  llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
  llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
  llvm/tools/llvm-pdbutil/MinimalSymbolDumper.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36426.110078.patch
Type: text/x-patch
Size: 19047 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170807/f91ef6a8/attachment.bin>


More information about the llvm-commits mailing list