summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
diff options
context:
space:
mode:
authorAlexandre Ganea <alexandre.ganea@ubisoft.com>2019-03-18 19:13:23 +0000
committerAlexandre Ganea <alexandre.ganea@ubisoft.com>2019-03-18 19:13:23 +0000
commit4aeea4cc42323067f0fb73fd844a66fbb295f889 (patch)
treef7a56f2bff1911b6b5a2efe147a270e6f4d8fdef /llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
parent8723a5655172dcea0e26c72c2def7deb9ad83188 (diff)
downloadbcm5719-llvm-4aeea4cc42323067f0fb73fd844a66fbb295f889.tar.gz
bcm5719-llvm-4aeea4cc42323067f0fb73fd844a66fbb295f889.zip
[DebugInfo][PDB] Don't write empty debug streams
Before, empty debug streams were written as 8 bytes (4 bytes signature + 4 bytes for the GlobalRefs count). With this patch, unused empty streams aren't emitted anymore. Modules now encode 65535 as an 'unused stream' value, by convention. Also fix the * Linker * contrib section which wasn't correctly emitted previously. Differential Revision: https://reviews.llvm.org/D59502 llvm-svn: 356395
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
index 922bea765c7..20b6c614254 100644
--- a/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
@@ -103,7 +103,6 @@ uint32_t DbiModuleDescriptorBuilder::calculateSerializedLength() const {
}
void DbiModuleDescriptorBuilder::finalize() {
- Layout.SC.Imod = Layout.Mod;
Layout.FileNameOffs = 0; // TODO: Fix this
Layout.Flags = 0; // TODO: Fix this
Layout.C11Bytes = 0;
@@ -116,12 +115,15 @@ void DbiModuleDescriptorBuilder::finalize() {
// This value includes both the signature field as well as the record bytes
// from the symbol stream.
- Layout.SymBytes = SymbolByteSize + sizeof(uint32_t);
+ Layout.SymBytes =
+ Layout.ModDiStream == kInvalidStreamIndex ? 0 : getNextSymbolOffset();
}
Error DbiModuleDescriptorBuilder::finalizeMsfLayout() {
this->Layout.ModDiStream = kInvalidStreamIndex;
uint32_t C13Size = calculateC13DebugInfoSize();
+ if (!C13Size && !SymbolByteSize)
+ return Error::success();
auto ExpectedSN =
MSF.addStream(calculateDiSymbolStreamSize(SymbolByteSize, C13Size));
if (!ExpectedSN)
OpenPOWER on IntegriCloud