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)
])
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
#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. */
#ifndef USED_FOR_TARGET
#undef HAVE_GETCHAR_UNLOCKED
#undef vfork
#endif
-/* Define to 1 if you have the `getauxval' function. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_GETAUXVAL
-#endif
--- /dev/null
+#define TARGET_USING_MCFGTHREAD 1
| MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
| 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
is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
builtin_define_std ("WIN64"); \
builtin_define ("_WIN64"); \
} \
+ if (TARGET_USING_MCFGTHREAD) \
+ builtin_define ("__USING_MCFGTHREAD__"); \
} \
while (0)
#else
#define SHARED_LIBGCC_SPEC " -lgcc "
#endif
+#if TARGET_USING_MCFGTHREAD
+#define MCFGTHREAD_SPEC " -lmcfgthread -lkernel32 -lntdll "
+#else
+#define MCFGTHREAD_SPEC ""
+#endif
#undef REAL_LIBGCC_SPEC
#define REAL_LIBGCC_SPEC \
"%{mthreads:-lmingwthrd} -lmingw32 \
" SHARED_LIBGCC_SPEC " \
- -lmoldname -lmingwex -lmsvcrt -lkernel32"
+ -lmoldname -lmingwex -lmsvcrt -lkernel32 " MCFGTHREAD_SPEC
#undef STARTFILE_SPEC
#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
target_thread_file='single'
;;
aix | dce | lynx | mipssde | posix | rtems | \
- single | tpf | vxworks | win32)
+ single | tpf | vxworks | win32 | mcf)
target_thread_file=${enable_threads}
;;
*)
*-*-mingw*)
# OS support for atomic primitives.
case ${target_thread_file} in
- win32)
+ win32 | mcf)
config_path="${config_path} mingw"
;;
posix)
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
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
--- /dev/null
+#include <mcfgthread/gthr.h>
--- /dev/null
+SHLIB_MCFGTHREAD_LIBS = -lmcfgthread -lkernel32 -lntdll
ifndef SHLIB_PTHREAD_LDFLAG
SHLIB_PTHREAD_LDFLAG =
endif
+ifndef SHLIB_MCFGTHREAD_LIBS
+SHLIB_MCFGTHREAD_LIBS =
+endif
SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \
if [ ! -d $(SHLIB_DIR) ]; then \
$(SHLIB_MAP).def \
-Wl,--out-implib,$(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp \
-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 \
mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \
$(SHLIB_DIR)/$(SHLIB_SONAME).backup; \
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
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
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 16065 "configure"
+#line 16066 "configure"
int main()
{
typedef bool atomic_type;
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16100 "configure"
+#line 16101 "configure"
int main()
{
typedef short atomic_type;
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16135 "configure"
+#line 16136 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 16171 "configure"
+#line 16172 "configure"
int main()
{
typedef long long atomic_type;
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16327 "configure"
+#line 16328 "configure"
int main()
{
_Decimal32 d1;
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 16369 "configure"
+#line 16370 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
#include <cstdlib>
#include <new>
#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
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
}
#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
+
+#endif // __USING_MCFGTHREAD__
#include <cxxabi.h>
#include <exception>
#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/concurrence.h>
#include <bits/atomic_lockfree_defines.h>
#endif
}
}
+
+#endif // __USING_MCFGTHREAD__