Patchwork Disable creation of local aliases on targets w/o alias support

login
register
mail settings
Submitter Jan Hubicka
Date Sept. 17, 2013, 4:04 p.m.
Message ID <20130917160458.GD1126@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/275494/
State New
Headers show

Comments

Jan Hubicka - Sept. 17, 2013, 4:04 p.m.
Hi,
this patch should fix HP-PA bootstrap issue where we create local aliases but the target
has no support for them. 

Bootstrapped/regtested x86_64-linux (with aliases disabled) and commited.
	PR middle-end/58329
	* ipa-devirt.c (ipa_devirt): Be ready for symtab_nonoverwritable_alias
	to return NULL.
	* ipa.c (function_and_variable_visibility): Likewise.
	* ipa-profile.c (ipa_profile): Likewise.

Patch

Index: ipa-devirt.c
===================================================================
--- ipa-devirt.c	(revision 202650)
+++ ipa-devirt.c	(working copy)
@@ -1098,7 +1098,13 @@  ipa_devirt (void)
 			   cgraph_node_name (likely_target),
 			   likely_target->symbol.order);
 		if (!symtab_can_be_discarded ((symtab_node) likely_target))
-		  likely_target = cgraph (symtab_nonoverwritable_alias ((symtab_node)likely_target));
+		  {
+		    cgraph_node *alias;
+		    alias = cgraph (symtab_nonoverwritable_alias
+				     ((symtab_node)likely_target));
+		    if (alias)
+		      likely_target = alias;
+		  }
 		nconverted++;
 		update = true;
 		cgraph_turn_edge_to_speculative
Index: ipa.c
===================================================================
--- ipa.c	(revision 202650)
+++ ipa.c	(working copy)
@@ -998,7 +998,7 @@  function_and_variable_visibility (bool w
 	{
 	  struct cgraph_node *alias = cgraph (symtab_nonoverwritable_alias ((symtab_node) node));
 
-	  if (alias != node)
+	  if (alias && alias != node)
 	    {
 	      while (node->callers)
 		{
Index: ipa-profile.c
===================================================================
--- ipa-profile.c	(revision 202650)
+++ ipa-profile.c	(working copy)
@@ -625,7 +625,13 @@  ipa_profile (void)
 			 of N2.  Speculate on the local alias to allow inlining.
 		       */
 		      if (!symtab_can_be_discarded ((symtab_node) n2))
-			n2 = cgraph (symtab_nonoverwritable_alias ((symtab_node)n2));
+			{
+			  cgraph_node *alias;
+			  alias = cgraph (symtab_nonoverwritable_alias
+					   ((symtab_node)n2));
+			  if (alias)
+			    n2 = alias;
+			}
 		      nconverted++;
 		      cgraph_turn_edge_to_speculative
 			(e, n2,
Index: symtab.c
===================================================================
--- symtab.c	(revision 202650)
+++ symtab.c	(working copy)
@@ -1083,6 +1083,10 @@  symtab_nonoverwritable_alias (symtab_nod
 		               (void *)&new_node, true);
   if (new_node)
     return new_node;
+#ifndef ASM_OUTPUT_DEF
+  /* If aliases aren't supported by the assembler, fail.  */
+  return NULL;
+#endif
 
   /* Otherwise create a new one.  */
   new_decl = copy_node (node->symbol.decl);