gcc-5054233.patch   [plain text]


2007-03-09  Geoffrey Keating  <geoffk@apple.com>

	* config/rs6000/darwin-fallback.c: Only build on powerpc
	in 32-bit mode.  
	(handle_syscall): Handle Leopard system call flavour.

Index: gcc/config/rs6000/darwin-fallback.c
===================================================================
--- gcc/config/rs6000/darwin-fallback.c	(revision 122782)
+++ gcc/config/rs6000/darwin-fallback.c	(working copy)
@@ -1,5 +1,5 @@
 /* Fallback frame-state unwinder for Darwin.
-   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -27,6 +27,8 @@
    Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.  */
 
+#ifdef __ppc__
+
 #include "tconfig.h"
 #include "tsystem.h"
 #include "coretypes.h"
@@ -327,9 +329,9 @@
   static _Unwind_Ptr return_addr;
   
   /* Yay!  We're in a Libc that we understand, and it's made a
-     system call.  It'll be one of two kinds: either a Jaguar-style
-     SYS_sigreturn, or a Panther-style 'syscall' call with 184, which 
-     is also SYS_sigreturn.  */
+     system call.  In Jaguar, this is a direct system call with value 103;
+     in Panther and Tiger it is a SYS_syscall call for system call number 184,
+     and in Leopard it is a direct syscall with number 184.  */
   
   if (gprs[0] == 0x67 /* SYS_SIGRETURN */)
     {
@@ -339,7 +341,7 @@
       is_64 = (uctx->mcsize == UC_FLAVOR64_VEC_SIZE
 	       || uctx->mcsize == UC_FLAVOR64_SIZE);
     }
-  else if (gprs[0] == 0 && gprs[3] == 184)
+  else if (gprs[0] == 0 /* SYS_syscall */ && gprs[3] == 184)
     {
       int ctxstyle = gprs[5];
       uctx = (struct gcc_ucontext *) gprs[4];
@@ -348,6 +350,15 @@
       is_64 = (ctxstyle == UC_FLAVOR64_VEC || ctxstyle == UC_TRAD64_VEC
 	       || ctxstyle == UC_FLAVOR64 || ctxstyle == UC_TRAD64);
     }
+  else if (gprs[0] == 184 /* SYS_sigreturn */)
+    {
+      int ctxstyle = gprs[4];
+      uctx = (struct gcc_ucontext *) gprs[3];
+      is_vector = (ctxstyle == UC_FLAVOR_VEC || ctxstyle == UC_FLAVOR64_VEC
+		   || ctxstyle == UC_TRAD_VEC || ctxstyle == UC_TRAD64_VEC);
+      is_64 = (ctxstyle == UC_FLAVOR64_VEC || ctxstyle == UC_TRAD64_VEC
+	       || ctxstyle == UC_FLAVOR64 || ctxstyle == UC_TRAD64);
+    }
   else
     return false;
 
@@ -469,3 +480,4 @@
     return false;
   return handle_syscall (fs, gprs, _Unwind_GetCFA (context));
 }
+#endif