]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libdw: Handle DW_AT_ranges in split DWARF 5 skeleton in dwarf_ranges
authorOmar Sandoval <osandov@fb.com>
Wed, 27 Sep 2023 18:20:52 +0000 (11:20 -0700)
committerMark Wielaard <mark@klomp.org>
Tue, 3 Oct 2023 15:21:02 +0000 (17:21 +0200)
commitc9c9ffae725009b192b40e2d89035f353ae7055f
treed8db486c2a0a12e33a5a383f6e42a4ca691ae08d
parent626186d6e7595121fd34234a574e9cecbea99a1a
libdw: Handle DW_AT_ranges in split DWARF 5 skeleton in dwarf_ranges

When commit 879f3a4f99df ("libdw: Handle .debug_rnglists in
dwarf_ranges.") added support for split DWARF 5 in 2018, GCC put all
range lists for split DWARF in the .debug_rnglists section of the
skeleton file (similarly to GNU DebugFission, which puts all range lists
in .debug_ranges in the skeleton file).

In 2021, after a discussion on the dwarf-discuss mailing list [1], GCC
changed this to match Clang's behavior.  Now, ranges are in
.debug_rnglists.dwo in the split file, _except_ for one: the skeleton
unit DIE has a DW_AT_ranges attribute, and its ranges are in
.debug_rnglists in the skeleton file.  See GCC commit 4b33c5aaab9e
("dwarf2out: Fix up ranges for -gdwarf-5 -gsplit-dwarf [PR99490]") and
the Issue 210310.1 clarifying the DWARF standard [2].

Unfortunately, this confuses dwarf_ranges, which always uses
.debug_rnglists.dwo if it exists.  Fix it by special casing the unit
DIE: its range lists should be in .debug_rnglists if that exists, and
.debug_rnglists.dwo otherwise.

1: https://lists.dwarfstd.org/pipermail/dwarf-discuss/2021-March/002009.html
2: https://dwarfstd.org/issues/210310.1.html

Signed-off-by: Omar Sandoval <osandov@fb.com>
libdw/ChangeLog
libdw/dwarf_ranges.c