[llvm-dev] [DWARFv5] Reading the .debug_str_offsets section
Robinson, Paul via llvm-dev
llvm-dev at lists.llvm.org
Thu Jul 6 06:35:33 PDT 2017
> -----Original Message-----
> From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Pieb,
> Wolfgang via llvm-dev
> Sent: Wednesday, July 05, 2017 6:14 PM
> To: llvm-dev at lists.llvm.org
> Subject: Re: [llvm-dev] [DWARFv5] Reading the .debug_str_offsets section
> > -----Original Message-----
> > From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of
> > Robinson, Paul via llvm-dev
> > Sent: Wednesday, July 05, 2017 1:35 PM
> > To: llvm-dev at lists.llvm.org
> > Subject: [llvm-dev] [DWARFv5] Reading the .debug_str_offsets section
> snip ...
> > Things get way trickier in an object (executable or "-r" ouput) that
> > has a mix of GCC and standard contributions. AFAICT there's no
> > equivalent of DW_AT_str_offsets_base in the GCC style, so about all
> > we can do is something like this:
> > (1) Walk through all units to find all DW_AT_str_offsets_base pointers;
> > (2) for each one, poke around in the prior 8-16 bytes looking for
> > the header; this is more reliable than it sounds;
> > (3) assume everything else in the section is GCC style.
> I believe a mix of GCC and standard contributions should only be an issue
> in a split-DWARF (fission) scenario, as there is no .debug_str_offsets
> section in a non-split pre-V5 compilation AFAIK.
Oh, of course! So a normal object file is always standard. Excellent!
> And given that we don't have a DW_AT_str_offsets_base attribute in
> .debug_info.dwo sections by standard decree, all units (whether standard
> V5 or GCC-style) would have to share the single contribution in the
> .debug_str_offsets.dwo section (or the single contribution in a slice of
> the section via dwp index table).
> So the only tricky part for the reader would be to figure out whether a
> .debug_str_offsets.dwo section (or a slice of it) is GCC-style or a
> (single) v5 standard contribution. As you pointed out earlier, either
> looking at the individual unit versions in the .debug_info.dwo section or
> the individual forms used could do the trick.
> -- wolfgangp
> > Questions and brickbats welcome.
> > --paulr
> > P.S. Ah, you clever reader, who noticed I carefully said nothing about
> > LTO of mixed-DWARF-version compilations! Haven't thought about it.
This is still a question. However I think it's not that hard to
handle. If LTO sees a mix of v4 and v5, we emit a standard
.debug_str_offsets.dwo section but force 32-bit offsets (i.e. leave
a comment for our descendants to make sure that happens) and then
the GCC forms will just DTRT. I think.
The dumper would treat it as a standard section as long as there are
any v5 units in the .dwo (or that contribution to the .dwp).
IIRC the string sections aren't actually emitted until after all
units have been processed, because everything shares the same string
section, so remembering whether any v5 units have crossed our path
and then adding the v5 header at the last moment should be feasible.
> > _______________________________________________
> > LLVM Developers mailing list
> > llvm-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
More information about the llvm-dev