|
From: George K. <xke...@ne...> - 2014-03-30 23:43:26
|
On 3/29/2014 11:24 PM, Kim wrote:
> 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".
You can't use Windows ld to link Linux programs.
$ ld -V
GNU ld (GNU Binutils) 2.23.2
Supported emulations:
i386pe
This ld only supports i386pe; it will always output .exe files for Windows.
You need a cross-ld that can link ELF files for Linux. I don't know how
to build a cross-binutils. You also need the crt files and libc for
Linux. You want clang to automatically call your cross-ld and pass the
crt files and libc.
--George Koehler
|