$OpenBSD: patch-gcc_config_alpha_alpha_c,v 1.1.1.1 2014/06/26 16:30:16 pascal Exp $
--- gcc/config/alpha/alpha.c.orig	Fri Nov 22 16:58:51 2013
+++ gcc/config/alpha/alpha.c	Mon Dec  2 12:20:02 2013
@@ -469,11 +469,17 @@ alpha_option_override (void)
   if (!global_options_set.x_g_switch_value)
     g_switch_value = 8;
 
+#ifdef OPENBSD_NATIVE
+  /* Make -fpic behave as -fPIC unless -msmall-data is specified. */
+  if (flag_pic == 2 && TARGET_SMALL_DATA)
+    warning (0, "-fPIC used with -msmall-data");
+#else
   /* Infer TARGET_SMALL_DATA from -fpic/-fPIC.  */
   if (flag_pic == 1)
     target_flags |= MASK_SMALL_DATA;
   else if (flag_pic == 2)
     target_flags &= ~MASK_SMALL_DATA;
+#endif
 
   /* Align labels and loops for optimal branching.  */
   /* ??? Kludge these by not doing anything if we don't optimize.  */
@@ -7608,6 +7614,9 @@ alpha_expand_prologue (void)
   sa_size = alpha_sa_size ();
   frame_size = compute_frame_size (get_frame_size (), sa_size);
 
+  if (warn_stack_larger_than && frame_size > stack_larger_than_size)
+    warning (OPT_Wstack_larger_than_, "stack usage is %ld bytes", frame_size);
+
   if (flag_stack_usage_info)
     current_function_static_stack_size = frame_size;
 
@@ -7646,6 +7655,8 @@ alpha_expand_prologue (void)
   if (flag_stack_check)
     probed_size += STACK_CHECK_PROTECT;
 
+if (flag_stack_check || STACK_CHECK_BUILTIN)
+  {
   if (probed_size <= 32768)
     {
       if (probed_size > 4096)
@@ -7724,6 +7735,34 @@ alpha_expand_prologue (void)
 		    gen_rtx_SET (VOIDmode, stack_pointer_rtx,
 				 plus_constant (Pmode, stack_pointer_rtx,
 						-frame_size)));
+    }
+    }
+  else
+    {
+      if (frame_size <= 32768)
+	{
+	  if (frame_size != 0)
+	    FRP (emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx,
+					GEN_INT (-frame_size))));
+	}
+      else
+	{
+	  rtx count = gen_rtx_REG (DImode, 23);
+	  rtx seq;
+ 
+	  emit_move_insn (count, GEN_INT (-frame_size));
+	  seq = emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx,
+				       count));
+ 
+	  /* This alternative is special, because the DWARF code cannot
+	     possibly intuit through the loop above.  So we invent this
+	     note it looks at instead.  */
+	  RTX_FRAME_RELATED_P (seq) = 1;
+          add_reg_note (seq, REG_FRAME_RELATED_EXPR,
+		    gen_rtx_SET (VOIDmode, stack_pointer_rtx,
+				 plus_constant (Pmode, stack_pointer_rtx,
+						-frame_size)));
+	}
     }
 
   /* Cope with very large offsets to the register save area.  */
