[LLVMdev] Alternative to Linker::LinkInFile()

Chris Cadwallader ccadwallader at arxan.com
Fri Feb 15 09:55:34 PST 2013


Looking at /tools/llvm-link/llvm-link.cpp may give you some ideas here. I havent looked at your specific use case, but llvm-link uses ParseIRFile to pull in a bitcode file and build a Module for it. You can then create a Composite using the Module * and call Linker::LinkModules(Composite.get(), NewModuleToLink.get()... to link a new Module to your Composite Module.

-Chris

On Feb 14, 2013, at 8:20 PM, Tom Stellard wrote:

> On Thu, Feb 14, 2013 at 04:41:41PM -0800, Daniel Dunbar wrote:
>> Hi Tom,
>> 
>> From the context I am assuming you are in a JIT context, so the comments
>> about using a platform specific LTO mechanism don't apply.
>> 
>> Were you using this code to extract bitcode files from archives, or just to
>> link in an individual bitcode file?
>> 
> 
> Hi Daniel,
> 
> I was using this code to link an individual bitcode file.  I would
> compile and OpenCL C kernel to bitcode and then link it with an OpenCL C
> builtin library which was also a bitcode file.
> 
> -Tom
> 
> 
>> 
>> 
>> On Wed, Feb 13, 2013 at 12:24 PM, Tom Stellard <tom at stellard.net> wrote:
>> 
>>> Hi Daniel,
>>> 
>>> In r172749 you removed the Linker::LinkInFiles() function and mentioned
>>> in the commit message that users of this function should migrate to
>>> "platform-specific linker-integrated LTO mechanisms, or the forthcoming
>>> LLVM linker."
>>> 
>>> I'm trying to update this code:
>>> 
>>> http://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/state_trackers/clover/llvm/invocation.cpp
>>> to work with TOT and I was wondering if you could elaborate a little more
>>> on these alternatives and maybe provide an example?
>>> 
>>> Thanks,
>>> Tom
>>> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





More information about the llvm-dev mailing list