Hi,

I tried building wine 6.8 with mingw. All fine, just one problem, it 
reports error "undefined reference to `sincos'". Why, you may ask, since 
wine never calls sincos function? Well, it seems to be because mingw gcc 
11 enables sincos optimization: [0]. But, wine uses -nodefaultlibs, 
intending to provide libc functions with msvcrt; however, wine msvcrt 
doesn't implement any sincos. So, there is a mismatch: gcc accepts mingw 
claim to implement sincos (ok since mingwex implements it), then 
generates call to sincos, then fails at link time (because msvcrt does 
not implement it).

After adding -fno-builtin-{sin,cos}{,f} to CFLAGS, wine compiled and ran 
OK.

This issue seems to be worked around for winelib builds by adding 
-fno-builtin, so that gcc will not generate sincos (or most other 
problematic functions).

I think this issue could be worked around by adding those -fno-builtin-* 
flags for mingw builds. However, I think the sin/cos->sincos 
optimization is a good one, so maybe we could instead add sincos 
forwarder in msvcrt (calling sin+cos separately in case sincos is not 
implemented in libc?).

CCed mingw-w64-public@lists.sourceforge.net due to potential relevance 
and felixonm...@archlinux.org due to maintaining wine and mingw-gcc on 
Arch. You may need to subscribe in order to reply all. I look forward to 
hearing your thoughts.

Regards,
Alex.

[0] 
https://github.com/gcc-mirror/gcc/commit/4f48f31bbfc10697296ff004a92614d9249ca784


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

Reply via email to