This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] DWARF5 .debug_rnglists support
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Jason Merrill <jason at redhat dot com>, Cary Coutant <ccoutant at gmail dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 01 Nov 2016 21:44:27 +0100
- Subject: Re: [PATCH] DWARF5 .debug_rnglists support
- Authentication-results: sourceware.org; auth=none
- References: <20161020185259.GA7282@tucnak.redhat.com> <1aefbb2b-c223-6c76-b224-0230f49cb5ec@redhat.com> <20161031193311.GL3541@tucnak.redhat.com> <CADzB+2n-Ri28uqNd3YNC3XJCoop5L_hFzSEZ=0vq1u2bT9Wp9w@mail.gmail.com> <20161101161417.GX3541@tucnak.redhat.com>
Hi Jakub,
> 2016-11-01 Jakub Jelinek <jakub@redhat.com>
>
> * tree.h (BLOCK_IN_COLD_SECTION_P): Define.
> * final.c (final_scan_insn): Set BLOCK_IN_COLD_SECTION_P.
> * dwarf2out.c (rnglist_idx): New variable.
> (struct dw_ranges): Add label, idx and maybe_new_sec fields.
> (DEBUG_RNGLISTS_SECTION): Define.
> (ranges_base_label): New variable.
> (size_of_die) <case dw_val_class_range_list>: If using
> DW_FORM_rnglistx, count size of uleb128 of range list index.
> (value_format) <case dw_val_class_range_list>: For
> -gdwarf-5 -gsplit-dwarf return DW_FORM_rnglistx.
> (output_range_list_offset): Handle -gdwarf-5 .debug_rnglists
> offsets. Multiply dwarf < 5 offsets by 2 * DWARF_ADDR_SIZE.
> (add_ranges_num): Remove useless prototype. Don't multiply
> by 2 * DWARF2_ADDR_SIZE. Add maybe_new_sec argument, adjust
> for new fields added to dw_ranges struct.
> (add_ranges): Add maybe_new_sec argument and pass it
> through to add_ranges_num.
> (note_rnglist_head): New function.
> (add_ranges_by_labels): Pass true as maybe_new_sec to
> add_ranges_num, call note_rnglist_head on the head of the list.
> (output_ranges): Add function comment. Switch to
> .debug_ranges section here and emit .Ldebug_ranges0 label.
> (index_rnglists, output_rnglists): New functions.
> (gen_subprogram_die): Formatting fixes.
> (add_high_low_attributes): Don't divide offsets
> by 2 * DWARF2_ADDR_SIZE. Call note_rnglist_head on the
> first list element or when pointing into the middle of
> a list. Pass true as second argument to add_ranges on the
> first block fragment after cold/hot section switch.
> (init_sections_and_labels): For -gdwarf-5 use .debug_rnglists
> section instead of .debug_ranges. Initialize
> ranges_base_label if -gdwarf-5 -gsplit-dwarf.
> (dwarf2out_finish): For -gdwarf-5 -gsplit-dwarf call
> index_rnglists and add DW_AT_rnglists_base attr. Don't switch
> to dwarf_ranges_section here or emit .Ldebug_ranges0 label.
> Call output_rnglists for -gdwarf-5.
> (dwarf2out_c_finalize): Clear rnglist_idx.
this patch broke Solaris bootstrap with /bin/as:
/vol/gcc/src/hg/trunk/local/gcc/dwarf2out.c: In function 'void output_rnglists()':
/vol/gcc/src/hg/trunk/local/gcc/dwarf2out.c:11055:8: error: unused variable 'basebuf' [-Werror=unused-variable]
char basebuf[MAX_ARTIFICIAL_LABEL_BYTES];
^~~~~~~
/vol/gcc/src/hg/trunk/local/gcc/dwarf2out.c:11088:16: error: unused variable 'len' [-Werror=unused-variable]
unsigned int len = vec_safe_length (ranges_table);
^~~
Fixed as follows; will commit as obvious once i386-pc-solaris2.12 and
sparc-sun-solaris2.12 bootstrap have finished successfully.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2016-11-01 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* dwarf2out.c (output_rnglists): Wrap basebuf, len in
HAVE_AS_LEB128.
# HG changeset patch
# Parent 82d985a9e114ce85dac367da31077070f40d7ab8
Fix dwarf2out.c non-leb128 bootstrap failure
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -11052,7 +11052,9 @@ output_rnglists (void)
dw_ranges *r;
char l1[MAX_ARTIFICIAL_LABEL_BYTES];
char l2[MAX_ARTIFICIAL_LABEL_BYTES];
+#ifdef HAVE_AS_LEB128
char basebuf[MAX_ARTIFICIAL_LABEL_BYTES];
+#endif
switch_to_section (debug_ranges_section);
ASM_OUTPUT_LABEL (asm_out_file, ranges_section_label);
@@ -11085,9 +11087,9 @@ output_rnglists (void)
ranges_base_label, NULL);
}
- unsigned int len = vec_safe_length (ranges_table);
const char *lab = "";
#ifdef HAVE_AS_LEB128
+ unsigned int len = vec_safe_length (ranges_table);
const char *base = NULL;
#endif
FOR_EACH_VEC_SAFE_ELT (ranges_table, i, r)