This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC 3.3 Prelease broken on s390
- From: Ulrich Weigand <weigand at immd1 dot informatik dot uni-erlangen dot de>
- To: rth at redhat dot com
- Cc: mark at codesourcery dot com, gcc at gcc dot gnu dot org
- Date: Wed, 7 May 2003 03:13:39 +0200 (MET DST)
- Subject: Re: GCC 3.3 Prelease broken on s390
I wrote:
> Interestingly, mainline works fine without any patch.
When your latest mainline patch to unwind-dw2.c is backported
to 3.3, it works again as well; the patch below does this.
(A full bootstrap/regtest is still running.)
Note that I really only need the first hunk, as the
rest only changes the return value from uw_install_context_1,
which is completely ignored on s390 anyway (as SP is
restored from its stack slot, where the correct new
value was already stored by uw_install_context_1).
What do you think?
Bye,
Ulrich
ChangeLog:
* unwind-dw2.c (uw_update_context_1): Only set cfa as sp if
previous frame didn't save sp. Clear sp for next frame.
(uw_install_context_1): Honor saved sp from frame.
*** unwind-dw2.c.orig Wed May 7 02:52:49 2003
--- unwind-dw2.c Wed May 7 03:00:45 2003
*************** uw_update_context_1 (struct _Unwind_Cont
*** 1059,1069 ****
In very special situations (such as unwind info for signal return),
there may be location expressions that use the stack pointer as well.
! Given that other unwind mechanisms generally won't work if you try
! to represent stack pointer saves and restores directly, we don't
! bother conditionalizing this at all. */
! tmp_sp = (_Unwind_Ptr) context->cfa;
! orig_context.reg[__builtin_dwarf_sp_column ()] = &tmp_sp;
/* Compute this frame's CFA. */
switch (fs->cfa_how)
--- 1059,1075 ----
In very special situations (such as unwind info for signal return),
there may be location expressions that use the stack pointer as well.
! Do this conditionally for one frame. This allows the unwind info
! for one frame to save a copy of the stack pointer from the previous
! frame, and be able to use much easier CFA mechanisms to do it.
! Always zap the saved stack pointer value for the next frame; carrying
! the value over from one frame to another doesn't make sense. */
! if (!orig_context.reg[__builtin_dwarf_sp_column ()])
! {
! tmp_sp = (_Unwind_Ptr) context->cfa;
! orig_context.reg[__builtin_dwarf_sp_column ()] = &tmp_sp;
! }
! context->reg[__builtin_dwarf_sp_column ()] = NULL;
/* Compute this frame's CFA. */
switch (fs->cfa_how)
*************** uw_install_context_1 (struct _Unwind_Con
*** 1201,1206 ****
--- 1207,1213 ----
struct _Unwind_Context *target)
{
long i;
+ void *target_cfa;
#if __GTHREADS
{
*************** uw_install_context_1 (struct _Unwind_Con
*** 1222,1232 ****
memcpy (c, t, dwarf_reg_size_table[i]);
}
/* We adjust SP by the difference between CURRENT and TARGET's CFA. */
if (STACK_GROWS_DOWNWARD)
! return target->cfa - current->cfa + target->args_size;
else
! return current->cfa - target->cfa - target->args_size;
}
static inline _Unwind_Ptr
--- 1229,1246 ----
memcpy (c, t, dwarf_reg_size_table[i]);
}
+ /* If the last frame records a saved stack pointer, use it. */
+ if (target->reg[__builtin_dwarf_sp_column ()])
+ target_cfa = (void *)(_Unwind_Ptr)
+ _Unwind_GetGR (target, __builtin_dwarf_sp_column ());
+ else
+ target_cfa = target->cfa;
+
/* We adjust SP by the difference between CURRENT and TARGET's CFA. */
if (STACK_GROWS_DOWNWARD)
! return target_cfa - current->cfa + target->args_size;
else
! return current->cfa - target_cfa - target->args_size;
}
static inline _Unwind_Ptr
--
Dr. Ulrich Weigand
weigand@informatik.uni-erlangen.de