[llvm-dev] SegFault creating a ExecutionEngine

edA-qa mort-ora-y via llvm-dev llvm-dev at lists.llvm.org
Sat Jun 11 08:59:32 PDT 2016

On 11/06/16 16:54, Tim Northover wrote:
> The EngineBuilder shouldn't be trying to destroy the module. Looking
> at EngineBuilder::create's control flow, the most plausible problem is
> that the TargetMachine is null, so EngineBuilder::selectTarget has
> gone wrong. If so, maybe the Module's triple is wrong or your LLVM is
> compiled strangely so no targets can be found? Either way, it's
> probably time to pull out the debugger. Tim. 

I'm not sure I've passed an invalid value; I've changed my code to not
delete the engine builder and it works:

    auto ebuild = new llvm::EngineBuilder(
unique_ptr<llvm::Module>(module) );
    llvm::ExecutionEngine * ee = ebuild->
        setErrorStr( &errStr ).
        setEngineKind( llvm::EngineKind::JIT ).
        setTargetOptions( topts ).

My code then runs fine. This is pointing towards destruction of the
`EngineBuilder` itself causing the problem (like it's deleting the
module although it shouldn't, since it's been given to the created

edA-qa mort-ora-y 

Leaf - the language we always wanted

More information about the llvm-dev mailing list