OSDN Git Service

Fix some differences between lld and MSVC generated PDBs.
authorZachary Turner <zturner@google.com>
Fri, 7 Jul 2017 18:45:56 +0000 (18:45 +0000)
committerZachary Turner <zturner@google.com>
Fri, 7 Jul 2017 18:45:56 +0000 (18:45 +0000)
commitb85b70f834a5825ef903a7b2a3bb843860c839cd
tree2242b37b8bb96aefdfeb34b332033fe0f0e25dfd
parent3324d0bf04207405bda200718d3236e370ae79cb
Fix some differences between lld and MSVC generated PDBs.

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.

Differential Revision: https://reviews.llvm.org/D35086

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307422 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h
lib/DebugInfo/PDB/Native/DbiStream.cpp
lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
lib/DebugInfo/PDB/Native/PDBFile.cpp
tools/llvm-pdbutil/Diff.cpp
tools/llvm-pdbutil/DiffPrinter.cpp
tools/llvm-pdbutil/DiffPrinter.h
tools/llvm-pdbutil/llvm-pdbutil.cpp
tools/llvm-pdbutil/llvm-pdbutil.h