[Mingw-users] Address fixup applied TWICE (was: ... bad jmp to malloc?)
- Date: Fri, 31 Aug 2007 16:37:48 -0400
- From: David Daeschler <daveregs@xxxxxxxxxx>
- Subject: [Mingw-users] Address fixup applied TWICE (was: ... bad jmp to malloc?)
Hi Again Brian,
Once again, I'm back with more information about the Application Failed
to Initialize problem.
It looks like in certain cases, 2 reloc entries are being inserted for
the jmp_msvcrt.dll!malloc entry of some of my DLLs.
xerces_c happens to be one of the DLLs that is affected, here is a
disassembly (using PE Explorer Disassembler):
6E763C60 jmp [msvcrt.dll!malloc]
That is the jmp *ADDRESS that we've been seeing. Before any fixups are
applied, it matches the address of the msvcrt import table entry
in .idata:
6E9AB300 msvcrt.dll!malloc:
6E9AB300 70B74200 dd ??
However, when I load the DLL I get an access violation:
Dump of assembler code for function malloc:
0x014d3c60 <malloc+0>: jmp *0x9448b300
Notice that the DLL has been relocated. The new base of the DLL is:
BASE SIZE IMAGE BASE
libxerces-c2_7_0.dll 0x12F0000 0x452000 0x6E580000
That is a difference of: 0x6E580000 - 0x12F0000 = 6D290000
If I Take the address of 6E9AB300 and perform a manual "fixup" on it, I
get:
6E9AB300 - (FIXUP) 6D290000 = 171B300
Hmmm, but the jmp is to *0x9448b300. Lets do another "fixup":
171B300 - 6D290000 = 0x9448b300
hmmmmmm look familiar?!
0x014d3c60 <malloc+0>: jmp *0x9448b300
So then I looked at the Relocation entries in the DLL I built, and sure
enough there are 2 entries for 6E763C62. Both in .text according to PE
Explorer Disassembler.
Xerces appears to use dllwrap in its build process.
$ ld -v
GNU ld version 2.17.50 20060824
$ gcc -v
Reading specs from d:/MinGW/bin/../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5/configure --with-gcc --with-gnu-ld
--with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw
--enable-threads --disable-nls --enable-languages=c,c
++,f77,ada,objc,java --disable-win32-registry --disable-shared
--enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x
--enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter
--enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw special)
Thanks again,
- Dave
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
- References:
- [Mingw-users] Update: application failed to initialize, bad jmp to malloc?
- Re: [Mingw-users] Update: application failed to initialize, bad jmp to malloc?
- Re: [Mingw-users] Update: application failed to initialize, bad jmp to malloc?
- Re: [Mingw-users] Update: application failed to initialize, bad jmp to malloc?
- Re: [Mingw-users] Update: application failed to initialize, bad jmp to malloc?
- Re: [Mingw-users] Update: application failed to initialize, bad jmp to malloc?
- Re: [Mingw-users] Update: application failed to initialize, bad jmp to malloc?
- Re: [Mingw-users] Update: application failed to initialize, bad jmp to malloc?
- Re: [Mingw-users] Update: application failed to initialize, bad jmp to malloc?
- Re: [Mingw-users] Update: application failed to initialize, bad jmp to malloc?
- Re: [Mingw-users] Update: application failed to initialize, bad jmp to malloc?
- Re: [Mingw-users] Update: application failed to initialize, bad jmp to malloc?
- Re: [Mingw-users] Update: application failed to initialize, bad jmp to malloc?
- Re: [Mingw-users] Update: application failed to initialize, bad jmp to malloc?
- Re: [Mingw-users] Update: application failed to initialize, bad jmp to malloc?