[LLVMdev] Using a function from another module

Garrison Venn gvenn.cfe.dev at gmail.com
Mon Jan 11 02:14:02 PST 2010


So, having given my last response, I'm still bothered by this. I think what I find unusual is 
that one has to manually JIT and map (ExecutionEngine::addGlobalMapping(...)). Maybe
I'm out there, but I keep on wanting to have the linkage supplied in the Module A decl. take
care of this for me. So instead of an enum value of llvm::GlobalValue::ExternalLinkage, 
I could conceptually give it (the decl.), a module (module B in this case), or maybe an enum 
linkage, module pair. Of course representing this in IR might be a problem.

Anyway what do I know.  

Garrison

On Jan 10, 2010, at 14:23, Michael Muller wrote:

> 
> Kenneth Uildriks wrote:
>> On Sun, Jan 10, 2010 at 12:38 PM, Garrison Venn <gvenn.cfe.dev at gmail.com> wrote:
>>> Won't passing llvm::Function* around vs strings (function names), also work, at code generation time,
>>> without the need for a module A dec to module B impl. mapping?
>>> 
>>> Garrison
>> 
>> Nope.  You cannot place a call instruction into one module whose
>> callee is a Function from another module.  You have to put a
>> declaration into the same module, and have your call instruction call
>> that.  And then they need to be linked together, either by llvm-link
>> or (if JITting) by addGlobalMapping.
>> 
> 
> Actually, this is the first thing I tried, and the correct function does seem 
> to get called - but it looks like the Verifier complains about it, which leads 
> me to believe that there may be broader issues involved.
> 
> 
> =============================================================================
> michaelMuller = mmuller at enduden.com | http://www.mindhog.net/~mmuller
> -----------------------------------------------------------------------------
> Scnozwangers? Vermicious Knids? What kind of rubbish is that?
> - Mr. Salt, "Willy Wonka and the Chocolate Factory"
> =============================================================================





More information about the llvm-dev mailing list