[PATCH] Fix -gdwarf-5 -gsplit-dwarf ICEs (PR debug/89498)

Alexandre Oliva aoliva@redhat.com
Sat Mar 9 09:47:00 GMT 2019


On Mar  9, 2019, Jakub Jelinek <jakub@redhat.com> wrote:

> Whatever we choose, IMHO: 1) we can't introduce new DW_FORM_*
> 2) we must avoid changing anything on how it was represented for the
> non-split case, we've already shipped GCC 8.[123] with it

None of the thoughts I wrote out involved any of that, so it looks like
we're in agreement.

> 3) the consumer must be able to figure out easily according to clear rules
> how to interpret the attribute and find the views.

I don't immediately see trouble there either.  DW_FORM_sec_offset has
different base addresses depending on the attribute they're used in.

My favorite suggestion is that we just define that the base address for
DW_FOR_sec_offset in split-dwarfv5 is the base address of the entries in
the loclistx index table, given by DW_AT_loclists_base.  Now I realize
this sort of amounts to introducing a new attribute class, but any
extended attribute might sort of do that already.  Anyway, maybe this
requirement makes it not such a great idea, after all.

So maybe in extended split-dwarfv5 mode, we should bite the bullet and
generate an index table for view lists, right after the index table for
loc lists, and use DW_FORM_loclistx.  That would be interpreted just as
in DW_AT_location, except that the index entry would NOT be in the range
implied by the Offset Entry Count in the loclists.dwo section header,
and it would reference a view list rather than a loclist.  Its being out
of range in an extended attribute would likely limit any surprises to
readers unaware of the DW_AT_GNU_locviews extension, especially WRT
split-dwarfv5.

> case etc.  We need to look at what we emit with
> -gdwarf-{2,3,4,5} {,-gsplit-dwarf}.

For v<5, we use DW_FORM_sec_offset for both DW_AT_location and
DW_AT_GNU_locviews, with absolute addresses for -gno-split-dwarf, and
with .Ldebug_loc0-based offsets for -gsplit-dwarf.

We use exactly the same logic for DW_AT_GNU_locviews in v5, even though
the logic for DW_AT_location changes for -gsplit-dwarf.  Given the
precedent for changing the DW_FORM_sec_offset's base address in split
compile units, I hope we can stick to it, but if you see some reason not
to do that, even for an extension, we should probably go with the
index-based indirection and DW_FORM_loclistx.

-- 
Alexandre Oliva, freedom fighter   https://FSFLA.org/blogs/lxo
Be the change, be Free!         FSF Latin America board member
GNU Toolchain Engineer                Free Software Evangelist
Hay que enGNUrecerse, pero sin perder la terGNUra jamás-GNUChe



More information about the Gcc-patches mailing list