Now I played a bit with it based on your example from bug report and
adding "extern const PIMAGE_TLS_CALLBACK __xl_f;" is NOT fixing the
problem when the /O2 /GL flags are used.

Here is the link to godbolt where anybody can play with it and verify
what is working what not: https://godbolt.org/z/z4sreEcY4

So based on above testing, I think that the additional declaration with
extern keyword is unnecessary and does not fix the main issue when /GL
together with /O2 is enabled.

I do not know how to fix it.

On Tuesday 23 September 2025 14:38:37 Pali Rohár wrote:
> That it really interesting. At least it proves that I was wrong about
> /include: assumption.
> 
> So if I understand correctly, if you add following line to your example
> then it start working, right? "extern const PIMAGE_TLS_CALLBACK __xl_f;"
> 
> In this case the extern is there needed for msvc and I would suggest to
> add a comment into mingw-w64 why additional extern declaration (which
> seems unnecessary from C point of view) is required.
> 
> On Tuesday 23 September 2025 14:10:31 Antonin Décimo wrote:
> > I experimented with MSVC and LTO two years ago, and had problems
> > applying them to winpthreads. I may not have been very rigorous, and
> > to get certainty the whole process would need to be re-tested. I did
> > report a bug, but it was deemed invalid.
> > https://developercommunity.visualstudio.com/t/Whole-program-optimization-and-optimized/10531811


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to