This is the mail archive of the gcc-bugs@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]

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


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-02-12
                 CC|                            |hubicka at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-12 13:39:15 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.


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