forked from OSchip/llvm-project
COFF: tie the execute and the PDB together
The PDB GUID, Age, and version are tied together by the RSDS record in the binary. Pass along the BuildId information into the createPDB to allow us to tie the binary and the PDB together. llvm-svn: 290975
This commit is contained in:
parent
8ab80ba3a2
commit
df8a13b257
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -28,8 +28,12 @@
|
|||
# CHECK-NEXT: - Stream: [ 8 ]
|
||||
# CHECK-NEXT: - Stream: [ 4 ]
|
||||
# CHECK-NEXT: PdbStream:
|
||||
# Ensure that the Guid matches the RSDS record:
|
||||
# PDBSignature: 0x53445352
|
||||
# PDBGUID (38 9A CC F2 14 A4 7F A2 6C F0 08 04 47 CF 5C 48)
|
||||
# PDBAge: 1
|
||||
# CHECK-NEXT: Age: 1
|
||||
# CHECK-NEXT: Guid: '{00000000-0000-0000-0000-000000000000}'
|
||||
# CHECK-NEXT: Guid: '{389ACCF2-14A4-7FA2-6CF0-080447CF5C48}'
|
||||
# CHECK-NEXT: Signature: 0
|
||||
# CHECK-NEXT: Version: VC70
|
||||
# CHECK-NEXT: NamedStreams:
|
||||
|
|
Loading…
Reference in New Issue