This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Need help figuring out DLL load problem


Hi,

I've been chasing a bug for a long time now, I need a pointer to be able
to look further.

Environment : the cegcc project, cross-development tools that target
Windows CE. Initially on ARM, now also on x86. This question is about
x86.

I'm trying to get a gcc 4.4.0 generated minimal C++ program to work
against a DLL version of libstdc++.

The symptom is that the application crashes, a debugger appears to point
to a constructor of libstdc++.

When looking at the code before and while executing, this is indeed
where things goes wrong, and it looks like a relocation is messed up.

When using i386-mingw32ce-gdb on the executable, but not connecting to
the runtime process, the code looks like this :

(gdb) disass 0x401080 0x4010c0
Dump of assembler code from 0x401080 to 0x4010c0:
0x00401080 <_Z41__static_initialization_and_destruction_0ii+3>: sub
$0x18,%esp
0x00401083 <_Z41__static_initialization_and_destruction_0ii+6>: cmpl
$0x1,0x8(%ebp)
0x00401087 <_Z41__static_initialization_and_destruction_0ii+10>:
jne    0x40109e <_fu2___ZNSt8ios_base4InitC1Ev+4>
0x00401089 <_Z41__static_initialization_and_destruction_0ii+12>:
cmpl   $0xffff,0xc(%ebp)
0x00401090 <_Z41__static_initialization_and_destruction_0ii+19>:
jne    0x40109e <_fu2___ZNSt8ios_base4InitC1Ev+4>
0x00401092 <_Z41__static_initialization_and_destruction_0ii+21>:
movl   $0x403000,(%esp)
0x00401099 <_Z41__static_initialization_and_destruction_0ii+28>:
call   0x404130 <_imp___ZNSt8ios_base4InitC1Ev>

After connecting to the process (it is running on a real device, under
gdbserver), the code looks different (and wrong !) :

(gdb) disass 0x401080 0x4010c0
Dump of assembler code from 0x401080 to 0x4010c0:
0x00401080 <_Z41__static_initialization_and_destruction_0ii+3>: sub
$0x18,%esp
0x00401083 <_Z41__static_initialization_and_destruction_0ii+6>: cmpl
$0x1,0x8(%ebp)
0x00401087 <_Z41__static_initialization_and_destruction_0ii+10>:
jne    0x40109e <_fu2___ZNSt8ios_base4InitC1Ev+4>
0x00401089 <_Z41__static_initialization_and_destruction_0ii+12>:
cmpl   $0xffff,0xc(%ebp)
0x00401090 <_Z41__static_initialization_and_destruction_0ii+19>:
jne    0x40109e <_fu2___ZNSt8ios_base4InitC1Ev+4>
0x00401092 <_Z41__static_initialization_and_destruction_0ii+21>:
movl   $0x403000,(%esp)
0x00401099 <_Z41__static_initialization_and_destruction_0ii+28>:
call   0x423517be

The call statement (last line) doesn't look right. It even points to a
location outside the DLL, or so it seems :

(gdb) info share
>From        To          Syms Read   Shared Object Library
                        No          \network\x86\libgcc_s_sjlj-1.dll
0x41ee1000  0x41fb2990
Yes         /opt/x86mingw32ce/i386-mingw32ce/lib/libstdc++-6.dll
                        No          \Windows\coredll.dll
(gdb) 

I have all kinds of additional information (objdump output and such).

The "application" itself looks like this :
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
        cout << "Hello\n" ;
}

I need a pointer to figure out where next to look. How can I assess
whether this is a g++ or a binutils issue ?

Thanks,

	Danny


-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]