Fix lto-bootstrap issue (one of them)

Message ID alpine.LNX.2.00.1209251316140.4063@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Sept. 25, 2012, 11:19 a.m.
The following fixes the TREE_ADDRESSABLE issue during LTO bootstrap.
We fail to merge all symbols because 'first' may no longer be 'first'.

Committed as obvious.  LTO bootstrap is still broken for me:

/tmp/ccXpATTw.ltrans19.ltrans.o: In function `is_ctor_or_dtor.17240':
ccXpATTw.ltrans19.o:(.text+0x133): undefined reference to `alloca'
ccXpATTw.ltrans19.o:(.text+0x147): undefined reference to `alloca'
/tmp/ccXpATTw.ltrans19.ltrans.o: In function `d_demangle_callback.17277':
ccXpATTw.ltrans19.o:(.text+0x1495): undefined reference to `alloca'
ccXpATTw.ltrans19.o:(.text+0x14b8): undefined reference to `alloca'
collect2: error: ld returned 1 exit status

I'll try updating binutils (but I don't see how alloca calls
should survive!?  both of the above is for cp-demangle.c of libiberty).


2012-09-25  Richard Guenther  <>

	* lto-symtab.c (lto_symtab_merge_decls_1): Properly merge
	all of the chain.


Index: gcc/lto-symtab.c
--- gcc/lto-symtab.c	(revision 191696)
+++ gcc/lto-symtab.c	(working copy)
@@ -566,12 +566,12 @@  lto_symtab_merge_decls_1 (symtab_node fi
   /* Merge the chain to the single prevailing decl and diagnose
      mismatches.  */
-  lto_symtab_merge_decls_2 (first, diagnosed_p);
+  lto_symtab_merge_decls_2 (prevailing, diagnosed_p);
   if (cgraph_dump_file)
       fprintf (cgraph_dump_file, "After resolution:\n");
-      for (e = first; e; e = e->symbol.next_sharing_asm_name)
+      for (e = prevailing; e; e = e->symbol.next_sharing_asm_name)
 	dump_symtab_node (cgraph_dump_file, e);