This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR lto/55466: Revision 191466 destroyed DWARF debug info


On Fri, Dec 7, 2012 at 11:59 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Hi,
>
> Since revision 191466, LTO no longer maintains its own symbol table and
> it uses varpool for variables instead.  As the result, debug info on
> variables is lost when GCC is configured with
>
> --enable-bootstrap --with-build-config=bootstrap-lto
>
> This patch record the global variables if WPA isn't enabled.  It
> works when GCC is configured with
>
> --enable-bootstrap --with-build-config=bootstrap-lto --enable-languages=c,c++,fortran,java,lto,objc,obj-c++
>
> However, when go is added, I got
>
> lto1: internal compiler error: in add_AT_specification, at
> dwarf2out.c:3985
> 0x629ad9 add_AT_specification
>         /export/gnu/import/git/gcc/gcc/dwarf2out.c:3985
> 0x64dabb gen_variable_die
>         /export/gnu/import/git/gcc/gcc/dwarf2out.c:18327
> 0x65336b gen_decl_die
>         /export/gnu/import/git/gcc/gcc/dwarf2out.c:20033
> 0x653fcd dwarf2out_decl(tree_node*)
>         /export/gnu/import/git/gcc/gcc/dwarf2out.c:20348
> 0x6535f9 dwarf2out_global_decl
>         /export/gnu/import/git/gcc/gcc/dwarf2out.c:20083
> 0x997703 emit_debug_global_declarations(tree_node**, int)
>         /export/gnu/import/git/gcc/gcc/toplev.c:530
> 0x521aaa lto_write_globals
>         /export/gnu/import/git/gcc/gcc/lto/lto-lang.c:1067
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <http://gcc.gnu.org/bugs.html> for instructions.
> make[6]: *** [/tmp/cc3yYR7d.ltrans4.ltrans.o] Error 1
> lto-wrapper: make returned 2 exit status
> /usr/local/x86_64-unknown-linux-gnu/bin/ld: lto-wrapper failed
> collect2: error: ld returned 1 exit status
> make[5]: *** [go1] Error 1
>
> This is latent without my patch since no DWARF info on varaibles are
>  generated.  OK to install?
>
> Thanks.
>
>
> H.J.
> ---
> 2012-12-07  H.J. Lu  <hongjiu.lu@intel.com>
>
>         PR lto/55466
>         * lto-symtab.c (lto_symtab_merge_decls_1): Don't record
>         the prevailing variable.
>         * lto.c (lto_main): Record the global variables if WPA isn't
>         enabled.
>
> diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c
> index 0b0cdac..295fd37 100644
> --- a/gcc/lto-symtab.c
> +++ b/gcc/lto-symtab.c
> @@ -443,10 +443,6 @@ lto_symtab_merge_decls_1 (symtab_node first)
>
>    symtab_prevail_in_asm_name_hash (prevailing);
>
> -  /* Record the prevailing variable.  */
> -  if (TREE_CODE (prevailing->symbol.decl) == VAR_DECL)
> -    vec_safe_push (lto_global_var_decls, prevailing->symbol.decl);
> -

As this is not necessary, the push in lto.c:lto_register_var_decl_in_symtab
for statics should not be necessary either (we even call
rest_of_decl_compilation
there).

Ok with that push removed as well.

Please make sure to file a bugreport for the go LTO bootstrap issue.

Thanks,
Richard.

>    /* Diagnose mismatched objects.  */
>    for (e = prevailing->symbol.next_sharing_asm_name;
>         e; e = e->symbol.next_sharing_asm_name)
> diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
> index 376af85..e567cb0 100644
> --- a/gcc/lto/lto.c
> +++ b/gcc/lto/lto.c
> @@ -3380,6 +3380,8 @@ lto_main (void)
>         do_whole_program_analysis ();
>        else
>         {
> +         struct varpool_node *vnode;
> +
>           timevar_start (TV_PHASE_OPT_GEN);
>
>           materialize_cgraph ();
> @@ -3397,6 +3399,10 @@ lto_main (void)
>              this.  */
>           if (flag_lto_report)
>             print_lto_report_1 ();
> +
> +         /* Record the global variables.  */
> +         FOR_EACH_DEFINED_VARIABLE (vnode)
> +           vec_safe_push (lto_global_var_decls, vnode->symbol.decl);
>         }
>      }
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]