Hi,

I am having some trouble running a simple example of C++ for uCLinux, on a 
Coldfire board, M5282EVB.

I have made an hello world application in c++ that when run on the board 
returns the message : BINFMT_FLAT: reloc outside program 0xb6580000 (0 - 
0x19504/0xdde0), killing hello!

I have searching on web for solutions, and see some erros alike, but the 
solutions founded can't solve my problem.

The exact code of hello and the same makefile, but with the lines of new and 
delete commented don't execute any error, so I think that the error can occur 
because of libsupc++ or some problem with the flags on gcc.

I have tried with other kernels, and others libsupc++ of tools 
(lib/m5307/libsupc++.a , lib/m5282/libsupc++.a) but returned the same results.

I am using the coldfire dist : uClinux-dist-20070130.tar.gz and the binaries 
tools of m68k-uclinux-tools-20061214.sh with software gcc (GCC) 4.1.3 and linux 
kernel 2.6.x.

The source code is : 

#include <stdio.h>
#include <stdlib.h>

class CA {
public:
CA() {
printf ("teste!!!\n");
};
};

int main(){

printf("Hello World !!!\n");
CA a;

printf("Hello World !!!\n");
char* b = new char;
delete b;
return 1;
}

I program is a user application, and is on user apps of uClinux, the makefile 
is : 

EXEC = hello
OBJS = hello.o

CXXLIBS += -lsupc++


all: $(EXEC)

$(EXEC): $(OBJS) 
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(CXXLIBS) 

romfs:
$(ROMFSINST) /bin/$(EXEC)

clean:
-rm -f $(EXEC) *.elf *.gdb *.o

And the commands generated for compiling are : 

* for generate the hello.o

ucfront-g++ m68k-elf-g++ -m5307 -DCONFIG_COLDFIRE -Wl,--fatal-warnings 
-Wl,-elf2flt -Wl,-move-rodata -msep-data -Wl,--fatal-warnings -Wl,-elf2flt 
-Wl,-move-rodata -msep-data -o hello hello.o -Wl,-Bstatic -lstdc++ 
-Wl,-Bdynamic  -lsupc++ 

* and for generate the executable, hello :
ucfront-g++ m68k-elf-g++ -m5307 -DCONFIG_COLDFIRE -Wl,--fatal-warnings 
-Wl,-elf2flt -Wl,-move-rodata -msep-data -Wl,--fatal-warnings -Wl,-elf2flt 
-Wl,-move-rodata -msep-data -o hello hello.o -Wl,-Bstatic -lstdc++ 
-Wl,-Bdynamic  -lsupc++ 

Thanks for the time,
AnĂ­bal

-- 

_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to