Patchwork [LTO] Fix PR47798, debug info for globals

login
register
mail settings
Submitter Richard Guenther
Date Feb. 18, 2011, 4:03 p.m.
Message ID <alpine.LNX.2.00.1102181702350.17230@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/83615/
State New
Headers show

Comments

Richard Guenther - Feb. 18, 2011, 4:03 p.m.
On Fri, 18 Feb 2011, Diego Novillo wrote:

> On Fri, Feb 18, 2011 at 09:15, Richard Guenther <rguenther@suse.de> wrote:
> >
> > We fail to emit debug information for privatized variables which causes
> > several guality fails.  The following patch fixes that.
> >
> > Bootstrapped and tested on x86_64-unknown-linux-gnu.
> >
> > Ok?
> >
> > Thanks,
> > Richard.
> >
> > 2011-02-18  Richard Guenther  <rguenther@suse.de>
> >
> >        PR lto/47798
> >        * lto-streamer.h (lto_global_var_decls): Declare.
> >        * lto-streamer-in.c (lto_register_var_decl_in_symtab): Register
> >        statics for global var processing.
> >
> >        lto/
> >        * lto-lang.h (lto_global_var_decls): Do not declare here.
> 
> The patch seems to be missing this hunk.

Right.  It's lto-tree.h, fixed patch below.

Richard.

2011-02-18  Richard Guenther  <rguenther@suse.de>

	PR lto/47798
	* lto-streamer.h (lto_global_var_decls): Declare.
	* lto-streamer-in.c (lto_register_var_decl_in_symtab): Register
	statics for global var processing.

	lto/
	* lto-tree.h (lto_global_var_decls): Do not declare here.
	* lto-lang.c: Include lto-streamer.h.
	* Make-lang.in (lto-lang.o): Adjust dependencies.


Index: gcc/lto/lto-tree.h
===================================================================
*** gcc/lto/lto-tree.h	(revision 170271)
--- gcc/lto/lto-tree.h	(working copy)
*************** union GTY((desc ("lto_tree_node_structur
*** 55,61 ****
  			desc ("tree_node_structure (&%h)"))) generic;
  };
  
- /* Vector to keep track of external variables we've seen so far.  */
- extern GTY(()) VEC(tree,gc) *lto_global_var_decls;
- 
  #endif /* GCC_LTO_TREE_H */
--- 55,58 ----
Diego Novillo - Feb. 18, 2011, 4:13 p.m.
On Fri, Feb 18, 2011 at 11:03, Richard Guenther <rguenther@suse.de> wrote:
> On Fri, 18 Feb 2011, Diego Novillo wrote:
>> >
>> >        PR lto/47798
>> >        * lto-streamer.h (lto_global_var_decls): Declare.
>> >        * lto-streamer-in.c (lto_register_var_decl_in_symtab): Register
>> >        statics for global var processing.
>> >
>> >        lto/
>> >        * lto-lang.h (lto_global_var_decls): Do not declare here.
>>
>> The patch seems to be missing this hunk.
>
> Right.  It's lto-tree.h, fixed patch below.

Thanks.

> 2011-02-18  Richard Guenther  <rguenther@suse.de>
>
>        PR lto/47798
>        * lto-streamer.h (lto_global_var_decls): Declare.
>        * lto-streamer-in.c (lto_register_var_decl_in_symtab): Register
>        statics for global var processing.
>
>        lto/
>        * lto-tree.h (lto_global_var_decls): Do not declare here.
>        * lto-lang.c: Include lto-streamer.h.
>        * Make-lang.in (lto-lang.o): Adjust dependencies.

OK.


Diego.
H.J. Lu - Feb. 18, 2011, 5:43 p.m.
On Fri, Feb 18, 2011 at 8:13 AM, Diego Novillo <dnovillo@google.com> wrote:
> On Fri, Feb 18, 2011 at 11:03, Richard Guenther <rguenther@suse.de> wrote:
>> On Fri, 18 Feb 2011, Diego Novillo wrote:
>>> >
>>> >        PR lto/47798
>>> >        * lto-streamer.h (lto_global_var_decls): Declare.
>>> >        * lto-streamer-in.c (lto_register_var_decl_in_symtab): Register
>>> >        statics for global var processing.
>>> >
>>> >        lto/
>>> >        * lto-lang.h (lto_global_var_decls): Do not declare here.
>>>
>>> The patch seems to be missing this hunk.
>>
>> Right.  It's lto-tree.h, fixed patch below.
>
> Thanks.
>
>> 2011-02-18  Richard Guenther  <rguenther@suse.de>
>>
>>        PR lto/47798
>>        * lto-streamer.h (lto_global_var_decls): Declare.
>>        * lto-streamer-in.c (lto_register_var_decl_in_symtab): Register
>>        statics for global var processing.
>>
>>        lto/
>>        * lto-tree.h (lto_global_var_decls): Do not declare here.
>>        * lto-lang.c: Include lto-streamer.h.
>>        * Make-lang.in (lto-lang.o): Adjust dependencies.
>
> OK.
>

I think this caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47807
H.J. Lu - Feb. 18, 2011, 6:55 p.m.
On Fri, Feb 18, 2011 at 9:43 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Fri, Feb 18, 2011 at 8:13 AM, Diego Novillo <dnovillo@google.com> wrote:
>> On Fri, Feb 18, 2011 at 11:03, Richard Guenther <rguenther@suse.de> wrote:
>>> On Fri, 18 Feb 2011, Diego Novillo wrote:
>>>> >
>>>> >        PR lto/47798
>>>> >        * lto-streamer.h (lto_global_var_decls): Declare.
>>>> >        * lto-streamer-in.c (lto_register_var_decl_in_symtab): Register
>>>> >        statics for global var processing.
>>>> >
>>>> >        lto/
>>>> >        * lto-lang.h (lto_global_var_decls): Do not declare here.
>>>>
>>>> The patch seems to be missing this hunk.
>>>
>>> Right.  It's lto-tree.h, fixed patch below.
>>
>> Thanks.
>>
>>> 2011-02-18  Richard Guenther  <rguenther@suse.de>
>>>
>>>        PR lto/47798
>>>        * lto-streamer.h (lto_global_var_decls): Declare.
>>>        * lto-streamer-in.c (lto_register_var_decl_in_symtab): Register
>>>        statics for global var processing.
>>>
>>>        lto/
>>>        * lto-tree.h (lto_global_var_decls): Do not declare here.
>>>        * lto-lang.c: Include lto-streamer.h.
>>>        * Make-lang.in (lto-lang.o): Adjust dependencies.
>>
>> OK.
>>
>
> I think this caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47807
>

This also caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47810
Richard Guenther - Feb. 19, 2011, 12:06 a.m.
On Fri, 18 Feb 2011, H.J. Lu wrote:

> On Fri, Feb 18, 2011 at 9:43 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> > On Fri, Feb 18, 2011 at 8:13 AM, Diego Novillo <dnovillo@google.com> wrote:
> >> On Fri, Feb 18, 2011 at 11:03, Richard Guenther <rguenther@suse.de> wrote:
> >>> On Fri, 18 Feb 2011, Diego Novillo wrote:
> >>>> >
> >>>> >        PR lto/47798
> >>>> >        * lto-streamer.h (lto_global_var_decls): Declare.
> >>>> >        * lto-streamer-in.c (lto_register_var_decl_in_symtab): Register
> >>>> >        statics for global var processing.
> >>>> >
> >>>> >        lto/
> >>>> >        * lto-lang.h (lto_global_var_decls): Do not declare here.
> >>>>
> >>>> The patch seems to be missing this hunk.
> >>>
> >>> Right.  It's lto-tree.h, fixed patch below.
> >>
> >> Thanks.
> >>
> >>> 2011-02-18  Richard Guenther  <rguenther@suse.de>
> >>>
> >>>        PR lto/47798
> >>>        * lto-streamer.h (lto_global_var_decls): Declare.
> >>>        * lto-streamer-in.c (lto_register_var_decl_in_symtab): Register
> >>>        statics for global var processing.
> >>>
> >>>        lto/
> >>>        * lto-tree.h (lto_global_var_decls): Do not declare here.
> >>>        * lto-lang.c: Include lto-streamer.h.
> >>>        * Make-lang.in (lto-lang.o): Adjust dependencies.
> >>
> >> OK.
> >>
> >
> > I think this caused:
> >
> > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47807
> >
> 
> This also caused:
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47810

All LTO guality fails very much depend on whether and what linker
plugin you use.  Most guality fails were just falsely UNSUPPORTED.

Richard.

Patch

Index: gcc/lto-streamer.h
===================================================================
--- gcc/lto-streamer.h	(revision 170270)
+++ gcc/lto-streamer.h	(working copy)
@@ -914,6 +914,7 @@  extern void lto_symtab_merge_cgraph_node
 extern tree lto_symtab_prevailing_decl (tree decl);
 extern enum ld_plugin_symbol_resolution lto_symtab_get_resolution (tree decl);
 extern void lto_symtab_free (void);
+extern GTY(()) VEC(tree,gc) *lto_global_var_decls;
 
 
 /* In lto-opts.c.  */
Index: gcc/lto/lto-lang.c
===================================================================
--- gcc/lto/lto-lang.c	(revision 170270)
+++ gcc/lto/lto-lang.c	(working copy)
@@ -34,6 +34,7 @@  along with GCC; see the file COPYING3.
 #include "gimple.h"
 #include "diagnostic-core.h"
 #include "toplev.h"
+#include "lto-streamer.h"
 
 static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *);
 static tree handle_leaf_attribute (tree *, tree, tree, int, bool *);
Index: gcc/lto/Make-lang.in
===================================================================
--- gcc/lto/Make-lang.in	(revision 170270)
+++ gcc/lto/Make-lang.in	(working copy)
@@ -79,7 +79,7 @@  $(LTO_EXE): $(LTO_OBJS) $(BACKEND) $(LIB
 lto/lto-lang.o: lto/lto-lang.c $(CONFIG_H) coretypes.h debug.h \
 	flags.h $(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(SYSTEM_H) \
 	$(TARGET_H) $(LTO_H) $(GIMPLE_H) gtype-lto.h gt-lto-lto-lang.h \
-	$(EXPR_H)
+	$(EXPR_H) lto-streamer.h
 lto/lto.o: lto/lto.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(OPTS_H) \
 	toplev.h $(TREE_H) $(DIAGNOSTIC_CORE_H) $(TM_H) \
 	$(CGRAPH_H) $(GGC_H) tree-ssa-operands.h $(TREE_PASS_H) \
Index: gcc/lto-streamer-in.c
===================================================================
--- gcc/lto-streamer-in.c	(revision 170271)
+++ gcc/lto-streamer-in.c	(working copy)
@@ -2432,6 +2427,8 @@  lto_register_var_decl_in_symtab (struct
       ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl));
       SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label));
       rest_of_decl_compilation (decl, 1, 0);
+
+      VEC_safe_push (tree, gc, lto_global_var_decls, decl);
     }
 
   /* If this variable has already been declared, queue the