File unwind-ia64.patch of Package gcc33
From nobody Fri Jun 18 12:05:46 2004
From: Jakub Jelinek <jakub@redhat.com>
Subject: [PATCH] Fix ia64 _Unwind_Backtrace
To: Jim Wilson <wilson@specifixinc.com>
Cc: gcc-patches@gcc.gnu.org
Date: Tue, 8 Jun 2004 08:19:45 +0200
Hi!
_Unwind_Backtrace on ia64 happily goes through a frame with IP 0 and might
crash later.
.save rp, r0
in _start is used to terminate the chain, so we should stop right there.
Without this patch, GCC assumes there is a leaf function without unwind info
at address 0.
I looked at libunwind and it special cases RP == 0 as well.
Ok for 3.3/3.4/HEAD?
2004-06-08 Jakub Jelinek <jakub@redhat.com>
* config/ia64/unwind-ia64.c (uw_frame_state_for): Don't assume a
leaf function without unwind info at RP 0.
Index: gcc/config/ia64/unwind-ia64.c
===================================================================
--- gcc/config/ia64/unwind-ia64.c.orig 2009-11-20 13:04:57.000000000 +0100
+++ gcc/config/ia64/unwind-ia64.c 2009-11-20 13:06:05.000000000 +0100
@@ -1781,8 +1781,10 @@ uw_frame_state_for (struct _Unwind_Conte
an unwind table entry.
This can only happen in the frame after unwinding through a signal
- handler. Avoid infinite looping by requiring that B0 != RP. */
- if (context->br_loc[0] && *context->br_loc[0] != context->rp)
+ handler. Avoid infinite looping by requiring that B0 != RP.
+ RP == 0 terminates the chain. */
+ if (context->br_loc[0] && *context->br_loc[0] != context->rp
+ && context->rp != 0)
{
fs->curr.reg[UNW_REG_RP].where = UNW_WHERE_BR;
fs->curr.reg[UNW_REG_RP].when = -1;