summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-07-07 18:45:56 +0000
committerZachary Turner <zturner@google.com>2017-07-07 18:45:56 +0000
commitc1e93e5fa46772c959a9f5d74dfeb95d3cde4ce3 (patch)
treee6a1e16d55e10052f109ee10270b4952c722dad8 /llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
parentf3b4b2d89d06ededb515703f86ca4ab8744c154d (diff)
downloadbcm5719-llvm-c1e93e5fa46772c959a9f5d74dfeb95d3cde4ce3.tar.gz
bcm5719-llvm-c1e93e5fa46772c959a9f5d74dfeb95d3cde4ce3.zip
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 llvm-svn: 307422
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp b/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
index 4f6ebb0cb34..0b6492efc70 100644
--- a/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/PDBFile.cpp
@@ -385,8 +385,11 @@ bool PDBFile::hasPDBDbiStream() const { return StreamDBI < getNumStreams(); }
bool PDBFile::hasPDBGlobalsStream() {
auto DbiS = getPDBDbiStream();
- if (!DbiS)
+ if (!DbiS) {
+ consumeError(DbiS.takeError());
return false;
+ }
+
return DbiS->getGlobalSymbolStreamIndex() < getNumStreams();
}
@@ -396,8 +399,10 @@ bool PDBFile::hasPDBIpiStream() const { return StreamIPI < getNumStreams(); }
bool PDBFile::hasPDBPublicsStream() {
auto DbiS = getPDBDbiStream();
- if (!DbiS)
+ if (!DbiS) {
+ consumeError(DbiS.takeError());
return false;
+ }
return DbiS->getPublicSymbolStreamIndex() < getNumStreams();
}
OpenPOWER on IntegriCloud