]> Savannah Git Hosting - gnulib.git/commitdiff
sigsegv: Fix compilation error on Mac OS X 10.4/powerpc.
authorBruno Haible <bruno@clisp.org>
Mon, 28 Apr 2025 15:47:37 +0000 (17:47 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 3 May 2025 14:07:58 +0000 (16:07 +0200)
Patch by Evan Miller <emmiller@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.

ChangeLog
lib/sigsegv.c

index e81cd5dd5ba1995822e700dee0da9dceb8c12c9f..2749ca7eed7b2c0f4ab5e1a628fabf210262fd5e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-04-28  Bruno Haible  <bruno@clisp.org>
+
+       sigsegv: Fix compilation error on Mac OS X 10.4/powerpc.
+       Patch by Evan Miller <emmiller@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.
+
 2025-04-25  Collin Funk  <collin.funk1@gmail.com>
 
        pselect: Disable signature check on AIX.
index 45e1618c468c115e61f0eb5e92a4cf39049136fc..4fc9f60803d1cde456251baf24cd10cbde739ee5 100644 (file)
@@ -1,5 +1,5 @@
 /* Page fault handling library.
-   Copyright (C) 1993-2024 Free Software Foundation, Inc.
+   Copyright (C) 1993-2025 Free Software Foundation, Inc.
    Copyright (C) 2018  Nylon Chen <nylon7@andestech.com>
 
    This program is free software: you can redistribute it and/or modify
@@ -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