This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
request for assistance in using binutils to link a .o which was cross-compiled to mips64 using Clang/LLVM
- From: Daniel Wilkerson <daniel dot wilkerson at gmail dot com>
- To: binutils at sourceware dot org
- Date: Wed, 2 Jul 2014 14:06:20 -0700
- Subject: request for assistance in using binutils to link a .o which was cross-compiled to mips64 using Clang/LLVM
- Authentication-results: sourceware.org; auth=none
I wonder if I may trouble you with what I am sure is a simple linking
question for someone who is not a beginner at linking internals such
as myself.
I am attempting to cross-compile to MIPS64 on an Ubuntu x86 machine.
Here is my input file, zero.c:
int main() {
return 0;
}
With some help from the LLVM people, I can now compile and assemble a
.o file as follows:
clang -o zero.o -target mips64 -integrated-as -c -Wall -Wextra
-Werror -O0 -g zero.c
file zero.o
zero.o: ELF 64-bit MSB relocatable, MIPS, MIPS64 version 1 (SYSV), not stripped
I configured and built binutils-2.24 (attempting to integrate with
gcc) as follows:
../binutils-2.24/configure --target=mips64 --prefix=/home/dsw/gcc-4.8.3-mips64
An now attempting to link the above-generated .o:
/home/dsw/gcc-4.8.3-mips64/bin/mips64-ld -o zero zero.o
/home/dsw/gcc-4.8.3-mips64/bin/mips64-ld: zero.o: ABI is incompatible
with that of the selected emulation
/home/dsw/gcc-4.8.3-mips64/bin/mips64-ld: failed to merge target
specific data of file zero.o
/home/dsw/gcc-4.8.3-mips64/bin/mips64-ld: warning: cannot find entry
symbol _start; defaulting to 0000000000400000
make: *** [zero] Error 1
I thought perhaps running the linker through the cross-compiled gcc
might help in some way, but no:
/home/dsw/gcc-4.8.3-mips64/bin/mips64-gcc -o zero zero.o
/home/dsw/gcc-4.8.3-mips64/lib/gcc/mips64/4.8.3/../../../../mips64/bin/ld:
zero.o: ABI is incompatible with that of the selected emulation
/home/dsw/gcc-4.8.3-mips64/lib/gcc/mips64/4.8.3/../../../../mips64/bin/ld:
failed to merge target specific data of file zero.o
/home/dsw/gcc-4.8.3-mips64/lib/gcc/mips64/4.8.3/../../../../mips64/bin/ld:
warning: cannot find entry symbol _start; defaulting to
0000000000400028
collect2: error: ld returned 1 exit status
make: *** [zero] Error 1
Feel free to point me to the documentation that I should have read
before bothering you.
Daniel