I have question relating to LLVM Jitter: Can i obligue the LLVM Jitter to emit the native code in continuous memory addresses ? and to be PIC ? what i want to do is to move save the JIT code in a file and load it for execution later ..
what i mean by "load" is to simply read the bits from file into buffer i don't want to generate elf or something like this.
Here's an example: suppose i have C source file which contain:
Global variables
----------------
Function Foo()
----------------
Function Too()
when i request the JIT code i want the JIT to be in continus memory addresses:
0x100: Global Vars (take 16 Byte)
0x110: Foo() Code (take 32 Byte)
0x130: Too() Code (take 32 Byte)
0x150: end.
To store JIT'ed code in some region of memory you can write special version of JITMemoryManager (include/llvm/ExecutionEngine/JITMemoryManager.h
lib/ExecutionEngine/JIT/JITMemoryManager.cpp
). There is example of custom JIM MM here: unittests/ExecutionEngine/JIT/JITTest.cpp
, it is an RecordingJITMemoryManager
which logs main JIT MM calls.
As I can see (as LLVM 2.9), ARM JIT have isPIC
set to False and X86 JIT is capable of generating PIC code.
The biggest problem, seems, is loading of precompiled code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With