<div dir="ltr"><div class="gmail_quote"><div dir="ltr">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:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" 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?<br></blockquote><div><br></div></div><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div>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:</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Hope this helps.</div><div><br></div><div>-eric</div></div></div></div></div>