Hi, I found that many libraries provided by mingw-w64-crt are actually empty,
for example, libmingwthrd and libmoldname. Unfortunately, they're still
hardcoded in GCC's default specs, so I'd like to first remove them from there,
then maybe in the future we can remove them from mingw-w64.
Note: The patch is below is for GCC, not for mingw-w64. I'm sending it here
first because I'm not 100% sure whether these libraries are kept for some
specific reason other than historic reason. It's worth noting that libcoldname
is also hardcoded in GCC's specs, but seemes like this is an old MinGW thing,
and
mingw-w64 never provide this.
BTW, I also found that crt{1,2}.o, crt{1,2}u.o, dllcrt{1,2}.o, and gcrt{0,1,2}.o
are pairwise identical (they're simply copied in Makefile.am). The use of these
startfiles in GCC's specs is somehow disordered. It looks like xxx1.o is usually
for -mcrtdll, and xxx2.o otherwise. Do we still need seperate object files for
potential flexibility (though I doubt this), or maybe we can always use the
xxx1.o
version?
---
>From aa772c7cb26d426ab79cb7bdd28206bef968ce39 Mon Sep 17 00:00:00 2001
From: Zhongteng Gui <[email protected]>
Date: Sun, 30 Aug 2026 00:48:16 +0800
Subject: [PATCH] mingw: Remove deprecated libs from spec
libmoldname and libmingwthrd have become dummy empty libraries since
2009, and libcoldname doesn't even exist now.
gcc/ChangeLog:
* config/i386/crtdll.h (LIBGCC_SPEC): Remove -lmingwthrd and
-lcoldname.
* config/i386/mingw-w64.h (LIBGCC_SPEC): Remove -lmingwthrd.
* config/mingw/mingw32.h (REAL_LIBGCC_SPEC): Remove -lmingwthrd,
-lcoldname, and -lmoldname.
libgcc/ChangeLog:
* config/i386/t-mingw32 (SHLIB_LC): Remove -lmingwthrd and
-lmoldname.
Signed-off-by: Zhongteng Gui <[email protected]>
---
gcc/config/i386/crtdll.h | 2 +-
gcc/config/i386/mingw-w64.h | 2 +-
gcc/config/mingw/mingw32.h | 3 +--
libgcc/config/i386/t-mingw32 | 2 +-
4 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/gcc/config/i386/crtdll.h b/gcc/config/i386/crtdll.h
index 1fea0b20d70..4d20469151e 100644
--- a/gcc/config/i386/crtdll.h
+++ b/gcc/config/i386/crtdll.h
@@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see
#undef LIBGCC_SPEC
#define LIBGCC_SPEC \
- "%{mthreads:-lmingwthrd} -lmingw32 -lgcc -lcoldname -libmingwex -lcrtdll"
+ "-lmingw32 -lgcc -libmingwex -lcrtdll"
/* Specify a different entry point when linking a DLL */
#undef STARTFILE_SPEC
diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h
index 5d71aa5358f..0a9f5247493 100644
--- a/gcc/config/i386/mingw-w64.h
+++ b/gcc/config/i386/mingw-w64.h
@@ -44,7 +44,7 @@ along with GCC; see the file COPYING3. If not see
#undef REAL_LIBGCC_SPEC
#define REAL_LIBGCC_SPEC \
- "%{mthreads:-lmingwthrd} -lmingw32 \
+ "-lmingw32 \
" SHARED_LIBGCC_SPEC " \
-lmingwex %{!mcrtdll=*:-lmsvcrt} %{mcrtdll=*:-l%*} \
-lkernel32 " MCFGTHREAD_SPEC
diff --git a/gcc/config/mingw/mingw32.h b/gcc/config/mingw/mingw32.h
index 3afbee65974..d1d5ed18cb0 100644
--- a/gcc/config/mingw/mingw32.h
+++ b/gcc/config/mingw/mingw32.h
@@ -202,9 +202,8 @@ along with GCC; see the file COPYING3. If not see
#endif
#undef REAL_LIBGCC_SPEC
#define REAL_LIBGCC_SPEC \
- "%{mthreads:-lmingwthrd} -lmingw32 \
+ "-lmingw32 \
" SHARED_LIBGCC_SPEC " \
- %{mcrtdll=crtdll*:-lcoldname} %{!mcrtdll=crtdll*:-lmoldname} \
-lmingwex %{!mcrtdll=*:-lmsvcrt} %{mcrtdll=*:-l%*} \
-lkernel32 " MCFGTHREAD_SPEC
diff --git a/libgcc/config/i386/t-mingw32 b/libgcc/config/i386/t-mingw32
index bfdef6723ce..540cd1b1b12 100644
--- a/libgcc/config/i386/t-mingw32
+++ b/libgcc/config/i386/t-mingw32
@@ -1,2 +1,2 @@
# MinGW-specific parts of LIB_SPEC
-SHLIB_LC = -lmingwthrd -lmingw32 -lmingwex -lmoldname -lmsvcrt -ladvapi32
-lshell32 -luser32 -lkernel32
+SHLIB_LC = -lmingw32 -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32
-lkernel32
--
2.55.0.windows.5
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public