This is the mail archive of the mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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

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

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.

Brendan Simon.

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

%(asm_cpu) %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} %{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} %{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} %{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian} %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian:     %{mcall-solaris: -mlittle -msolaris} %{mcall-linux: -mbig} }}}}


%{posix: -D_POSIX_SOURCE} %(cpp_sysv) %(cpp_endian) %(cpp_cpu) %{mads: %(cpp_os_ads) } %{myellowknife: %(cpp_os_yellowknife) } %{mmvme: %(cpp_os_mvme) } %{msim: %(cpp_os_sim) } %{mcall-linux: %(cpp_os_linux) } %{mcall-solaris: %(cpp_os_solaris) } %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(cpp_os_default) }}}}}}

%{G*} %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian:     %{mcall-nt: -mlittle }     %{mcall-aixdesc: -mbig }     %{mcall-solaris: -mlittle }     %{mcall-linux: -mbig} }}}} %{mcall-solaris: -mregnames } %{mno-sdata: -msdata=none } %{meabi: %{!mcall-*: -mcall-sysv }} %{!meabi: %{!mno-eabi:     %{mrelocatable: -meabi }     %{mcall-solaris: -mno-eabi }     %{mcall-linux: -mno-eabi }}} %{msdata: -msdata=default} %{mno-sdata: -msdata=none}


%{mads: ecrtn.o%s} %{myellowknife: ecrtn.o%s} %{mmvme: ecrtn.o%s} %{msim: ecrtn.o%s} %{mcall-linux: %(endfile_linux) } %{mcall-solaris: scrtn.o%s} %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(endfile_default) }}}}}}

%{h*} %{v:-V} %{G*} %{Wl,*:%*} %{YP,*} %{R*} %{Qy:} %{!Qn:-Qy} %(link_shlib) %{!Ttext*: %(link_start) } %(link_target) %(link_os)

%{mads: %(lib_ads) } %{myellowknife: %(lib_yellowknife) } %{mmvme: %(lib_mvme) } %{msim: %(lib_sim) } %{mcall-linux: %(lib_linux) } %{mcall-solaris: %(lib_solaris) } %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(lib_default) }}}}}}


%{mads: %(startfile_ads) } %{myellowknife: %(startfile_yellowknife) } %{mmvme: %(startfile_mvme) } %{msim: %(startfile_sim) } %{mcall-linux: %(startfile_linux) } %{mcall-solaris: %(startfile_solaris) } %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(startfile_default) }}}}}}



-DPPC -D__embedded__ -Asystem(embedded) -Acpu(powerpc) -Amachine(powerpc)



. !msoft-float !mlittle !mbig !mcall-sysv !mcall-aix !mcall-solaris !mcall-linux;nof msoft-float !mlittle !mbig !mcall-sysv !mcall-aix !mcall-solaris !mcall-linux;le !msoft-float mlittle !mbig !mcall-sysv !mcall-aix !mcall-solaris !mcall-linux;be !msoft-float !mlittle mbig !mcall-sysv !mcall-aix !mcall-solaris !mcall-linux;cs !msoft-float !mlittle !mbig mcall-sysv !mcall-aix !mcall-solaris !mcall-linux;ca !msoft-float !mlittle !mbig !mcall-sysv mcall-aix !mcall-solaris !mcall-linux;sol !msoft-float !mlittle !mbig !mcall-sysv !mcall-aix mcall-solaris !mcall-linux;lin !msoft-float !mlittle !mbig !mcall-sysv !mcall-aix !mcall-solaris mcall-linux;le/cs !msoft-float mlittle !mbig mcall-sysv !mcall-aix !mcall-solaris !mcall-linux;le/ca !msoft-float mlittle !mbig !mcall-sysv mcall-aix !mcall-solaris !mcall-linux;be/cs !msoft-float !mlittle mbig mcall-sysv !mcall-aix !mcall-solaris !mcall-linux;be/ca !msoft-float !mlittle mbig !mcall-sysv mcall-aix !mcall-solaris !mcall-linux;nof/le msoft-float mlittle !mbig !mcall-sysv !mcall-aix !mcall-solaris !mcall-linux;nof/be msoft-float !mlittle mbig !mcall-sysv !mcall-aix !mcall-solaris !mcall-linux;nof/cs msoft-float !mlittle !mbig mcall-sysv !mcall-aix !mcall-solaris !mcall-linux;nof/ca msoft-float !mlittle !mbig !mcall-sysv mcall-aix !mcall-solaris !mcall-linux;nof/le/cs msoft-float mlittle !mbig mcall-sysv !mcall-aix !mcall-solaris !mcall-linux;nof/le/ca msoft-float mlittle !mbig !mcall-sysv mcall-aix !mcall-solaris !mcall-linux;nof/be/cs msoft-float !mlittle mbig mcall-sysv !mcall-aix !mcall-solaris !mcall-linux;nof/be/ca msoft-float !mlittle mbig !mcall-sysv mcall-aix !mcall-solaris !mcall-linux;

mbig mcall-sysv

mrelocatable-lib mno-eabi mstrict-align

mcpu=403 msoft-float;mcpu=821 msoft-float;mcpu=860 msoft-float;mlittle-endian mlittle;mbig-endian mbig;mcall-sysv-eabi mcall-sysv;mcall-sysv-noeabi mcall-sysv;msoft-float msoft-float;mlittle mlittle;mbig mbig;mcall-sysv mcall-sysv;mcall-aix mcall-aix;mcall-solaris mcall-solaris;mcall-linux mcall-linux;


%{!mcpu*:   %{mpower: %{!mpower2: -D_ARCH_PWR}}   %{mpower2: -D_ARCH_PWR2}   %{mpowerpc*: -D_ARCH_PPC}   %{mno-power: %{!mpowerpc*: -D_ARCH_COM}}   %{!mno-power: %{!mpower2: %(cpp_default)}}} %{mcpu=common: -D_ARCH_COM} %{mcpu=power: -D_ARCH_PWR} %{mcpu=power2: -D_ARCH_PWR2} %{mcpu=powerpc: -D_ARCH_PPC} %{mcpu=rios: -D_ARCH_PWR} %{mcpu=rios1: -D_ARCH_PWR} %{mcpu=rios2: -D_ARCH_PWR2} %{mcpu=rsc: -D_ARCH_PWR} %{mcpu=rsc1: -D_ARCH_PWR} %{mcpu=403: -D_ARCH_PPC} %{mcpu=505: -D_ARCH_PPC} %{mcpu=601: -D_ARCH_PPC -D_ARCH_PWR} %{mcpu=602: -D_ARCH_PPC} %{mcpu=603: -D_ARCH_PPC} %{mcpu=603e: -D_ARCH_PPC} %{mcpu=604: -D_ARCH_PPC} %{mcpu=620: -D_ARCH_PPC} %{mcpu=821: -D_ARCH_PPC} %{mcpu=860: -D_ARCH_PPC}


%{mrelocatable*: -D_RELOCATABLE} %{fpic: -D__PIC__=1 -D__pic__=1} %{fPIC: -D__PIC__=2 -D__pic__=2} %{mcall-sysv: -D_CALL_SYSV} %{mcall-nt: -D_CALL_NT} %{mcall-aix: -D_CALL_AIX} %{mcall-aixdesc: -D_CALL_AIX -D_CALL_AIXDESC} %{!mcall-sysv: %{!mcall-aix: %{!mcall-aixdesc: %{!mcall-nt: %(cpp_sysv_default) }}}} %{msoft-float: -D_SOFT_FLOAT} %{mcpu=403: -D_SOFT_FLOAT}



%{mlittle: %(cpp_endian_little) } %{mlittle-endian: %(cpp_endian_little) } %{mbig: %(cpp_endian_big) } %{mbig-endian: %(cpp_endian_big) } %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian:     %{mcall-solaris: %(cpp_endian_solaris) }     %{mcall-nt: %(cpp_endian_little) }     %{mcall-linux: %(cpp_endian_big) }     %{mcall-aixdesc:  %(cpp_endian_big) }     %{!mcall-solaris: %{!mcall-linux: %{!mcall-nt: %{!mcall-aixdesc: %(cpp_endian_default) }}}}}}}}

%{!mcpu*:   %{mpower: %{!mpower2: -mpwr}}   %{mpower2: -mpwrx}   %{mpowerpc*: -mppc}   %{mno-power: %{!mpowerpc*: -mcom}}   %{!mno-power: %{!mpower2: %(asm_default)}}} %{mcpu=common: -mcom} %{mcpu=power: -mpwr} %{mcpu=power2: -mpwrx} %{mcpu=powerpc: -mppc} %{mcpu=rios: -mpwr} %{mcpu=rios1: -mpwr} %{mcpu=rios2: -mpwrx} %{mcpu=rsc: -mpwr} %{mcpu=rsc1: -mpwr} %{mcpu=403: -mppc} %{mcpu=505: -mppc} %{mcpu=601: -m601} %{mcpu=602: -mppc} %{mcpu=603: -mppc} %{mcpu=603e: -mppc} %{mcpu=604: -mppc} %{mcpu=620: -mppc} %{mcpu=821: -mppc} %{mcpu=860: -mppc}




--start-group -lads -lc --end-group

--start-group -lyk -lc --end-group

--start-group -lmvme -lc --end-group

--start-group -lsim -lc --end-group

%{mnewlib: --start-group -llinux -lc --end-group } %{!mnewlib: -lc }

%{mnewlib: --start-group -lsolaris -lc --end-group } %{!mnewlib:     %{ansi:values-Xc.o%s}     %{!ansi: 	%{traditional:values-Xt.o%s} 	%{!traditional:values-Xa.o%s}} 	%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio}     %{solaris-cclib: /opt/SUNWspro/SC4.0/lib/libabi.a}     %{!shared: %{!symbolic: -lc }}}

--start-group -lads -lc --end-group

ecrti.o%s crt0.o%s

ecrti.o%s crt0.o%s

ecrti.o%s crt0.o%s

ecrti.o%s sim-crt0.o%s

%{!shared: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} %{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}

%{!msolaris-cclib: scrti.o%s scrt0.o%s} %{msolaris-cclib: /opt/SUNWspro/SC4.0/lib/crti.o%s /opt/SUNWspro/SC4.0/lib/crt1.o%s}

ecrti.o%s crt0.o%s





%{mnewlib: ecrtn.o%s} %{!mnewlib: %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s}

%{!msolaris-cclib: scrtn.o%s} %{msolaris-cclib: /opt/SUNWspro/SC4.0/lib/crtn.o%s}



%{mshlib: %(link_path) } %{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} %{static: } %{shared:-G -dy -z text %(link_path) } %{symbolic:-Bsymbolic -G -dy -z text %(link_path) }

%{mlittle: -oformat elf32-powerpcle } %{mlittle-endian: -oformat elf32-powerpcle } %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: %{mcall-solaris: -oformat elf32-powerpcle}}}}}

%{mads: %(link_start_ads) } %{myellowknife: %(link_start_yellowknife) } %{mmvme: %(link_start_mvme) } %{msim: %(link_start_sim) } %{mcall-linux: %(link_start_linux) } %{mcall-solaris: %(link_start_solaris) } %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(link_start_default) }}}}}}

-T ads.ld%s

-T yellowknife.ld%s

%{!Wl,-T*: %{!T*: -Ttext 0x40000}}

-Ttext 0x10000074

-Ttext 0x400074


-T ads.ld%s

%{mads: %(link_os_ads) } %{myellowknife: %(link_os_yellowknife) } %{mmvme: %(link_os_mvme) } %{msim: %(link_os_sim) } %{mcall-linux: %(link_os_linux) } %{mcall-solaris: %(link_os_solaris) } %{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(link_os_default) }}}}}}








-D_BIG_ENDIAN -D__BIG_ENDIAN__ -Amachine(bigendian)

-D_LITTLE_ENDIAN -D__LITTLE_ENDIAN__ -Amachine(littleendian)

-D__LITTLE_ENDIAN__ -Amachine(littleendian)





-D__unix__ -D__linux__ %{!ansi: -Dunix -Dlinux } -Asystem(unix) -Asystem(linux)

-D__ppc -D__sun__=1 -D__unix__ -D__svr4__  -D__SVR4__ %{!ansi: -Dsun=1 -Dunix -DSVR4 -D__EXTENSIONS__ } -Amachine(prep)


Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]