diff options
author | Zachary Turner <zturner@google.com> | 2017-07-31 19:36:08 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-07-31 19:36:08 +0000 |
commit | 8d927b6bf908503e7d2f7aca22d6fec2a15fd44b (patch) | |
tree | f9b536787bc48c6dc3ef8d83743d660af7106f01 /llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp | |
parent | fb82a59a8cc21778bebd6931acaa8e3daf35268c (diff) | |
download | llvm-8d927b6bf908503e7d2f7aca22d6fec2a15fd44b.zip llvm-8d927b6bf908503e7d2f7aca22d6fec2a15fd44b.tar.gz llvm-8d927b6bf908503e7d2f7aca22d6fec2a15fd44b.tar.bz2 |
[lld/pdb] Add an empty globals stream.
We don't write any actual symbols to this stream yet, but for
now we just create the stream and hook it up to the appropriate
places and give it a valid header.
Differential Revision: https://reviews.llvm.org/D35290
llvm-svn: 309608
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp index 21e5e4b..a8b80ac 100644 --- a/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp @@ -15,6 +15,7 @@ #include "llvm/DebugInfo/PDB/GenericError.h" #include "llvm/DebugInfo/PDB/Native/DbiStream.h" #include "llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h" +#include "llvm/DebugInfo/PDB/Native/GlobalsStreamBuilder.h" #include "llvm/DebugInfo/PDB/Native/InfoStream.h" #include "llvm/DebugInfo/PDB/Native/InfoStreamBuilder.h" #include "llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h" @@ -80,6 +81,12 @@ PublicsStreamBuilder &PDBFileBuilder::getPublicsBuilder() { return *Publics; } +GlobalsStreamBuilder &PDBFileBuilder::getGlobalsBuilder() { + if (!Globals) + Globals = llvm::make_unique<GlobalsStreamBuilder>(*Msf); + return *Globals; +} + Error PDBFileBuilder::addNamedStream(StringRef Name, uint32_t Size) { auto ExpectedStream = Msf->addStream(Size); if (!ExpectedStream) @@ -131,6 +138,13 @@ Expected<msf::MSFLayout> PDBFileBuilder::finalizeMsfLayout() { } } + if (Globals) { + if (auto EC = Globals->finalizeMsfLayout()) + return std::move(EC); + if (Dbi) + Dbi->setGlobalsStreamIndex(Globals->getStreamIndex()); + } + return Msf->build(); } @@ -220,5 +234,13 @@ Error PDBFileBuilder::commit(StringRef Filename) { return EC; } + if (Globals) { + auto GS = WritableMappedBlockStream::createIndexedStream( + Layout, Buffer, Globals->getStreamIndex(), Allocator); + BinaryStreamWriter GSWriter(*GS); + if (auto EC = Globals->commit(GSWriter)) + return EC; + } + return Buffer.commit(); } |