[LLVMdev] Memory clean for applications using LLVM for JIT compilation

Frank Henigman fjhenigman at google.com
Sun Mar 17 14:17:41 PDT 2013

Thanks for the reply, nice to have some validation.  I thought of
another approach which might be preferable:
generate relocatable code, use a JITEventListener to grab each
function and copy it to my own memory,
let all the LLVM stuff die normally then use my copy of the code.
However when I call setRelocationModel(Reloc::PIC_) on the engine
builder I get code that seg faults.
The assembly looks plausible at a glance, but I'm not really up to
speed on x86 assembly.
Is PIC supposed to work with JIT on X86-32?

On Sat, Mar 16, 2013 at 11:35 AM, Dirkjan Bussink <d.bussink at gmail.com> wrote:
> On Mar 7, 2013, at 20:48 , Frank Henigman <fjhenigman at google.com> wrote:
>> I derived a class from JITMemoryManager which delegates everything to
>> an instance made with CreateDefaultMemManager().  ExecutionEngine
>> destroys the wrapper, but I keep the inner instance which did the
>> actual work.  Works, but seems a bit ugly.  Did you find any other
>> solutions?
> I ended up implementing the exact same thing, it feels dirty but it has worked great for us so far.
> --
> Dirkjan

More information about the llvm-dev mailing list