Patchwork Avoid duplicate toplevel asms with WHOPR

login
register
mail settings
Submitter Jan Hubicka
Date July 7, 2010, 1:18 a.m.
Message ID <20100707011845.GC12425@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/58075/
State New
Headers show

Comments

Jan Hubicka - July 7, 2010, 1:18 a.m.
Hi,
this fixes problem linking Mozilla.  The problem is that libffi use toplevel asms for
stub functions and they get shipped into every partition producing about 1million linker
error messages.

This patch makes them go to only first partition.  It is not very clean, but I can't
think of anything pretty here.

Boostrapped/regtested x86_64-linux, OK?

Honza

	* lto-cgraph.c (output_cgraph): Output toplevel asms only into first
	partition.
Diego Novillo - July 7, 2010, 2:03 a.m.
On Wed, Jul 7, 2010 at 01:18, Jan Hubicka <hubicka@ucw.cz> wrote:

>        * lto-cgraph.c (output_cgraph): Output toplevel asms only into first
>        partition.

OK.


Diego.

Patch

Index: lto-cgraph.c
===================================================================
--- lto-cgraph.c	(revision 161898)
+++ lto-cgraph.c	(working copy)
@@ -881,14 +884,21 @@  output_cgraph (cgraph_node_set set, varp
 
   lto_output_uleb128_stream (ob->main_stream, 0);
 
-  /* Emit toplevel asms.  */
-  for (can = cgraph_asm_nodes; can; can = can->next)
+  /* Emit toplevel asms.
+     When doing WPA we must output every asm just once.  Since we do not partition asm
+     nodes at all, output them to first output.  This is kind of hack, but should work
+     well.  */
+  if (!asm_nodes_output)
     {
-      int len = TREE_STRING_LENGTH (can->asm_str);
-      lto_output_uleb128_stream (ob->main_stream, len);
-      for (i = 0; i < len; ++i)
-	lto_output_1_stream (ob->main_stream,
-			     TREE_STRING_POINTER (can->asm_str)[i]);
+      asm_nodes_output = true;
+      for (can = cgraph_asm_nodes; can; can = can->next)
+	{
+	  int len = TREE_STRING_LENGTH (can->asm_str);
+	  lto_output_uleb128_stream (ob->main_stream, len);
+	  for (i = 0; i < len; ++i)
+	    lto_output_1_stream (ob->main_stream,
+				 TREE_STRING_POINTER (can->asm_str)[i]);
+	}
     }
 
   lto_output_uleb128_stream (ob->main_stream, 0);