[Bug lto/56297] LTO: multiple definition error with global register variables

hubicka at ucw dot cz gcc-bugzilla@gcc.gnu.org
Tue Feb 12 16:24:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56297

--- Comment #5 from Jan Hubicka <hubicka at ucw dot cz> 2013-02-12 16:23:37 UTC ---
> Confirmed.  We put
> 
> register int i asm ("esp");
> 
> into the LTO symbol table.  Oops.  The GCC symtab and the partition contains
> 
> (gdb) call debug_symtab_node (node)
> *esp/0 (*esp) @0x7ffff6e1a068
>   Type: variable
>   Visibility: force_output public
>   References: 
>   Referring: main/1 (read)
>   Availability: overwritable
>   Varpool flags: analyzed finalized
> 
> not sure if we want to put global hardregs into the symtab at all ...
> (certainly not in the LTO symbol table we feed to the linker).
> Thus, maybe
> 
> Index: gcc/lto-streamer-out.c
> ===================================================================
> --- gcc/lto-streamer-out.c      (revision 195973)
> +++ gcc/lto-streamer-out.c      (working copy)
> @@ -1166,7 +1166,8 @@ write_symbol (struct streamer_tree_cache
>    if (!TREE_PUBLIC (t)
>        || is_builtin_fn (t)
>        || DECL_ABSTRACT (t)
> -      || TREE_CODE (t) == RESULT_DECL)
> +      || TREE_CODE (t) == RESULT_DECL
> +      || (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t)))
>      return;
> 
>    gcc_assert (TREE_CODE (t) == VAR_DECL
> 
> ?  At least it "works" with that change.
> 
> Testing it.

Yeah, I suppose we ought to put those out of symbol table for 4.9. I have local
patch for that.

Honza



More information about the Gcc-bugs mailing list