[llvm-pdbutil] Fix build.

Some platforms require an explicit specialization of std::hash
for PdbRaw_FeaturesSig.  Also a test involving case sensitivity
needed to be fixed.  For now that particular check just accepts
any path even if they're completely different.  Long term we
should output paths in the correct case to match MSVC.

llvm-svn: 307426
This commit is contained in:
Zachary Turner 2017-07-07 19:00:06 +00:00
parent 4eb210bdeb
commit fe71c546e7
2 changed files with 227 additions and 216 deletions

View File

@ -1,216 +1,216 @@
This test verifies that we produce PDBs compatible with MSVC in various ways.
We check in a cl-generated object file, PDB, and original source which serve
as the "baseline" for us to measure against. Then we link the same object
file with LLD and compare the two PDBs. Since the baseline object file and
PDB are already checked in, we just run LLD on the object file.
RUN: lld-link /debug /pdb:%T/pdb-diff-lld.pdb /nodefaultlib /entry:main %S/Inputs/pdb-diff.obj
RUN: llvm-pdbutil diff -result -values=false %T/pdb-diff-lld.pdb %S/Inputs/pdb-diff-cl.pdb | FileCheck %s
CHECK: ----------------------
CHECK-NEXT: | MSF Super Block |
CHECK-NEXT: |----------------+---|
CHECK-NEXT: | File | |
CHECK-NEXT: |----------------+---|
CHECK-NEXT: | Block Size | I |
CHECK-NEXT: |----------------+---|
CHECK-NEXT: | Block Count |
CHECK-NEXT: |----------------+---|
CHECK-NEXT: | Unknown 1 | I |
CHECK-NEXT: |----------------+---|
CHECK-NEXT: | Directory Size |
CHECK-NEXT: |----------------+---|
CHECK-NEXT: ------------------------------------
CHECK-NEXT: | Stream Directory |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | File | |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Stream Count | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Old MSF Directory | I |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | PDB Stream | I |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | TPI Stream | I |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | DBI Stream | I |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | IPI Stream | I |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Section Header Data | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Named Stream "/names" | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Named Stream "/LinkInfo" | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Named Stream "/src/heade..." | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Module "{{.*}}\pdb-diff.obj" | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Module "* Linker *" | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | TPI Hash | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | IPI Hash | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Global Symbol Hash | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Public Symbol Hash | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Public Symbol Records | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | New FPO Data | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: ------------------------------------
CHECK-NEXT: | String Table |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | File | |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Number of Strings | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Hash Version | I |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Byte Size |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Signature | I |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Empty Strings |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | {{.*}}pdb-diff.cpp | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | $T0 $ebp = $...p $T0 8 + = | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | d:\src\llvm-...er internal) | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: ----------------------------
CHECK-NEXT: | PDB Stream |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | File | |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Stream Size |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Age | I |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Guid | D |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Signature | D |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Version | I |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Features (set) | I |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Feature | I |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Named Stream Size | D |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Named Streams (map) | D |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | /names | I |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | /LinkInfo | E |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | /src/headerblock | D |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: ----------------------------------------------
CHECK-NEXT: | DBI Stream |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | File | |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Dbi Version | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Age | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Machine | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Flags | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Build Major | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Build Minor | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Build Number | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | PDB DLL Version | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | PDB DLL RBLD | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (FPO) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (Exception) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (Fixup) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (OmapToSrc) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (OmapFromSrc) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (SectionHdr) | {{[EI]}} |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (TokenRidMap) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (Xdata) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (Pdata) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (NewFPO) | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (SectionHdrOrig) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Globals Stream | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Publics Stream | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Symbol Records | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Has CTypes | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Is Incrementally Linked | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Is Stripped | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Module Count | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Source File Count | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: |Module "{{.*}}\pdb-diff.obj"|
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Modi | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Obj File Name | {{[EI]}} |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Debug Stream | {{[EI]}} |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - C11 Byte Size | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - C13 Byte Size | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - # of files | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Pdb File Path Index | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Source File Name Index | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Symbol Byte Size | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Module "* Linker *" |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Modi | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Obj File Name | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Debug Stream | {{[EI]}} |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - C11 Byte Size | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - C13 Byte Size | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - # of files | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Pdb File Path Index | {{[EI]}} |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Source File Name Index | {{[EI]}} |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Symbol Byte Size | D |
CHECK-NEXT: |----------------------------------------+---|
This test verifies that we produce PDBs compatible with MSVC in various ways.
We check in a cl-generated object file, PDB, and original source which serve
as the "baseline" for us to measure against. Then we link the same object
file with LLD and compare the two PDBs. Since the baseline object file and
PDB are already checked in, we just run LLD on the object file.
RUN: lld-link /debug /pdb:%T/pdb-diff-lld.pdb /nodefaultlib /entry:main %S/Inputs/pdb-diff.obj
RUN: llvm-pdbutil diff -result -values=false %T/pdb-diff-lld.pdb %S/Inputs/pdb-diff-cl.pdb | FileCheck %s
CHECK: ----------------------
CHECK-NEXT: | MSF Super Block |
CHECK-NEXT: |----------------+---|
CHECK-NEXT: | File | |
CHECK-NEXT: |----------------+---|
CHECK-NEXT: | Block Size | I |
CHECK-NEXT: |----------------+---|
CHECK-NEXT: | Block Count |
CHECK-NEXT: |----------------+---|
CHECK-NEXT: | Unknown 1 | I |
CHECK-NEXT: |----------------+---|
CHECK-NEXT: | Directory Size |
CHECK-NEXT: |----------------+---|
CHECK-NEXT: ------------------------------------
CHECK-NEXT: | Stream Directory |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | File | |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Stream Count | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Old MSF Directory | I |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | PDB Stream | I |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | TPI Stream | I |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | DBI Stream | I |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | IPI Stream | I |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Section Header Data | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Named Stream "/names" | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Named Stream "/LinkInfo" | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Named Stream "/src/heade..." | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Module "{{.*}}\pdb-diff.obj" | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Module "* Linker *" | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | TPI Hash | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | IPI Hash | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Global Symbol Hash | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Public Symbol Hash | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Public Symbol Records | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | New FPO Data | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: ------------------------------------
CHECK-NEXT: | String Table |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | File | |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Number of Strings | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Hash Version | I |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Byte Size |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Signature | I |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | Empty Strings |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | {{.*}}pdb-diff.cpp | {{[EI]}} |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | $T0 $ebp = $...p $T0 8 + = | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: | d:\src\llvm-...er internal) | D |
CHECK-NEXT: |------------------------------+---|
CHECK-NEXT: ----------------------------
CHECK-NEXT: | PDB Stream |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | File | |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Stream Size |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Age | I |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Guid | D |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Signature | D |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Version | I |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Features (set) | I |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Feature | I |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Named Stream Size | D |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | Named Streams (map) | D |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | /names | I |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | /LinkInfo | E |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: | /src/headerblock | D |
CHECK-NEXT: |----------------------+---|
CHECK-NEXT: ----------------------------------------------
CHECK-NEXT: | DBI Stream |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | File | |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Dbi Version | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Age | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Machine | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Flags | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Build Major | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Build Minor | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Build Number | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | PDB DLL Version | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | PDB DLL RBLD | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (FPO) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (Exception) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (Fixup) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (OmapToSrc) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (OmapFromSrc) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (SectionHdr) | {{[EI]}} |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (TokenRidMap) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (Xdata) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (Pdata) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (NewFPO) | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | DBG (SectionHdrOrig) | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Globals Stream | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Publics Stream | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Symbol Records | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Has CTypes | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Is Incrementally Linked | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Is Stripped | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Module Count | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Source File Count | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: |Module "{{.*}}\pdb-diff.obj"|
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Modi | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Obj File Name | {{[DEI]}} |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Debug Stream | {{[EI]}} |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - C11 Byte Size | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - C13 Byte Size | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - # of files | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Pdb File Path Index | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Source File Name Index | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Symbol Byte Size | D |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | Module "* Linker *" |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Modi | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Obj File Name | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Debug Stream | {{[EI]}} |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - C11 Byte Size | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - C13 Byte Size | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - # of files | I |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Pdb File Path Index | {{[EI]}} |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Source File Name Index | {{[EI]}} |
CHECK-NEXT: |----------------------------------------+---|
CHECK-NEXT: | - Symbol Byte Size | D |
CHECK-NEXT: |----------------------------------------+---|

View File

@ -13,12 +13,23 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/raw_ostream.h"
#include <list>
#include <unordered_set>
namespace std {
template <> struct hash<llvm::pdb::PdbRaw_FeatureSig> {
typedef llvm::pdb::PdbRaw_FeatureSig argument_type;
typedef std::size_t result_type;
result_type operator()(argument_type Item) const {
return std::hash<uint32_t>{}(uint32_t(Item));
}
};
} // namespace std
namespace llvm {
namespace pdb {