There is a bug in binutils 2.18 and current cvs about linking DLLs. It causes some crash in Wine DDLs. See http://bugs.winehq.org/show_bug.cgi?id=10783 I tested several binutils versions and it turned out the bug is not present in 2.17, but present in 2.17.50, up to current cvs. What's interesting is that the bug is only present in linux builds of the compiler; the pre-built win32 gcc from mingw, which uses some version of binutils 2.17.50, works properly. I can do regression testing if someone tells me how to; I've tried something with cvs but was unsuccessfull.
I've been doing bisecting and found out this commit causes the regression: http://sourceware.org/ml/binutils-cvs/2007-01/msg00093.html
Created attachment 2140 [details] libwine.dll linked with broken binutils and one commit before
That was just after 'dllwrap', before 'dlltool'
Hi Ambroz, (Sorry for the long delay in replying to this PR - I had hoped that the original author of the problem patch might have responded). I am not greatly familiar wit this code, but it seems to me that there are two likely areas where the bug may exist. Therefore please could try building two linkers, one with each of the two patches I am going to upload, and see if one or both of them fixes the problem ? Cheers Nick
Created attachment 2170 [details] possible fix 1
Created attachment 2171 [details] Second possible workaround
Well, I tried it, and the first patch didn't help, but the second fixed it!
Hi Ambroz, OK, that helps a bit. Now, please could you put together a *small* testcase that reproduces the problem so that we can investigate why the patch to pe.em is broken ? Cheers Nick
Created attachment 2186 [details] test case for the crash Well, here it is. It seems to crash in vsnprintf inside libfoo.c. Crashes both in WinXP and Wine.
I downloaded binutils-2.18.50-20080109-src.tar.gz and built the binutils on MINGW32_NT_5.1 (windows XP) and ran the compile.sh. The the dll is built correctly and the main.exe runs successfully. WHat is the correct way to reproduce the bug? thanks
I am unable to reproduce the bug with the current newest toolchain components. I tried using older toolchain components. Turns out the bug is longer present with the latest mingw-runtime, 3.14, but present with 3.13. So there probably is no bug in binutils, the change only triggered a bug within mingw-runtime.
Closing as reporter says bug in migw runtime