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

Avoid duplicate toplevel asms with WHOPR


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.
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);


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