bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix uses of libwinpthread on mingw 10


From: Bruno Haible
Subject: Fix uses of libwinpthread on mingw 10
Date: Thu, 20 Apr 2023 16:58:53 +0200

On mingw 10.0.0, in a testdir configured without --enable-threads=windows,
most threads related tests fail:

FAIL: test-asyncsafe-spin2
FAIL: test-cond
FAIL: test-execute.sh
FAIL: test-execute-script
FAIL: test-fstrcmp
FAIL: test-immutable.sh
FAIL: test-localename
FAIL: test-rwlock1
FAIL: test-lock
FAIL: test-once1
FAIL: test-once2
FAIL: test-mtx
FAIL: test-pipe-filter-gi1.sh
FAIL: test-pipe-filter-gi2.sh
FAIL: test-pipe-filter-ii1.sh
FAIL: test-pipe-filter-ii2.sh
FAIL: test-pthread-tss
FAIL: test-pthread_sigmask2
FAIL: test-regex-quote
FAIL: test-regex
FAIL: test-simple-atomic
FAIL: test-spawn-pipe.sh
FAIL: test-spawn-pipe-script
FAIL: test-ssfmalloc
FAIL: test-strsignal
FAIL: test-supersede
FAIL: test-term-style-control-hello
FAIL: test-thread_self
FAIL: test-thread_create
FAIL: test-tls

They are caused by use of "weak symbols", which appear to work as long as
we only link, but not run, programs. When run, these programs crash,
typically in a 'call' instruction to an invalid address.

This patch fixes it.


2023-04-20  Bruno Haible  <bruno@clisp.org>

        Fix uses of libwinpthread on mingw 10.
        * m4/threadlib.m4 (gl_WEAK_SYMBOLS): On mingw, set the result to
        "guessing no".

diff --git a/m4/threadlib.m4 b/m4/threadlib.m4
index 7202b9528d..c19d047221 100644
--- a/m4/threadlib.m4
+++ b/m4/threadlib.m4
@@ -1,4 +1,4 @@
-# threadlib.m4 serial 35
+# threadlib.m4 serial 36
 dnl Copyright (C) 2005-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -85,10 +85,11 @@ AC_DEFUN([gl_WEAK_SYMBOLS]
   AC_CACHE_CHECK([whether imported symbols can be declared weak],
     [gl_cv_have_weak],
     [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.
+       cygwin* | mingw*)
+         dnl On Cygwin 3.2.0 with gcc 10.2, and likewise on mingw 10.0.0 with
+         dnl gcc 11.3, the test below would succeed, but programs that use
+         dnl pthread_in_use() with weak symbol references crash miserably at
+         dnl runtime.
          gl_cv_have_weak="guessing no"
          ;;
        *)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]