In an attempt to build a gcc 4.x.x cross compiler for arm, I'm stuck at a missing crti.o
file in the $BUILD_DIR/gcc
subdirectory.
An strace
on the top level Makefile
shows that the compiled xgcc
is calling the cross-linker ld
with "crti.o"
as an argument. I'm assuming that if the cross linking ld
is being called, the native /usr/lib/crti.o
is not what is needed.
I can see that in the gcc source tree there is a number of potential sources for a crti object (including $SRC_DIR/gcc/config/arm/crti.asm
).
How can I configure the gcc build to insure this file is built (or omitted from the ld
command)?
Here is my configure line:
/x-tools/build/gcc-4.5.0$ ../../src/gcc-4.5.0/configure --target=arm-linux --prefix=/opt/arm-tools --disable-threads --enable-languages=c
The real answer is that it should compile
crti.o
if one was to build an arm-elf target. In building an arm-linux target, the gcc people reasonably assume that glibc has been compiled previously and it will provide thecrti.o
startup. Perfectly reasonable, if you're upgrading.Building a new root file system is another story, a paradoxical one at that (which comes first: glibc or gcc?). An approach (endorsed, but I've not yet succeeded with) is to build a stand-alone gcc (arm-elf\static, say) then glibc, then gcc again.
It seems as though some have addressed the missing
crti.o
in an arm-linux target by modfiyinggcc\config\arm\t-linux
. Rather than relying on an unexisting glibc, the kludge is to use the arm-elf provided version of thecrti.o
. An example can be found here.