]> git.pld-linux.org Git - packages/crossmingw32-gcc.git/commitdiff
- added pthreads-w32, use POSIX threading model for std::thread/std::mutex support auto/th/crossmingw32-gcc-9.5.0-1
authorJakub Bogusz <qboosh@pld-linux.org>
Sat, 22 Apr 2023 09:40:49 +0000 (11:40 +0200)
committerJakub Bogusz <qboosh@pld-linux.org>
Sat, 22 Apr 2023 09:40:49 +0000 (11:40 +0200)
crossmingw32-gcc.spec
gcc-pthreads-w32.patch [new file with mode: 0644]

index 24c88fd0526a4736bd05c86087862813bbd355cf..6706a4294d54942a7ae9cf3d1f433ad64b4414ae 100644 (file)
@@ -1,9 +1,13 @@
 #
 # Conditional build:
 %bcond_with    bootstrap       # bootstrap build (using binary w32api/mingwrt, only C/C++, no gomp)
+%bcond_without pthreads        # POSIX threads support (needed for GOMP and C++ 11 thread/mutex support)
 %bcond_without gomp            # OpenMP libraries
 #
 %if %{with bootstrap}
+%undefine      with_pthreads
+%endif
+%if %{without pthreads}
 %undefine      with_gomp
 %endif
 Summary:       Cross MinGW32 GNU binary utility development utilities - gcc
@@ -35,12 +39,13 @@ Patch1:             %{name}-buildsystem2.patch
 Patch2:                %{name}-lfs.patch
 Patch3:                gcc-mingw32.patch
 Patch4:                gcc-build-libvtv.patch
+Patch5:                gcc-pthreads-w32.patch
 URL:           http://gcc.gnu.org/
 BuildRequires: autoconf >= 2.64
 BuildRequires: automake >= 1:1.11.1
 BuildRequires: bison
 BuildRequires: crossmingw32-binutils >= 2.23
-%{?with_gomp:BuildRequires:    crossmingw32-pthreads-w32}
+%{?with_pthreads:BuildRequires:        crossmingw32-pthreads-w32}
 %if %{without bootstrap}
 BuildRequires: crossmingw32-runtime >= 3.5
 BuildRequires: crossmingw32-w32api >= 3.1
@@ -477,6 +482,7 @@ Biblioteka DLL GCC do obsÅ‚ugi typu __float128 dla Windows.
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
 
 %if %{with bootstrap}
 # note: "winsup" dirs are special, handled by gcc's configure
@@ -550,7 +556,7 @@ CXXFLAGS_FOR_TARGET="-O2 -march=i486" \
        --enable-shared \
        --disable-sjlj-exceptions \
        --disable-symvers \
-       --enable-threads \
+       --enable-threads%{?with_pthreads:=posix} \
        --disable-werror \
        --disable-win32-registry \
        --target=%{target}
diff --git a/gcc-pthreads-w32.patch b/gcc-pthreads-w32.patch
new file mode 100644 (file)
index 0000000..6589e6f
--- /dev/null
@@ -0,0 +1,49 @@
+--- gcc-9.5.0/libgcc/gthr-posix.h.orig 2022-05-27 09:21:12.915389144 +0200
++++ gcc-9.5.0/libgcc/gthr-posix.h      2023-04-21 21:34:01.235216833 +0200
+@@ -372,7 +372,7 @@ __gthread_objc_thread_detach (void (*fun
+   if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs,
+                                 (void *) func, arg)))
+-    thread_id = (objc_thread_t) new_thread_handle;
++    thread_id = (objc_thread_t) new_thread_handle.p;
+   else
+     thread_id = NULL;
+@@ -469,7 +469,7 @@ static inline objc_thread_t
+ __gthread_objc_thread_id (void)
+ {
+   if (__gthread_active_p ())
+-    return (objc_thread_t) __gthrw_(pthread_self) ();
++    return (objc_thread_t) __gthrw_(pthread_self) ().x;
+   else
+     return (objc_thread_t) 1;
+ }
+--- gcc-9.5.0/libstdc++-v3/include/std/thread.orig     2022-05-27 09:21:13.435391692 +0200
++++ gcc-9.5.0/libstdc++-v3/include/std/thread  2023-04-21 22:05:23.125021761 +0200
+@@ -279,7 +279,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     // can't safely use __gthread_equal on default-constructed values (nor
+     // the non-zero value returned by this_thread::get_id() for
+     // single-threaded programs using GNU libc). Assume EqualityComparable.
+-    return __x._M_thread == __y._M_thread;
++    return __x._M_thread.p == __y._M_thread.p;
+   }
+   inline bool
+@@ -291,7 +291,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+   {
+     // Pthreads doesn't define any way to do this, so we just have to
+     // assume native_handle_type is LessThanComparable.
+-    return __x._M_thread < __y._M_thread;
++    return __x._M_thread.p < __y._M_thread.p;
+   }
+   inline bool
+@@ -314,7 +314,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     {
+       size_t
+       operator()(const thread::id& __id) const noexcept
+-      { return std::_Hash_impl::hash(__id._M_thread); }
++      { return std::_Hash_impl::hash(__id._M_thread.p); }
+     };
+   template<class _CharT, class _Traits>
This page took 0.116131 seconds and 4 git commands to generate.