[llvm] r287067 - Align Modi and FileInfo substreams on 32-byte offsets.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 15 16:59:28 PST 2016
Author: ruiu
Date: Tue Nov 15 18:59:27 2016
New Revision: 287067
URL: http://llvm.org/viewvc/llvm-project?rev=287067&view=rev
Log:
Align Modi and FileInfo substreams on 32-byte offsets.
This is required by DbiStream, but DbiStreamBuilder didn't align
these substreams, so the output of DbiSTreamBuilder couldn't be
read by DbiStream.
Test will be added to LLD.
Modified:
llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp?rev=287067&r1=287066&r2=287067&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStreamBuilder.cpp Tue Nov 15 18:59:27 2016
@@ -107,7 +107,7 @@ uint32_t DbiStreamBuilder::calculateModi
Size += M->Mod.size() + 1;
Size += M->Obj.size() + 1;
}
- return Size;
+ return alignTo(Size, sizeof(uint32_t));
}
uint32_t DbiStreamBuilder::calculateSectionContribsStreamSize() const {
@@ -134,7 +134,7 @@ uint32_t DbiStreamBuilder::calculateFile
NumFileInfos += M->SourceFiles.size();
Size += NumFileInfos * sizeof(ulittle32_t); // FileNameOffsets
Size += calculateNamesBufferSize();
- return Size;
+ return alignTo(Size, sizeof(uint32_t));
}
uint32_t DbiStreamBuilder::calculateNamesBufferSize() const {
@@ -167,7 +167,7 @@ Error DbiStreamBuilder::generateModiSubs
if (auto EC = ModiWriter.writeZeroString(M->Obj))
return EC;
}
- if (ModiWriter.bytesRemaining() != 0)
+ if (ModiWriter.bytesRemaining() > sizeof(uint32_t))
return make_error<RawError>(raw_error_code::invalid_format,
"Unexpected bytes in Modi Stream Data");
return Error::success();
@@ -228,7 +228,7 @@ Error DbiStreamBuilder::generateFileInfo
return make_error<RawError>(raw_error_code::invalid_format,
"The names buffer contained unexpected data.");
- if (MetadataWriter.bytesRemaining() > 0)
+ if (MetadataWriter.bytesRemaining() > sizeof(uint32_t))
return make_error<RawError>(
raw_error_code::invalid_format,
"The metadata buffer contained unexpected data.");
More information about the llvm-commits
mailing list