On 2/26/26 11:34, Jonathan Yong wrote:
Fixed incorrect attempts to build a libgdiagnostics by naming it
as a DLL when gcc is configured as a cross compiler that targets
mingw but hosted on non-Windows systems.

Patch OK?

gcc/ChangeLog:

         * Makefile.in: the libgdiagnostics shared object for mingw
         should be based on host name, not target name.


Attached updated patch that also fixes the installation targets.
From 14b4c5195e9541d21c18ef079eac72df188c2d42 Mon Sep 17 00:00:00 2001
From: Jonathan Yong <[email protected]>
Date: Thu, 26 Feb 2026 11:24:13 +0000
Subject: [PATCH] gcc: libgdiagnostics DLL for mingw should be for mingw hosts

Fixed incorrect attempts to build a libgdiagnostics by naming it
as a DLL when gcc is configured as a cross compiler that targets
mingw but hosted on non-Windows systems.

gcc/ChangeLog:

	* Makefile.in: the libgdiagnostics shared object for mingw
	should be based on host name, not target name.

Signed-off-by: Jonathan Yong <[email protected]>
---
 gcc/Makefile.in | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 81c5045e326..2a0a66988b1 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1133,7 +1133,7 @@ ALL_LINKERFLAGS = $(ALL_CXXFLAGS) $(LD_PICFLAG)
 
 # Use the "pic" build of libiberty if --enable-host-shared or --enable-host-pie,
 # unless we are building for mingw.
-LIBIBERTY_PICDIR=$(if $(findstring mingw,$(target)),,pic)
+LIBIBERTY_PICDIR=$(if $(findstring mingw,$(host)),,pic)
 ifneq ($(enable_host_shared)$(enable_host_pie),)
 LIBIBERTY = ../libiberty/$(LIBIBERTY_PICDIR)/libiberty.a
 else
@@ -2373,7 +2373,7 @@ LIBGDIAGNOSTICS_VERSION_NUM = 0
 LIBGDIAGNOSTICS_MINOR_NUM = 0
 LIBGDIAGNOSTICS_RELEASE_NUM = 1
 
-ifneq (,$(findstring mingw,$(target)))
+ifneq (,$(findstring mingw,$(host)))
 LIBGDIAGNOSTICS_FILENAME = libgdiagnostics-$(LIBGDIAGNOSTICS_VERSION_NUM).dll
 LIBGDIAGNOSTICS_IMPORT_LIB = libgdiagnostics.dll.a
 
@@ -2446,7 +2446,7 @@ libgdiagnostics.serial = $(LIBGDIAGNOSTICS_FILENAME)
 # Tell GNU make to ignore these if they exist.
 .PHONY: libgdiagnostics
 
-ifneq (,$(findstring mingw,$(target)))
+ifneq (,$(findstring mingw,$(host)))
 # Create import library
 LIBGDIAGNOSTICS_EXTRA_OPTS = -Wl,--out-implib,$(LIBGDIAGNOSTICS_IMPORT_LIB)
 else
@@ -2474,7 +2474,7 @@ $(LIBGDIAGNOSTICS_FILENAME): $(libgdiagnostics_OBJS) $(CPPLIB) $(EXTRA_GCC_LIBS)
 	@$(call LINK_PROGRESS,$(INDEX.libgdiagnostics),end)
 
 # Create symlinks when not building for Windows
-ifeq (,$(findstring mingw,$(target)))
+ifeq (,$(findstring mingw,$(host)))
 
 ifeq (,$(findstring darwin,$(host)))
 # but only one level for Darwin, version info is embedded.
@@ -4293,7 +4293,7 @@ libgdiagnostics.install-headers: installdirs
 	$(INSTALL_DATA) $(srcdir)/libgdiagnostics++.h \
 	  $(DESTDIR)$(includedir)/libgdiagnostics++.h
 
-ifneq (,$(findstring mingw,$(target)))
+ifneq (,$(findstring mingw,$(host)))
 libgdiagnostics.install-common: installdirs libgdiagnostics.install-headers
 # Install import library
 	$(INSTALL_PROGRAM) $(LIBGDIAGNOSTICS_IMPORT_LIB) \
-- 
2.53.0

Reply via email to