Issue 211102.1: No DW_FORM_strp in .dwo files

Author: Paul Robinson
Champion: David Blaikie
Date submitted: 2021-11-02
Date revised: 2022-10-28
Date closed: 2022-10-31
Type: Error
Status: Accepted
DWARF Version: 6
Section F.1, pg 393

The top paragraph of p.393 reads:

  In a .dwo file, referring to a string using DW_FORM_strp is valid,
but such use
  results in a file that cannot be incorporated into a package file
(which involves
  string merging).

Actually my understanding is that DW_FORM_strp is not allowed at all
in a .dwo file.
This is not stated explicitly, but a .dwo file cannot have
relocations, and so can't
use any form that requires a relocation.

See section, p.189, paragraph starting at line 6:

  Split DWARF object files do not get linked with any other files, therefore
  references between sections must not make use of normal object file relocation
  information. As a result, symbolic references within or between
sections are not

This doesn't say "forms that use relocations cannot be used in a .dwo file" but
it comes pretty close.


1. Section 7.3.1, p186.

Following the bullet for DW_FORM_strp (after line 12), insert the
following new bullet:

The .debug_macro section may have DW_MACRO_define_strp and
DW_MACRO_undef_strp entries (see Section on page 167).
These entries refer to strings in the .debug_str section.
These values require relocation.

2. Section, page 189.

Following, and as part of the bullet at the top of the page, add a
new subparagraph.

    Attributes that refer to the .debug_str.dwo string table do so
    only indirectly through the .debug_str_offsets.dwo section using the
    form DW_FORM_strx, DW_FORM_strx1, DW_FORM_strx2,
    DW_FORM_strx3, or DW_FORM_strx4, as well as macro entries
    DW_MACRO_define_strx or DW_MACRO_undef_strx. Direct
    reference using form DW_FORM_strp or DW_FORM_strp8, as well
    as the macro entries DW_MACRO_define_strp or
    DW_MACRO_undef_strp, is not allowed.

3. Section 7.3.3, page 189.

Change the title to "Executable Objects and Related .dwo Files".

4. Section 7.3.3, page 189.

Replace the entire second paragraph (lines 13-21) with the following.

    The sections in an executable file containing the debugging
    information are typically not loaded as part of the memory image of
    the program (in ELF terminology, the sections are not "allocatable"
    and are not part of a loadable segment). Therefore, the debugging
    information sections described in this document are typically linked
    as if they were each to be loaded at virtual address 0. Similarly,
    debugging information in a .dwo file is not loaded in the memory image.
    The absence (or non-use) of relocation information in a .dwo file means
    that sections described in this document are effectively linked as if
    they were each to be loaded at virtual address 0. In both cases,
    references within the debugging information always implicitly indicate
    which section a particular offset refers to. (For example, a reference
    of form DW_FORM_sec_offset may refer to one of several sections,
    depending on the class allowed by a particular attribute of a debugging
    information entry, as shown in Table 7.5 on page 211.)

5. Section B.2, Figure B.2, pages 278-281:

Delete edges (do) and (po) in the Figure B.2 as well as the corresponding
textual explanations that follow.

6. Section F.1, page 392.

Add the following to the end of the bottom paragraph (at line 35):

    This merge is facilitated by the requirement that all references to
    the .debug_str.dwo string table are made indirectly through the
    .debug_str_offsets.dwo section so that only that section needs to
    be modified during string merging.

7. Section F.4, page 393.

Delete the top paragraph (lines 1-3).

2022-07-08:  Revised.
2022-08-15:  Revised - add bullet re .debug_macro.
2022-10-11:  Revised - Expanded and revised proposal.
   Previous version:
2022-10-21:  Accepted.  (Section names corrected.)
2022-10-28:  Reopened, revised to include macros.
2022-10-31:  Accepted.