This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC 3.3 Prelease broken on s390


On Tue, May 06, 2003 at 04:17:01PM -0700, Richard Henderson wrote:
> I dunno, perhaps some new target macro can work around this.

Try this.  It's vs mainline, if that works, we can 
adjust it as necessary for 3.3.



r~



Index: unwind-dw2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-dw2.c,v
retrieving revision 1.29
diff -c -p -d -u -r1.29 unwind-dw2.c
--- unwind-dw2.c	6 May 2003 17:28:37 -0000	1.29
+++ unwind-dw2.c	6 May 2003 23:36:25 -0000
@@ -54,6 +54,11 @@
 #define DWARF_REG_TO_UNWIND_COLUMN(REGNO) (REGNO)
 #endif
 
+/* Work around historic mistakes defining the CFA on some targets.  */
+#ifndef RUNTIME_SP_CFA_OFFSET
+#define RUNTIME_SP_CFA_OFFSET 0
+#endif
+
 /* This is the register and unwind state for a particular frame.  This
    provides the information necessary to unwind up past a frame and return
    to its caller.  */
@@ -1096,7 +1101,7 @@ uw_update_context_1 (struct _Unwind_Cont
      the value over from one frame to another doesn't make sense.  */
   if (!_Unwind_GetGRPtr (&orig_context, __builtin_dwarf_sp_column ()))
     {
-      tmp_sp = (_Unwind_Ptr) context->cfa;
+      tmp_sp = (_Unwind_Ptr) context->cfa + RUNTIME_SP_CFA_OFFSET;
       _Unwind_SetGRPtr (&orig_context, __builtin_dwarf_sp_column (), &tmp_sp);
     }
   _Unwind_SetGRPtr (context, __builtin_dwarf_sp_column (), NULL);
@@ -1267,6 +1272,7 @@ uw_install_context_1 (struct _Unwind_Con
   if (_Unwind_GetGRPtr (target, __builtin_dwarf_sp_column ()))
     target_cfa = (void *)(_Unwind_Ptr)
       _Unwind_GetGR (target, __builtin_dwarf_sp_column ());
+      + RUNTIME_SP_CFA_OFFSET;
   else
     target_cfa = target->cfa;
 
Index: doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.216
diff -c -p -d -u -r1.216 tm.texi
--- doc/tm.texi	28 Apr 2003 20:02:28 -0000	1.216
+++ doc/tm.texi	6 May 2003 23:36:31 -0000
@@ -2979,6 +2979,20 @@ You only need to define this macro if th
 want to support call frame debugging information like that provided by
 DWARF 2.
 
+@findex RUNTIME_SP_CFA_OFFSET
+@item RUNTIME_SP_CFA_OFFSET
+A C expression that expresses a fixed offset from the stack pointer
+to the CFA of a function.
+
+Normally it is assumed that the CFA of one frame will be the stack
+pointer of the outer frame.  This should be considered canonical,
+and all new targets should do this.
+
+In the case of s390, however, the other CFA macros were set up such
+that the stack pointer is at an offset from the CFA.  But this was
+discovered too late to change, lest all new object files not 
+interoperate will old object files.
+
 @findex SMALL_STACK
 @item SMALL_STACK
 Define this macro if the stack size for the target is very small.  This
Index: config/s390/s390.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.h,v
retrieving revision 1.70
diff -c -p -d -u -r1.70 s390.h
--- config/s390/s390.h	29 Apr 2003 14:16:47 -0000	1.70
+++ config/s390/s390.h	6 May 2003 23:36:31 -0000
@@ -546,6 +546,7 @@ extern int current_function_outgoing_arg
 /* Describe calling conventions for DWARF-2 exception handling.  */
 #define INCOMING_RETURN_ADDR_RTX  gen_rtx_REG (Pmode, RETURN_REGNUM)
 #define INCOMING_FRAME_SP_OFFSET STACK_POINTER_OFFSET
+#define RUNTIME_SP_CFA_OFFSET (-STACK_POINTER_OFFSET)
 #define DWARF_FRAME_RETURN_COLUMN  14
 
 /* Describe how we implement __builtin_eh_return.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]