Q: can't explain difference between ARM/i386-mingw32ce trivial C++ pgm

Danny Backx danny.backx@scarlet.be
Sun Jun 21 06:37:00 GMT 2009


Hi,

The cegcc project offers a cross-compiler, the target is your average
ARM based pocketpc/smartphone (Windows CE based). A new development is
for x86 based targets. This new stuff is based on gcc-4.4.0 .

My question is that a trivial C++ program
  #include <iostream>
  using namespace std;
  int main(int argc, char *argv[])
  {
        cout << "Hello\n" ;
  }
works on ARM, but fails on x86.

The build produces a different set of warnings though, see below.

Debugging the malfunctioning program on x86 (which is hard,
cross-debugging a target which I'm learning to work with) appears to
reveal that the crash occurs in one of the symbols mentioned :
  std::ios_base::Init::Init()

Note that this is the message that comes up for the i386 build but not
for the ARM build.

Can anyone point me to potential causes ? Remember, this same
application will run well on ARM.

Thanks,

	Danny

> When I compile the same program with arm-mingw32ce-g++ or with
> i386-mingw32ce-g++ , the results are different.
> 
> pavilion: {124} 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: {125} arm-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)
> /opt/mingw32ce/lib/gcc/arm-mingw32ce/4.4.0/../../../../arm-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: {126} 
> 
> The std::ios_base::Init::Init() is the constructor that crashes the
> application (but only on i386).
> 
> What could explain the difference between ARM and i386 ?
> 
>         Danny
-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info




More information about the Libstdc++ mailing list