From: Mark Wielaard Date: Fri, 1 Jun 2018 23:04:09 +0000 (+0000) Subject: DWARF5: Don't generate DW_AT_loclists_base for split compile unit DIEs. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=38a2b7ecfbf049e4fd3241b6fa79e39ef8ba2b12;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 427945d5fff..3278823415c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-06-01 Mark Wielaard + + * dwarf2out.c (dwarf2out_finish): Remove generation of + DW_AT_loclists_base. + 2018-06-01 Eric Botcazou * gimple-ssa-store-merging.c: Include gimple-fold.h. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 3a24225690d..e3d24e86c15 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -31297,9 +31297,15 @@ dwarf2out_finish (const char *) { if (have_location_lists) { - if (dwarf_version >= 5) - add_AT_loclistsptr (comp_unit_die (), DW_AT_loclists_base, - loc_section_label); + /* Since we generate the loclists in the split DWARF .dwo + file itself, we don't need to generate a loclists_base + 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, so index them first, and assign indices to the entries. Although optimize_location_lists will remove entries from