[llvm-dev] Linking existing functions from JITed code

Andy Somogyi via llvm-dev llvm-dev at lists.llvm.org
Fri Aug 14 07:24:02 PDT 2015


> On Aug 13, 2015, at 8:22 PM, Eric Christopher <echristo at gmail.com> wrote:
> On Thu, Aug 13, 2015 at 12:44 PM Andy Somogyi via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
> Hi
> 
> I’ve previously used the ExecutionEngine::addGlobalMapping to make existing functions available to my JITed code. 
> 
> I’m currently using ORC, as MCJIT does not appear to be maintained any longer (the kaleidoscope examples have not worked for some time with MCJIT). 
> 
> 
> Which MCJIT tutorials are you building here? The ones linked from the website should work just fine - and all of the jit uses MCJIT underneath the covers in some way or another.
> 
> Code link/pointer?
> 
> -eric

Hi Eric, 

The standard Kaleidoscope examples do compile, like this one:

https://github.com/llvm-mirror/llvm/blob/master/examples/Kaleidoscope/Chapter7/toy.cpp <https://github.com/llvm-mirror/llvm/blob/master/examples/Kaleidoscope/Chapter7/toy.cpp>

However, only the first JITed function works. The problem is MCJIT does not support adding new functions like the previous standard JIT did. The only way for MCJIT to support adding functions is to create new MCJIT engine instances, and set up the symbol resolver to look in previous instances for existing symbols. 

This kind of code used to be working in 

https://github.com/llvm-mirror/llvm/tree/master/examples/Kaleidoscope/MCJIT <https://github.com/llvm-mirror/llvm/tree/master/examples/Kaleidoscope/MCJIT>

However, the last time I checked, a month or so ago, none of the examples in the Kaleidoscope/MCJIT would compile. 

Also, Lang, I'm not sure if the ORC MCJITReplacement supports the ExecutionEngine::addGlobalMapping methods. It looks like the lambda resolver that the MCJITReplacement uses ignores all the values in the global address map when it resolves symbols. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150814/2538a4e9/attachment.html>


More information about the llvm-dev mailing list