Issue 250311.1: Clarifying use of DW_AT_rnglists_base and other base attributes
Author: | Cary Coutant |
---|---|
Champion: | |
Date submitted: | 2025-03-11 |
Date revised: | |
Date closed: | 2025-03-17 |
Type: | Error |
Status: | Accepted |
DWARF version: | 6 |
Submitted as a replacement for Issue 240618.2: Making sense of DW_AT_rnglists_base.
Background
The various _base
attributes were added for two reasons.
First, to collapse many relocations into one for non-split
DWARF compilations. The CU could specify DW_AT_addr_base
,
DW_AT_loclists_base
, and DW_AT_rnglists_base
, and then
all references to those tables could be relative to those
base pointers and be free of any linker relocations. Second,
to allow a DIE in a split DWARF (.dwo) to reference a table
in the main program (.o, as linked into an exe). This second
purpose is why DW_AT_addr_base
needs to be in the skeleton
CU and inherited by the split CU. But because location lists
and range lists are both in the .dwo, those _base pointers
do not need to be (and should not be) inherited by the split
CU.
In 200709.1, we concluded that
DW_AT_rnglists_base
should be added to the list of
attributes that a skeleton CU could have, based on the
misunderstanding that the split CU should inherit it. But
that was a relic from an early version of split DWARF where
the range list table stayed in the .o and the references
from the .dwo were to range lists in the .o. We changed
that, and moved the range lists to the .dwo, and the split
CU no longer needs to reference the executable and should
not inherit that attribute.
It still makes sense for a skeleton CU to have a
DW_AT_rnglists_base
attribute, as the skeleton CU might
still reference range lists in the .o/exe. In a split DWARF
compilation, these would be just overall CU ranges to
support lookup by address. Other ranges used by DIEs in the
.dwo would reference ranges in the _debug_.rnglists.dwo
section,
and do not need a base address because the references do not
need relocation. Note that it doesn't need to use a base
attribute—it could just use DW_FORM_sec_offset
to reference
what is probably the one location list for the skeleton CU.
So the conclusion was:
Add "8. A
DW_AT_rnglists_base
attribute." to the list of attributes a skeleton unit may have.
This was OK, but somehow we ended up also adding "for range
list entry references from the corresponding split full
compilation unit," which was wrong. I suspect that extra
phrase was copied from bullet 6, about DW_AT_str_offsets
,
which is also wrong.
The non-normative text below those bullets is also wrong:
The
DW_AT_addr_base
,DW_AT_str_offsets
, andDW_AT_rnglists_base
attributes provide context that may be necessary to interpret the contents of the corresponding split DWARF object file.
This is true only for the DW_AT_addr_base
attribute.
In 210310.1, we (correctly) removed
DW_AT_rnglists_base
from the list of inherited attributes in
3.1.3 Split Full Compilation Unit Entries. This issue
(incorrectly) left DW_AT_str_offsets_base
in that list, but
that was fixed in 221203.1.
I think it's therefore incorrect to have a
DW_AT_rnglists_base
or DW_AT_loclists_base
attribute in a
.dwo. If present, and they match sizeof(section header),
it's harmless, but I don't think we should even suggest that
a producer should emit them.
Proposal
In 3.1.2 Skeleton Compilation Unit Entries, change bullet items 6, 7, and 8 to:
6. A
DW_AT_str_offsets
attribute, for indirect string references from this skeleton compilation unit to a (non-split).debug_str_offsets
section.7. A
DW_AT_addr_base
attribute, for indirect references from this skeleton compilation unit and from the corresponding split full compilation unit (See Section 3.1.3) to the compilation unit's contribution to the.debug_addr
section. TheDW_AT_addr_base
attribute provides context that may be necessary to interpret the contents of the corresponding split DWARF object file.8. A
DW_AT_rnglists_base
attribute, for range list entry references from this skeleton compilation unit to a (non-split).debug_rnglists
section.
And remove the non-normative paragraph:
The
DW_AT_addr_base
,DW_AT_str_offsets
, andDW_AT_rnglists_base
attributes provides context that may be necessary to interpret the contents of the corresponding split DWARF object file.
In 7.5.5 Classes and Forms, the loclist bullet should
mention .debug_loclists.dwo
in the first item:
- An index into the
.debug_loclists
or.debug_loclists.dwo
section (DW_FORM_loclistx
)....
Likewise, the rnglist bullet:
- An index into the
.debug_rnglists
or.debug_rnglists.dwo
section (DW_FORM_rnglistx
)....
In Appendix F, Section F.1 Overview, remove the checkmarks
from the Split Full column of Table F.1 for
DW_AT_loclists_base
, DW_AT_rnglists_base
, and DW_AT_str_offsets
.
2025-03-17: Accepted.