qemu/gcc-unwind-ia64.patch

42 lines
1.4 KiB
Diff

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.
--- gcc/config/ia64/unwind-ia64.c.jj 2004-04-01 18:43:56.000000000 +0200
+++ gcc/config/ia64/unwind-ia64.c 2004-06-08 10:26:50.673203249 +0200
@@ -1783,8 +1783,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;
Jakub