Re: Un-break dwarf2out for DWARF2_LINENO_DEBUGGING_INFO configurations (was: [PATCH] Refactor section/label init for early LTO debug)

2016-10-12 Thread Thomas Schwinge
Hi!

On Wed, 28 Sep 2016 11:28:16 +0200 (CEST), Richard Biener  
wrote:
> On Wed, 28 Sep 2016, Thomas Schwinge wrote:
> > ([...] got committed in r240545.)  For DWARF2_LINENO_DEBUGGING_INFO
> > configurations (that is, nvptx; Bernd CCed, who originally authored the
> > DWARF2_LINENO_DEBUGGING_INFO support), this breaks things because of
> > uninitialized text_section_line_info/cur_line_info_table.  OK to fix as
> > follows?
> 
> Ok.

Without changes committed to trunk in r241045:

commit 84cb1b769377413a1b7cef73fc4f6022e046b0a9
Author: tschwinge 
Date:   Wed Oct 12 13:09:26 2016 +

Un-break dwarf2out for DWARF2_LINENO_DEBUGGING_INFO configurations

gcc/
* dwarf2out.c (dwarf2_lineno_debug_hooks): Use
dwarf2out_assembly_start.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241045 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog   | 3 +++
 gcc/dwarf2out.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git gcc/ChangeLog gcc/ChangeLog
index d6880d9..c66b7a7 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,5 +1,8 @@
 2016-10-12  Thomas Schwinge  
 
+   * dwarf2out.c (dwarf2_lineno_debug_hooks): Use
+   dwarf2out_assembly_start.
+
* Makefile.in (SELFTEST_FLAGS): Add -nostdinc.
 
* Makefile.in (SELFTEST_FLAGS): New variable.
diff --git gcc/dwarf2out.c gcc/dwarf2out.c
index b5787ef..98deeef 100644
--- gcc/dwarf2out.c
+++ gcc/dwarf2out.c
@@ -2540,7 +2540,7 @@ const struct gcc_debug_hooks dwarf2_lineno_debug_hooks =
   dwarf2out_init,
   debug_nothing_charstar,
   debug_nothing_charstar,
-  debug_nothing_void,
+  dwarf2out_assembly_start,
   debug_nothing_int_charstar,
   debug_nothing_int_charstar,
   debug_nothing_int_charstar,


Grüße
 Thomas


Re: Un-break dwarf2out for DWARF2_LINENO_DEBUGGING_INFO configurations (was: [PATCH] Refactor section/label init for early LTO debug)

2016-09-28 Thread Richard Biener
On Wed, 28 Sep 2016, Thomas Schwinge wrote:

> Hi!
> 
> On Tue, 27 Sep 2016 12:34:46 +0200 (CEST), Richard Biener  
> wrote:
> > --- gcc/dwarf2out.c (revision 240521)
> > +++ gcc/dwarf2out.c (working copy)
> > @@ -25657,14 +25687,6 @@ dwarf2out_init (const char *filename ATT
> >  vec_alloc (macinfo_table, 64);
> >  #endif
> >  
> > -  /* Make sure the line number table for .text always exists.  */
> > -  text_section_line_info = new_line_info_table ();
> > -  text_section_line_info->end_label = text_end_label;
> > -
> > -#ifdef DWARF2_LINENO_DEBUGGING_INFO
> > -  cur_line_info_table = text_section_line_info;
> > -#endif
> > -
> >/* If front-ends already registered a main translation unit but we were 
> > not
> >   ready to perform the association, do this now.  */
> >if (main_translation_unit != NULL_TREE)
> > @@ -25688,6 +25710,14 @@ dwarf2out_assembly_start (void)
> >ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
> >  #endif
> >  
> > +  /* Make sure the line number table for .text always exists.  */
> > +  text_section_line_info = new_line_info_table ();
> > +  text_section_line_info->end_label = text_end_label;
> > +
> > +#ifdef DWARF2_LINENO_DEBUGGING_INFO
> > +  cur_line_info_table = text_section_line_info;
> > +#endif
> > +
> >if (HAVE_GAS_CFI_SECTIONS_DIRECTIVE
> >&& dwarf2out_do_cfi_asm ()
> >&& (!(flag_unwind_tables || flag_exceptions)
> 
> (This got committed in r240545.)  For DWARF2_LINENO_DEBUGGING_INFO
> configurations (that is, nvptx; Bernd CCed, who originally authored the
> DWARF2_LINENO_DEBUGGING_INFO support), this breaks things because of
> uninitialized text_section_line_info/cur_line_info_table.  OK to fix as
> follows?

Ok.

Richard.

> commit e745307ac5a90e999133df21139526230e81
> Author: Thomas Schwinge 
> Date:   Wed Sep 28 10:55:23 2016 +0200
> 
> Un-break dwarf2out for DWARF2_LINENO_DEBUGGING_INFO configurations
> 
>   gcc/
>   * dwarf2out.c (dwarf2_lineno_debug_hooks): Use
>   dwarf2out_assembly_start.
> ---
>  gcc/dwarf2out.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git gcc/dwarf2out.c gcc/dwarf2out.c
> index 51cab42..8c18c4c 100644
> --- gcc/dwarf2out.c
> +++ gcc/dwarf2out.c
> @@ -2539,7 +2539,7 @@ const struct gcc_debug_hooks dwarf2_lineno_debug_hooks =
>dwarf2out_init,
>debug_nothing_charstar,
>debug_nothing_charstar,
> -  debug_nothing_void,
> +  dwarf2out_assembly_start,
>debug_nothing_int_charstar,
>debug_nothing_int_charstar,
>debug_nothing_int_charstar,
> 


Un-break dwarf2out for DWARF2_LINENO_DEBUGGING_INFO configurations (was: [PATCH] Refactor section/label init for early LTO debug)

2016-09-28 Thread Thomas Schwinge
Hi!

On Tue, 27 Sep 2016 12:34:46 +0200 (CEST), Richard Biener  
wrote:
> --- gcc/dwarf2out.c (revision 240521)
> +++ gcc/dwarf2out.c (working copy)
> @@ -25657,14 +25687,6 @@ dwarf2out_init (const char *filename ATT
>  vec_alloc (macinfo_table, 64);
>  #endif
>  
> -  /* Make sure the line number table for .text always exists.  */
> -  text_section_line_info = new_line_info_table ();
> -  text_section_line_info->end_label = text_end_label;
> -
> -#ifdef DWARF2_LINENO_DEBUGGING_INFO
> -  cur_line_info_table = text_section_line_info;
> -#endif
> -
>/* If front-ends already registered a main translation unit but we were 
> not
>   ready to perform the association, do this now.  */
>if (main_translation_unit != NULL_TREE)
> @@ -25688,6 +25710,14 @@ dwarf2out_assembly_start (void)
>ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
>  #endif
>  
> +  /* Make sure the line number table for .text always exists.  */
> +  text_section_line_info = new_line_info_table ();
> +  text_section_line_info->end_label = text_end_label;
> +
> +#ifdef DWARF2_LINENO_DEBUGGING_INFO
> +  cur_line_info_table = text_section_line_info;
> +#endif
> +
>if (HAVE_GAS_CFI_SECTIONS_DIRECTIVE
>&& dwarf2out_do_cfi_asm ()
>&& (!(flag_unwind_tables || flag_exceptions)

(This got committed in r240545.)  For DWARF2_LINENO_DEBUGGING_INFO
configurations (that is, nvptx; Bernd CCed, who originally authored the
DWARF2_LINENO_DEBUGGING_INFO support), this breaks things because of
uninitialized text_section_line_info/cur_line_info_table.  OK to fix as
follows?

commit e745307ac5a90e999133df21139526230e81
Author: Thomas Schwinge 
Date:   Wed Sep 28 10:55:23 2016 +0200

Un-break dwarf2out for DWARF2_LINENO_DEBUGGING_INFO configurations

gcc/
* dwarf2out.c (dwarf2_lineno_debug_hooks): Use
dwarf2out_assembly_start.
---
 gcc/dwarf2out.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git gcc/dwarf2out.c gcc/dwarf2out.c
index 51cab42..8c18c4c 100644
--- gcc/dwarf2out.c
+++ gcc/dwarf2out.c
@@ -2539,7 +2539,7 @@ const struct gcc_debug_hooks dwarf2_lineno_debug_hooks =
   dwarf2out_init,
   debug_nothing_charstar,
   debug_nothing_charstar,
-  debug_nothing_void,
+  dwarf2out_assembly_start,
   debug_nothing_int_charstar,
   debug_nothing_int_charstar,
   debug_nothing_int_charstar,


Grüße
 Thomas


signature.asc
Description: PGP signature


Re: [PATCH] Refactor section/label init for early LTO debug

2016-09-28 Thread Richard Biener
On Wed, 28 Sep 2016, Richard Biener wrote:

> On Tue, 27 Sep 2016, Rainer Orth wrote:
> 
> > Hi Richard,
> > 
> > >> this patch introduced many pch assembly comparison failures on Solaris
> > >> (both sparc and x86, 32 and 64-bit, /bin/as only), like
> > >> 
> > >> FAIL: gcc.dg/pch/common-1.c   -O3 -g  assembly comparison
> > >> FAIL: gcc.dg/pch/common-1.c  -O0 -g assembly comparison
> > >> 
> > >> gcc.log shows this diff:
> > >> 
> > >> <   .long   .Letext0
> > >> >   .long
> > >> 
> > >> While the .Letext0 label is still in the assembly output, it isn't
> > >> referenced inside .debug_line, as can be seen in the diff.
> > >
> > > Can you check if moving
> > >
> > > static void
> > > dwarf2out_assembly_start (void)
> > > {
> > > #ifndef DWARF2_LINENO_DEBUGGING_INFO
> > >   ASM_GENERATE_INTERNAL_LABEL (text_section_label, TEXT_SECTION_LABEL, 0);
> > >   ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
> > >   ASM_GENERATE_INTERNAL_LABEL (cold_text_section_label,
> > >COLD_TEXT_SECTION_LABEL, 0);
> > >   ASM_GENERATE_INTERNAL_LABEL (cold_end_label, COLD_END_LABEL, 0);
> > >
> > >   switch_to_section (text_section);
> > >   ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
> > > #endif
> > >
> > > back to dwarf2out_init helps?  Ah!  Does
> > >
> > > Index: gcc/dwarf2out.c
> > > ===
> > > --- gcc/dwarf2out.c (revision 240521)
> > > +++ gcc/dwarf2out.c (working copy)
> > > @@ -25657,14 +25687,6 @@ dwarf2out_init (const char *filename ATT
> > >  vec_alloc (macinfo_table, 64);
> > >  #endif
> > >  
> > > -  /* Make sure the line number table for .text always exists.  */
> > > -  text_section_line_info = new_line_info_table ();
> > > -  text_section_line_info->end_label = text_end_label;
> > > -
> > > -#ifdef DWARF2_LINENO_DEBUGGING_INFO
> > > -  cur_line_info_table = text_section_line_info;
> > > -#endif
> > > -
> > >/* If front-ends already registered a main translation unit but we 
> > > were 
> > > not
> > >   ready to perform the association, do this now.  */
> > >if (main_translation_unit != NULL_TREE)
> > > @@ -25688,6 +25710,14 @@ dwarf2out_assembly_start (void)
> > >ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
> > >  #endif
> > >  
> > > +  /* Make sure the line number table for .text always exists.  */
> > > +  text_section_line_info = new_line_info_table ();
> > > +  text_section_line_info->end_label = text_end_label;
> > > +
> > > +#ifdef DWARF2_LINENO_DEBUGGING_INFO
> > > +  cur_line_info_table = text_section_line_info;
> > > +#endif
> > > +
> > >if (HAVE_GAS_CFI_SECTIONS_DIRECTIVE
> > >&& dwarf2out_do_cfi_asm ()
> > >&& (!(flag_unwind_tables || flag_exceptions)
> > >
> > >
> > > fix it?  Ok if it passes testing for you.
> > 
> > testing on a single testcase worked fine.  I'll just run a full
> > bootstrap to make sure everything is fine.
> 
> Meanwhile I bootstrapped and tested it on x86_64-unknown-linux-gnu and
> applied it to trunk.

Ah, you already did.

Thanks,
Richard.


Re: [PATCH] Refactor section/label init for early LTO debug

2016-09-28 Thread Richard Biener
On Tue, 27 Sep 2016, Rainer Orth wrote:

> Hi Richard,
> 
> >> this patch introduced many pch assembly comparison failures on Solaris
> >> (both sparc and x86, 32 and 64-bit, /bin/as only), like
> >> 
> >> FAIL: gcc.dg/pch/common-1.c   -O3 -g  assembly comparison
> >> FAIL: gcc.dg/pch/common-1.c  -O0 -g assembly comparison
> >> 
> >> gcc.log shows this diff:
> >> 
> >> <   .long   .Letext0
> >> >   .long
> >> 
> >> While the .Letext0 label is still in the assembly output, it isn't
> >> referenced inside .debug_line, as can be seen in the diff.
> >
> > Can you check if moving
> >
> > static void
> > dwarf2out_assembly_start (void)
> > {
> > #ifndef DWARF2_LINENO_DEBUGGING_INFO
> >   ASM_GENERATE_INTERNAL_LABEL (text_section_label, TEXT_SECTION_LABEL, 0);
> >   ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
> >   ASM_GENERATE_INTERNAL_LABEL (cold_text_section_label,
> >COLD_TEXT_SECTION_LABEL, 0);
> >   ASM_GENERATE_INTERNAL_LABEL (cold_end_label, COLD_END_LABEL, 0);
> >
> >   switch_to_section (text_section);
> >   ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
> > #endif
> >
> > back to dwarf2out_init helps?  Ah!  Does
> >
> > Index: gcc/dwarf2out.c
> > ===
> > --- gcc/dwarf2out.c (revision 240521)
> > +++ gcc/dwarf2out.c (working copy)
> > @@ -25657,14 +25687,6 @@ dwarf2out_init (const char *filename ATT
> >  vec_alloc (macinfo_table, 64);
> >  #endif
> >  
> > -  /* Make sure the line number table for .text always exists.  */
> > -  text_section_line_info = new_line_info_table ();
> > -  text_section_line_info->end_label = text_end_label;
> > -
> > -#ifdef DWARF2_LINENO_DEBUGGING_INFO
> > -  cur_line_info_table = text_section_line_info;
> > -#endif
> > -
> >/* If front-ends already registered a main translation unit but we were 
> > not
> >   ready to perform the association, do this now.  */
> >if (main_translation_unit != NULL_TREE)
> > @@ -25688,6 +25710,14 @@ dwarf2out_assembly_start (void)
> >ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
> >  #endif
> >  
> > +  /* Make sure the line number table for .text always exists.  */
> > +  text_section_line_info = new_line_info_table ();
> > +  text_section_line_info->end_label = text_end_label;
> > +
> > +#ifdef DWARF2_LINENO_DEBUGGING_INFO
> > +  cur_line_info_table = text_section_line_info;
> > +#endif
> > +
> >if (HAVE_GAS_CFI_SECTIONS_DIRECTIVE
> >&& dwarf2out_do_cfi_asm ()
> >&& (!(flag_unwind_tables || flag_exceptions)
> >
> >
> > fix it?  Ok if it passes testing for you.
> 
> testing on a single testcase worked fine.  I'll just run a full
> bootstrap to make sure everything is fine.

Meanwhile I bootstrapped and tested it on x86_64-unknown-linux-gnu and
applied it to trunk.

Sorry for the breakage.

Richard.

2016-09-28  Richard Biener  

* dwarf2out.c (dwarf2out_init): Move text_section_line_info init ...
(dwarf2out_assembly_start): ... here.

diff -u gcc/dwarf2out.c gcc/dwarf2out.c
--- gcc/dwarf2out.c (working copy)
+++ gcc/dwarf2out.c (working copy)
@@ -25684,14 +25687,6 @@
 vec_alloc (macinfo_table, 64);
 #endif
 
-  /* Make sure the line number table for .text always exists.  */
-  text_section_line_info = new_line_info_table ();
-  text_section_line_info->end_label = text_end_label;
-
-#ifdef DWARF2_LINENO_DEBUGGING_INFO
-  cur_line_info_table = text_section_line_info;
-#endif
-
   /* If front-ends already registered a main translation unit but we were not
  ready to perform the association, do this now.  */
   if (main_translation_unit != NULL_TREE)
@@ -25715,6 +25710,14 @@
   ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
 #endif
 
+  /* Make sure the line number table for .text always exists.  */
+  text_section_line_info = new_line_info_table ();
+  text_section_line_info->end_label = text_end_label;
+
+#ifdef DWARF2_LINENO_DEBUGGING_INFO
+  cur_line_info_table = text_section_line_info;
+#endif
+
   if (HAVE_GAS_CFI_SECTIONS_DIRECTIVE
   && dwarf2out_do_cfi_asm ()
   && (!(flag_unwind_tables || flag_exceptions)



Re: [PATCH] Refactor section/label init for early LTO debug

2016-09-27 Thread Rainer Orth
Hi Richard,

>> this patch introduced many pch assembly comparison failures on Solaris
>> (both sparc and x86, 32 and 64-bit, /bin/as only), like
>> 
>> FAIL: gcc.dg/pch/common-1.c   -O3 -g  assembly comparison
>> FAIL: gcc.dg/pch/common-1.c  -O0 -g assembly comparison
>> 
>> gcc.log shows this diff:
>> 
>> <   .long   .Letext0
>> >   .long
>> 
>> While the .Letext0 label is still in the assembly output, it isn't
>> referenced inside .debug_line, as can be seen in the diff.
>
> Can you check if moving
>
> static void
> dwarf2out_assembly_start (void)
> {
> #ifndef DWARF2_LINENO_DEBUGGING_INFO
>   ASM_GENERATE_INTERNAL_LABEL (text_section_label, TEXT_SECTION_LABEL, 0);
>   ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
>   ASM_GENERATE_INTERNAL_LABEL (cold_text_section_label,
>COLD_TEXT_SECTION_LABEL, 0);
>   ASM_GENERATE_INTERNAL_LABEL (cold_end_label, COLD_END_LABEL, 0);
>
>   switch_to_section (text_section);
>   ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
> #endif
>
> back to dwarf2out_init helps?  Ah!  Does
>
> Index: gcc/dwarf2out.c
> ===
> --- gcc/dwarf2out.c (revision 240521)
> +++ gcc/dwarf2out.c (working copy)
> @@ -25657,14 +25687,6 @@ dwarf2out_init (const char *filename ATT
>  vec_alloc (macinfo_table, 64);
>  #endif
>  
> -  /* Make sure the line number table for .text always exists.  */
> -  text_section_line_info = new_line_info_table ();
> -  text_section_line_info->end_label = text_end_label;
> -
> -#ifdef DWARF2_LINENO_DEBUGGING_INFO
> -  cur_line_info_table = text_section_line_info;
> -#endif
> -
>/* If front-ends already registered a main translation unit but we were 
> not
>   ready to perform the association, do this now.  */
>if (main_translation_unit != NULL_TREE)
> @@ -25688,6 +25710,14 @@ dwarf2out_assembly_start (void)
>ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
>  #endif
>  
> +  /* Make sure the line number table for .text always exists.  */
> +  text_section_line_info = new_line_info_table ();
> +  text_section_line_info->end_label = text_end_label;
> +
> +#ifdef DWARF2_LINENO_DEBUGGING_INFO
> +  cur_line_info_table = text_section_line_info;
> +#endif
> +
>if (HAVE_GAS_CFI_SECTIONS_DIRECTIVE
>&& dwarf2out_do_cfi_asm ()
>&& (!(flag_unwind_tables || flag_exceptions)
>
>
> fix it?  Ok if it passes testing for you.

testing on a single testcase worked fine.  I'll just run a full
bootstrap to make sure everything is fine.

Thanks.
Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH] Refactor section/label init for early LTO debug

2016-09-27 Thread Richard Biener
On Tue, 27 Sep 2016, Rainer Orth wrote:

> Hi Richard,
> 
> > The following patch ports a refactoring of section/label in it from
> > the early LTO debug work to trunk.  For early LTO debug we need to
> > be able to emit two sets of debug infos into two sets of different
> > sections - early LTO into .gnu.debuglto_ prefixed sections and
> > regular (early + late) debug for the FAT part of the object.
> >
> > Thus this preparation splits out the section and label generation
> > from dwarf2out_init moving the text section related stuff to 
> > dwarf2out_assembly_start and the rest to a new function
> > init_sections_and_labels which is now called only before we start
> > outputting dwarf (in dwarf2out_finish).  It also removes some
> > dwarf_split_debug_info checks from the macro section name defines
> > (in the end I'll have up to four variants - regular, regular LTO,
> > DWO, DWO LTO).
> >
> > And it removes an unused function.
> >
> > Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.  I've
> > also bootstrapped with -O2 -g3 to exercise the .debug_macro path.
> >
> > Ok?
> >
> > Just noticed that DEBUG_STR_OFFSETS_SECTION needs similar massaging
> > for its dwarf_split_debug_info condition - will followup as obvious
> > if this one is approved.
> 
> this patch introduced many pch assembly comparison failures on Solaris
> (both sparc and x86, 32 and 64-bit, /bin/as only), like
> 
> FAIL: gcc.dg/pch/common-1.c   -O3 -g  assembly comparison
> FAIL: gcc.dg/pch/common-1.c  -O0 -g assembly comparison
> 
> gcc.log shows this diff:
> 
> <   .long   .Letext0
> >   .long
> 
> While the .Letext0 label is still in the assembly output, it isn't
> referenced inside .debug_line, as can be seen in the diff.

Can you check if moving

static void
dwarf2out_assembly_start (void)
{
#ifndef DWARF2_LINENO_DEBUGGING_INFO
  ASM_GENERATE_INTERNAL_LABEL (text_section_label, TEXT_SECTION_LABEL, 0);
  ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
  ASM_GENERATE_INTERNAL_LABEL (cold_text_section_label,
   COLD_TEXT_SECTION_LABEL, 0);
  ASM_GENERATE_INTERNAL_LABEL (cold_end_label, COLD_END_LABEL, 0);

  switch_to_section (text_section);
  ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
#endif

back to dwarf2out_init helps?  Ah!  Does

Index: gcc/dwarf2out.c
===
--- gcc/dwarf2out.c (revision 240521)
+++ gcc/dwarf2out.c (working copy)
@@ -25657,14 +25687,6 @@ dwarf2out_init (const char *filename ATT
 vec_alloc (macinfo_table, 64);
 #endif
 
-  /* Make sure the line number table for .text always exists.  */
-  text_section_line_info = new_line_info_table ();
-  text_section_line_info->end_label = text_end_label;
-
-#ifdef DWARF2_LINENO_DEBUGGING_INFO
-  cur_line_info_table = text_section_line_info;
-#endif
-
   /* If front-ends already registered a main translation unit but we were 
not
  ready to perform the association, do this now.  */
   if (main_translation_unit != NULL_TREE)
@@ -25688,6 +25710,14 @@ dwarf2out_assembly_start (void)
   ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
 #endif
 
+  /* Make sure the line number table for .text always exists.  */
+  text_section_line_info = new_line_info_table ();
+  text_section_line_info->end_label = text_end_label;
+
+#ifdef DWARF2_LINENO_DEBUGGING_INFO
+  cur_line_info_table = text_section_line_info;
+#endif
+
   if (HAVE_GAS_CFI_SECTIONS_DIRECTIVE
   && dwarf2out_do_cfi_asm ()
   && (!(flag_unwind_tables || flag_exceptions)


fix it?  Ok if it passes testing for you.

Thanks,
Richard.


Re: [PATCH] Refactor section/label init for early LTO debug

2016-09-27 Thread Dominique d'Humières
> this patch introduced many pch assembly comparison failures on Solaris
> (both sparc and x86, 32 and 64-bit, /bin/as only), like
Something on darwin.

TIA

Dominique



Re: [PATCH] Refactor section/label init for early LTO debug

2016-09-27 Thread Rainer Orth
Hi Richard,

> The following patch ports a refactoring of section/label in it from
> the early LTO debug work to trunk.  For early LTO debug we need to
> be able to emit two sets of debug infos into two sets of different
> sections - early LTO into .gnu.debuglto_ prefixed sections and
> regular (early + late) debug for the FAT part of the object.
>
> Thus this preparation splits out the section and label generation
> from dwarf2out_init moving the text section related stuff to 
> dwarf2out_assembly_start and the rest to a new function
> init_sections_and_labels which is now called only before we start
> outputting dwarf (in dwarf2out_finish).  It also removes some
> dwarf_split_debug_info checks from the macro section name defines
> (in the end I'll have up to four variants - regular, regular LTO,
> DWO, DWO LTO).
>
> And it removes an unused function.
>
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.  I've
> also bootstrapped with -O2 -g3 to exercise the .debug_macro path.
>
> Ok?
>
> Just noticed that DEBUG_STR_OFFSETS_SECTION needs similar massaging
> for its dwarf_split_debug_info condition - will followup as obvious
> if this one is approved.

this patch introduced many pch assembly comparison failures on Solaris
(both sparc and x86, 32 and 64-bit, /bin/as only), like

FAIL: gcc.dg/pch/common-1.c   -O3 -g  assembly comparison
FAIL: gcc.dg/pch/common-1.c  -O0 -g assembly comparison

gcc.log shows this diff:

<   .long   .Letext0
>   .long

While the .Letext0 label is still in the assembly output, it isn't
referenced inside .debug_line, as can be seen in the diff.

Unlike the gas case, with as HAVE_AS_DWARF2_DEBUG_LINE isn't defined.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: [PATCH] Refactor section/label init for early LTO debug

2016-09-23 Thread Jason Merrill
OK.

On Wed, Sep 21, 2016 at 9:19 AM, Richard Biener  wrote:
>
> The following patch ports a refactoring of section/label in it from
> the early LTO debug work to trunk.  For early LTO debug we need to
> be able to emit two sets of debug infos into two sets of different
> sections - early LTO into .gnu.debuglto_ prefixed sections and
> regular (early + late) debug for the FAT part of the object.
>
> Thus this preparation splits out the section and label generation
> from dwarf2out_init moving the text section related stuff to
> dwarf2out_assembly_start and the rest to a new function
> init_sections_and_labels which is now called only before we start
> outputting dwarf (in dwarf2out_finish).  It also removes some
> dwarf_split_debug_info checks from the macro section name defines
> (in the end I'll have up to four variants - regular, regular LTO,
> DWO, DWO LTO).
>
> And it removes an unused function.
>
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.  I've
> also bootstrapped with -O2 -g3 to exercise the .debug_macro path.
>
> Ok?
>
> Just noticed that DEBUG_STR_OFFSETS_SECTION needs similar massaging
> for its dwarf_split_debug_info condition - will followup as obvious
> if this one is approved.
>
> Thanks,
> Richard.
>
> 2016-09-21  Richard Biener  
>
> * dwarf2out.c (stripattributes): Remove unused function.
> (DEBUG_NORM_MACINFO_SECTION): Rename to DEBUG_MACINFO_SECTION.
> Push dwarf_split_debug_info handling into init_sections_and_labels.
> (DEBUG_NORM_MACRO_SECTION): Likewise to DEBUG_MACRO_SECTION.
> (DEBUG_MACRO_SECTION_FLAGS): Remove.
> (debug_macinfo_section_name): New global.
> (output_macinfo): Use debug_macinfo_section_name.
> (init_sections_and_labels): Split out section and label generation
> from dwarf2out_init.  Set debug_macinfo_section_name.
> (dwarf2out_init): Move text section label generation and emission
> to ...
> (dwarf2out_assembly_start): ... here.
> (dwarf2out_finish): Call init_sections_and_labels before DWARF
> output starts.
>
> Index: gcc/dwarf2out.c
> ===
> --- gcc/dwarf2out.c (revision 240303)
> +++ gcc/dwarf2out.c (working copy)
> @@ -159,6 +159,7 @@ static GTY(()) section *debug_skeleton_a
>  static GTY(()) section *debug_aranges_section;
>  static GTY(()) section *debug_addr_section;
>  static GTY(()) section *debug_macinfo_section;
> +static const char *debug_macinfo_section_name;
>  static GTY(()) section *debug_line_section;
>  static GTY(()) section *debug_skeleton_line_section;
>  static GTY(()) section *debug_loc_section;
> @@ -265,7 +266,6 @@ static GTY(()) dw_die_ref decltype_auto_
>
>  /* Forward declarations for functions defined in this file.  */
>
> -static char *stripattributes (const char *);
>  static void output_call_frame_info (int);
>  static void dwarf2out_note_section_used (void);
>
> @@ -410,24 +410,6 @@ should_emit_struct_debug (tree type, enu
>return DUMP_GSTRUCT (type, usage, criterion, generic, false, false);
>  }
>
> -/* Return a pointer to a copy of the section string name S with all
> -   attributes stripped off, and an asterisk prepended (for assemble_name).  
> */
> -
> -static inline char *
> -stripattributes (const char *s)
> -{
> -  char *stripped = XNEWVEC (char, strlen (s) + 2);
> -  char *p = stripped;
> -
> -  *p++ = '*';
> -
> -  while (*s && *s != ',')
> -*p++ = *s++;
> -
> -  *p = '\0';
> -  return stripped;
> -}
> -
>  /* Switch [BACK] to eh_frame_section.  If we don't have an eh_frame_section,
> switch to the data section instead, and write out a synthetic start label
> for collect2 the first time around.  */
> @@ -3514,27 +3496,17 @@ new_addr_loc_descr (rtx addr, enum dtpre
>  #ifndef DEBUG_ADDR_SECTION
>  #define DEBUG_ADDR_SECTION ".debug_addr"
>  #endif
> -#ifndef DEBUG_NORM_MACINFO_SECTION
> -#define DEBUG_NORM_MACINFO_SECTION ".debug_macinfo"
> +#ifndef DEBUG_MACINFO_SECTION
> +#define DEBUG_MACINFO_SECTION ".debug_macinfo"
>  #endif
>  #ifndef DEBUG_DWO_MACINFO_SECTION
>  #define DEBUG_DWO_MACINFO_SECTION  ".debug_macinfo.dwo"
>  #endif
> -#ifndef DEBUG_MACINFO_SECTION
> -#define DEBUG_MACINFO_SECTION   \
> -  (!dwarf_split_debug_info  \
> -   ? (DEBUG_NORM_MACINFO_SECTION) : (DEBUG_DWO_MACINFO_SECTION))
> -#endif
> -#ifndef DEBUG_NORM_MACRO_SECTION
> -#define DEBUG_NORM_MACRO_SECTION ".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 \
> -  (!dwarf_split_debug_info  \
> -   ? (DEBUG_NORM_MACRO_SECTION) : (DEBUG_DWO_MACRO_SECTION))
> +#define 

[PATCH] Refactor section/label init for early LTO debug

2016-09-21 Thread Richard Biener

The following patch ports a refactoring of section/label in it from
the early LTO debug work to trunk.  For early LTO debug we need to
be able to emit two sets of debug infos into two sets of different
sections - early LTO into .gnu.debuglto_ prefixed sections and
regular (early + late) debug for the FAT part of the object.

Thus this preparation splits out the section and label generation
from dwarf2out_init moving the text section related stuff to 
dwarf2out_assembly_start and the rest to a new function
init_sections_and_labels which is now called only before we start
outputting dwarf (in dwarf2out_finish).  It also removes some
dwarf_split_debug_info checks from the macro section name defines
(in the end I'll have up to four variants - regular, regular LTO,
DWO, DWO LTO).

And it removes an unused function.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.  I've
also bootstrapped with -O2 -g3 to exercise the .debug_macro path.

Ok?

Just noticed that DEBUG_STR_OFFSETS_SECTION needs similar massaging
for its dwarf_split_debug_info condition - will followup as obvious
if this one is approved.

Thanks,
Richard.

2016-09-21  Richard Biener  

* dwarf2out.c (stripattributes): Remove unused function.
(DEBUG_NORM_MACINFO_SECTION): Rename to DEBUG_MACINFO_SECTION.
Push dwarf_split_debug_info handling into init_sections_and_labels.
(DEBUG_NORM_MACRO_SECTION): Likewise to DEBUG_MACRO_SECTION.
(DEBUG_MACRO_SECTION_FLAGS): Remove.
(debug_macinfo_section_name): New global.
(output_macinfo): Use debug_macinfo_section_name.
(init_sections_and_labels): Split out section and label generation
from dwarf2out_init.  Set debug_macinfo_section_name.
(dwarf2out_init): Move text section label generation and emission
to ...
(dwarf2out_assembly_start): ... here.
(dwarf2out_finish): Call init_sections_and_labels before DWARF
output starts.

Index: gcc/dwarf2out.c
===
--- gcc/dwarf2out.c (revision 240303)
+++ gcc/dwarf2out.c (working copy)
@@ -159,6 +159,7 @@ static GTY(()) section *debug_skeleton_a
 static GTY(()) section *debug_aranges_section;
 static GTY(()) section *debug_addr_section;
 static GTY(()) section *debug_macinfo_section;
+static const char *debug_macinfo_section_name;
 static GTY(()) section *debug_line_section;
 static GTY(()) section *debug_skeleton_line_section;
 static GTY(()) section *debug_loc_section;
@@ -265,7 +266,6 @@ static GTY(()) dw_die_ref decltype_auto_
 
 /* Forward declarations for functions defined in this file.  */
 
-static char *stripattributes (const char *);
 static void output_call_frame_info (int);
 static void dwarf2out_note_section_used (void);
 
@@ -410,24 +410,6 @@ should_emit_struct_debug (tree type, enu
   return DUMP_GSTRUCT (type, usage, criterion, generic, false, false);
 }
 
-/* Return a pointer to a copy of the section string name S with all
-   attributes stripped off, and an asterisk prepended (for assemble_name).  */
-
-static inline char *
-stripattributes (const char *s)
-{
-  char *stripped = XNEWVEC (char, strlen (s) + 2);
-  char *p = stripped;
-
-  *p++ = '*';
-
-  while (*s && *s != ',')
-*p++ = *s++;
-
-  *p = '\0';
-  return stripped;
-}
-
 /* Switch [BACK] to eh_frame_section.  If we don't have an eh_frame_section,
switch to the data section instead, and write out a synthetic start label
for collect2 the first time around.  */
@@ -3514,27 +3496,17 @@ new_addr_loc_descr (rtx addr, enum dtpre
 #ifndef DEBUG_ADDR_SECTION
 #define DEBUG_ADDR_SECTION ".debug_addr"
 #endif
-#ifndef DEBUG_NORM_MACINFO_SECTION
-#define DEBUG_NORM_MACINFO_SECTION ".debug_macinfo"
+#ifndef DEBUG_MACINFO_SECTION
+#define DEBUG_MACINFO_SECTION ".debug_macinfo"
 #endif
 #ifndef DEBUG_DWO_MACINFO_SECTION
 #define DEBUG_DWO_MACINFO_SECTION  ".debug_macinfo.dwo"
 #endif
-#ifndef DEBUG_MACINFO_SECTION
-#define DEBUG_MACINFO_SECTION   \
-  (!dwarf_split_debug_info  \
-   ? (DEBUG_NORM_MACINFO_SECTION) : (DEBUG_DWO_MACINFO_SECTION))
-#endif
-#ifndef DEBUG_NORM_MACRO_SECTION
-#define DEBUG_NORM_MACRO_SECTION ".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 \
-  (!dwarf_split_debug_info  \
-   ? (DEBUG_NORM_MACRO_SECTION) : (DEBUG_DWO_MACRO_SECTION))
+#define DEBUG_MACRO_SECTION".debug_macro"
 #endif
 #ifndef DEBUG_LINE_SECTION
 #define DEBUG_LINE_SECTION ".debug_line"
@@ -3580,10 +3552,6 @@ new_addr_loc_descr (rtx addr, enum dtpre
 #define TEXT_SECTION_NAME  ".text"
 #endif
 
-/* Section flags for .debug_macinfo/.debug_macro section.  */
-#define