This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Configuring ld linker to generate ELF files on Windows for cross compilation to linux 32 & 64bit
- From: Kim <soldoutseashell at gmail dot com>
- To: Binutils Development <binutils at sourceware dot org>
- Date: Fri, 28 Mar 2014 13:37:00 +0800
- Subject: Configuring ld linker to generate ELF files on Windows for cross compilation to linux 32 & 64bit
- Authentication-results: sourceware.org; auth=none
Hi guys,
I'm trying to set up a cross compilation toolchain targeting linux 32bit
and 64bit from windows 7 using clang and ld. I have clang compiling the
object files for the linux target just fine but I'm not sure about how
to set up the ld build so that it can link to ELF. If I take the object
files generated by clang over to linux I can successfully link them but
on windows ld gives me a message "invalid file format". Building
binutils from mingw I tried:
$ configure --target=x86_64-pc-linux
And various other targets but none of them seemed to do the trick. Using
objdump -i I can see my version of ld supports:
pe-i386 pei-i386 elf32-i386 elf32-little elf32-big
plugin srec
i386 pe-i386 pei-i386 elf32-i386 elf32-little elf32-big
------ srec
plugin ------- -------- ---------- elf32-little elf32-big
------ srec
While the one on linux has:
elf64-x86-64 elf32-i386 elf32-x86-64 a.out-i386-linux
pei-i386
i386 elf64-x86-64 elf32-i386 elf32-x86-64 a.out-i386-linux
pei-i386
pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big
i386 pei-x86-64 ---------- ---------- elf64-little elf64-big
l1om ---------- elf64-l1om ---------- elf64-little elf64-big
k1om ---------- ---------- elf64-k1om elf64-little elf64-big
plugin ---------- ---------- ---------- elf64-little elf64-big
elf32-little elf32-big pe-x86-64 pe-i386 plugin srec
symbolsrec
i386 elf32-little elf32-big pe-x86-64 pe-i386 ------ srec
symbolsrec
l1om elf32-little elf32-big --------- ------- ------ srec
symbolsrec
k1om elf32-little elf32-big --------- ------- ------ srec
symbolsrec
plugin elf32-little elf32-big --------- ------- ------ srec
symbolsrec
How do I go about setting this up correctly? Any help is greatly
appreciated!
Thanks very much,
Kim