From: Mark Wielaard <mark@klomp.org>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>,
gcc@gcc.gnu.org,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: Split DWARF and rnglists, gcc vs clang
Date: Fri, 13 Nov 2020 19:34:43 +0100 [thread overview]
Message-ID: <0f175f575fcf3172a1cc8e34ba9ac1b24803481e.camel@klomp.org> (raw)
In-Reply-To: <d6199d0f-142f-f5c6-2104-2c311800cc8f@polymtl.ca>
Hi Simon,
On Fri, 2020-11-13 at 10:41 -0500, Simon Marchi wrote:
> So in the end the logical thing to do when encountering a
> DW_FORM_rnglistx in a split-unit, in order to support everybody, is
> probably to go to the .debug_rnglists.dwo section, if there's one,
> disregarding the (inherited) DW_AT_rnglists_base. If there isn't, then
> try the linked file's .debug_rnglists section, using
> DW_AT_rnglists_base. If there isn't, then something is malformed.
Yes, I think that makes sense.
> > I interpreted it as when there is a base attribute in the (skeleton)
> > unit, then the corresponding section (index table) can be found in the
> > main object file.
>
> That doesn't work with how clang produces it, AFAIU. There is a
> DW_AT_rnglists_base attribute in the skeleton and a .debug_rnglists in
> the linked file, which is used for the skeleton's DW_AT_ranges
> attribute. And there is also .debug_rnglists.dwo sections in the DWO
> files. So DW_FORM_rnglistx values in the skeleton use the
> .debug_rnglists in the linked file, while the DW_FORM_rnglistx values
> in the DWO file use the .debug_rnglists.dwo in that file (even though
> there is a DW_AT_rnglists_base in the skeleton).
I would have expected the skeleton's DW_AT_ranges to use
DW_FORM_secoffset, not DW_FORM_rnglistx. Precisely because you would
then get an ambiguity. But it would indeed be good to handle that
situation.
> > I think it depends on who exactly you ask and what their specific
> > goals/setups are. Both things, reducing the number of relocations and
> > moving data out of the main object file, are independently useful in
> > different context. But I think it is mainly reducing the number of
> > relocations that is beneficial. For example clang (but not yet gcc)
> > supports having the .dwo sections themselves in the main object file
> > (using SHF_EXCLUDED for the .dwo sections, so the linker will still
> > skip them). Which is also a possibility that the spec describes and
> > which really makes split DWARF much more usable, because then you don't
> > need to change your build system to deal with multiple output files.
>
> Not sure I understand. Does that mean that the .dwo sections are
> emitted in the .o files, and that's the end of the road for them? The
> DW_AT_dwo_name attributes of the skeletons then refer to the .o files?
Yes, precisely. I am not sure whether it is already in any released
clang, but if it is you could try -gsplit-dwarf=single to see an
example.
Note that elfutils libdw doesn't yet handle that variant. Luckily not
because of a design issue, but because there are some sanity checks
that trigger when seeing a .debug_xxx and .debug_xxx.dwo section in the
same file. I have a partial patch to fix that and make it so that you
can explicitly open a file as either a "main" Dwarf or "split" Dwarf.
The only thing it doesn't do yet is share the file handle between the
Dwarf object (which isn't strictly needed, but would be a nice
optimization).
I actually think having a "single" split-dwarf file (.o == .dwo) is the
best way to support Split Dwarf more generically because then it would
simply work without having to adjust all build systems to work
with/around separate .dwo files.
Cheers,
Mark
prev parent reply other threads:[~2020-11-13 18:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <d2bd55b6-67fb-a04c-95d3-bae4a0c65ff5@polymtl.ca>
[not found] ` <20201113001143.GA2654@wildebeest.org>
2020-11-13 14:45 ` Simon Marchi
2020-11-13 15:18 ` Mark Wielaard
2020-11-13 15:41 ` Simon Marchi
2020-11-13 18:34 ` Mark Wielaard [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0f175f575fcf3172a1cc8e34ba9ac1b24803481e.camel@klomp.org \
--to=mark@klomp.org \
--cc=gcc@gcc.gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=gdb@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).