<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Another hello to everyone,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">I found the issue by now – it was… a simple misunderstanding you could say.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">When I add names to the list of functions that are actually defined in the module, then the function will succeed. However, if I add names of functions that are only declared like “puts”,
 then the function will fail. This is not exactly what I expected to be honest. I thought, that in such a situation the function would still succeed and that the resulting list would either not contain “puts” or with an 0 address.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">I wanted to use this function to identify which symbols of my list are defined and which not…
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Kind greetings and sorry for double posting,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Björn<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> llvm-dev <llvm-dev-bounces@lists.llvm.org>
<b>On Behalf Of </b>Gaier, Bjoern via llvm-dev<br>
<b>Sent:</b> 08 April 2020 12:23<br>
<b>To:</b> Lang Hames <lhames@gmail.com><br>
<b>Cc:</b> LLVM Developers Mailing List <llvm-dev@lists.llvm.org><br>
<b>Subject:</b> Re: [llvm-dev] [ORC JIT] -Resolving cross references in a multi-process scenario<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Hey Lang and LLVM-Mailinglist,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">I hoped I was through with the questions but… I have difficulties trying out the code example you shared (message below). First of all, I was not able to use your example because there
 is no LookupKind::Static. I guess this is because those things are not in the LLVM9 source code?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">So I tried this instead:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">bool</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">
 test(</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">const</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"> std::</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF;mso-fareast-language:EN-US">vector</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"><std::</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF;mso-fareast-language:EN-US">string</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">>
 &</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:gray;mso-fareast-language:EN-US">symbols</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">{<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">      
</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">auto</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"> &ES = jit->getExecutionSession();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">       llvm::orc::</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF;mso-fareast-language:EN-US">SymbolNameSet</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">
 LookupSet;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">      
</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">for</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">(</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">const</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">
</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">auto</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"> &Name :
</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:gray;mso-fareast-language:EN-US">symbols</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">      
</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">{<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">             LookupSet.insert(ES.intern(Name));<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">      
</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">      
</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">auto</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"> result = ES.lookup({{&jit->getMainJITDylib(),
</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">true</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">}}, LookupSet, llvm::orc::</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:#2B91AF;mso-fareast-language:EN-US">SymbolState</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">::</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:darkslategray;mso-fareast-language:EN-US">Resolved</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">      
</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">if</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">(!result)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">       {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">            
</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">return</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">
</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">false</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">       }<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">      
</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">for</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">(</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">const</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">
</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">auto</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US"> &bla : *result)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">       {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">             printf(</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:#A31515;mso-fareast-language:EN-US">"Miau:
 %s\n"</span><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">, (*(bla.first)).str().c_str());<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-GB" style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">      
</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">      
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">return</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue;mso-fareast-language:EN-US">true</span><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black;mso-fareast-language:EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">However running this will result in “result” having an error – but I get no message what went wrong. I added a llvm::Module to my jit with addIRModule and well… that’s it basically.
 Is this because I don’t have the latest changes?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">The string vector contains decorated names, I got them from asking the IRModule about its functions and choosing some for testing.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Kind greetings<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Björn<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Lang Hames <<a href="mailto:lhames@gmail.com">lhames@gmail.com</a>>
<br>
<b>Sent:</b> 18 March 2020 17:26<br>
<b>To:</b> Gaier, Bjoern <<a href="mailto:Bjoern.Gaier@horiba.com">Bjoern.Gaier@horiba.com</a>><br>
<b>Cc:</b> LLVM Developers Mailing List <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><br>
<b>Subject:</b> Re: [llvm-dev] [ORC JIT] -Resolving cross references in a multi-process scenario<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<div>
<div>
<div>
<p class="MsoNormal">Hi Bjoern,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">Thanks for your patience. The good news is that there is a neater way to do this: ExecutionSession's lookup methods take a orc::SymbolState parameter which describes the state that symbols must reach before a query can return (See
<a href="https://github.com/llvm/llvm-project/blob/d1a7bfca74365c6523e647fcedd84f8fa1972dd3/llvm/include/llvm/ExecutionEngine/Orc/Core.h#L1273).In">
https://github.com/llvm/llvm-project/blob/d1a7bfca74365c6523e647fcedd84f8fa1972dd3/llvm/include/llvm/ExecutionEngine/Orc/Core.h#L1273).In</a> your case you want to use orc::SymbolState::Resolved, which will cause the query to return as soon as the searched-for
 symbols have been assigned an address.<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">So if your process is generating a set of symbols that may need to be transmitted to other sessions then you would write something like:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New"">auto Syms = ES.lookup(SearchOrder, SymbolsToTransmit, LookupKind::Static, SymbolState::Resolved);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New"">if (!Syms)</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New"">  reportError(Syms.takeError());</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New"">sendSymbolsToRemote(*Syms);</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Out of interest -- Is it necessary for your JIT itself to be split across two or more processes? I had always anticipated having a single ExecutionSession attached to the target process and then running just the compilers on other processes.
 That gives you a star-like IPC network with N + 1 connections: One between the execution session and each of the N compilers, and one between the execution session and the target processs. In your model it sounds like the risk is that you may end up with N(N
 + 1) IPC links with every execution session having to communicate with every other and also with the target process.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">-- Lang.<o:p></o:p></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Tue, Mar 17, 2020 at 12:34 AM Gaier, Bjoern <<a href="mailto:Bjoern.Gaier@horiba.com" target="_blank">Bjoern.Gaier@horiba.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">Hello LLVM-Mailing-List and Lang,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">I played around with this problem a bit and found a way of doing this – however I’m not sure about the consequences and if this is really a good idea.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">I went trough all of the global symbols and functions being defined in the llvm::Module and set for each of them a new section name (based on there name). With
 this approach the memorymanager could tell me already the addresses of my symbols, which I could then share with the other process. However, this approach needed to load the module two times, first to get the future address and in a second run to use the addresses
 to resolve the symbols.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">The only disadvantage I noticed so far was that the overall size of the emitted code was bigger then having the regular sections. Are there any other risks I
 might have overseen? </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">Kind greetings</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">Björn</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>>
<b>On Behalf Of </b>Gaier, Bjoern via llvm-dev<br>
<b>Sent:</b> 06 March 2020 14:24<br>
<b>To:</b> LLVM Developers Mailing List <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>; Lang Hames <<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>><br>
<b>Subject:</b> [llvm-dev] [ORC JIT] -Resolving cross references in a multi-process scenario</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">Hello LLVM-Mailing-List and Lang,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">I have a very weird (or strict?) scenario and was curious if the ORC  JIT can help me with it. Soo here it comes:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">I have currently a windows process ("Runtime") which does nothing but creating a shared memory with read, write and execute rights - and also writing some function
 addresses like from printf to it. </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">Then I have two or more processes which are using the ORC JIT to load modules to this shared memory, in "perspective" of the process I mentioned above ("Runtime").
 The sections are remapped from the other processes to be correct for "Runtime", also they resolve the undefined references for "Runtime" - like for printf and so on.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">This works quite well so far! Wuhuhu x3</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">However, there is one issue about it. Given that those two (or more processes) are now loading modules that reference each other. Like Module A is using a function
 of Module B - but Module B also uses a function of Module A. How could I resolve those modules when they are loaded from different processes? Normally I would use llvm-link to link those modules but in my current scenario this is sadly not possible.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">Can the ORC JIT help me with that? Can I solve this problem differently? Like replacing all the functions of Module A that rely on Module B with function pointers?
 Is something like that possible?</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">I know this situation is pretty uncommon but sadly I ran into that issue.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">Kind greetings</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB">Björn</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-GB"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert,
 Takashi Nagano, Takeshi Fukushima. Junichi Tajika <o:p></o:p></p>
</div>
<p class="MsoNormal">Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika
<o:p></o:p></p>
</div>
</blockquote>
</div>
<p class="MsoNormal">Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Junichi Tajika, Ergin Cansiz.
<o:p></o:p></p>
</div>
Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Junichi Tajika, Ergin Cansiz.
</body>
</html>