Blame SOURCES/gcc34-pr26208.patch

6fdc0f
2006-02-27  Jakub Jelinek  <jakub@redhat.com>
6fdc0f
6fdc0f
	PR other/26208
6fdc0f
	* unwind-dw2.c (struct _Unwind_Context): Add signal_frame field.
6fdc0f
	(_Unwind_FrameState): Add signal_frame field.
6fdc0f
	(extract_cie_info): Handle S flag in augmentation string.
6fdc0f
	(execute_cfa_program): If context->signal_frame, execute also
6fdc0f
	fs->pc == context->ra instructions.
6fdc0f
	(uw_frame_state_for): If context->signal_frame, don't subtract one
6fdc0f
	from context->ra to find FDE.
6fdc0f
	(uw_update_context_1): Set context->signal_frame to
6fdc0f
	fs->signal_frame.
6fdc0f
	(_Unwind_GetIPInfo): New function.
6fdc0f
	* unwind-c.c (PERSONALITY_FUNCTION): Use _Unwind_GetIPInfo instead
6fdc0f
	of _Unwind_GetIP.
6fdc0f
	* unwind-sjlj.c (_Unwind_GetIPInfo): New function.
6fdc0f
	* unwind.h (_Unwind_GetIPInfo): New prototype.
6fdc0f
	* unwind-compat.c (_Unwind_GetIPInfo): New function.
6fdc0f
	* libgcc-std.ver (_Unwind_GetIPInfo): Export @@GCC_4.2.0.
6fdc0f
	* config/ia64/unwind-ia64.c (_Unwind_GetIPInfo): New function.
6fdc0f
	* config/i386/linux.h (MD_FALLBACK_FRAME_STATE_FOR): Set
6fdc0f
	(FS)->signal_frame.
6fdc0f
	* config/i386/linux64.h (MD_FALLBACK_FRAME_STATE_FOR): Likewise.
6fdc0f
	* config/rs6000/linux-unwind.h (MD_FALLBACK_FRAME_STATE_FOR): Likewise.
6fdc0f
	* config/s390/linux.h (MD_FALLBACK_FRAME_STATE_FOR): Likewise.
6fdc0f
6fdc0f
	* libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Use
6fdc0f
	_Unwind_GetIPInfo instead of _Unwind_GetIP.
6fdc0f
6fdc0f
	* exception.cc (PERSONALITY_FUNCTION): Use _Unwind_GetIPInfo instead
6fdc0f
	of _Unwind_GetIP.
6fdc0f
	* include/i386-signal.h (MAKE_THROW_FRAME): Change into empty macro.
6fdc0f
	(HANDLE_DIVIDE_OVERFLOW): Don't adjust _res->eip if falling through
6fdc0f
	to throw.
6fdc0f
	* include/x86_64-signal.h (MAKE_THROW_FRAME): Change into empty
6fdc0f
	macro.
6fdc0f
	* include/powerpc-signal.h (MAKE_THROW_FRAME): Change into empty
6fdc0f
	macro.
6fdc0f
6fdc0f
--- libjava/exception.cc.jj	2005-11-21 14:47:25.000000000 +0100
6fdc0f
+++ libjava/exception.cc	2006-04-21 14:00:19.000000000 +0200
6fdc0f
@@ -199,6 +199,7 @@ PERSONALITY_FUNCTION (int version,
6fdc0f
   int handler_switch_value;
6fdc0f
   bool saw_cleanup;
6fdc0f
   bool saw_handler;
6fdc0f
+  int ip_before_insn = 0;
6fdc0f
 
6fdc0f
 
6fdc0f
   // Interface version check.
6fdc0f
@@ -214,10 +215,10 @@ PERSONALITY_FUNCTION (int version,
6fdc0f
       goto install_context;
6fdc0f
     }
6fdc0f
 
6fdc0f
-  // FIXME: In Phase 1, record _Unwind_GetIP in xh->obj as a part of
6fdc0f
+  // FIXME: In Phase 1, record _Unwind_GetIPInfo in xh->obj as a part of
6fdc0f
   // the stack trace for this exception.  This will only collect Java
6fdc0f
   // frames, but perhaps that is acceptable.
6fdc0f
-  // FIXME2: _Unwind_GetIP is nonsensical for SJLJ, being a call-site
6fdc0f
+  // FIXME2: _Unwind_GetIPInfo is nonsensical for SJLJ, being a call-site
6fdc0f
   // index instead of a PC value.  We could perhaps arrange for
6fdc0f
   // _Unwind_GetRegionStart to return context->fc->jbuf[1], which
6fdc0f
   // is the address of the handler label for __builtin_longjmp, but
6fdc0f
@@ -232,7 +233,9 @@ PERSONALITY_FUNCTION (int version,
6fdc0f
 
6fdc0f
   // Parse the LSDA header.
6fdc0f
   p = parse_lsda_header (context, language_specific_data, &info;;
6fdc0f
-  ip = _Unwind_GetIP (context) - 1;
6fdc0f
+  ip = _Unwind_GetIPInfo (context, &ip_before_insn);
6fdc0f
+  if (! ip_before_insn)
6fdc0f
+    --ip;
6fdc0f
   landing_pad = 0;
6fdc0f
   action_record = 0;
6fdc0f
   handler_switch_value = 0;
6fdc0f
--- libjava/include/i386-signal.h.jj	2005-11-21 14:47:15.000000000 +0100
6fdc0f
+++ libjava/include/i386-signal.h	2006-04-21 14:57:55.000000000 +0200
6fdc0f
@@ -22,19 +22,7 @@ details.  */
6fdc0f
 #define SIGNAL_HANDLER(_name)	\
6fdc0f
 static void _name (int _dummy)
6fdc0f
 
6fdc0f
-#define MAKE_THROW_FRAME(_exception)					\
6fdc0f
-do									\
6fdc0f
-{									\
6fdc0f
-  void **_p = (void **)&_dummy;						\
6fdc0f
-  struct sigcontext_struct *_regs = (struct sigcontext_struct *)++_p;	\
6fdc0f
-									\
6fdc0f
-  /* Advance the program counter so that it is after the start of the	\
6fdc0f
-     instruction:  the x86 exception handler expects			\
6fdc0f
-     the PC to point to the instruction after a call. */		\
6fdc0f
-  _regs->eip += 2;							\
6fdc0f
-									\
6fdc0f
-}									\
6fdc0f
-while (0)
6fdc0f
+#define MAKE_THROW_FRAME(_exception)
6fdc0f
 
6fdc0f
 #define HANDLE_DIVIDE_OVERFLOW						\
6fdc0f
 do									\
6fdc0f
@@ -84,14 +72,6 @@ do									\
6fdc0f
 	  _regs->eip = (unsigned long)_eip;				\
6fdc0f
 	  return;							\
6fdc0f
 	}								\
6fdc0f
-      else								\
6fdc0f
-	{								\
6fdc0f
-	  /* Advance the program counter so that it is after the start	\
6fdc0f
-	     of the instruction: this is because the x86 exception	\
6fdc0f
-	     handler expects the PC to point to the instruction after a	\
6fdc0f
-	     call. */							\
6fdc0f
-	  _regs->eip += 2;						\
6fdc0f
-	}								\
6fdc0f
     }									\
6fdc0f
 }									\
6fdc0f
 while (0)
6fdc0f
--- libjava/include/x86_64-signal.h.jj	2006-04-20 17:02:27.000000000 +0200
6fdc0f
+++ libjava/include/x86_64-signal.h	2006-04-21 14:00:19.000000000 +0200
6fdc0f
@@ -34,17 +34,7 @@ extern "C" 
6fdc0f
   };
6fdc0f
 }
6fdc0f
 
6fdc0f
-#define MAKE_THROW_FRAME(_exception)					     \
6fdc0f
-do									     \
6fdc0f
-{									     \
6fdc0f
-  /* Advance the program counter so that it is after the start of the	     \
6fdc0f
-     instruction:  the x86_64 exception handler expects			     \
6fdc0f
-     the PC to point to the instruction after a call. */		     \
6fdc0f
-  struct ucontext *_uc = (struct ucontext *)_p;				     \
6fdc0f
-  volatile struct sigcontext *_sc = (struct sigcontext *) &_uc->uc_mcontext; \
6fdc0f
-  _sc->rip += 2;							     \
6fdc0f
-}									     \
6fdc0f
-while (0)
6fdc0f
+#define MAKE_THROW_FRAME(_exception)
6fdc0f
 
6fdc0f
 #define RESTORE(name, syscall) RESTORE2 (name, syscall)
6fdc0f
 #define RESTORE2(name, syscall)			\
6fdc0f
--- libjava/include/powerpc-signal.h.jj	2005-11-21 14:47:15.000000000 +0100
6fdc0f
+++ libjava/include/powerpc-signal.h	2006-04-21 14:00:19.000000000 +0200
6fdc0f
@@ -22,18 +22,12 @@ details.  */
6fdc0f
 #define SIGNAL_HANDLER(_name)						\
6fdc0f
   static void _name (int /* _signal */, struct sigcontext *_sc)
6fdc0f
 
6fdc0f
-/* PPC either leaves PC pointing at a faulting instruction or the
6fdc0f
-   following instruction, depending on the signal.  SEGV always does
6fdc0f
-   the former, so we adjust the saved PC to point to the following
6fdc0f
-   instruction. This is what the handler in libgcc expects.  */
6fdc0f
+/* MD_FALBACK_FRAME_STATE_FOR takes care of special casing PC
6fdc0f
+   before the faulting instruction, so we don't need to do anything
6fdc0f
+   here.  */
6fdc0f
+
6fdc0f
+#define MAKE_THROW_FRAME(_exception)
6fdc0f
 
6fdc0f
-#define MAKE_THROW_FRAME(_exception)					\
6fdc0f
-do									\
6fdc0f
-  {									\
6fdc0f
-    _sc->regs->nip += 4;						\
6fdc0f
-  }									\
6fdc0f
-while (0)
6fdc0f
-  
6fdc0f
 /* For an explanation why we cannot simply use sigaction to
6fdc0f
    install the handlers, see i386-signal.h.  */
6fdc0f
 
6fdc0f
--- libstdc++-v3/libsupc++/eh_personality.cc.jj	2005-11-21 14:43:32.000000000 +0100
6fdc0f
+++ libstdc++-v3/libsupc++/eh_personality.cc	2006-04-21 14:24:34.000000000 +0200
6fdc0f
@@ -201,6 +201,7 @@ PERSONALITY_FUNCTION (int version,
6fdc0f
   _Unwind_Ptr landing_pad, ip;
6fdc0f
   int handler_switch_value;
6fdc0f
   void *thrown_ptr = xh + 1;
6fdc0f
+  int ip_before_insn = 0;
6fdc0f
 
6fdc0f
   // Interface version check.
6fdc0f
   if (version != 1)
6fdc0f
@@ -227,7 +228,9 @@ PERSONALITY_FUNCTION (int version,
6fdc0f
   // Parse the LSDA header.
6fdc0f
   p = parse_lsda_header (context, language_specific_data, &info;;
6fdc0f
   info.ttype_base = base_of_encoded_value (info.ttype_encoding, context);
6fdc0f
-  ip = _Unwind_GetIP (context) - 1;
6fdc0f
+  ip = _Unwind_GetIPInfo (context, &ip_before_insn);
6fdc0f
+  if (! ip_before_insn)
6fdc0f
+    --ip;
6fdc0f
   landing_pad = 0;
6fdc0f
   action_record = 0;
6fdc0f
   handler_switch_value = 0;
6fdc0f
--- gcc/libgcc-std.ver.jj	2005-11-21 14:43:21.000000000 +0100
6fdc0f
+++ gcc/libgcc-std.ver	2006-04-21 14:02:13.000000000 +0200
6fdc0f
@@ -234,3 +234,8 @@ GCC_3.4.4 {
6fdc0f
   __negvti2
6fdc0f
   __subvti3
6fdc0f
 }
6fdc0f
+
6fdc0f
+%inherit GCC_4.2.0 GCC_3.4.4
6fdc0f
+GCC_4.2.0 {
6fdc0f
+  _Unwind_GetIPInfo
6fdc0f
+}
6fdc0f
--- gcc/unwind-c.c.jj	2005-11-21 14:43:20.000000000 +0100
6fdc0f
+++ gcc/unwind-c.c	2006-04-21 14:00:08.000000000 +0200
6fdc0f
@@ -102,6 +102,7 @@ PERSONALITY_FUNCTION (int version,
6fdc0f
   lsda_header_info info;
6fdc0f
   const unsigned char *language_specific_data, *p, *action_record;
6fdc0f
   _Unwind_Ptr landing_pad, ip;
6fdc0f
+  int ip_before_insn = 0;
6fdc0f
 
6fdc0f
   if (version != 1)
6fdc0f
     return _URC_FATAL_PHASE1_ERROR;
6fdc0f
@@ -119,7 +120,9 @@ PERSONALITY_FUNCTION (int version,
6fdc0f
 
6fdc0f
   /* Parse the LSDA header.  */
6fdc0f
   p = parse_lsda_header (context, language_specific_data, &info;;
6fdc0f
-  ip = _Unwind_GetIP (context) - 1;
6fdc0f
+  ip = _Unwind_GetIPInfo (context, &ip_before_insn);
6fdc0f
+  if (! ip_before_insn)
6fdc0f
+    --ip;
6fdc0f
   landing_pad = 0;
6fdc0f
 
6fdc0f
 #ifdef __USING_SJLJ_EXCEPTIONS__
6fdc0f
--- gcc/config/rs6000/linux-unwind.h.jj	2005-11-21 14:41:11.000000000 +0100
6fdc0f
+++ gcc/config/rs6000/linux-unwind.h	2006-04-21 14:23:09.000000000 +0200
6fdc0f
@@ -247,6 +247,7 @@ enum { SIGNAL_FRAMESIZE = 64 };
6fdc0f
     (FS)->regs.reg[ARG_POINTER_REGNUM].loc.offset 			\
6fdc0f
       = (long) &regs->nip - new_cfa;					\
6fdc0f
     (FS)->retaddr_column = ARG_POINTER_REGNUM;				\
6fdc0f
+    (FS)->signal_frame = 1;						\
6fdc0f
 									\
6fdc0f
     if (hwcap == 0)							\
6fdc0f
       {									\
6fdc0f
--- gcc/config/s390/linux.h.jj	2005-11-21 14:40:55.000000000 +0100
6fdc0f
+++ gcc/config/s390/linux.h	2006-04-21 14:15:46.000000000 +0200
6fdc0f
@@ -113,6 +113,7 @@ Software Foundation, 59 Temple Place - S
6fdc0f
       } __attribute__ ((__aligned__ (8))) sigregs_;			\
6fdc0f
 									\
6fdc0f
     sigregs_ *regs_;							\
6fdc0f
+    int *signo_ = NULL;							\
6fdc0f
 									\
6fdc0f
     /* svc $__NR_sigreturn or svc $__NR_rt_sigreturn  */		\
6fdc0f
     if (pc_[0] != 0x0a || (pc_[1] != 119 && pc_[1] != 173))		\
6fdc0f
@@ -133,6 +134,7 @@ Software Foundation, 59 Temple Place - S
6fdc0f
 	  } *uc_ = (CONTEXT)->cfa + 8 + 128;				\
6fdc0f
 									\
6fdc0f
 	regs_ = &uc_->uc_mcontext;					\
6fdc0f
+	signo_ = (CONTEXT)->cfa + sizeof(long);				\
6fdc0f
       }									\
6fdc0f
 									\
6fdc0f
     /* Old-style RT frame and all non-RT frames:			\
6fdc0f
@@ -141,6 +143,11 @@ Software Foundation, 59 Temple Place - S
6fdc0f
     else								\
6fdc0f
       {									\
6fdc0f
 	regs_ = *(sigregs_ **)((CONTEXT)->cfa + 8);			\
6fdc0f
+	/* Recent kernels store the signal number immediately after	\
6fdc0f
+	   the sigregs; old kernels have the return trampoline at	\
6fdc0f
+	   this location.  */						\
6fdc0f
+	if ((void *)(regs_ + 1) != (CONTEXT)->ra)			\
6fdc0f
+	  signo_ = (int *)(regs_ + 1);					\
6fdc0f
       }									\
6fdc0f
       									\
6fdc0f
     new_cfa_ = regs_->gprs[15] + 16*sizeof(long) + 32;			\
6fdc0f
@@ -167,6 +174,12 @@ Software Foundation, 59 Temple Place - S
6fdc0f
     (FS)->regs.reg[32].loc.offset = (long)&regs_->psw_addr - new_cfa_;	\
6fdc0f
     (FS)->retaddr_column = 32;						\
6fdc0f
 									\
6fdc0f
+    /* SIGILL, SIGFPE and SIGTRAP are delivered with psw_addr		\
6fdc0f
+       after the faulting instruction rather than before it.		\
6fdc0f
+       Don't set FS->signal_frame in that case.  */			\
6fdc0f
+    if (!signo_ || (*signo_ != 4 && *signo_ != 5 && *signo_ != 8))	\
6fdc0f
+      (FS)->signal_frame = 1;						\
6fdc0f
+									\
6fdc0f
     goto SUCCESS;							\
6fdc0f
   } while (0)
6fdc0f
 
6fdc0f
--- gcc/config/i386/linux.h.jj	2005-11-21 14:41:07.000000000 +0100
6fdc0f
+++ gcc/config/i386/linux.h	2006-04-21 14:18:05.000000000 +0200
6fdc0f
@@ -268,6 +268,7 @@ Boston, MA 02111-1307, USA.  */
6fdc0f
     (FS)->regs.reg[8].how = REG_SAVED_OFFSET;				\
6fdc0f
     (FS)->regs.reg[8].loc.offset = (long)&sc_->eip - new_cfa_;		\
6fdc0f
     (FS)->retaddr_column = 8;						\
6fdc0f
+    (FS)->signal_frame = 1;						\
6fdc0f
     goto SUCCESS;							\
6fdc0f
   } while (0)
6fdc0f
 #endif /* not USE_GNULIBC_1 */
6fdc0f
--- gcc/config/i386/linux64.h.jj	2005-11-21 14:41:07.000000000 +0100
6fdc0f
+++ gcc/config/i386/linux64.h	2006-04-21 14:18:45.000000000 +0200
6fdc0f
@@ -136,6 +136,7 @@ Boston, MA 02111-1307, USA.  */
6fdc0f
     (FS)->regs.reg[16].how = REG_SAVED_OFFSET;				\
6fdc0f
     (FS)->regs.reg[16].loc.offset = (long)&sc_->rip - new_cfa_;		\
6fdc0f
     (FS)->retaddr_column = 16;						\
6fdc0f
+    (FS)->signal_frame = 1;						\
6fdc0f
     goto SUCCESS;							\
6fdc0f
   } while (0)
6fdc0f
 #else /* ifdef __x86_64__  */
6fdc0f
@@ -190,6 +191,7 @@ Boston, MA 02111-1307, USA.  */
6fdc0f
     (FS)->regs.reg[8].how = REG_SAVED_OFFSET;				\
6fdc0f
     (FS)->regs.reg[8].loc.offset = (long)&sc_->eip - new_cfa_;		\
6fdc0f
     (FS)->retaddr_column = 8;						\
6fdc0f
+    (FS)->signal_frame = 1;						\
6fdc0f
     goto SUCCESS;							\
6fdc0f
   } while (0)
6fdc0f
 #endif /* ifdef __x86_64__  */
6fdc0f
--- gcc/config/ia64/unwind-ia64.c.jj	2005-11-21 14:40:57.000000000 +0100
6fdc0f
+++ gcc/config/ia64/unwind-ia64.c	2006-04-21 14:00:11.000000000 +0200
6fdc0f
@@ -1748,6 +1748,13 @@ _Unwind_GetIP (struct _Unwind_Context *c
6fdc0f
   return context->rp;
6fdc0f
 }
6fdc0f
 
6fdc0f
+inline _Unwind_Ptr
6fdc0f
+_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
6fdc0f
+{
6fdc0f
+  *ip_before_insn = 0;
6fdc0f
+  return context->rp;
6fdc0f
+}
6fdc0f
+
6fdc0f
 /* Overwrite the return address for CONTEXT with VAL.  */
6fdc0f
 
6fdc0f
 inline void
6fdc0f
--- gcc/unwind-compat.c.jj	2005-11-21 14:43:20.000000000 +0100
6fdc0f
+++ gcc/unwind-compat.c	2006-04-21 13:59:59.000000000 +0200
6fdc0f
@@ -134,6 +134,13 @@ _Unwind_GetIP (struct _Unwind_Context *c
6fdc0f
 }
6fdc0f
 symver (_Unwind_GetIP, GCC_3.0);
6fdc0f
 
6fdc0f
+_Unwind_Ptr
6fdc0f
+_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
6fdc0f
+{
6fdc0f
+  *ip_before_insn = 0;
6fdc0f
+  return __libunwind_Unwind_GetIP (context);
6fdc0f
+}
6fdc0f
+
6fdc0f
 extern void *__libunwind_Unwind_GetLanguageSpecificData
6fdc0f
   (struct _Unwind_Context *);
6fdc0f
 
6fdc0f
--- gcc/unwind-sjlj.c.jj	2005-11-21 14:43:21.000000000 +0100
6fdc0f
+++ gcc/unwind-sjlj.c	2006-04-21 14:00:08.000000000 +0200
6fdc0f
@@ -202,6 +202,13 @@ _Unwind_GetIP (struct _Unwind_Context *c
6fdc0f
   return context->fc->call_site + 1;
6fdc0f
 }
6fdc0f
 
6fdc0f
+_Unwind_Ptr
6fdc0f
+_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
6fdc0f
+{
6fdc0f
+  *ip_before_insn = 0;
6fdc0f
+  return context->fc->call_site + 1;
6fdc0f
+}
6fdc0f
+
6fdc0f
 /* Set the return landing pad index in CONTEXT.  */
6fdc0f
 
6fdc0f
 void
6fdc0f
--- gcc/unwind.h.jj	2005-11-21 14:43:20.000000000 +0100
6fdc0f
+++ gcc/unwind.h	2006-04-21 14:08:51.000000000 +0200
6fdc0f
@@ -151,6 +151,7 @@ extern _Unwind_Word _Unwind_GetGR (struc
6fdc0f
 extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word);
6fdc0f
 
6fdc0f
 extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
6fdc0f
+extern _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
6fdc0f
 extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
6fdc0f
 
6fdc0f
 /* @@@ Retrieve the CFA of the given context.  */
6fdc0f
--- gcc/unwind-dw2.c.jj	2005-11-21 14:43:21.000000000 +0100
6fdc0f
+++ gcc/unwind-dw2.c	2006-04-21 14:05:32.000000000 +0200
6fdc0f
@@ -82,6 +82,7 @@ struct _Unwind_Context
6fdc0f
   void *lsda;
6fdc0f
   struct dwarf_eh_bases bases;
6fdc0f
   _Unwind_Word args_size;
6fdc0f
+  char signal_frame;
6fdc0f
 };
6fdc0f
 
6fdc0f
 /* Byte size of every register managed by these routines.  */
6fdc0f
@@ -137,6 +138,7 @@ typedef struct
6fdc0f
   unsigned char fde_encoding;
6fdc0f
   unsigned char lsda_encoding;
6fdc0f
   unsigned char saw_z;
6fdc0f
+  unsigned char signal_frame;
6fdc0f
   void *eh_ptr;
6fdc0f
 } _Unwind_FrameState;
6fdc0f
 
6fdc0f
@@ -271,6 +273,16 @@ _Unwind_GetIP (struct _Unwind_Context *c
6fdc0f
   return (_Unwind_Ptr) context->ra;
6fdc0f
 }
6fdc0f
 
6fdc0f
+/* Retrieve the return address and flag whether that IP is before
6fdc0f
+   or after first not yet fully executed instruction.  */
6fdc0f
+
6fdc0f
+inline _Unwind_Ptr
6fdc0f
+_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
6fdc0f
+{
6fdc0f
+  *ip_before_insn = context->signal_frame != 0;
6fdc0f
+  return (_Unwind_Ptr) context->ra;
6fdc0f
+}
6fdc0f
+
6fdc0f
 /* Overwrite the return address for CONTEXT with VAL.  */
6fdc0f
 
6fdc0f
 inline void
6fdc0f
@@ -382,6 +394,13 @@ extract_cie_info (const struct dwarf_cie
6fdc0f
 	  aug += 1;
6fdc0f
 	}
6fdc0f
 
6fdc0f
+      /* "S" indicates a signal frame.  */
6fdc0f
+      else if (aug[0] == 'S')
6fdc0f
+	{
6fdc0f
+	  fs->signal_frame = 1;
6fdc0f
+	  aug += 1;
6fdc0f
+	}
6fdc0f
+
6fdc0f
       /* Otherwise we have an unknown augmentation string.
6fdc0f
 	 Bail unless we saw a 'z' prefix.  */
6fdc0f
       else
6fdc0f
@@ -818,8 +837,10 @@ execute_cfa_program (const unsigned char
6fdc0f
      a different stack configuration that we are not interested in.  We
6fdc0f
      assume that the call itself is unwind info-neutral; if not, or if
6fdc0f
      there are delay instructions that adjust the stack, these must be
6fdc0f
-     reflected at the point immediately before the call insn.  */
6fdc0f
-  while (insn_ptr < insn_end && fs->pc < context->ra)
6fdc0f
+     reflected at the point immediately before the call insn.
6fdc0f
+     In signal frames, return address is after last completed instruction,
6fdc0f
+     so we add 1 to return address to make the comparison <=.  */
6fdc0f
+  while (insn_ptr < insn_end && fs->pc < context->ra + context->signal_frame)
6fdc0f
     {
6fdc0f
       unsigned char insn = *insn_ptr++;
6fdc0f
       _Unwind_Word reg, utmp;
6fdc0f
@@ -1021,7 +1042,8 @@ uw_frame_state_for (struct _Unwind_Conte
6fdc0f
   if (context->ra == 0)
6fdc0f
     return _URC_END_OF_STACK;
6fdc0f
 
6fdc0f
-  fde = _Unwind_Find_FDE (context->ra - 1, &context->bases);
6fdc0f
+  fde = _Unwind_Find_FDE (context->ra + context->signal_frame - 1,
6fdc0f
+			  &context->bases);
6fdc0f
   if (fde == NULL)
6fdc0f
     {
6fdc0f
       /* Couldn't find frame unwind info for this function.  Try a
6fdc0f
@@ -1376,6 +1398,8 @@ uw_update_context_1 (struct _Unwind_Cont
6fdc0f
 	break;
6fdc0f
       }
6fdc0f
 
6fdc0f
+  context->signal_frame = fs->signal_frame;
6fdc0f
+
6fdc0f
   MD_FROB_UPDATE_CONTEXT (context, fs);
6fdc0f
 }
6fdc0f