[LLVMdev] MCJIT + Windows = Incompatible object format

Kaylor, Andrew andrew.kaylor at intel.com
Tue Dec 3 09:40:55 PST 2013


Hi Josh,

Glad to hear this worked for you.

I think there are problems with putting this into sys::getProcessTriple().  If that's used for anything other than MCJIT (and I think it probably is) then appending "-elf" wouldn't be appropriate.  Also, MCJIT isn't always generating code for the current process, so this wouldn't cover all its bases.

Probably a better solution (at least until MCJIT supports COFF, if it ever will) is to have MCJIT check the target triple and automatically add this if the target OS is Windows-based.  In general I don't like MCJIT tinkering with client supplied settings, but since in this case the alternative is guaranteed to fail it's probably a reasonable thing to do.

-Andy

From: Joshua Klontz [mailto:josh.klontz at gmail.com]
Sent: Tuesday, December 03, 2013 6:50 AM
To: Kaylor, Andrew; yaron.keren at gmail.com
Cc: Dev
Subject: Re: [LLVMdev] MCJIT + Windows = Incompatible object format

Bingo, thanks! Confirmed it works for both 32- and 64-bit targets.

Should `sys::getProcessTriple()` be updated with this change? According to the documentation:

  /// getProcessTriple() - Return an appropriate target triple for generating
  /// code to be loaded into the current process, e.g. when using the JIT.

I had to "-elf" to the result of this function for JIT to work on Windows.

v/r,
Josh

On Mon, Dec 2, 2013 at 7:27 PM, Kaylor, Andrew <andrew.kaylor at intel.com<mailto:andrew.kaylor at intel.com>> wrote:
As Yaron said, you need to add "-elf" to the end of your target triple to get MCJIT to generate ELF object in memory on Windows.  This should work with 32- or 64-bit targets.

-Andy


From: llvmdev-bounces at cs.uiuc.edu<mailto:llvmdev-bounces at cs.uiuc.edu> [mailto:llvmdev-bounces at cs.uiuc.edu<mailto:llvmdev-bounces at cs.uiuc.edu>] On Behalf Of Joshua Klontz
Sent: Monday, December 02, 2013 1:18 PM
To: Dev
Subject: [LLVMdev] MCJIT + Windows = Incompatible object format

Is the MCJIT infrastructure supported on Windows? I'm getting an "LLVM ERROR: Incompatible object format!" when running my project with both VS 2013 and Mingw_w64 (GCC 4.8.2). Looks like this issue has been brought up before [1,2] and the answer is "almost". Any help would be greatly appreciated.

v/r,
Josh

[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-January/046670.html
[2] http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-August/052522.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131203/f7c44d77/attachment.html>


More information about the llvm-dev mailing list