[Bug debug/88878] .debug_pubnames/types empty with -flto

2020-07-29 Thread jan.kratochvil at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88878

--- Comment #9 from Jan Kratochvil  ---
(In reply to Richard Biener from comment #8)
> The .debug_types section isn't supposed to be output when in_lto_p
> (that's for the LTRANS units where we generally do not output any
> types into DWARF).  Instead .debug_types has to be output during
> dwarf2out_early_finish when we write the declaration dwarf units,
> the "early" debug info.  That should now be done.

Thanks for the explanation, I see -fdebug-types-section -flto does work with
trunk without any patch, great!


> You can verify with a small testcase and -gpubnames [-flto] where
> with -flto both .debug_pubtype and .debug_pubnames are missing.

I do not think anyone is interested in those, for DWARF-5 they are officially
removed:
http://www.dwarfstd.org/doc/DWARF5.pdf
 * Replace the .debug_pubnames and .debug_pubtypes sections with a single and
   more functional name index section, .debug_names .

And for DWARF-4 those were replaced by GNU .gdb_index .

[Bug debug/88878] .debug_pubnames/types empty with -flto

2020-07-29 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88878

--- Comment #8 from Richard Biener  ---
(In reply to Jan Kratochvil from comment #7)
> Hello, @rguenth could you suggest what problem does -fdebug-types-section
> -flto still have?
> When I remove the use_debug_types's "&& !in_lto_p" part it looks to me as
> working fine. (I haven't done any non-trivial debuginfo testing.)

The .debug_types section isn't supposed to be output when in_lto_p
(that's for the LTRANS units where we generally do not output any
types into DWARF).  Instead .debug_types has to be output during
dwarf2out_early_finish when we write the declaration dwarf units,
the "early" debug info.  That should now be done.  What's still missing
is pubnames/pubtypes I think, -fdebug-types-section works fine now.
But -gpubnames is not.

You can verify with a small testcase and -gpubnames [-flto] where
with -flto both .debug_pubtype and .debug_pubnames are missing.

But nobody complained in years so I gues -gpubnames is unused.

[Bug debug/88878] .debug_pubnames/types empty with -flto

2020-07-29 Thread jan.kratochvil at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88878

Jan Kratochvil  changed:

   What|Removed |Added

 CC||jan.kratochvil at redhat dot 
com

--- Comment #7 from Jan Kratochvil  ---
Hello, @rguenth could you suggest what problem does -fdebug-types-section -flto
still have?
When I remove the use_debug_types's "&& !in_lto_p" part it looks to me as
working fine. (I haven't done any non-trivial debuginfo testing.)

Contents of the .debug_info section:
  Compilation Unit @ offset 0x0:
   Version:   4
 <0>: Abbrev Number: 1 (DW_TAG_compile_unit)
   DW_AT_producer: (indirect string, offset: 0x0): GNU GIMPLE 10.2.1
20200723 (Red Hat 10.2.1-1) -mtune=generic -march=x86-64 -g -g -fno-openmp
-fno-openacc -fno-pie -fdebug-types-section -fltrans
<11>   DW_AT_name: (indirect string, offset: 0xa8): 
  Compilation Unit @ offset 0xc9:
   Version:   4
 <0>: Abbrev Number: 11 (DW_TAG_compile_unit)
   DW_AT_producer: (indirect string, offset: 0x35a): GNU C++14
10.2.1 20200723 (Red Hat 10.2.1-1) -mtune=generic -march=x86-64 -g
-fdebug-types-section -flto
   DW_AT_name: (indirect string, offset: 0x20e): main.C
 <1>: Abbrev Number: 12 (DW_TAG_class_type)
   DW_AT_signature   : signature: 0xf1df7e53d0fa1d2e
  Compilation Unit @ offset 0x15a:
   Version:   4
 <0><165>: Abbrev Number: 11 (DW_TAG_compile_unit)
<166>   DW_AT_producer: (indirect string, offset: 0x35a): GNU C++14
10.2.1 20200723 (Red Hat 10.2.1-1) -mtune=generic -march=x86-64 -g
-fdebug-types-section -flto
<16b>   DW_AT_name: (indirect string, offset: 0x479): lib.C
Contents of the .debug_types section:
  Compilation Unit @ offset 0x0:
   Version:   4
   Signature: 0xf1df7e53d0fa1d2e
   Type Offset:   0x25
 <0><17>: Abbrev Number: 1 (DW_TAG_type_unit)
<19>   DW_AT_GNU_odr_signature: 0xddd94cb16fdd687a
 <1><25>: Abbrev Number: 2 (DW_TAG_class_type)

[Bug debug/88878] .debug_pubnames/types empty with -flto

2019-03-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88878

--- Comment #5 from Richard Biener  ---
Author: rguenth
Date: Fri Mar  1 12:38:38 2019
New Revision: 269305

URL: https://gcc.gnu.org/viewcvs?rev=269305=gcc=rev
Log:
2019-03-01  Richard Biener  

Backport from mainline
2019-03-01  Jakub Jelinek  

PR bootstrap/89539
* dwarf2out.c (output_comdat_type_unit): Add ATTRIBUTE_UNUSED to
early_lto_debug argument.

2019-02-27  Richard Biener  

PR debug/88878
* dwarf2out.c (use_debug_types): Disable when in_lto_p.

2019-02-27  Richard Biener  

PR debug/88878
* dwarf2out.c (output_comdat_type_unit): Add early_lto_debug
parameter, prefix section name with .gnu.debuglto_ if true.
(dwarf2out_finish): Pass false to output_comdat_type_unit.
(dwarf2out_early_finish): Pass true to output_comdat_type_unit.

2019-02-27  Richard Biener  

PR debug/89514
* dwarf2out.c (size_of_die): Key on AT_ref (a)->comdat_type_p
rather than on use_debug_types, doing what output_die does.
(value_format): Likewise.

Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/dwarf2out.c

[Bug debug/88878] .debug_pubnames/types empty with -flto

2019-03-01 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88878

--- Comment #6 from Richard Biener  ---
-fdebug-types-section should be OK now on the branch as well.

[Bug debug/88878] .debug_pubnames/types empty with -flto

2019-02-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88878

--- Comment #4 from Richard Biener  ---
Author: rguenth
Date: Wed Feb 27 14:04:18 2019
New Revision: 269253

URL: https://gcc.gnu.org/viewcvs?rev=269253=gcc=rev
Log:
2019-02-27  Richard Biener  

PR debug/88878
* dwarf2out.c (use_debug_types): Disable when in_lto_p.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/dwarf2out.c

[Bug debug/88878] .debug_pubnames/types empty with -flto

2019-02-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88878

--- Comment #3 from Richard Biener  ---
-fdebug-types-section now work as expected.

[Bug debug/88878] .debug_pubnames/types empty with -flto

2019-02-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88878

--- Comment #2 from Richard Biener  ---
Author: rguenth
Date: Wed Feb 27 12:51:43 2019
New Revision: 269251

URL: https://gcc.gnu.org/viewcvs?rev=269251=gcc=rev
Log:
2019-02-27  Richard Biener  

PR debug/88878
* dwarf2out.c (output_comdat_type_unit): Add early_lto_debug
parameter, prefix section name with .gnu.debuglto_ if true.
(dwarf2out_finish): Pass false to output_comdat_type_unit.
(dwarf2out_early_finish): Pass true to output_comdat_type_unit.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/dwarf2out.c

[Bug debug/88878] .debug_pubnames/types empty with -flto

2019-01-25 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88878

--- Comment #1 from Richard Biener  ---
Applies to -fdebug-types-section as well.