[Mingw-w64-public] [PATCH] Add _ftime aliases for all msvcr versions
Hello all, I'm currently adding (some basic) MinGW support to the D code which was recently merged into GCC9. The D runtime library already has full windows support, developed by DMD and LLVM D compiler devs. However, this needs MSVC runtime versions >= 120. So I'm now trying to add proper support for targeting newer MSVC libs to the GCC/MinGW ecosystem. It turns out libgomp uses _ftime, but this symbol is only exposed for msvcrt.dll and I get linker errors for any other MSVC version. Therefore this patch adds the _ftime aliases to all msvcr .def files. According to timeb.h, there should be a _ftime symbol which maps to _ftime64 on _WIN64 and _ftime32 for anything else. This is my first MinGW patch, so please feel free to point out if there's anything wrong with the patch. BTW: How do you handle branches for the patches? The attached patch is against the v6.x branch. Best regards, Johannes Signed-off-by: Johannes Pfau --- mingw-w64-crt/lib32/msvcr100.def.in | 1 + mingw-w64-crt/lib32/msvcr110.def.in | 1 + mingw-w64-crt/lib32/msvcr120.def.in | 1 + mingw-w64-crt/lib32/msvcr120_app.def.in | 1 + mingw-w64-crt/lib32/msvcr120d.def.in| 1 + mingw-w64-crt/lib32/msvcr90.def.in | 1 + mingw-w64-crt/lib32/msvcr90d.def.in | 1 + mingw-w64-crt/lib64/msvcr100.def.in | 1 + mingw-w64-crt/lib64/msvcr110.def.in | 1 + mingw-w64-crt/lib64/msvcr120.def.in | 1 + mingw-w64-crt/lib64/msvcr120_app.def.in | 1 + mingw-w64-crt/lib64/msvcr120d.def.in| 1 + mingw-w64-crt/lib64/msvcr90.def.in | 1 + mingw-w64-crt/lib64/msvcr90d.def.in | 1 + mingw-w64-crt/libarm32/msvcr110.def | 1 + mingw-w64-crt/libarm32/msvcr120_clr0400.def | 1 + 16 files changed, 16 insertions(+) diff --git a/mingw-w64-crt/lib32/msvcr100.def.in b/mingw-w64-crt/lib32/msvcr100.def.in index d103a2b0..53ccd37b 100644 --- a/mingw-w64-crt/lib32/msvcr100.def.in +++ b/mingw-w64-crt/lib32/msvcr100.def.in @@ -896,6 +896,7 @@ _ftime32 _ftime32_s _ftime64 _ftime64_s +_ftime == _ftime32 _ftol _fullpath _futime32 diff --git a/mingw-w64-crt/lib32/msvcr110.def.in b/mingw-w64-crt/lib32/msvcr110.def.in index 7296955b..920677bc 100644 --- a/mingw-w64-crt/lib32/msvcr110.def.in +++ b/mingw-w64-crt/lib32/msvcr110.def.in @@ -1019,6 +1019,7 @@ _ftime32 _ftime32_s _ftime64 _ftime64_s +_ftime == _ftime32 _ftol _fullpath _futime32 diff --git a/mingw-w64-crt/lib32/msvcr120.def.in b/mingw-w64-crt/lib32/msvcr120.def.in index 57122cbf..c1e2af84 100644 --- a/mingw-w64-crt/lib32/msvcr120.def.in +++ b/mingw-w64-crt/lib32/msvcr120.def.in @@ -1042,6 +1042,7 @@ _ftime32 _ftime32_s _ftime64 _ftime64_s +_ftime == _ftime32 _ftol _fullpath _futime32 diff --git a/mingw-w64-crt/lib32/msvcr120_app.def.in b/mingw-w64-crt/lib32/msvcr120_app.def.in index 0c5aaff9..b13d9a66 100644 --- a/mingw-w64-crt/lib32/msvcr120_app.def.in +++ b/mingw-w64-crt/lib32/msvcr120_app.def.in @@ -654,6 +654,7 @@ _ftime32 _ftime32_s _ftime64 _ftime64_s +_ftime == _ftime32 _ftol _fullpath _futime32 diff --git a/mingw-w64-crt/lib32/msvcr120d.def.in b/mingw-w64-crt/lib32/msvcr120d.def.in index 194a0d24..385d4913 100644 --- a/mingw-w64-crt/lib32/msvcr120d.def.in +++ b/mingw-w64-crt/lib32/msvcr120d.def.in @@ -1098,6 +1098,7 @@ _ftime32 _ftime32_s _ftime64 _ftime64_s +_ftime == _ftime32 _ftol _fullpath _fullpath_dbg diff --git a/mingw-w64-crt/lib32/msvcr90.def.in b/mingw-w64-crt/lib32/msvcr90.def.in index 861ce56c..69765e53 100644 --- a/mingw-w64-crt/lib32/msvcr90.def.in +++ b/mingw-w64-crt/lib32/msvcr90.def.in @@ -523,6 +523,7 @@ _ftime32 _ftime32_s _ftime64 _ftime64_s +_ftime == _ftime32 _ftol _fullpath _futime32 diff --git a/mingw-w64-crt/lib32/msvcr90d.def.in b/mingw-w64-crt/lib32/msvcr90d.def.in index 419c65ce..2fe211dd 100644 --- a/mingw-w64-crt/lib32/msvcr90d.def.in +++ b/mingw-w64-crt/lib32/msvcr90d.def.in @@ -583,6 +583,7 @@ _ftime32 _ftime32_s _ftime64 _ftime64_s +_ftime == _ftime32 _ftol _fullpath _fullpath_dbg diff --git a/mingw-w64-crt/lib64/msvcr100.def.in b/mingw-w64-crt/lib64/msvcr100.def.in index b3be3024..b1e3e073 100644 --- a/mingw-w64-crt/lib64/msvcr100.def.in +++ b/mingw-w64-crt/lib64/msvcr100.def.in @@ -853,6 +853,7 @@ _ftime32 _ftime32_s _ftime64 _ftime64_s +_ftime == _ftime64 _fullpath _futime32 _futime64 diff --git a/mingw-w64-crt/lib64/msvcr110.def.in b/mingw-w64-crt/lib64/msvcr110.def.in index 59868920..a4129975 100644 --- a/mingw-w64-crt/lib64/msvcr110.def.in +++ b/mingw-w64-crt/lib64/msvcr110.def.in @@ -978,6 +978,7 @@ _ftime32 _ftime32_s _ftime64 _ftime64_s +_ftime == _ftime64 _fullpath _futime32 _futime64 diff --git a/mingw-w64-crt/lib64/msvcr120.def.in b/mingw-w64-crt/lib64/msvcr120.def.in index 0ec1dc48..38d5af29 100644 --- a/mingw-w64-crt/lib64/msvcr120.def.in +++ b/mingw-w64-crt/lib64/msvcr120.def.in @@ -998,6 +998,7 @@ _ftime32 _ftime32_s _ftime64 _ftime64_s +_ftime == _ftime64 _fullpath _futime32 _futime64 d
Re: [Mingw-w64-public] [PATCH] Add _ftime aliases for all msvcr versions
On 1/2/19 1:10 PM, Johannes Pfau wrote: > Hello all, > > I'm currently adding (some basic) MinGW support to the D code which > was recently merged into GCC9. The D runtime library already has full > windows support, developed by DMD and LLVM D compiler devs. However, > this needs MSVC runtime versions >= 120. So I'm now trying to add > proper support for targeting newer MSVC libs to the GCC/MinGW ecosystem. > > It turns out libgomp uses _ftime, but this symbol is only exposed for > msvcrt.dll and I get linker errors for any other MSVC version. > Therefore this patch adds the _ftime aliases to all msvcr .def > files. According to timeb.h, there should be a _ftime symbol which > maps to _ftime64 on _WIN64 and _ftime32 for anything else. > > This is my first MinGW patch, so please feel free to point out if > there's anything wrong with the patch. > BTW: How do you handle branches for the patches? The attached patch > is against the v6.x branch. > > Best regards, > Johannes Ideally, the patch should be against master, and then cherry-picked to v6.x. If there are conflicts, please prepare the patch for both branches. I'll let LH, Jacek and the others comment on the patch. signature.asc 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] Add _ftime aliases for all msvcr versions
W dniu 02.01.2019 o 16:32, JonY via Mingw-w64-public pisze: > On 1/2/19 1:10 PM, Johannes Pfau wrote: >> Hello all, >> >> I'm currently adding (some basic) MinGW support to the D code which >> was recently merged into GCC9. The D runtime library already has full >> windows support, developed by DMD and LLVM D compiler devs. However, >> this needs MSVC runtime versions >= 120. So I'm now trying to add >> proper support for targeting newer MSVC libs to the GCC/MinGW ecosystem. >> >> It turns out libgomp uses _ftime, but this symbol is only exposed for >> msvcrt.dll and I get linker errors for any other MSVC version. >> Therefore this patch adds the _ftime aliases to all msvcr .def >> files. According to timeb.h, there should be a _ftime symbol which >> maps to _ftime64 on _WIN64 and _ftime32 for anything else. >> >> This is my first MinGW patch, so please feel free to point out if >> there's anything wrong with the patch. >> BTW: How do you handle branches for the patches? The attached patch >> is against the v6.x branch. >> >> Best regards, >> Johannes > > > Ideally, the patch should be against master, and then cherry-picked to > v6.x. If there are conflicts, please prepare the patch for both branches. > > I'll let LH, Jacek and the others comment on the patch. On page https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/ftime-ftime32-ftime64?view=vs-2017 there is an example program. I've tested this example in 64-bit GCC msvcrt/msvcr120/ucrtbase + 32-bit GCC msvcrt/msvcr120/ucrtbase -- all works. Could you specify example that not works? Regards, Mateusz Test results: $ m64- 82 Mateusz@Mateusz-i7 /f/t/ft $ gcc -Wall -o f64.exe f.c Mateusz@Mateusz-i7 /f/t/ft $ f64 Seconds since midnight, January 1, 1970 (UTC): 1546446966 Milliseconds: 416 Minutes between UTC and local time: -60 Daylight savings time flag (1 means Daylight time is in effect): 0 The time is Wed Jan 02 17:36:06.416 2019 Mateusz@Mateusz-i7 /f/t/ft $ m64-12- 82 Mateusz@Mateusz-i7 /f/t/ft $ gcc -Wall -o f64-12.exe f.c Mateusz@Mateusz-i7 /f/t/ft $ f64-12 Seconds since midnight, January 1, 1970 (UTC): 1546447001 Milliseconds: 583 Minutes between UTC and local time: -60 Daylight savings time flag (1 means Daylight time is in effect): 0 The time is Wed Jan 02 17:36:41.583 2019 Mateusz@Mateusz-i7 /f/t/ft $ m64-14- 82 Mateusz@Mateusz-i7 /f/t/ft $ gcc -Wall -o f64-14.exe f.c f.c: In function 'main': f.c:28:64: warning: format '%d' expects argument of type 'int', but argument 2 has type 'time_t' {aka 'long long int'} [-Wformat=] printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n", ^ %I64lld time1); ~ Mateusz@Mateusz-i7 /f/t/ft $ f64-14 Seconds since midnight, January 1, 1970 (UTC): 1546447049 Milliseconds: 498 Minutes between UTC and local time: -60 Daylight savings time flag (1 means Daylight time is in effect): 0 The time is Wed Jan 2 17:37:29.498 2019 Mateusz@Mateusz-i7 /f/t/ft $ m32- 82 Mateusz@Mateusz-i7 /f/t/ft $ gcc -Wall -o f32.exe f.c f.c: In function 'main': f.c:28:64: warning: format '%I64d' expects argument of type 'long long int', but argument 2 has type 'time_t' {aka 'long int'} [-Wformat=] printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n", ^ %ld time1); ~ f.c:28:64: warning: format '%I64d' expects argument of type 'long long int', but argument 2 has type 'time_t' {aka 'long int'} [-Wformat=] printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n", ^ %ld time1); ~ Mateusz@Mateusz-i7 /f/t/ft $ f32 Seconds since midnight, January 1, 1970 (UTC): 1546447100 Milliseconds: 970 Minutes between UTC and local time: -60 Daylight savings time flag (1 means Daylight time is in effect): 0 The time is Wed Jan 02 17:38:20.970 2019 Mateusz@Mateusz-i7 /f/t/ft $ m32-12- 82 Mateusz@Mateusz-i7 /f/t/ft $ gcc -Wall -o f32-12.exe f.c f.c: In function 'main': f.c:28:64: warning: format '%I64d' expects argument of type 'long long int', but argument 2 has type 'time_t' {aka 'long int'} [-Wformat=] printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n", ^ %ld time1); ~ f.c:28:64: warning: format '%I64d' expects argument of type 'long long int', but argument 2 has type 'time_t' {aka 'long int'} [-Wformat=] printf( "Seconds since midnight, January 1, 1970 (UTC): %I64d\n", ^ %ld time1); ~ Mateu
Re: [Mingw-w64-public] [PATCH] Add _ftime aliases for all msvcr versions
W dniu 02.01.2019 o 14:10, Johannes Pfau pisze: > BTW: How do you handle branches for the patches? The attached patch > is against the v6.x branch. I didn't read this, sorry for noise in previous mail. The problem was solved in master branch by https://sourceforge.net/p/mingw-w64/mingw-w64/ci/38496499910a580ddc449a7d09f3bc0302767f31/ Regards, Mateusz ___ 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] Add _ftime aliases for all msvcr versions
Am 02.01.19 um 18:02 schrieb Mateusz: W dniu 02.01.2019 o 14:10, Johannes Pfau pisze: BTW: How do you handle branches for the patches? The attached patch is against the v6.x branch. I didn't read this, sorry for noise in previous mail. The problem was solved in master branch by https://sourceforge.net/p/mingw-w64/mingw-w64/ci/38496499910a580ddc449a7d09f3bc0302767f31/ Regards, Mateusz I guess I should have checked the master branch first, this is perfect. Any idea whether this will be backported to v6.x? OTOH I'll probably just post a patch to https://github.com/niXman/mingw-builds anyway, so it's not really urgent to have this in v6.x. Regards, Johannes ___ 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] Add _ftime aliases for all msvcr versions
If you want to experiment mingw-build allows you to use trunk mingw-w64: https://github.com/niXman/mingw-builds/blob/dba8a4ab94906afe677bf11199b6330e3e1ce8a2/build#L69 GCC 8.1.0 available at mingw-w64 sourceforge page was built from master branch AFAIK. Regards, Mateusz Mikuła śr., 2 sty 2019 o 20:27 Johannes Pfau napisał(a): > Am 02.01.19 um 18:02 schrieb Mateusz: > > W dniu 02.01.2019 o 14:10, Johannes Pfau pisze: > >> BTW: How do you handle branches for the patches? The attached patch > >> is against the v6.x branch. > > I didn't read this, sorry for noise in previous mail. > > > > The problem was solved in master branch by > > > https://sourceforge.net/p/mingw-w64/mingw-w64/ci/38496499910a580ddc449a7d09f3bc0302767f31/ > > > > Regards, > > Mateusz > > I guess I should have checked the master branch first, this is perfect. > Any idea whether this will be backported to v6.x? OTOH I'll probably > just post a patch to https://github.com/niXman/mingw-builds anyway, so > it's not really urgent to have this in v6.x. > > Regards, > > Johannes > > > > ___ > Mingw-w64-public mailing list > Mingw-w64-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > ___ 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] Add _ftime aliases for all msvcr versions
W dniu 02.01.2019 o 20:27, Johannes Pfau pisze: > Am 02.01.19 um 18:02 schrieb Mateusz: >> W dniu 02.01.2019 o 14:10, Johannes Pfau pisze: >>> BTW: How do you handle branches for the patches? The attached patch >>> is against the v6.x branch. >> I didn't read this, sorry for noise in previous mail. >> >> The problem was solved in master branch by >> https://sourceforge.net/p/mingw-w64/mingw-w64/ci/38496499910a580ddc449a7d09f3bc0302767f31/ >> >> Regards, >> Mateusz > > I guess I should have checked the master branch first, this is perfect. Any > idea whether this will be backported to v6.x? I don't know, usually JonY make the backports and releases. JonY maybe it is time to backport all new commits and make 6.1 release? Now it is possible to compile ffmpeg for msvcrt/msvcr120/ucrtbase and it passes FATE tests for all variants 32/64-bit msvcrt/msvcr120/ucrtbase. It is also possible to compile x265 for ucrtbase and run this x265 in Windows XP (after installing VC++ 2017 redist that brings ucrt to WinXP). Regards, Mateusz ___ 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] Add _ftime aliases for all msvcr versions
在 2019/1/3 1:02, Mateusz 写道: > W dniu 02.01.2019 o 14:10, Johannes Pfau pisze: >> BTW: How do you handle branches for the patches? The attached patch >> is against the v6.x branch. > > I didn't read this, sorry for noise in previous mail. > > The problem was solved in master branch by > https://sourceforge.net/p/mingw-w64/mingw-w64/ci/38496499910a580ddc449a7d09f3bc0302767f31/ > > Regards, > Mateusz > > > Yes; and there is no need for a fresh patch. Backporting the existent patch will suffice. -- Best regards, LH_Mouse ___ 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] Add _ftime aliases for all msvcr versions
在 2019/1/3 3:27, Johannes Pfau 写道: > Am 02.01.19 um 18:02 schrieb Mateusz: >> W dniu 02.01.2019 o 14:10, Johannes Pfau pisze: >>> BTW: How do you handle branches for the patches? The attached patch >>> is against the v6.x branch. >> I didn't read this, sorry for noise in previous mail. >> >> The problem was solved in master branch by >> https://sourceforge.net/p/mingw-w64/mingw-w64/ci/38496499910a580ddc449a7d09f3bc0302767f31/ >> >> >> Regards, >> Mateusz > > I guess I should have checked the master branch first, this is perfect. > Any idea whether this will be backported to v6.x? OTOH I'll probably > just post a patch to https://github.com/niXman/mingw-builds anyway, so > it's not really urgent to have this in v6.x. > If you are sure that this fixes the problem for you, we can cherry-pick it now, as it applies cleanly. > Regards, > > Johannes > > > -- Best regards, LH_Mouse ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public