public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aurelien at aurel32 dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/103874] [11/12 Regression] ICE in internal_error on riscv64
Date: Sat, 01 Jan 2022 01:05:41 +0000	[thread overview]
Message-ID: <bug-103874-4-X2ELqkMM6u@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103874-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103874

Aurelien Jarno <aurelien at aurel32 dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at redhat dot com

--- Comment #5 from Aurelien Jarno <aurelien at aurel32 dot net> ---
A bisect pointed me to that commit:

commit 4b33c5aaab9e863da162942ab8bcd54070b705af
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Mar 31 21:25:58 2021 +0200

    dwarf2out: Fix up ranges for -gdwarf-5 -gsplit-dwarf [PR99490]

    For -gdwarf-4 -gsplit-dwarf we used to emit .debug_ranges section
    (so in the binaries/shared libraries) with DW_AT_ranges from skeleton
    units as well as .debug_info.dwo pointing to it through DW_FORM_sec_offset
    (and DW_AT_GNU_ranges_base pointing into section, not sure for what
    reason exactly).
    When DWARF5 support was being added, we've started using .debug_rnglists
    section, added DW_AT_rnglists_base to the DW_TAG_skeleton_unit, kept
    DW_AT_ranges with DW_FORM_sec_offset in the skeleton and switched
    over to DW_FORM_rnglistx for DW_AT_ranges in .debug_info.dwo.
    But the DWARF5 spec actually means for the ranges section (at least
    everything for those DW_AT_ranges in .debug_info.dwo) to sit
    in .debug_rnglists.dwo section next to the .debug_info.dwo, rather than
    having consumers look it up in the binary/shared library instead.
    Based on some discussions in the DWARF discuss mailing list:
   
http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/2021-March/thread.html#4765
    this patch mostly follows what LLVM emits for that right now:
    1) small .debug_rnglists section (when needed) just to cover the
       skeleton DW_AT_ranges (if present); the content of the section
       uses the Split DWARFy DW_RLE_* codes with addrx encodings where
       possible
    2) DW_AT_ranges in the skeleton uses DW_FORM_sec_offset (difference
       from LLVM which uses DW_FORM_rnglistx, which makes it larger
       and ambiguous)
    3) DW_AT_rnglists_base attribute is gone from the skeleton (again,
       unlike LLVM where it is just confusing what exactly it means because
       it is inherited; it would make sense if we emitted DW_FORM_rnglistx
       in non-split DWARF, but unless ranges are shared, I'm afraid we'd
       make DWARF larger with fewer relocations by that)
    4) usually big .debug_rnglists.dwo section again with using DW_RLE_*x*
       where possible
    5) DW_AT_ranges with DW_FORM_rnglistx from .debug_info.dwo referring to
       that .debug_rnglists.dwo ranges

    2021-03-31  Jakub Jelinek  <jakub@redhat.com>

            PR debug/99490
            * dwarf2out.c (debug_ranges_dwo_section): New variable.
            (DW_RANGES_IDX_SKELETON): Define.
            (struct dw_ranges): Add begin_entry and end_entry members.
            (DEBUG_DWO_RNGLISTS_SECTION): Define.
            (add_ranges_num): Adjust r initializer for addition of *_entry
            members.
            (add_ranges_by_labels): For -gsplit-dwarf and force_direct,
            set idx to DW_RANGES_IDX_SKELETON.
            (use_distinct_base_address_for_range): New function.
            (index_rnglists): Don't set r->idx if it is equal to
            DW_RANGES_IDX_SKELETON.  Initialize r->begin_entry and
            r->end_entry for -gsplit-dwarf if those will be needed by
            output_rnglists.
            (output_rnglists): Add DWO argument.  If true, switch to
            debug_ranges_dwo_section rather than debug_ranges_section.
            Adjust l1/l2 label indexes.  Only output the offset table when
            dwo is true and don't include in there the skeleton range
            entry if present.  For -gsplit-dwarf, skip ranges that belong
            to the other rnglists section.  Change return type from void
            to bool and return true if there are any range entries for
            the other section.  For dwarf_split_debug_info use
            DW_RLE_startx_endx, DW_RLE_startx_length and DW_RLE_base_addressx
            entries instead of DW_RLE_start_end, DW_RLE_start_length and
            DW_RLE_base_address.  Use use_distinct_base_address_for_range.
            (init_sections_and_labels): Initialize debug_ranges_dwo_section
            if -gsplit-dwarf and DWARF >= 5.  Adjust ranges_section_label
            and range_base_label indexes.
            (dwarf2out_finish): Call index_rnglists earlier before finalizing
            .debug_addr.  Never emit DW_AT_rnglists_base attribute.  For
            -gsplit-dwarf and DWARF >= 5 call output_rnglists up to twice
            with different dwo arguments.
            (dwarf2out_c_finalize): Clear debug_ranges_dwo_section.

 gcc/dwarf2out.c | 255 ++++++++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 211 insertions(+), 44 deletions(-)

  parent reply	other threads:[~2022-01-01  1:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-31 12:48 [Bug c/103874] New: " aurelien at aurel32 dot net
2021-12-31 12:55 ` [Bug c/103874] " aurelien at aurel32 dot net
2021-12-31 15:14 ` [Bug target/103874] " aurelien at aurel32 dot net
2021-12-31 15:15 ` aurelien at aurel32 dot net
2021-12-31 16:26 ` aurelien at aurel32 dot net
2022-01-01  1:05 ` aurelien at aurel32 dot net [this message]
2022-01-01  1:23 ` [Bug debug/103874] [11/12 Regression] ICE in internal_error on riscv64 and -gsplit-dwarf pinskia at gcc dot gnu.org
2022-01-04 14:01 ` rguenth at gcc dot gnu.org
2022-01-19 12:42 ` jakub at gcc dot gnu.org
2022-01-20  2:22 ` pinskia at gcc dot gnu.org
2022-01-20 10:59 ` cvs-commit at gcc dot gnu.org
2022-01-20 10:59 ` [Bug debug/103874] [11 " jakub at gcc dot gnu.org
2022-01-20 22:34 ` aurelien at aurel32 dot net
2022-01-24  9:21 ` cvs-commit at gcc dot gnu.org
2022-01-24  9:28 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103874-4-X2ELqkMM6u@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).