From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WwIlFc4cB2uSWj0AWB0awg (envelope-from ) for ; Wed, 25 Nov 2026 12:37:18 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=QqFVKeet; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 392BA1E166; Wed, 25 Nov 2026 12:37:18 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 405291E023 for ; Wed, 25 Nov 2026 12:37:17 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E3D2243F49BA for ; Wed, 25 Nov 2026 17:37:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E3D2243F49BA Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=QqFVKeet Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 13353448E9EE for ; Wed, 25 Nov 2026 17:36:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 13353448E9EE Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 13353448E9EE Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1795628210; cv=none; b=A5xPFogvxFVqBLegZ+df2xgNJrtnoyAXGFWhHlHVqii8180FP1BB8OblUlFHtLMg4hShVLa7B95CvBdtbAiLJ0dHmouypzS1iCfzMscQDhHcXkjnUev4/mn3QTdFThqUce8GkmPXW7yjEpn44CZEj6vb8H8QbtVNSis/hHStKiI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1795628210; c=relaxed/simple; bh=16eN7cm4QLWwruckr6XCOjczGN3Uz1/iHox56mRFWgg=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=KV/UwpqWNxujGgzxiWWXpm8+WJelkOnMN1fdp3ede71+5fSUNvkkFJ/aXd2WMpNOgfR0s7d/Ai4G7L1XMIiLlR+fBhu1322DuXUivHDEiTgEQw4oBf7eWt5xuvQFo6xmUlArDwZbRASPRRxT4jUXqhkyRsJSo47rCYSl5fNibXs= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=QqFVKeet DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 13353448E9EE Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xWGvH-0007GA-9H; Wed, 25 Nov 2026 12:36:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=AlhZUVD+3oibMzXTRVofLlD2EI35H4DyALNYhZ2GtQ4=; b=QqFVKeetemWZ UhNHd6KNbZ8x5v99+R1QJJzllFvqpI39LEcCXPi4OPIqCkLu9duILkDV8I3zduZwdeKn2D+zbaY6j xzSYaerl4+hroSst2uLFsXaSGVjKt/QsnlcX+iO+sYpITbPpxO+kz8JEWyNgUOpeHlVF6u2EWyyPr xPmBpZHdGN9gTBI6OBqqmp+WaqHjKs7G9ydXvN+ou9q2GktVP+j284/SxP4QZz2qWVmDf4RVyVgeF +jHAM/Y+qnDaY9I1bH6wmyVj0Jmy3DRbpgO/XDE8tX2i9qcSo/fxFBqNjW67B01KFBtFdPd2Sm+ze h6Xb9VDx7RNUtZvRQmdH4A==; Date: Wed, 25 Nov 2026 19:36:28 +0200 Message-Id: <861p88ertv.fsf@gnu.org> From: Eli Zaretskii To: Nikita.Venkatesh@arm.com Cc: gdb-patches@sourceware.org, tromey@adacore.com, nd@arm.com In-Reply-To: <20261125164851.416291-1-Nikita.Venkatesh@arm.com> Subject: Re: [PATCH v2] Default to Vista APIs for MinGW-w64 when no version is selected References: <86pkw0j796.fsf@gnu.org> <20261125164851.416291-1-Nikita.Venkatesh@arm.com> X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org > From: Nikita.Venkatesh@arm.com > Cc: eliz@gnu.org, > tromey@adacore.com, > nd@arm.com, > Nikita Venkatesh > Date: Wed, 25 Nov 2026 16:48:51 +0000 > > From: Nikita Venkatesh > > 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. > > Detect MinGW-w64 during configure by including <_mingw.h> and checking > for MINGW64_VERSION_MAJOR. Record the result in GDB_USING_MINGW_W64. > > Use this result in common-defs.h and the configure threading test > to default to 0x0600 for MinGW-w64 when _WIN32_WINNT is undefined. > Keep the 0x0501 default for other configurations and preserve the > existing handling of explicitly defined values. > > 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 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. > > Verified that full MinGW GCC 13 builds succeed with both automatic > threading detection and explicit --enable-threading. > --- > > Changes in v2: > - Detect MinGW-w64 during configure. > - Default to Vista APIs only for MinGW-w64 when _WIN32_WINNT > is undefined, retaining the XP default otherwise. > > OK for trunk? > > gdb/config.in | 3 +++ > gdb/configure | 56 ++++++++++++++++++++++++++++++++++++++++ > gdbserver/config.in | 3 +++ > gdbserver/configure | 56 ++++++++++++++++++++++++++++++++++++++++ > gdbsupport/common-defs.h | 11 +++++--- > gdbsupport/common.m4 | 25 ++++++++++++++++++ > gdbsupport/config.in | 3 +++ > gdbsupport/configure | 56 ++++++++++++++++++++++++++++++++++++++++ > 8 files changed, 210 insertions(+), 3 deletions(-) Thanks. > diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h > index 1c0ae0ad9d1..41c21d8e985 100644 > --- a/gdbsupport/common-defs.h > +++ b/gdbsupport/common-defs.h > @@ -83,9 +83,12 @@ > #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 Vista (0x600) APIs for > + MinGW-w64 and XP (0x501) APIs otherwise. GCC's native Win32 > + C++11 threading support requires Vista APIs. > > NOTE: this must be kept in sync with common.m4. */ > #if defined (__MINGW32__) || defined (__CYGWIN__) > @@ -94,6 +97,8 @@ > # undef _WIN32_WINNT > # define _WIN32_WINNT 0x0501 > # endif > +# elif defined (GDB_USING_MINGW_W64) > +# define _WIN32_WINNT 0x0600 > # else > # define _WIN32_WINNT 0x0501 > # endif AFAIU, you want to define _WIN32_WINNT to 0x0600 even if it _is_ defined, but to a lower value, no? If so, I think the branch where _WIN32_WINNT is defined but to a smaller value also needs to be adjusted, right? The conditions look now like this: #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__ */ I think when GDB_USING_MINGW_W64 is defined, you want 0x0600 as the minimal value, not 0x0501. Or am I missing something? Reviewed-By: Eli Zaretskii