Blob Blame History Raw
--- gcc/unwind-dw2.c.jj	2006-05-22 13:39:48.000000000 -0400
+++ gcc/unwind-dw2.c	2006-05-22 13:48:20.000000000 -0400
@@ -40,6 +40,7 @@
 #include "unwind-pe.h"
 #include "unwind-dw2-fde.h"
 #include "gthr.h"
+#include <endian.h>
 
 
 #ifndef __USING_SJLJ_EXCEPTIONS__
@@ -81,8 +82,15 @@ struct _Unwind_Context
   void *ra;
   void *lsda;
   struct dwarf_eh_bases bases;
-  _Unwind_Word args_size;
-  char signal_frame;
+#if __BYTE_ORDER == __BIG_ENDIAN
+  _Unwind_Word signal_frame : 1;
+  _Unwind_Word args_size : sizeof (_Unwind_Word) * 8 - 1;
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
+  _Unwind_Word args_size : sizeof (_Unwind_Word) * 8 - 1;
+  _Unwind_Word signal_frame : 1;
+#else
+#error Unknown endianity
+#endif
 };
 
 /* Byte size of every register managed by these routines.  */
@@ -1003,7 +1011,13 @@ execute_cfa_program (const unsigned char
 	  break;
 
 	case DW_CFA_GNU_args_size:
-	  insn_ptr = read_uleb128 (insn_ptr, &context->args_size);
+	  {
+	    _Unwind_Word args_size;
+	    insn_ptr = read_uleb128 (insn_ptr, &args_size);
+	    context->args_size = args_size;
+	    if (context->args_size != args_size)
+	      abort ();
+	  }
 	  break;
 
 	case DW_CFA_GNU_negative_offset_extended:
--- libjava/exception.cc.jj	2006-05-22 13:39:48.000000000 -0400
+++ libjava/exception.cc	2006-05-22 14:48:30.000000000 -0400
@@ -31,6 +31,153 @@ namespace std
 }
 #include "unwind.h"
 
+#if defined PIC && !defined __ia64__
+
+#include <dlfcn.h>
+
+extern "C" {
+
+static void *libgcc_s_handle;
+
+_Unwind_Reason_Code __attribute__((visibility ("hidden")))
+_Unwind_RaiseException (struct _Unwind_Exception *exc)
+{
+  static _Unwind_Reason_Code (*RaiseException) (struct _Unwind_Exception *);
+
+  if (RaiseException == NULL)
+    {
+      if (libgcc_s_handle == NULL)
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
+      RaiseException = (__typeof (RaiseException))
+	dlsym (libgcc_s_handle, "_Unwind_RaiseException");
+    }
+  return RaiseException (exc);
+}
+
+void __attribute__((visibility ("hidden")))
+_Unwind_Resume (struct _Unwind_Exception *exc)
+{
+  static void (*Resume) (struct _Unwind_Exception *);
+
+  if (Resume == NULL)
+    {
+      if (libgcc_s_handle == NULL)
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
+      Resume = (__typeof (Resume))
+	dlsym (libgcc_s_handle, "_Unwind_Resume");
+    }
+  Resume (exc);
+}
+
+__attribute__((visibility ("hidden"))) void * 
+_Unwind_GetLanguageSpecificData (struct _Unwind_Context *ctx)
+{
+  static void * (*GetLanguageSpecificData) (struct _Unwind_Context *);
+
+  if (GetLanguageSpecificData == NULL)
+    {
+      if (libgcc_s_handle == NULL)
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
+      GetLanguageSpecificData = (__typeof (GetLanguageSpecificData))
+	dlsym (libgcc_s_handle, "_Unwind_GetLanguageSpecificData");
+    }
+  return GetLanguageSpecificData (ctx);
+}
+
+_Unwind_Ptr __attribute__((visibility ("hidden")))
+_Unwind_GetRegionStart (struct _Unwind_Context *ctx)
+{
+  static _Unwind_Ptr (*GetRegionStart) (struct _Unwind_Context *);
+
+  if (GetRegionStart == NULL)
+    {
+      if (libgcc_s_handle == NULL)
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
+      GetRegionStart = (__typeof (GetRegionStart))
+	dlsym (libgcc_s_handle, "_Unwind_GetRegionStart");
+    }
+  return GetRegionStart (ctx);
+}
+
+_Unwind_Ptr __attribute__((visibility ("hidden")))
+_Unwind_GetDataRelBase (struct _Unwind_Context *ctx)
+{
+  static _Unwind_Ptr (*GetDataRelBase) (struct _Unwind_Context *);
+
+  if (GetDataRelBase == NULL)
+    {
+      if (libgcc_s_handle == NULL)
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
+      GetDataRelBase = (__typeof (GetDataRelBase))
+	dlsym (libgcc_s_handle, "_Unwind_GetDataRelBase");
+    }
+  return GetDataRelBase (ctx);
+}
+
+_Unwind_Ptr __attribute__((visibility ("hidden")))
+_Unwind_GetTextRelBase (struct _Unwind_Context *ctx)
+{
+  static _Unwind_Ptr (*GetTextRelBase) (struct _Unwind_Context *);
+
+  if (GetTextRelBase == NULL)
+    {
+      if (libgcc_s_handle == NULL)
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
+      GetTextRelBase = (__typeof (GetTextRelBase))
+	dlsym (libgcc_s_handle, "_Unwind_GetTextRelBase");
+    }
+  return GetTextRelBase (ctx);
+}
+
+_Unwind_Ptr __attribute__((visibility ("hidden")))
+_Unwind_GetIPInfo (struct _Unwind_Context *ctx, int *ip)
+{
+  static _Unwind_Ptr (*GetIPInfo) (struct _Unwind_Context *, int *ip);
+
+  if (GetIPInfo == NULL)
+    {
+      if (libgcc_s_handle == NULL)
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
+      GetIPInfo = (__typeof (GetIPInfo))
+	dlsym (libgcc_s_handle, "_Unwind_GetIPInfo");
+    }
+  return GetIPInfo (ctx, ip);
+}
+
+void __attribute__((visibility ("hidden")))
+_Unwind_SetIP (struct _Unwind_Context *ctx, _Unwind_Ptr ip)
+{
+  static void (*SetIP) (struct _Unwind_Context *, _Unwind_Ptr ip);
+
+  if (SetIP == NULL)
+    {
+      if (libgcc_s_handle == NULL)
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
+      SetIP = (__typeof (SetIP))
+	dlsym (libgcc_s_handle, "_Unwind_SetIP");
+    }
+  SetIP (ctx, ip);
+}
+
+void __attribute__((visibility ("hidden")))
+_Unwind_SetGR (struct _Unwind_Context *ctx, int num, _Unwind_Ptr gr)
+{
+  static void (*SetGR) (struct _Unwind_Context *, int num, _Unwind_Ptr gr);
+
+  if (SetGR == NULL)
+    {
+      if (libgcc_s_handle == NULL)
+	libgcc_s_handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
+      SetGR = (__typeof (SetGR))
+	dlsym (libgcc_s_handle, "_Unwind_SetGR");
+    }
+  SetGR (ctx, num, gr);
+}
+
+}
+
+#endif
+
 struct alignment_test_struct
 {
   char space;