Blame SOURCES/gcc48-rh1312436.patch

25c7f1
2015-12-02  Pierre-Marie de Rodat  <derodat@adacore.com>
25c7f1
25c7f1
	* dwarf2out.c (dwar2out_var_location): Enhance pattern matching to get
25c7f1
	the SYMBOL_REF they embed.
25c7f1
	(gen_subprogram_die): Handle such calls.
25c7f1
25c7f1
--- gcc/dwarf2out.c	(revision 231184)
25c7f1
+++ gcc/dwarf2out.c	(revision 231185)
25c7f1
@@ -18051,18 +18051,23 @@ gen_subprogram_die (tree decl, dw_die_re
25c7f1
 		    }
25c7f1
 		  if (mode == VOIDmode || mode == BLKmode)
25c7f1
 		    continue;
25c7f1
-		  if (XEXP (XEXP (arg, 0), 0) == pc_rtx)
25c7f1
+		  /* Get dynamic information about call target only if we
25c7f1
+		     have no static information: we cannot generate both
25c7f1
+		     DW_AT_abstract_origin and DW_AT_GNU_call_site_target
25c7f1
+		     attributes.  */
25c7f1
+		  if (ca_loc->symbol_ref == NULL_RTX)
25c7f1
 		    {
25c7f1
-		      gcc_assert (ca_loc->symbol_ref == NULL_RTX);
25c7f1
-		      tloc = XEXP (XEXP (arg, 0), 1);
25c7f1
-		      continue;
25c7f1
-		    }
25c7f1
-		  else if (GET_CODE (XEXP (XEXP (arg, 0), 0)) == CLOBBER
25c7f1
-			   && XEXP (XEXP (XEXP (arg, 0), 0), 0) == pc_rtx)
25c7f1
-		    {
25c7f1
-		      gcc_assert (ca_loc->symbol_ref == NULL_RTX);
25c7f1
-		      tlocc = XEXP (XEXP (arg, 0), 1);
25c7f1
-		      continue;
25c7f1
+		      if (XEXP (XEXP (arg, 0), 0) == pc_rtx)
25c7f1
+			{
25c7f1
+			  tloc = XEXP (XEXP (arg, 0), 1);
25c7f1
+			  continue;
25c7f1
+			}
25c7f1
+		      else if (GET_CODE (XEXP (XEXP (arg, 0), 0)) == CLOBBER
25c7f1
+			       && XEXP (XEXP (XEXP (arg, 0), 0), 0) == pc_rtx)
25c7f1
+			{
25c7f1
+			  tlocc = XEXP (XEXP (arg, 0), 1);
25c7f1
+			  continue;
25c7f1
+			}
25c7f1
 		    }
25c7f1
 		  reg = NULL;
25c7f1
 		  if (REG_P (XEXP (XEXP (arg, 0), 0)))
25c7f1
@@ -20842,15 +20847,27 @@ dwarf2out_var_location (rtx loc_note)
25c7f1
       if (!CALL_P (prev))
25c7f1
 	prev = XVECEXP (PATTERN (prev), 0, 0);
25c7f1
       ca_loc->tail_call_p = SIBLING_CALL_P (prev);
25c7f1
+
25c7f1
+      /* Look for a SYMBOL_REF in the "prev" instruction.  */
25c7f1
       x = get_call_rtx_from (PATTERN (prev));
25c7f1
       if (x)
25c7f1
 	{
25c7f1
-	  x = XEXP (XEXP (x, 0), 0);
25c7f1
-	  if (GET_CODE (x) == SYMBOL_REF
25c7f1
-	      && SYMBOL_REF_DECL (x)
25c7f1
-	      && TREE_CODE (SYMBOL_REF_DECL (x)) == FUNCTION_DECL)
25c7f1
-	    ca_loc->symbol_ref = x;
25c7f1
+	  /* Try to get the call symbol, if any.  */
25c7f1
+	  if (MEM_P (XEXP (x, 0)))
25c7f1
+	    x = XEXP (x, 0);
25c7f1
+	  /* First, look for a memory access to a symbol_ref.  */
25c7f1
+	  if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
25c7f1
+	      && SYMBOL_REF_DECL (XEXP (x, 0))
25c7f1
+	      && TREE_CODE (SYMBOL_REF_DECL (XEXP (x, 0))) == FUNCTION_DECL)
25c7f1
+	    ca_loc->symbol_ref = XEXP (x, 0);
25c7f1
+	  /* Otherwise, look at a compile-time known user-level function
25c7f1
+	     declaration.  */
25c7f1
+	  else if (MEM_P (x)
25c7f1
+		   && MEM_EXPR (x)
25c7f1
+		   && TREE_CODE (MEM_EXPR (x)) == FUNCTION_DECL)
25c7f1
+	    ca_loc->symbol_ref = XEXP (DECL_RTL (MEM_EXPR (x)), 0);
25c7f1
 	}
25c7f1
+
25c7f1
       ca_loc->block = insn_scope (prev);
25c7f1
       if (call_arg_locations)
25c7f1
 	call_arg_loc_last->next = ca_loc;