Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
GCC 13 has a new implementation of gthr-win32.h which supports C++11
mutexes, threads etc. but this causes an unintended ABI break. The
__gthread_mutex_t type is always used in std::basic_filebuf even in
C++98, so independent of whether C++11 sync primitives work or not.
Because that type changed for the win32 thread model, we have a layout
change in std::basic_filebuf. The member is completely unused, it just
gets passed to the std::__basic_file constructor and ignored. So we
don't need that mutex to actually work, we just need its layout to not
change.
Introduce a new __gthr_win32_legacy_mutex_t struct in gthr-win32.h with
the old layout, and conditionally use that in std::basic_filebuf.
PR libstdc++/108331
libgcc/ChangeLog:
* config/i386/gthr-win32.h (__gthr_win32_legacy_mutex_t): New
struct matching the previous __gthread_mutex_t struct.
(__GTHREAD_LEGACY_MUTEX_T): Define.
libstdc++-v3/ChangeLog:
* config/io/c_io_stdio.h (__c_lock): Define as a typedef for
__GTHREAD_LEGACY_MUTEX_T if defined.
|
|
Broken by 9149a5b7e0a66b7b94d5b7db3194a975d18dea2f.
CC_NONE is defined by wingdi.h and conflicting with gcc.
Committed as obvious.
libgcc/:
* config/i386/gthr-win32.h: undef CC_NONE
Signed-off-by: Jonathan Yong <10walls@gmail.com>
|
|
This reimplements the GNU threads library on native Windows (except for the
Objective-C specific subset) using direct Win32 API calls, in lieu of the
implementation based on semaphores. This base implementations requires
Windows XP/Server 2003, which was the default minimal setting of MinGW-W64
until end of 2020. This also adds the support required for the C++11 threads,
using again direct Win32 API calls; this additional layer requires Windows
Vista/Server 2008 and is enabled only if _WIN32_WINNT >= 0x0600.
This also changes libstdc++ to pass -D_WIN32_WINNT=0x0600 but only when the
switch --enable-libstdcxx-threads is passed, which means that C++11 threads
are still disabled by default *unless* MinGW-W64 itself is configured for
Windows Vista/Server 2008 or later by default (this has been the case in
the development version since end of 2020, for earlier versions you can
configure it --with-default-win32-winnt=0x0600 to get the same effect).
I only manually tested it on i686-w64-mingw32 and x86_64-w64-mingw32 but
AdaCore has used it in their C/C++/Ada compilers for 3 years now and the
30_threads chapter of the libstdc++ testsuite was clean at the time.
2022-10-31 Eric Botcazou <ebotcazou@adacore.com>
libgcc/
* config.host (i[34567]86-*-mingw*): Add thread fragment after EH one
as well as new i386/t-slibgcc-mingw fragment.
(x86_64-*-mingw*): Likewise.
* config/i386/gthr-win32.h: If _WIN32_WINNT is at least 0x0600, define
both __GTHREAD_HAS_COND and __GTHREADS_CXX0X to 1.
Error out if _GTHREAD_USE_MUTEX_TIMEDLOCK is 1.
Include stdlib.h instead of errno.h and do not include _mingw.h.
(CONST_CAST2): Add specific definition for C++.
(ATTRIBUTE_UNUSED): New macro.
(__UNUSED_PARAM): Delete.
Define WIN32_LEAN_AND_MEAN before including windows.h.
(__gthread_objc_data_tls): Use TLS_OUT_OF_INDEXES instead of (DWORD)-1.
(__gthread_objc_init_thread_system): Likewise.
(__gthread_objc_thread_get_data): Minor tweak.
(__gthread_objc_condition_allocate): Use ATTRIBUTE_UNUSED.
(__gthread_objc_condition_deallocate): Likewise.
(__gthread_objc_condition_wait): Likewise.
(__gthread_objc_condition_broadcast): Likewise.
(__gthread_objc_condition_signal): Likewise.
Include sys/time.h.
(__gthr_win32_DWORD): New typedef.
(__gthr_win32_HANDLE): Likewise.
(__gthr_win32_CRITICAL_SECTION): Likewise.
(__gthr_win32_CONDITION_VARIABLE): Likewise.
(__gthread_t): Adjust.
(__gthread_key_t): Likewise.
(__gthread_mutex_t): Likewise.
(__gthread_recursive_mutex_t): Likewise.
(__gthread_cond_t): New typedef.
(__gthread_time_t): Likewise.
(__GTHREAD_MUTEX_INIT_DEFAULT): Delete.
(__GTHREAD_RECURSIVE_MUTEX_INIT_DEFAULT): Likewise.
(__GTHREAD_COND_INIT_FUNCTION): Define.
(__GTHREAD_TIME_INIT): Likewise.
(__gthr_i486_lock_cmp_xchg): Delete.
(__gthr_win32_create): Declare.
(__gthr_win32_join): Likewise.
(__gthr_win32_self): Likewise.
(__gthr_win32_detach): Likewise.
(__gthr_win32_equal): Likewise.
(__gthr_win32_yield): Likewise.
(__gthr_win32_mutex_destroy): Likewise.
(__gthr_win32_cond_init_function): Likewise if __GTHREADS_HAS_COND is 1.
(__gthr_win32_cond_broadcast): Likewise.
(__gthr_win32_cond_signal): Likewise.
(__gthr_win32_cond_wait): Likewise.
(__gthr_win32_cond_timedwait): Likewise.
(__gthr_win32_recursive_mutex_init_function): Delete.
(__gthr_win32_recursive_mutex_lock): Likewise.
(__gthr_win32_recursive_mutex_unlock): Likewise.
(__gthr_win32_recursive_mutex_destroy): Likewise.
(__gthread_create): New inline function.
(__gthread_join): Likewise.
(__gthread_self): Likewise.
(__gthread_detach): Likewise.
(__gthread_equal): Likewise.
(__gthread_yield): Likewise.
(__gthread_cond_init_function): Likewise if __GTHREADS_HAS_COND is 1.
(__gthread_cond_broadcast): Likewise.
(__gthread_cond_signal): Likewise.
(__gthread_cond_wait): Likewise.
(__gthread_cond_timedwait): Likewise.
(__GTHREAD_WIN32_INLINE): New macro.
(__GTHREAD_WIN32_COND_INLINE): Likewise.
(__GTHREAD_WIN32_ACTIVE_P): Likewise.
Define WIN32_LEAN_AND_MEAN before including windows.h.
(__gthread_once): Minor tweaks.
(__gthread_key_create): Use ATTRIBUTE_UNUSED and TLS_OUT_OF_INDEXES.
(__gthread_key_delete): Minor tweak.
(__gthread_getspecific): Likewise.
(__gthread_setspecific): Likewise.
(__gthread_mutex_init_function): Reimplement.
(__gthread_mutex_destroy): Likewise.
(__gthread_mutex_lock): Likewise.
(__gthread_mutex_trylock): Likewise.
(__gthread_mutex_unlock): Likewise.
(__gthr_win32_abs_to_rel_time): Declare.
(__gthread_recursive_mutex_init_function): Reimplement.
(__gthread_recursive_mutex_destroy): Likewise.
(__gthread_recursive_mutex_lock): Likewise.
(__gthread_recursive_mutex_trylock): Likewise.
(__gthread_recursive_mutex_unlock): Likewise.
(__gthread_cond_destroy): New inline function.
(__gthread_cond_wait_recursive): Likewise.
* config/i386/gthr-win32.c: Delete everything.
Include gthr-win32.h to get the out-of-line version of inline routines.
Add compile-time checks for the local version of the Win32 types.
* config/i386/gthr-win32-cond.c: New file.
* config/i386/gthr-win32-thread.c: Likewise.
* config/i386/t-gthr-win32: Add config/i386/gthr-win32-thread.c to the
EH part, config/i386/gthr-win32-cond.c and config/i386/gthr-win32.c to
the static version of libgcc.
* config/i386/t-slibgcc-mingw: New file.
* config/i386/libgcc-mingw.ver: Likewise.
libstdc++-v3/
* acinclude.m4 (GLIBCXX_EXPORT_FLAGS): Substitute CPPFLAGS.
(GLIBCXX_ENABLE_LIBSTDCXX_TIME): Set ac_has_sched_yield and
ac_has_win32_sleep to yes for MinGW. Change HAVE_WIN32_SLEEP
into _GLIBCXX_USE_WIN32_SLEEP.
(GLIBCXX_CHECK_GTHREADS): Add _WIN32_THREADS to compilation flags for
Win32 threads and force _GTHREAD_USE_MUTEX_TIMEDLOCK to 0 for them.
Add -D_WIN32_WINNT=0x0600 to compilation flags if yes was configured
and add it to CPPFLAGS on success.
* config.h.in: Regenerate.
* configure: Likewise.
* config/os/mingw32-w64/os_defines.h (_GLIBCXX_USE_GET_NPROCS_WIN32):
Define to 1.
* config/os/mingw32/os_defines.h (_GLIBCXX_USE_GET_NPROCS_WIN32): Ditto
* src/c++11/thread.cc (get_nprocs): Provide Win32 implementation if
_GLIBCXX_USE_GET_NPROCS_WIN32 is defined. Replace HAVE_WIN32_SLEEP
with USE_WIN32_SLEEP.
* testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc: Add
missing conditional compilation.
* testsuite/lib/libstdc++.exp (check_v3_target_sleep): Add support for
_GLIBCXX_USE_WIN32_SLEEP.
(check_v3_target_nprocs): Likewise for _GLIBCXX_USE_GET_NPROCS_WIN32.
Signed-off-by: Eric Botcazou <ebotcazou@adacore.com>
Signed-off-by: Jonathan Yong <10walls@gmail.com>
|
|
2022-01-14 David <gccbugzilla@limegreensocks.com>
libgcc/
* config/i386/gthr-win32.c (__gthr_i486_lock_cmp_xchg):
Remove inlined version, Windows 95 is no longer relevant.
* config/i386/gthr-win32.h
(__GTHREAD_I486_INLINE_LOCK_PRIMITIVES): unset.
|
|
|
|
|
|
From-SVN: r279813
|
|
From-SVN: r267494
|
|
From-SVN: r256169
|
|
CC_NONE macro clash...
* config/i386/gthr-win32.h: Define NOGDI before
windows.h include to prevent w32api CC_NONE macro
clash with libgfortran.
From-SVN: r245835
|
|
From-SVN: r243994
|
|
From-SVN: r232055
|
|
PR libgcc/64885
* gthr-single.h: Use __unused__ attribute instead of unused.
* config/gthr-vxworks.h: Likewise.
* config/i386/gthr-win32.h: Likewise.
From-SVN: r221120
|
|
From-SVN: r219188
|
|
From-SVN: r206295
|
|
2013-09-17 Jacek Caban <jacek@codeweavers.com>
* config/i386/gthr-win32.c: CreateSemaphoreW instead of
CreateSemaphoreA.
* config/i386/gthr-win32.h: Likewise.
From-SVN: r202648
|
|
From-SVN: r195731
|
|
PR other/53889
* config/i386/gthr-win32.h (__gthread_recursive_mutex_destroy):
Fix parameter names.
From-SVN: r192114
|
|
libgcc:
PR other/53889
* gthr.h (__gthread_recursive_mutex_destroy): Document new required
function.
* gthr-posix.h (__gthread_recursive_mutex_destroy): Define.
* gthr-single.h (__gthread_recursive_mutex_destroy): Likewise.
* config/gthr-rtems.h (__gthread_recursive_mutex_destroy): Likewise.
* config/gthr-vxworks.h (__gthread_recursive_mutex_destroy): Likewise.
* config/i386/gthr-win32.h (__gthread_recursive_mutex_destroy):
Likewise.
* config/mips/gthr-mipssde.h (__gthread_recursive_mutex_destroy):
Likewise.
* config/pa/gthr-dce.h (__gthread_recursive_mutex_destroy): Likewise.
* config/s390/gthr-tpf.h (__gthread_recursive_mutex_destroy): Likewise.
libstdc++-v3:
PR other/53889
* include/std/mutex (__recursive_mutex_base::~__recursive_mutex_base):
Use __gthread_recursive_mutex_destroy.
(__recursive_mutex_base::_S_destroy): Remove.
(__recursive_mutex_base::_S_destroy_win32): Likewise.
* include/ext/concurrence.h (__recursive_mutex::~__recursive_mutex):
Use __gthread_recursive_mutex_destroy.
(__recursive_mutex::_S_destroy): Remove.
(__recursive_mutex::_S_destroy_win32): Likewise.
From-SVN: r192002
|
|
gcc:
* gthr-single.h, gthr.h: Move to ../libgcc.
* gthr-aix.h: Move to ../libgcc/config/rs6000.
* gthr-dce.h: Move to ../libgcc/config/pa.
* gthr-lynx.h: Move to ../libgcc/config.
* gthr-mipssde.h: Move to ../libgcc/config/mips.
* gthr-posix.h: Move to ../libgcc/config.
* gthr-rtems.h: Likewise.
* gthr-tpf.h: Move to ../libgcc/config/s390.
* gthr-vxworks.h: Move to ../libgcc/config.
* gthr-win32.h: Move to ../libgcc/config/i386.
* configure.ac (gthread_flags): Remove
(gthr-default.h): Don't create.
(thread_file): Don't substitute.
* configure: Regenerate.
* Makefile.in (GCC_THREAD_FILE): Remove.
(GTHREAD_FLAGS): Remove.
(libgcc.mvars): Remove GTHREAD_FLAGS.
* config/t-vxworks (EXTRA_HEADERS): Remove.
gcc/po:
* EXCLUDES (gthr-aix.h, gthr-dce.h, gthr-posix.c, gthr-posix.h)
(gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h)
(gthr-win32.h, gthr.h): Remove.
libgcc:
* gthr-single.h, gthr.h: New files.
* config/gthr-lynx.h, config/gthr-posix.h., config/gthr-rtems.h,
config/gthr-vxworks.h, config/i386/gthr-win32.h,
config/mips/gthr-mipssde.h, config/pa/gthr-dce.h,
config/rs6000/gthr-aix.h, config/s390/gthr-tpf.h: New files.
* config/i386/gthr-win32.c: Include "gthr-win32.h".
* configure.ac (thread_header): New variable.
Set it depending on target_thread_file.
(gthr-default.h): Link from $thread_header.
* configure: Regenerate.
* Makefile.in (LIBGCC2_CFLAGS): Remove $(GTHREAD_FLAGS).
libgfortran:
* Makefile.am (AM_CPPFLAGS): Add
-I$(srcdir)/$(MULTISRCTOP)../libgcc, -I$(MULTIBUILDTOP)../libgcc.
* Makefile.in: Regenerate.
* acinclude.m4 (LIBGFOR_CHECK_GTHR_DEFAULT): Remove.
* configure.ac (LIBGFOR_CHECK_GTHR_DEFAULT): Likewise.
* configure: Regenerate.
* config.h.in: Regenerate.
libobjc:
* Makefile.in (INCLUDES): Add -I$(MULTIBUILDTOP)../libgcc.
* configure.ac (target_thread_file, HAVE_GTHR_DEFAULT): Remove.
* configure: Regenerate.
* config.h.in: Regenerate.
libstdc++-v3:
* acinclude.m4 (GLIBCXX_CONFIGURE): Determine and substitute
toplevel_builddir.
(GLIBCXX_ENABLE_THREADS): Remove glibcxx_thread_h,
HAVE_GTHR_DEFAULT, enable_thread.
(GLIBCXX_CHECK_GTHREADS): Reflect gthr move to libgcc.
* include/Makefile.am (thread_host_headers): Remove
${host_builddir}/gthr-tpf.h.
(${host_builddir}/gthr.h): Reflect gthr move to libgcc.
Use $<.
(${host_builddir}/gthr-single.h): Likewise.
(${host_builddir}/gthr-posix.h): Likewise.
(${host_builddir}/gthr-tpf.h): Remove.
(${host_builddir}/gthr-default.h): Likewise.
* configure, config.h.in: Regenerate.
* Makefile.in, doc/Makefile.in, include/Makefile.in,
libsupc++/Makefile.in, po/Makefile.in, python/Makefile.in,
src/Makefile.intestsuite/Makefile.in: Regenerate.
From-SVN: r180776
|