pdb output: Initialize padding in PublicsStreamHeader.
authorNico Weber <nicolasweber@gmx.de>
Tue, 11 Sep 2018 14:11:52 +0000 (14:11 +0000)
committerNico Weber <nicolasweber@gmx.de>
Tue, 11 Sep 2018 14:11:52 +0000 (14:11 +0000)
Makes the produced pdbs more deterministic; before they'd contain 2 arbitary
bytes where this padding was.

Also reorder initialization to match the order of the fields in the struct (nfc)

llvm-svn: 341945

llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp

index 58efc2256ae1235102bd82ab650b33844a1d6981..19efae6fc556b3befd7fe96bde55fcb219931389 100644 (file)
@@ -310,13 +310,14 @@ Error GSIStreamBuilder::commitPublicsHashStream(
   PublicsStreamHeader Header;
 
   // FIXME: Fill these in. They are for incremental linking.
+  Header.SymHash = PSH->calculateSerializedLength();
+  Header.AddrMap = PSH->Records.size() * 4;
   Header.NumThunks = 0;
   Header.SizeOfThunk = 0;
   Header.ISectThunkTable = 0;
+  memset(Header.Padding, 0, sizeof(Header.Padding));
   Header.OffThunkTable = 0;
   Header.NumSections = 0;
-  Header.SymHash = PSH->calculateSerializedLength();
-  Header.AddrMap = PSH->Records.size() * 4;
   if (auto EC = Writer.writeObject(Header))
     return EC;