[llvm-dev] SegFault creating a ExecutionEngine
Lang Hames via llvm-dev
llvm-dev at lists.llvm.org
Sat Jun 11 16:42:57 PDT 2016
Hi edA-qa,
EngineBuilder is using unique_ptr, so if it constructed a valid engine it
should be passing ownership off just fine.
That backtrace contains a call to erase on a null SmallPtrSetImpl in the
LLVMContext. What LLVMContext are you building the Module with, and are you
making sure that the context outlives the module?
- Lang.
On Sat, Jun 11, 2016 at 8:59 AM, edA-qa mort-ora-y via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> 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 ).
> create();
>
> 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
> `ExecutionEngine`).
>
> --
> edA-qa mort-ora-y
> http://mortoray.com/
>
> Leaf - the language we always wanted
> http://leaflang.org/
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160611/9fc81056/attachment.html>
More information about the llvm-dev
mailing list