Hi Evan,

Sorry for the long delay.
> Attached is a proposed patch to fix the compilation issue, designed by 
> comparing the 10.4 and 10.5 SDKs. It relies on an implementation detail, but 
> I think it's safe to say that the PowerPC headers are frozen at this point.

Looks good. I've verified that, yes, _STRUCT_MCONTEXT is not defined in the
SDK header files from 10.4.

> I have built it on 10.4.

Thanks. Applied in gnulib and in libsigsegv:


2025-04-28  Bruno Haible  <br...@clisp.org>

        sigsegv: Fix compilation error on Mac OS X 10.4/powerpc.
        Patch by Evan Miller <emmil...@gmail.com> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2021-08/msg00153.html>.
        * lib/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER) [macOS/powerpc: On Mac OS X
        <= 10.4, assume struct field names without underscores.

diff --git a/lib/sigsegv.c b/lib/sigsegv.c
index d0519814eb..6d08999075 100644
--- a/lib/sigsegv.c
+++ b/lib/sigsegv.c
@@ -684,7 +684,12 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
      - '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
+#  if !(defined _STRUCT_MCONTEXT || defined _STRUCT_MCONTEXT32 || defined 
_STRUCT_MCONTEXT64)
+/* Mac OS X 10.4 and earlier omitted the underscores.  */
+#   define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) ucp)->uc_mcontext->ss.r1
+#  else
+#   define SIGSEGV_FAULT_STACKPOINTER  ((ucontext_t *) 
ucp)->uc_mcontext->__ss.__r1
+#  endif
 
 # endif
 




Reply via email to