This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Link problem with sparc64-elf newlib: crt0 incompatible
- From: Marco Zandonadi <marco_zandonadi at yahoo dot com>
- To: newlib at sources dot redhat dot com
- Date: Tue, 9 Mar 2004 14:54:41 -0800 (PST)
- Subject: Link problem with sparc64-elf newlib: crt0 incompatible
Hello,
I'm building a gnu cross toolchain for embedded
use and I ran into a problem with newlib and the
target linker. The host is a pentium running Linux RH8
and the target is sparc64-elf.
I downloaded and built successfully the following
three packages:
1) binutils 2.14
Here's the configure command:
../binutils-2.14/configure \
--host=i686-linux-elf \
--target=sparc64-elf \
--prefix=/usr/local/sparc64tools \
--disable-nls \
-v
2) gcc 3.3.3
Here's the configure command:
../gcc-3.3.3/configure \
--host=i686-linux-elf \
--target=sparc64-elf \
--prefix=/usr/local/sparc64tools \
--enable-languages="c" \
--without-headers \
--with-newlib \
--enable-thread=single \
--disable-shared \
--disable-nls \
-v
3) newlib 1.12.0
I had to patch four .S files in libgloss/sparc to get
rid of an assembly error: I added the following two
lines to all four .S files.
.register %g2,#scratch
.register %g3,#scratch
Here's the configure command:
../newlib-1.12.0/configure \
--host=i686-linux-elf \
--target=sparc64-elf \
--prefix=/usr/local/sparc64tools \
-v
After building the above three packages successfully I
tried compiling a simple hello.c program using the
cross toolchain and I got an error about crt0.o being
incompatible:
[root@localhost root]# sparc64-elf-gcc -T
/root/bsd/newlib-1.12.0/libgloss/sparc/ex930.ld
hello.c
/usr/local/sparc64tools/lib/gcc-lib/sparc64-elf/3.3.3/../../../../sparc64-elf/bin/ld:
skipping incompatible
/usr/local/sparc64tools/lib/gcc-lib/sparc64-elf/3.3.3/../../../../sparc64-elf/lib/crt0.o
when searching for crt0.o
/usr/local/sparc64tools/lib/gcc-lib/sparc64-elf/3.3.3/../../../../sparc64-elf/bin/ld:
skipping incompatible
/usr/local/sparc64tools/sparc64-elf/bin/../lib/crt0.o
when searching for crt0.o
/usr/local/sparc64tools/lib/gcc-lib/sparc64-elf/3.3.3/../../../../sparc64-elf/bin/ld:
cannot find crt0.o
collect2: ld returned 1 exit status
It seems that the linker thinks that crt0.o is not
compatible with the generated .o file. So I used
sparc64-elf-objdump to verify that they are the same
format:
[root@localhost root]# sparc64-elf-gcc -c hello.c
[root@localhost root]# sparc64-elf-objdump -p hello.o
hello.o: file format elf64-sparc
[root@localhost root]# sparc64-elf-objdump -p
/usr/local/sparc64tools/lib/gcc-lib/sparc64-elf/3.3.3/../../../../sparc64-elf/lib/crt0.o
/usr/local/sparc64tools/lib/gcc-lib/sparc64-elf/3.3.3/../../../../sparc64-elf/lib/crt0.o:
file format elf64-sparc
So it seems that both files are the same format.
Any help getting rid of this incompatibile format
problem would be much appreciated.
Marco
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you?re looking for faster
http://search.yahoo.com