Hello,
Attached patch fixes support for building lib/sigsegv.c in PowerPC Mac OS X. Tested on OS X 10.4.11.

Amended definition sources in comment using
https://opensource.apple.com/source/xnu/xnu-792.24.17/bsd/sys/_types.h.auto.html
https://opensource.apple.com/source/xnu/xnu-792.24.17/bsd/ppc/ucontext.h.auto.html
https://opensource.apple.com/source/xnu/xnu-792.24.17/osfmk/mach/ppc/_types.h.auto.html


Sevan Janiyan
From 614bb98f019a37b559ea57168829ec282584b741 Mon Sep 17 00:00:00 2001
From: Sevan Janiyan <ventur...@geeklan.co.uk>
Date: Mon, 29 Nov 2021 00:44:41 +0000
Subject: [PATCH] sigsegv: Unbreak on Mac OS X PowerPC

* lib/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER):
Point to the right struct members on PowerPC, __ prefixes were
introduced in later versions and do not apply to PowerPC support in
OS X 10.4 & 10.5. It is likely further work is required to support
versions older than 10.4. Update comment to reflect locations in
XNU 792.24.17 as shipped with OS X 10.4.11.
---
 lib/sigsegv.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/sigsegv.c b/lib/sigsegv.c
index 347b42644..48210813c 100644
--- a/lib/sigsegv.c
+++ b/lib/sigsegv.c
@@ -592,10 +592,10 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
 # elif defined __powerpc__
 
 /* See the definitions of
-     - 'ucontext_t' and 'struct __darwin_ucontext' in <sys/_structs.h>,
-     - 'struct __darwin_mcontext' in <ppc/_structs.h>, and
-     - 'struct __darwin_ppc_thread_state' in <mach/ppc/_structs.h>.  */
-#  define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) 
ucp)->uc_mcontext->__ss.__r1
+     - 'ucontext_t' and 'struct __darwin_ucontext' in <sys/_types.h>,
+     - 'struct __darwin_mcontext' in <ppc/ucontext.h>, and
+     - 'struct __darwin_ppc_thread_state' in <mach/ppc/_types.h>.  */
+#  define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) ucp)->uc_mcontext->ss.r1
 
 # endif
 
-- 
2.24.3 (Apple Git-128)

Reply via email to