On 7/14/2015 6:03 PM, Eric Blake wrote:
On 07/08/2015 01:39 PM, Warren Young wrote:

- New API sigaltstack, plus definitions for SA_ONSTACK, SS_ONSTACK, SS_DISABLE,
  MINSIGSTKSZ, SIGSTKSZ.

Since these were entirely missing before, this can’t be tested without 
rebuilding software, right?  When rebuilt, existing Cygwin packages may 
discover the new APIs via autoconf or similar.

A search for "sigaltstack” on code.openhub.net found only 95 projects with this 
string in their source code, almost entirely consisting of *receivers* of that call, 
such as NetBSD, glibc, and a bunch of Linux forks.


libsigsegv is a cygwin package (currently 32-bit only) that has
configure checks to use sigaltstack if present; I have not yet tested if
it can be configured to work with the new API, but hope to do so in the
near future.  In fact, if sigaltstack works, it may finally be possible
to port libsigsegv to 64-bit cygwin (the reason the current package is
not ported to 64-bit is that libsigsegv is relying on raw assembly and
Windows native calls to emulate the lack of sigaltstack; but if
sigaltstack works, then we don't need to port the 64-bit counterpart for
the 32-bit specific hacks).

I just did a quick test, and it looks promising. I removed all Cygwin-specific code from configure.ac and Makefile.am (see attached patch), and it then built on 64-bit Cygwin. Here's the result of 'make check':

Entering directory '/home/kbrown/src/cyglibsigsegv/libsigsegv-2.10-1.x86_64/build/tests'
Test passed.
PASS: sigsegv1.exe
Test passed.
PASS: sigsegv2.exe
Doing SIGSEGV pass 1.
Stack overflow 1 caught.
Doing SIGSEGV pass 2.
Stack overflow 2 caught.
Test passed.
PASS: sigsegv3.exe
SKIP: stackoverflow1.exe
SKIP: stackoverflow2.exe
======================
All 3 tests passed
(2 tests were not run)
======================
[...]
Please send the following summary line via email to the main author
Bruno Haible <br...@clisp.org> for inclusion into the list of
successfully tested platforms (see PORTING file).

libsigsegv: x86_64-unknown-cygwin | yes | no | 2.10

I'm not the cygwin packager for libsigsegv,

No one is; it's orphaned.

but am one of the upstream
contributors, and so this thread has piqued my interest.

So it seems that you would be the obvious person to maintain it, if you have the time. If you don't have the time, I'd be willing to ITA it just to get it into the 64-bit distro. But in that case I'd appreciate it if you would review my build after I send the ITA, since you actually know something about libsigsegv, and I don't.

Sadly, I'm a
bit late to the testing because I was on vacation last month, and am now
trying to catch up with several things that happened during my
(much-needed) downtime, such as a new upstream release of coreutils.

Ken
--- origsrc/libsigsegv-2.10/configure.ac        2015-07-14 20:32:45.036228200 
-0400
+++ src/libsigsegv-2.10/configure.ac    2015-07-14 20:42:36.489057300 -0400
@@ -522,19 +522,6 @@ case "$host_os" in
     FAULT_CONTEXT_INCLUDE='#include <windows.h>'
     CFG_FAULT=fault-win32.h # nonexistent, just a dummy
     ;;
-  cygwin*)
-    FAULT_CONTEXT='struct _CONTEXT'
-    # CONTEXT is defined in <windows.h>, but cygwin programs should not
-    # normally inspect the contents of CONTEXT, and the outright inclusion
-    # of <windows.h> pollutes the namespace.
-    FAULT_CONTEXT_INCLUDE='struct _CONTEXT;'
-    # Cygwin 1.7 uses fault-posix.h. Cygwin 1.5.x needs a hacky workaround.
-    if test -z "$CFG_FAULT"; then
-      CFG_FAULT=fault-cygwin-old.h
-      AC_DEFINE([OLD_CYGWIN_WORKAROUND], [1],
-        [Define to 1 on Cygwin versions older than 1.7.])
-    fi
-    ;;
 esac
 if test -n "$CFG_FAULT"; then
   sv_cv_have_sigsegv_recovery=yes
@@ -861,7 +848,7 @@ AC_CACHE_CHECK([if the system supports c
     sv_cv_have_stack_overflow_recovery=yes
   else
     case "$host_os" in
-      mingw* | cygwin*) sv_cv_have_stack_overflow_recovery=yes ;;
+      mingw*) sv_cv_have_stack_overflow_recovery=yes ;;
       *)
         if test "$CFG_LEAVE" != 'leave-none.c'; then
           if test "$sv_cv_sigaltstack" != no; then
@@ -930,7 +917,7 @@ dnl Requires AC_CANONICAL_HOST, CFG_HAND
 dnl HAVE_SIGSEGV_RECOVERY, HAVE_STACK_OVERFLOW_RECOVERY.
 
 case "$host_os" in
-  mingw* | cygwin*) CFG_HANDLER=handler-win32.c ;;
+  mingw*) CFG_HANDLER=handler-win32.c ;;
   *)
     if test -z "$CFG_HANDLER"; then
       if test $sv_cv_have_sigsegv_recovery = no \
@@ -961,7 +948,6 @@ dnl should make the system call fail wit
 dnl the signal handler.
 dnl It is necessary on Cygwin: otherwise the cygwin1 test fails.
 case "$host_os" in
-  cygwin*) enable_EFAULT=yes ;;
   *)       enable_EFAULT=no ;;
 esac
 if test $enable_EFAULT = yes; then
--- origsrc/libsigsegv-2.10/tests/Makefile.am   2010-10-24 13:25:15.000000000 
-0400
+++ src/libsigsegv-2.10/tests/Makefile.am       2015-07-14 21:37:25.864937900 
-0400
@@ -29,11 +29,6 @@ DEFS = @DEFS@
 LDADD = ../src/libsigsegv.la
 noinst_PROGRAMS = sigsegv1 sigsegv2 sigsegv3 stackoverflow1 stackoverflow2
 
-if CYGWIN
-TESTS += cygwin1
-noinst_PROGRAMS += cygwin1
-endif
-
 if ENABLE_EFAULT
 TESTS += efault1 efault2 efault3
 noinst_PROGRAMS += efault1 efault2 efault3
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to