Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/4] gdb: recognize *-*-windows* Windows targets
Date: Tue, 14 Jul 2026 01:45:04 +0100	[thread overview]
Message-ID: <20260714004507.1323332-2-pedro@palves.net> (raw)
In-Reply-To: <20260714004507.1323332-1-pedro@palves.net>

Clang's default target on Windows uses the "windows-msvc" OS in its
triplet, e.g. x86_64-pc-windows-msvc, i686-pc-windows-msvc, and
aarch64-pc-windows-msvc.  This is different from MinGW triplets -- it
means that the compiler produces binaries following the Windows/MSVC
ABI, not the GNU ABI.

config.sub already canonicalizes these, but gdb/configure.tgt has no
entry for the "windows" OS.  Configuring GDB for such a target does
not fail.  The per-CPU section of configure.tgt still matches on the
CPU, so gdb_target_obs is non-empty and the "configuration ... is
unsupported" check does not trigger, but the resulting GDB has no
Windows support at all -- none of the windows-tdep.o and friends are
pulled in, and no Windows OS ABI is selected.

Fix this my extending the i386, x86_64 and aarch64 Windows entries to
also match "*-windows*", and map the "windows" OS to
GDB_OSABI_WINDOWS, so that Windows target triplets spelled with the
"windows" OS select the same target objects and OS ABI as their MinGW
counterparts.

The GNU/MinGW and MSVC ABIs are not actually identical (long double,
the C++ ABI, and so on differ), so a later commit will introduce a
distinct OS ABI for the MSVC case.  For now, reusing GDB_OSABI_WINDOWS
is enough to make these configurations build.

Note: even though config.sub does not support "windows-gnu" today,
Clang and Rust support it, as an alias for MinGW.  Clang also accepts
plain "windows", treating it as MSVC.  That's why the patch matches
"windows*".  Also, this is what is already used in bfd, anyhow:

 bfd/configure.host:81:*-*-windows*)
 bfd/acinclude.m4:24:*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
 ...

Change-Id: I14a0030efc388ae3dc5f34b2580849c41219e2bd
---
 gdb/configure.tgt | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 362de60065c..f473f67d8bd 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -155,8 +155,8 @@ aarch64*-*-linux*)
 			symfile-mem.o linux-record.o"
 	;;
 
-aarch64-*-mingw*)
-        # Target: MingW/aarch64
+aarch64-*-mingw* | aarch64-*-windows*)
+        # Target: Windows/aarch64
 	gdb_target_obs="aarch64-windows-tdep.o windows-tdep.o"
         ;;
 
@@ -339,11 +339,7 @@ i[34567]86-*-gnu*)
 	# Target: Intel 386 running the GNU Hurd
 	gdb_target_obs="i386-gnu-tdep.o glibc-tdep.o solib-svr4.o"
 	;;
-i[34567]86-*-cygwin*)
-	# Target: Intel 386 running win32
-	gdb_target_obs="i386-windows-tdep.o windows-tdep.o"
-	;;
-i[34567]86-*-mingw32*)
+i[34567]86-*-cygwin* | i[34567]86-*-mingw32* | i[34567]86-*-windows*)
 	# Target: Intel 386 running win32
 	gdb_target_obs="i386-windows-tdep.o windows-tdep.o"
 	;;
@@ -739,8 +735,8 @@ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
 	gdb_target_obs="amd64-fbsd-tdep.o ${i386_tobjs} \
 			i386-bsd-tdep.o i386-fbsd-tdep.o"
 	;;
-x86_64-*-mingw* | x86_64-*-cygwin*)
-        # Target: MingW/amd64
+x86_64-*-mingw* | x86_64-*-cygwin* | x86_64-*-windows*)
+        # Target: Windows/amd64
 	gdb_target_obs="amd64-windows-tdep.o \
                         ${i386_tobjs} i386-windows-tdep.o \
                         windows-tdep.o"
@@ -826,7 +822,7 @@ m68*-*-openbsd* | m88*-*-openbsd* | vax-*-openbsd*) ;;
 *-*-*-gnu*)	;; # prevent non-GNU kernels to match the Hurd rule below
 *-*-gnu*)	gdb_osabi=GDB_OSABI_HURD ;;
 *-*-mingw32ce*)	gdb_osabi=GDB_OSABI_WINCE ;;
-*-*-mingw*)	gdb_osabi=GDB_OSABI_WINDOWS ;;
+*-*-mingw* | *-*-windows*)	gdb_osabi=GDB_OSABI_WINDOWS ;;
 *-*-cygwin*)	gdb_osabi=GDB_OSABI_CYGWIN ;;
 *-*-dicos*)	gdb_osabi=GDB_OSABI_DICOS ;;
 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*)
-- 
2.54.0


  reply	other threads:[~2026-07-14  0:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14  0:45 [PATCH 0/4] Support the Windows/MSVC target in GDB Pedro Alves
2026-07-14  0:45 ` Pedro Alves [this message]
2026-07-14  0:45 ` [PATCH 2/4] gdb: treat Windows host + Windows target as native Pedro Alves
2026-07-14  0:45 ` [PATCH 3/4] gdb: distinguish GNU and MSVC flavors of the Windows OS ABI Pedro Alves
2026-07-14 11:57   ` Eli Zaretskii
2026-07-14 22:15     ` Pedro Alves
2026-07-15  1:21       ` Simon Marchi
2026-07-15 11:18         ` Pedro Alves
2026-07-15 13:13           ` Simon Marchi
2026-07-15 14:10             ` Pedro Alves
2026-07-15 15:51               ` Simon Marchi
2026-07-15 11:43       ` Eli Zaretskii
2026-07-14  0:45 ` [PATCH 4/4] gdb: MSVC "long double" is a 64-bit double Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260714004507.1323332-2-pedro@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox