[PATCH] D35086: Fix some differences between LLD and MSVC generated PDBs

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 14:16:56 PDT 2017


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

  A couple of things were different about our generated PDBs.
  
  1) We were outputting the wrong Version on the PDB Stream.
     The version we were setting was newer than what MSVC is setting.
     It's not clear what the implications are, but we change LLD
     to use PdbImplVC70, as MSVC does.
  2) For the optional debug stream indices in the DBI Stream, we
     were outputting 0 to mean "the stream is not present".  MSVC
     outputs uint16_t(-1), which is the "correct" way to specify
     that a stream is not present.  So we fix that as well.
  3) We were setting the PDB Stream signature to 0.  This is supposed
     to be the result of calling time(nullptr).  Although this leads
     to non-deterministic builds, a better way to solve that is by
     having a command line option explicitly for generating a
     reproducible build, and have the default behavior of lld-link
     match the default behavior of link.
  
  To test this, I'm making use of the new and improved `pdb diff`
  sub command.  To make it suitable for writing tests against, I had
  to modify the diff subcommand slightly to print less verbose output.
  Previously it would always print | <column> | <value1> | <value2> |
  which is quite verbose, and the values are fragile.  All we really
  want to know is "did we produce the same value as link?"  So I added
  command line options to print a single character representing the
  result status (different, identical, equivalent), and another to
  hide the value display.  Note that just inspecting the diff output
  used to write the test, you can see some things that are obviously
  wrong.  That is just reflective of the fact that this is the state
  of affairs today, not that we're asserting that this is "correct".
  We can use this as a starting point to discover differences, fix
  them, and update the test.


https://reviews.llvm.org/D35086

Files:
  lld/COFF/PDB.cpp
  lld/test/COFF/Inputs/pdb-diff-cl.pdb
  lld/test/COFF/Inputs/pdb-diff.cpp
  lld/test/COFF/Inputs/pdb-diff.obj
  lld/test/COFF/pdb-diff.test
  llvm/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h
  llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
  llvm/tools/llvm-pdbutil/Diff.cpp
  llvm/tools/llvm-pdbutil/DiffPrinter.cpp
  llvm/tools/llvm-pdbutil/DiffPrinter.h
  llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
  llvm/tools/llvm-pdbutil/llvm-pdbutil.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35086.105531.patch
Type: text/x-patch
Size: 23751 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170706/0b5e0cd1/attachment-0001.bin>


More information about the llvm-commits mailing list