Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Default to Vista APIs (0x0600) when _WIN32_WINNT is undefined
@ 2026-11-19 17:56 Nikita.Venkatesh
  2026-11-19 20:49 ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Nikita.Venkatesh @ 2026-11-19 17:56 UTC (permalink / raw)
  To: gdb-patches; +Cc: nd, Nikita Venkatesh

From: Nikita Venkatesh <Nikita.Venkatesh@arm.com>

GCC13 added win32 C++11 threading support that requires
Windows Vista (0x0600) condition variable APIs. GDB's
XP default hides the required declarations, causing
GDB compilation to fail.

With --enable-threading, configure stops with an error. With automatic
detection, configure disables GDB threading, but compilation later
fails because other libstdc++ headers still require those declarations.

The following discussions were considered:
https://sourceware.org/pipermail/gdb/2022-November/050448.html
https://sourceware.org/pipermail/gdb-patches/2024-May/209176.html

Including <sdkddkver.h> as suggested in the 2024 discussion,
does not resolve this with Ubuntu 24.04's mingw-w64 headers.
It instead defaults to 0x0502, which is below the required
0x0600.

Default to 0x0600 only when _WIN32_WINNT is undefined. Preserve the
existing XP minimum for already defined and higher values. An
explicitly selected XP target is preserved. However, builds using
GCC's native Win32 C++11 threading support require Vista or later.

Verified that full MinGW GCC 13 builds succeed with both automatic
threading detection and explicit --enable-threading.
---
 gdb/configure            |  2 +-
 gdbserver/configure      |  2 +-
 gdbsupport/common-defs.h | 10 ++++++----
 gdbsupport/common.m4     |  2 +-
 gdbsupport/configure     |  2 +-
 5 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/gdb/configure b/gdb/configure
index e747ffce49f..39cbc817657 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -21168,7 +21168,7 @@ else
     #   define _WIN32_WINNT 0x0501
     #  endif
     # else
-    #  define _WIN32_WINNT 0x0501
+    #  define _WIN32_WINNT 0x0600
     # endif
     #endif	/* __MINGW32__ || __CYGWIN__ */
     #include <thread>
diff --git a/gdbserver/configure b/gdbserver/configure
index e00e1e1c1c5..cebef407494 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -9363,7 +9363,7 @@ else
     #   define _WIN32_WINNT 0x0501
     #  endif
     # else
-    #  define _WIN32_WINNT 0x0501
+    #  define _WIN32_WINNT 0x0600
     # endif
     #endif	/* __MINGW32__ || __CYGWIN__ */
     #include <thread>
diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h
index 1c0ae0ad9d1..38e1d3402e4 100644
--- a/gdbsupport/common-defs.h
+++ b/gdbsupport/common-defs.h
@@ -83,9 +83,11 @@
 #define _FORTIFY_SOURCE 2
 #endif
 
-/* We don't support Windows versions before XP, so we define
-   _WIN32_WINNT correspondingly to ensure the Windows API headers
-   expose the required symbols.
+/* We don't support Windows versions before XP, so ensure that
+   _WIN32_WINNT is atleast 0x0501 when already defined.
+
+   If it is undefined, default to 0x0600 because GCC's native
+   win32 C++11 threading support requires Windows Vista APIs.
 
    NOTE: this must be kept in sync with common.m4.  */
 #if defined (__MINGW32__) || defined (__CYGWIN__)
@@ -95,7 +97,7 @@
 #   define _WIN32_WINNT 0x0501
 #  endif
 # else
-#  define _WIN32_WINNT 0x0501
+#  define _WIN32_WINNT 0x0600
 # endif
 #endif	/* __MINGW32__ || __CYGWIN__ */
 
diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
index bf21c31d78d..4ee949d0be4 100644
--- a/gdbsupport/common.m4
+++ b/gdbsupport/common.m4
@@ -132,7 +132,7 @@ AC_CHECK_HEADERS([ \
     #   define _WIN32_WINNT 0x0501
     #  endif
     # else
-    #  define _WIN32_WINNT 0x0501
+    #  define _WIN32_WINNT 0x0600
     # endif
     #endif	/* __MINGW32__ || __CYGWIN__ */
     #include <thread>
diff --git a/gdbsupport/configure b/gdbsupport/configure
index 7ed4e259ffe..74e4551e4a8 100755
--- a/gdbsupport/configure
+++ b/gdbsupport/configure
@@ -12264,7 +12264,7 @@ else
     #   define _WIN32_WINNT 0x0501
     #  endif
     # else
-    #  define _WIN32_WINNT 0x0501
+    #  define _WIN32_WINNT 0x0600
     # endif
     #endif	/* __MINGW32__ || __CYGWIN__ */
     #include <thread>
-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-26 16:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 17:56 [PATCH] Default to Vista APIs (0x0600) when _WIN32_WINNT is undefined Nikita.Venkatesh
2026-11-19 20:49 ` Tom Tromey
2026-11-20  7:23   ` Eli Zaretskii
2026-11-25 16:48     ` [PATCH v2] Default to Vista APIs for MinGW-w64 when no version is selected Nikita.Venkatesh
2026-11-25 17:36       ` Eli Zaretskii
2026-11-26 16:53         ` [PATCH v3] " Nikita.Venkatesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox