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

See the CrossGCC FAQ for lots more information.


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

Re: problems with simple C++ program Alpha binary


On Nov 12, 2009, at 1:47 PM, Kenneth Hoste wrote:

> 
> Just wanted to give this a little nudge...
> 
> Does anyone have any idea why a fairly straightforward build of an Alpha crosscompiler
> fails to produce working binaries for C++ programs involving the C++ IO library?
> 
> As far as I can figure it out, something is wrong with the crosscompiler itself here...

For future reference, replacing GCC 4.2.4 with GCC 4.3.4 in the crosscompiler
solves this issue. So, it's probably a bug in GCC 4.2.4 itself, or something related...

K.

> On Nov 9, 2009, at 10:27 PM, Kenneth Hoste wrote:
> 
>> Hello,
>> 
>> I successfully built a crosscompiler for Alpha (EV5)/Linux (host: x86_64/Linux) using crosstool-ng.
>> It was a breeze, so thanks to everyone involved in this project, I probably wouldn't have been
>> able to get an Alpha/Linux crosscompiler built otherwise.
>> 
>> I configured it as follows:
>> 
>> 	• GCC 4.2.4
>> 	• binutils 2.19.1
>> 	• glibc 2.9
>> 	• GMP 4.3.1
>> 	• MPFR 2.4.1
>> 	• Linux kernel 2.6.31.1
>> 	• support for C, C++ and Fortran
>> 
>> I've used the crosscompiler to obtain Alpha binaries for SPEC CPU2000 and CPU2006,
>> and have been testing them using the M5 simulator (m5sim.org).
>> 
>> The binaries work without problems for most of the benchmarks, but are troublesome for others.
>> 
>> Most of the problems I'm running into involve getting working binaries for C++ programs, even
>> very simple ones.
>> 
>> For example, running a compiled version of the following "hello world" C++ testcase results in a
>> program crash (complete error messages at the end of this email).
>> 
>> 	#include <iostream>
>> 	using namespace std;
>> 
>> 	int main()
>> 	{
>> 	  cout << "Hello world\n";
>> 	  return 0;
>> 	}
>> 
>> The problem does not occur when the C++-style IO is replaced by C-style IO (stdio.h).
>> 
>> Does anyone know what could be the issue causing these problems?
>> I suspect something is wrong with my crosscompiler setup, but I have no idea where
>> to look or how to figure it out.
>> 
>> Any comments or pointers in the direction of solving this would be highly appreciated...
>> 
>> 
>> Error message using M5:
>> 
>> 	panic: Tried to execute unmapped address 0x12048e5f4.
>> 
>> Error message on native Alpha/Linux hardware:
>> 
>> 	Segmentation fault (core dumped)
>> 
>> gdb backtrace on native Alpha/Linux hardware:
>> 
>> (gdb) bt
>> #0  0x00000001201463d8 in _IO_2_1_stderr_ ()
>> #1  0x00000001200b082c in malloc ()
>> #2  0x000000012005d344 in __cxa_allocate_exception (thrown_size=128)
>>  at /user/data/gent/vsc400/vsc40023/tools/crosstool-ng.1.5.0/targets/src/gcc-4.2.4/libstdc++-v3/libsupc++/eh_alloc.cc:104
>> #3  0x00000001200496b4 in std::__throw_runtime_error (
>>  __s=<value optimized out>)
>>  at /user/data/gent/vsc400/vsc40023/tools/crosstool-ng.1.5.0/targets/src/gcc-4.2.4/libstdc++-v3/src/functexcept.cc:84
>> #4  0x00000001200441fc in std::locale::facet::_S_create_c_locale (
>>  __cloc=<value optimized out>, __s=<value optimized out>)
>>  at c++locale.cc:141
>> #5  0x000000012004bb18 in std::locale::facet::_S_initialize_once ()
>>  at /user/data/gent/vsc400/vsc40023/tools/crosstool-ng.1.5.0/targets/src/gcc-4.2.4/libstdc++-v3/src/locale.cc:200
>> #6  0x000000012004bb54 in std::locale::facet::_S_get_c_locale ()
>>  at /user/data/gent/vsc400/vsc40023/tools/crosstool-ng.1.5.0/targets/src/gcc-4.2.4/libstdc++-v3/src/locale.cc:213
>> #7  0x0000000120047484 in codecvt (this=0x120149710,
>>  __refs=<value optimized out>)
>>  at /user/data/gent/vsc400/vsc40023/tools/crosstool-ng.1.5.0/targets/src/gcc-4.2.4/libstdc++-v3/src/codecvt.cc:44
>> #8  0x000000012004c6bc in _Impl (this=0x120149268,
>>  __refs=<value optimized out>)
>>  at /user/data/gent/vsc400/vsc40023/tools/crosstool-ng.1.5.0/targets/src/gcc-4.2.4/libstdc++-v3/src/locale_init.cc:387
>> #9  0x000000012004d0f0 in std::locale::_S_initialize_once ()
>>  at /user/data/gent/vsc400/vsc40023/tools/crosstool-ng.1.5.0/targets/src/gcc-4.2.4/libstdc++-v3/src/locale_init.cc:255
>> #10 0x000000012004d3f8 in locale (this=0x80)
>>  at /user/data/gent/vsc400/vsc40023/tools/crosstool-ng.1.5.0/targets/src/gcc-4.2.4/libstdc++-v3/src/locale_init.cc:214
>> #11 0x00000001200250d4 in basic_streambuf (this=0x120147960)
>>  at /user/data/gent/vsc400/vsc40023/tools/crosstool-ng.1.5.0/targets/alphaev5-unknown-linux-gnu/build/build-cc/alphaev5-unknown-linux-gnu/libstdc++-v3/include/streambuf:462
>> #12 0x000000012001f2ac in stdio_sync_filebuf (this=0x80, __f=0x12005d344)
>>  at /user/data/gent/vsc400/vsc40023/tools/crosstool-ng.1.5.0/targets/alphaev5-unknown-linux-gnu/build/build-cc/alphaev5-unknown-linux-gnu/libstdc++-v3/include/ext/stdio_sync_filebuf.h:72
>> #13 0x0000000120000ad4 in Init (this=<value optimized out>)
>>  at /user/data/gent/vsc400/vsc40023/tools/crosstool-ng.1.5.0/targets/src/gcc-4.2.4/libstdc++-v3/src/ios_init.cc:89
>> #14 0x00000001200006b4 in __static_initialization_and_destruction_0 ()
>> #15 0x0000000120000718 in global constructors keyed to main ()
>> #16 0x00000001200f7e38 in __do_global_ctors_aux ()
>> #17 0x0000000120000240 in _init ()
>> 
>> greetings,
>> 
>> Kenneth
>> 
>> 
>> --
>> For unsubscribe information see http://sourceware.org/lists.html#faq
>> 
> 
> 
> --
> For unsubscribe information see http://sourceware.org/lists.html#faq
> 


--
For unsubscribe information see http://sourceware.org/lists.html#faq


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