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

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 13 10:09:35 PST 2018


You might want http://llvm.org/doxygen/Cloning_8h.html to copy the Module
before you link it in?

Looks like this functionality was removed a few years ago because it had
bitrotted/was broken:
http://llvm.org/viewvc/llvm-project?view=revision&revision=220741

- Dave

On Mon, Nov 12, 2018 at 10:10 PM Riyaz Puthiyapurayil via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> 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
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181113/82af8e16/attachment.html>


More information about the llvm-dev mailing list