[LLVMdev] LLVM ERROR: Incompatible object format

Yaron Keren yaron.keren at gmail.com
Mon Feb 16 14:49:35 PST 2015


+llvmdev

Yes, the best solution would be to support COFF dynamic loading so you
could load COFF object files from disk as well as JITed ones and run them
together.

Otherwise, you need to add -elf to the triple. Patching
getProcessTriple() would
work but it's not the correct way, the change should be local, use
EngineBuilder::setMArch.

Yaron


2015-02-17 0:37 GMT+02:00 llvm 999 <llvm.999 at outlook.com>:

> If I understand correctly, the "really correct" solution is the provide a
> dynamic loader for COFF object format, which LLVM dos not currently support?
>
> To get example working, I did the following in host.cpp:
>
> std::string sys::getProcessTriple() {
>
> Triple PT(Triple::normalize(LLVM_HOST_TRIPLE));
>
> if (sizeof(void *) == 8 && PT.isArch32Bit())
>
>
> PT = PT.get64BitArchVariant();
>
> if (sizeof(void *) == 4 && PT.isArch64Bit())
>
>
> PT = PT.get32BitArchVariant();
>
> return PT.str()* + **"-elf"*;
>
>
> }
>
>
>  It seems this has fooled the system into thinking we have an "elf" format
> object?
>
> Why did this work? (Should it have worked?)
> ------------------------------
> From: yaron.keren at gmail.com
> Date: Tue, 17 Feb 2015 00:18:13 +0200
> Subject: Re: [LLVMdev] (no subject)
> To: llvm.999 at outlook.com
> CC: llvmdev at cs.uiuc.edu
>
> If you're running code under the JIT, it has a dynamic loader for ELF but
> not COFF object format , so you'll need to produce ELF objects. As the
> default under Windows is COFF you'll need to add -elf to the triple.
>
>
>
> 2015-02-17 0:01 GMT+02:00 llvm 999 <llvm.999 at outlook.com>:
>
>  This is my first post so not sure I've done everything right.
>
> Just started playing with LLVM on Windows 7, VS C++.
> Was trying to play with the example 4 and got the following error:
>
>
> *"LLVM ERROR: Incompatible object format"*
>
>
>
> *I was able resolve the problem by following the suggestion found here:*
>
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-December/068395.html
>
>
>
> This issue seems to be an old one and it is now resurfacing?
>
> Or was there anything I did wrong?
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150217/8f9ed8ea/attachment.html>


More information about the llvm-dev mailing list