[uClinux-dev] Does ucfront work with libstdc++.a?

kitefree kitefree at so-net.net.tw
Sat Oct 20 09:52:24 EDT 2007


Hi,
Recently I have been working on c++ program with uClinux-dist. And I found
there seems to be some problem with using ucfront-g++ with libstdc++.a(gcc 3.4.4). 
As you can see how I build my C++ program,
/home/nerokuo/uClinux/tools/ucfront-g++ arm-linux-g++ -D__PIC__ -fpic -msingle-pic-base -msoft-float -Wall -c main.cpp
/home/nerokuo/uClinux/tools/ucfront-g++ arm-linux-g++ -L/home/nerokuo/uClinux/uClibc/lib -Wl,-elf2flt -Wl,--fatal-warnings -o helloworld main.o -msoft-float -lstdc++

After builing my program successfully. I run it on my verify board and it crashes
with this error when running at this line "test *p = new test(10);",
/mnt> ./helloworld
BINFMT_FLAT: Loading file: ./helloworld
Mapping is 5d0000, Entry point is 44, data_start is b840
Load ./helloworld: TEXT=5d0040-5db840 DATA=1f0004-1f2234 BSS=1f2234-1f6484
Unhandled fault: alignment exception (0x5000001) at 0x001b7fec
rld 1 !Internal error: Oops: 5000001 [#1]
CPU: 0
PC is at 0x5d89cc
LR is at 0x5d9334
pc : [<005d89cc>]    lr : [<005d9334>]    Not tainted
sp : 001f7ee8  ip : 001f7f60  fp : 001f7f5c
r10: 005db840  r9 : 00000000  r8 : 00000000
r7 : 00000001  r6 : 001f7f98  r5 : 001f7f00  r4 : e1500003
r3 : 00000058  r2 : 00009350  r1 : 001f236a  r0 : 001f7f00
Flags: nzCv  IRQs on  FIQs on  Mode USER_32  Segment kernel
Process helloworld (pid: 18, stack limit = 0x001b6250)

And this is the main.cpp of my test program,
#include <stdio.h>
#include <unistd.h>

class test
{
public:
    test(int n) {i=n;}
    int i;

};

int main(int argc, char *argv[])
{
    test *p = new test(10);
    printf("Nero: test = %d\n", p->i);
    delete p;
    return 0;
}

Could you help identify why this crash happens? Thanks a lot.

Nero


More information about the uClinux-dev mailing list