<div dir="ltr"><div dir="ltr">Hi Geoff,<div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">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:<br>    Duplicate definition of symbol '$./path/to/my/file.bc.__inits.0'</blockquote></div><div><br></div><div>That's a pseudo-symbol representing the static initializers. Orc auto-generates it based on the module identifier, and the module identifier defaults to the path-name of the module file (I don't recall whether this happens when the module is stored or loaded). I think you could fix this by setting the module identifier for each module to a unique string (via Module::setModuleIdentifier) before adding it to the JIT.</div><div><br></div><div>I'll see if I can add de-duping logic to the JIT API side too.</div><div><br></div><div>-- Lang.</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Feb 6, 2021 at 12:32 AM Geoff Levner <<a href="mailto:glevner@gmail.com">glevner@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>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...</div><div><br></div><div>Geoff<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 2, 2021 at 12:26 PM Geoff Levner <<a href="mailto:glevner@gmail.com" target="_blank">glevner@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Greetings, LLVM developers.</div><div><br></div><div>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.<br></div><div><br></div><div>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:</div><div><br></div><div>    Duplicate definition of symbol '$./path/to/my/file.bc.__inits.0'</div><div><br></div><div>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...?</div><div><br></div><div>Does anybody have a better idea than I am of what is going on, or how to solve this?</div><div><br></div><div>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().<br></div><div><br></div><div>Geoff<br></div></div>
</blockquote></div>
</blockquote></div>