On Wednesday 23 October 2024 00:06:01 Martin Storsjö wrote: > On Tue, 22 Oct 2024, Pali Rohár wrote: > > > On Tuesday 22 October 2024 23:52:11 Martin Storsjö wrote: > > > On Sat, 19 Oct 2024, Pali Rohár wrote: > > > > > > > libmsvcrtd.a is import library for msvcrtd.dll and therefore it cannot > > > > include libmsvcrt_extra.a library which object files are compiled with > > > > -D__LIBMSVCRT_OS__ which instruct code to access msvcrt.dll library. > > > > > > > > Add a new static library libmsvcrtd_extra.a which is compiled from > > > > subset > > > > of libmsvcrt_extra.a sources which does not depend on msvcrt.dll and > > > > compile them without -D__LIBMSVCRT_OS__ option. Then use this new static > > > > library libmsvcrtd_extra.a for building the final libmsvcrtd.a import > > > > library. > > > > --- > > > > mingw-w64-crt/Makefile.am | 43 +++++++++++++++++++++++++++++++-- > > > > mingw-w64-crt/lib32/msvcrtd.mri | 2 +- > > > > 2 files changed, 42 insertions(+), 3 deletions(-) > > > > > > Thanks - this version does compile correctly. > > > > > > I'd like to point out, that this patch does add a bit of maintainance > > > burden > > > - there's yet another new src_<library> variable with a lot of source > > > files, > > > that needs to be taken into account whenever we move functions around > > > between the libraries. The rule for exactly which files from src_msvcrt > > > that > > > are included and which ones aren't, isn't very obvious either. (Include > > > all > > > files except the ones that trigger #error?) > > > > > > When judging whether we should add these debug variants of CRTs, one > > > factor > > > was/is how much extra maintainance burden they add; this new information > > > makes me wonder if we really do need an import library for this DLL at > > > all? > > > > > > // Martin > > > > This is just a way how source files are currently defined in the > > Makefile.am. > > Yes, but this adds yet another list that I'm not very interested in > maintaining. > > You didn't mention what the exact logic is for which files are included and > excluded compared with the list of files for the regular msvcrt.dll - I > think that should be spelled out somewhere.
I took files which did not cause compile errors. > > I was thinking about improving this situation by defining variables like > > src_up_to_msvcr100, src_up_to_msvcr80, ... as lot of source files are > > statically linked into more msvcr libraries. There is common pattern: > > if the msvcrX introduced function F then emulation of F is included in > > all versions prior X. And this should reduce the maintenance problems. > > Hmm, perhaps that would help with the duplication a bit - I'm not entirely > sure if that ends up more or less maintainable, but maybe it's good to try > and see what it ends up looking like? > > // Martin In the attachment is such attempt. What do you think about it? Viewing diff is not the best option, better is to apply it and look. Fix for msvcrtd would then look like this, which is pretty straightforward without any maintenance burden: diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 0be41ac39274..f6c2bc6e4d11 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -802,6 +802,12 @@ src_msvcrt40=\ $(src_pre_msvcr100) \ $(src_pre_msvcr120) +src_msvcrtd=\ + $(src_pre_msvcr70) \ + $(src_pre_msvcr80) \ + $(src_pre_msvcr100) \ + $(src_pre_msvcr120) + src_msvcr70=\ $(src_pre_msvcr80) \ $(src_pre_msvcr100) \
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 7db657ed7991..0be41ac39274 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -678,14 +678,7 @@ src_msvcrtarm64=\ stdio/_setmaxstdio.c \ stdio/gets.c -src_crtdll=\ - misc/crtdll__getmainargs.c \ - misc/crtdll__ismbblead.c \ - misc/crtdll_fstat.c \ - misc/crtdll_stat.c \ - math/x86/_copysignf.c \ - misc/___mb_cur_max_func.c \ - misc/__badioinfo.c \ +src_pre_msvcrt20=\ misc/__daylight.c \ misc/__initenv.c \ misc/__p___argc.c \ @@ -696,297 +689,153 @@ src_crtdll=\ misc/__p__commode.c \ misc/__p__environ.c \ misc/__p__fmode.c \ - misc/__p__mbctype.c \ - misc/__p__osplatform_emul.c \ misc/__p__osver.c \ - misc/__p__pgmptr.c \ misc/__p__pctype.c \ + misc/__p__pgmptr.c \ misc/__p__pwctype.c \ misc/__p__winmajor.c \ misc/__p__winminor.c \ misc/__p__winver.c \ - misc/__pctype_func.c \ - misc/__pwctype_func.c \ - misc/__set_app_type.c \ - misc/__sys_errlist.c \ - misc/__sys_nerr.c \ misc/__timezone.c \ misc/__tzname.c \ - misc/_configthreadlocale.c \ - misc/dummy__setusermatherr.c \ - misc/imaxabs.c \ - misc/imaxdiv.c \ - misc/invalid_parameter_handler.c \ - misc/isblank.c \ - misc/iswblank.c \ - misc/lc_locale_func.c \ - misc/mbrtowc.c \ - misc/output_format.c \ - misc/purecall.c \ - misc/_get_errno.c \ - misc/_set_errno.c \ - misc/strnlen.c \ - misc/strtoimax.c \ - misc/strtoumax.c \ - misc/wassert.c \ - misc/wcrtomb.c \ - misc/wcsnlen.c \ - misc/wcstoimax.c \ - misc/wcstoumax.c \ - misc/wctob.c \ - misc/wctrans.c \ - misc/wctype.c \ - stdio/_filelengthi64.c \ - stdio/_scprintf.c \ - stdio/_vscprintf.c \ - stdio/atoll.c \ - stdio/fgetpos.c \ - stdio/fsetpos.c \ - stdio/fseeki64.c \ - stdio/iob_func.c \ - stdio/mingw_dummy__lock.c \ - stdio/mingw_lock.c + stdio/iob_func.c -src_msvcrt10=\ - misc/crtdll__getmainargs.c \ - misc/msvcrt10__ismbblead.c \ - misc/___mb_cur_max_func.c \ - misc/__badioinfo.c \ - misc/__daylight.c \ - misc/__initenv.c \ - misc/__p___argc.c \ - misc/__p___argv.c \ - misc/__p___initenv.c \ - misc/__p___mb_cur_max.c \ - misc/__p__acmdln.c \ - misc/__p__commode.c \ - misc/__p__environ.c \ - misc/__p__fmode.c \ - misc/__p__osplatform_emul.c \ - misc/__p__osver.c \ - misc/__p__pctype.c \ - misc/__p__pgmptr.c \ - misc/__p__pwctype.c \ - misc/__p__winmajor.c \ - misc/__p__winminor.c \ - misc/__p__winver.c \ - misc/__pctype_func.c \ - misc/__pwctype_func.c \ +src_pre_msvcrt40=\ misc/__set_app_type.c \ - misc/__sys_errlist.c \ - misc/__sys_nerr.c \ - misc/__timezone.c \ - misc/__tzname.c \ - misc/_configthreadlocale.c \ - misc/btowc.c \ misc/dummy__setusermatherr.c \ - misc/imaxabs.c \ - misc/imaxdiv.c \ - misc/invalid_parameter_handler.c \ - misc/isblank.c \ - misc/iswblank.c \ - misc/lc_locale_func.c \ - misc/mbrtowc.c \ - misc/output_format.c \ - misc/purecall.c \ - misc/_get_errno.c \ - misc/_set_errno.c \ - misc/strnlen.c \ - misc/strtoimax.c \ - misc/strtoumax.c \ - misc/wassert.c \ - misc/wcrtomb.c \ - misc/wcsnlen.c \ - misc/wcstoimax.c \ - misc/wcstoumax.c \ - misc/wctob.c \ - misc/wctrans.c \ - misc/wctype.c \ stdio/_filelengthi64.c \ - stdio/_scprintf.c \ - stdio/_vscprintf.c \ - stdio/atoll.c \ stdio/fgetpos.c \ - stdio/fsetpos.c \ - stdio/fseeki64.c \ - stdio/iob_func.c \ - stdio/mingw_dummy__lock.c \ - stdio/mingw_lock.c + stdio/fsetpos.c -src_msvcrt20=\ - misc/msvcrt20__getmainargs.c \ - misc/msvcrt20__wgetmainargs.c \ - misc/___mb_cur_max_func.c \ +src_pre_msvcrt60=\ misc/__badioinfo.c \ misc/__p__osplatform_emul.c \ - misc/__pctype_func.c \ - misc/__pwctype_func.c \ - misc/__set_app_type.c \ - misc/__sys_errlist.c \ - misc/__sys_nerr.c \ - misc/_configthreadlocale.c \ - misc/btowc.c \ - misc/dummy__setusermatherr.c \ - misc/imaxabs.c \ - misc/imaxdiv.c \ - misc/invalid_parameter_handler.c \ - misc/isblank.c \ - misc/iswblank.c \ - misc/lc_locale_func.c \ - misc/mbrtowc.c \ - misc/output_format.c \ - misc/purecall.c \ - misc/_get_errno.c \ - misc/_set_errno.c \ - misc/strnlen.c \ - misc/strtoimax.c \ - misc/strtoumax.c \ - misc/wassert.c \ - misc/wcrtomb.c \ - misc/wcsnlen.c \ - misc/wcstoimax.c \ - misc/wcstoumax.c \ - misc/wctob.c \ - misc/wctrans.c \ - misc/wctype.c \ - stdio/_filelengthi64.c \ - stdio/_scprintf.c \ - stdio/_vscprintf.c \ stdio/atoll.c \ - stdio/fgetpos.c \ - stdio/fsetpos.c \ - stdio/fseeki64.c \ - stdio/mingw_dummy__lock.c \ - stdio/mingw_lock.c + stdio/mingw_dummy__lock.c -src_msvcrt40=\ +src_pre_msvcr70=\ misc/___mb_cur_max_func.c \ - misc/__badioinfo.c \ - misc/__p__osplatform_emul.c \ misc/__pctype_func.c \ misc/__pwctype_func.c \ - misc/__sys_errlist.c \ - misc/__sys_nerr.c \ - misc/_configthreadlocale.c \ - misc/btowc.c \ - misc/imaxabs.c \ - misc/imaxdiv.c \ - misc/invalid_parameter_handler.c \ - misc/isblank.c \ - misc/iswblank.c \ misc/lc_locale_func.c \ - misc/mbrtowc.c \ - misc/output_format.c \ misc/purecall.c \ - misc/_get_errno.c \ - misc/_set_errno.c \ - misc/strnlen.c \ misc/strtoimax.c \ misc/strtoumax.c \ - misc/wassert.c \ - misc/wcrtomb.c \ - misc/wcsnlen.c \ misc/wcstoimax.c \ misc/wcstoumax.c \ - misc/wctob.c \ - misc/wctrans.c \ - misc/wctype.c \ stdio/_scprintf.c \ - stdio/_vscprintf.c \ - stdio/atoll.c \ - stdio/fseeki64.c \ - stdio/mingw_dummy__lock.c \ - stdio/mingw_lock.c + stdio/_vscprintf.c -src_msvcr70=\ - misc/__p__osplatform.c \ +src_pre_msvcr80=\ misc/__sys_errlist.c \ misc/__sys_nerr.c \ misc/_configthreadlocale.c \ - misc/btowc.c \ - misc/imaxabs.c \ - misc/imaxdiv.c \ - misc/invalid_parameter_handler.c \ - misc/isblank.c \ - misc/iswblank.c \ - misc/mbrtowc.c \ - misc/output_format.c \ misc/_get_errno.c \ misc/_set_errno.c \ - misc/strnlen.c \ - misc/wassert.c \ - misc/wcrtomb.c \ - misc/wcsnlen.c \ - misc/wctob.c \ - misc/wctrans.c \ - misc/wctype.c \ - stdio/_fstat64i32.c \ - stdio/fseeki64.c \ - stdio/mingw_lock.c - -src_msvcr71=\ - misc/__p__osplatform.c \ - misc/__sys_errlist.c \ - misc/__sys_nerr.c \ - misc/_configthreadlocale.c \ misc/btowc.c \ misc/imaxabs.c \ - misc/imaxdiv.c \ misc/invalid_parameter_handler.c \ - misc/isblank.c \ - misc/iswblank.c \ misc/mbrtowc.c \ misc/output_format.c \ - misc/_get_errno.c \ - misc/_set_errno.c \ misc/strnlen.c \ misc/wassert.c \ misc/wcrtomb.c \ misc/wcsnlen.c \ misc/wctob.c \ - misc/wctrans.c \ - misc/wctype.c \ stdio/_fstat64i32.c \ stdio/fseeki64.c \ stdio/mingw_lock.c -src_msvcr80=\ - misc/imaxdiv.c \ +src_pre_msvcr100=\ + misc/imaxdiv.c + +src_pre_msvcr120=\ misc/isblank.c \ misc/iswblank.c \ misc/wctrans.c \ misc/wctype.c -src_msvcr90=\ +src_post_msvcr80=\ misc/__p__osplatform_emul.c \ - misc/__p__osver_emul.c \ - misc/imaxdiv.c \ - misc/isblank.c \ - misc/iswblank.c \ - misc/wctrans.c \ - misc/wctype.c + misc/__p__osver_emul.c + +src_crtdll=\ + $(src_pre_msvcrt20) \ + $(src_pre_msvcrt40) \ + $(src_pre_msvcrt60) \ + $(src_pre_msvcr70) \ + $(src_pre_msvcr80) \ + $(src_pre_msvcr100) \ + $(src_pre_msvcr120) \ + misc/crtdll__getmainargs.c \ + misc/crtdll__ismbblead.c \ + misc/crtdll_fstat.c \ + misc/crtdll_stat.c \ + math/x86/_copysignf.c \ + misc/__p__mbctype.c + +src_msvcrt10=\ + $(src_pre_msvcrt20) \ + $(src_pre_msvcrt40) \ + $(src_pre_msvcrt60) \ + $(src_pre_msvcr70) \ + $(src_pre_msvcr80) \ + $(src_pre_msvcr100) \ + $(src_pre_msvcr120) \ + misc/crtdll__getmainargs.c \ + misc/msvcrt10__ismbblead.c + +src_msvcrt20=\ + $(src_pre_msvcrt40) \ + $(src_pre_msvcrt60) \ + $(src_pre_msvcr70) \ + $(src_pre_msvcr80) \ + $(src_pre_msvcr100) \ + $(src_pre_msvcr120) \ + misc/msvcrt20__getmainargs.c \ + misc/msvcrt20__wgetmainargs.c + +src_msvcrt40=\ + $(src_pre_msvcrt60) \ + $(src_pre_msvcr70) \ + $(src_pre_msvcr80) \ + $(src_pre_msvcr100) \ + $(src_pre_msvcr120) + +src_msvcr70=\ + $(src_pre_msvcr80) \ + $(src_pre_msvcr100) \ + $(src_pre_msvcr120) \ + misc/__p__osplatform.c + +src_msvcr71=\ + $(src_pre_msvcr80) \ + $(src_pre_msvcr100) \ + $(src_pre_msvcr120) \ + misc/__p__osplatform.c + +src_msvcr80=\ + $(src_pre_msvcr100) \ + $(src_pre_msvcr120) + +src_msvcr90=\ + $(src_pre_msvcr100) \ + $(src_pre_msvcr120) \ + $(src_post_msvcr80) src_msvcr100=\ - misc/__p__osplatform_emul.c \ - misc/__p__osver_emul.c \ - misc/isblank.c \ - misc/iswblank.c \ - misc/wctrans.c \ - misc/wctype.c + $(src_pre_msvcr120) \ + $(src_post_msvcr80) src_msvcr110=\ - misc/__p__osplatform_emul.c \ - misc/__p__osver_emul.c \ - misc/isblank.c \ - misc/iswblank.c \ - misc/wctrans.c \ - misc/wctype.c + $(src_pre_msvcr120) \ + $(src_post_msvcr80) src_msvcr120=\ - misc/__p__osplatform_emul.c \ - misc/__p__osver_emul.c + $(src_post_msvcr80) src_msvcr120_app=\ + $(src_post_msvcr80) \ misc/__p___initenv.c \ misc/__p___winitenv.c \ misc/__p__environ.c \
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
