public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
@ 2021-03-09 16:47 jan.kratochvil at redhat dot com
  2021-03-09 16:48 ` [Bug debug/99490] " jan.kratochvil at redhat dot com
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: jan.kratochvil at redhat dot com @ 2021-03-09 16:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99490
           Summary: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main
                    file, not .dwo file
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jan.kratochvil at redhat dot com
  Target Milestone: ---

FAIL: gcc-11.0.0-0.19.fc35.x86_64
PASS: clang-12.0.0-0.1.rc1.fc35.x86_64

double p_ext=3.14,e_ext=2.71;
int main(void) {
  double q,f;
  { volatile double p=p_ext;
    q=p/1.1;
  }
  { volatile double e=e_ext;
    f=e/1.1;
  }
  return q+f;
}

clang -o range-clang range.c -Wall -O3 -gdwarf-5 -gsplit-dwarf;gcc -o
range-gcc.s range.c -Wall -O3 -gdwarf-5 -gsplit-dwarf
llvm-readelf -WS range-{clang,gcc}{,.dwo} | egrep '^File:|debug_rnglists'
File: range-clang
File: range-clang.dwo
  [ 6] .debug_rnglists.dwo PROGBITS      0000000000000000 0001d4 000017 00   E 
0   0  1
Actual:
File: range-gcc
  [33] .debug_rnglists   PROGBITS        0000000000000000 004c0a 000049 00     
0   0  1
File: range-gcc.dwo
Expected:
File: range-gcc
File: range-gcc.dwo
  [33] .debug_rnglists   PROGBITS        0000000000000000 004c0a 000049 00     
0   0  1

DWARF-5 spec:
"The .debug_rnglists.dwosection contains range lists referenced by any
DW_AT_ranges attributes in the split DWARF object."
"Range lists are contained in a separate object file section called
.debug_rnglists or .debug_rnglists.dwo (in split units)."

Reproducer from attached .s files:
: clang -S -o range-clang.s range.c -Wall -O3 -gdwarf-5 -gsplit-dwarf;clang -o
range-clang range-clang.s -Wall -gdwarf-5 -gsplit-dwarf;: gcc -S -o range-gcc.s
range.c -Wall -O3 -gdwarf-5 -gsplit-dwarf;gcc -o range-gcc range-gcc.s -Wall
-gdwarf-5 -gsplit-dwarf

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
@ 2021-03-09 16:48 ` jan.kratochvil at redhat dot com
  2021-03-09 16:48 ` jan.kratochvil at redhat dot com
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jan.kratochvil at redhat dot com @ 2021-03-09 16:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
Created attachment 50340
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50340&action=edit
range-clang.s

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
  2021-03-09 16:48 ` [Bug debug/99490] " jan.kratochvil at redhat dot com
@ 2021-03-09 16:48 ` jan.kratochvil at redhat dot com
  2021-03-09 19:31 ` marxin at gcc dot gnu.org
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jan.kratochvil at redhat dot com @ 2021-03-09 16:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
Created attachment 50341
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50341&action=edit
range-gcc.s

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
  2021-03-09 16:48 ` [Bug debug/99490] " jan.kratochvil at redhat dot com
  2021-03-09 16:48 ` jan.kratochvil at redhat dot com
@ 2021-03-09 19:31 ` marxin at gcc dot gnu.org
  2021-03-09 20:10 ` jan.kratochvil at redhat dot com
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-09 19:31 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org,
                   |                            |vries at gcc dot gnu.org
   Last reconfirmed|                            |2021-03-09
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (2 preceding siblings ...)
  2021-03-09 19:31 ` marxin at gcc dot gnu.org
@ 2021-03-09 20:10 ` jan.kratochvil at redhat dot com
  2021-03-10  9:53 ` jakub at gcc dot gnu.org
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jan.kratochvil at redhat dot com @ 2021-03-09 20:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
LLDB testsuite failure from it is:

PASS: LLDB (/usr/bin/gcc-x86_64) :: test_with_run_command_dwarf
(TestTypeCompletion.TypeCompletionTestCase)
error: a.out {0x00005850}: DIE has DW_AT_ranges(0x0) attribute, but range
extraction failed (missing or invalid range list table), please file a bug and
attach the file at the start of this error message
FAIL: LLDB (/usr/bin/gcc-x86_64) :: test_with_run_command_dwo
(TestTypeCompletion.TypeCompletionTestCase)
Failed Tests (1):
  lldb-api :: functionalities/type_completion/TestTypeCompletion.py

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (3 preceding siblings ...)
  2021-03-09 20:10 ` jan.kratochvil at redhat dot com
@ 2021-03-10  9:53 ` jakub at gcc dot gnu.org
  2021-03-10 10:17 ` mark at gcc dot gnu.org
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-10  9:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The DWARF4 split DWARF extension used .debug_ranges rather than
.debug_ranges.dwo and the code hasn't been adjusted for -gdwarf-5
-gsplit-dwarf.  It needs quite a lot of changes though.

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (4 preceding siblings ...)
  2021-03-10  9:53 ` jakub at gcc dot gnu.org
@ 2021-03-10 10:17 ` mark at gcc dot gnu.org
  2021-03-10 11:35 ` jakub at gcc dot gnu.org
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: mark at gcc dot gnu.org @ 2021-03-10 10:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Mark Wielaard <mark at gcc dot gnu.org> ---
I don't believe it is a requirement to generate a separate .debug_rnglists.dwo
section, the spec says the same data can be provided in the .debug_rnglists
section and gdb and elfutils handle that just fine for split dwarf. If we would
generate a .debug_rnglists.dwo section then we have to make sure it only
contains DW_RLE_ entries that don't require relocations (like we already do for
.loclists and DW_LLE_ entries).

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (5 preceding siblings ...)
  2021-03-10 10:17 ` mark at gcc dot gnu.org
@ 2021-03-10 11:35 ` jakub at gcc dot gnu.org
  2021-03-10 11:43 ` jan.kratochvil at redhat dot com
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-10 11:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

Incomplete patch I've been playing with.  It clearly isn't enough though.
If I add void foo () {} void bar () {} to your testcase and compile with
clang -gdwarf-5 -gsplit-dwarf -O2 -ffunction-sections, I see it emits both
.debug_rnglists and .debug_rnglists.dwo, the former contains only the single
range list that the DW_TAG_skeleton_unit needs (and uses DW_AT_ranges and
DW_AT_rnglists_base in it), while the latter contains what the DW_AT_ranges in
.debug_info.dwo DIEs need (and doesn't contain DW_AT_rnglists_base).

The question is if it has to be that way.  Can't e.g. the DW_AT_ranges
attribute
for the CU not be present on the DW_TAG_skeleton_unit in .debug_info, but
instead on the DW_TAG_compile_unit DIE in .debug_info.dwo?  In that case we
wouldn't need the .debug_rnglists section, nor DW_AT_rnglists_base attribute.

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (6 preceding siblings ...)
  2021-03-10 11:35 ` jakub at gcc dot gnu.org
@ 2021-03-10 11:43 ` jan.kratochvil at redhat dot com
  2021-03-10 12:03 ` jakub at gcc dot gnu.org
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jan.kratochvil at redhat dot com @ 2021-03-10 11:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
It would be nice if you could provide the .s/.o/.dwo files so that one does not
have to rebuild the patched GCC.

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (7 preceding siblings ...)
  2021-03-10 11:43 ` jan.kratochvil at redhat dot com
@ 2021-03-10 12:03 ` jakub at gcc dot gnu.org
  2021-03-10 12:06 ` jakub at gcc dot gnu.org
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-10 12:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

Updated patch that removes DW_AT_rnglists_base and moves DW_AT_ranges from the
skeleton unit to corresponding compile unit.

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (8 preceding siblings ...)
  2021-03-10 12:03 ` jakub at gcc dot gnu.org
@ 2021-03-10 12:06 ` jakub at gcc dot gnu.org
  2021-03-10 12:29 ` jan.kratochvil at redhat dot com
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-10 12:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 50350
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50350&action=edit
pr99490.tar.xz

Tarball with the updated patch and 4 versions of assembly, all with -gdwarf-5
-gsplit-dwarf -O2, s0 is vanilla trunk (from a few days ago), s1 the same but
with -ffunction-sections, s2 with the latest patch and s3 with the latest patch
and -ffunction-sections.

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (9 preceding siblings ...)
  2021-03-10 12:06 ` jakub at gcc dot gnu.org
@ 2021-03-10 12:29 ` jan.kratochvil at redhat dot com
  2021-03-10 22:10 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jan.kratochvil at redhat dot com @ 2021-03-10 12:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
clang is using DW_AT_ranges+DW_FORM_rnglistx+DW_AT_rnglists_base in the main
file but in the DWO file it assumes DW_AT_rnglists_base is right after the
.debug_rnglists header (as it does not make sense to point it anywhere else in
a DWO file having single CU). It makes sense although I do not see it specified
in DWARF-5:

.debug_info contents:
...
0x00000014: DW_TAG_skeleton_unit [1]  
...
              DW_AT_ranges [DW_FORM_rnglistx]   (indexed (0x0) rangelist =
0x00000010
                 [0x0000000000401110, 0x0000000000401111)
                 [0x0000000000401120, 0x0000000000401121)
                 [0x0000000000401130, 0x0000000000401171))
...
              DW_AT_rnglists_base [DW_FORM_sec_offset]  (0x0000000c)

.debug_info.dwo contents:
...
0x00000014: DW_TAG_compile_unit [1] *
...
                  DW_AT_ranges [DW_FORM_rnglistx]       (indexed (0x0)
rangelist = 0x00000010
                     [0x0000000000000004, 0x0000000000000016)
                     [0x0000000000000022, 0x0000000000000034))

https://github.com/llvm/llvm-project/blob/523d7bc6f427f9ae32e54dbf1764826cfb269d21/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp#L388

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (10 preceding siblings ...)
  2021-03-10 12:29 ` jan.kratochvil at redhat dot com
@ 2021-03-10 22:10 ` jakub at gcc dot gnu.org
  2021-03-10 22:17 ` jan.kratochvil at redhat dot com
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-10 22:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
DWARF5 3.1.3 says:
The following attributes are not part of a split full compilation unit entry
but instead are inherited (if present) from the corresponding skeleton
compilation unit: DW_AT_low_pc, DW_AT_high_pc, DW_AT_ranges, DW_AT_stmt_list,
DW_AT_comp_dir,
DW_AT_str_offsets_base, DW_AT_addr_base and DW_AT_rnglists_base.
So, my current patch is not 100% correct.

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (11 preceding siblings ...)
  2021-03-10 22:10 ` jakub at gcc dot gnu.org
@ 2021-03-10 22:17 ` jan.kratochvil at redhat dot com
  2021-03-10 22:21 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jan.kratochvil at redhat dot com @ 2021-03-10 22:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
That looks as a DWARF5 bug to me. DW_AT_str_offsets_base, DW_AT_addr_base and
DW_AT_rnglists_base do not make any sense for a split unit. Split unit contains
only one CompileUnit (and optionally one TypeUnit where only
DW_AT_str_offsets_base would have some sense).

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (12 preceding siblings ...)
  2021-03-10 22:17 ` jan.kratochvil at redhat dot com
@ 2021-03-10 22:21 ` jakub at gcc dot gnu.org
  2021-03-10 23:18 ` jan.kratochvil at redhat dot com
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-10 22:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
That sentence says that they should not be in the DW_TAG_compile_unit in
.debug_info.dwo, but may be instead (if present at all) in DW_TAG_skeleton_unit
in .debug_info.  Haven't checked all, but DW_AT_addr_base is definitely needed
whenever something in the dwo refers to .debug_addr (so that one knows to which
part of .debug_addr it refers to).

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (13 preceding siblings ...)
  2021-03-10 22:21 ` jakub at gcc dot gnu.org
@ 2021-03-10 23:18 ` jan.kratochvil at redhat dot com
  2021-03-11 12:20 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jan.kratochvil at redhat dot com @ 2021-03-10 23:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
DW_AT_addr_base is for .debug_addr in the main file, I agree, my mistake. That
should be inherited from the skeleton to the split-unit.

But DW_AT_loclists_base, DW_AT_rnglists_base and DW_AT_str_offsets_base point
to .debug_loclists.dwo, .debug_rnglists.dwo and .debug_str_offsets.dwo
respectively.
As there is only one CU in a DWO they make no sense to be inherited from the
skeleton unit to split-unit.

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (14 preceding siblings ...)
  2021-03-10 23:18 ` jan.kratochvil at redhat dot com
@ 2021-03-11 12:20 ` jakub at gcc dot gnu.org
  2021-03-11 12:46 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-11 12:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

Updated patch that implements what has been discussed on dwarf mailing list.

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (15 preceding siblings ...)
  2021-03-11 12:20 ` jakub at gcc dot gnu.org
@ 2021-03-11 12:46 ` jakub at gcc dot gnu.org
  2021-03-12  9:00 ` jan.kratochvil at redhat dot com
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-11 12:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 50365
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50365&action=edit
pr99490-2.tar.xz

And for Jan, assembly for the pr99490.c from the first tarball with the latest
patch.

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

* [Bug debug/99490] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (16 preceding siblings ...)
  2021-03-11 12:46 ` jakub at gcc dot gnu.org
@ 2021-03-12  9:00 ` jan.kratochvil at redhat dot com
  2021-03-12  9:22 ` [Bug debug/99490] [11 Regression] " jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 22+ messages in thread
From: jan.kratochvil at redhat dot com @ 2021-03-12  9:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
Yes, the testcase TestTypeCompletion.py category 'dwo' is now fixed with the
patch from Comment 15.

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

* [Bug debug/99490] [11 Regression] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (17 preceding siblings ...)
  2021-03-12  9:00 ` jan.kratochvil at redhat dot com
@ 2021-03-12  9:22 ` jakub at gcc dot gnu.org
  2021-03-31 19:27 ` cvs-commit at gcc dot gnu.org
  2021-03-31 19:39 ` jakub at gcc dot gnu.org
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-12  9:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.0
            Summary|-gdwarf-5 -gsplit-dwarf     |[11 Regression] -gdwarf-5
                   |puts .debug_rnglists to     |-gsplit-dwarf puts
                   |main file, not .dwo file    |.debug_rnglists to main
                   |                            |file, not .dwo file

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Marking this as a regression because we've switched the default from -gdwarf-4
to -gdwarf-5, so code compiled with -g -gsplit-dwarf used to produce something
valid that consumers could handle and now it doesn't, even when they have
DWARF5 support.

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

* [Bug debug/99490] [11 Regression] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (18 preceding siblings ...)
  2021-03-12  9:22 ` [Bug debug/99490] [11 Regression] " jakub at gcc dot gnu.org
@ 2021-03-31 19:27 ` cvs-commit at gcc dot gnu.org
  2021-03-31 19:39 ` jakub at gcc dot gnu.org
  20 siblings, 0 replies; 22+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-31 19:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 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:4b33c5aaab9e863da162942ab8bcd54070b705af

commit r11-7938-g4b33c5aaab9e863da162942ab8bcd54070b705af
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.

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

* [Bug debug/99490] [11 Regression] -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file
  2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
                   ` (19 preceding siblings ...)
  2021-03-31 19:27 ` cvs-commit at gcc dot gnu.org
@ 2021-03-31 19:39 ` jakub at gcc dot gnu.org
  20 siblings, 0 replies; 22+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-31 19:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #20 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-03-31 19:39 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 16:47 [Bug debug/99490] New: -gdwarf-5 -gsplit-dwarf puts .debug_rnglists to main file, not .dwo file jan.kratochvil at redhat dot com
2021-03-09 16:48 ` [Bug debug/99490] " jan.kratochvil at redhat dot com
2021-03-09 16:48 ` jan.kratochvil at redhat dot com
2021-03-09 19:31 ` marxin at gcc dot gnu.org
2021-03-09 20:10 ` jan.kratochvil at redhat dot com
2021-03-10  9:53 ` jakub at gcc dot gnu.org
2021-03-10 10:17 ` mark at gcc dot gnu.org
2021-03-10 11:35 ` jakub at gcc dot gnu.org
2021-03-10 11:43 ` jan.kratochvil at redhat dot com
2021-03-10 12:03 ` jakub at gcc dot gnu.org
2021-03-10 12:06 ` jakub at gcc dot gnu.org
2021-03-10 12:29 ` jan.kratochvil at redhat dot com
2021-03-10 22:10 ` jakub at gcc dot gnu.org
2021-03-10 22:17 ` jan.kratochvil at redhat dot com
2021-03-10 22:21 ` jakub at gcc dot gnu.org
2021-03-10 23:18 ` jan.kratochvil at redhat dot com
2021-03-11 12:20 ` jakub at gcc dot gnu.org
2021-03-11 12:46 ` jakub at gcc dot gnu.org
2021-03-12  9:00 ` jan.kratochvil at redhat dot com
2021-03-12  9:22 ` [Bug debug/99490] [11 Regression] " jakub at gcc dot gnu.org
2021-03-31 19:27 ` cvs-commit at gcc dot gnu.org
2021-03-31 19:39 ` jakub 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).