GCC Does Not Look At libc.a for PowerPC-EABI

Brendan John Simon brendan@dgs.monash.edu.au
Sun Aug 15 05:19:00 GMT 1999


Roger Racine wrote:

> The linker gives me the following message:
>
> ---
> $/usr/local/cygnus/ecosSWtools-990319/H-i686-pc-linux-gnu/bin/powerpc-eabi-g
> cc  test_ppc.c
> /usr/local/cygnus/ecosSWtools-990319/H-i686-pc-linux-gnu/lib/gcc-lib/powerpc
> -eabi/2.9-ecosSWtools-990319/../../../../powerpc-eabi/bin/ld: warning:
> cannot find entry symbol _start; defaulting to 01800074
> /tmp/cca166161.o: In function `main':
> /tmp/cca166161.o(.text+0x28): undefined reference to `strlen'
> collect2: ld returned 1 exit status
> ---
>
> It appears that the powerpc-eabi configuration does not have the -lc option
> provided to the linker, but I am not at all familiar enough with the
> configuration files to be sure.  Newlib is built as part of the cygnus
> build process, and strlen is in libc.a (according to "nm -s").
>
> Is there an easy way to fix this, or do I need to create a completely new
> configuration (modifying "configure" and creating a new ".h" file in
> config/rs6000) for this type of system?  Thanks.

Use the -v switch on the powerpc-eabi-gcc command line.  This will give you
verbose information and you will be able to see which libraries are included by
default.

Also powerpc-eabi-gcc -print-search-dirs will show you which directories are
searched for libraries.

It looks like your crt0.o is not complete or isn't being linked in.  The "cannot
find entry symbol _start" gives this away.  From the sounds of things, your
libraries and startup files are not installed in the place where the powerpc-eabi
toolchain expects to find them.  They should be in $prefix/$target/lib and
$prefix/$target/inlcude.  If everything does seem in the right place then the
specs file can be used to alter the default libraries that are included.  Aah !!
I just remembered I had the same problem.  If you compile your program with the
-mads or -mmbx switches then everything should work.  This is because the specs
file recognises these options and includes the right libraries and startup
files.  What I did was to edit the specs file so that the default settings would
include the ads startup files and libraries.  The specs file is quite picky about
the layout (I'm not sure why but the specs file parser could be improved).  The
main problem was that it is intollerant to the number of newlines between its
statements.  I have attached my altered specs file below.

Cheers,
Brendan Simon.

BTW.  The specs file is in $prefix/lib/gcc-lib/powerpc-eabi/egcs-2.91.66 (or
something similar).



More information about the crossgcc mailing list