Florent DEFAY <spira.inhabitant@xxxxxxxxx> writes: > I am working on a new port (cross compilation). I am wondering about > crt. Binutils are already developped. > > I need a crt0.o for the linker. I set some macros this way: > > #define STARTFILE_SPEC "%(crt_binutils)" > #define CRT_BINUTILS_SPECS "crt0.o%s" > #define EXTRA_SPECS \ > {"crt_binutils", CRT_BINUTILS_SPECS}, > > Then GCC tells the linker to link crt0.o found in: > $TARGET_GCC_INSTALL/bin/../lib/gcc/target/4.3.3/crt0.o > > This crt0.o was compiled with target-gcc manually. I would like GCC to > generate the crt file automatically > during the installation. I read crtstuff.c but I cannot find which > macros in target.h to set so > crt0.o is built, and how to control what it contains. gcc does not generally provide a crt0. That generally comes from your board support library--in the GNU system, this is often libgloss. crtstuff.c is used to generate crtbegin.o and crtend.o, which are important for running global constructors, but are not the same as crt0. There is at least one gcc target which provides a crt0 (actually crt1, but it's the same thing really), so if you really want to include crt0 in your gcc sources look at gcc/config/sparc/t-sol2 and see extra_parts in the entry for sparc-*-solaris2* in gcc/config.gcc. Ian