I'm probably the only person building texinfo on Cygwin, but this is just a heads-up that there's a bug in gnulib/m4/threadlib.m4 that can cause mysterious crashes that are very hard to debug. The bug shows up when running 'make check' in the info subdirectory. 13 of the 85 tests fail because ginfo crashes.

The bug has been fixed in upstream gnulib (see attached). I'm not suggesting that anything needs to be done right now; the problem will be taken care of the next time you do a gnulib update.

Ken
From 7818455627c5e54813ac89924b8b67d0bc869146 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 17 Sep 2021 22:22:50 +0200
Subject: [PATCH] threadlib: Avoid crashes in thread-related functions on
 Cygwin 3.2.0.

Reported by Brian Inglis via Akim Demaille in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-09/msg00063.html>.

* m4/threadlib.m4 (gl_WEAK_SYMBOLS): Force a "guessing no" result on
Cygwin.
---
 ChangeLog       |  8 +++++++
 m4/threadlib.m4 | 62 ++++++++++++++++++++++++++++---------------------
 2 files changed, 44 insertions(+), 26 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b96fc9f09..1a766b4fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2021-09-17  Bruno Haible  <[email protected]>
+
+       threadlib: Avoid crashes in thread-related functions on Cygwin 3.2.0.
+       Reported by Brian Inglis via Akim Demaille in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2021-09/msg00063.html>.
+       * m4/threadlib.m4 (gl_WEAK_SYMBOLS): Force a "guessing no" result on
+       Cygwin.
+
 2021-09-13  Bruno Haible  <[email protected]>
 
        simple-atomic: Port to Oracle Studio 12.6.
diff --git a/m4/threadlib.m4 b/m4/threadlib.m4
index 37b797c18..6b43bbdfa 100644
--- a/m4/threadlib.m4
+++ b/m4/threadlib.m4
@@ -1,4 +1,4 @@
-# threadlib.m4 serial 31
+# threadlib.m4 serial 32
 dnl Copyright (C) 2005-2021 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -84,38 +84,48 @@ AC_DEFUN([gl_WEAK_SYMBOLS],
   AC_REQUIRE([AC_CANONICAL_HOST])
   AC_CACHE_CHECK([whether imported symbols can be declared weak],
     [gl_cv_have_weak],
-    [gl_cv_have_weak=no
-     dnl First, test whether the compiler accepts it syntactically.
-     AC_LINK_IFELSE(
-       [AC_LANG_PROGRAM(
-          [[extern void xyzzy ();
+    [case "$host_os" in
+       cygwin*)
+         dnl On Cygwin 3.2.0 with gcc 10.2, the test below would succeed, but
+         dnl programs that use pthread_in_use() with weak symbol references
+         dnl crash miserably at runtime.
+         gl_cv_have_weak="guessing no"
+         ;;
+       *)
+         gl_cv_have_weak=no
+         dnl First, test whether the compiler accepts it syntactically.
+         AC_LINK_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[extern void xyzzy ();
 #pragma weak xyzzy]],
-          [[xyzzy();]])],
-       [gl_cv_have_weak=maybe])
-     if test $gl_cv_have_weak = maybe; then
-       dnl Second, test whether it actually works. On Cygwin 1.7.2, with
-       dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
-       AC_RUN_IFELSE(
-         [AC_LANG_SOURCE([[
+              [[xyzzy();]])],
+           [gl_cv_have_weak=maybe])
+         if test $gl_cv_have_weak = maybe; then
+           dnl Second, test whether it actually works. On Cygwin 1.7.2, with
+           dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
+           AC_RUN_IFELSE(
+             [AC_LANG_SOURCE([[
 #include <stdio.h>
 #pragma weak fputs
 int main ()
 {
   return (fputs == NULL);
 }]])],
-         [gl_cv_have_weak=yes],
-         [gl_cv_have_weak=no],
-         [dnl When cross-compiling, assume that only ELF platforms support
-          dnl weak symbols.
-          AC_EGREP_CPP([Extensible Linking Format],
-            [#ifdef __ELF__
-             Extensible Linking Format
-             #endif
-            ],
-            [gl_cv_have_weak="guessing yes"],
-            [gl_cv_have_weak="guessing no"])
-         ])
-     fi
+             [gl_cv_have_weak=yes],
+             [gl_cv_have_weak=no],
+             [dnl When cross-compiling, assume that only ELF platforms support
+              dnl weak symbols.
+              AC_EGREP_CPP([Extensible Linking Format],
+                [#ifdef __ELF__
+                 Extensible Linking Format
+                 #endif
+                ],
+                [gl_cv_have_weak="guessing yes"],
+                [gl_cv_have_weak="guessing no"])
+             ])
+         fi
+         ;;
+     esac
      dnl But when linking statically, weak symbols don't work.
      case " $LDFLAGS " in
        *" -static "*) gl_cv_have_weak=no ;;
-- 
2.33.0

Reply via email to