Geoff Levner via llvm-dev
2021-Feb-02 11:26 UTC
[llvm-dev] saving and restoring multiple modules for Orc JIT
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>
Geoff Levner via llvm-dev
2021-Feb-05 13:32 UTC
[llvm-dev] saving and restoring multiple modules for Orc JIT
Well, I have worked around this problem by implementing my own little file format to hold the simple concatenation of any number of bitcode files. It does not seem like this should be necessary, though. If anyone comes up with a better solution in the future, I am interested... Geoff On Tue, Feb 2, 2021 at 12:26 PM Geoff Levner <glevner at gmail.com> wrote:> 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/20210205/8dfa93e6/attachment.html>