Commit 38a2b7ec by Mark Wielaard Committed by Mark Wielaard

DWARF5: Don't generate DW_AT_loclists_base for split compile unit DIEs.

The loclists_base attribute is used to point to the beginning of the
loclists index of a DWARF5 loclists table when using DW_FORM_loclistsx.
For split compile units the base is not given by the attribute, but is
either the first (and only) index in the .debug_loclists.dwo section,
or (when placed in a .dwp file) given by the DW_SECT_LOCLISTS row in
the .debug_cu_index section.

The loclists_base attribute is only valid for the full (or skeleton)
compile unit DIE in the main (relocatable) object. But GCC only ever
generates a loclists table index for the .debug_loclists section put
into the split DWARF .dwo file.

For split compile unit DIEs it is confusing (and not according to spec)
to also have a DW_AT_loclists_base attribute (which might be wrong,
since its relocatable offset won't actually be relocated).

gcc/ChangeLog

	* dwarf2out.c (dwarf2out_finish): Remove generation of
	DW_AT_loclists_base.

From-SVN: r261092
parent f8ad043f
2018-06-01 Mark Wielaard <mark@klomp.org>
* dwarf2out.c (dwarf2out_finish): Remove generation of
DW_AT_loclists_base.
2018-06-01 Eric Botcazou <ebotcazou@adacore.com> 2018-06-01 Eric Botcazou <ebotcazou@adacore.com>
* gimple-ssa-store-merging.c: Include gimple-fold.h. * gimple-ssa-store-merging.c: Include gimple-fold.h.
......
...@@ -31297,9 +31297,15 @@ dwarf2out_finish (const char *) ...@@ -31297,9 +31297,15 @@ dwarf2out_finish (const char *)
{ {
if (have_location_lists) if (have_location_lists)
{ {
if (dwarf_version >= 5) /* Since we generate the loclists in the split DWARF .dwo
add_AT_loclistsptr (comp_unit_die (), DW_AT_loclists_base, file itself, we don't need to generate a loclists_base
loc_section_label); attribute for the split compile unit DIE. That attribute
(and using relocatable sec_offset FORMs) isn't allowed
for a split compile unit. Only if the .debug_loclists
section was in the main file, would we need to generate a
loclists_base attribute here (for the full or skeleton
unit DIE). */
/* optimize_location_lists calculates the size of the lists, /* optimize_location_lists calculates the size of the lists,
so index them first, and assign indices to the entries. so index them first, and assign indices to the entries.
Although optimize_location_lists will remove entries from Although optimize_location_lists will remove entries from
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment