mirror of git://gcc.gnu.org/git/gcc.git
gcc: Add 'mcf' thread model support from mcfgthread
This patch adds the new thread model `mcf`, which implements mutexes and condition variables with the mcfgthread library. Source code for mcfgthread is available at <https://github.com/lhmouse/mcfgthread>. config/ChangeLog: * gthr.m4 (GCC_AC_THREAD_HEADER): Add new case for `mcf` thread model gcc/ChangeLog: * config/i386/mingw-mcfgthread.h: New file * config/i386/mingw32.h: Add builtin macro and default libraries for mcfgthread when thread model is `mcf` * config.gcc: Include 'i386/mingw-mcfgthread.h' when thread model is `mcf` * configure.ac: Recognize `mcf` as a valid thread model * config.in: Regenerate * configure: Regenerate libatomic/ChangeLog: * configure.tgt: Add new case for `mcf` thread model libgcc/ChangeLog: * config.host: Add new cases for `mcf` thread model * config/i386/gthr-mcf.h: New file * config/i386/t-mingw-mcfgthread: New file * config/i386/t-slibgcc-cygming: Add mcfgthread for libgcc DLL * configure: Regenerate libstdc++-v3/ChangeLog: * libsupc++/atexit_thread.cc (__cxa_thread_atexit): Use implementation from mcfgthread if available * libsupc++/guard.cc (__cxa_guard_acquire, __cxa_guard_release, __cxa_guard_abort): Use implementations from mcfgthread if available * configure: Regenerate
This commit is contained in:
parent
f3b957ea8b
commit
f036d759ec
|
@ -22,6 +22,7 @@ case $1 in
|
||||||
tpf) thread_header=config/s390/gthr-tpf.h ;;
|
tpf) thread_header=config/s390/gthr-tpf.h ;;
|
||||||
vxworks) thread_header=config/gthr-vxworks.h ;;
|
vxworks) thread_header=config/gthr-vxworks.h ;;
|
||||||
win32) thread_header=config/i386/gthr-win32.h ;;
|
win32) thread_header=config/i386/gthr-win32.h ;;
|
||||||
|
mcf) thread_header=config/i386/gthr-mcf.h ;;
|
||||||
esac
|
esac
|
||||||
AC_SUBST(thread_header)
|
AC_SUBST(thread_header)
|
||||||
])
|
])
|
||||||
|
|
|
@ -2096,6 +2096,9 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
|
||||||
if test x$enable_threads = xposix ; then
|
if test x$enable_threads = xposix ; then
|
||||||
tm_file="${tm_file} i386/mingw-pthread.h"
|
tm_file="${tm_file} i386/mingw-pthread.h"
|
||||||
fi
|
fi
|
||||||
|
if test x$enable_threads = xmcf ; then
|
||||||
|
tm_file="${tm_file} i386/mingw-mcfgthread.h"
|
||||||
|
fi
|
||||||
tm_file="${tm_file} i386/mingw32.h"
|
tm_file="${tm_file} i386/mingw32.h"
|
||||||
# This makes the logic if mingw's or the w64 feature set has to be used
|
# This makes the logic if mingw's or the w64 feature set has to be used
|
||||||
case ${target} in
|
case ${target} in
|
||||||
|
|
|
@ -1451,6 +1451,12 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getauxval' function. */
|
||||||
|
#ifndef USED_FOR_TARGET
|
||||||
|
#undef HAVE_GETAUXVAL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getchar_unlocked' function. */
|
/* Define to 1 if you have the `getchar_unlocked' function. */
|
||||||
#ifndef USED_FOR_TARGET
|
#ifndef USED_FOR_TARGET
|
||||||
#undef HAVE_GETCHAR_UNLOCKED
|
#undef HAVE_GETCHAR_UNLOCKED
|
||||||
|
@ -2678,7 +2684,3 @@
|
||||||
#undef vfork
|
#undef vfork
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define to 1 if you have the `getauxval' function. */
|
|
||||||
#ifndef USED_FOR_TARGET
|
|
||||||
#undef HAVE_GETAUXVAL
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
#define TARGET_USING_MCFGTHREAD 1
|
|
@ -32,6 +32,10 @@ along with GCC; see the file COPYING3. If not see
|
||||||
| MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
|
| MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
|
||||||
| MASK_MS_BITFIELD_LAYOUT)
|
| MASK_MS_BITFIELD_LAYOUT)
|
||||||
|
|
||||||
|
#ifndef TARGET_USING_MCFGTHREAD
|
||||||
|
#define TARGET_USING_MCFGTHREAD 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
|
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
|
||||||
is for compatibility with native compiler. */
|
is for compatibility with native compiler. */
|
||||||
#define EXTRA_OS_CPP_BUILTINS() \
|
#define EXTRA_OS_CPP_BUILTINS() \
|
||||||
|
@ -50,6 +54,8 @@ along with GCC; see the file COPYING3. If not see
|
||||||
builtin_define_std ("WIN64"); \
|
builtin_define_std ("WIN64"); \
|
||||||
builtin_define ("_WIN64"); \
|
builtin_define ("_WIN64"); \
|
||||||
} \
|
} \
|
||||||
|
if (TARGET_USING_MCFGTHREAD) \
|
||||||
|
builtin_define ("__USING_MCFGTHREAD__"); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
@ -181,11 +187,16 @@ along with GCC; see the file COPYING3. If not see
|
||||||
#else
|
#else
|
||||||
#define SHARED_LIBGCC_SPEC " -lgcc "
|
#define SHARED_LIBGCC_SPEC " -lgcc "
|
||||||
#endif
|
#endif
|
||||||
|
#if TARGET_USING_MCFGTHREAD
|
||||||
|
#define MCFGTHREAD_SPEC " -lmcfgthread -lkernel32 -lntdll "
|
||||||
|
#else
|
||||||
|
#define MCFGTHREAD_SPEC ""
|
||||||
|
#endif
|
||||||
#undef REAL_LIBGCC_SPEC
|
#undef REAL_LIBGCC_SPEC
|
||||||
#define REAL_LIBGCC_SPEC \
|
#define REAL_LIBGCC_SPEC \
|
||||||
"%{mthreads:-lmingwthrd} -lmingw32 \
|
"%{mthreads:-lmingwthrd} -lmingw32 \
|
||||||
" SHARED_LIBGCC_SPEC " \
|
" SHARED_LIBGCC_SPEC " \
|
||||||
-lmoldname -lmingwex -lmsvcrt -lkernel32"
|
-lmoldname -lmingwex -lmsvcrt -lkernel32 " MCFGTHREAD_SPEC
|
||||||
|
|
||||||
#undef STARTFILE_SPEC
|
#undef STARTFILE_SPEC
|
||||||
#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
|
#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
|
||||||
|
|
|
@ -12900,7 +12900,7 @@ case ${enable_threads} in
|
||||||
target_thread_file='single'
|
target_thread_file='single'
|
||||||
;;
|
;;
|
||||||
aix | dce | lynx | mipssde | posix | rtems | \
|
aix | dce | lynx | mipssde | posix | rtems | \
|
||||||
single | tpf | vxworks | win32)
|
single | tpf | vxworks | win32 | mcf)
|
||||||
target_thread_file=${enable_threads}
|
target_thread_file=${enable_threads}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
@ -1991,7 +1991,7 @@ case ${enable_threads} in
|
||||||
target_thread_file='single'
|
target_thread_file='single'
|
||||||
;;
|
;;
|
||||||
aix | dce | lynx | mipssde | posix | rtems | \
|
aix | dce | lynx | mipssde | posix | rtems | \
|
||||||
single | tpf | vxworks | win32)
|
single | tpf | vxworks | win32 | mcf)
|
||||||
target_thread_file=${enable_threads}
|
target_thread_file=${enable_threads}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
@ -159,7 +159,7 @@ case "${target}" in
|
||||||
*-*-mingw*)
|
*-*-mingw*)
|
||||||
# OS support for atomic primitives.
|
# OS support for atomic primitives.
|
||||||
case ${target_thread_file} in
|
case ${target_thread_file} in
|
||||||
win32)
|
win32 | mcf)
|
||||||
config_path="${config_path} mingw"
|
config_path="${config_path} mingw"
|
||||||
;;
|
;;
|
||||||
posix)
|
posix)
|
||||||
|
|
|
@ -825,6 +825,9 @@ i[34567]86-*-mingw*)
|
||||||
posix)
|
posix)
|
||||||
tmake_file="i386/t-mingw-pthread $tmake_file"
|
tmake_file="i386/t-mingw-pthread $tmake_file"
|
||||||
;;
|
;;
|
||||||
|
mcf)
|
||||||
|
tmake_file="i386/t-mingw-mcfgthread $tmake_file"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
|
# 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
|
if test x$ac_cv_sjlj_exceptions = xyes; then
|
||||||
|
@ -849,6 +852,9 @@ x86_64-*-mingw*)
|
||||||
posix)
|
posix)
|
||||||
tmake_file="i386/t-mingw-pthread $tmake_file"
|
tmake_file="i386/t-mingw-pthread $tmake_file"
|
||||||
;;
|
;;
|
||||||
|
mcf)
|
||||||
|
tmake_file="i386/t-mingw-mcfgthread $tmake_file"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
# This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h
|
# 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
|
if test x$ac_cv_sjlj_exceptions = xyes; then
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
#include <mcfgthread/gthr.h>
|
|
@ -0,0 +1 @@
|
||||||
|
SHLIB_MCFGTHREAD_LIBS = -lmcfgthread -lkernel32 -lntdll
|
|
@ -27,6 +27,9 @@ endif
|
||||||
ifndef SHLIB_PTHREAD_LDFLAG
|
ifndef SHLIB_PTHREAD_LDFLAG
|
||||||
SHLIB_PTHREAD_LDFLAG =
|
SHLIB_PTHREAD_LDFLAG =
|
||||||
endif
|
endif
|
||||||
|
ifndef SHLIB_MCFGTHREAD_LIBS
|
||||||
|
SHLIB_MCFGTHREAD_LIBS =
|
||||||
|
endif
|
||||||
|
|
||||||
SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \
|
SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \
|
||||||
if [ ! -d $(SHLIB_DIR) ]; then \
|
if [ ! -d $(SHLIB_DIR) ]; then \
|
||||||
|
@ -37,7 +40,8 @@ SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \
|
||||||
$(SHLIB_MAP).def \
|
$(SHLIB_MAP).def \
|
||||||
-Wl,--out-implib,$(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp \
|
-Wl,--out-implib,$(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp \
|
||||||
-o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
|
-o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
|
||||||
$(SHLIB_OBJS) ${SHLIB_PTHREAD_LDFLAG} $(SHLIB_LC) && \
|
$(SHLIB_OBJS) ${SHLIB_PTHREAD_LDFLAG} $(SHLIB_LC) \
|
||||||
|
$(SHLIB_MCFGTHREAD_LIBS) && \
|
||||||
if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \
|
if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \
|
||||||
mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \
|
mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \
|
||||||
$(SHLIB_DIR)/$(SHLIB_SONAME).backup; \
|
$(SHLIB_DIR)/$(SHLIB_SONAME).backup; \
|
||||||
|
|
|
@ -5699,6 +5699,7 @@ case $target_thread_file in
|
||||||
tpf) thread_header=config/s390/gthr-tpf.h ;;
|
tpf) thread_header=config/s390/gthr-tpf.h ;;
|
||||||
vxworks) thread_header=config/gthr-vxworks.h ;;
|
vxworks) thread_header=config/gthr-vxworks.h ;;
|
||||||
win32) thread_header=config/i386/gthr-win32.h ;;
|
win32) thread_header=config/i386/gthr-win32.h ;;
|
||||||
|
mcf) thread_header=config/i386/gthr-mcf.h ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15855,6 +15855,7 @@ case $target_thread_file in
|
||||||
tpf) thread_header=config/s390/gthr-tpf.h ;;
|
tpf) thread_header=config/s390/gthr-tpf.h ;;
|
||||||
vxworks) thread_header=config/gthr-vxworks.h ;;
|
vxworks) thread_header=config/gthr-vxworks.h ;;
|
||||||
win32) thread_header=config/i386/gthr-win32.h ;;
|
win32) thread_header=config/i386/gthr-win32.h ;;
|
||||||
|
mcf) thread_header=config/i386/gthr-mcf.h ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
@ -16062,7 +16063,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
|
||||||
# Fake what AC_TRY_COMPILE does.
|
# Fake what AC_TRY_COMPILE does.
|
||||||
|
|
||||||
cat > conftest.$ac_ext << EOF
|
cat > conftest.$ac_ext << EOF
|
||||||
#line 16065 "configure"
|
#line 16066 "configure"
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
typedef bool atomic_type;
|
typedef bool atomic_type;
|
||||||
|
@ -16097,7 +16098,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
|
||||||
rm -f conftest*
|
rm -f conftest*
|
||||||
|
|
||||||
cat > conftest.$ac_ext << EOF
|
cat > conftest.$ac_ext << EOF
|
||||||
#line 16100 "configure"
|
#line 16101 "configure"
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
typedef short atomic_type;
|
typedef short atomic_type;
|
||||||
|
@ -16132,7 +16133,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
|
||||||
rm -f conftest*
|
rm -f conftest*
|
||||||
|
|
||||||
cat > conftest.$ac_ext << EOF
|
cat > conftest.$ac_ext << EOF
|
||||||
#line 16135 "configure"
|
#line 16136 "configure"
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// NB: _Atomic_word not necessarily int.
|
// NB: _Atomic_word not necessarily int.
|
||||||
|
@ -16168,7 +16169,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
|
||||||
rm -f conftest*
|
rm -f conftest*
|
||||||
|
|
||||||
cat > conftest.$ac_ext << EOF
|
cat > conftest.$ac_ext << EOF
|
||||||
#line 16171 "configure"
|
#line 16172 "configure"
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
typedef long long atomic_type;
|
typedef long long atomic_type;
|
||||||
|
@ -16324,7 +16325,7 @@ $as_echo "mutex" >&6; }
|
||||||
# unnecessary for this test.
|
# unnecessary for this test.
|
||||||
|
|
||||||
cat > conftest.$ac_ext << EOF
|
cat > conftest.$ac_ext << EOF
|
||||||
#line 16327 "configure"
|
#line 16328 "configure"
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
_Decimal32 d1;
|
_Decimal32 d1;
|
||||||
|
@ -16366,7 +16367,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||||
# unnecessary for this test.
|
# unnecessary for this test.
|
||||||
|
|
||||||
cat > conftest.$ac_ext << EOF
|
cat > conftest.$ac_ext << EOF
|
||||||
#line 16369 "configure"
|
#line 16370 "configure"
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
struct same
|
struct same
|
||||||
{ typedef T2 type; };
|
{ typedef T2 type; };
|
||||||
|
|
|
@ -25,6 +25,24 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <new>
|
#include <new>
|
||||||
#include "bits/gthr.h"
|
#include "bits/gthr.h"
|
||||||
|
|
||||||
|
#ifdef __USING_MCFGTHREAD__
|
||||||
|
|
||||||
|
#include <mcfgthread/cxa.h>
|
||||||
|
|
||||||
|
namespace __cxxabiv1 {
|
||||||
|
|
||||||
|
extern "C" int
|
||||||
|
__cxa_thread_atexit (void (_GLIBCXX_CDTOR_CALLABI *dtor)(void *),
|
||||||
|
void *obj, void *dso_handle) _GLIBCXX_NOTHROW
|
||||||
|
{
|
||||||
|
return __MCF_cxa_thread_atexit (dtor, obj, dso_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace __cxxabiv1
|
||||||
|
|
||||||
|
#else // __USING_MCFGTHREAD__
|
||||||
|
|
||||||
#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
|
#ifdef _GLIBCXX_THREAD_ATEXIT_WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -173,3 +191,5 @@ __cxxabiv1::__cxa_thread_atexit (void (_GLIBCXX_CDTOR_CALLABI *dtor)(void *),
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
|
#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
|
||||||
|
|
||||||
|
#endif // __USING_MCFGTHREAD__
|
||||||
|
|
|
@ -28,6 +28,35 @@
|
||||||
#include <cxxabi.h>
|
#include <cxxabi.h>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
|
#ifdef __USING_MCFGTHREAD__
|
||||||
|
|
||||||
|
#include <mcfgthread/cxa.h>
|
||||||
|
|
||||||
|
namespace __cxxabiv1 {
|
||||||
|
|
||||||
|
extern "C" int
|
||||||
|
__cxa_guard_acquire (__guard* g) _GLIBCXX_NOTHROW
|
||||||
|
{
|
||||||
|
return __MCF_cxa_guard_acquire(g);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
__cxa_guard_release (__guard* g) _GLIBCXX_NOTHROW
|
||||||
|
{
|
||||||
|
__MCF_cxa_guard_release(g);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
__cxa_guard_abort (__guard* g) _GLIBCXX_NOTHROW
|
||||||
|
{
|
||||||
|
__MCF_cxa_guard_abort(g);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace __cxxabiv1
|
||||||
|
|
||||||
|
#else // __USING_MCFGTHREAD__
|
||||||
|
|
||||||
#include <ext/atomicity.h>
|
#include <ext/atomicity.h>
|
||||||
#include <ext/concurrence.h>
|
#include <ext/concurrence.h>
|
||||||
#include <bits/atomic_lockfree_defines.h>
|
#include <bits/atomic_lockfree_defines.h>
|
||||||
|
@ -458,3 +487,5 @@ namespace __cxxabiv1
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // __USING_MCFGTHREAD__
|
||||||
|
|
Loading…
Reference in New Issue