public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Kim <soldoutseashell@gmail.com>
To: Binutils Development <binutils@sourceware.org>
Subject: Configuring ld linker to generate ELF files on Windows for cross compilation to linux 32 & 64bit
Date: Fri, 28 Mar 2014 05:37:00 -0000	[thread overview]
Message-ID: <53350A7C.9040404@gmail.com> (raw)

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

             reply	other threads:[~2014-03-28  5:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-28  5:37 Kim [this message]
2014-04-02 14:44 ` Nicholas Clifton
2014-04-03 10:13   ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53350A7C.9040404@gmail.com \
    --to=soldoutseashell@gmail.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).