[llvm-dev] [DWARFv5] Reading the .debug_str_offsets section

Pieb, Wolfgang via llvm-dev llvm-dev at lists.llvm.org
Wed Jul 5 15:13:55 PDT 2017

> -----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.

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.
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

More information about the llvm-dev mailing list