Am 17.03.2013 13:50, schrieb Chung-Ju Wu: > 2013/3/17 Jens Mehler <jens.mehler@xxxxxxxxxx>: >> Hi, >> >> the problem I keep running into is something that I don't fully >> understand (yet). >> I wrote a new backend for GCC, ported the GNU-Toolchain to my target and >> got it running. >> >> The next thing I did: >> I wrote a small helloworld.c a start.s and an end.s. >> Everything that is needed is included in those files. When building the >> program myself: >> eco32-elf-gcc -S helloworld.c >> eco32-elf-as -o hello.o start.s helloworld.s end.s >> eco32-elf-ld -o hello.elf hello.o >> everything works like a charm. The program even runs in the simulator >> (after using eco32-elf-objdump -O binary hello.elf hello.bin) >> >> After that I tried using only gcc: >> gcc -o hello.elf start.s helloworld.c end.s >> after that I got "ld can't find crt0.o". > Hi Jens, > > It is controlled by spec mechanism. > The following is the link for its syntax: > http://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html > > In your case, I think you should define your own > STARTFILE_SPEC and ENDFILE_SPEC to guide gcc driver > using start.o and end.o files. > > > Best regards, > jasonwucj > Hi jasonwucj, As I figured out that solves the first problem :) In retrospective I have to admit that I posted this a bit to early because I traced the real error back to either as or ld. The way I compiled stuff myself is not the way gcc invokes stuff.13:06 < okarin> ../../../build/bin/eco32-elf-gcc -v -nostdinc -nostdlib -S main.c build/bin/eco32-elf-as -v -o start.o start.s build/bin/eco32-elf-as -v -o end.o end.s build/bin/eco32-elf-as -v -o main.o main.s build/bin/eco32-elf-ld -v -o main.elf start.o main.o end.o If I do it this way the problem with the relocation surface. I still try to figure out what it could be. Because doing it the other way results in a perfect binary. Thank for the reply, With best regards ~Jens