[LLVMdev] MC-JIT (any progress?)

Yuri yuri at rawbw.com
Thu Jun 30 14:59:43 PDT 2011


On 06/30/2011 09:21, Jim Grosbach wrote:
> The current implementation uses MachO binaries in memory. There's no reason they couldn't be serialized to disk. The llvm-rtdyld tool gives an example of using the MCJIT RuntimeDyld support to load an object file from memory and use it directly.
>
> The idea is that the object module will be loaded/JITed, then registered with the RuntimeDyld which will extract the functions, data, etc.. from the object and register them with the JIT memory manager and perform any relocations necessary. That will allow having the running program be in a separate address space (or a remote target) than where the compilation/loading is taking place, for example.
>
> For platforms that want ELF instead of MachO, it should be straightforward to implement a similar structure with proper subclassing and such of the RuntimeDyld interfaces. That's not there, currently, however.
>    

What I see now is that on ELF platform MCJIT writes ELF module in memory 
but then later tries to parse it with MachOObject and it breaks with 
"not a Mach object file (invalid magic)" message. This is inconsistency: 
it could have written Mach-O anyway even on ELF architecture just to 
make it work and later when ELFObject class is implemented switch both 
writing and reading sides to ELF.

Yuri



More information about the llvm-dev mailing list