<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 19, 2016 at 8:08 PM, Eric Christopher via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><br><div class="gmail_quote"><span class=""><div dir="ltr">On Fri, Feb 19, 2016 at 7:45 PM Robinson, Paul <<a href="mailto:Paul_Robinson@playstation.sony.com" target="_blank">Paul_Robinson@playstation.sony.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">You know I favor the pedantic answer.
</span><span style="font-size:11.0pt;font-family:Wingdings;color:#1f497d">J</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">  The point remains, type unit signatures need to be content-dependent and dwo_ids really don't,
 regardless of the details, because they have different consistency requirements.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"></span></p></div></div></blockquote><div><br></div></span><div>Where content dependent can mean a lot of things :)</div><div><br></div><div>That said, I really wish I could remember the dwo_id reasoning for using the hash for type units rather than a simple hash of the section.</div></div></div></blockquote><div><br></div><div>One reason that sprung to my mind is type units themselves - the hash of the debug_info section would be insufficient to capture the change in the content of a type. Eg: <br><br>struct foo { int i; };<br>foo f;<br><br>With type units enabled, would produce the same hash if you make the int a float instead.<br><br>So you'd at least have to hash the content of the types as well (but perhaps you could hash the whole debug_types section instead of the content-aware hashing)<br><br>So that's a best-guess right now: we didn't have the bytes in memory to just hash, and we didn't want to use a frontend-provided identifier because that would be needlessly volatile (comment changes would purturb it, etc - you only want a hash of what ends up in the debug info, not more than that). So it's possible that we can hash the bytes before we emit them and patch them up (having the bytes in memory first isn't the end of the world - LLVM's MC API currently does that anyway, so we can't avoid that by streaming it out - but it dose double that requirement unless/until we improve LLVM's MC APIs)<br><br>But I thought there were other reasons too - would have to look at what things the type unit hash /doesn't/ hash and see why... <br><br>- Dave</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>-eric</div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">--paulr<u></u><u></u></span></p>
<p class="MsoNormal"><a name="1040695768_msg-f:1526663664908981973__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></a></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Eric Christopher [mailto:<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>]
<br>
<b>Sent:</b> Friday, February 19, 2016 7:07 PM<br>
<b>To:</b> Robinson, Paul; Peter Collingbourne; Adrian Prantl</span></p></div></div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><br>
<b>Cc:</b> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<b>Subject:</b> Re: [PATCH] D17321: DIEData, DIEWriter: introduce and begin migration.<u></u><u></u></span></p></div></div></div></div></div><div lang="EN-US" link="blue" vlink="purple"><div><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Fri, Feb 19, 2016 at 6:52 PM Robinson, Paul <<a href="mailto:Paul_Robinson@playstation.sony.com" target="_blank">Paul_Robinson@playstation.sony.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Type units are COMDATs produced across (potentially) many compilations, so the key has to correspond
 to the content in a predictable/consistent way in order for the linker to throw away duplicates. Therefore the type-unit hash is specified the way it is.</span><u></u><u></u></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Doesn't matter. The way that we're doing it in clang is perfectly acceptable for this.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">dwo_ids are just identifiers matching two lumps of data for the same CU, produced by the same compilation,
 so they aren't sensitive to content (at least not in the same way as type units).  But it would seem prudent for two compilations of the "same" source to have different IDs, thus hashing the .debug_info content might not be the best choice; a more random-number
 kind of ID would be more appropriate.</span><u></u><u></u></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I don't see this either, but I know where you're coming from.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">-eric<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">--paulr</span><u></u><u></u></p>
<p class="MsoNormal"><a name="1040695768_msg-f:1526663664908981973_msg-f:1526660323155250066__MailEndCompos"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></a><u></u><u></u></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> llvm-commits [mailto:<a href="mailto:llvm-commits-bounces@lists.llvm.org" target="_blank">llvm-commits-bounces@lists.llvm.org</a>]
<b>On Behalf Of </b>Eric Christopher via llvm-commits<br>
<b>Sent:</b> Friday, February 19, 2016 6:39 PM<br>
<b>To:</b> Peter Collingbourne; Adrian Prantl<br>
<b>Cc:</b> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<b>Subject:</b> Re: [PATCH] D17321: DIEData, DIEWriter: introduce and begin migration.</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<div>
<p class="MsoNormal">On Fri, Feb 19, 2016 at 5:45 PM Peter Collingbourne via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal">On Fri, Feb 19, 2016 at 03:47:22PM -0800, Adrian Prantl wrote:<br>
><br>
> > On Feb 19, 2016, at 12:31 PM, Peter Collingbourne via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
> ><br>
> > them incorrectly, see DwarfDebug::makeTypeSignature). Since the page at<br>
> > <a href="https://gcc.gnu.org/wiki/DebugFission" target="_blank">https://gcc.gnu.org/wiki/DebugFission</a> does not specify how the hash is to be<br>
> > computed, could we maybe do something simpler (e.g. MD5 hash the DIE bytes<br>
> > themselves) and avoid needing to use something like the DWARF type hashing<br>
> > algorithm for this?<br>
><br>
> Where it can LLVM uses an MD5 sum over the mangled name of the type to avoid the expensive DWARF type hashing.<br>
><br>
> Just a side node: Debug info fission is in the process of being standardized in DWARF 5. The progress can be tracked here:<br>
>   <a href="http://dwarfstd.org/Issues.php?type=closed4" target="_blank">http://dwarfstd.org/Issues.php?type=closed4</a> (search for “fission” and “split DWARF”)<br>
> The DWARF specification may deviate from the description on the GCC wiki a little, but we probably want to follow the DWARF spec where that makes sense.<br>
<br>
I see. From <a href="http://dwarfstd.org/ShowIssue.php?issue=130313.4" target="_blank">
http://dwarfstd.org/ShowIssue.php?issue=130313.4</a> :<br>
<br>
>   5.  A DW_AT_dwo_id attribute whose value is an 8-byte<br>
>       unsigned hash of the full compilation unit.  This hash<br>
>       value is computed by the method described in Section 7.27<br>
>       ("Type Signature Computation").<br>
<br>
That's unfortunate. Maybe I'm missing something, but I don't really see why<br>
the attribute value needs to be specified like that, as the hash is only<br>
used by consumers to match skeleton units with full units, and it should be<br>
up to the producer to use a good enough hash. Is there any possibility of<br>
changing the specification before DWARF 5 is standardised?<u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">It has been, but it's not really important as any two compilers aren't going to agree on debug info output anyhow so they're unlikely to match. I raised this in committee at the
 time as a "may" rather than "is". That said, recent text (I don't have an absolutely updated version in front of me) reads:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">A DW_AT_dwo_id attribute whose implementation-defined integer constant value, known as the compilation unit ID, provides unique identification of this compilation unit as well as
 the associated split compilation unit in the object file named in the DW_AT_dwo_name attribute. For simplicity, the DW_AT_dwo_id attributes in the skeleton compilation unit and the corresponding split full compilation unit (see Section 3.1.3 on the following
 page) must use the same form to encode this identification value.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">The means of determining a compilation unit ID does not need to be similar or related to the means of determining a type unit signature.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">That said, ISTR at the time having a good reason why a hash of the debug_info section wasn't a sufficient method for unique identifiers, but my brain isn't coming up with it right
 now. Might have been related to not having a finalized section before wanting to splat in the hash, but I'm not sure.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">For the type ids we haven't worried because we're only supporting type units for C++ types at the moment, if we wanted to support C types we'd want to come up with another identifier
 so we could merge similar types across compilation units.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Hope this helps.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">-eric<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div></div></div></blockquote></div></div></div></div>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div>