Merge staging-next into staging

This commit is contained in:
github-actions[bot] 2021-01-04 06:25:40 +00:00 committed by GitHub
commit 92f5b04596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 1625 additions and 60 deletions

View File

@ -0,0 +1,306 @@
From 86f2f767ddffd9f7c6f1470b987ae7b0d251b988 Mon Sep 17 00:00:00 2001
From: Liu Hao <lh_mouse@126.com>
Date: Wed, 25 Apr 2018 21:54:19 +0800
Subject: [PATCH] Added 'mcf' thread model support from mcfgthread.
Signed-off-by: Liu Hao <lh_mouse@126.com>
---
config/gthr.m4 | 1 +
gcc/config.gcc | 3 +++
gcc/config/i386/mingw-mcfgthread.h | 1 +
gcc/config/i386/mingw-w64.h | 2 +-
gcc/config/i386/mingw32.h | 11 ++++++++++-
gcc/configure | 2 +-
gcc/configure.ac | 2 +-
libatomic/configure.tgt | 2 +-
libgcc/config.host | 6 ++++++
libgcc/config/i386/gthr-mcf.h | 1 +
libgcc/config/i386/t-mingw-mcfgthread | 2 ++
libgcc/configure | 1 +
libstdc++-v3/configure | 1 +
libstdc++-v3/libsupc++/atexit_thread.cc | 18 ++++++++++++++++++
libstdc++-v3/libsupc++/guard.cc | 23 +++++++++++++++++++++++
libstdc++-v3/src/c++11/thread.cc | 9 +++++++++
16 files changed, 80 insertions(+), 5 deletions(-)
create mode 100644 gcc/config/i386/mingw-mcfgthread.h
create mode 100644 libgcc/config/i386/gthr-mcf.h
create mode 100644 libgcc/config/i386/t-mingw-mcfgthread
diff --git a/config/gthr.m4 b/config/gthr.m4
index 7b29f1f3327..82e21fe1709 100644
--- a/config/gthr.m4
+++ b/config/gthr.m4
@@ -21,6 +21,7 @@ case $1 in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
AC_SUBST(thread_header)
])
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 46a9029acec..112c24e95a3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1758,6 +1758,9 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
if test x$enable_threads = xposix ; then
tm_file="${tm_file} i386/mingw-pthread.h"
fi
+ if test x$enable_threads = xmcf ; then
+ tm_file="${tm_file} i386/mingw-mcfgthread.h"
+ fi
tm_file="${tm_file} i386/mingw32.h"
# This makes the logic if mingw's or the w64 feature set has to be used
case ${target} in
diff --git a/gcc/config/i386/mingw-mcfgthread.h b/gcc/config/i386/mingw-mcfgthread.h
new file mode 100644
index 00000000000..ec381a7798f
--- /dev/null
+++ b/gcc/config/i386/mingw-mcfgthread.h
@@ -0,0 +1 @@
+#define TARGET_USE_MCFGTHREAD 1
diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h
index 484dc7a9e9f..a15bbeea500 100644
--- a/gcc/config/i386/mingw-w64.h
+++ b/gcc/config/i386/mingw-w64.h
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
#undef SPEC_32
#undef SPEC_64
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index 0612b87199a..76cea94f3b7 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -32,6 +32,14 @@ along with GCC; see the file COPYING3. If not see
| MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
| MASK_MS_BITFIELD_LAYOUT)
+#ifndef TARGET_USE_MCFGTHREAD
+#define CPP_MCFGTHREAD() ((void)0)
+#define LIB_MCFGTHREAD ""
+#else
+#define CPP_MCFGTHREAD() (builtin_define("__USING_MCFGTHREAD__"))
+#define LIB_MCFGTHREAD " -lmcfgthread "
+#endif
+
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
@@ -50,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
builtin_define_std ("WIN64"); \
builtin_define ("_WIN64"); \
} \
+ CPP_MCFGTHREAD(); \
} \
while (0)
@@ -93,7 +102,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
/* Weak symbols do not get resolved if using a Windows dll import lib.
Make the unwind registration references strong undefs. */
diff --git a/gcc/configure b/gcc/configure
index 6121e163259..52f0e00efe6 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11693,7 +11693,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b066cc609e1..4ecdba88de7 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1612,7 +1612,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index ea8c34f8c71..23134ad7363 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -145,7 +145,7 @@ case "${target}" in
*-*-mingw*)
# OS support for atomic primitives.
case ${target_thread_file} in
- win32)
+ win32 | mcf)
config_path="${config_path} mingw"
;;
posix)
diff --git a/libgcc/config.host b/libgcc/config.host
index 11b4acaff55..9fbd38650bd 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -737,6 +737,9 @@ i[34567]86-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
@@ -761,6 +764,9 @@ x86_64-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
diff --git a/libgcc/config/i386/gthr-mcf.h b/libgcc/config/i386/gthr-mcf.h
new file mode 100644
index 00000000000..5ea2908361f
--- /dev/null
+++ b/libgcc/config/i386/gthr-mcf.h
@@ -0,0 +1 @@
+#include <mcfgthread/gthread.h>
diff --git a/libgcc/config/i386/t-mingw-mcfgthread b/libgcc/config/i386/t-mingw-mcfgthread
new file mode 100644
index 00000000000..4b9b10e32d6
--- /dev/null
+++ b/libgcc/config/i386/t-mingw-mcfgthread
@@ -0,0 +1,2 @@
+SHLIB_PTHREAD_CFLAG =
+SHLIB_PTHREAD_LDFLAG = -lmcfgthread
diff --git a/libgcc/configure b/libgcc/configure
index b2f3f870844..eff889dc3b3 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5451,6 +5451,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index ba094be6f15..979a5ab9ace 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -15187,6 +15187,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc
index de920d714c6..665fb74bd6b 100644
--- a/libstdc++-v3/libsupc++/atexit_thread.cc
+++ b/libstdc++-v3/libsupc++/atexit_thread.cc
@@ -25,6 +25,22 @@
#include <cstdlib>
#include <new>
#include "bits/gthr.h"
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+extern "C" int
+__cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *),
+ void *obj, void *dso_handle)
+ _GLIBCXX_NOTHROW
+{
+ return ::_MCFCRT_AtThreadExit((void (*)(_MCFCRT_STD intptr_t))dtor, (_MCFCRT_STD intptr_t)obj) ? 0 : -1;
+ (void)dso_handle;
+}
+
+#else // __USING_MCFGTHREAD__
+
#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -167,3 +183,5 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha
}
#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
+
+#endif // __USING_MCFGTHREAD__
diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc
index 3a2ec3ad0d6..8b4cc96199b 100644
--- a/libstdc++-v3/libsupc++/guard.cc
+++ b/libstdc++-v3/libsupc++/guard.cc
@@ -28,6 +28,27 @@
#include <cxxabi.h>
#include <exception>
#include <new>
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+namespace __cxxabiv1 {
+
+extern "C" int __cxa_guard_acquire(__guard *g){
+ return ::_MCFCRT_WaitForOnceFlagForever((::_MCFCRT_OnceFlag *)g) == ::_MCFCRT_kOnceResultInitial;
+}
+extern "C" void __cxa_guard_abort(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsAborted((::_MCFCRT_OnceFlag *)g);
+}
+extern "C" void __cxa_guard_release(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsFinished((::_MCFCRT_OnceFlag *)g);
+}
+
+}
+
+#else // __USING_MCFGTHREAD__
+
#include <ext/atomicity.h>
#include <ext/concurrence.h>
#include <bits/atomic_lockfree_defines.h>
@@ -425,3 +446,5 @@ namespace __cxxabiv1
#endif
}
}
+
+#endif
diff --git a/libstdc++-v3/src/c++11/thread.cc b/libstdc++-v3/src/c++11/thread.cc
index 8238817c2e9..0c6a1f85f6f 100644
--- a/libstdc++-v3/src/c++11/thread.cc
+++ b/libstdc++-v3/src/c++11/thread.cc
@@ -55,6 +55,15 @@ static inline int get_nprocs()
#elif defined(_GLIBCXX_USE_SC_NPROC_ONLN)
# include <unistd.h>
# define _GLIBCXX_NPROCS sysconf(_SC_NPROC_ONLN)
+#elif defined(_WIN32)
+# include <windows.h>
+static inline int get_nprocs()
+{
+ SYSTEM_INFO sysinfo;
+ GetSystemInfo(&sysinfo);
+ return (int)sysinfo.dwNumberOfProcessors;
+}
+# define _GLIBCXX_NPROCS get_nprocs()
#else
# define _GLIBCXX_NPROCS 0
#endif
--
2.17.0

View File

@ -66,10 +66,9 @@ let majorVersion = "10";
++ optional langAda ../gnat-cflags.patch
++ optional langFortran ../gfortran-driving.patch
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch
++ optional (!crossStageStatic && targetPlatform.isMinGW) (fetchpatch {
url = "https://raw.githubusercontent.com/lhmouse/MINGW-packages/${import ../common/mfcgthreads-patches-repo.nix}/mingw-w64-gcc-git/9000-gcc-${majorVersion}-branch-Added-mcf-thread-model-support-from-mcfgthread.patch";
sha256 = "1in5kvcknlpi9z1vvjw6jfmwy8k12zvbqlqfnq84qpm99r0rh00a";
});
# Obtain latest patch with ../update-mcfgthread-patches.sh
++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch;
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";

View File

@ -0,0 +1,285 @@
From 30534f48c6ede142dad0008d1641392d82b8a137 Mon Sep 17 00:00:00 2001
From: Liu Hao <lh_mouse@126.com>
Date: Mon, 18 Apr 2016 11:50:55 +0800
Subject: [PATCH] Added 'mcf' thread model support from mcfgthread.
Signed-off-by: Liu Hao <lh_mouse@126.com>
---
config/gthr.m4 | 1 +
gcc/config.gcc | 3 +++
gcc/config/i386/mingw-mcfgthread.h | 1 +
gcc/config/i386/mingw-w64.h | 2 +-
gcc/config/i386/mingw32.h | 11 ++++++++++-
gcc/configure | 2 +-
gcc/configure.ac | 2 +-
libatomic/configure.tgt | 2 +-
libgcc/config.host | 6 ++++++
libgcc/config/i386/gthr-mcf.h | 1 +
libgcc/config/i386/t-mingw-mcfgthread | 2 ++
libgcc/configure | 1 +
libstdc++-v3/configure | 1 +
libstdc++-v3/libsupc++/atexit_thread.cc | 18 ++++++++++++++++++
libstdc++-v3/libsupc++/guard.cc | 23 +++++++++++++++++++++++
15 files changed, 71 insertions(+), 5 deletions(-)
create mode 100644 gcc/config/i386/mingw-mcfgthread.h
create mode 100644 libgcc/config/i386/gthr-mcf.h
create mode 100644 libgcc/config/i386/t-mingw-mcfgthread
diff --git a/config/gthr.m4 b/config/gthr.m4
index 7b29f1f3327..82e21fe1709 100644
--- a/config/gthr.m4
+++ b/config/gthr.m4
@@ -21,6 +21,7 @@ case $1 in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
AC_SUBST(thread_header)
])
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 858b878d4b3..6f745790d64 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1722,6 +1722,9 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
if test x$enable_threads = xposix ; then
tm_file="${tm_file} i386/mingw-pthread.h"
fi
+ if test x$enable_threads = xmcf ; then
+ tm_file="${tm_file} i386/mingw-mcfgthread.h"
+ fi
tm_file="${tm_file} i386/mingw32.h"
# This makes the logic if mingw's or the w64 feature set has to be used
case ${target} in
diff --git a/gcc/config/i386/mingw-mcfgthread.h b/gcc/config/i386/mingw-mcfgthread.h
new file mode 100644
index 00000000000..ec381a7798f
--- /dev/null
+++ b/gcc/config/i386/mingw-mcfgthread.h
@@ -0,0 +1 @@
+#define TARGET_USE_MCFGTHREAD 1
diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h
index fe11333a2d1..cac85802f38 100644
--- a/gcc/config/i386/mingw-w64.h
+++ b/gcc/config/i386/mingw-w64.h
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
#undef SPEC_32
#undef SPEC_64
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index e04818966fa..7b75a372506 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -32,6 +32,14 @@ along with GCC; see the file COPYING3. If not see
| MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
| MASK_MS_BITFIELD_LAYOUT)
+#ifndef TARGET_USE_MCFGTHREAD
+#define CPP_MCFGTHREAD() ((void)0)
+#define LIB_MCFGTHREAD ""
+#else
+#define CPP_MCFGTHREAD() (builtin_define("__USING_MCFGTHREAD__"))
+#define LIB_MCFGTHREAD " -lmcfgthread "
+#endif
+
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
@@ -50,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
builtin_define_std ("WIN64"); \
builtin_define ("_WIN64"); \
} \
+ CPP_MCFGTHREAD(); \
} \
while (0)
@@ -93,7 +102,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
/* Weak symbols do not get resolved if using a Windows dll import lib.
Make the unwind registration references strong undefs. */
diff --git a/gcc/configure b/gcc/configure
index 954673c1c43..6b5667f1c70 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11702,7 +11702,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 4c65d441e72..e6fa04ada4f 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1593,7 +1593,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index eab2765d7fd..f4058b6f4a2 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -124,7 +124,7 @@ case "${target}" in
*-*-mingw*)
# OS support for atomic primitives.
case ${target_thread_file} in
- win32)
+ win32 | mcf)
config_path="${config_path} mingw"
;;
posix)
diff --git a/libgcc/config.host b/libgcc/config.host
index 2b139b8befc..fb18d2a042e 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -712,6 +712,9 @@ i[34567]86-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
@@ -736,6 +739,9 @@ x86_64-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
diff --git a/libgcc/config/i386/gthr-mcf.h b/libgcc/config/i386/gthr-mcf.h
new file mode 100644
index 00000000000..5ea2908361f
--- /dev/null
+++ b/libgcc/config/i386/gthr-mcf.h
@@ -0,0 +1 @@
+#include <mcfgthread/gthread.h>
diff --git a/libgcc/config/i386/t-mingw-mcfgthread b/libgcc/config/i386/t-mingw-mcfgthread
new file mode 100644
index 00000000000..4b9b10e32d6
--- /dev/null
+++ b/libgcc/config/i386/t-mingw-mcfgthread
@@ -0,0 +1,2 @@
+SHLIB_PTHREAD_CFLAG =
+SHLIB_PTHREAD_LDFLAG = -lmcfgthread
diff --git a/libgcc/configure b/libgcc/configure
index e7d6c75a6f7..664d0f852c4 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5077,6 +5077,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index b5ae4213f94..c484d3aee5f 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -15177,6 +15177,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc
index e6520c1094f..3d6907796dd 100644
--- a/libstdc++-v3/libsupc++/atexit_thread.cc
+++ b/libstdc++-v3/libsupc++/atexit_thread.cc
@@ -25,6 +25,22 @@
#include <cstdlib>
#include <new>
#include "bits/gthr.h"
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+extern "C" int
+__cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *),
+ void *obj, void *dso_handle)
+ _GLIBCXX_NOTHROW
+{
+ return ::_MCFCRT_AtThreadExit((void (*)(_MCFCRT_STD intptr_t))dtor, (_MCFCRT_STD intptr_t)obj) ? 0 : -1;
+ (void)dso_handle;
+}
+
+#else // __USING_MCFGTHREAD__
+
#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -163,3 +179,5 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha
}
#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
+
+#endif // __USING_MCFGTHREAD__
diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc
index 9b617998ffe..a441fdbb616 100644
--- a/libstdc++-v3/libsupc++/guard.cc
+++ b/libstdc++-v3/libsupc++/guard.cc
@@ -28,6 +28,27 @@
#include <cxxabi.h>
#include <exception>
#include <new>
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+namespace __cxxabiv1 {
+
+extern "C" int __cxa_guard_acquire(__guard *g){
+ return ::_MCFCRT_WaitForOnceFlagForever((::_MCFCRT_OnceFlag *)g) == ::_MCFCRT_kOnceResultInitial;
+}
+extern "C" void __cxa_guard_abort(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsAborted((::_MCFCRT_OnceFlag *)g);
+}
+extern "C" void __cxa_guard_release(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsFinished((::_MCFCRT_OnceFlag *)g);
+}
+
+}
+
+#else // __USING_MCFGTHREAD__
+
#include <ext/atomicity.h>
#include <ext/concurrence.h>
#if defined(__GTHREADS) && defined(__GTHREAD_HAS_COND) \
@@ -424,3 +445,5 @@ namespace __cxxabiv1
#endif
}
}
+
+#endif
--
2.12.1

View File

@ -76,10 +76,9 @@ let majorVersion = "6";
++ optional langAda ../gnat-cflags.patch
++ optional langFortran ../gfortran-driving.patch
++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch
++ optional (!crossStageStatic && targetPlatform.isMinGW) (fetchpatch {
url = "https://raw.githubusercontent.com/lhmouse/MINGW-packages/${import ../common/mfcgthreads-patches-repo.nix}/mingw-w64-gcc-git/9000-gcc-${majorVersion}-branch-Added-mcf-thread-model-support-from-mcfgthread.patch";
sha256 = "1c449jgm1vx9g4kv82bxmvlgrwb8f6kwkl0gqmjlmhf7f4hjy2nr";
});
# Obtain latest patch with ../update-mcfgthread-patches.sh
++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch;
javaEcj = fetchurl {
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at

View File

@ -0,0 +1,285 @@
From d3cb66e4751fcbd581b81a14a973de2d78fc02ad Mon Sep 17 00:00:00 2001
From: Liu Hao <lh_mouse@126.com>
Date: Mon, 18 Apr 2016 11:50:55 +0800
Subject: [PATCH] Added 'mcf' thread model support from mcfgthread.
Signed-off-by: Liu Hao <lh_mouse@126.com>
---
config/gthr.m4 | 1 +
gcc/config.gcc | 3 +++
gcc/config/i386/mingw-mcfgthread.h | 1 +
gcc/config/i386/mingw-w64.h | 2 +-
gcc/config/i386/mingw32.h | 11 ++++++++++-
gcc/configure | 2 +-
gcc/configure.ac | 2 +-
libatomic/configure.tgt | 2 +-
libgcc/config.host | 6 ++++++
libgcc/config/i386/gthr-mcf.h | 1 +
libgcc/config/i386/t-mingw-mcfgthread | 2 ++
libgcc/configure | 1 +
libstdc++-v3/configure | 1 +
libstdc++-v3/libsupc++/atexit_thread.cc | 18 ++++++++++++++++++
libstdc++-v3/libsupc++/guard.cc | 23 +++++++++++++++++++++++
15 files changed, 71 insertions(+), 5 deletions(-)
create mode 100644 gcc/config/i386/mingw-mcfgthread.h
create mode 100644 libgcc/config/i386/gthr-mcf.h
create mode 100644 libgcc/config/i386/t-mingw-mcfgthread
diff --git a/config/gthr.m4 b/config/gthr.m4
index 7b29f1f3327..82e21fe1709 100644
--- a/config/gthr.m4
+++ b/config/gthr.m4
@@ -21,6 +21,7 @@ case $1 in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
AC_SUBST(thread_header)
])
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 8f91197f34e..59db37cac04 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1719,6 +1719,9 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
if test x$enable_threads = xposix ; then
tm_file="${tm_file} i386/mingw-pthread.h"
fi
+ if test x$enable_threads = xmcf ; then
+ tm_file="${tm_file} i386/mingw-mcfgthread.h"
+ fi
tm_file="${tm_file} i386/mingw32.h"
# This makes the logic if mingw's or the w64 feature set has to be used
case ${target} in
diff --git a/gcc/config/i386/mingw-mcfgthread.h b/gcc/config/i386/mingw-mcfgthread.h
new file mode 100644
index 00000000000..ec381a7798f
--- /dev/null
+++ b/gcc/config/i386/mingw-mcfgthread.h
@@ -0,0 +1 @@
+#define TARGET_USE_MCFGTHREAD 1
diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h
index 270ec0dd037..88966f79695 100644
--- a/gcc/config/i386/mingw-w64.h
+++ b/gcc/config/i386/mingw-w64.h
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
#undef SPEC_32
#undef SPEC_64
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index e5f014cb473..989cfbe894e 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -32,6 +32,14 @@ along with GCC; see the file COPYING3. If not see
| MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
| MASK_MS_BITFIELD_LAYOUT)
+#ifndef TARGET_USE_MCFGTHREAD
+#define CPP_MCFGTHREAD() ((void)0)
+#define LIB_MCFGTHREAD ""
+#else
+#define CPP_MCFGTHREAD() (builtin_define("__USING_MCFGTHREAD__"))
+#define LIB_MCFGTHREAD " -lmcfgthread "
+#endif
+
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
@@ -50,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
builtin_define_std ("WIN64"); \
builtin_define ("_WIN64"); \
} \
+ CPP_MCFGTHREAD(); \
} \
while (0)
@@ -93,7 +102,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
/* Weak symbols do not get resolved if using a Windows dll import lib.
Make the unwind registration references strong undefs. */
diff --git a/gcc/configure b/gcc/configure
index ea73b151a4e..317200e5620 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11681,7 +11681,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 9d4c792a33f..d51899a5676 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1612,7 +1612,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index b8af3ab2546..73248438a8c 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -125,7 +125,7 @@ case "${target}" in
*-*-mingw*)
# OS support for atomic primitives.
case ${target_thread_file} in
- win32)
+ win32 | mcf)
config_path="${config_path} mingw"
;;
posix)
diff --git a/libgcc/config.host b/libgcc/config.host
index b279a6458f9..20d22f585da 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -710,6 +710,9 @@ i[34567]86-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
@@ -734,6 +737,9 @@ x86_64-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
diff --git a/libgcc/config/i386/gthr-mcf.h b/libgcc/config/i386/gthr-mcf.h
new file mode 100644
index 00000000000..5ea2908361f
--- /dev/null
+++ b/libgcc/config/i386/gthr-mcf.h
@@ -0,0 +1 @@
+#include <mcfgthread/gthread.h>
diff --git a/libgcc/config/i386/t-mingw-mcfgthread b/libgcc/config/i386/t-mingw-mcfgthread
new file mode 100644
index 00000000000..4b9b10e32d6
--- /dev/null
+++ b/libgcc/config/i386/t-mingw-mcfgthread
@@ -0,0 +1,2 @@
+SHLIB_PTHREAD_CFLAG =
+SHLIB_PTHREAD_LDFLAG = -lmcfgthread
diff --git a/libgcc/configure b/libgcc/configure
index 45c459788c3..8fc569ef16e 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5086,6 +5086,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 2406cb9d946..50e7e4ced89 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -15182,6 +15182,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc
index 923a0707556..a55d85aad2d 100644
--- a/libstdc++-v3/libsupc++/atexit_thread.cc
+++ b/libstdc++-v3/libsupc++/atexit_thread.cc
@@ -25,6 +25,22 @@
#include <cstdlib>
#include <new>
#include "bits/gthr.h"
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+extern "C" int
+__cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *),
+ void *obj, void *dso_handle)
+ _GLIBCXX_NOTHROW
+{
+ return ::_MCFCRT_AtThreadExit((void (*)(_MCFCRT_STD intptr_t))dtor, (_MCFCRT_STD intptr_t)obj) ? 0 : -1;
+ (void)dso_handle;
+}
+
+#else // __USING_MCFGTHREAD__
+
#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -167,3 +183,5 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha
}
#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
+
+#endif // __USING_MCFGTHREAD__
diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc
index 19953bc52f0..72fd5f26d5b 100644
--- a/libstdc++-v3/libsupc++/guard.cc
+++ b/libstdc++-v3/libsupc++/guard.cc
@@ -28,6 +28,27 @@
#include <cxxabi.h>
#include <exception>
#include <new>
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+namespace __cxxabiv1 {
+
+extern "C" int __cxa_guard_acquire(__guard *g){
+ return ::_MCFCRT_WaitForOnceFlagForever((::_MCFCRT_OnceFlag *)g) == ::_MCFCRT_kOnceResultInitial;
+}
+extern "C" void __cxa_guard_abort(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsAborted((::_MCFCRT_OnceFlag *)g);
+}
+extern "C" void __cxa_guard_release(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsFinished((::_MCFCRT_OnceFlag *)g);
+}
+
+}
+
+#else // __USING_MCFGTHREAD__
+
#include <ext/atomicity.h>
#include <ext/concurrence.h>
#include <bits/atomic_lockfree_defines.h>
@@ -425,3 +446,5 @@ namespace __cxxabiv1
#endif
}
}
+
+#endif
--
2.12.1

View File

@ -73,10 +73,9 @@ let majorVersion = "7";
++ optional langFortran ../gfortran-driving.patch
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch
++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch
++ optional (!crossStageStatic && targetPlatform.isMinGW) (fetchpatch {
url = "https://raw.githubusercontent.com/lhmouse/MINGW-packages/${import ../common/mfcgthreads-patches-repo.nix}/mingw-w64-gcc-git/9000-gcc-${majorVersion}-branch-Added-mcf-thread-model-support-from-mcfgthread.patch";
sha256 = "1nyjnshpq5gbcbbpfv27hy4ajvycmgkpiabkjlxnnrnq1d99k1ay";
});
# Obtain latest patch with ../update-mcfgthread-patches.sh
++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch;
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";

View File

@ -0,0 +1,306 @@
From 86f2f767ddffd9f7c6f1470b987ae7b0d251b988 Mon Sep 17 00:00:00 2001
From: Liu Hao <lh_mouse@126.com>
Date: Wed, 25 Apr 2018 21:54:19 +0800
Subject: [PATCH] Added 'mcf' thread model support from mcfgthread.
Signed-off-by: Liu Hao <lh_mouse@126.com>
---
config/gthr.m4 | 1 +
gcc/config.gcc | 3 +++
gcc/config/i386/mingw-mcfgthread.h | 1 +
gcc/config/i386/mingw-w64.h | 2 +-
gcc/config/i386/mingw32.h | 11 ++++++++++-
gcc/configure | 2 +-
gcc/configure.ac | 2 +-
libatomic/configure.tgt | 2 +-
libgcc/config.host | 6 ++++++
libgcc/config/i386/gthr-mcf.h | 1 +
libgcc/config/i386/t-mingw-mcfgthread | 2 ++
libgcc/configure | 1 +
libstdc++-v3/configure | 1 +
libstdc++-v3/libsupc++/atexit_thread.cc | 18 ++++++++++++++++++
libstdc++-v3/libsupc++/guard.cc | 23 +++++++++++++++++++++++
libstdc++-v3/src/c++11/thread.cc | 9 +++++++++
16 files changed, 80 insertions(+), 5 deletions(-)
create mode 100644 gcc/config/i386/mingw-mcfgthread.h
create mode 100644 libgcc/config/i386/gthr-mcf.h
create mode 100644 libgcc/config/i386/t-mingw-mcfgthread
diff --git a/config/gthr.m4 b/config/gthr.m4
index 7b29f1f3327..82e21fe1709 100644
--- a/config/gthr.m4
+++ b/config/gthr.m4
@@ -21,6 +21,7 @@ case $1 in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
AC_SUBST(thread_header)
])
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 46a9029acec..112c24e95a3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1758,6 +1758,9 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
if test x$enable_threads = xposix ; then
tm_file="${tm_file} i386/mingw-pthread.h"
fi
+ if test x$enable_threads = xmcf ; then
+ tm_file="${tm_file} i386/mingw-mcfgthread.h"
+ fi
tm_file="${tm_file} i386/mingw32.h"
# This makes the logic if mingw's or the w64 feature set has to be used
case ${target} in
diff --git a/gcc/config/i386/mingw-mcfgthread.h b/gcc/config/i386/mingw-mcfgthread.h
new file mode 100644
index 00000000000..ec381a7798f
--- /dev/null
+++ b/gcc/config/i386/mingw-mcfgthread.h
@@ -0,0 +1 @@
+#define TARGET_USE_MCFGTHREAD 1
diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h
index 484dc7a9e9f..a15bbeea500 100644
--- a/gcc/config/i386/mingw-w64.h
+++ b/gcc/config/i386/mingw-w64.h
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
#undef SPEC_32
#undef SPEC_64
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index 0612b87199a..76cea94f3b7 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -32,6 +32,14 @@ along with GCC; see the file COPYING3. If not see
| MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
| MASK_MS_BITFIELD_LAYOUT)
+#ifndef TARGET_USE_MCFGTHREAD
+#define CPP_MCFGTHREAD() ((void)0)
+#define LIB_MCFGTHREAD ""
+#else
+#define CPP_MCFGTHREAD() (builtin_define("__USING_MCFGTHREAD__"))
+#define LIB_MCFGTHREAD " -lmcfgthread "
+#endif
+
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
@@ -50,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
builtin_define_std ("WIN64"); \
builtin_define ("_WIN64"); \
} \
+ CPP_MCFGTHREAD(); \
} \
while (0)
@@ -93,7 +102,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
/* Weak symbols do not get resolved if using a Windows dll import lib.
Make the unwind registration references strong undefs. */
diff --git a/gcc/configure b/gcc/configure
index 6121e163259..52f0e00efe6 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11693,7 +11693,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b066cc609e1..4ecdba88de7 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1612,7 +1612,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index ea8c34f8c71..23134ad7363 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -145,7 +145,7 @@ case "${target}" in
*-*-mingw*)
# OS support for atomic primitives.
case ${target_thread_file} in
- win32)
+ win32 | mcf)
config_path="${config_path} mingw"
;;
posix)
diff --git a/libgcc/config.host b/libgcc/config.host
index 11b4acaff55..9fbd38650bd 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -737,6 +737,9 @@ i[34567]86-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
@@ -761,6 +764,9 @@ x86_64-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
diff --git a/libgcc/config/i386/gthr-mcf.h b/libgcc/config/i386/gthr-mcf.h
new file mode 100644
index 00000000000..5ea2908361f
--- /dev/null
+++ b/libgcc/config/i386/gthr-mcf.h
@@ -0,0 +1 @@
+#include <mcfgthread/gthread.h>
diff --git a/libgcc/config/i386/t-mingw-mcfgthread b/libgcc/config/i386/t-mingw-mcfgthread
new file mode 100644
index 00000000000..4b9b10e32d6
--- /dev/null
+++ b/libgcc/config/i386/t-mingw-mcfgthread
@@ -0,0 +1,2 @@
+SHLIB_PTHREAD_CFLAG =
+SHLIB_PTHREAD_LDFLAG = -lmcfgthread
diff --git a/libgcc/configure b/libgcc/configure
index b2f3f870844..eff889dc3b3 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5451,6 +5451,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index ba094be6f15..979a5ab9ace 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -15187,6 +15187,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc
index de920d714c6..665fb74bd6b 100644
--- a/libstdc++-v3/libsupc++/atexit_thread.cc
+++ b/libstdc++-v3/libsupc++/atexit_thread.cc
@@ -25,6 +25,22 @@
#include <cstdlib>
#include <new>
#include "bits/gthr.h"
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+extern "C" int
+__cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *),
+ void *obj, void *dso_handle)
+ _GLIBCXX_NOTHROW
+{
+ return ::_MCFCRT_AtThreadExit((void (*)(_MCFCRT_STD intptr_t))dtor, (_MCFCRT_STD intptr_t)obj) ? 0 : -1;
+ (void)dso_handle;
+}
+
+#else // __USING_MCFGTHREAD__
+
#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -167,3 +183,5 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha
}
#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
+
+#endif // __USING_MCFGTHREAD__
diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc
index 3a2ec3ad0d6..8b4cc96199b 100644
--- a/libstdc++-v3/libsupc++/guard.cc
+++ b/libstdc++-v3/libsupc++/guard.cc
@@ -28,6 +28,27 @@
#include <cxxabi.h>
#include <exception>
#include <new>
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+namespace __cxxabiv1 {
+
+extern "C" int __cxa_guard_acquire(__guard *g){
+ return ::_MCFCRT_WaitForOnceFlagForever((::_MCFCRT_OnceFlag *)g) == ::_MCFCRT_kOnceResultInitial;
+}
+extern "C" void __cxa_guard_abort(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsAborted((::_MCFCRT_OnceFlag *)g);
+}
+extern "C" void __cxa_guard_release(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsFinished((::_MCFCRT_OnceFlag *)g);
+}
+
+}
+
+#else // __USING_MCFGTHREAD__
+
#include <ext/atomicity.h>
#include <ext/concurrence.h>
#include <bits/atomic_lockfree_defines.h>
@@ -425,3 +446,5 @@ namespace __cxxabiv1
#endif
}
}
+
+#endif
diff --git a/libstdc++-v3/src/c++11/thread.cc b/libstdc++-v3/src/c++11/thread.cc
index 8238817c2e9..0c6a1f85f6f 100644
--- a/libstdc++-v3/src/c++11/thread.cc
+++ b/libstdc++-v3/src/c++11/thread.cc
@@ -55,6 +55,15 @@ static inline int get_nprocs()
#elif defined(_GLIBCXX_USE_SC_NPROC_ONLN)
# include <unistd.h>
# define _GLIBCXX_NPROCS sysconf(_SC_NPROC_ONLN)
+#elif defined(_WIN32)
+# include <windows.h>
+static inline int get_nprocs()
+{
+ SYSTEM_INFO sysinfo;
+ GetSystemInfo(&sysinfo);
+ return (int)sysinfo.dwNumberOfProcessors;
+}
+# define _GLIBCXX_NPROCS get_nprocs()
#else
# define _GLIBCXX_NPROCS 0
#endif
--
2.17.0

View File

@ -63,10 +63,9 @@ let majorVersion = "8";
++ optional langFortran ../gfortran-driving.patch
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch
++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch
++ optional (!crossStageStatic && targetPlatform.isMinGW) (fetchpatch {
url = "https://raw.githubusercontent.com/lhmouse/MINGW-packages/${import ../common/mfcgthreads-patches-repo.nix}/mingw-w64-gcc-git/9000-gcc-${majorVersion}-branch-Added-mcf-thread-model-support-from-mcfgthread.patch";
sha256 = "1in5kvcknlpi9z1vvjw6jfmwy8k12zvbqlqfnq84qpm99r0rh00a";
});
# Obtain latest patch with ../update-mcfgthread-patches.sh
++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch;
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";

View File

@ -0,0 +1,306 @@
From 86f2f767ddffd9f7c6f1470b987ae7b0d251b988 Mon Sep 17 00:00:00 2001
From: Liu Hao <lh_mouse@126.com>
Date: Wed, 25 Apr 2018 21:54:19 +0800
Subject: [PATCH] Added 'mcf' thread model support from mcfgthread.
Signed-off-by: Liu Hao <lh_mouse@126.com>
---
config/gthr.m4 | 1 +
gcc/config.gcc | 3 +++
gcc/config/i386/mingw-mcfgthread.h | 1 +
gcc/config/i386/mingw-w64.h | 2 +-
gcc/config/i386/mingw32.h | 11 ++++++++++-
gcc/configure | 2 +-
gcc/configure.ac | 2 +-
libatomic/configure.tgt | 2 +-
libgcc/config.host | 6 ++++++
libgcc/config/i386/gthr-mcf.h | 1 +
libgcc/config/i386/t-mingw-mcfgthread | 2 ++
libgcc/configure | 1 +
libstdc++-v3/configure | 1 +
libstdc++-v3/libsupc++/atexit_thread.cc | 18 ++++++++++++++++++
libstdc++-v3/libsupc++/guard.cc | 23 +++++++++++++++++++++++
libstdc++-v3/src/c++11/thread.cc | 9 +++++++++
16 files changed, 80 insertions(+), 5 deletions(-)
create mode 100644 gcc/config/i386/mingw-mcfgthread.h
create mode 100644 libgcc/config/i386/gthr-mcf.h
create mode 100644 libgcc/config/i386/t-mingw-mcfgthread
diff --git a/config/gthr.m4 b/config/gthr.m4
index 7b29f1f3327..82e21fe1709 100644
--- a/config/gthr.m4
+++ b/config/gthr.m4
@@ -21,6 +21,7 @@ case $1 in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
AC_SUBST(thread_header)
])
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 46a9029acec..112c24e95a3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1758,6 +1758,9 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
if test x$enable_threads = xposix ; then
tm_file="${tm_file} i386/mingw-pthread.h"
fi
+ if test x$enable_threads = xmcf ; then
+ tm_file="${tm_file} i386/mingw-mcfgthread.h"
+ fi
tm_file="${tm_file} i386/mingw32.h"
# This makes the logic if mingw's or the w64 feature set has to be used
case ${target} in
diff --git a/gcc/config/i386/mingw-mcfgthread.h b/gcc/config/i386/mingw-mcfgthread.h
new file mode 100644
index 00000000000..ec381a7798f
--- /dev/null
+++ b/gcc/config/i386/mingw-mcfgthread.h
@@ -0,0 +1 @@
+#define TARGET_USE_MCFGTHREAD 1
diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h
index 484dc7a9e9f..a15bbeea500 100644
--- a/gcc/config/i386/mingw-w64.h
+++ b/gcc/config/i386/mingw-w64.h
@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
#undef SPEC_32
#undef SPEC_64
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index 0612b87199a..76cea94f3b7 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -32,6 +32,14 @@ along with GCC; see the file COPYING3. If not see
| MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
| MASK_MS_BITFIELD_LAYOUT)
+#ifndef TARGET_USE_MCFGTHREAD
+#define CPP_MCFGTHREAD() ((void)0)
+#define LIB_MCFGTHREAD ""
+#else
+#define CPP_MCFGTHREAD() (builtin_define("__USING_MCFGTHREAD__"))
+#define LIB_MCFGTHREAD " -lmcfgthread "
+#endif
+
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
@@ -50,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
builtin_define_std ("WIN64"); \
builtin_define ("_WIN64"); \
} \
+ CPP_MCFGTHREAD(); \
} \
while (0)
@@ -93,7 +102,7 @@ along with GCC; see the file COPYING3. If not see
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
- "-ladvapi32 -lshell32 -luser32 -lkernel32"
+ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32"
/* Weak symbols do not get resolved if using a Windows dll import lib.
Make the unwind registration references strong undefs. */
diff --git a/gcc/configure b/gcc/configure
index 6121e163259..52f0e00efe6 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -11693,7 +11693,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b066cc609e1..4ecdba88de7 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1612,7 +1612,7 @@ case ${enable_threads} in
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index ea8c34f8c71..23134ad7363 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -145,7 +145,7 @@ case "${target}" in
*-*-mingw*)
# OS support for atomic primitives.
case ${target_thread_file} in
- win32)
+ win32 | mcf)
config_path="${config_path} mingw"
;;
posix)
diff --git a/libgcc/config.host b/libgcc/config.host
index 11b4acaff55..9fbd38650bd 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -737,6 +737,9 @@ i[34567]86-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
@@ -761,6 +764,9 @@ x86_64-*-mingw*)
posix)
tmake_file="i386/t-mingw-pthread $tmake_file"
;;
+ mcf)
+ tmake_file="i386/t-mingw-mcfgthread $tmake_file"
+ ;;
esac
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
if test x$ac_cv_sjlj_exceptions = xyes; then
diff --git a/libgcc/config/i386/gthr-mcf.h b/libgcc/config/i386/gthr-mcf.h
new file mode 100644
index 00000000000..5ea2908361f
--- /dev/null
+++ b/libgcc/config/i386/gthr-mcf.h
@@ -0,0 +1 @@
+#include <mcfgthread/gthread.h>
diff --git a/libgcc/config/i386/t-mingw-mcfgthread b/libgcc/config/i386/t-mingw-mcfgthread
new file mode 100644
index 00000000000..4b9b10e32d6
--- /dev/null
+++ b/libgcc/config/i386/t-mingw-mcfgthread
@@ -0,0 +1,2 @@
+SHLIB_PTHREAD_CFLAG =
+SHLIB_PTHREAD_LDFLAG = -lmcfgthread
diff --git a/libgcc/configure b/libgcc/configure
index b2f3f870844..eff889dc3b3 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -5451,6 +5451,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index ba094be6f15..979a5ab9ace 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -15187,6 +15187,7 @@ case $target_thread_file in
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
+ mcf) thread_header=config/i386/gthr-mcf.h ;;
esac
diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc
index de920d714c6..665fb74bd6b 100644
--- a/libstdc++-v3/libsupc++/atexit_thread.cc
+++ b/libstdc++-v3/libsupc++/atexit_thread.cc
@@ -25,6 +25,22 @@
#include <cstdlib>
#include <new>
#include "bits/gthr.h"
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+extern "C" int
+__cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *),
+ void *obj, void *dso_handle)
+ _GLIBCXX_NOTHROW
+{
+ return ::_MCFCRT_AtThreadExit((void (*)(_MCFCRT_STD intptr_t))dtor, (_MCFCRT_STD intptr_t)obj) ? 0 : -1;
+ (void)dso_handle;
+}
+
+#else // __USING_MCFGTHREAD__
+
#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -167,3 +183,5 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha
}
#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
+
+#endif // __USING_MCFGTHREAD__
diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc
index 3a2ec3ad0d6..8b4cc96199b 100644
--- a/libstdc++-v3/libsupc++/guard.cc
+++ b/libstdc++-v3/libsupc++/guard.cc
@@ -28,6 +28,27 @@
#include <cxxabi.h>
#include <exception>
#include <new>
+
+#ifdef __USING_MCFGTHREAD__
+
+#include <mcfgthread/gthread.h>
+
+namespace __cxxabiv1 {
+
+extern "C" int __cxa_guard_acquire(__guard *g){
+ return ::_MCFCRT_WaitForOnceFlagForever((::_MCFCRT_OnceFlag *)g) == ::_MCFCRT_kOnceResultInitial;
+}
+extern "C" void __cxa_guard_abort(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsAborted((::_MCFCRT_OnceFlag *)g);
+}
+extern "C" void __cxa_guard_release(__guard *g) throw() {
+ ::_MCFCRT_SignalOnceFlagAsFinished((::_MCFCRT_OnceFlag *)g);
+}
+
+}
+
+#else // __USING_MCFGTHREAD__
+
#include <ext/atomicity.h>
#include <ext/concurrence.h>
#include <bits/atomic_lockfree_defines.h>
@@ -425,3 +446,5 @@ namespace __cxxabiv1
#endif
}
}
+
+#endif
diff --git a/libstdc++-v3/src/c++11/thread.cc b/libstdc++-v3/src/c++11/thread.cc
index 8238817c2e9..0c6a1f85f6f 100644
--- a/libstdc++-v3/src/c++11/thread.cc
+++ b/libstdc++-v3/src/c++11/thread.cc
@@ -55,6 +55,15 @@ static inline int get_nprocs()
#elif defined(_GLIBCXX_USE_SC_NPROC_ONLN)
# include <unistd.h>
# define _GLIBCXX_NPROCS sysconf(_SC_NPROC_ONLN)
+#elif defined(_WIN32)
+# include <windows.h>
+static inline int get_nprocs()
+{
+ SYSTEM_INFO sysinfo;
+ GetSystemInfo(&sysinfo);
+ return (int)sysinfo.dwNumberOfProcessors;
+}
+# define _GLIBCXX_NPROCS get_nprocs()
#else
# define _GLIBCXX_NPROCS 0
#endif
--
2.17.0

View File

@ -79,10 +79,9 @@ let majorVersion = "9";
++ optional langD ../libphobos.patch
++ optional langFortran ../gfortran-driving.patch
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch
++ optional (!crossStageStatic && targetPlatform.isMinGW) (fetchpatch {
url = "https://raw.githubusercontent.com/lhmouse/MINGW-packages/${import ../common/mfcgthreads-patches-repo.nix}/mingw-w64-gcc-git/9000-gcc-${majorVersion}-branch-Added-mcf-thread-model-support-from-mcfgthread.patch";
sha256 = "1in5kvcknlpi9z1vvjw6jfmwy8k12zvbqlqfnq84qpm99r0rh00a";
});
# Obtain latest patch with ../update-mcfgthread-patches.sh
++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch;
/* Cross-gcc settings (build == host != target) */
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";

View File

@ -1 +0,0 @@
"740f233da00c4fb5bcc225b2e29768824bcecc58"

View File

@ -0,0 +1,15 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p curl
# We use this script to download local copies instead of using
# fetchpatch because lmhouse/MINGW-packages-dev is constantly rebased
# against msys2/MINGW-packages-dev and won't have stable commit hashes.
name=Added-mcf-thread-model-support-from-mcfgthread.patch
source=https://raw.githubusercontent.com/lhmouse/MINGW-packages-dev/master/mingw-w64-gcc-git
dest=$(dirname "$0")
for majorVersion in 6 7 8 9 10; do
curl "$source/9000-gcc-$majorVersion-branch-$name" \
> "$dest/$majorVersion/$name"
done

View File

@ -5,13 +5,13 @@
# Uses scheme to bootstrap the build of idris2
stdenv.mkDerivation rec {
pname = "idris2";
version = "0.2.1";
version = "0.2.2";
src = fetchFromGitHub {
owner = "idris-lang";
repo = "Idris2";
rev = "v${version}";
sha256 = "044slgl2pwvj939kz3z92n6l182plc5fzng1n4z4k6bg11msqq14";
sha256 = "18m483vccijfh9z6x4zgi37fql3q765x3ypkwixv3rwq9nxnd6hm";
};
strictDeps = true;

View File

@ -1,4 +1,4 @@
{ lib, buildPythonPackage, fetchPypi, isPy3k }:
{ lib, buildPythonPackage, fetchPypi, flask, ldapdomaindump, pycryptodomex, pyasn1, pyopenssl }:
buildPythonPackage rec {
pname = "impacket";
@ -9,16 +9,18 @@ buildPythonPackage rec {
sha256 = "4bf7e7b595356585599b4b2773b8a463d7b9765c97012dcd5a44eb6d547f6a1d";
};
disabled = isPy3k;
propagatedBuildInputs = [ flask ldapdomaindump pycryptodomex pyasn1 pyopenssl ];
# no tests
# fail with:
# RecursionError: maximum recursion depth exceeded
doCheck = false;
pythonImportsCheck = [ "impacket" ];
meta = with lib; {
description = "Network protocols Constructors and Dissectors";
homepage = "https://github.com/CoreSecurity/impacket";
# Modified Apache Software License, Version 1.1
license = licenses.free;
maintainers = with maintainers; [ peterhoeg ];
maintainers = with maintainers; [ SuperSandro2000 ];
};
}

View File

@ -0,0 +1,24 @@
{ lib, buildPythonPackage, fetchPypi, dnspython, future, ldap3 }:
buildPythonPackage rec {
pname = "ldapdomaindump";
version = "0.9.3";
src = fetchPypi {
inherit pname version;
sha256 = "10cis8cllpa9qi5qil9k7521ag3921mxwg2wj9nyn0lk41rkjagc";
};
propagatedBuildInputs = [ dnspython future ldap3 ];
# requires ldap server
doCheck = false;
pythonImportsCheck = [ "ldapdomaindump" ];
meta = with lib; {
description = "Active Directory information dumper via LDAP";
homepage = "https://github.com/dirkjanm/ldapdomaindump/";
license = licenses.mit;
maintainers = with maintainers; [ SuperSandro2000 ];
};
}

View File

@ -2,11 +2,11 @@
buildPythonPackage rec {
pname = "micawber";
version = "0.5.1";
version = "0.5.2";
src = fetchPypi {
inherit pname version;
sha256 = "5e1e6fbab5bfc1edc6d575b900707c24a3484c51cf2e01f059a7e070724a3633";
sha256 = "ac2d737d8ff27ed01ea3825ed8806970e8137d7b342cef37b39b6dd17e6eb3a4";
};
propagatedBuildInputs = [ beautifulsoup4 ];

View File

@ -9,11 +9,11 @@
buildPythonPackage rec {
pname = "mocket";
version = "3.9.4";
version = "3.9.35";
src = fetchPypi {
inherit pname version;
sha256 = "0b3nx8qa66isfl7rm3ljgxflr087qwabnf0a2xa1l5s28rikfj04";
sha256 = "d822a2adfd8e028a2856785fbfe78e7dd8c7a3b623516298aef6d42a4c9149d1";
};
patchPhase = ''

View File

@ -1,22 +1,28 @@
{ stdenv, buildPythonPackage, isPy3k, fetchPypi,
paramiko, pycurl, ajpy, pyopenssl, cx_oracle, mysqlclient,
psycopg2, pycrypto, dnspython, ipy, pysnmp, pyasn1 }:
{ stdenv, buildPythonPackage, isPy27, fetchPypi
, paramiko, pycurl, ajpy, impacket, pyopenssl, cx_oracle, mysqlclient
, psycopg2, pycrypto, dnspython, ipy, pysnmp, pyasn1, pysqlcipher3 }:
buildPythonPackage rec {
pname = "patator";
version = "0.9";
disabled = !(isPy3k);
disabled = isPy27;
src = fetchPypi {
inherit pname version;
sha256 = "68cb24bdc3042ee0d47a288b19a8b99a6c54bdbd4ddf0c5817d9b9ac0a0d8a15";
};
postPatch = ''
substituteInPlace requirements.txt \
--replace psycopg2-binary psycopg2
'';
propagatedBuildInputs = [
paramiko
pycurl
ajpy
impacket
pyopenssl
cx_oracle
mysqlclient
@ -26,15 +32,16 @@ buildPythonPackage rec {
ipy
pysnmp
pyasn1
pysqlcipher3
];
# No tests provided by patator
# tests require docker-compose and vagrant
doCheck = false;
meta = with stdenv.lib; {
description = "multi-purpose brute-forcer";
homepage = "https://github.com/lanjelot/patator";
license = licenses.gpl2;
maintainers = with maintainers; [ y0no ];
maintainers = with maintainers; [ y0no SuperSandro2000 ];
};
}

View File

@ -0,0 +1,24 @@
{ lib, buildPythonPackage, fetchPypi, pythonAtLeast, sqlcipher }:
buildPythonPackage rec {
pname = "pysqlcipher3";
version = "1.0.3";
disabled = pythonAtLeast "3.9";
src = fetchPypi {
inherit pname version;
sha256 = "0c54m18h52llwkfc9zaag3qkmfzzp5a1w9jzsm5hd2nfdsxmnkk9";
};
buildInputs = [ sqlcipher ];
pythonImportsCheck = [ "pysqlcipher3" ];
meta = with lib; {
description = "Python 3 bindings for SQLCipher";
homepage = "https://github.com/rigglemania/pysqlcipher3/";
license = licenses.zlib;
maintainers = with maintainers; [ SuperSandro2000 ];
};
}

View File

@ -1,11 +1,10 @@
{
lib, fetchPypi, buildPythonPackage, isPy3k, pythonOlder,
# runtime dependencies
pandas, numpy, requests, inflection, python-dateutil, six, more-itertools, importlib-metadata,
# test suite dependencies
nose, unittest2, flake8, httpretty, mock, jsondate, parameterized, faker, factory_boy,
# additional runtime dependencies are required on Python 2.x
pyOpenSSL ? null, ndg-httpsclient ? null, pyasn1 ? null
{ lib, fetchPypi, buildPythonPackage, isPy3k, pythonOlder
# runtime dependencies
, pandas, numpy, requests, inflection, python-dateutil, six, more-itertools, importlib-metadata
# test suite dependencies
, nose, unittest2, flake8, httpretty, mock, jsondate, parameterized, faker, factory_boy
# additional runtime dependencies are required on Python 2.x
, pyopenssl, ndg-httpsclient, pyasn1
}:
buildPythonPackage rec {
@ -19,8 +18,6 @@ buildPythonPackage rec {
sha256 = "0zpw0nwqr4g56l9z4my0fahfgpcmfx74acbmv6nfx1dmq5ggraf3";
};
doCheck = true;
checkInputs = [
nose
unittest2
@ -42,7 +39,7 @@ buildPythonPackage rec {
six
more-itertools
] ++ lib.optionals (!isPy3k) [
pyOpenSSL
pyopenssl
ndg-httpsclient
pyasn1
] ++ lib.optionals (pythonOlder "3.8") [

View File

@ -23,7 +23,7 @@
buildPythonPackage rec {
pname = "weasyprint";
version = "50";
version = "52";
disabled = !isPy3k;
# excluded test needs the Ahem font
@ -59,7 +59,7 @@ buildPythonPackage rec {
src = fetchPypi {
inherit version;
pname = "WeasyPrint";
sha256 = "0invs96zvmcr6wh5klj52jrcnr9qg150v9wpmbhcsf3vv1d1hbcw";
sha256 = "0rwf43111ws74m8b1alkkxzz57g0np3vmd8as74adwnxslfcg4gs";
};
meta = with stdenv.lib; {

View File

@ -1,8 +1,8 @@
diff --git a/weasyprint/fonts.py b/weasyprint/fonts.py
index 377716c1..2016e01c 100644
index 79e3b5b..4438eb4 100644
--- a/weasyprint/fonts.py
+++ b/weasyprint/fonts.py
@@ -48,11 +48,8 @@ else:
@@ -45,11 +45,8 @@ else:
# with OSError: dlopen() failed to load a library: cairo / cairo-2
# So let's hope we find the same file as cairo already did ;)
# Same applies to pangocairo requiring pangoft2
@ -10,26 +10,26 @@ index 377716c1..2016e01c 100644
- 'libfontconfig-1.dll',
- 'libfontconfig.so.1', 'libfontconfig-1.dylib')
- pangoft2 = dlopen(ffi, 'pangoft2-1.0', 'libpangoft2-1.0-0',
- 'libpangoft2-1.0.so', 'libpangoft2-1.0.dylib')
- 'libpangoft2-1.0.so.0', 'libpangoft2-1.0.dylib')
+ fontconfig = dlopen(ffi, '@fontconfig@')
+ pangoft2 = dlopen(ffi, '@pangoft2@')
ffi.cdef('''
// FontConfig
diff --git a/weasyprint/text.py b/weasyprint/text.py
index 035074e9..08e40395 100644
index 1dc5e4d..b070bad 100644
--- a/weasyprint/text.py
+++ b/weasyprint/text.py
@@ -243,12 +243,9 @@ def dlopen(ffi, *names):
@@ -255,12 +255,9 @@ def dlopen(ffi, *names):
return ffi.dlopen(names[0]) # pragma: no cover
-gobject = dlopen(ffi, 'gobject-2.0', 'libgobject-2.0-0', 'libgobject-2.0.so',
-gobject = dlopen(ffi, 'gobject-2.0', 'libgobject-2.0-0', 'libgobject-2.0.so.0',
- 'libgobject-2.0.dylib')
-pango = dlopen(ffi, 'pango-1.0', 'libpango-1.0-0', 'libpango-1.0.so',
-pango = dlopen(ffi, 'pango-1.0', 'libpango-1.0-0', 'libpango-1.0.so.0',
- 'libpango-1.0.dylib')
-pangocairo = dlopen(ffi, 'pangocairo-1.0', 'libpangocairo-1.0-0',
- 'libpangocairo-1.0.so', 'libpangocairo-1.0.dylib')
- 'libpangocairo-1.0.so.0', 'libpangocairo-1.0.dylib')
+gobject = dlopen(ffi, '@gobject@')
+pango = dlopen(ffi, '@pango@')
+pangocairo = dlopen(ffi, '@pangocairo@')

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub }:
{ stdenv, fetchFromGitHub, makeWrapper, imagemagick, xorg }:
stdenv.mkDerivation rec {
pname = "ttygif";
@ -13,6 +13,12 @@ stdenv.mkDerivation rec {
makeFlags = [ "CC:=$(CC)" "PREFIX=${placeholder "out"}" ];
nativeBuildInputs = [ makeWrapper ];
postInstall = ''
wrapProgram $out/bin/ttygif \
--prefix PATH : ${stdenv.lib.makeBinPath [ imagemagick xorg.xwd ]}
'';
meta = with stdenv.lib; {
homepage = "https://github.com/icholy/ttygif";
description = "Convert terminal recordings to animated gifs";

View File

@ -3405,9 +3405,13 @@ in {
lazy-object-proxy = callPackage ../development/python-modules/lazy-object-proxy { };
ldap = callPackage ../development/python-modules/ldap {
inherit (pkgs) openldap cyrus_sasl;
};
ldap3 = callPackage ../development/python-modules/ldap3 { };
ldap = callPackage ../development/python-modules/ldap { inherit (pkgs) openldap cyrus_sasl; };
ldapdomaindump = callPackage ../development/python-modules/ldapdomaindump { };
ldappool = callPackage ../development/python-modules/ldappool { };
@ -5722,6 +5726,10 @@ in {
pysptk = callPackage ../development/python-modules/pysptk { };
pysqlcipher3 = callPackage ../development/python-modules/pysqlcipher3 {
inherit (pkgs) sqlcipher;
};
pysqlite = callPackage ../development/python-modules/pysqlite { };
pysqueezebox = callPackage ../development/python-modules/pysqueezebox { };