Issue 150623.1: Clarify byte order of DW_FORM_ref_sig8

Author: Cary Coutant
Champion: Cary Coutant
Date submitted: 2015-06-23
Date revised:
Date closed:
Type: Clarification
Status: Accepted
DWARF Version: 5
Section many, pg many
E150528.1: Clarify byte order of DW_FORM_ref_sig8

In RFC 1321, the MD5 message-digest algorithm defines its output
as a sequence of 16 bytes. Thus, any mention of byte order is
neither necessary nor appropriate, and we should not refer to the
"low-order 64 bits", but rather to a specific 8-byte subrange of
the digest.

Since the subrange is arbitrary, I've chosen to use the last 8
bytes (i.e., bytes 8-15) of the digest, which matches what GCC
uses today. (I checked, and the GCC implementation is indeed
independent of the host or target byte order.)

I've also chosen to refer to "MD5 digest" rather than "MD5 hash",
as that matches the terminology from the RFC.


Proposed changes to the DWARF spec
----------------------------------

In Section 2.2, on page 18, change:

    ... The third type of reference is an indirect reference to a
    type definition using a 64-bit signature for that type. ...

to:

    ... The third type of reference is an indirect reference to a
    type definition using an 8-byte signature for that type. ...

In Section 3.3.3, on page 60, change:

    ... Each type unit must be uniquely identified by a 64-bit
    signature, ...

to:

    ... Each type unit must be uniquely identified by an 8-byte
    signature, ...

In Section 5.7.1, on page 104, change:

    If the complete declaration of a type has been placed in a
    separate type unit (see Section 3.1.3 on page 60), an
    incomplete declaration of that type in the compilation unit
    may provide the unique 64-bit signature of the type using a
    DW_AT_signature attribute.

to:

    If the complete declaration of a type has been placed in a
    separate type unit (see Section 3.1.3 on page 60), an
    incomplete declaration of that type in the compilation unit
    may provide the unique 8-byte signature of the type using a
    DW_AT_signature attribute.

In Section 6.1.1.2, on page 129, change:

    The list of foreign TUs is an array of 64-bit
    (DW_FORM_ref_sig8) type signatures, ...

to:

    The list of foreign TUs is an array of 8-byte
    (DW_FORM_ref_sig8) type signatures, ...

In Section 6.1.1.4.4, on page 132, change:

    The list of foreign TUs immediately follows the list of local
    TUs. Each entry in the list is an 64-bit type signature (as
    described by DW_FORM_ref_sig8).

to:

    The list of foreign TUs immediately follows the list of local
    TUs. Each entry in the list is an 8-byte type signature (as
    described by DW_FORM_ref_sig8).

In Section 7.3.5.3, on page 178, change:

    Both index sections have the same format, and serve to map a
    64-bit signature to a set of contributions to the debug
    sections.

to:

    Both index sections have the same format, and serve to map an
    8-byte signature to a set of contributions to the debug
    sections.

On page 179, change:

    The hash table begins at offset 16 in the section, and
    consists of an array of S 8-byte slots. Each slot contains a
    64-bit signature.

to:

    The hash table begins at offset 16 in the section, and
    consists of an array of S 8-byte slots. Each slot contains an
    8-byte signature.

On page 179, change:

    Given a 64-bit compilation unit signature or a type signature
    X, ...

to:

    Given an 8-byte compilation unit signature or a type signature
    X, ...

In Section 7.5.1.2, on page 188, change:

    6. type_signature (8-byte unsigned integer)
       A unique 64-bit signature (see Section 7.32 on page 229)
       of the type described in this type unit.

to:

    6. type_signature (8 bytes)
       A unique 8-byte signature (see Section 7.32 on page 229)
       of the type described in this type unit.

In Section 7.5.4, on page 201, change:

    The third type of reference can identify any debugging
    information type entry that has been placed in its own type
    unit. This type of reference (DW_FORM_ref_sig8) is the 64-bit
    type signature (see Section 7.32 on page 229) that was
    computed for the type.

to:

    The third type of reference can identify any debugging
    information type entry that has been placed in its own type
    unit. This type of reference (DW_FORM_ref_sig8) is the 8-byte
    type signature (see Section 7.32 on page 229) that was
    computed for the type.


In Section 7.32, on page 232, change:

    Once the string S has been formed from the DWARF encoding, an
    MD5 hash is computed for the string and the least significant
    64 bits are taken as the type signature.

to:

    Once the string S has been formed from the DWARF encoding, an
    MD5 digest is computed for the string and the last 8 bytes
    are taken as the type signature.

Also change "MD5 hash" to "MD5 digest" in the following locations:

  Section 7.32, page 229:

    The type signature for a type T0 is formed from the MD5 hash
    of a flattened description of the type....

  Section 7.32, page 232:

    * The DW_AT_decl_file, DW_AT_decl_line, and DW_AT_decl_column
      attributes are not included because they may vary from one
      source file to the next, and would prevent two otherwise
      identical type declarations from producing the same MD5
      hash.

  Section 7.32, page 233:

    An example that illustrates the computation of an MD5 hash
    may be found in Appendix E.2 on page 357.

--

7/28/2015 -- Accepted.