[LLVMdev] Execution Engine issue with composite module

charles quarra charllsnotieneningunputocorreo at gmail.com
Sun Dec 16 21:31:12 PST 2012


Hi,

I'm having an issue with the below modules.

I build module X, then module Y (which has a dependency on X). I've
added an external declaration on module Y of the functions defined in
X.

i also link the except-handling module, but i think it is peripheral
to the issue

i like all the modules together in a single module called
executableModule. I link them with the method:

Linker::LinkModules(executableModule , moduleToLink,
llvm::Linker::PreserveSource, &errorMsg);

i call

llvm::verifyModule(* executableModule, llvm::AbortProcessAction, &err);

which doesn't seem to find anything wrong with the linked module.

then i proceed to create the executionEngine:

            llvm::EngineBuilder eB(executableModule);
            eB.setEngineKind(llvm::EngineKind::JIT);
            llvmEngine = eB.create();

which seems to go well, but as soon as i run:

           llvm::Function* foo2 = moduleX->getFunction("foo2");
           engine->getPointerToFunction(foo2);

i get the error:

LLVM ERROR: Program used external function 'foo' which could not be resolved!


Any idea what is wrong? i thought linking those modules together in a
single module would solve this problem.

I've attached all the .ll files for the modules involved
-------------- next part --------------
A non-text attachment was scrubbed...
Name: except-handling.ll
Type: application/octet-stream
Size: 740 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121217/b7bc5599/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: executableModule.ll
Type: application/octet-stream
Size: 1547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121217/b7bc5599/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: X.ll
Type: application/octet-stream
Size: 355 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121217/b7bc5599/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Y.ll
Type: application/octet-stream
Size: 512 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121217/b7bc5599/attachment-0003.obj>


More information about the llvm-dev mailing list