[LLVMdev] ExecutionEngine::create returns 0

subramanyam subbu.pur at gmail.com
Mon Sep 27 23:53:30 PDT 2010



Hendrik Boom-2 wrote:
> 
> On Tue, 10 Jun 2008 07:07:35 +0530, Mahadevan R wrote:
> 
>>> Now to compare it in detail with the much smaller program I've got and
>>> maybe I'll figure out what's wrong with my call to
>>> ExecutionEngine::create.
>> 
>> That call is perfectly valid, actually. It works for me when linked
>> with:
>> 
>> g++ -o b b.o `llvm-config --ldflags` `llvm-config --libs engine jit`
>> 
>> Cheers,
>> -Mahadevan.
> 
> Thanks.  It's compiling and executing now.
> 
> The story appears to be this:
> 
>   llvm::ExecutionEngine::create requires particular libraries (presumably 
> those that involve execution, JIT code generation, or interpretation) to 
> be linked into the executable (the executable that contains the call to 
> llvm::ExecutionEngine::create), or else it returns NULL.  However, 
> llvm::ExecutionEngine::create does not itself contains references to 
> entry-points that would cause the necessary libraries to be sought by the 
> linker, so no linker failure results.
> 
> Would it be possible to include this information in the documentation for 
> llvm::ExecutionEngine::create?
> 
> -- hendrik
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 
> 

I am using llvm 2.6 and I am getting the same error. I tried using
llvm-config with flags '--libs core engine jit native'. But ExecutionEngine
returns NULL. I even tried including the JIT.h. No luck there too.

Here is my code listing:
        llvm::ExecutionEngine* ee  = llvm::ExecutionEngine::create(mModule);
	llvm::Function* func = ee->FindFunctionNamed("main");
	typedef void (*PFN)();
	PFN pfn = reinterpret_cast<PFN> (ee->getPointerToFunction(func));
	pfn();
	delete ee;

thanks, 
subramanyam
-- 
View this message in context: http://old.nabble.com/ExecutionEngine%3A%3Acreate-returns-0-tp17710149p29825737.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.




More information about the llvm-dev mailing list