[LLVMdev] MCJIT crash on 64 bit Linux, works find on OSX

Andy Somogyi andy.somogyi at gmail.com
Fri Feb 28 21:48:47 PST 2014


I get the same behavior with llvm 3.3

If I do not delete the ExecutionEngine, it works fine, and if I create a regular JIT and delete it it works fine. 

So, basically, if I just let the engines leak, it seems to work. 

After creating the engine, all I do is just build series of module function and JIT the module. I add mappings to a number of C++ functions in my library each time a new engine is created with:

void myAddGlobalMapping(const llvm::GlobalValue *gv, void *addr)
{
    llvm::sys::DynamicLibrary::AddSymbol(gv->getName(), addr);
    executionEngine->addGlobalMapping(gv, addr);
}





On Feb 28, 2014, at 9:32 PM, Andy Somogyi wrote:

> Hi All.
> 
> I have an issue when a MCJIT ExecutionEngine is created then deleted, any C++ exception thrown after the MCJIT dtor is called will result in a seg fault. This does not occur with the regular JIT engine, and only occurs on Linux, works fine on OSX. 
> 
> basically its like this:
> 
> ExecutionEngine *e = engineBuilder.create();
> 
> // this is fine
> try { throw exception()} catch(exception&) {}
> 
> delete e
> 
> e = engineBuilder.create();
> 
> // this will cause a segfault on 64 bit Linux, LLVM 3.4
> // works fine on OSX
> try { throw exception()} catch(exception&) {}
> 
> Any ideas?





More information about the llvm-dev mailing list