From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28865 invoked by alias); 7 May 2003 01:13:44 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 28856 invoked from network); 7 May 2003 01:13:43 -0000 Received: from unknown (HELO faui11.informatik.uni-erlangen.de) (131.188.31.2) by sources.redhat.com with SMTP; 7 May 2003 01:13:43 -0000 Received: (from weigand@localhost) by faui11.informatik.uni-erlangen.de (8.9.1/8.1.4-FAU) id DAA15839; Wed, 7 May 2003 03:13:39 +0200 (MET DST) From: Ulrich Weigand Message-Id: <200305070113.DAA15839@faui11.informatik.uni-erlangen.de> Subject: Re: GCC 3.3 Prelease broken on s390 To: rth@redhat.com Date: Wed, 07 May 2003 01:13:00 -0000 Cc: mark@codesourcery.com, gcc@gcc.gnu.org In-Reply-To: from "weigand" at May 07, 2003 02:24:35 AM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2003-05/txt/msg00568.txt.bz2 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