On 30/11/2021 01:12, Bruno Haible wrote:
I suspect that it merely compiles, but does not actually work on Mac
OS X 10.4.x.

You can find out by running "make check", to see whether the unit
tests pass.


Running "make check" results in 2 test failures without the use of libsigsegv.

./../build-aux/test-driver: line 112: 5311 Illegal instruction "$@" >> "$log_file" 2>&1
FAIL: test-sigsegv-catch-stackoverflow1
./../build-aux/test-driver: line 112: 5318 Illegal instruction "$@" >> "$log_file" 2>&1
FAIL: test-sigsegv-catch-stackoverflow2

With the use of libsigsegv, all 19 tests pass.
The patch is still required in both cases as a build fix.

Tested on 10.4 PowerPC with GCC 4.0.1.

Updated version of the patch attached.

Sevan
From 5ec37e2fca34baba0bf5ed6450f0235953faba21 Mon Sep 17 00:00:00 2001
From: Sevan Janiyan <ventur...@geeklan.co.uk>
Date: Mon, 6 Nov 2023 03:00:27 +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 8263d9b7bd..708ee7789a 100644
--- a/lib/sigsegv.c
+++ b/lib/sigsegv.c
@@ -677,10 +677,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.41.0

Reply via email to