aboutsummaryrefslogtreecommitdiffstats
path: root/COFF
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-04 22:11:50 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-04 22:11:50 +0000
commit5d4d137132d719d0d20d119375b205d6a2c721ee (patch)
tree76f546a0733e158f9da39a4360937b4b59aa782d /COFF
parentd93e1dfac8711cfed1a9d9cd1876a788b83945cd (diff)
downloadsrc-5d4d137132d719d0d20d119375b205d6a2c721ee.tar.gz
src-5d4d137132d719d0d20d119375b205d6a2c721ee.zip
Notes
Notes: svn path=/vendor/lld/dist/; revision=311323 svn path=/vendor/lld/lld-trunk-r291012/dist/; revision=311334; tag=vendor/lld/lld-trunk-r291015
Diffstat (limited to 'COFF')
-rw-r--r--COFF/PDB.cpp12
-rw-r--r--COFF/PDB.h9
-rw-r--r--COFF/Writer.cpp2
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");