forked from OSchip/llvm-project
[PDB] Don't write uninitialized bytes to a PDB file.
There were certain fields that we didn't know how to write, as well as various padding bytes that we would ignore. This leads to garbage data in the PDB. While not strictly necessary, we should initialize these bytes to something meaningful, as it makes for easier binary comparison between PDBs. llvm-svn: 305819
This commit is contained in:
parent
ed130b6ac0
commit
297b6eb20d
|
@ -51,6 +51,7 @@ DbiModuleDescriptorBuilder::DbiModuleDescriptorBuilder(StringRef ModuleName,
|
|||
uint32_t ModIndex,
|
||||
msf::MSFBuilder &Msf)
|
||||
: MSF(Msf), ModuleName(ModuleName) {
|
||||
::memset(&Layout, 0, sizeof(Layout));
|
||||
Layout.Mod = ModIndex;
|
||||
}
|
||||
|
||||
|
@ -102,6 +103,7 @@ template <typename T> struct Foo {
|
|||
template <typename T> Foo<T> makeFoo(T &&t) { return Foo<T>(std::move(t)); }
|
||||
|
||||
void DbiModuleDescriptorBuilder::finalize() {
|
||||
Layout.SC.ModuleIndex = Layout.Mod;
|
||||
Layout.FileNameOffs = 0; // TODO: Fix this
|
||||
Layout.Flags = 0; // TODO: Fix this
|
||||
Layout.C11Bytes = 0;
|
||||
|
|
|
@ -237,6 +237,7 @@ Error DbiStreamBuilder::finalize() {
|
|||
return EC;
|
||||
|
||||
DbiStreamHeader *H = Allocator.Allocate<DbiStreamHeader>();
|
||||
::memset(H, 0, sizeof(DbiStreamHeader));
|
||||
H->VersionHeader = *VerHeader;
|
||||
H->VersionSignature = -1;
|
||||
H->Age = Age;
|
||||
|
|
Loading…
Reference in New Issue