On Mon, 2009-07-06 at 08:53 +0200, Johnny Willemsen wrote:
> Hi,
> 
> > > You need to either make both calls be to __main, or to __gccmain,
> > never to both.
> > 
> > I think I fixed that one already.
> > 
> > Right now, a constructor from libstdc++ is dying when it gets called
> > for the first time.
> > 
> > It happens to get mentioned in a linker message about auto-import. Not
> > a coincidence, I'm sure.
> > 
> > Btw that message doesn't appear on ARM, also the same code works on
> > ARM.
> 
> As Danny points out in some other points, for x86 we now have a problem with
> a constructor crashing. It happens only on x86  when using shared libraries.
> Danny has now an x86 target to test on, I think that is the real last issue
> before we can say that cegcc also works on x86.

Here is the current state of this work.
- linker mentions ios_base::Init::Init()
- crash occurs, says gdb, in ios_base::Init __ioinit;
- gdbserver occasionally shows the glitch with reading dll names
  (Symbol file not found for li)

I am really not sure where to look next for tracking/solving this
constructor crash problem.

  Danny

pavilion: {946} cat hello.C
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
        cout << "Hello\n" ;
}
pavilion: {947} make clean
rm -f *.o *.exe *.rsc
pavilion: {948} make
i386-mingw32ce-g++ -g -D_WIN32_IE=0x0400 -D_WIN32_WCE=0x0400 -o
hello.exe hello.C
Info: resolving std::cout  by linking to __imp___ZSt4cout (auto-import)
Info: resolving std::basic_ostream<char, std::char_traits<char> >&
std::operator<< <std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&, char const*) by linking to
__imp___ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
(auto-import)
Info: resolving std::ios_base::Init::Init() by linking to
__imp___ZNSt8ios_base4InitC1Ev (auto-import)
Info: resolving std::ios_base::Init::~Init() by linking to
__imp___ZNSt8ios_base4InitD1Ev (auto-import)
/opt/x86mingw32ce/lib/gcc/i386-mingw32ce/4.4.0/../../../../i386-mingw32ce/bin/ld:
 warning: auto-importing has been activated without --enable-auto-import 
specified on the command line.
This should work unless it involves constant data structures referencing
symbols from auto-imported DLLs.
pavilion: {949} cp hello.exe ~/x86/


\network\x86> gdbserver :9999 /network/x86/hello.exe
Process /network/x86/hello.exe created; pid = 80674830
Listening on port 9999
Remote debugging from host 172.17.1.10
Detaching from process 80674830


pavilion: {954} i386-mingw32ce-gdb hello.exe
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show
copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu
--target=i386-mingw32ce"...
(gdb) target remote ebox:9999
Remote debugging using ebox:9999
[New Thread 80740366]
Error while mapping shared library sections:
\network\x86\libgcc_s_sjlj-1.dll: No such file or directory.
Error while mapping shared library sections:
li: No such file or directory.
Error while mapping shared library sections:
\Windows\coredll.dll: No such file or directory.
Symbol file not found for \network\x86\libgcc_s_sjlj-1.dll
Symbol file not found for li
Symbol file not found for \Windows\coredll.dll
WinMainCRTStartup (hInst=0x4cf000e, hPrevInst=0x0, lpCmdLine=0x2e01fc70,
nCmdShow=5)

at /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/mingw/crt3.c:35
35      {
Current language:  auto; currently c
(gdb) s
41        _fpreset ();                  /* Supplied by the runtime
library. */
(gdb) 
44        _pei386_runtime_relocator ();
(gdb) 

_pei386_runtime_relocator ()

at 
/home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/mingw/pseudo-reloc.c:33
33        for (r = (runtime_pseudo_reloc*) start; r <
(runtime_pseudo_reloc*) end; r++)
(gdb) 

46      }
(gdb) 
WinMainCRTStartup (hInst=0x4cf000e, hPrevInst=0x0, lpCmdLine=0x2e01fc70,
nCmdShow=5)

at /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/mingw/crt3.c:49
49        __atexit_init();
(gdb) 

__atexit_init ()
at /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/mingw/atexit.c:65

65        first_atexit = (p_atexit_fn*) malloc (32 * sizeof
(p_atexit_fn));
(gdb) 
66        if (first_atexit == NULL ) /* can't allocate memory */
(gdb) 
73        *first_atexit =  NULL;
(gdb) 
74        next_atexit = first_atexit;
(gdb) 
76      }
(gdb) 
WinMainCRTStartup (hInst=0x4cf000e, hPrevInst=0x0, lpCmdLine=0x2e01fc70,
nCmdShow=5)

at /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/mingw/crt3.c:54
54        __gccmain();
(gdb) 
__gccmain ()
at /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/mingw/gccmain.c:79
79        if (!initialized)
(gdb) 
81            initialized = 1;
(gdb) 
86      }
(gdb) 
__gccmain ()
at /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/mingw/gccmain.c:83
83            __mingw_do_global_ctors ();
(gdb) 
__mingw_do_global_ctors ()

at /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/mingw/gccmain.c:40
40      {
(gdb) 
41        unsigned long nptrs = (unsigned long) __CTOR_LIST__[0];
(gdb) 
49        if (nptrs == -1)
(gdb) 
58        for (i = nptrs; i >= 1; i--)
(gdb) 
60            __CTOR_LIST__[i] ();
(gdb) 
global constructors keyed to main () at hello.C:8
8       }
Current language:  auto; currently c++
(gdb) 
__static_initialization_and_destruction_0 (__initialize_p=1,
__priority=65535) at hello.C:8
8       }
(gdb) 
72        static ios_base::Init __ioinit;
(gdb) 
Cannot access memory at address 0x4235174a
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) n
Cannot find bounds of current function
(gdb) fin
Run till exit from #0  0x4235174a in ?? ()

Program received signal SIGSEGV, Segmentation fault.
0x4235174a in ?? ()
(gdb) detach
Ending remote debugging.
(gdb) q
pavilion: {955} i386-mingw32ce-objdump -x hello.exe | grep DLL
 vma:            Hint    Time      Forward  DLL       First
        DLL Name: COREDLL
        DLL Name: libstdc++-6.dll
        DLL Name: libstdc++-6.dll
        DLL Name: libstdc++-6.dll
        DLL Name: libstdc++-6.dll
        DLL Name: libstdc++-6.dll



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


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to