diff options
Diffstat (limited to 'COFF')
-rw-r--r-- | COFF/PDB.cpp | 12 | ||||
-rw-r--r-- | COFF/PDB.h | 9 | ||||
-rw-r--r-- | COFF/Writer.cpp | 2 |
3 files changed, 15 insertions, 8 deletions
diff --git a/COFF/PDB.cpp b/COFF/PDB.cpp index 56d5a3651143..d5c52a69be69 100644 --- a/COFF/PDB.cpp +++ b/COFF/PDB.cpp @@ -13,6 +13,7 @@ #include "Error.h" #include "SymbolTable.h" #include "Symbols.h" +#include "llvm/DebugInfo/CodeView/CVDebugRecord.h" #include "llvm/DebugInfo/CodeView/SymbolDumper.h" #include "llvm/DebugInfo/CodeView/TypeDumper.h" #include "llvm/DebugInfo/MSF/ByteStream.h" @@ -131,7 +132,8 @@ static void addTypeInfo(SymbolTable *Symtab, // Creates a PDB file. void coff::createPDB(StringRef Path, SymbolTable *Symtab, - ArrayRef<uint8_t> SectionTable) { + ArrayRef<uint8_t> SectionTable, + const llvm::codeview::DebugInfo *DI) { if (Config->DumpPdb) dumpCodeView(Symtab); @@ -146,11 +148,9 @@ void coff::createPDB(StringRef Path, SymbolTable *Symtab, // Add an Info stream. auto &InfoBuilder = Builder.getInfoBuilder(); - InfoBuilder.setAge(1); - - // Should be a random number, 0 for now. - InfoBuilder.setGuid({}); - + InfoBuilder.setAge(DI->PDB70.Age); + InfoBuilder.setGuid( + *reinterpret_cast<const pdb::PDB_UniqueId *>(&DI->PDB70.Signature)); // Should be the current time, but set 0 for reproducibilty. InfoBuilder.setSignature(0); InfoBuilder.setVersion(pdb::PdbRaw_ImplVer::PdbImplVC70); diff --git a/COFF/PDB.h b/COFF/PDB.h index 091e90fa1ef1..c9c37914299a 100644 --- a/COFF/PDB.h +++ b/COFF/PDB.h @@ -13,12 +13,19 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" +namespace llvm { +namespace codeview { +union DebugInfo; +} +} + namespace lld { namespace coff { class SymbolTable; void createPDB(llvm::StringRef Path, SymbolTable *Symtab, - llvm::ArrayRef<uint8_t> SectionTable); + llvm::ArrayRef<uint8_t> SectionTable, + const llvm::codeview::DebugInfo *DI); } } diff --git a/COFF/Writer.cpp b/COFF/Writer.cpp index 3e69aebbb424..71217ebeb60a 100644 --- a/COFF/Writer.cpp +++ b/COFF/Writer.cpp @@ -304,7 +304,7 @@ void Writer::run() { writeBuildId(); if (!Config->PDBPath.empty()) - createPDB(Config->PDBPath, Symtab, SectionTable); + createPDB(Config->PDBPath, Symtab, SectionTable, BuildId->DI); if (auto EC = Buffer->commit()) fatal(EC, "failed to write the output file"); |