Blame SOURCES/gcc32-pr26208-workaround.patch

6f1b0c
--- gcc/unwind-dw2.c.jj	2006-05-22 13:39:48.000000000 -0400
6f1b0c
+++ gcc/unwind-dw2.c	2006-05-22 13:48:20.000000000 -0400
6f1b0c
@@ -61,8 +61,8 @@ struct _Unwind_Context
6f1b0c
   void *ra;
6f1b0c
   void *lsda;
6f1b0c
   struct dwarf_eh_bases bases;
6f1b0c
+#define SIGNAL_FRAME_BIT ((~(_Unwind_Word) 0 >> 1) + 1)
6f1b0c
   _Unwind_Word args_size;
6f1b0c
-  char signal_frame;
6f1b0c
 };
6f1b0c
 
6f1b0c
 /* Byte size of every register managed by these routines.  */
6f1b0c
@@ -201,7 +201,7 @@ _Unwind_GetIP (struct _Unwind_Context *c
6f1b0c
 inline _Unwind_Ptr
6f1b0c
 _Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
6f1b0c
 {
6f1b0c
-  *ip_before_insn = context->signal_frame != 0;
6f1b0c
+  *ip_before_insn = (context->args_size & SIGNAL_FRAME_BIT) != 0;
6f1b0c
   return (_Unwind_Ptr) context->ra;
6f1b0c
 }
6f1b0c
 
6f1b0c
@@ -758,7 +758,8 @@ execute_cfa_program (const unsigned char
6f1b0c
      reflected at the point immediately before the call insn.
6f1b0c
      In signal frames, return address is after last completed instruction,
6f1b0c
      so we add 1 to return address to make the comparison <=.  */
6f1b0c
-  while (insn_ptr < insn_end && fs->pc < context->ra + context->signal_frame)
6f1b0c
+  while (insn_ptr < insn_end
6f1b0c
+	 && fs->pc < context->ra + ((context->args_size & SIGNAL_FRAME_BIT) != 0))
6f1b0c
     {
6f1b0c
       unsigned char insn = *insn_ptr++;
6f1b0c
       _Unwind_Word reg, utmp;
6f1b0c
@@ -918,7 +919,14 @@ execute_cfa_program (const unsigned char
6f1b0c
 	  break;
6f1b0c
 
6f1b0c
 	case DW_CFA_GNU_args_size:
6f1b0c
-	  insn_ptr = read_uleb128 (insn_ptr, &context->args_size);
6f1b0c
+	  {
6f1b0c
+	    _Unwind_Word args_size;
6f1b0c
+	    insn_ptr = read_uleb128 (insn_ptr, &args_size);
6f1b0c
+	    if (args_size & SIGNAL_FRAME_BIT)
6f1b0c
+	      abort ();
6f1b0c
+	    context->args_size
6f1b0c
+	      = (context->args_size & SIGNAL_FRAME_BIT) | args_size;
6f1b0c
+	  }
6f1b0c
 	  break;
6f1b0c
 
6f1b0c
 	case DW_CFA_GNU_negative_offset_extended:
6f1b0c
@@ -945,10 +953,10 @@ uw_frame_state_for (struct _Unwind_Conte
6f1b0c
   const unsigned char *aug, *insn, *end;
6f1b0c
 
6f1b0c
   memset (fs, 0, sizeof (*fs));
6f1b0c
-  context->args_size = 0;
6f1b0c
+  context->args_size &= SIGNAL_FRAME_BIT;
6f1b0c
   context->lsda = 0;
6f1b0c
 
6f1b0c
-  fde = _Unwind_Find_FDE (context->ra + context->signal_frame - 1,
6f1b0c
+  fde = _Unwind_Find_FDE (context->ra + ((context->args_size & SIGNAL_FRAME_BIT) != 0) - 1,
6f1b0c
 			  &context->bases);
6f1b0c
   if (fde == NULL)
6f1b0c
     {
6f1b0c
@@ -1092,7 +1100,7 @@ __frame_state_for (void *pc_target, stru
6f1b0c
   state_in->cfa_offset = fs.cfa_offset;
6f1b0c
   state_in->cfa_reg = fs.cfa_reg;
6f1b0c
   state_in->retaddr_column = fs.retaddr_column;
6f1b0c
-  state_in->args_size = context.args_size;
6f1b0c
+  state_in->args_size = context.args_size & ~SIGNAL_FRAME_BIT;
6f1b0c
   state_in->eh_ptr = fs.eh_ptr;
6f1b0c
 
6f1b0c
 #ifdef __linux__
6f1b0c
@@ -1287,7 +1295,10 @@ uw_update_context_1 (struct _Unwind_Cont
6f1b0c
 	break;
6f1b0c
       }
6f1b0c
 
6f1b0c
-  context->signal_frame = fs->signal_frame;
6f1b0c
+  if (fs->signal_frame)
6f1b0c
+    context->args_size |= SIGNAL_FRAME_BIT;
6f1b0c
+  else
6f1b0c
+    context->args_size &= ~SIGNAL_FRAME_BIT;
6f1b0c
 
6f1b0c
   MD_FROB_UPDATE_CONTEXT (context, fs);
6f1b0c
 }
6f1b0c
@@ -1403,9 +1414,9 @@ uw_install_context_1 (struct _Unwind_Con
6f1b0c
 
6f1b0c
     /* We adjust SP by the difference between CURRENT and TARGET's CFA.  */
6f1b0c
     if (STACK_GROWS_DOWNWARD)
6f1b0c
-      return target_cfa - current->cfa + target->args_size;
6f1b0c
+      return target_cfa - current->cfa + (target->args_size & ~SIGNAL_FRAME_BIT);
6f1b0c
     else
6f1b0c
-      return current->cfa - target_cfa - target->args_size;
6f1b0c
+      return current->cfa - target_cfa - (target->args_size & ~SIGNAL_FRAME_BIT);
6f1b0c
   }
6f1b0c
 #else
6f1b0c
   return 0;
6f1b0c
--- libjava/exception.cc.jj	2006-05-22 13:39:48.000000000 -0400
6f1b0c
+++ libjava/exception.cc	2006-05-22 14:48:30.000000000 -0400
6f1b0c
@@ -31,6 +31,153 @@ namespace std
6f1b0c
 }
6f1b0c
 #include "unwind.h"
6f1b0c
 
6f1b0c
+#if defined PIC && !defined __ia64__
6f1b0c
+
6f1b0c
+#include <dlfcn.h>
6f1b0c
+
6f1b0c
+extern "C" {
6f1b0c
+
6f1b0c
+static void *libgcc_s_handle;
6f1b0c
+
6f1b0c
+_Unwind_Reason_Code __attribute__((visibility ("hidden")))
6f1b0c
+_Unwind_RaiseException (struct _Unwind_Exception *exc)
6f1b0c
+{
6f1b0c
+  static _Unwind_Reason_Code (*RaiseException) (struct _Unwind_Exception *);
6f1b0c
+
6f1b0c
+  if (RaiseException == NULL)
6f1b0c
+    {
6f1b0c
+      if (libgcc_s_handle == NULL)
6f1b0c
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
6f1b0c
+      RaiseException = (__typeof (RaiseException))
6f1b0c
+	dlsym (libgcc_s_handle, "_Unwind_RaiseException");
6f1b0c
+    }
6f1b0c
+  return RaiseException (exc);
6f1b0c
+}
6f1b0c
+
6f1b0c
+void __attribute__((visibility ("hidden")))
6f1b0c
+_Unwind_Resume (struct _Unwind_Exception *exc)
6f1b0c
+{
6f1b0c
+  static void (*Resume) (struct _Unwind_Exception *);
6f1b0c
+
6f1b0c
+  if (Resume == NULL)
6f1b0c
+    {
6f1b0c
+      if (libgcc_s_handle == NULL)
6f1b0c
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
6f1b0c
+      Resume = (__typeof (Resume))
6f1b0c
+	dlsym (libgcc_s_handle, "_Unwind_Resume");
6f1b0c
+    }
6f1b0c
+  Resume (exc);
6f1b0c
+}
6f1b0c
+
6f1b0c
+__attribute__((visibility ("hidden"))) void * 
6f1b0c
+_Unwind_GetLanguageSpecificData (struct _Unwind_Context *ctx)
6f1b0c
+{
6f1b0c
+  static void * (*GetLanguageSpecificData) (struct _Unwind_Context *);
6f1b0c
+
6f1b0c
+  if (GetLanguageSpecificData == NULL)
6f1b0c
+    {
6f1b0c
+      if (libgcc_s_handle == NULL)
6f1b0c
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
6f1b0c
+      GetLanguageSpecificData = (__typeof (GetLanguageSpecificData))
6f1b0c
+	dlsym (libgcc_s_handle, "_Unwind_GetLanguageSpecificData");
6f1b0c
+    }
6f1b0c
+  return GetLanguageSpecificData (ctx);
6f1b0c
+}
6f1b0c
+
6f1b0c
+_Unwind_Ptr __attribute__((visibility ("hidden")))
6f1b0c
+_Unwind_GetRegionStart (struct _Unwind_Context *ctx)
6f1b0c
+{
6f1b0c
+  static _Unwind_Ptr (*GetRegionStart) (struct _Unwind_Context *);
6f1b0c
+
6f1b0c
+  if (GetRegionStart == NULL)
6f1b0c
+    {
6f1b0c
+      if (libgcc_s_handle == NULL)
6f1b0c
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
6f1b0c
+      GetRegionStart = (__typeof (GetRegionStart))
6f1b0c
+	dlsym (libgcc_s_handle, "_Unwind_GetRegionStart");
6f1b0c
+    }
6f1b0c
+  return GetRegionStart (ctx);
6f1b0c
+}
6f1b0c
+
6f1b0c
+_Unwind_Ptr __attribute__((visibility ("hidden")))
6f1b0c
+_Unwind_GetDataRelBase (struct _Unwind_Context *ctx)
6f1b0c
+{
6f1b0c
+  static _Unwind_Ptr (*GetDataRelBase) (struct _Unwind_Context *);
6f1b0c
+
6f1b0c
+  if (GetDataRelBase == NULL)
6f1b0c
+    {
6f1b0c
+      if (libgcc_s_handle == NULL)
6f1b0c
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
6f1b0c
+      GetDataRelBase = (__typeof (GetDataRelBase))
6f1b0c
+	dlsym (libgcc_s_handle, "_Unwind_GetDataRelBase");
6f1b0c
+    }
6f1b0c
+  return GetDataRelBase (ctx);
6f1b0c
+}
6f1b0c
+
6f1b0c
+_Unwind_Ptr __attribute__((visibility ("hidden")))
6f1b0c
+_Unwind_GetTextRelBase (struct _Unwind_Context *ctx)
6f1b0c
+{
6f1b0c
+  static _Unwind_Ptr (*GetTextRelBase) (struct _Unwind_Context *);
6f1b0c
+
6f1b0c
+  if (GetTextRelBase == NULL)
6f1b0c
+    {
6f1b0c
+      if (libgcc_s_handle == NULL)
6f1b0c
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
6f1b0c
+      GetTextRelBase = (__typeof (GetTextRelBase))
6f1b0c
+	dlsym (libgcc_s_handle, "_Unwind_GetTextRelBase");
6f1b0c
+    }
6f1b0c
+  return GetTextRelBase (ctx);
6f1b0c
+}
6f1b0c
+
6f1b0c
+_Unwind_Ptr __attribute__((visibility ("hidden")))
6f1b0c
+_Unwind_GetIPInfo (struct _Unwind_Context *ctx, int *ip)
6f1b0c
+{
6f1b0c
+  static _Unwind_Ptr (*GetIPInfo) (struct _Unwind_Context *, int *ip);
6f1b0c
+
6f1b0c
+  if (GetIPInfo == NULL)
6f1b0c
+    {
6f1b0c
+      if (libgcc_s_handle == NULL)
6f1b0c
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
6f1b0c
+      GetIPInfo = (__typeof (GetIPInfo))
6f1b0c
+	dlsym (libgcc_s_handle, "_Unwind_GetIPInfo");
6f1b0c
+    }
6f1b0c
+  return GetIPInfo (ctx, ip);
6f1b0c
+}
6f1b0c
+
6f1b0c
+void __attribute__((visibility ("hidden")))
6f1b0c
+_Unwind_SetIP (struct _Unwind_Context *ctx, _Unwind_Ptr ip)
6f1b0c
+{
6f1b0c
+  static void (*SetIP) (struct _Unwind_Context *, _Unwind_Ptr ip);
6f1b0c
+
6f1b0c
+  if (SetIP == NULL)
6f1b0c
+    {
6f1b0c
+      if (libgcc_s_handle == NULL)
6f1b0c
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
6f1b0c
+      SetIP = (__typeof (SetIP))
6f1b0c
+	dlsym (libgcc_s_handle, "_Unwind_SetIP");
6f1b0c
+    }
6f1b0c
+  SetIP (ctx, ip);
6f1b0c
+}
6f1b0c
+
6f1b0c
+void __attribute__((visibility ("hidden")))
6f1b0c
+_Unwind_SetGR (struct _Unwind_Context *ctx, int num, _Unwind_Ptr gr)
6f1b0c
+{
6f1b0c
+  static void (*SetGR) (struct _Unwind_Context *, int num, _Unwind_Ptr gr);
6f1b0c
+
6f1b0c
+  if (SetGR == NULL)
6f1b0c
+    {
6f1b0c
+      if (libgcc_s_handle == NULL)
6f1b0c
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
6f1b0c
+      SetGR = (__typeof (SetGR))
6f1b0c
+	dlsym (libgcc_s_handle, "_Unwind_SetGR");
6f1b0c
+    }
6f1b0c
+  SetGR (ctx, num, gr);
6f1b0c
+}
6f1b0c
+
6f1b0c
+}
6f1b0c
+
6f1b0c
+#endif
6f1b0c
+
6f1b0c
 struct alignment_test_struct
6f1b0c
 {
6f1b0c
   char space;