[PATCH] D49230: Add support for COFF groups in * Linker * compiland in PDB
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 25 20:32:06 PDT 2018
Sorry for the delay on this, been OOO. I'll take a look tomorrow.
On Wed, Jul 18, 2018 at 3:20 AM Stefan Reinalter via Phabricator <
reviews at reviews.llvm.org> wrote:
> stefan_reinalter updated this revision to Diff 156035.
> stefan_reinalter added a comment.
>
> Updated diff to only contain formatted changes for new code.
>
>
> https://reviews.llvm.org/D49230
>
> Files:
> COFF/PDB.cpp
>
>
> Index: COFF/PDB.cpp
> ===================================================================
> --- COFF/PDB.cpp
> +++ COFF/PDB.cpp
> @@ -1085,6 +1085,21 @@
> EBS, Allocator, CodeViewContainer::Pdb));
> }
>
> +static void addLinkerModuleCoffGroup(const Chunk *firstChunk,
> + const Chunk *lastChunk,
> + pdb::DbiModuleDescriptorBuilder &Mod,
> + OutputSection &OS,
> + BumpPtrAllocator &Allocator) {
> + CoffGroupSym CGS(SymbolRecordKind::CoffGroupSym);
> + CGS.Name = firstChunk->getSectionName();
> + CGS.Segment = OS.SectionIndex;
> + CGS.Offset = firstChunk->getRVA() - OS.getRVA();
> + CGS.Size = lastChunk->getRVA() + lastChunk->getSize() -
> firstChunk->getRVA();
> + CGS.Characteristics = firstChunk->getOutputCharacteristics();
> + Mod.addSymbol(codeview::SymbolSerializer::writeOneSymbol(
> + CGS, Allocator, CodeViewContainer::Pdb));
> +}
> +
> static void addLinkerModuleSectionSymbol(pdb::DbiModuleDescriptorBuilder
> &Mod,
> OutputSection &OS,
> BumpPtrAllocator &Allocator) {
> @@ -1097,6 +1112,39 @@
> Sym.SectionNumber = OS.SectionIndex;
> Mod.addSymbol(codeview::SymbolSerializer::writeOneSymbol(
> Sym, Allocator, CodeViewContainer::Pdb));
> +
> + // Output COFF groups for individual chunks of this section.
> + // There may be several chunks with the same name (e.g. .text$di), but
> we only
> + // want to output each unique chunk once.
> + Chunk *firstChunkInSubSection = nullptr;
> + Chunk *lastChunkInSubSection = nullptr;
> +
> + for (Chunk *C : OS.getChunks()) {
> + auto *SecChunk = dyn_cast<SectionChunk>(C);
> +
> + // If this chunk doesn't represent an unmerged input file chunk, or it
> + // didn't contribute to the final output file, skip it.
> + if (!SecChunk || !SecChunk->isLive())
> + continue;
> +
> + if (!firstChunkInSubSection) {
> + firstChunkInSubSection = C;
> + }
> +
> + if (C->getSectionName() != firstChunkInSubSection->getSectionName()) {
> + addLinkerModuleCoffGroup(firstChunkInSubSection,
> lastChunkInSubSection,
> + Mod, OS, Allocator);
> +
> + firstChunkInSubSection = C;
> + }
> +
> + lastChunkInSubSection = C;
> + }
> +
> + if (firstChunkInSubSection && lastChunkInSubSection) {
> + addLinkerModuleCoffGroup(firstChunkInSubSection,
> lastChunkInSubSection, Mod,
> + OS, Allocator);
> + }
> }
>
> // Creates a PDB file.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180725/e5e080f5/attachment.html>
More information about the llvm-commits
mailing list