This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
RE: binutils and newlib for powerpc-ibm-eabi with gcc-2.95.2
- To: 'Dan Alderman' <d dot alderman at 180sw dot com>, newlib at sourceware dot cygnus dot com, gcc-help at gcc dot gnu dot org, binutils at sources dot redhat dot com, crossgcc at sourceware dot cygnus dot com
- Subject: RE: binutils and newlib for powerpc-ibm-eabi with gcc-2.95.2
- From: David Korn <dkorn at pixelpower dot com>
- Date: Mon, 12 Feb 2001 14:11:12 -0000
>ls
>CVS build-binutils gcc-2.95.2 newlib-cvs
>binutils-2.10.1 build-gcc newlib-1.9.0
Oops, no build-newlib.
>cd build-binutils
>../binutils-2.10.1/configure --prefix=/export/usr
>--target=powerpc-ibm-eabi
>make
>make install
>ln -s ../newlib-cvs/newlib newlib
>../gcc-2.95.2/configure --prefix=/export/usr --target=powerpc-ibm-eabi
>--enable-languages="c" --with-gnu-as --with-gnu-ld --with-newlib
>make
>make install
>Now, if I try to compile a 'plain' C program with no library calls in it
>everything works (apparently), but if I include any library calls the
>compilation fails at link time.
Well, you haven't built and installed newlib yet. It doesn't get done
by the gcc build; that just needs the headers for building the cross libgcc,
which doesn't contain the libc functions.
>/export/usr/powerpc-ibm-eabi/bin/ld: warning: cannot find entry symbol
>_start; defaulting to 01800074
Oops, no startup crt.o file. That's part of newlib too.
>In function `__do_global_ctors':
>/export/sources/build-gcc/gcc/eabi-ctors.c(.sdata+0x4): undefined
>reference to `__fini'
>collect2: ld returned 1 exit status
>
>Something I find odd is that in the final error the linker is looking in
>the source tree rather than in the built code, is this right?
Yep, because the undefined references are all coming from modules in
libgcc.a:
>/export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi.o)(.got2+
>0x50):undefined reference to `__EXCEPT_END__'
>/export/usr/lib/gcc-lib/powerpc-ibm-eabi/2.95.2/libgcc.a(eabi-ctors.o)
>(.sdata+0x0):undefined reference to `__init'
so the error message points at the source code that libgcc was compiled
from. This is probably made possible because gcc builds with -g in the
flags by default.
>So... if I do the following to reduce the error I get these errors,
>
>powerpc-ibm-eabi-gcc -e main -mno-eabi -mcpu=823 helloworld.c
>
>/tmp/ccXU84tt.o: In function `main':
>/tmp/ccXU84tt.o(.text+0x1c): undefined reference to `printf'
>collect2: ld returned 1 exit status
>
>This appears to be the linker not knowing where printf is, or more
>specifically libc.a, so I try the following
>
>powerpc-ibm-eabi-gcc -e main -mno-eabi -mcpu=823
>-L/export/usr/powerpc-ibm-eabi/lib/ helloworld.c
>
>and get the same error.
Did you stop and look if there was a libc.a actually in that dir?
>
>Has anyone here been able to use gcc with binutils and newlib to create
>a cross compiler suite of tools for the powerpc-ibm-eabi target (i.e. a
>powerpc as a bare chip with no OS, i.e. Linux on it). Is there
>something I'm missing in the build process?
cd build-newlib;
../newlib-1.9.0/configure --prefix=/export/usr --target=powerpc-ibm-eabi
make
make install
might help.
DaveK
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************