<div dir="ltr">Sorry for the delay on this, been OOO. I'll take a look tomorrow.</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 18, 2018 at 3:20 AM Stefan Reinalter via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">stefan_reinalter updated this revision to Diff 156035.<br>
stefan_reinalter added a comment.<br>
<br>
Updated diff to only contain formatted changes for new code.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D49230" rel="noreferrer" target="_blank">https://reviews.llvm.org/D49230</a><br>
<br>
Files:<br>
COFF/PDB.cpp<br>
<br>
<br>
Index: COFF/PDB.cpp<br>
===================================================================<br>
--- COFF/PDB.cpp<br>
+++ COFF/PDB.cpp<br>
@@ -1085,6 +1085,21 @@<br>
EBS, Allocator, CodeViewContainer::Pdb));<br>
}<br>
<br>
+static void addLinkerModuleCoffGroup(const Chunk *firstChunk,<br>
+ const Chunk *lastChunk,<br>
+ pdb::DbiModuleDescriptorBuilder &Mod,<br>
+ OutputSection &OS,<br>
+ BumpPtrAllocator &Allocator) {<br>
+ CoffGroupSym CGS(SymbolRecordKind::CoffGroupSym);<br>
+ CGS.Name = firstChunk->getSectionName();<br>
+ CGS.Segment = OS.SectionIndex;<br>
+ CGS.Offset = firstChunk->getRVA() - OS.getRVA();<br>
+ CGS.Size = lastChunk->getRVA() + lastChunk->getSize() - firstChunk->getRVA();<br>
+ CGS.Characteristics = firstChunk->getOutputCharacteristics();<br>
+ Mod.addSymbol(codeview::SymbolSerializer::writeOneSymbol(<br>
+ CGS, Allocator, CodeViewContainer::Pdb));<br>
+}<br>
+<br>
static void addLinkerModuleSectionSymbol(pdb::DbiModuleDescriptorBuilder &Mod,<br>
OutputSection &OS,<br>
BumpPtrAllocator &Allocator) {<br>
@@ -1097,6 +1112,39 @@<br>
Sym.SectionNumber = OS.SectionIndex;<br>
Mod.addSymbol(codeview::SymbolSerializer::writeOneSymbol(<br>
Sym, Allocator, CodeViewContainer::Pdb));<br>
+<br>
+ // Output COFF groups for individual chunks of this section.<br>
+ // There may be several chunks with the same name (e.g. .text$di), but we only<br>
+ // want to output each unique chunk once.<br>
+ Chunk *firstChunkInSubSection = nullptr;<br>
+ Chunk *lastChunkInSubSection = nullptr;<br>
+<br>
+ for (Chunk *C : OS.getChunks()) {<br>
+ auto *SecChunk = dyn_cast<SectionChunk>(C);<br>
+<br>
+ // If this chunk doesn't represent an unmerged input file chunk, or it<br>
+ // didn't contribute to the final output file, skip it.<br>
+ if (!SecChunk || !SecChunk->isLive())<br>
+ continue;<br>
+<br>
+ if (!firstChunkInSubSection) {<br>
+ firstChunkInSubSection = C;<br>
+ }<br>
+<br>
+ if (C->getSectionName() != firstChunkInSubSection->getSectionName()) {<br>
+ addLinkerModuleCoffGroup(firstChunkInSubSection, lastChunkInSubSection,<br>
+ Mod, OS, Allocator);<br>
+<br>
+ firstChunkInSubSection = C;<br>
+ }<br>
+<br>
+ lastChunkInSubSection = C;<br>
+ }<br>
+<br>
+ if (firstChunkInSubSection && lastChunkInSubSection) {<br>
+ addLinkerModuleCoffGroup(firstChunkInSubSection, lastChunkInSubSection, Mod,<br>
+ OS, Allocator);<br>
+ }<br>
}<br>
<br>
// Creates a PDB file.<br>
<br>
<br>
</blockquote></div>