On Sunday 30 August 2026 10:02:22 Kirill Makurin wrote: > Zhongteng Gui <[email protected]> wrote: > > > On 2026/08/30 15:44, Pali Rohár wrote: > >> On Sunday 30 August 2026 03:24:26 Kirill Makurin wrote: > >>> We also had briefly discussed an idea to move contents of libmingwex.a > >>> directly into import libraries (e.g. libucrt.a). The interaction between > >>> libmingwex.a and import libraries sometimes causes linker errors, e.g. > >>> when LTO is involved and import library references symbol from > >>> libmingwex.a or vice versa. If we did this, we would have to similarly > >>> make libmingwex.a empty so that older gcc/clang versions continue to work. > >> > >> I like this idea. But I'm still not sure if this would not cause other > >> issues. > >> > >> What I know is that there is still one problem that some symbols are > >> duplicated in libmingwex.a and in individual CRT DLL import libs. I have > >> tried to clean it up, but as I have figured out few days ago I found new > >> such symbols (e.g. _Exit). > > > > I think this is a good idea. Currently every libraries (mingw32, mingwex, > > msvcrt, etc.) are linked twice to solve circular dependencies in GCC > > (implicit) > > and Clang (explicit). If we finished this in the future maybe we could > > remove > > the duplicate linking from newer GCC and Clang. > > From looking at mingw-w64-crt/Makefile.am, one way I see how we can do this > is rename src_libmingwex_{arch} variables and add these source files to each > import library; it seems like src_msvcrt_common_add_{arch} variables can be > used for this. And then, simply use an empty file as sources for libmingwex.a. > > - Kirill Makurin
This would increase number of object files which needs to be produced because source files for each import library is compiled separately. And therefore it will slow down compilation of the whole mingw-w64. I would rather propose to rename libmingwex.a to something like libcrt_common.a, mark it to not be installed and then via MRI scripts merge this library into each CRT import library. This will ensure that source files are compiled only once (like now). (Of course then add a new empty libmingwex.a library which would be installed.) And same thing should be done with those "src_(pre|post)_msvcr*" source files. Each one can be compiled and put into own .a library and then via MRI script merged into appropriate import library. Because right now for example all files specified in "src_pre_msvcr120" are compiled for each CRT import library individually and in the same way. _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
