<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 6, 2017 at 3:15 AM George Rimar <<a href="mailto:grimar@accesssoftek.com">grimar@accesssoftek.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>><span style="color:rgb(33,33,33);font-size:12pt">I</span><span style="color:rgb(33,33,33);font-size:12pt">f you're interested in things you can do in the linker for this - you might consider something more aggressive: Fully DWARF aware deduplication.</span></p>
</div><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><div style="color:rgb(33,33,33)"><div>
<div dir="ltr">><br>
>This could be done hopefully by reusing some of the code in the dsymutil implementation in LLVM.<br>
><br>
>This would be much more effective (and without the possible context-sensitive tradeoffs) than using type units. </div>
</div></div></div><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><div style="color:rgb(33,33,33)"><div><div dir="ltr">>Though it'd possibly have a big tradeoff in link time and/or linker memory usage (I'm not sure how much dsymutil needs/uses of either).<br>
<br>
</div></div></div></div><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><div style="color:rgb(33,33,33)"><div><div dir="ltr"><span style="color:rgb(33,33,33);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)">+ Rui.</span></div>
<div dir="ltr"><br>
I think LLD development direction vector currently is to avoid teaching linker about things it naturally should not be aware off.</div></div></div></div></blockquote><div><br>*nod* That's been the historic ELF+DWARF approach, but both MacOS (with dsyms+DWARF) and Windows (COFF+CodeView+PDB) don't do it that way, and instead involve the linker to a degree.<br><br>Mostly I'm wondering if it'd be reasonable to (and if anyone would be interested in doing it) do something more like the PDB support - fully debug-aware linking.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><div style="color:rgb(33,33,33)"><div>
<div dir="ltr">Like it should ideally work with sections as pieces and should not know about content. That is not always possible,</div>
<div dir="ltr">for example we have to look inside .eh_frame to deuplicate FDEs, but that is probably what we would want to avoid in general.<br></div></div></div></div></blockquote><div><br>Yeah, I can totally understand that & it's historically how it's been done, so I'm not expecting a change there, just floating the idea.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><div style="color:rgb(33,33,33)"><div><div dir="ltr">
</div></div></div></div><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><div style="color:rgb(33,33,33)"><div>
<div dir="ltr"><br>
</div>
<div dir="ltr">>It doesn't seem especially important to implement the DWARF5 types -> debug_info thing for this situation, the type units</div>
<div dir="ltr">>as they are (in debug_types) offer the same size benefits here. But sure, if anyone wanted to implement it at some point, that'd be fine.</div>
<div dir="ltr"><br>
</div>
</div></div></div><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><div style="color:rgb(33,33,33)"><div><div dir="ltr">But there is no .debug_types in DWARF5, so it is depricated approach as far I understand.</div></div></div></div></blockquote><div><br>Sure - but it works/is supported/is implemented. If someone wants to implement the newer thing, that's cool, but I don't have any personal motivation to do so for example. (& honestly we've been throwing around some ideas about how to further generalize the debug_info contributions to reduce some of the overhead of isolating types - so maybe if we're lazy enough, we might leapfrog this particular state and just implement that future better thing)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><div style="color:rgb(33,33,33)"><div><div dir="ltr"><br>
<br>
>I think Paul covered some of the reasons type units might not be a reasonable default.<br>
><br>
>One additional reason is that if you use Split DWARF (another great way to massively reduce the amount of debug info going to the linker)</div></div></div></div><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><div style="color:rgb(33,33,33)"><div>
<div dir="ltr">>type units are mostly /just/ overhead in the .dwo files: since the debug info is not linked, there's no opportunity to remove the</div>
</div></div></div><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><div style="color:rgb(33,33,33)"><div><div dir="ltr">>duplication anyway (unless you're making a DWP - like a >dsym file)<br>
<br></div></div></div></div><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><div style="color:rgb(33,33,33)"><div><div dir="ltr">
Yeah. Looks <span style="font-family:monospace;font-size:13px;background-color:rgb(255,255,255)">-gsplit-dwarf</span>​ and -fdebug-types-section are harmfull together. Probably it worth to restrict using of them together or<br>
</div>
<div dir="ltr">emit a warning (both clang and gcc silently allows the combination and output has size penalty you describing).<br></div></div></div></div></blockquote><div><br></div><div>Nah, only if you're not producing a DWP at the end ( <a href="https://gcc.gnu.org/wiki/DebugFissionDWP">https://gcc.gnu.org/wiki/DebugFissionDWP</a> ).<br><br>In short, I probably wouldn't change any of LLVM's defaults. But there are certainly flags people can use to reduce their debug info size.<br><br>You mentioned starting with this because LLVM's defaults mean the DWARF is too large to link with DWARF 32 bit? How does gold cope with this? I haven't seen failures/error messages/etc from either gold or lld related to this? (though I mostly use Split DWARF myself)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><div style="color:rgb(33,33,33)"><div><div dir="ltr">
</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">But then does it make sence to emit multiple .debug_info sections with <span style="color:rgb(33,33,33);font-family:monospace;font-size:13px;background-color:rgb(255,255,255)">-gsplit-dwarf</span>, so that objects will contain skeleton
 .debug_info and<br>
</div>
<div dir="ltr">.debug_info sections with type units as described in DWARF5. So that linker will be able to do deduplication of<br>
</div>
<div dir="ltr">types on a sections level as expected ?<br>
</div></div></div></div><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif"><div style="color:rgb(33,33,33)"><div>
<div dir="ltr"><br>
</div>
<div dir="ltr">George.<br>
</div>
</div></div></div></blockquote></div></div>