$OpenBSD: patch-gcc_config_alpha_alpha_c,v 1.2 2012/07/01 18:56:45 pascal Exp $
--- gcc/config/alpha/alpha.c.orig	Sun May 13 18:25:20 2012
+++ gcc/config/alpha/alpha.c	Wed Jun 20 14:39:11 2012
@@ -421,11 +421,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 and also if
@@ -7619,6 +7625,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 %d bytes", frame_size);
+
   if (flag_stack_usage_info)
     current_function_static_stack_size = frame_size;
 
@@ -7657,6 +7666,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)
@@ -7849,6 +7860,44 @@ alpha_expand_prologue (void)
 				           stack_pointer_rtx, sa_reg)));
 	}
     }
+    }
+  else
+    {
+      if (frame_size <= 32768)
+	{
+	  if (frame_size != 0)
+	    FRP (emit_insn (gen_adddi3 (stack_pointer_rtx, stack_pointer_rtx,
+					GEN_INT (TARGET_ABI_UNICOSMK
+						 ? -frame_size + 64
+						 : -frame_size))));
+	}
+      else
+	{
+	  rtx count = gen_rtx_REG (DImode, 23);
+	  rtx seq;
+ 
+	  emit_move_insn (count, GEN_INT (TARGET_ABI_UNICOSMK
+					  ? -frame_size + 64
+					  : -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;
+	  REG_NOTES (seq)
+	    = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR,
+				 gen_rtx_SET (VOIDmode, stack_pointer_rtx,
+				   gen_rtx_PLUS (Pmode, stack_pointer_rtx,
+						 GEN_INT (TARGET_ABI_UNICOSMK
+							  ? -frame_size + 64
+							  : -frame_size))),
+				 REG_NOTES (seq));
+	}
+    }
+
+
 
   /* The ABIs for VMS and OSF/1 say that while we can schedule insns into
      the prologue, for exception handling reasons, we cannot do this for
