Bug 5487 - linking with dllwrap causes crash
Summary: linking with dllwrap causes crash
Status: RESOLVED INVALID
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.18
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-16 15:41 UTC by Ambroz Bizjak
Modified: 2009-10-14 11:45 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: mingw32
Build: i686-pc-linux-gnu
Last reconfirmed:


Attachments
libwine.dll linked with broken binutils and one commit before (859.50 KB, application/x-tbz)
2007-12-16 22:30 UTC, Ambroz Bizjak
Details
possible fix 1 (356 bytes, patch)
2008-01-04 15:30 UTC, Nick Clifton
Details | Diff
Second possible workaround (463 bytes, patch)
2008-01-04 15:30 UTC, Nick Clifton
Details | Diff
test case for the crash (13.37 KB, application/x-zip)
2008-01-08 13:31 UTC, Ambroz Bizjak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ambroz Bizjak 2007-12-16 15:41:20 UTC
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.
Comment 1 Ambroz Bizjak 2007-12-16 22:15:46 UTC
I've been doing bisecting and found out this commit causes the regression:
http://sourceware.org/ml/binutils-cvs/2007-01/msg00093.html
Comment 2 Ambroz Bizjak 2007-12-16 22:30:26 UTC
Created attachment 2140 [details]
libwine.dll linked with broken binutils and one commit before
Comment 3 Ambroz Bizjak 2007-12-16 22:32:02 UTC
That was just after 'dllwrap', before 'dlltool'
Comment 4 Nick Clifton 2008-01-04 15:26:54 UTC
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
Comment 5 Nick Clifton 2008-01-04 15:30:15 UTC
Created attachment 2170 [details]
possible fix 1
Comment 6 Nick Clifton 2008-01-04 15:30:59 UTC
Created attachment 2171 [details]
Second possible workaround
Comment 7 Ambroz Bizjak 2008-01-04 20:29:29 UTC
Well, I tried it, and the first patch didn't help, but the second fixed it!
Comment 8 Nick Clifton 2008-01-07 16:34:54 UTC
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
Comment 9 Ambroz Bizjak 2008-01-08 13:31:35 UTC
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.
Comment 10 murali vemulapati 2008-02-17 02:23:08 UTC
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
Comment 11 Ambroz Bizjak 2008-02-17 17:37:14 UTC
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.
Comment 12 Alan Modra 2009-10-14 11:45:00 UTC
Closing as reporter says bug in migw runtime