This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][2/2] early LTO debug, main part
- From: Richard Biener <rguenther at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Jason Merrill <jason at redhat dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 20 Sep 2017 10:20:03 +0200 (CEST)
- Subject: Re: [PATCH][2/2] early LTO debug, main part
- Authentication-results: sourceware.org; auth=none
- References: <alpine.LSU.2.20.1705191235260.20726@zhemvz.fhfr.qr> <7c94dcc5-ee25-76ca-8abb-e0a22b57cba2@redhat.com> <alpine.LSU.2.20.1708021029230.10808@zhemvz.fhfr.qr> <CADzB+2nDWZOom8MaM-dEFjTNwDTRB6Kq0jSAWr=4nXDu702m2A@mail.gmail.com> <alpine.LSU.2.20.1708031142210.10808@zhemvz.fhfr.qr> <CADzB+2nHQOAOmSO86LzGwWgyUm=kKxMk=KeKosMbOXQAkb6rvg@mail.gmail.com> <alpine.LSU.2.20.1708041418140.10808@zhemvz.fhfr.qr> <20170919152414.GR1701@tucnak> <20170919212209.GT1701@tucnak>
On Tue, 19 Sep 2017, Jakub Jelinek wrote:
> On Tue, Sep 19, 2017 at 05:24:14PM +0200, Jakub Jelinek wrote:
> > These changes broke DWARF-5 support. E.g. in gcc-7 and before this change
> > there was:
Sorry for the breakage I had to manually merge conflicts in this
part quite a few times since the 1.5 years the patch was under review.
Appearantly there's no testsuite coverage for this when testing with
default flags (nor is there any coverage for -gsplit-dwarf btw...).
> Here is a fix, make check-g++ RUNTESTFLAGS=dwarf2.exp now passes again
> even with !DWARF2_ASM_LINE_DEBUG_INFO compiler. Haven't tried LTO (except
> for what is in make check). Bootstrapped/regtested on x86_64-linux and
> i686-linux, ok for trunk?
>
> 2017-09-19 Jakub Jelinek <jakub@redhat.com>
>
> * dwarf2out.c (DEBUG_LTO_DWO_INFO_SECTION): Reorder defines.
> (DEBUG_LTO_ABBREV_SECTION): Likewise.
> (DEBUG_LTO_MACINFO_SECTION): Likewise.
> (DEBUG_MACRO_SECTION): Likewise.
> (DEBUG_LTO_MACRO_SECTION): Likewise.
> (DEBUG_STR_DWO_SECTION): Likewise.
> (DEBUG_LTO_STR_DWO_SECTION): Likewise.
> (DEBUG_LTO_LINE_SECTION): Drop .dwo suffix from the name.
I think this has .dwo because similar to DWO this section can
be dropped (it's only "fake" because for some reason we do have
to have a line section).
Anyway, I did a quick LTO bootstrap with your patch and it seems
to work fine.
Can you add a testcase verifying -gdwarf-5 works ok (properly
emitting a debug_line_str section?).
Ok with that change.
Thanks and sorry for the breakage,
Richard.
> (DEBUG_LTO_DWO_LINE_SECTION): Define.
> (DEBUG_LTO_LINE_STR_SECTION): Define.
> (init_sections_and_labels): Initialize debug_line_str_section
> variable. Initialize debug_loc_section for -gdwarf-5 to
> DEBUG_LOCLISTS_SECTION. Formatting fixes.
>
> --- gcc/dwarf2out.c.jj 2017-09-19 16:51:16.000000000 +0200
> +++ gcc/dwarf2out.c 2017-09-19 18:07:51.348919965 +0200
> @@ -3702,24 +3702,24 @@ new_addr_loc_descr (rtx addr, enum dtpre
> #ifndef DEBUG_DWO_INFO_SECTION
> #define DEBUG_DWO_INFO_SECTION ".debug_info.dwo"
> #endif
> -#ifndef DEBUG_LTO_DWO_INFO_SECTION
> -#define DEBUG_LTO_DWO_INFO_SECTION ".gnu.debuglto_.debug_info.dwo"
> -#endif
> #ifndef DEBUG_LTO_INFO_SECTION
> #define DEBUG_LTO_INFO_SECTION ".gnu.debuglto_.debug_info"
> #endif
> +#ifndef DEBUG_LTO_DWO_INFO_SECTION
> +#define DEBUG_LTO_DWO_INFO_SECTION ".gnu.debuglto_.debug_info.dwo"
> +#endif
> #ifndef DEBUG_ABBREV_SECTION
> #define DEBUG_ABBREV_SECTION ".debug_abbrev"
> #endif
> +#ifndef DEBUG_LTO_ABBREV_SECTION
> +#define DEBUG_LTO_ABBREV_SECTION ".gnu.debuglto_.debug_abbrev"
> +#endif
> #ifndef DEBUG_DWO_ABBREV_SECTION
> #define DEBUG_DWO_ABBREV_SECTION ".debug_abbrev.dwo"
> #endif
> #ifndef DEBUG_LTO_DWO_ABBREV_SECTION
> #define DEBUG_LTO_DWO_ABBREV_SECTION ".gnu.debuglto_.debug_abbrev.dwo"
> #endif
> -#ifndef DEBUG_LTO_ABBREV_SECTION
> -#define DEBUG_LTO_ABBREV_SECTION ".gnu.debuglto_.debug_abbrev"
> -#endif
> #ifndef DEBUG_ARANGES_SECTION
> #define DEBUG_ARANGES_SECTION ".debug_aranges"
> #endif
> @@ -3729,35 +3729,38 @@ new_addr_loc_descr (rtx addr, enum dtpre
> #ifndef DEBUG_MACINFO_SECTION
> #define DEBUG_MACINFO_SECTION ".debug_macinfo"
> #endif
> +#ifndef DEBUG_LTO_MACINFO_SECTION
> +#define DEBUG_LTO_MACINFO_SECTION ".gnu.debuglto_.debug_macinfo"
> +#endif
> #ifndef DEBUG_DWO_MACINFO_SECTION
> #define DEBUG_DWO_MACINFO_SECTION ".debug_macinfo.dwo"
> #endif
> #ifndef DEBUG_LTO_DWO_MACINFO_SECTION
> #define DEBUG_LTO_DWO_MACINFO_SECTION ".gnu.debuglto_.debug_macinfo.dwo"
> #endif
> -#ifndef DEBUG_LTO_MACINFO_SECTION
> -#define DEBUG_LTO_MACINFO_SECTION ".gnu.debuglto_.debug_macinfo"
> +#ifndef DEBUG_MACRO_SECTION
> +#define DEBUG_MACRO_SECTION ".debug_macro"
> +#endif
> +#ifndef DEBUG_LTO_MACRO_SECTION
> +#define DEBUG_LTO_MACRO_SECTION ".gnu.debuglto_.debug_macro"
> #endif
> #ifndef DEBUG_DWO_MACRO_SECTION
> #define DEBUG_DWO_MACRO_SECTION ".debug_macro.dwo"
> #endif
> -#ifndef DEBUG_MACRO_SECTION
> -#define DEBUG_MACRO_SECTION ".debug_macro"
> -#endif
> #ifndef DEBUG_LTO_DWO_MACRO_SECTION
> #define DEBUG_LTO_DWO_MACRO_SECTION ".gnu.debuglto_.debug_macro.dwo"
> #endif
> -#ifndef DEBUG_LTO_MACRO_SECTION
> -#define DEBUG_LTO_MACRO_SECTION ".gnu.debuglto_.debug_macro"
> -#endif
> #ifndef DEBUG_LINE_SECTION
> #define DEBUG_LINE_SECTION ".debug_line"
> #endif
> +#ifndef DEBUG_LTO_LINE_SECTION
> +#define DEBUG_LTO_LINE_SECTION ".gnu.debuglto_.debug_line"
> +#endif
> #ifndef DEBUG_DWO_LINE_SECTION
> #define DEBUG_DWO_LINE_SECTION ".debug_line.dwo"
> #endif
> -#ifndef DEBUG_LTO_LINE_SECTION
> -#define DEBUG_LTO_LINE_SECTION ".gnu.debuglto_.debug_line.dwo"
> +#ifndef DEBUG_LTO_DWO_LINE_SECTION
> +#define DEBUG_LTO_DWO_LINE_SECTION ".gnu.debuglto_.debug_line.dwo"
> #endif
> #ifndef DEBUG_LOC_SECTION
> #define DEBUG_LOC_SECTION ".debug_loc"
> @@ -3790,18 +3793,18 @@ new_addr_loc_descr (rtx addr, enum dtpre
> #ifndef DEBUG_LTO_DWO_STR_OFFSETS_SECTION
> #define DEBUG_LTO_DWO_STR_OFFSETS_SECTION ".gnu.debuglto_.debug_str_offsets.dwo"
> #endif
> -#ifndef DEBUG_STR_DWO_SECTION
> -#define DEBUG_STR_DWO_SECTION ".debug_str.dwo"
> -#endif
> -#ifndef DEBUG_LTO_STR_DWO_SECTION
> -#define DEBUG_LTO_STR_DWO_SECTION ".gnu.debuglto_.debug_str.dwo"
> -#endif
> #ifndef DEBUG_STR_SECTION
> #define DEBUG_STR_SECTION ".debug_str"
> #endif
> #ifndef DEBUG_LTO_STR_SECTION
> #define DEBUG_LTO_STR_SECTION ".gnu.debuglto_.debug_str"
> #endif
> +#ifndef DEBUG_STR_DWO_SECTION
> +#define DEBUG_STR_DWO_SECTION ".debug_str.dwo"
> +#endif
> +#ifndef DEBUG_LTO_STR_DWO_SECTION
> +#define DEBUG_LTO_STR_DWO_SECTION ".gnu.debuglto_.debug_str.dwo"
> +#endif
> #ifndef DEBUG_RANGES_SECTION
> #define DEBUG_RANGES_SECTION ".debug_ranges"
> #endif
> @@ -3811,6 +3814,9 @@ new_addr_loc_descr (rtx addr, enum dtpre
> #ifndef DEBUG_LINE_STR_SECTION
> #define DEBUG_LINE_STR_SECTION ".debug_line_str"
> #endif
> +#ifndef DEBUG_LTO_LINE_STR_SECTION
> +#define DEBUG_LTO_LINE_STR_SECTION ".gnu.debuglto_.debug_line_str"
> +#endif
>
> /* Standard ELF section names for compiled code and data. */
> #ifndef TEXT_SECTION_NAME
> @@ -27188,7 +27194,8 @@ output_macinfo (const char *debug_line_l
> static void
> init_sections_and_labels (bool early_lto_debug)
> {
> - /* As we may get called multiple times have a generation count for labels. */
> + /* As we may get called multiple times have a generation count for
> + labels. */
> static unsigned generation = 0;
>
> if (early_lto_debug)
> @@ -27201,14 +27208,14 @@ init_sections_and_labels (bool early_lto
> debug_abbrev_section = get_section (DEBUG_LTO_ABBREV_SECTION,
> SECTION_DEBUG | SECTION_EXCLUDE,
> NULL);
> - debug_macinfo_section_name = ((dwarf_strict && dwarf_version < 5)
> - ? DEBUG_LTO_MACINFO_SECTION
> - : DEBUG_LTO_MACRO_SECTION);
> + debug_macinfo_section_name
> + = ((dwarf_strict && dwarf_version < 5)
> + ? DEBUG_LTO_MACINFO_SECTION : DEBUG_LTO_MACRO_SECTION);
> debug_macinfo_section = get_section (debug_macinfo_section_name,
> SECTION_DEBUG
> | SECTION_EXCLUDE, NULL);
> - /* For macro info we have to refer to a debug_line section, so similar
> - to split-dwarf emit a skeleton one for early debug. */
> + /* For macro info we have to refer to a debug_line section, so
> + similar to split-dwarf emit a skeleton one for early debug. */
> debug_skeleton_line_section
> = get_section (DEBUG_LTO_LINE_SECTION,
> SECTION_DEBUG | SECTION_EXCLUDE, NULL);
> @@ -27228,15 +27235,16 @@ init_sections_and_labels (bool early_lto
> debug_skeleton_info_section = get_section (DEBUG_LTO_INFO_SECTION,
> SECTION_DEBUG
> | SECTION_EXCLUDE, NULL);
> - debug_skeleton_abbrev_section = get_section (DEBUG_LTO_ABBREV_SECTION,
> - SECTION_DEBUG
> - | SECTION_EXCLUDE, NULL);
> + debug_skeleton_abbrev_section
> + = get_section (DEBUG_LTO_ABBREV_SECTION,
> + SECTION_DEBUG | SECTION_EXCLUDE, NULL);
> ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_abbrev_section_label,
> DEBUG_SKELETON_ABBREV_SECTION_LABEL,
> generation);
>
> - /* Somewhat confusing detail: The skeleton_[abbrev|info] sections stay in
> - the main .o, but the skeleton_line goes into the split off dwo. */
> + /* Somewhat confusing detail: The skeleton_[abbrev|info] sections
> + stay in the main .o, but the skeleton_line goes into the split
> + off dwo. */
> debug_skeleton_line_section
> = get_section (DEBUG_LTO_LINE_SECTION,
> SECTION_DEBUG | SECTION_EXCLUDE, NULL);
> @@ -27251,9 +27259,10 @@ init_sections_and_labels (bool early_lto
> DEBUG_SKELETON_INFO_SECTION_LABEL,
> generation);
> debug_str_dwo_section = get_section (DEBUG_LTO_STR_DWO_SECTION,
> - DEBUG_STR_DWO_SECTION_FLAGS, NULL);
> + DEBUG_STR_DWO_SECTION_FLAGS,
> + NULL);
> debug_macinfo_section_name
> - = (dwarf_strict
> + = ((dwarf_strict && dwarf_version < 5)
> ? DEBUG_LTO_DWO_MACINFO_SECTION : DEBUG_LTO_DWO_MACRO_SECTION);
> debug_macinfo_section = get_section (debug_macinfo_section_name,
> SECTION_DEBUG | SECTION_EXCLUDE,
> @@ -27262,6 +27271,10 @@ init_sections_and_labels (bool early_lto
> debug_str_section = get_section (DEBUG_LTO_STR_SECTION,
> DEBUG_STR_SECTION_FLAGS
> | SECTION_EXCLUDE, NULL);
> + if (!dwarf_split_debug_info && !DWARF2_ASM_LINE_DEBUG_INFO)
> + debug_line_str_section
> + = get_section (DEBUG_LTO_LINE_STR_SECTION,
> + DEBUG_STR_SECTION_FLAGS | SECTION_EXCLUDE, NULL);
> }
> else
> {
> @@ -27271,10 +27284,13 @@ init_sections_and_labels (bool early_lto
> SECTION_DEBUG, NULL);
> debug_abbrev_section = get_section (DEBUG_ABBREV_SECTION,
> SECTION_DEBUG, NULL);
> - debug_loc_section = get_section (DEBUG_LOC_SECTION,
> + debug_loc_section = get_section (dwarf_version >= 5
> + ? DEBUG_LOCLISTS_SECTION
> + : DEBUG_LOC_SECTION,
> SECTION_DEBUG, NULL);
> debug_macinfo_section_name
> - = dwarf_strict ? DEBUG_MACINFO_SECTION : DEBUG_MACRO_SECTION;
> + = ((dwarf_strict && dwarf_version < 5)
> + ? DEBUG_MACINFO_SECTION : DEBUG_MACRO_SECTION);
> debug_macinfo_section = get_section (debug_macinfo_section_name,
> SECTION_DEBUG, NULL);
> }
> @@ -27311,15 +27327,17 @@ init_sections_and_labels (bool early_lto
> ASM_GENERATE_INTERNAL_LABEL (debug_skeleton_info_section_label,
> DEBUG_SKELETON_INFO_SECTION_LABEL,
> generation);
> - debug_loc_section = get_section (DEBUG_DWO_LOC_SECTION,
> + debug_loc_section = get_section (dwarf_version >= 5
> + ? DEBUG_DWO_LOCLISTS_SECTION
> + : DEBUG_DWO_LOC_SECTION,
> SECTION_DEBUG | SECTION_EXCLUDE,
> NULL);
> debug_str_dwo_section = get_section (DEBUG_STR_DWO_SECTION,
> DEBUG_STR_DWO_SECTION_FLAGS,
> NULL);
> debug_macinfo_section_name
> - = (dwarf_strict && dwarf_version < 5)
> - ? DEBUG_DWO_MACINFO_SECTION : DEBUG_DWO_MACRO_SECTION;
> + = ((dwarf_strict && dwarf_version < 5)
> + ? DEBUG_DWO_MACINFO_SECTION : DEBUG_DWO_MACRO_SECTION);
> debug_macinfo_section = get_section (debug_macinfo_section_name,
> SECTION_DEBUG | SECTION_EXCLUDE,
> NULL);
> @@ -27334,6 +27352,9 @@ init_sections_and_labels (bool early_lto
> SECTION_DEBUG, NULL);
> debug_str_section = get_section (DEBUG_STR_SECTION,
> DEBUG_STR_SECTION_FLAGS, NULL);
> + if (!dwarf_split_debug_info && !DWARF2_ASM_LINE_DEBUG_INFO)
> + debug_line_str_section = get_section (DEBUG_LINE_STR_SECTION,
> + DEBUG_STR_SECTION_FLAGS, NULL);
> debug_ranges_section = get_section (dwarf_version >= 5
> ? DEBUG_RNGLISTS_SECTION
> : DEBUG_RANGES_SECTION,
> @@ -27355,7 +27376,7 @@ init_sections_and_labels (bool early_lto
> ASM_GENERATE_INTERNAL_LABEL (ranges_base_label,
> DEBUG_RANGES_SECTION_LABEL, 2 + generation);
> ASM_GENERATE_INTERNAL_LABEL (debug_addr_section_label,
> - DEBUG_ADDR_SECTION_LABEL, generation);
> + DEBUG_ADDR_SECTION_LABEL, generation);
> ASM_GENERATE_INTERNAL_LABEL (macinfo_section_label,
> (dwarf_strict && dwarf_version < 5)
> ? DEBUG_MACINFO_SECTION_LABEL
>
>
> Jakub
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)