* [PATCH] Set _WIN32_WINNT in common.m4 configure check
@ 2023-01-09 14:47 Tom Tromey
2023-01-09 15:27 ` Tom Tromey
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Tom Tromey @ 2023-01-09 14:47 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
GCC recently added support for the Windows thread model, enabling
libstdc++ to support Windows natively. However, this supporrt
requires a version of Windows later than the minimum version that is
supported by GDB.
PR build/29966 points out that the GDB configure test for std::thread
does not work in this situation, because _WIN32_WINNT is not defined
in test program, and so <thread> seems to be fine.
This patch is an attempt to fix the problem, by using the same setting
for _WIN32_WINNT at configure time as is used at build time.
I don't have access to one of the older systems so I don't think I can
truly test this. I did do a mingw cross build, though. I'm going to
ask the bug reporter to test it.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29966
---
gdb/configure | 12 +++++++++++-
gdbserver/configure | 12 +++++++++++-
gdbsupport/common-defs.h | 4 +++-
gdbsupport/common.m4 | 13 ++++++++++++-
gdbsupport/configure | 12 +++++++++++-
5 files changed, 48 insertions(+), 5 deletions(-)
diff --git a/gdb/configure b/gdb/configure
index 0591d187f0a..0455af120f3 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -24969,7 +24969,17 @@ if ${gdb_cv_cxx_std_thread+:} false; then :
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <thread>
+ #if defined (__MINGW32__) || defined (__CYGWIN__)
+ # ifdef _WIN32_WINNT
+ # if _WIN32_WINNT < 0x0501
+ # undef _WIN32_WINNT
+ # define _WIN32_WINNT 0x0501
+ # endif
+ # else
+ # define _WIN32_WINNT 0x0501
+ # endif
+ #endif /* __MINGW32__ || __CYGWIN__ */
+ #include <thread>
void callback() { }
int
main ()
diff --git a/gdbserver/configure b/gdbserver/configure
index e5e0cb14d03..e807c60c08a 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -7951,7 +7951,17 @@ if ${gdb_cv_cxx_std_thread+:} false; then :
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <thread>
+ #if defined (__MINGW32__) || defined (__CYGWIN__)
+ # ifdef _WIN32_WINNT
+ # if _WIN32_WINNT < 0x0501
+ # undef _WIN32_WINNT
+ # define _WIN32_WINNT 0x0501
+ # endif
+ # else
+ # define _WIN32_WINNT 0x0501
+ # endif
+ #endif /* __MINGW32__ || __CYGWIN__ */
+ #include <thread>
void callback() { }
int
main ()
diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h
index bcebd7187d9..5e529f6febf 100644
--- a/gdbsupport/common-defs.h
+++ b/gdbsupport/common-defs.h
@@ -70,7 +70,9 @@
/* We don't support Windows versions before XP, so we define
_WIN32_WINNT correspondingly to ensure the Windows API headers
- expose the required symbols. */
+ expose the required symbols.
+
+ NOTE: this must be kept in sync with common.m4. */
#if defined (__MINGW32__) || defined (__CYGWIN__)
# ifdef _WIN32_WINNT
# if _WIN32_WINNT < 0x0501
diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
index c6b9a25b744..3909ec81ccb 100644
--- a/gdbsupport/common.m4
+++ b/gdbsupport/common.m4
@@ -100,7 +100,18 @@ AC_DEFUN([GDB_AC_COMMON], [
AC_CACHE_CHECK([for std::thread],
gdb_cv_cxx_std_thread,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
- [[#include <thread>
+ dnl NOTE: this must be kept in sync with common-defs.h.
+ [[#if defined (__MINGW32__) || defined (__CYGWIN__)
+ # ifdef _WIN32_WINNT
+ # if _WIN32_WINNT < 0x0501
+ # undef _WIN32_WINNT
+ # define _WIN32_WINNT 0x0501
+ # endif
+ # else
+ # define _WIN32_WINNT 0x0501
+ # endif
+ #endif /* __MINGW32__ || __CYGWIN__ */
+ #include <thread>
void callback() { }]],
[[std::thread t(callback);]])],
gdb_cv_cxx_std_thread=yes,
diff --git a/gdbsupport/configure b/gdbsupport/configure
index a0e4a3f94a4..9433ac41468 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -8967,7 +8967,17 @@ if ${gdb_cv_cxx_std_thread+:} false; then :
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <thread>
+ #if defined (__MINGW32__) || defined (__CYGWIN__)
+ # ifdef _WIN32_WINNT
+ # if _WIN32_WINNT < 0x0501
+ # undef _WIN32_WINNT
+ # define _WIN32_WINNT 0x0501
+ # endif
+ # else
+ # define _WIN32_WINNT 0x0501
+ # endif
+ #endif /* __MINGW32__ || __CYGWIN__ */
+ #include <thread>
void callback() { }
int
main ()
--
2.38.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Set _WIN32_WINNT in common.m4 configure check
2023-01-09 14:47 [PATCH] Set _WIN32_WINNT in common.m4 configure check Tom Tromey
@ 2023-01-09 15:27 ` Tom Tromey
2023-01-09 16:41 ` Eli Zaretskii
2023-01-11 17:30 ` Tom Tromey
2 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2023-01-09 15:27 UTC (permalink / raw)
To: Tom Tromey via Gdb-patches; +Cc: Tom Tromey
>>>>> "Tom" == Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> writes:
Tom> I don't have access to one of the older systems so I don't think I can
Tom> truly test this. I did do a mingw cross build, though. I'm going to
Tom> ask the bug reporter to test it.
BTW, if this works, I think we should consider it for GDB 13.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Set _WIN32_WINNT in common.m4 configure check
2023-01-09 14:47 [PATCH] Set _WIN32_WINNT in common.m4 configure check Tom Tromey
2023-01-09 15:27 ` Tom Tromey
@ 2023-01-09 16:41 ` Eli Zaretskii
2023-01-11 17:30 ` Tom Tromey
2 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2023-01-09 16:41 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
> Cc: Tom Tromey <tromey@adacore.com>
> Date: Mon, 9 Jan 2023 07:47:16 -0700
> From: Tom Tromey via Gdb-patches <gdb-patches@sourceware.org>
>
> GCC recently added support for the Windows thread model, enabling
> libstdc++ to support Windows natively. However, this supporrt
> requires a version of Windows later than the minimum version that is
> supported by GDB.
>
> PR build/29966 points out that the GDB configure test for std::thread
> does not work in this situation, because _WIN32_WINNT is not defined
> in test program, and so <thread> seems to be fine.
>
> This patch is an attempt to fix the problem, by using the same setting
> for _WIN32_WINNT at configure time as is used at build time.
>
> I don't have access to one of the older systems so I don't think I can
> truly test this. I did do a mingw cross build, though. I'm going to
> ask the bug reporter to test it.
The patch LGTM, but of course actually testing on an old system would
be the best.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Set _WIN32_WINNT in common.m4 configure check
2023-01-09 14:47 [PATCH] Set _WIN32_WINNT in common.m4 configure check Tom Tromey
2023-01-09 15:27 ` Tom Tromey
2023-01-09 16:41 ` Eli Zaretskii
@ 2023-01-11 17:30 ` Tom Tromey
2023-01-12 5:22 ` Joel Brobecker
2 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2023-01-11 17:30 UTC (permalink / raw)
To: Tom Tromey via Gdb-patches; +Cc: Tom Tromey, Joel Brobecker
>>>>> "Tom" == Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> writes:
Tom> GCC recently added support for the Windows thread model, enabling
Tom> libstdc++ to support Windows natively. However, this supporrt
Tom> requires a version of Windows later than the minimum version that is
Tom> supported by GDB.
Tom> PR build/29966 points out that the GDB configure test for std::thread
Tom> does not work in this situation, because _WIN32_WINNT is not defined
Tom> in test program, and so <thread> seems to be fine.
Tom> This patch is an attempt to fix the problem, by using the same setting
Tom> for _WIN32_WINNT at configure time as is used at build time.
Tom> I don't have access to one of the older systems so I don't think I can
Tom> truly test this. I did do a mingw cross build, though. I'm going to
Tom> ask the bug reporter to test it.
There turns out to also be some small problem in libstdc++ so this patch
can't fully be confirmed. However it also seems like an improvement, so
I am going to check it in.
Joel, I tend to think we should consider this for GDB 13. Without it,
GDB 13 won't build with a newer GCC on some older Windows systems.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Set _WIN32_WINNT in common.m4 configure check
2023-01-11 17:30 ` Tom Tromey
@ 2023-01-12 5:22 ` Joel Brobecker
0 siblings, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2023-01-12 5:22 UTC (permalink / raw)
To: Tom Tromey; +Cc: Tom Tromey via Gdb-patches, Joel Brobecker
Hi Tom,
> Tom> GCC recently added support for the Windows thread model, enabling
> Tom> libstdc++ to support Windows natively. However, this supporrt
> Tom> requires a version of Windows later than the minimum version that is
> Tom> supported by GDB.
>
> Tom> PR build/29966 points out that the GDB configure test for std::thread
> Tom> does not work in this situation, because _WIN32_WINNT is not defined
> Tom> in test program, and so <thread> seems to be fine.
>
> Tom> This patch is an attempt to fix the problem, by using the same setting
> Tom> for _WIN32_WINNT at configure time as is used at build time.
>
> Tom> I don't have access to one of the older systems so I don't think I can
> Tom> truly test this. I did do a mingw cross build, though. I'm going to
> Tom> ask the bug reporter to test it.
>
> There turns out to also be some small problem in libstdc++ so this patch
> can't fully be confirmed. However it also seems like an improvement, so
> I am going to check it in.
>
> Joel, I tend to think we should consider this for GDB 13. Without it,
> GDB 13 won't build with a newer GCC on some older Windows systems.
Thanks for the heads up, Tom. Sounds good to me!
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-12 5:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09 14:47 [PATCH] Set _WIN32_WINNT in common.m4 configure check Tom Tromey
2023-01-09 15:27 ` Tom Tromey
2023-01-09 16:41 ` Eli Zaretskii
2023-01-11 17:30 ` Tom Tromey
2023-01-12 5:22 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).