unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 74805@debbugs.gnu.org
Subject: bug#74805: 30.0.92; Trying to build scratch/igc on Cygwin
Date: Thu, 12 Dec 2024 13:12:46 -0500	[thread overview]
Message-ID: <baca5037-fac8-47e9-b582-9b82d17780a7@cornell.edu> (raw)
In-Reply-To: <86pllx1lh8.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1648 bytes --]

On 12/12/2024 1:09 AM, Eli Zaretskii wrote:
>> Date: Wed, 11 Dec 2024 17:50:40 -0500
>> From: Ken Brown <kbrown@cornell.edu>
>>
>> I've made a first attempt to port mps to Cygwin.  If anyone else is
>> interested in seeing this or helping, you can find my work at
>>
>>     https://github.com/kbrow1i/mps-cygwin
>>
>> This is a fork of the mps git repo with two commits on top.
> 
> Thanks, good news!  Could you please post the patches here, so that
> they are recorded in our bug tracker?

Unfortunately, the approach I tried, which was suggested by one of the 
MPS developers, fails badly.  I already mentioned the test failures, but 
now I've tried to run Emacs interactively, and I can't even get a 
directory listing.  For the record, I'm attaching the patches I've 
accumulated so far, but I'll have to try a completely different 
approach.  This will probably take me a while.
> 
>> With the current attempt, I can build the scratch/igc branch, but there
>> are many test failures.  For example, when I run the process-tests, I
>> get 19 failures and 8 skipped tests.  But on the master branch I get no
>> failures and only 3 skipped.
>>
>> This probably means that my current attempt to port mps is no good, and
>> I have to go back to the drawing board.
> 
> Did you run the MPS test suite, and if you did, were there any
> failures?  My suggestion is to make sure the MPS test suite passes
> cleanly, including in several consecutive runs (when I ported MPS to
> 32-bit MinGW, I had intermittent failures which only happened once in
> several runs, until I fixed that).

There are lots of test failures.  Back to the drawing board.

Ken

[-- Attachment #2: 0001-Porting-to-Cygwin-first-attempt.patch --]
[-- Type: text/plain, Size: 11640 bytes --]

From 30976ef9d2407092b44f2f6126dcddef717252ca Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Mon, 9 Dec 2024 13:29:04 -0500
Subject: [PATCH 1/4] Porting to Cygwin, first attempt

Add Cygwin as a recognized platform.  Mostly copy the FreeBSD case.

This builds but fails to work properly because of an mmap problem on
Cygwin: You can't remap without first unmapping.  See

  https://cygwin.com/pipermail/cygwin/2018-February/236044.html

It's probably possible to work around this by replacing mmap and
friends by direct calls to VirtualAlloc and friends.
---
 code/config.h   |  4 ++--
 code/cyi6gc.gmk | 55 ++++++++++++++++++++++++++++++++++++++++++++++
 code/lockix.c   |  5 +++--
 code/mps.c      | 15 +++++++++++++
 code/mpstd.h    | 19 ++++++++++++++++
 code/prmccyi6.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
 code/prmcix.c   |  4 ++--
 code/protix.c   |  5 +++--
 code/protsgix.c |  4 ++--
 code/pthrdext.c |  4 ++--
 code/testthr.h  |  3 ++-
 code/thix.c     |  4 ++--
 code/vmix.c     |  5 +++--
 13 files changed, 168 insertions(+), 17 deletions(-)
 create mode 100644 code/cyi6gc.gmk
 create mode 100644 code/prmccyi6.c

diff --git a/code/config.h b/code/config.h
index 02d335efec6f..5abf6c982596 100644
--- a/code/config.h
+++ b/code/config.h
@@ -543,7 +543,7 @@
  * <https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html>
  */
 
-#if defined(MPS_OS_LI)
+#if defined(MPS_OS_LI) || defined(MPS_OS_CY)
 
 #if defined(_XOPEN_SOURCE) && _XOPEN_SOURCE < 500
 #undef _XOPEN_SOURCE
@@ -616,7 +616,7 @@
 
 /* POSIX thread extensions configuration -- see <code/pthrdext.c> */
 
-#if defined(MPS_OS_LI) || defined(MPS_OS_FR)
+#if defined(MPS_OS_LI) || defined(MPS_OS_FR) || defined(MPS_OS_CY)
 
 /* PTHREADEXT_SIGSUSPEND -- signal used to suspend a thread
  * <design/pthreadext#.impl.signals>
diff --git a/code/cyi6gc.gmk b/code/cyi6gc.gmk
new file mode 100644
index 000000000000..98b863274bac
--- /dev/null
+++ b/code/cyi6gc.gmk
@@ -0,0 +1,55 @@
+# -*- makefile -*-
+#
+# cyi6gc.gmk: BUILD FOR CYGWIN/x64/GCC PLATFORM
+#
+# $Id$
+# Copyright (c) 2001-2020 Ravenbrook Limited.  See end of file for license.
+
+PFM = cyi6gc
+
+MPMPF = \
+    lockix.c \
+    prmcanan.c \
+    prmccyi6.c \
+    prmci6.c \
+    protix.c \
+    protsgix.c \
+    pthrdext.c \
+    span.c \
+    thix.c \
+    vmix.c
+
+LIBS = -lm -lpthread
+
+include gc.gmk
+include comm.gmk
+
+
+# C. COPYRIGHT AND LICENSE
+#
+# Copyright (C) 2001-2020 Ravenbrook Limited <https://www.ravenbrook.com/>.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the
+#    distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/code/lockix.c b/code/lockix.c
index a6555f5bb360..3c4e1939c739 100644
--- a/code/lockix.c
+++ b/code/lockix.c
@@ -31,8 +31,9 @@
 
 #include "mpm.h"
 
-#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC)
-#error "lockix.c is specific to MPS_OS_FR, MPS_OS_LI or MPS_OS_XC"
+#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC) \
+  && !defined(MPS_OS_CY)
+#error "lockix.c is specific to MPS_OS_FR, MPS_OS_LI, MPS_OS_XC, or MPS_OS_CY"
 #endif
 
 #include "lock.h"
diff --git a/code/mps.c b/code/mps.c
index e7872b3c14a0..a2bb7f003f5d 100644
--- a/code/mps.c
+++ b/code/mps.c
@@ -256,6 +256,21 @@
 #include "spw3i6.c"     /* Windows on x86-64 stack probe */
 #include "mpsiw3.c"     /* Windows interface layer extras */
 
+/* Cygwin on x86-64 built with GCC */
+
+#elif defined(MPS_PF_CYI6GC)
+
+#include "lockix.c"     /* Posix locks */
+#include "thix.c"       /* Posix threading */
+#include "pthrdext.c"   /* Posix thread extensions */
+#include "vmix.c"       /* Posix virtual memory */
+#include "protix.c"     /* Posix protection */
+#include "protsgix.c"   /* Posix signal handling */
+#include "prmcanan.c"   /* generic architecture mutator context */
+#include "prmcix.c"     /* Posix mutator context */
+#include "prmccyi6.c"   /* x86-64 for Cygwin mutator context */
+#include "span.c"       /* generic stack probe */
+
 #else
 
 #error "Unknown platform -- can't determine platform specific parts."
diff --git a/code/mpstd.h b/code/mpstd.h
index 7df1c2a12f6d..d2c21d263064 100644
--- a/code/mpstd.h
+++ b/code/mpstd.h
@@ -392,6 +392,25 @@
 #define MPS_PF_ALIGN    8
 
 
+/* GCC 12.4.0, gcc -E -dM */
+
+#elif defined(__CYGWIN__) && defined(__x86_64__) && defined(__GNUC__) \
+      && !defined(__clang__)
+#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_CYI6GC)
+#error "specified CONFIG_PF_... inconsistent with detected cyi6gc"
+#endif
+#define MPS_PF_CYI6GC
+#define MPS_PF_STRING   "cyi6gc"
+#define MPS_OS_CY
+#define MPS_ARCH_I6
+#define MPS_BUILD_GC
+#define MPS_T_WORD      unsigned long
+#define MPS_T_ULONGEST  unsigned long
+#define MPS_WORD_WIDTH  64
+#define MPS_WORD_SHIFT  6
+#define MPS_PF_ALIGN    8
+
+
 #else
 #error "The MPS Kit does not have a configuration for this platform out of the box; see manual/build.txt"
 #endif
diff --git a/code/prmccyi6.c b/code/prmccyi6.c
new file mode 100644
index 000000000000..e5085185b369
--- /dev/null
+++ b/code/prmccyi6.c
@@ -0,0 +1,58 @@
+/* prmccyi6.c: MUTATOR CONTEXT x64 (CYGWIN)
+ *
+ * $Id$
+ * Copyright (c) 2001-2020 Ravenbrook Limited.  See end of file for license.
+ *
+ * .purpose: Implement the mutator context module. <design/prmc>.
+ *
+ *
+ * ASSUMPTIONS
+ *
+ * .sp: The stack pointer in the context is RSP.
+ */
+
+#include "prmcix.h"
+#include "prmci6.h"
+
+SRCID(prmcfri6, "$Id$");
+
+#if !defined(MPS_OS_CY) || !defined(MPS_ARCH_I6)
+#error "prmccyi6.c is specific to MPS_OS_CY and MPS_ARCH_I6"
+#endif
+
+
+Addr MutatorContextSP(MutatorContext context)
+{
+  AVERT(MutatorContext, context);
+  return (Addr)context->ucontext->uc_mcontext.rsp;   /* .sp */
+}
+
+
+/* C. COPYRIGHT AND LICENSE
+ *
+ * Copyright (C) 2001-2020 Ravenbrook Limited <https://www.ravenbrook.com/>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
diff --git a/code/prmcix.c b/code/prmcix.c
index 8529405ae9c7..0af391eb45c7 100644
--- a/code/prmcix.c
+++ b/code/prmcix.c
@@ -14,8 +14,8 @@
 
 #include "mpm.h"
 
-#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI)
-#error "prmcix.c is specific to MPS_OS_FR or MPS_OS_LI"
+#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_CY)
+#error "prmcix.c is specific to MPS_OS_FR, MPS_OS_LI, or MPS_OS_CY"
 #endif
 
 #include "prmcix.h"
diff --git a/code/protix.c b/code/protix.c
index fa6541913b71..18f29430e07d 100644
--- a/code/protix.c
+++ b/code/protix.c
@@ -35,8 +35,9 @@
 
 #include "mpm.h"
 
-#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC)
-#error "protix.c is specific to MPS_OS_FR, MPS_OS_LI or MPS_OS_XC"
+#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC) \
+  && !defined(MPS_OS_CY)
+#error "protix.c is specific to MPS_OS_FR, MPS_OS_LI, MPS_OS_XC, or MPS_OS_CY"
 #endif
 
 #include "vm.h"
diff --git a/code/protsgix.c b/code/protsgix.c
index 966569c92934..9540908300d8 100644
--- a/code/protsgix.c
+++ b/code/protsgix.c
@@ -22,8 +22,8 @@
 
 #include "mpm.h"
 
-#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI)
-#error "protsgix.c is specific to MPS_OS_FR or MPS_OS_LI"
+#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_CY)
+#error "protsgix.c is specific to MPS_OS_FR, MPS_OS_LI, or MPS_OS_CY"
 #endif
 
 #include "prmcix.h"
diff --git a/code/pthrdext.c b/code/pthrdext.c
index 7619468a1872..c143b5cf4db2 100644
--- a/code/pthrdext.c
+++ b/code/pthrdext.c
@@ -16,8 +16,8 @@
 
 #include "mpm.h"
 
-#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI)
-#error "pthrdext.c is specific to MPS_OS_FR or MPS_OS_LI"
+#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_CY)
+#error "pthrdext.c is specific to MPS_OS_FR, MPS_OS_LI, or MPS_OS_CY"
 #endif
 
 #include "pthrdext.h"
diff --git a/code/testthr.h b/code/testthr.h
index a50dad1e5d09..13dcb3fc8924 100644
--- a/code/testthr.h
+++ b/code/testthr.h
@@ -45,7 +45,8 @@ typedef struct testthr_t {
   void *result;               /* result returned from start */
 } testthr_t;
 
-#elif defined(MPS_OS_FR) || defined(MPS_OS_LI) || defined(MPS_OS_XC)
+#elif defined(MPS_OS_FR) || defined(MPS_OS_LI) || defined(MPS_OS_XC) \
+  || defined(MPS_OS_CY)
 
 #include <pthread.h>
 
diff --git a/code/thix.c b/code/thix.c
index c47f82ad3b87..b89a6b4f43ab 100644
--- a/code/thix.c
+++ b/code/thix.c
@@ -34,8 +34,8 @@
 
 #include "mpm.h"
 
-#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI)
-#error "thix.c is specific to MPS_OS_FR or MPS_OS_LI"
+#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_CY)
+#error "thix.c is specific to MPS_OS_FR, MPS_OS_LI, or MPS_OS_CY"
 #endif
 
 #include "prmcix.h"
diff --git a/code/vmix.c b/code/vmix.c
index 4bdd0caefadc..8fce9389e742 100644
--- a/code/vmix.c
+++ b/code/vmix.c
@@ -40,8 +40,9 @@
 
 #include "mpm.h"
 
-#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC)
-#error "vmix.c is specific to MPS_OS_FR, MPS_OS_LI or MPS_OS_XC"
+#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC) \
+  && !defined(MPS_OS_CY)
+#error "vmix.c is specific to MPS_OS_FR, MPS_OS_LI, MPS_OS_XC, or MPS_OS_CY"
 #endif
 
 #include "vm.h"
-- 
2.45.1


[-- Attachment #3: 0002-Porting-to-Cygwin-second-attempt.patch --]
[-- Type: text/plain, Size: 9559 bytes --]

From 0c8c2d6f3168a56474b222c919b051641948b3bf Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Mon, 9 Dec 2024 17:41:47 -0500
Subject: [PATCH 2/4] Porting to Cygwin, second attempt

Use GCC with the Windows interface.  The MPS builds, but I don't know
yet if it works well in Emacs.
---
 code/config.h   |  2 +-
 code/lockix.c   |  5 ++---
 code/mps.c      | 32 ++++++++++++++++++++++----------
 code/mpstd.h    | 22 ++++++++++++++++++++--
 code/prmcix.c   |  4 ++--
 code/protix.c   |  5 ++---
 code/protsgix.c |  4 ++--
 code/pthrdext.c |  4 ++--
 code/spw3i6.c   |  5 +++++
 code/testlib.h  |  2 +-
 code/testthr.h  |  3 +--
 code/th.h       |  6 ++++++
 code/thix.c     |  4 ++--
 code/vmix.c     |  5 ++---
 14 files changed, 70 insertions(+), 33 deletions(-)

diff --git a/code/config.h b/code/config.h
index 5abf6c982596..0201094a0e15 100644
--- a/code/config.h
+++ b/code/config.h
@@ -616,7 +616,7 @@
 
 /* POSIX thread extensions configuration -- see <code/pthrdext.c> */
 
-#if defined(MPS_OS_LI) || defined(MPS_OS_FR) || defined(MPS_OS_CY)
+#if defined(MPS_OS_LI) || defined(MPS_OS_FR)
 
 /* PTHREADEXT_SIGSUSPEND -- signal used to suspend a thread
  * <design/pthreadext#.impl.signals>
diff --git a/code/lockix.c b/code/lockix.c
index 3c4e1939c739..a6555f5bb360 100644
--- a/code/lockix.c
+++ b/code/lockix.c
@@ -31,9 +31,8 @@
 
 #include "mpm.h"
 
-#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC) \
-  && !defined(MPS_OS_CY)
-#error "lockix.c is specific to MPS_OS_FR, MPS_OS_LI, MPS_OS_XC, or MPS_OS_CY"
+#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC)
+#error "lockix.c is specific to MPS_OS_FR, MPS_OS_LI or MPS_OS_XC"
 #endif
 
 #include "lock.h"
diff --git a/code/mps.c b/code/mps.c
index a2bb7f003f5d..2b4f13885001 100644
--- a/code/mps.c
+++ b/code/mps.c
@@ -260,16 +260,28 @@
 
 #elif defined(MPS_PF_CYI6GC)
 
-#include "lockix.c"     /* Posix locks */
-#include "thix.c"       /* Posix threading */
-#include "pthrdext.c"   /* Posix thread extensions */
-#include "vmix.c"       /* Posix virtual memory */
-#include "protix.c"     /* Posix protection */
-#include "protsgix.c"   /* Posix signal handling */
-#include "prmcanan.c"   /* generic architecture mutator context */
-#include "prmcix.c"     /* Posix mutator context */
-#include "prmccyi6.c"   /* x86-64 for Cygwin mutator context */
-#include "span.c"       /* generic stack probe */
+/* #include "lockix.c"     /\* Posix locks *\/ */
+/* #include "thix.c"       /\* Posix threading *\/ */
+/* #include "pthrdext.c"   /\* Posix thread extensions *\/ */
+/* #include "vmix.c"       /\* Posix virtual memory *\/ */
+/* #include "protix.c"     /\* Posix protection *\/ */
+/* #include "protsgix.c"   /\* Posix signal handling *\/ */
+/* #include "prmcanan.c"   /\* generic architecture mutator context *\/ */
+/* #include "prmcix.c"     /\* Posix mutator context *\/ */
+/* #include "prmccyi6.c"   /\* x86-64 for Cygwin mutator context *\/ */
+/* #include "span.c"       /\* generic stack probe *\/ */
+
+/* Use the Windows interface. */
+
+#include "lockw3.c"     /* Windows locks */
+#include "thw3.c"       /* Windows threading */
+#include "vmw3.c"       /* Windows virtual memory */
+#include "protw3.c"     /* Windows protection */
+#include "prmci6.c"     /* x86-64 mutator context */
+#include "prmcw3.c"     /* Windows mutator context */
+#include "prmcw3i6.c"   /* Windows on x86-64 mutator context */
+#include "spw3i6.c"     /* Windows on x86-64 stack probe */
+#include "mpsiw3.c"     /* Windows interface layer extras */
 
 #else
 
diff --git a/code/mpstd.h b/code/mpstd.h
index d2c21d263064..8730282abeb9 100644
--- a/code/mpstd.h
+++ b/code/mpstd.h
@@ -394,6 +394,24 @@
 
 /* GCC 12.4.0, gcc -E -dM */
 
+/* #elif defined(__CYGWIN__) && defined(__x86_64__) && defined(__GNUC__) \ */
+/*       && !defined(__clang__) */
+/* #if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_CYI6GC) */
+/* #error "specified CONFIG_PF_... inconsistent with detected cyi6gc" */
+/* #endif */
+/* #define MPS_PF_CYI6GC */
+/* #define MPS_PF_STRING   "cyi6gc" */
+/* #define MPS_OS_CY */
+/* #define MPS_ARCH_I6 */
+/* #define MPS_BUILD_GC */
+/* #define MPS_T_WORD      unsigned long */
+/* #define MPS_T_ULONGEST  unsigned long */
+/* #define MPS_WORD_WIDTH  64 */
+/* #define MPS_WORD_SHIFT  6 */
+/* #define MPS_PF_ALIGN    8 */
+
+/* Use Cygwin GCC on Windows interface. */
+
 #elif defined(__CYGWIN__) && defined(__x86_64__) && defined(__GNUC__) \
       && !defined(__clang__)
 #if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_CYI6GC)
@@ -402,14 +420,14 @@
 #define MPS_PF_CYI6GC
 #define MPS_PF_STRING   "cyi6gc"
 #define MPS_OS_CY
+#define MPS_OS_W3
 #define MPS_ARCH_I6
 #define MPS_BUILD_GC
 #define MPS_T_WORD      unsigned long
 #define MPS_T_ULONGEST  unsigned long
 #define MPS_WORD_WIDTH  64
 #define MPS_WORD_SHIFT  6
-#define MPS_PF_ALIGN    8
-
+#define MPS_PF_ALIGN    16
 
 #else
 #error "The MPS Kit does not have a configuration for this platform out of the box; see manual/build.txt"
diff --git a/code/prmcix.c b/code/prmcix.c
index 0af391eb45c7..8529405ae9c7 100644
--- a/code/prmcix.c
+++ b/code/prmcix.c
@@ -14,8 +14,8 @@
 
 #include "mpm.h"
 
-#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_CY)
-#error "prmcix.c is specific to MPS_OS_FR, MPS_OS_LI, or MPS_OS_CY"
+#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI)
+#error "prmcix.c is specific to MPS_OS_FR or MPS_OS_LI"
 #endif
 
 #include "prmcix.h"
diff --git a/code/protix.c b/code/protix.c
index 18f29430e07d..fa6541913b71 100644
--- a/code/protix.c
+++ b/code/protix.c
@@ -35,9 +35,8 @@
 
 #include "mpm.h"
 
-#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC) \
-  && !defined(MPS_OS_CY)
-#error "protix.c is specific to MPS_OS_FR, MPS_OS_LI, MPS_OS_XC, or MPS_OS_CY"
+#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC)
+#error "protix.c is specific to MPS_OS_FR, MPS_OS_LI or MPS_OS_XC"
 #endif
 
 #include "vm.h"
diff --git a/code/protsgix.c b/code/protsgix.c
index 9540908300d8..966569c92934 100644
--- a/code/protsgix.c
+++ b/code/protsgix.c
@@ -22,8 +22,8 @@
 
 #include "mpm.h"
 
-#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_CY)
-#error "protsgix.c is specific to MPS_OS_FR, MPS_OS_LI, or MPS_OS_CY"
+#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI)
+#error "protsgix.c is specific to MPS_OS_FR or MPS_OS_LI"
 #endif
 
 #include "prmcix.h"
diff --git a/code/pthrdext.c b/code/pthrdext.c
index c143b5cf4db2..7619468a1872 100644
--- a/code/pthrdext.c
+++ b/code/pthrdext.c
@@ -16,8 +16,8 @@
 
 #include "mpm.h"
 
-#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_CY)
-#error "pthrdext.c is specific to MPS_OS_FR, MPS_OS_LI, or MPS_OS_CY"
+#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI)
+#error "pthrdext.c is specific to MPS_OS_FR or MPS_OS_LI"
 #endif
 
 #include "pthrdext.h"
diff --git a/code/spw3i6.c b/code/spw3i6.c
index d06b4afcab03..ef2e49fb2a38 100644
--- a/code/spw3i6.c
+++ b/code/spw3i6.c
@@ -16,7 +16,12 @@
 #error "spw3i6.c is specific to MPS_OS_W3"
 #endif
 
+#ifndef MPS_OS_CY
 #include <stdlib.h> /* _alloca */
+#else
+#include <alloca.h>
+#define _alloca alloca
+#endif
 
 
 void StackProbe(Size depth)
diff --git a/code/testlib.h b/code/testlib.h
index 9a414f2b5dd0..085681e033ea 100644
--- a/code/testlib.h
+++ b/code/testlib.h
@@ -71,7 +71,7 @@
  * <https://docs.microsoft.com/en-gb/cpp/c-runtime-library/reference/alloca>
  */
 
-#if defined(MPS_OS_W3)
+#if defined(MPS_OS_W3) && !defined(MPS_OS_CY)
 
 #define alloca _alloca
 
diff --git a/code/testthr.h b/code/testthr.h
index 13dcb3fc8924..a50dad1e5d09 100644
--- a/code/testthr.h
+++ b/code/testthr.h
@@ -45,8 +45,7 @@ typedef struct testthr_t {
   void *result;               /* result returned from start */
 } testthr_t;
 
-#elif defined(MPS_OS_FR) || defined(MPS_OS_LI) || defined(MPS_OS_XC) \
-  || defined(MPS_OS_CY)
+#elif defined(MPS_OS_FR) || defined(MPS_OS_LI) || defined(MPS_OS_XC)
 
 #include <pthread.h>
 
diff --git a/code/th.h b/code/th.h
index 08e01d6cc3d3..c939e371bc39 100644
--- a/code/th.h
+++ b/code/th.h
@@ -68,9 +68,15 @@ extern Thread ThreadRingThread(Ring threadRing);
 
 extern Arena ThreadArena(Thread thread);
 
+#ifdef MP_OS_W3
 extern Res ThreadScan(ScanState ss, Thread thread, void *stackCold,
                       mps_area_scan_t scan_area,
                       void *closure);
+#else
+extern Res ThreadScan(ScanState ss, Thread thread, Word *stackCold,
+                      mps_area_scan_t scan_area,
+                      void *closure);
+#endif
 
 extern void ThreadSetup(void);
 
diff --git a/code/thix.c b/code/thix.c
index b89a6b4f43ab..c47f82ad3b87 100644
--- a/code/thix.c
+++ b/code/thix.c
@@ -34,8 +34,8 @@
 
 #include "mpm.h"
 
-#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_CY)
-#error "thix.c is specific to MPS_OS_FR, MPS_OS_LI, or MPS_OS_CY"
+#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI)
+#error "thix.c is specific to MPS_OS_FR or MPS_OS_LI"
 #endif
 
 #include "prmcix.h"
diff --git a/code/vmix.c b/code/vmix.c
index 8fce9389e742..4bdd0caefadc 100644
--- a/code/vmix.c
+++ b/code/vmix.c
@@ -40,9 +40,8 @@
 
 #include "mpm.h"
 
-#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC) \
-  && !defined(MPS_OS_CY)
-#error "vmix.c is specific to MPS_OS_FR, MPS_OS_LI, MPS_OS_XC, or MPS_OS_CY"
+#if !defined(MPS_OS_FR) && !defined(MPS_OS_LI) && !defined(MPS_OS_XC)
+#error "vmix.c is specific to MPS_OS_FR, MPS_OS_LI or MPS_OS_XC"
 #endif
 
 #include "vm.h"
-- 
2.45.1


[-- Attachment #4: 0003-Update-Cygwin-Makefile.patch --]
[-- Type: text/plain, Size: 993 bytes --]

From 14e2acf82387429bc05896c57d5114edea916479 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Wed, 11 Dec 2024 15:51:45 -0500
Subject: [PATCH 3/4] Update Cygwin Makefile

---
 code/cyi6gc.gmk | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/code/cyi6gc.gmk b/code/cyi6gc.gmk
index 98b863274bac..7e707a291dc6 100644
--- a/code/cyi6gc.gmk
+++ b/code/cyi6gc.gmk
@@ -7,17 +7,28 @@
 
 PFM = cyi6gc
 
+# MPMPF = \
+#     lockix.c \
+#     prmcanan.c \
+#     prmccyi6.c \
+#     prmci6.c \
+#     protix.c \
+#     protsgix.c \
+#     pthrdext.c \
+#     span.c \
+#     thix.c \
+#     vmix.c
+
 MPMPF = \
-    lockix.c \
-    prmcanan.c \
-    prmccyi6.c \
+    lockw3.c \
+    thw3.c \
+    vmw3.c \
+    protw3.c \
     prmci6.c \
-    protix.c \
-    protsgix.c \
-    pthrdext.c \
-    span.c \
-    thix.c \
-    vmix.c
+    prmcw3.c \
+    prmcw3i6.c \
+    spw3i6.c \
+    mpsiw3.c
 
 LIBS = -lm -lpthread
 
-- 
2.45.1


[-- Attachment #5: 0004-Pacifying-testsuite-don-t-use-long-long.patch --]
[-- Type: text/plain, Size: 689 bytes --]

From 6c6fae9c920e3db08219a3c8086a49f32056e96c Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Wed, 11 Dec 2024 16:06:02 -0500
Subject: [PATCH 4/4] Pacifying testsuite: don't use long long

---
 code/testlib.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/code/testlib.h b/code/testlib.h
index 085681e033ea..b2983d501490 100644
--- a/code/testlib.h
+++ b/code/testlib.h
@@ -112,7 +112,7 @@
 #error "How many beans make five?"
 #endif
 
-#if defined(MPS_OS_W3) && defined(MPS_ARCH_I6)
+#if defined(MPS_OS_W3) && defined(MPS_ARCH_I6) && !defined(MPS_OS_CY)
 #define PRIuLONGEST "llu"
 #define PRIdLONGEST "lld"
 #define SCNuLONGEST "llu"
-- 
2.45.1


  reply	other threads:[~2024-12-12 18:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11 22:50 bug#74805: 30.0.92; Trying to build scratch/igc on Cygwin Ken Brown
2024-12-11 23:47 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-12 18:14   ` Ken Brown
2024-12-11 23:57 ` Andrea Corallo
2024-12-12  6:09 ` Eli Zaretskii
2024-12-12 18:12   ` Ken Brown [this message]
2024-12-12 19:25     ` Eli Zaretskii
2024-12-12 11:05 ` Stefan Kangas
2024-12-12 11:30   ` Eli Zaretskii
2024-12-12 12:06     ` Gerd Möllmann
2024-12-12 14:38       ` Eli Zaretskii
2024-12-12 15:01         ` Gerd Möllmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=baca5037-fac8-47e9-b582-9b82d17780a7@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=74805@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).