GNU linker failure?

Kevin Buettner kev@primenet.com
Tue, 30 Jan 2001 19:15:48 -0700


On Jan 26,  1:28pm, Stephen Smith wrote:

> I sent this message earlier, but never recieved my copy back, in fact I haven't recieved anything from plug today.
> 
> I built a cross compiler for the motorola power pc according to instructions that I received from Mumit Khan
> (in Wisconsin).  According to the logs, the compiler installed correctly.
> 
> As the fragment below shows, when I try to use the compiler, it can't find the _start entry.  I am told that 
> the symbol is in the crt0* which is on my system. How do I tell the compiler where to find the the libraries for the link step.
> 
> I think that that is my problem.
> 
> > ssmith@AZ75-SSMITH ~
> > $ $target-gcc hello.c
> > /usr/local/lib/gcc-lib/powerpc-motorola-elf/2.95.2-6/../../../../powerpc-motorola-elf/bin/ld: warning: cannot find entry symbol _start;
> defaulting to 01800074
> > /cygdrive/c/DOCUME~1/ssmith/LOCALS~1/Temp/ccF4RY4I.o: In function `main':
> > /cygdrive/c/DOCUME~1/ssmith/LOCALS~1/Temp/ccF4RY4I.o(.text+0x20): undefined reference to `printf'
> > collect2: ld returned 1 exit status
> >

For your install, I think the linker is looking for crt0.o in
/usr/local/powerpc-motorola-elf/lib/crt0.o.  Just copy crt0.o from
the target system to this location.  (At least that's how I usually
do it.)

Doing "gcc -v -save-temps ..." is also helpful for diagnosing problems
like this.  (The -save-temps will cause the intermediate files to be
preserved.  This is helpful if you need to debug one of the toolchain
components.)

Kevin