public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Configuring ld linker to generate ELF files on Windows for cross compilation to linux 32 & 64bit
@ 2014-03-28  5:37 Kim
  2014-04-02 14:44 ` Nicholas Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Kim @ 2014-03-28  5:37 UTC (permalink / raw)
  To: Binutils Development

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Configuring ld linker to generate ELF files on Windows for cross compilation to linux 32 & 64bit
  2014-03-28  5:37 Configuring ld linker to generate ELF files on Windows for cross compilation to linux 32 & 64bit Kim
@ 2014-04-02 14:44 ` Nicholas Clifton
  2014-04-03 10:13   ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Nicholas Clifton @ 2014-04-02 14:44 UTC (permalink / raw)
  To: Kim, Binutils Development

Hi Kim,

> $ configure --target=x86_64-pc-linux

Have you tried:

   configure --target=x86_64-pc-linux-gnu

I think that the '-' character after "linux" is needed in order for the 
configuration mechanism to correctly determine that you are targetting a 
linux system.  Also you may need to add 64-bit bfd support, as in:

   configure --enable-64-bit-bfd --target=x86_64-pc-linux-gnu

Cheers
   Nick


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Configuring ld linker to generate ELF files on Windows for cross compilation to linux 32 & 64bit
  2014-04-02 14:44 ` Nicholas Clifton
@ 2014-04-03 10:13   ` Andreas Schwab
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2014-04-03 10:13 UTC (permalink / raw)
  To: Nicholas Clifton; +Cc: Kim, Binutils Development

Nicholas Clifton <nickc@redhat.com> writes:

> Hi Kim,
>
>> $ configure --target=x86_64-pc-linux
>
> Have you tried:
>
>   configure --target=x86_64-pc-linux-gnu
>
> I think that the '-' character after "linux" is needed in order for the

That should not be needed, config.sub will canonicalize it.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-03 10:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-28  5:37 Configuring ld linker to generate ELF files on Windows for cross compilation to linux 32 & 64bit Kim
2014-04-02 14:44 ` Nicholas Clifton
2014-04-03 10:13   ` Andreas Schwab

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).