[LLVMdev] Migration from JIT to MCJIT

Kaylor, Andrew andrew.kaylor at intel.com
Wed Apr 10 11:49:54 PDT 2013


The MachO handling isn’t always straightforward in that it has a lot of bit fields to handle while it’s also trying to accommodate the format abstractions baked into the interfaces.  The actual relocation type gets extracted in the RuntimeDyldMachO::resolveRelocation function (RuntimeDyldMachO.cpp:32) before it is passed on to the architecture-specific handlers.  So the mask you mentioned is probably OK.

The fact that this relocation type isn’t handled is, of course, the root of your problem.

MCJIT has grown on an as-needed basis up to now, with only the relocation types we were actually seeing being implemented.  Unfortunately, I don’t know enough about MachO to help with this one.  Maybe Jim Grosbach can help?

-Andy

From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Weiss, Eran
Sent: Tuesday, April 09, 2013 11:51 PM
To: Jiong Wang
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] Migration from JIT to MCJIT

Thank you for the help.

The relocation type value is anded with 0xffffffffL. (RuntimeDyldMachO.cpp:214)
Maybe this mask should be different?
Anyway, it seems like this relocation isn't implemented. (RuntimeDyldMachO.cpp:104)

From: Jiong Wang <jiwang at tilera.com<mailto:jiwang at tilera.com>>
Date: Tue, 9 Apr 2013 09:42:03 -0400
To: Eran Weiss <eran.weiss at emc.com<mailto:eran.weiss at emc.com>>
Cc: "llvmdev at cs.uiuc.edu<mailto:llvmdev at cs.uiuc.edu>" <llvmdev at cs.uiuc.edu<mailto:llvmdev at cs.uiuc.edu>>
Subject: Re: [LLVMdev] Migration from JIT to MCJIT

于 2013/4/9 21:08, Weiss, Eran 写道:
Hi,

I'm migrating my code (running on mac) from using JIT to MCJIT. My code generates in memory, mostly using the llvm-c api, and then runs the generated code.
When I try to use MCJIT I encounter a problem with relocations of external symbols – functions compiled statically beforehand with gcc.

I get the following error:

Invalid relocation type!
UNREACHABLE executed at /Users/weisse4/dev/llvm/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp:89

While debugging, I see that the relocation type read in  is 218103811, which seems corrupt to me.

Hi Weiss,

    I do not have any experience on Mach binary format, but the hex value of 218103811 is 0xd000003  (maybe the relocation type is RIT_Generic_PreboundLazyPointer = 3),  something looks like a relocation entry composed of "symbol index" + "relocation type".
    maybe something is wrong, that the relocation entry is not anded with a mask to get the final relocation type.

---
Regards,
Jiong


Did someone encounter a similar error? Or can direct me to changes that I need to do while migrating from JIT to MCJIT?

Thanks.




_______________________________________________

LLVM Developers mailing list

LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu>         http://llvm.cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

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


More information about the llvm-dev mailing list