Re: [Mingw-w64-public] [PATCH] crt: Move get/put _nolock functions from libmingwex.a to libmvscr*.a
在 2021-07-14 19:38, Martin Storsjö 写道: This avoids any risk of pulling in these when linking with UCRT. UCRT does provide these same functions, and the libmingwex.a implementation relies on symbols like _flsbuf which don't exist in UCRT. Signed-off-by: Martin Storsjö --- mingw-w64-crt/Makefile.am | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) LGTM. -- Best regards, LIU Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Fix printf formatting of %a on arm/aarch64 with __USE_MINGW_ANSI_STDIO
在 2021-07-13 17:21, Martin Storsjö 写道: The mingw_pformat.c code converts all input floats to an 80 bit float representation and analyzes that struct when printing the float. This was already fixed in ceb4c4fd4b696e96bbe174ce4abc065d43e9ac87, but one case in was missed. Factorize the conversion from 64 to 80 bit floats to a function used to intialize the __pformat_fpreg_t struct. Signed-off-by: Martin Storsjö --- mingw-w64-crt/stdio/mingw_pformat.c | 46 - 1 file changed, 26 insertions(+), 20 deletions(-) This patch looks good itself. (Is it necessary to take this 64->80->string approach on ARM? It seems to me an overkill.) -- Best regards, LIU Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] Patch WS2 Inline Functions
Yes I double checked and it appears I'm able to take the address of these functions even when they are static. This means last patch I sent that uses __mingw_ovr should work fine. On Tue, Jul 13, 2021 at 11:52 PM Martin Storsjö wrote: > On Tue, 13 Jul 2021, Jonathan Marler wrote: > > > I think the ideal solution would allow programs to take the address of > these > > functions since MSVC allows it. > > Well even with static inline, their address can be taken just fine, it's > just not identical across all translation units. I don't see that as a big > issue here, so I'd be fine with going with that approach. > > // Martin > > ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] clock_nanosleep(CLOCK_MONOTONIC ...
在 2021-07-10 00:02, Burkhardt, Glenn B Collins via Mingw-w64-public 写道: I'm curious - why does the implementation of 'clock_nanosleep()' not work with CLOCK_MONOTONIC, while 'clock_gettime()' does? Is there anything preventing an implementation? I don't think there is. The reason is probably that nobody needed it. Patches are welcome. -- Best regards, LIU Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] headers: Implement the _bittest* intrinsics for arm and aarch64
On Wed, 14 Jul 2021, LIU Hao wrote: 在 7/14/21 9:02 PM, Martin Storsjö 写道: +unsigned char _bittestandset(__LONG32 *__a, __LONG32 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a |= (1 << __b); I suggest `1UL` here, as shifting 1 to the left by 31 is undefined behavior. Thanks, will update all these. // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH v2] headers: Implement the _bittest* intrinsics for arm and aarch64
These are non-atomic versions corresponding to the existing _interlockedbittest* - therefore they're implemented as plain C instead of assembly. Additionally, there are plain intrinsics "_bittest" and "_bittest64", where there's no corresponding interlocked version. Signed-off-by: Martin Storsjö --- .../include/psdk_inc/intrin-impl.h| 117 ++ 1 file changed, 117 insertions(+) diff --git a/mingw-w64-headers/include/psdk_inc/intrin-impl.h b/mingw-w64-headers/include/psdk_inc/intrin-impl.h index d59682c18..3db454b14 100644 --- a/mingw-w64-headers/include/psdk_inc/intrin-impl.h +++ b/mingw-w64-headers/include/psdk_inc/intrin-impl.h @@ -1424,6 +1424,123 @@ unsigned char _BitScanReverse64(unsigned __LONG32 *Index, unsigned __int64 Mask) #endif /* __INTRINSIC_PROLOG */ #endif /* defined(__aarch64__) || define(_ARM64_) */ + +#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) + +#if __INTRINSIC_PROLOG(_bittest) +unsigned char _bittest(const __LONG32 *__a, __LONG32 __b); +#if !__has_builtin(_bittest) +__INTRINSICS_USEINLINE +unsigned char _bittest(const __LONG32 *__a, __LONG32 __b) +{ +return (*__a >> __b) & 1; +} +#endif +#define __INTRINSIC_DEFINED__bittest +#endif /* __INTRINSIC_PROLOG */ + +#if __INTRINSIC_PROLOG(_bittestandset) +unsigned char _bittestandset(__LONG32 *__a, __LONG32 __b); +#if !__has_builtin(_bittestandset) +__INTRINSICS_USEINLINE +unsigned char _bittestandset(__LONG32 *__a, __LONG32 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a |= (1UL << __b); +return __v; +} +#endif +#define __INTRINSIC_DEFINED__bittestandset +#endif /* __INTRINSIC_PROLOG */ + +#if __INTRINSIC_PROLOG(_bittestandreset) +unsigned char _bittestandreset(__LONG32 *__a, __LONG32 __b); +#if !__has_builtin(_bittestandreset) +__INTRINSICS_USEINLINE +unsigned char _bittestandreset(__LONG32 *__a, __LONG32 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a &= ~(1UL << __b); +return __v; +} +#endif +#define __INTRINSIC_DEFINED__bittestandreset +#endif /* __INTRINSIC_PROLOG */ + +#if __INTRINSIC_PROLOG(_bittestandcomplement) +unsigned char _bittestandcomplement(__LONG32 *a, __LONG32 b); +#if !__has_builtin(_bittestandcomplement) +__INTRINSICS_USEINLINE +unsigned char _bittestandcomplement(__LONG32 *__a, __LONG32 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a = (*__a & ~(1UL << __b)) | ((__v ^ 1) << __b); +return __v; +} +#endif +#define __INTRINSIC_DEFINED__bittestandcomplement +#endif /* __INTRINSIC_PROLOG */ + +#endif /* defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) */ + +#if defined(__aarch64__) || defined(_ARM64_) + +#if __INTRINSIC_PROLOG(_bittest64) +unsigned char _bittest64(const __int64 *__a, __int64 __b); +#if !__has_builtin(_bittest64) +__INTRINSICS_USEINLINE +unsigned char _bittest64(const __int64 *__a, __int64 __b) +{ +return (*__a >> __b) & 1; +} +#endif +#define __INTRINSIC_DEFINED__bittest64 +#endif /* __INTRINSIC_PROLOG */ + +#if __INTRINSIC_PROLOG(_bittestandset64) +unsigned char _bittestandset64(__int64 *__a, __int64 __b); +#if !__has_builtin(_bittestandset64) +__INTRINSICS_USEINLINE +unsigned char _bittestandset64(__int64 *__a, __int64 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a |= (1ULL << __b); +return __v; +} +#endif +#define __INTRINSIC_DEFINED__bittestandset64 +#endif /* __INTRINSIC_PROLOG */ + +#if __INTRINSIC_PROLOG(_bittestandreset64) +unsigned char _bittestandreset64(__int64 *__a, __int64 __b); +#if !__has_builtin(_bittestandreset64) +__INTRINSICS_USEINLINE +unsigned char _bittestandreset64(__int64 *__a, __int64 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a &= ~(1ULL << __b); +return __v; +} +#endif +#define __INTRINSIC_DEFINED__bittestandreset64 +#endif /* __INTRINSIC_PROLOG */ + +#if __INTRINSIC_PROLOG(_bittestandcomplement64) +unsigned char _bittestandcomplement64(__int64 *a, __int64 b); +#if !__has_builtin(_bittestandcomplement64) +__INTRINSICS_USEINLINE +unsigned char _bittestandcomplement64(__int64 *__a, __int64 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a = (*__a & ~(1ULL << __b)) | ((__int64)(__v ^ 1) << __b); +return __v; +} +#endif +#define __INTRINSIC_DEFINED__bittestandcomplement64 +#endif /* __INTRINSIC_PROLOG */ + +#endif /* defined(__aarch64__) || define(_ARM64_) */ + /* * */ #if defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) -- 2.25.1 ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Fix printf formatting of %a on arm/aarch64 with __USE_MINGW_ANSI_STDIO
On Thu, 15 Jul 2021, LIU Hao wrote: 在 2021-07-13 17:21, Martin Storsjö 写道: The mingw_pformat.c code converts all input floats to an 80 bit float representation and analyzes that struct when printing the float. This was already fixed in ceb4c4fd4b696e96bbe174ce4abc065d43e9ac87, but one case in was missed. Factorize the conversion from 64 to 80 bit floats to a function used to intialize the __pformat_fpreg_t struct. Signed-off-by: Martin Storsjö --- mingw-w64-crt/stdio/mingw_pformat.c | 46 - 1 file changed, 26 insertions(+), 20 deletions(-) This patch looks good itself. Thanks, pushed. (Is it necessary to take this 64->80->string approach on ARM? It seems to me an overkill.) Yes, it's indeed overkill, but it feels like more effort to tweak all the formatting code to work with two float representations, with more risk of missing some case, or possibly ending up with more duplicated code. (Also in general, there's less need for our own implementation on ARM with UCRT, as the system one is generally modern and the long double stuff doesn't mismatch like it does on x86.) // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] headers: Import propvarutil.h from wine
在 2021-07-13 23:36, Biswapriyo Nath 写道: 0001-headers-Import-propvarutil.h-from-wine.patch From ad16f9d5f67e64860b09541a7f285e10434c4884 Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Tue, 13 Jul 2021 21:03:36 +0530 Subject: [PATCH] headers: Import propvarutil.h from wine This reverts d603db2c1544a26c7e1153208b660f1c0f0f21d7 commit. The added functions are required for qt6-multimedia v6.2.0. Signed-off-by: Biswapriyo Nath --- mingw-w64-headers/wine-import.sh | 1 + 1 file changed, 1 insertion(+) Thanks. I pushed this patch to master. -- Best regards, LIU Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH] headers: Implement the _bittest* intrinsics for arm and aarch64
These are non-atomic versions corresponding to the existing _interlockedbittest* - therefore they're implemented as plain C instead of assembly. Additionally, there are plain intrinsics "_bittest" and "_bittest64", where there's no corresponding interlocked version. Signed-off-by: Martin Storsjö --- .../include/psdk_inc/intrin-impl.h| 117 ++ 1 file changed, 117 insertions(+) diff --git a/mingw-w64-headers/include/psdk_inc/intrin-impl.h b/mingw-w64-headers/include/psdk_inc/intrin-impl.h index d59682c18..d0651a654 100644 --- a/mingw-w64-headers/include/psdk_inc/intrin-impl.h +++ b/mingw-w64-headers/include/psdk_inc/intrin-impl.h @@ -1424,6 +1424,123 @@ unsigned char _BitScanReverse64(unsigned __LONG32 *Index, unsigned __int64 Mask) #endif /* __INTRINSIC_PROLOG */ #endif /* defined(__aarch64__) || define(_ARM64_) */ + +#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) + +#if __INTRINSIC_PROLOG(_bittest) +unsigned char _bittest(const __LONG32 *__a, __LONG32 __b); +#if !__has_builtin(_bittest) +__INTRINSICS_USEINLINE +unsigned char _bittest(const __LONG32 *__a, __LONG32 __b) +{ +return (*__a >> __b) & 1; +} +#endif +#define __INTRINSIC_DEFINED__bittest +#endif /* __INTRINSIC_PROLOG */ + +#if __INTRINSIC_PROLOG(_bittestandset) +unsigned char _bittestandset(__LONG32 *__a, __LONG32 __b); +#if !__has_builtin(_bittestandset) +__INTRINSICS_USEINLINE +unsigned char _bittestandset(__LONG32 *__a, __LONG32 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a |= (1 << __b); +return __v; +} +#endif +#define __INTRINSIC_DEFINED__bittestandset +#endif /* __INTRINSIC_PROLOG */ + +#if __INTRINSIC_PROLOG(_bittestandreset) +unsigned char _bittestandreset(__LONG32 *__a, __LONG32 __b); +#if !__has_builtin(_bittestandreset) +__INTRINSICS_USEINLINE +unsigned char _bittestandreset(__LONG32 *__a, __LONG32 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a &= ~(1 << __b); +return __v; +} +#endif +#define __INTRINSIC_DEFINED__bittestandreset +#endif /* __INTRINSIC_PROLOG */ + +#if __INTRINSIC_PROLOG(_bittestandcomplement) +unsigned char _bittestandcomplement(__LONG32 *a, __LONG32 b); +#if !__has_builtin(_bittestandcomplement) +__INTRINSICS_USEINLINE +unsigned char _bittestandcomplement(__LONG32 *__a, __LONG32 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a = (*__a & ~(1 << __b)) | ((__v ^ 1) << __b); +return __v; +} +#endif +#define __INTRINSIC_DEFINED__bittestandcomplement +#endif /* __INTRINSIC_PROLOG */ + +#endif /* defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) */ + +#if defined(__aarch64__) || defined(_ARM64_) + +#if __INTRINSIC_PROLOG(_bittest64) +unsigned char _bittest64(const __int64 *__a, __int64 __b); +#if !__has_builtin(_bittest64) +__INTRINSICS_USEINLINE +unsigned char _bittest64(const __int64 *__a, __int64 __b) +{ +return (*__a >> __b) & 1; +} +#endif +#define __INTRINSIC_DEFINED__bittest64 +#endif /* __INTRINSIC_PROLOG */ + +#if __INTRINSIC_PROLOG(_bittestandset64) +unsigned char _bittestandset64(__int64 *__a, __int64 __b); +#if !__has_builtin(_bittestandset64) +__INTRINSICS_USEINLINE +unsigned char _bittestandset64(__int64 *__a, __int64 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a |= (1LL << __b); +return __v; +} +#endif +#define __INTRINSIC_DEFINED__bittestandset64 +#endif /* __INTRINSIC_PROLOG */ + +#if __INTRINSIC_PROLOG(_bittestandreset64) +unsigned char _bittestandreset64(__int64 *__a, __int64 __b); +#if !__has_builtin(_bittestandreset64) +__INTRINSICS_USEINLINE +unsigned char _bittestandreset64(__int64 *__a, __int64 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a &= ~(1LL << __b); +return __v; +} +#endif +#define __INTRINSIC_DEFINED__bittestandreset64 +#endif /* __INTRINSIC_PROLOG */ + +#if __INTRINSIC_PROLOG(_bittestandcomplement64) +unsigned char _bittestandcomplement64(__int64 *a, __int64 b); +#if !__has_builtin(_bittestandcomplement64) +__INTRINSICS_USEINLINE +unsigned char _bittestandcomplement64(__int64 *__a, __int64 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a = (*__a & ~(1LL << __b)) | ((__int64)(__v ^ 1) << __b); +return __v; +} +#endif +#define __INTRINSIC_DEFINED__bittestandcomplement64 +#endif /* __INTRINSIC_PROLOG */ + +#endif /* defined(__aarch64__) || define(_ARM64_) */ + /* * */ #if defined(__x86_64__) || defined(_AMD64_) || defined(__i386__) || defined(_X86_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) -- 2.25.1 ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] headers: Implement the _bittest* intrinsics for arm and aarch64
在 7/14/21 9:02 PM, Martin Storsjö 写道: +unsigned char _bittestandset(__LONG32 *__a, __LONG32 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a |= (1 << __b); I suggest `1UL` here, as shifting 1 to the left by 31 is undefined behavior. +unsigned char _bittestandreset(__LONG32 *__a, __LONG32 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a &= ~(1 << __b); Likewise. +unsigned char _bittestandcomplement(__LONG32 *__a, __LONG32 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a = (*__a & ~(1 << __b)) | ((__v ^ 1) << __b); Likewise. +unsigned char _bittestandset64(__int64 *__a, __int64 __b) +{ +unsigned char __v = (*__a >> __b) & 1; +*__a |= (1LL << __b); Likewise, but `1ULL`, and more follow. -- Best regards, LIU Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH] RFC: crt: Use intermediate libraries to build object files shared across all libmsvcr*.a and libucrt*.a
This avoids compiling the object files that go into libmsvcrt*.a 10 times, and object files that go into libucrt*.a twice. This reduces the number of built object files for a build for i686 from 885 to 747, and shrinks the generate Makefile.in from 9.8 MB to 8.9 MB, by emitting per-object rules for fewer object files. This in itself isn't a huge saving, but there's a general trend of wanting to move more object files from libmingwex.a into libmvscr*.a, to allow UCRT builds to use the UCRT provided version of functions instead of statically linking our own version. And moving object files in that direction is a bit costly currently as each of them end up compiled multiple times. Signed-off-by: Martin Storsjö --- This builds a separate (non-installed) static library from the def files (named _def.a), and then merges that with the intermediate static libraries containing the shared object files. If there's suggestions on ways of doing it more straightforwardly, I'm all ears. FWIW, llvm-ar actually has a (nonstandard/new) option 'L' for merging one static library into another one, but as GNU ar doesn't have it, we have to stick to mri scripts for merging static libraries. We might be able to get away with just creating the target .a from the def file and then merging in the object files directly into it (with "OPEN " instead of "CREATE " in the mri script), but llvm-ar doesn't support the OPEN command in mri scripts; in practice those extra intermediate libs aren't an issue. --- mingw-w64-crt/Makefile.am | 312 +++--- mingw-w64-crt/lib-common/crtdll.mri | 5 + mingw-w64-crt/lib-common/msvcr100.mri | 5 + mingw-w64-crt/lib-common/msvcr110.mri | 5 + mingw-w64-crt/lib-common/msvcr120.mri | 5 + mingw-w64-crt/lib-common/msvcr120_app.mri | 6 + mingw-w64-crt/lib-common/msvcr120d.mri| 5 + mingw-w64-crt/lib-common/msvcr80.mri | 5 + mingw-w64-crt/lib-common/msvcr80_64.mri | 6 + mingw-w64-crt/lib-common/msvcr90.mri | 5 + mingw-w64-crt/lib-common/msvcr90d.mri | 5 + mingw-w64-crt/lib-common/msvcrt-os.mri| 6 + mingw-w64-crt/lib-common/ucrtbase.mri | 5 + 13 files changed, 213 insertions(+), 162 deletions(-) create mode 100644 mingw-w64-crt/lib-common/crtdll.mri create mode 100644 mingw-w64-crt/lib-common/msvcr100.mri create mode 100644 mingw-w64-crt/lib-common/msvcr110.mri create mode 100644 mingw-w64-crt/lib-common/msvcr120.mri create mode 100644 mingw-w64-crt/lib-common/msvcr120_app.mri create mode 100644 mingw-w64-crt/lib-common/msvcr120d.mri create mode 100644 mingw-w64-crt/lib-common/msvcr80.mri create mode 100644 mingw-w64-crt/lib-common/msvcr80_64.mri create mode 100644 mingw-w64-crt/lib-common/msvcr90.mri create mode 100644 mingw-w64-crt/lib-common/msvcr90d.mri create mode 100644 mingw-w64-crt/lib-common/msvcrt-os.mri create mode 100644 mingw-w64-crt/lib-common/ucrtbase.mri diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index edfbfc5f2..4b557105b 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -176,7 +176,6 @@ src_msvcrt_common=\ math/frexp.c src_msvcrt=\ - $(src_msvcrt_common) \ misc/_configthreadlocale.c \ misc/invalid_parameter_handler.c \ misc/output_format.c \ @@ -397,7 +396,6 @@ src_msvcrtarm64=\ stdio/gets.c src_msvcr80_64=\ - $(src_msvcrt_common) \ misc/__p___argv.c \ misc/__p__acmdln.c \ misc/__p__commode.c \ @@ -405,7 +403,6 @@ src_msvcr80_64=\ misc/__p__wcmdln.c src_msvcr120_app=\ - $(src_msvcrt_common) \ misc/__set_app_type.c \ misc/_getpid.c @@ -666,11 +663,9 @@ lib32_DATA += lib32/libmsvcrt.a lib32/libmsvcrt.a: lib32/@MSVCRT_LIB@ cp $< $@ -lib32_LIBRARIES += lib32/libmsvcrt-os.a -lib32_libmsvcrt_os_a_SOURCES = $(src_msvcrt32) lib-common/msvcrt.def.in -lib32_libmsvcrt_os_a_AR = $(DTDEF32) lib32/msvcrt.def && $(AR) $(ARFLAGS) -lib32_libmsvcrt_os_a_CPPFLAGS=$(CPPFLAGS32) -D__LIBMSVCRT__ $(extra_include) $(sysincludes) -EXTRA_lib32_libmsvcrt_os_a_DEPENDENCIES=lib32/msvcrt.def +lib32_DATA += lib32/libmsvcrt-os.a +lib32/libmsvcrt-os.a: lib-common/msvcrt-os.mri lib32/libmsvcrt_def.a lib32/libmsvcrt_common.a lib32/libmsvcrt_extra.a + cd $(dir $@) && $(AR) -M < $(abspath $<) endif lib32_LIBRARIES += lib32/libshell32.a @@ -837,67 +832,54 @@ include lib32/Makefile.am if !W32API lib32_DATA += lib32/libglut.a lib32/libmsvcp60.a lib32/libmsvcp120_app.a -lib32_LIBRARIES += lib32/libcrtdll.a -lib32_libcrtdll_a_SOURCES = $(src_msvcrt_common) -lib32_libcrtdll_a_AR = $(DTDEF32) $(top_srcdir)/lib32/crtdll.def && $(AR) $(ARFLAGS) -lib32_libcrtdll_a_CPPFLAGS=$(CPPFLAGS32) -D__LIBMSVCRT__ $(extra_include) $(sysincludes) - -lib32_LIBRARIES += lib32/libmsvcr80.a -lib32_libmsvcr80_a_SOURCES = $(src_msvcrt_common) lib32/msvcr80.def.in -lib32_libmsvcr80_a_AR = $(DTDEF32) lib32/msvcr80.def && $(AR) $(ARFLAGS) -lib32_libmsvcr80_a_CPPFLAGS=$(CPPFLAGS32) -D__LIBMSVCRT__
[Mingw-w64-public] [PATCH] crt: Move get/put _nolock functions from libmingwex.a to libmvscr*.a
This avoids any risk of pulling in these when linking with UCRT. UCRT does provide these same functions, and the libmingwex.a implementation relies on symbols like _flsbuf which don't exist in UCRT. Signed-off-by: Martin Storsjö --- mingw-w64-crt/Makefile.am | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index edfbfc5f2..c1d32111e 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -170,6 +170,10 @@ src_msvcrt_common=\ misc/uchar_mbrtoc16.c \ misc/uchar_mbrtoc32.c \ misc/wcrtomb.c \ + stdio/_getc_nolock.c \ + stdio/_getwc_nolock.c \ + stdio/_putc_nolock.c \ + stdio/_putwc_nolock.c \ stdio/acrt_iob_func.c \ stdio/snprintf_alias.c \ stdio/vsnprintf_alias.c \ @@ -486,8 +490,8 @@ src_libmingwex=\ stdio/vfscanf2.S stdio/vfwscanf2.S stdio/vscanf2.S stdio/vsscanf2.S stdio/vswscanf2.S \ stdio/vwscanf2.S stdio/strtok_r.c stdio/scanf.S \ stdio/_Exit.cstdio/_findfirst64i32.c stdio/_findnext64i32.c stdio/_fstat.c \ - stdio/_fstat64i32.c stdio/_ftime.cstdio/_getc_nolock.c stdio/_getwc_nolock.c stdio/_putc_nolock.c\ - stdio/_putwc_nolock.cstdio/_stat.c stdio/_stat64i32.c stdio/_wfindfirst64i32.c stdio/_wfindnext64i32.c \ + stdio/_fstat64i32.c stdio/_ftime.c \ + stdio/_stat.cstdio/_stat64i32.cstdio/_wfindfirst64i32.c stdio/_wfindnext64i32.c \ stdio/_wstat.c stdio/_wstat64i32.c stdio/asprintf.c stdio/atoll.c stdio/fgetpos64.c \ stdio/fopen64.c stdio/fseeko32.c stdio/fseeko64.c stdio/fsetpos64.c stdio/ftello.c \ stdio/ftello64.c stdio/ftruncate64.c stdio/lltoa.c stdio/lltow.c stdio/lseek64.c \ -- 2.25.1 ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Move get/put _nolock functions from libmingwex.a to libmvscr*.a
On Wed, 14 Jul 2021, Martin Storsjö wrote: This avoids any risk of pulling in these when linking with UCRT. UCRT does provide these same functions, and the libmingwex.a implementation relies on symbols like _flsbuf which don't exist in UCRT. Signed-off-by: Martin Storsjö --- mingw-w64-crt/Makefile.am | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) FWIW, with the current makefile setup, this innocuous patch grows the generated Makefile.in by over 1700 lines. With the "RFC: crt: Use intermediate libraries" patch in place, it grows by 8 lines only - just to showcase the "why" of that patch. // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] RFC: crt: Use intermediate libraries to build object files shared across all libmsvcr*.a and libucrt*.a
On Wed, 14 Jul 2021, Martin Storsjö wrote: This avoids compiling the object files that go into libmsvcrt*.a 10 times, and object files that go into libucrt*.a twice. This reduces the number of built object files for a build for i686 from 885 to 747, and shrinks the generate Makefile.in from 9.8 MB to 8.9 MB, by emitting per-object rules for fewer object files. This in itself isn't a huge saving, but there's a general trend of wanting to move more object files from libmingwex.a into libmvscr*.a, to allow UCRT builds to use the UCRT provided version of functions instead of statically linking our own version. And moving object files in that direction is a bit costly currently as each of them end up compiled multiple times. Signed-off-by: Martin Storsjö --- This builds a separate (non-installed) static library from the def files (named _def.a), and then merges that with the intermediate static libraries containing the shared object files. If there's suggestions on ways of doing it more straightforwardly, I'm all ears. FWIW, llvm-ar actually has a (nonstandard/new) option 'L' for merging one static library into another one, but as GNU ar doesn't have it, we have to stick to mri scripts for merging static libraries. We might be able to get away with just creating the target .a from the def file and then merging in the object files directly into it (with "OPEN " instead of "CREATE " in the mri script), but llvm-ar doesn't support the OPEN command in mri scripts; in practice those extra intermediate libs aren't an issue. --- mingw-w64-crt/Makefile.am | 312 +++--- mingw-w64-crt/lib-common/crtdll.mri | 5 + mingw-w64-crt/lib-common/msvcr100.mri | 5 + mingw-w64-crt/lib-common/msvcr110.mri | 5 + mingw-w64-crt/lib-common/msvcr120.mri | 5 + mingw-w64-crt/lib-common/msvcr120_app.mri | 6 + mingw-w64-crt/lib-common/msvcr120d.mri| 5 + mingw-w64-crt/lib-common/msvcr80.mri | 5 + mingw-w64-crt/lib-common/msvcr80_64.mri | 6 + mingw-w64-crt/lib-common/msvcr90.mri | 5 + mingw-w64-crt/lib-common/msvcr90d.mri | 5 + mingw-w64-crt/lib-common/msvcrt-os.mri| 6 + mingw-w64-crt/lib-common/ucrtbase.mri | 5 + 13 files changed, 213 insertions(+), 162 deletions(-) create mode 100644 mingw-w64-crt/lib-common/crtdll.mri create mode 100644 mingw-w64-crt/lib-common/msvcr100.mri create mode 100644 mingw-w64-crt/lib-common/msvcr110.mri create mode 100644 mingw-w64-crt/lib-common/msvcr120.mri create mode 100644 mingw-w64-crt/lib-common/msvcr120_app.mri create mode 100644 mingw-w64-crt/lib-common/msvcr120d.mri create mode 100644 mingw-w64-crt/lib-common/msvcr80.mri create mode 100644 mingw-w64-crt/lib-common/msvcr80_64.mri create mode 100644 mingw-w64-crt/lib-common/msvcr90.mri create mode 100644 mingw-w64-crt/lib-common/msvcr90d.mri create mode 100644 mingw-w64-crt/lib-common/msvcrt-os.mri create mode 100644 mingw-w64-crt/lib-common/ucrtbase.mri diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index edfbfc5f2..4b557105b 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -1245,6 +1220,12 @@ lib64/lib%.a: lib64/%.def lib64/lib%.a: lib-common/%.def $(DTDEF64) $< +lib64/lib%_def.a: lib64/%.def + $(DTDEF32) $< FWIW this is a typo here, it should be DTDEF64, in case someone wants to try out the patch. // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public