You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(55) |
Oct
(59) |
Nov
(3) |
Dec
(30) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(59) |
Feb
(22) |
Mar
(55) |
Apr
(4) |
May
(15) |
Jun
(29) |
Jul
(6) |
Aug
(17) |
Sep
|
Oct
(27) |
Nov
(8) |
Dec
(14) |
| 2009 |
Jan
(6) |
Feb
(26) |
Mar
(48) |
Apr
(11) |
May
(3) |
Jun
(20) |
Jul
(28) |
Aug
(48) |
Sep
(85) |
Oct
(34) |
Nov
(23) |
Dec
(65) |
| 2010 |
Jan
(68) |
Feb
(46) |
Mar
(105) |
Apr
(74) |
May
(185) |
Jun
(118) |
Jul
(179) |
Aug
(170) |
Sep
(513) |
Oct
(113) |
Nov
(41) |
Dec
(52) |
| 2011 |
Jan
(59) |
Feb
(102) |
Mar
(110) |
Apr
(197) |
May
(123) |
Jun
(91) |
Jul
(195) |
Aug
(209) |
Sep
(233) |
Oct
(112) |
Nov
(241) |
Dec
(86) |
| 2012 |
Jan
(138) |
Feb
(151) |
Mar
(326) |
Apr
(154) |
May
(278) |
Jun
(230) |
Jul
(311) |
Aug
(327) |
Sep
(194) |
Oct
(139) |
Nov
(243) |
Dec
(141) |
| 2013 |
Jan
(169) |
Feb
(90) |
Mar
(187) |
Apr
(228) |
May
(150) |
Jun
(328) |
Jul
(287) |
Aug
(199) |
Sep
(288) |
Oct
(199) |
Nov
(310) |
Dec
(214) |
| 2014 |
Jan
(166) |
Feb
(66) |
Mar
(90) |
Apr
(166) |
May
(166) |
Jun
(99) |
Jul
(120) |
Aug
(139) |
Sep
(107) |
Oct
(142) |
Nov
(171) |
Dec
(170) |
| 2015 |
Jan
(138) |
Feb
(100) |
Mar
(101) |
Apr
(83) |
May
(143) |
Jun
(148) |
Jul
(139) |
Aug
(174) |
Sep
(60) |
Oct
(52) |
Nov
(41) |
Dec
(59) |
| 2016 |
Jan
(40) |
Feb
(86) |
Mar
(121) |
Apr
(154) |
May
(78) |
Jun
(46) |
Jul
(71) |
Aug
(191) |
Sep
(96) |
Oct
(44) |
Nov
(85) |
Dec
(52) |
| 2017 |
Jan
(80) |
Feb
(65) |
Mar
(91) |
Apr
(66) |
May
(144) |
Jun
(115) |
Jul
(61) |
Aug
(301) |
Sep
(78) |
Oct
(96) |
Nov
(309) |
Dec
(59) |
| 2018 |
Jan
(99) |
Feb
(41) |
Mar
(88) |
Apr
(52) |
May
(62) |
Jun
(95) |
Jul
(49) |
Aug
(133) |
Sep
(79) |
Oct
(86) |
Nov
(145) |
Dec
(72) |
| 2019 |
Jan
(138) |
Feb
(68) |
Mar
(145) |
Apr
(203) |
May
(115) |
Jun
(70) |
Jul
(85) |
Aug
(55) |
Sep
(79) |
Oct
(50) |
Nov
(95) |
Dec
(155) |
| 2020 |
Jan
(63) |
Feb
(59) |
Mar
(135) |
Apr
(397) |
May
(180) |
Jun
(141) |
Jul
(36) |
Aug
(62) |
Sep
(92) |
Oct
(86) |
Nov
(86) |
Dec
(144) |
| 2021 |
Jan
(112) |
Feb
(44) |
Mar
(117) |
Apr
(112) |
May
(234) |
Jun
(86) |
Jul
(88) |
Aug
(113) |
Sep
(88) |
Oct
(109) |
Nov
(46) |
Dec
(54) |
| 2022 |
Jan
(104) |
Feb
(90) |
Mar
(95) |
Apr
(70) |
May
(51) |
Jun
(96) |
Jul
(76) |
Aug
(91) |
Sep
(101) |
Oct
(95) |
Nov
(126) |
Dec
(125) |
| 2023 |
Jan
(39) |
Feb
(64) |
Mar
(103) |
Apr
(107) |
May
(77) |
Jun
(162) |
Jul
(59) |
Aug
(59) |
Sep
(91) |
Oct
(273) |
Nov
(101) |
Dec
(183) |
| 2024 |
Jan
(148) |
Feb
(50) |
Mar
(55) |
Apr
(182) |
May
(106) |
Jun
(217) |
Jul
(139) |
Aug
(161) |
Sep
(193) |
Oct
(174) |
Nov
(139) |
Dec
(157) |
| 2025 |
Jan
(158) |
Feb
(215) |
Mar
(286) |
Apr
(194) |
May
(150) |
Jun
(172) |
Jul
(117) |
Aug
(133) |
Sep
(166) |
Oct
(275) |
Nov
(204) |
Dec
(267) |
| 2026 |
Jan
(174) |
Feb
(149) |
Mar
(62) |
Apr
(104) |
May
(130) |
Jun
(168) |
Jul
(203) |
Aug
(298) |
Sep
(226) |
Oct
(261) |
Nov
(233) |
Dec
|
|
From: LIU H. <lh_...@12...> - 2026-11-17 11:49:05
|
在 2026-11-17 19:22, Pali Rohár 写道: > Right now I do not remember if this applies for the amd64 or arm64, but > switching the current sp vs sp on entry caused failures in one of my new > setjmp / longjmp tests which I prepared for verification that the current > sp vs sp on entry is needed. All those tests are now part of mingw-w64 > test suite. If the SEH frame in the jump buffer was shifted then SEH > handlers were called with incorrect flags (if it is Frame handler or not). > > If (msvc or any other) compiler is doing something then there is a high > chance that there is a reason for it. And that is why I tried to write > tests which shows these differences and why it is really needed. For i686, `EstablisherFrame` points to an object of `EXCEPTION_REGISTRATION_RECORD` on the stack, which itself is a node of a singly-linked list from FS:[0]. It is used to access local variables. For x86-64, `EstablisherFrame` has the value of RSP at the end of the prologue (a.k.a. the fixed allocation area). Local variables may also be accessed through `DispatcherContext->ContextRecord`. For ARM and ARM64, the `EstablisherFrame` parameter always points to the CFA (SP on entry) no matter whether the target function is using a frame pointer or not. Local variables may also be accessed through `DispatcherContext->ContextRecord` (for ARM64EC it points to an x86-64 `CONTEXT`). These look really like values that should be passed as the second argument to `_setjmpex()`. -- Best regards, LIU Hao |
|
From: Pali R. <pal...@gm...> - 2026-11-17 11:22:51
|
On Tuesday 17 November 2026 17:26:11 LIU Hao wrote: > 在 2026-11-17 17:01, Evgeny Karpov 写道: > > mingw_getsp has been used to validate AArch64 SEH implementation while it was > > still available. __builtin_stack_address does the same and is also suficeent > > for current aarch64-w64-mingw32 and aarch64-pc-cycgwin needs. > > > > Thanks for clarifying what MSVC does. > > Perhaps there might be a reason for that, however it looks like the unwinder > > works also with SP of its caller in the GNU Toolchain. > > It would be helpful if __builtin_stack_address is used in AArch64 for GNU > > Toolchain for now. And once the repro case is known, > > __builtin_aarch64_sponentry might be added if there are no other solutions. > The second parameter to `_setjmpex()` is stored into `_JUMP_BUFFER::Frame` that the first > parameter points to. This definition seems to match the `EstablisherFrame` parameter of > an SEH handler. > > It sounds like passing the current SP only works by accident; it's the CFA of a direct > callee of the current function, and is therefore off by one frame. Right now I do not remember if this applies for the amd64 or arm64, but switching the current sp vs sp on entry caused failures in one of my new setjmp / longjmp tests which I prepared for verification that the current sp vs sp on entry is needed. All those tests are now part of mingw-w64 test suite. If the SEH frame in the jump buffer was shifted then SEH handlers were called with incorrect flags (if it is Frame handler or not). If (msvc or any other) compiler is doing something then there is a high chance that there is a reason for it. And that is why I tried to write tests which shows these differences and why it is really needed. Evgeny, you have not wrote how you have tested or verified that correct SEH handlers with correct flags are being called from the GNU toolchain during the longjmp. And from that is quite hard from me to deduce what is happing and if it correct or not. Obviously compiler could do lot of things with sp, including the fact that it would not be changed (if everything is inlined and put into registers). And there could be also cases were the sp on entry is same as current sp. The point is not to write one test which will always pass. But rather find that contra example which will fail and will show why it is needed to pass that sp on entry. |
|
From: Pali R. <pal...@gm...> - 2026-11-17 11:06:42
|
On Tuesday 17 November 2026 09:43:12 Kirill Makurin wrote: > On Tuesday, November 17th, 2026 at 12:46 AM, LIU Hao <lh_...@12...> wrote: > > > 在 2026-11-16 21:31, Pali Rohár 写道: > > > t_wrongret.cpp:14:1: error: control reaches end of non-void function [-Werror=return-type] > > > --- > > > mingw-w64-crt/testcases/t_wrongret.cpp | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/mingw-w64-crt/testcases/t_wrongret.cpp b/mingw-w64-crt/testcases/t_wrongret.cpp > > > index 09026264d359..ccfb72b7ace3 100644 > > > --- a/mingw-w64-crt/testcases/t_wrongret.cpp > > > +++ b/mingw-w64-crt/testcases/t_wrongret.cpp > > > @@ -11,6 +11,7 @@ int F() > > > std::cout << std::endl; > > > return 12345; > > > std::cout << std::endl; > > > + return 0; > > > } > > > > > > int main() > > > > This test looks weird. Can we delete it instead? > > I think it's better to delete it. > > - Kirill Makurin > Do whatever is the best with this test. I have no idea what this test is trying to verify. As it was causing compile error, I was just trying to fix the error. |
|
From: Kirill M. <mai...@pr...> - 2026-11-17 09:43:25
|
On Tuesday, November 17th, 2026 at 12:46 AM, LIU Hao <lh_...@12...> wrote: > 在 2026-11-16 21:31, Pali Rohár 写道: > > t_wrongret.cpp:14:1: error: control reaches end of non-void function [-Werror=return-type] > > --- > > mingw-w64-crt/testcases/t_wrongret.cpp | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/mingw-w64-crt/testcases/t_wrongret.cpp b/mingw-w64-crt/testcases/t_wrongret.cpp > > index 09026264d359..ccfb72b7ace3 100644 > > --- a/mingw-w64-crt/testcases/t_wrongret.cpp > > +++ b/mingw-w64-crt/testcases/t_wrongret.cpp > > @@ -11,6 +11,7 @@ int F() > > std::cout << std::endl; > > return 12345; > > std::cout << std::endl; > > + return 0; > > } > > > > int main() > > This test looks weird. Can we delete it instead? I think it's better to delete it. - Kirill Makurin |
|
From: LIU H. <lh_...@12...> - 2026-11-17 09:26:27
|
在 2026-11-17 17:01, Evgeny Karpov 写道: > mingw_getsp has been used to validate AArch64 SEH implementation while it was > still available. __builtin_stack_address does the same and is also suficeent > for current aarch64-w64-mingw32 and aarch64-pc-cycgwin needs. > > Thanks for clarifying what MSVC does. > Perhaps there might be a reason for that, however it looks like the unwinder > works also with SP of its caller in the GNU Toolchain. > It would be helpful if __builtin_stack_address is used in AArch64 for GNU > Toolchain for now. And once the repro case is known, > __builtin_aarch64_sponentry might be added if there are no other solutions. The second parameter to `_setjmpex()` is stored into `_JUMP_BUFFER::Frame` that the first parameter points to. This definition seems to match the `EstablisherFrame` parameter of an SEH handler. It sounds like passing the current SP only works by accident; it's the CFA of a direct callee of the current function, and is therefore off by one frame. -- Best regards, LIU Hao |
|
From: Evgeny K. <evg...@ar...> - 2026-11-17 09:02:08
|
On Mon, 16 Nov 2026 LIU Hao wrote: > `mingw_getsp()` used to return SP of its caller; so here it would be the same as `__builtin_stack_address()`. > > But that's not what MSVC passes to `_setjmpex`: > > str lr,[sp,#-0x10]! ; SP := <SP-on-entry> - 0x10 > ... > sub sp,sp,#0xC0 ; SP := <SP-on-entry> - 0xD0 > add x1,sp,#0xD0 ; X1 := SP + 0xD0 = <SP-on-entry> > bl _setjmpex mingw_getsp has been used to validate AArch64 SEH implementation while it was still available. __builtin_stack_address does the same and is also suficeent for current aarch64-w64-mingw32 and aarch64-pc-cycgwin needs. Thanks for clarifying what MSVC does. Perhaps there might be a reason for that, however it looks like the unwinder works also with SP of its caller in the GNU Toolchain. It would be helpful if __builtin_stack_address is used in AArch64 for GNU Toolchain for now. And once the repro case is known, __builtin_aarch64_sponentry might be added if there are no other solutions. Regards, Evgeny |
|
From: LIU H. <lh_...@12...> - 2026-11-17 08:50:11
|
在 2026-10-27 20:15, LIU Hao 写道:
> Assisted-by: DeepSeek V4.1 Flash
> Signed-off-by: LIU Hao <lh_...@12...>
> ---
> mingw-w64-crt/Makefile.am | 4 ++++
> mingw-w64-crt/math/arm-common/log2.c | 24 ------------------------
> mingw-w64-crt/math/arm-common/log2f.c | 27 +++++++++++++++++++++++++++
> mingw-w64-crt/math/arm-common/log2l.c | 12 ++++++++++++
> 4 files changed, 43 insertions(+), 24 deletions(-)
> create mode 100644 mingw-w64-crt/math/arm-common/log2f.c
> create mode 100644 mingw-w64-crt/math/arm-common/log2l.c
Ping.
And also [PATCH 1/3] crt: Split `scalb{, l}n{, f, l}` to individual source files.
--
Best regards,
LIU Hao
|
|
From: LIU H. <lh_...@12...> - 2026-11-17 03:20:47
|
在 2026-11-15 22:16, Pali Rohár 写道: > Hello, in the attachment I'm sending commits which fixes failing complex > math functions and tests built by 32-bit and 64-bit clang ucrtapp. The > last commit removes "continue-on-error: true" from CI configuration, so > now all ucrtapp test failures would be fatal, like for any other testing. > > Kirill run CI test suite and it passed: > https://github.com/maiddaisuki/mingw-w64/actions/runs/43714144625 Thanks. I have pushed these patches now. -- Best regards, LIU Hao |
|
From: LIU H. <lh_...@12...> - 2026-11-17 00:46:22
|
在 2026-11-16 21:31, Pali Rohár 写道: > t_wrongret.cpp:14:1: error: control reaches end of non-void function [-Werror=return-type] > --- > mingw-w64-crt/testcases/t_wrongret.cpp | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/mingw-w64-crt/testcases/t_wrongret.cpp b/mingw-w64-crt/testcases/t_wrongret.cpp > index 09026264d359..ccfb72b7ace3 100644 > --- a/mingw-w64-crt/testcases/t_wrongret.cpp > +++ b/mingw-w64-crt/testcases/t_wrongret.cpp > @@ -11,6 +11,7 @@ int F() > std::cout << std::endl; > return 12345; > std::cout << std::endl; > + return 0; > } > > int main() This test looks weird. Can we delete it instead? -- Best regards, LIU Hao |
|
From: LIU H. <lh_...@12...> - 2026-11-17 00:33:52
|
在 2026-11-17 01:24, Evgeny Karpov 写道:
> It looks like _setjmpex((BUF), mingw_getsp()) is sufficent for GNU Toolchain
> with SEH enabled.
> Would it be possible to enable it for the GNU Toolchain?
> It will unblock upstreaming for SEH and aarch64-pc-cygwin introduction, which
> has a dependency on the SEH patch.
>
> The implementation for __builtin_sponentry needs a clarification.
> If it is only clang related support, then mingw_getsp() might be enough for now.
`mingw_getsp()` used to return SP of its caller; so here it would be the same as `__builtin_stack_address()`.
But that's not what MSVC passes to `_setjmpex`:
str lr,[sp,#-0x10]! ; SP := <SP-on-entry> - 0x10
...
sub sp,sp,#0xC0 ; SP := <SP-on-entry> - 0xD0
add x1,sp,#0xD0 ; X1 := SP + 0xD0 = <SP-on-entry>
bl _setjmpex
--
Best regards,
LIU Hao
|
|
From: Evgeny K. <evg...@ar...> - 2026-11-16 18:06:08
|
On Mon, 16 Nov 2026 Pali Roh�r wrote: > > It looks like _setjmpex((BUF), mingw_getsp()) is sufficent for GNU Toolchain > > with SEH enabled. > > Would it be possible to enable it for the GNU Toolchain? > > It will unblock upstreaming for SEH and aarch64-pc-cygwin introduction, which > > has a dependency on the SEH patch. > > > > The implementation for __builtin_sponentry needs a clarification. > > If it is only clang related support, then mingw_getsp() might be enough for now. > > For aarch64 the mingw_getsp() cannot be used as it returns different pointer. > I have clarified it in recent commit messages what are differences. > Moreover the mingw_getsp function was already removed. mingw_getsp still exists and it was used to confirm that aarch64 SEH works correctly in GNU Toolchain. It looks like mingw_getsp is sufficient for the unwinder, at least in the GNU Toolchain. Regards, Evgeny |
|
From: Evgeny K. <evg...@ar...> - 2026-11-16 17:41:14
|
On Fri, 13 Nov 2026 Pali Roh�r wrote: > > This means the builds from upstream repositories should not be impacted now. > > The SEH patch will be extended with __builtin_sponentry implementation. > > > Yes, please extend the SEH support with the __builtin_sponentry > implementation. This could solve problems with clang interop and also > decrease ifdefs for clang/gcc. It looks like _setjmpex((BUF), mingw_getsp()) is sufficent for GNU Toolchain with SEH enabled. Would it be possible to enable it for the GNU Toolchain? It will unblock upstreaming for SEH and aarch64-pc-cygwin introduction, which has a dependency on the SEH patch. The implementation for __builtin_sponentry needs a clarification. If it is only clang related support, then mingw_getsp() might be enough for now. Regards, Evgeny |
|
From: Pali R. <pal...@gm...> - 2026-11-16 17:35:32
|
On Monday 16 November 2026 18:24:26 Evgeny Karpov wrote: > On Fri, 13 Nov 2026 Pali Roh�r wrote: > > > This means the builds from upstream repositories should not be impacted now. > > > The SEH patch will be extended with __builtin_sponentry implementation. > > > > > Yes, please extend the SEH support with the __builtin_sponentry > > implementation. This could solve problems with clang interop and also > > decrease ifdefs for clang/gcc. > > It looks like _setjmpex((BUF), mingw_getsp()) is sufficent for GNU Toolchain > with SEH enabled. > Would it be possible to enable it for the GNU Toolchain? > It will unblock upstreaming for SEH and aarch64-pc-cygwin introduction, which > has a dependency on the SEH patch. > > The implementation for __builtin_sponentry needs a clarification. > If it is only clang related support, then mingw_getsp() might be enough for now. > > Regards, > Evgeny > For aarch64 the mingw_getsp() cannot be used as it returns different pointer. I have clarified it in recent commit messages what are differences. Moreover the mingw_getsp function was already removed. |
|
From: Kirill M. <mai...@pr...> - 2026-11-16 15:17:16
|
(Please keep Pali CC'd as he's not subscribed to the list) On Monday, November 16th, 2026 at 3:12 PM, Gisle Vanem via Mingw-w64-public <min...@li...> wrote: > Pali Rohár wrote: > > > diff --git a/mingw-w64-crt/testcases/t_wrongret.cpp b/mingw-w64-crt/testcases/t_wrongret.cpp > > index 09026264d359..ccfb72b7ace3 100644 > > --- a/mingw-w64-crt/testcases/t_wrongret.cpp > > +++ b/mingw-w64-crt/testcases/t_wrongret.cpp > > @@ -11,6 +11,7 @@ int F() > > std::cout << std::endl; > > return 12345; > > std::cout << std::endl; > > + return 0; > > 2 'return' statements !? This is some weird old test, which seems to be used to debug some code generation issue. When compiled without optimizations, it produces a warning which causes CI runs to fail because of -Werror. - Kirill Makurin |
|
From: Gisle V. <gv...@ya...> - 2026-11-16 15:11:51
|
Pali Rohár wrote: > diff --git a/mingw-w64-crt/testcases/t_wrongret.cpp b/mingw-w64-crt/testcases/t_wrongret.cpp > index 09026264d359..ccfb72b7ace3 100644 > --- a/mingw-w64-crt/testcases/t_wrongret.cpp > +++ b/mingw-w64-crt/testcases/t_wrongret.cpp > @@ -11,6 +11,7 @@ int F() > std::cout << std::endl; > return 12345; > std::cout << std::endl; > + return 0; 2 'return' statements !? -- --gv |
|
From: Kirill M. <mai...@pr...> - 2026-11-16 14:18:06
|
On Monday, November 16th, 2026 at 12:32 PM, Kirill Makurin via Mingw-w64-public <min...@li...> wrote: > On Monday, November 16th, 2026 at 12:27 PM, LIU Hao <lh_...@12...> wrote: > > > 在 2026-11-16 20:06, Kirill Makurin 写道: > > > Are there any other issues with these changes? > > > > Not really. > > Ok. I'll rebase and push new version for CI, and send it if CI passes. New version of the changes is in attachment. GitHub CI run: https://github.com/maiddaisuki/mingw-w64/actions/runs/43868565112 There is also a small formatting change in 0002.txt: > /** > * Mask of `WINPTHREADS_FEATURE_*` bits which are guaranteed to be > * available at runtime. > */ > -#define WINPTHREADS_DEFAULT_FEATURES (0) > +#define WINPTHREADS_DEFAULT_FEATURES ( \ > + WINPTHREADS_DEFAULT_FEATURE_WAIT_ON_ADDRESS \ > + ) I added one level of indentation (two spaces). - Kirill Makurin |
|
From: Kirill M. <mai...@pr...> - 2026-11-16 13:49:13
|
On Monday, November 16th, 2026 at 1:36 PM, Luca Bacci <luc...@ou...> wrote:
> > So far, we only call WinAPI functions. However, if I recall
> correctly, Luca's changes may need to do memory allocation, and it is
> likely done using `malloc`, which is a CRT function.
>
> Fortunately I have to call only WinApi functions. Actually, after patch
> 5/5 from this patchset ("remove static function _pthread_once_raw"),
> I'll only have to call WINPTHREADS_CHECK_FEATURE.
>
> > I think the best thing we can do is ensure that `*_init` functions do
> not call CRT functions.
>
> That's fine with me.
That's great. Then we can use ".CRT.XI?" and remove calls to `_onexit` and
`abort` which will be added as a temporary solution in these changes.
- Kirill Makurin
|
|
From: Luca B. <luc...@ou...> - 2026-11-16 13:36:07
|
> So far, we only call WinAPI functions. However, if I recall
correctly, Luca's changes may need to do memory allocation, and it is
likely done using `malloc`, which is a CRT function.
Fortunately I have to call only WinApi functions. Actually, after patch
5/5 from this patchset ("remove static function _pthread_once_raw"),
I'll only have to call WINPTHREADS_CHECK_FEATURE.
> I think the best thing we can do is ensure that `*_init` functions do
not call CRT functions.
That's fine with me.
Best Regards,
Luca
On 11/16/2026 2:22 PM, Kirill Makurin via Mingw-w64-public wrote:
> On Monday, November 16th, 2026 at 1:14 PM, Pali Rohár<pal...@gm...> wrote:
>
>> For EXE builds which are using CRT DLL library there is mostly no
>> difference as the CRT DLL library is initialized before EXE entry point
>> is executed. The only difference is what statically linked init code
>> into EXE build is doing (which is that _argc/_argv initialization or
>> similar stuff). For msvc EXE builds which have statically linked with
>> CRT library (mingw-w64 does not support this, it always uses CRT DLL
>> library) those callback orders (the last letter) have impact because
>> they are intermixed by linker at link order in which are called. And
>> therefore statically linked CRT function for initializing malloc heap or
>> stdio can be called after application's ".CRT.XI?" hook. That is why I
>> wrote that it does not have to be safe to call every CRT function.
>>
>> For DLL builds it again depends on whether CRT library is statically
>> linked into that DLL or not like above. And when it is linked
>> dynamically to CRT DLL on older Windows versions the order of calling
>> DLL entry points (and hence also DllMain) is not fully safe and IIRC,
>> it can be called even before msvcrt/UCRT entry point (and so all
>> callbacks .CRT.XI? / .CRT.XC? / __attribute__((constructor))) can be
>> called before msvcrt is initialized. But I'm not sure how old Windows
>> version is affected by this (lot of these issues were already fixed and
>> dependent library entry points should be called in the dependent order;
>> including PE TLS callbacks) and whether msvcrt library did not contain
>> some lazy initialization for some functions (so the issue could be
>> invisible)..
> One thing I have in mind is to prohibit building winpthreads as a DLL with
> static CRT. It almost never intended, but MSVC by default act as if /MT is
> used, which links static CRT. It is really easy to forget to add /MD switch
> when configuring for MSVC.
>
> So, with static CRT we only need to think about static winpthreads.
>
>> Hence for mingw-w64 builds, it should be mostly fine because there is no
>> static build of CRT. The main problem could be that msvc compiled build
>> where it is needed to think more about orders
> I think the best thing we can do is ensure that `*_init` functions do not
> call CRT functions.
>
> - Kirill Makurin
>
>
>
> _______________________________________________
> Mingw-w64-public mailing list
> Min...@li...
> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
|
|
From: Pali R. <pal...@gm...> - 2026-11-16 13:32:10
|
Just recompile and rerun test cases during the msvcrt build as msvcrt and msvcrt20/40 should be mostly ABI compatible (and possible incompatibilities are handled by the libmsvcrt20/40.a import library). This will save CI time and avoids recompiling of whole code base. --- CI passed: https://github.com/maiddaisuki/mingw-w64/actions/runs/43861031838 --- .github/workflows/build.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1b72f4fe129..c10229161a3a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -785,6 +785,22 @@ jobs: export PATH=/gcc-mingw/bin:$PATH ${{matrix.arch}}-w64-mingw32-gcc -std=c99 -march=i386 -o t_intrinc.exe mingw-w64-crt/testcases/t_intrinc.c mingw-w64-crt/testcases/libtest.c ./t_intrinc.exe + - name: Run testcases for msvcrt20.dll + if: matrix.arch == 'i686' && matrix.crt == 'msvcrt' + run: | + export PATH=/gcc-mingw/bin:$PATH + cd mingw-w64-crt/build + make -j$(nproc) -C testcases clean + make -j$(nproc) check -k -O --no-print-directory CFLAGS="-mcrtdll=msvcrt20" CXXFLAGS="-mcrtdll=msvcrt20" LDFLAGS='-static -mcrtdll=msvcrt20' TESTS= + make -j$(nproc) check -k -O --no-print-directory CFLAGS="-mcrtdll=msvcrt20" CXXFLAGS="-mcrtdll=msvcrt20" LDFLAGS='-static -mcrtdll=msvcrt20' || { cat testcases/test-suite.log; exit 1; } + - name: Run testcases for msvcrt40.dll + if: matrix.arch == 'i686' && matrix.crt == 'msvcrt' + run: | + export PATH=/gcc-mingw/bin:$PATH + cd mingw-w64-crt/build + make -j$(nproc) -C testcases clean + make -j$(nproc) check -k -O --no-print-directory CFLAGS="-mcrtdll=msvcrt40" CXXFLAGS="-mcrtdll=msvcrt40" LDFLAGS='-static -mcrtdll=msvcrt40' TESTS= + make -j$(nproc) check -k -O --no-print-directory CFLAGS="-mcrtdll=msvcrt40" CXXFLAGS="-mcrtdll=msvcrt40" LDFLAGS='-static -mcrtdll=msvcrt40' || { cat testcases/test-suite.log; exit 1; } - name: Run testcases for ucrtapp if: matrix.crt == 'ucrt' run: | -- 2.20.1 |
|
From: Pali R. <pal...@gm...> - 2026-11-16 13:32:02
|
t_wrongret.cpp:14:1: error: control reaches end of non-void function [-Werror=return-type]
---
mingw-w64-crt/testcases/t_wrongret.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/mingw-w64-crt/testcases/t_wrongret.cpp b/mingw-w64-crt/testcases/t_wrongret.cpp
index 09026264d359..ccfb72b7ace3 100644
--- a/mingw-w64-crt/testcases/t_wrongret.cpp
+++ b/mingw-w64-crt/testcases/t_wrongret.cpp
@@ -11,6 +11,7 @@ int F()
std::cout << std::endl;
return 12345;
std::cout << std::endl;
+ return 0;
}
int main()
--
2.20.1
|
|
From: Kirill M. <mai...@pr...> - 2026-11-16 13:23:06
|
On Monday, November 16th, 2026 at 1:14 PM, Pali Rohár <pal...@gm...> wrote: > For EXE builds which are using CRT DLL library there is mostly no > difference as the CRT DLL library is initialized before EXE entry point > is executed. The only difference is what statically linked init code > into EXE build is doing (which is that _argc/_argv initialization or > similar stuff). For msvc EXE builds which have statically linked with > CRT library (mingw-w64 does not support this, it always uses CRT DLL > library) those callback orders (the last letter) have impact because > they are intermixed by linker at link order in which are called. And > therefore statically linked CRT function for initializing malloc heap or > stdio can be called after application's ".CRT.XI?" hook. That is why I > wrote that it does not have to be safe to call every CRT function. > > For DLL builds it again depends on whether CRT library is statically > linked into that DLL or not like above. And when it is linked > dynamically to CRT DLL on older Windows versions the order of calling > DLL entry points (and hence also DllMain) is not fully safe and IIRC, > it can be called even before msvcrt/UCRT entry point (and so all > callbacks .CRT.XI? / .CRT.XC? / __attribute__((constructor))) can be > called before msvcrt is initialized. But I'm not sure how old Windows > version is affected by this (lot of these issues were already fixed and > dependent library entry points should be called in the dependent order; > including PE TLS callbacks) and whether msvcrt library did not contain > some lazy initialization for some functions (so the issue could be > invisible).. One thing I have in mind is to prohibit building winpthreads as a DLL with static CRT. It almost never intended, but MSVC by default act as if /MT is used, which links static CRT. It is really easy to forget to add /MD switch when configuring for MSVC. So, with static CRT we only need to think about static winpthreads. > Hence for mingw-w64 builds, it should be mostly fine because there is no > static build of CRT. The main problem could be that msvc compiled build > where it is needed to think more about orders I think the best thing we can do is ensure that `*_init` functions do not call CRT functions. - Kirill Makurin |
|
From: Pali R. <pal...@gm...> - 2026-11-16 13:15:00
|
On Monday 16 November 2026 13:01:22 Kirill Makurin wrote: > On Monday, November 16th, 2026 at 12:44 PM, Pali Rohár <pal...@gm...> wrote: > > > .CRT.XI? is callback which can fail (return non-zero value) and for > > non-DLL builds is called before initialization of _argc/_argv variables. > > > > .CRT.XC? is callback which is called after all .CRT.XI? callbacks and > > must not fail. > > > > .ctors is callback declared via __attribute__((constructor)) which is > > called after all .CRT.XC? callbacks and must not fail. > > > > From the nature of C++ initialization, it is expected that C++ > > constructors are called after C runtime is already initialized, > > so C++ constructors are put into the .CRT.XI? or .ctors sections. > > > > But I guess for custom code it does not matter if is "C" or "C++". The > > important is order, if code expects that whole C runtime is initialized > > or if the code can fail and this failure has to be propagated back. > > > > IMHO, from .CRT.XC? is safe to call any CRT function. From .CRT.XI? it > > does not have to be safe to call every CRT function, but should be safe > > to call any WinAPI function. > > Using ".CRT.XI?" does sound like a good option to me. > > So far, we only call WinAPI functions. However, if I recall correctly, > Luca's changes may need to do memory allocation, and it is likely done > using `malloc`, which is a CRT function. For EXE builds which are using CRT DLL library there is mostly no difference as the CRT DLL library is initialized before EXE entry point is executed. The only difference is what statically linked init code into EXE build is doing (which is that _argc/_argv initialization or similar stuff). For msvc EXE builds which have statically linked with CRT library (mingw-w64 does not support this, it always uses CRT DLL library) those callback orders (the last letter) have impact because they are intermixed by linker at link order in which are called. And therefore statically linked CRT function for initializing malloc heap or stdio can be called after application's ".CRT.XI?" hook. That is why I wrote that it does not have to be safe to call every CRT function. For DLL builds it again depends on whether CRT library is statically linked into that DLL or not like above. And when it is linked dynamically to CRT DLL on older Windows versions the order of calling DLL entry points (and hence also DllMain) is not fully safe and IIRC, it can be called even before msvcrt/UCRT entry point (and so all callbacks .CRT.XI? / .CRT.XC? / __attribute__((constructor))) can be called before msvcrt is initialized. But I'm not sure how old Windows version is affected by this (lot of these issues were already fixed and dependent library entry points should be called in the dependent order; including PE TLS callbacks) and whether msvcrt library did not contain some lazy initialization for some functions (so the issue could be invisible). Hence for mingw-w64 builds, it should be mostly fine because there is no static build of CRT. The main problem could be that msvc compiled build where it is needed to think more about orders. > My changes also adds calls to `_onexit` and `abort`, but I think we could > remove them eventually. We should eventually replace use of `_onexit` with > more appropriate mechanism based on compiler and build type (DLL vs static). > > > The main benefit of .CRT.XI? is indication of failure because .CRT.XC? > > and __attribute__((constructor)) do not prove them. > > This sounds really helpful, e.g. it allow us to remove the `abort` call. Yes. And this also simplifies the code as we would have clear error path. |
|
From: LIU H. <lh_...@12...> - 2026-11-16 13:03:02
|
在 2026-11-16 20:44, Pali Rohár 写道: > But I guess for custom code it does not matter if is "C" or "C++". The > important is order, if code expects that whole C runtime is initialized > or if the code can fail and this failure has to be propagated back. > > IMHO, from .CRT.XC? is safe to call any CRT function. From .CRT.XI? it > does not have to be safe to call every CRT function, but should be safe > to call any WinAPI function. > > The main benefit of .CRT.XI? is indication of failure because .CRT.XC? > and __attribute__((constructor)) do not prove them. For mingw-w64, there's no static CRT, so C facilities are initialized either in the entry point of MSVCR* or UCRT DLL, or on demand. -- Best regards, LIU Hao |
|
From: Kirill M. <mai...@pr...> - 2026-11-16 13:01:39
|
On Monday, November 16th, 2026 at 12:44 PM, Pali Rohár <pal...@gm...> wrote: > .CRT.XI? is callback which can fail (return non-zero value) and for > non-DLL builds is called before initialization of _argc/_argv variables. > > .CRT.XC? is callback which is called after all .CRT.XI? callbacks and > must not fail. > > .ctors is callback declared via __attribute__((constructor)) which is > called after all .CRT.XC? callbacks and must not fail. > > From the nature of C++ initialization, it is expected that C++ > constructors are called after C runtime is already initialized, > so C++ constructors are put into the .CRT.XI? or .ctors sections. > > But I guess for custom code it does not matter if is "C" or "C++". The > important is order, if code expects that whole C runtime is initialized > or if the code can fail and this failure has to be propagated back. > > IMHO, from .CRT.XC? is safe to call any CRT function. From .CRT.XI? it > does not have to be safe to call every CRT function, but should be safe > to call any WinAPI function. Using ".CRT.XI?" does sound like a good option to me. So far, we only call WinAPI functions. However, if I recall correctly, Luca's changes may need to do memory allocation, and it is likely done using `malloc`, which is a CRT function. My changes also adds calls to `_onexit` and `abort`, but I think we could remove them eventually. We should eventually replace use of `_onexit` with more appropriate mechanism based on compiler and build type (DLL vs static). > The main benefit of .CRT.XI? is indication of failure because .CRT.XC? > and __attribute__((constructor)) do not prove them. This sounds really helpful, e.g. it allow us to remove the `abort` call. - Kirill Makurin |
|
From: Pali R. <pal...@gm...> - 2026-11-16 12:44:35
|
On Monday 16 November 2026 20:27:16 LIU Hao wrote: > 在 2026-11-16 20:06, Kirill Makurin 写道: > > Automake manual is somewhat unclear about `_LIBADD`, as it says > > it is used to add extra object files or libtool libraries[1]. > > > > However, it also says: > > > > _LDADD and _LIBADD are inappropriate for passing program-specific linker > > flags (except for -l, -L, -dlopen and -dlpreopen). Use the _LDFLAGS variable > > for this purpose. > > > > So, it seems that `_LIBADD` is the right place after all? > > > > Are there any other issues with these changes? > > Not really. > > Currently `winpthreads_init()` is called through a pointer in `.CRT$XCT` > which is for C++ initialization; I think this could be `.CRT$XIT`? .CRT.XI? is callback which can fail (return non-zero value) and for non-DLL builds is called before initialization of _argc/_argv variables. .CRT.XC? is callback which is called after all .CRT.XI? callbacks and must not fail. .ctors is callback declared via __attribute__((constructor)) which is called after all .CRT.XC? callbacks and must not fail. >From the nature of C++ initialization, it is expected that C++ constructors are called after C runtime is already initialized, so C++ constructors are put into the .CRT.XI? or .ctors sections. But I guess for custom code it does not matter if is "C" or "C++". The important is order, if code expects that whole C runtime is initialized or if the code can fail and this failure has to be propagated back. IMHO, from .CRT.XC? is safe to call any CRT function. From .CRT.XI? it does not have to be safe to call every CRT function, but should be safe to call any WinAPI function. The main benefit of .CRT.XI? is indication of failure because .CRT.XC? and __attribute__((constructor)) do not prove them. |