summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-06-20 18:50:55 +0000
committerZachary Turner <zturner@google.com>2017-06-20 18:50:55 +0000
commit297b6eb20df59d7c5d593b6f04fd4ea9d0e77e29 (patch)
tree63025d0d5dcc4f31ad5541fb4f03691bbf14026f /llvm/lib/DebugInfo
parented130b6ac0e2aa3bfa9ba3d99fe9e2cbf171a789 (diff)
downloadbcm5719-llvm-297b6eb20df59d7c5d593b6f04fd4ea9d0e77e29.tar.gz
bcm5719-llvm-297b6eb20df59d7c5d593b6f04fd4ea9d0e77e29.zip
[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
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp2
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp1
2 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
index 59ecbb50143..745dd742aad 100644
--- a/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
@@ -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;
diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
index 0ad461546d7..aad247ea185 100644
--- a/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
@@ -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;
OpenPOWER on IntegriCloud