[llvm-dev] saving and restoring multiple modules for Orc JIT

Geoff Levner via llvm-dev
Tue, 02 Feb 2021 11:26:50 -0000

Greetings, LLVM developers.

I am trying to save the bitcode for multiple modules so that I can reload
them later and add them to my Orc-based JIT.

If I save each module to its own file, I have no problem. But I would like
to save them to a single file. When I do that, I sometimes get duplicate
symbol definitions when I reload the modules:

    Duplicate definition of symbol '$./path/to/my/file.bc.__inits.0'

It looks to me as though this is a problem with static constructors in the
modules, as though each module puts its constructors in a symbol with the
same name...?

Does anybody have a better idea than I am of what is going on, or how to
solve this?

I am using the 11.x release branch on Linux, FWIW. To reload the modules, I
use a call to getBitcodeModuleList(), followed by calls to
BitcodeModule::parseModule(), and finally calls to
orc::LLJIT::addIRModule().

Geoff
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20210202/af054175/attachment.html>