public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/99090] New: gsplit-dwarf broken on riscv64-linux
@ 2021-02-13 21:20 wilson at gcc dot gnu.org
  2021-02-26 11:59 ` [Bug debug/99090] " jakub at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: wilson at gcc dot gnu.org @ 2021-02-13 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99090
           Summary: gsplit-dwarf broken on riscv64-linux
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wilson at gcc dot gnu.org
  Target Milestone: ---

Enabling -gsplit-dwarf by default and trying a build hits an assert in
dw2_asm_output_delta_uleb128 because HAVE_AS_LEB128 is not defined.

The problem appears to be in output_loc_list in dwarf2out.c which has in the
dwarf_split_debug_info code
              /* FIXME: This will ICE ifndef HAVE_AS_LEB128.                    
                 For that case we probably need to emit DW_LLE_startx_endx,     
                 but we'd need 2 .debug_addr entries rather than just one.  */

riscv doesn't allow leb128 because of agressive linker relaxation, so we need
the alternative solution here that works without HAVE_AS_LEB128.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/99090] gsplit-dwarf broken on riscv64-linux
  2021-02-13 21:20 [Bug debug/99090] New: gsplit-dwarf broken on riscv64-linux wilson at gcc dot gnu.org
@ 2021-02-26 11:59 ` jakub at gcc dot gnu.org
  2021-02-26 16:34 ` wilson at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-26 11:59 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Is there any reason why can't .{u,s}leb128 be supported in .debug* sections
when referring to labels in .debug* sections (where I don't see how aggressive
linker relaxation should apply to those sections, those sections heavily rely
on no linker relaxation)?
So essentially have partial as leb128 support instead of none at all?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/99090] gsplit-dwarf broken on riscv64-linux
  2021-02-13 21:20 [Bug debug/99090] New: gsplit-dwarf broken on riscv64-linux wilson at gcc dot gnu.org
  2021-02-26 11:59 ` [Bug debug/99090] " jakub at gcc dot gnu.org
@ 2021-02-26 16:34 ` wilson at gcc dot gnu.org
  2021-02-26 17:50 ` jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: wilson at gcc dot gnu.org @ 2021-02-26 16:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jim Wilson <wilson at gcc dot gnu.org> ---
Yes we could have partial uleb128 support.  There is only a problem if at least
one label is in the code section.

There is another proposed solution to add special relaxable relocations for
uleb128 but the initial proposal had flaws, and no one has reviewed the second
proposal yet.

Or we could change the -gsplit-dwarf support to work even when there is no
uleb128 support.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/99090] gsplit-dwarf broken on riscv64-linux
  2021-02-13 21:20 [Bug debug/99090] New: gsplit-dwarf broken on riscv64-linux wilson at gcc dot gnu.org
  2021-02-26 11:59 ` [Bug debug/99090] " jakub at gcc dot gnu.org
  2021-02-26 16:34 ` wilson at gcc dot gnu.org
@ 2021-02-26 17:50 ` jakub at gcc dot gnu.org
  2021-02-26 18:24 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-26 17:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Making it work is desirable in any case.  But, the emitted debug sections will
be in various spots less compact when .uleb128/.sleb128 don't support
non-constant operands.
Though, I'm afraid the
              /* FIXME: This will ICE ifndef HAVE_AS_LEB128.
                 For that case we probably need to emit DW_LLE_startx_endx,
                 but we'd need 2 .debug_addr entries rather than just one.  */
              dw2_asm_output_delta_uleb128 (curr->end, curr->begin,
                                            "Location list length (%s)",
                                            list_head->ll_symbol);
case is actually code addresses and not .debug section labels, sorry for
confusion.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/99090] gsplit-dwarf broken on riscv64-linux
  2021-02-13 21:20 [Bug debug/99090] New: gsplit-dwarf broken on riscv64-linux wilson at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-02-26 17:50 ` jakub at gcc dot gnu.org
@ 2021-02-26 18:24 ` jakub at gcc dot gnu.org
  2021-02-27  2:35 ` wilson at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-26 18:24 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-02-26
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 50265
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50265&action=edit
gcc11-pr99090.patch

Untested fix.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/99090] gsplit-dwarf broken on riscv64-linux
  2021-02-13 21:20 [Bug debug/99090] New: gsplit-dwarf broken on riscv64-linux wilson at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-02-26 18:24 ` jakub at gcc dot gnu.org
@ 2021-02-27  2:35 ` wilson at gcc dot gnu.org
  2021-03-03  8:54 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: wilson at gcc dot gnu.org @ 2021-02-27  2:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jim Wilson <wilson at gcc dot gnu.org> ---
I tested it with a riscv-gnu-toolchain build and check.  The 4 -gsplit-dwarf
testcases that fail without the patch work with the patch.

I also tried a build and check with -gsplit-dwarf enabled by default and
discovered that there are a number of debug tests that fail simply because the
output is a little different than what is expected.  But nothing else appeared
to fail.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/99090] gsplit-dwarf broken on riscv64-linux
  2021-02-13 21:20 [Bug debug/99090] New: gsplit-dwarf broken on riscv64-linux wilson at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-02-27  2:35 ` wilson at gcc dot gnu.org
@ 2021-03-03  8:54 ` cvs-commit at gcc dot gnu.org
  2021-03-03  8:58 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-03  8:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:b5040344b9ca609e19ee59ba56cd4af9697a1692

commit r11-7472-gb5040344b9ca609e19ee59ba56cd4af9697a1692
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Mar 3 09:53:58 2021 +0100

    dwarf2out: Fix -gsplit-dwarf on riscv or other non-.uleb128 targets
[PR99090]

    As mentioned in the PR, riscv* only supports .uleb128 with constant
    arguments, doesn't support difference of two labels because of aggressive
    linker relaxations.  But I bet various other targets, especially those not
    using GNU assembler, might suffer from the same problem.
    As the FIXME comment in output_loc_list indicates, we ICE on
    -gsplit-dwarf on those targets whenever we need .debug_loclists, because
    we only emit DW_LLE_startx_length which requires working .uleb128 delta
    of 2 code section labels.  We can't use DW_LLE_base_addressx
    once followed by DW_LLE_offset_pair either because the latter suffers
    from the same issue - need .uleb128 difference of code section labels
    (and in that case not just for the second operand but also for the first).

    So, this patch implements what the comment said and emits
DW_LLE_startx_endx
    instead, which wastes more space in .debug_addr, but will work.

    Bootstrapped/regtested on x86_64-linux and i686-linux and as written in the
    PR, Jim has tested it on riscv*linux.  Ok for trunk?

    BTW, for HAVE_AS_LEB128 -gdwarf-5 -gsplit-dwarf, maybe we should consider
    instead of always emitting DW_LLE_startx_length do all the optimizations
    that we do for HAVE_AS_LEB128 -gdwarf-5, or at least a subset of them.
    For !have_multiple_function_sections, we in that case emit just
    DW_LLE_offset_pair (that can certainly be a win for small TUs, we wouldn't
    need any .debug_addr entry in that case; on the other side, just using
    DW_LLE_offset_pair can be harmful for very large TUs especially if the
    loclist has many entries, emitting in that case a single
DW_LLE_base_address
    or for -gsplit-dwarf DW_LLE_base_addressx followed by DW_LLE_offset_pair
    might be much smaller), and for have_multiple_function_sections figuring
    out if DW_LLE_base_address followed by DW_LLE_offset_pair entries
    or DW_LLE_start_length is bettter.  So perhaps a middle-ground for
    -gsplit-dwarf would be to always do the have_multiple_function_sections
    behavior, i.e. DW_LLE_base_addressx followed by DW_LLE_offset_pair vs.
    DW_LLE_startx_length decisions based on the ranges and their counts.
    And perhaps dwz could optimize afterwards, on linked binaries or shared
    libraries it knows all the offsets and could figure out optimal DW_LLE_*.

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

            PR debug/99090
            * dwarf2out.c (dw_loc_list_struct): Add end_entry member.
            (new_loc_list): Clear end_entry.
            (output_loc_list): Only use DW_LLE_startx_length for -gsplit-dwarf
            if HAVE_AS_LEB128, otherwise use DW_LLE_startx_endx.  Fix comment
            typo.
            (index_location_lists): For dwarf_version >= 5 without
HAVE_AS_LEB128,
            initialize also end_entry.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/99090] gsplit-dwarf broken on riscv64-linux
  2021-02-13 21:20 [Bug debug/99090] New: gsplit-dwarf broken on riscv64-linux wilson at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-03-03  8:54 ` cvs-commit at gcc dot gnu.org
@ 2021-03-03  8:58 ` jakub at gcc dot gnu.org
  2021-08-20 21:34 ` belyshev at depni dot sinp.msu.ru
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-03  8:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/99090] gsplit-dwarf broken on riscv64-linux
  2021-02-13 21:20 [Bug debug/99090] New: gsplit-dwarf broken on riscv64-linux wilson at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-03-03  8:58 ` jakub at gcc dot gnu.org
@ 2021-08-20 21:34 ` belyshev at depni dot sinp.msu.ru
  2021-09-11 18:48 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: belyshev at depni dot sinp.msu.ru @ 2021-08-20 21:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99090
Bug 99090 depends on bug 91602, which changed state.

Bug 91602 Summary: GCC fails to build for riscv in a combined tree due to misconfigured leb128 support
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91602

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/99090] gsplit-dwarf broken on riscv64-linux
  2021-02-13 21:20 [Bug debug/99090] New: gsplit-dwarf broken on riscv64-linux wilson at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-08-20 21:34 ` belyshev at depni dot sinp.msu.ru
@ 2021-09-11 18:48 ` pinskia at gcc dot gnu.org
  2022-11-18 22:58 ` law at gcc dot gnu.org
  2022-11-28 22:31 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-11 18:48 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kilobyte at angband dot pl

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 102290 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/99090] gsplit-dwarf broken on riscv64-linux
  2021-02-13 21:20 [Bug debug/99090] New: gsplit-dwarf broken on riscv64-linux wilson at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2021-09-11 18:48 ` pinskia at gcc dot gnu.org
@ 2022-11-18 22:58 ` law at gcc dot gnu.org
  2022-11-28 22:31 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: law at gcc dot gnu.org @ 2022-11-18 22:58 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |law at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #9 from Jeffrey A. Law <law at gcc dot gnu.org> ---
It was fixed on the trunk, in time for gcc-12.  I can't see that we're likely
to backport to gcc-11 or earlier.  So closing as fixed.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug debug/99090] gsplit-dwarf broken on riscv64-linux
  2021-02-13 21:20 [Bug debug/99090] New: gsplit-dwarf broken on riscv64-linux wilson at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2022-11-18 22:58 ` law at gcc dot gnu.org
@ 2022-11-28 22:31 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-28 22:31 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-11-28 22:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-13 21:20 [Bug debug/99090] New: gsplit-dwarf broken on riscv64-linux wilson at gcc dot gnu.org
2021-02-26 11:59 ` [Bug debug/99090] " jakub at gcc dot gnu.org
2021-02-26 16:34 ` wilson at gcc dot gnu.org
2021-02-26 17:50 ` jakub at gcc dot gnu.org
2021-02-26 18:24 ` jakub at gcc dot gnu.org
2021-02-27  2:35 ` wilson at gcc dot gnu.org
2021-03-03  8:54 ` cvs-commit at gcc dot gnu.org
2021-03-03  8:58 ` jakub at gcc dot gnu.org
2021-08-20 21:34 ` belyshev at depni dot sinp.msu.ru
2021-09-11 18:48 ` pinskia at gcc dot gnu.org
2022-11-18 22:58 ` law at gcc dot gnu.org
2022-11-28 22:31 ` pinskia at gcc dot gnu.org

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