$OpenBSD: patch-gcc_config_sh_sh_md,v 1.1 2013/02/04 21:23:40 tobiasu Exp $
--- gcc/config/sh/sh.md.orig	Tue Jan 29 02:05:10 2013
+++ gcc/config/sh/sh.md	Tue Jan 29 02:07:11 2013
@@ -1774,28 +1774,8 @@
 
   operands[3] = gen_reg_rtx (Pmode);
   /* Emit the move of the address to a pseudo outside of the libcall.  */
-  if (TARGET_DIVIDE_CALL_TABLE)
+  if (TARGET_HARD_SH4 && TARGET_SH2E)
     {
-      /* libgcc2:__udivmoddi4 is not supposed to use an actual division, since
-	 that causes problems when the divide code is supposed to come from a
-	 separate library.  Division by zero is undefined, so dividing 1 can be
-	 implemented by comparing with the divisor.  */
-      if (operands[1] == const1_rtx && currently_expanding_to_rtl)
-	{
-	  emit_insn (gen_cmpsi (operands[1], operands[2]));
-	  emit_insn (gen_sgeu (operands[0]));
-	  DONE;
-	}
-      else if (operands[2] == const0_rtx)
-	{
-	  emit_move_insn (operands[0], operands[2]);
-	  DONE;
-	}
-      function_symbol (operands[3], \"__udivsi3_i4i\", SFUNC_GOT);
-      last = gen_udivsi3_i4_int (operands[0], operands[3]);
-    }
-  else if (TARGET_DIVIDE_CALL_FP)
-    {
       function_symbol (operands[3], \"__udivsi3_i4\", SFUNC_STATIC);
       if (TARGET_FPU_SINGLE)
 	last = gen_udivsi3_i4_single (operands[0], operands[3]);
@@ -2046,13 +2026,8 @@
 
   operands[3] = gen_reg_rtx (Pmode);
   /* Emit the move of the address to a pseudo outside of the libcall.  */
-  if (TARGET_DIVIDE_CALL_TABLE)
+  if (TARGET_HARD_SH4 && TARGET_SH2E)
     {
-      function_symbol (operands[3], sh_divsi3_libfunc, SFUNC_GOT);
-      last = gen_divsi3_i4_int (operands[0], operands[3]);
-    }
-  else if (TARGET_DIVIDE_CALL_FP)
-    {
       function_symbol (operands[3], sh_divsi3_libfunc, SFUNC_STATIC);
       if (TARGET_FPU_SINGLE)
 	last = gen_divsi3_i4_single (operands[0], operands[3]);
@@ -8354,7 +8329,7 @@ label:
       && GET_CODE (XEXP (operands[1], 0)) == UNSPEC
       && GET_CODE (XVECEXP (XEXP (operands[1], 0), 0, 0)) == SYMBOL_REF
       && strcmp (XSTR (XVECEXP (XEXP (operands[1], 0), 0, 0), 0),
-		 \"__stack_chk_guard\") == 0)
+		 \"__guard_local\") == 0)
     emit_insn (gen_blockage ());
 
   /* N.B. This is not constant for a GOTPLT relocation.  */
