[llvm-dev] llvm::Linker::linkModules destroys source module

Riyaz Puthiyapurayil via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 12 22:10:25 PST 2018


We have some LLVM 3.4 based code that we are now trying to upgrade. There used to be the following API in LLVM 3.4 which is now gone:

Linker::LinkModules(dst, src, Linker::PreserveSource, &error);

The current function Linker::linkModules wants to take ownership of src and destroys it on return.

In our use case, src is a module containing a predefined set of inline functions. We link src with dst, optimize dst, emit object code for dst, destroy dst and then create a new dst module from our code generator and repeat this process. The src module is a constant throughout. What is the recommended way of doing something like this in current version of LLVM? Is there a way of copying only what is needed from src into dst and then updating all the call instructions in dst that refer to src functions?

Or do I just have to write something like this myself and not use linkModules?

/Riyaz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181113/c90dfd93/attachment.html>


More information about the llvm-dev mailing list