[Dwarf-Discuss] Split Dwarf vs. CU DW_AT_ranges / DW_AT_low_pc placement

David Blaikie dblaikie@gmail.com
Wed Mar 10 20:59:09 GMT 2021


On Wed, Mar 10, 2021 at 12:32 PM Cary Coutant <ccoutant at gmail.com> wrote:

> Location List and Range List Sections Improvement/Enhancement >> We
> got a report today that GCC even for -gdwarf-5 -gsplit-dwarf uses
> >> .debug_rnglists section + DW_AT_ranges + DW_AT_low_pc +
> DW_AT_rnglists_base
> >> attributes in the DW_TAG_skeleton_unit (and then some DW_AT_ranges in
> >> .debug_info.dwo that use DW_FORM_rnglistx, but no .debug_rnglists.dwo
> >> section).
>
> The original split DWARF proposal, and the prototype implementation
> based on DWARF-4 in GCC did not use .debug_rnglists.dwo (this was
> before .debug_ranges was converted to .debug_rnglists by issue
> 160123.1), so we used DW_AT_ranges_base in the skeleton CU so that dwo
> files could use DW_AT_ranges with a non-relocatable offset relative to
> that base.
>
> With issues 160123.1 (Unify Location Lists and Range Lists) and
> 160714.1 (Location List and Range List Sections
> Improvement/Enhancement), we replaced .debug_ranges with
> .debug_rnglists, and made it possible to place range lists into
> .debug_rnglists.dwo when using split DWARF.
>
> DW_AT_rnglists_base is useful to reduce the number of relocations in a
> non-split-DWARF object file. It's not necessary when placing range
> lists into the dwo file, but if it were to be used there, it would not
> make sense to put it in the skeleton CU. It's pointless in a split
> DWARF situation, since no relocations are necessary for
> DW_FORM_rnglistx.
>

But what about the DW_AT_ranges on the skeleton CU when using split DWARF?

Are you suggesting that both LLVM and GCC's emission is incorrect - and
that it's not possible to use rnglistx in the skeleton CU (instead you must
use sec_offset for DW_AT_ranges on the skeleton CU)? (& that there's no way
to refer to range lists in the .o (debug_rnglists) from the .dwo - all
ranges in the split full unit must be in debug_rnglists.dwo?)


> It sounds like the DWARF-5 implementation of split DWARF in GCC still
> has some residuals from the prototype based on DWARF-4. That's likely
> due to my retirement and the move of the rest of the Google compiler
> team over to LLVM.
>
> > I think the spec is ambiguous here:
> >
> > 3.1.3 "The following attributes are not part of a split full compilation
> unit entry but instead are 18 inherited (if present) from the corresponding
> skeleton compilation unit: DW_AT_low_pc, 19 DW_AT_high_pc, DW_AT_ranges,
> DW_AT_stmt_list, DW_AT_comp_dir, 20 DW_AT_str_offsets_base, DW_AT_addr_base
> and DW_AT_rnglists_base."
> >
> > So, on the one hand, if rnglists_base is inherited that implies that
> rnglists_base on a skeleton CU means rnglists.dwo is not used. (so the only
> way to use rnglists.dwo is to not have rnglists_base on the skeleton CU and
> you don't have it on the split full CU and /that's/ how rnglistx in split
> full unit refer to rnglists.dwo instead of debug_rnglists in the linked
> executable)
>
> Yes, it would be possible to keep range lists in .debug_rnglists (and
> in the .o) under split DWARF, and then DW_AT_rnglists_base in the
> skeleton CU would make sense. But that's not the intent.
>
> -cary
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/attachments/20210310/86723007/attachment.html>



More information about the Dwarf-discuss mailing list