Blame SOURCES/gcc32-pr26208-workaround.patch

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