<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:lhames@gmail.com" title="Lang Hames &lt;lhames&#64;gmail.com&gt;"> <span class="fn">Lang Hames</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_REOPENED " title="REOPENED --- - MCJIT::addGlobalMapping not mapping functions in the current object correctly" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D20656&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=rogMy85uMhNLHGYk64NEGyCXK96HzxKP7Z0HfYMRqaM&s=Kg-ScFVmMO8KmeeuCCBNx8C4R4sltSXwl4uLuFGv8dw&e=">bug 20656</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>RESOLVED
           </td>
           <td>REOPENED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>FIXED
           </td>
           <td>---
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED " title="REOPENED --- - MCJIT::addGlobalMapping not mapping functions in the current object correctly" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D20656-23c32&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=rogMy85uMhNLHGYk64NEGyCXK96HzxKP7Z0HfYMRqaM&s=PvL4FAEBXn4q7DXW2_8oG7TDMXUOgQBlDOqVWsNaXgQ&e=">Comment # 32</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED " title="REOPENED --- - MCJIT::addGlobalMapping not mapping functions in the current object correctly" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D20656&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=rogMy85uMhNLHGYk64NEGyCXK96HzxKP7Z0HfYMRqaM&s=Kg-ScFVmMO8KmeeuCCBNx8C4R4sltSXwl4uLuFGv8dw&e=">bug 20656</a>
              from <span class="vcard"><a class="email" href="mailto:lhames@gmail.com" title="Lang Hames &lt;lhames&#64;gmail.com&gt;"> <span class="fn">Lang Hames</span></a>
</span></b>
        <pre>Hi Federico,

It looks like the global mapping code was never properly attached to MCJIT. I'm
not sure how the "fix" for this addressed Murat's bug. (Murat - did you confirm
that this actually fixed your issue?)

On MacOSX the failure was masked by the fact that RTDyldMemoryManager searches
the JIT process symbols by default as a fallback, and finds "someFunction"
there without ever looking up the global mapping. If someFunction is mapped as
"foo", the bug shows up as a failure to find foo.

I'm working on hooking this up now, and have emailed Hans to see if it's
possible to get this in to the 3.7 release.

Federico - are you caching objects in your JIT at all, or do you always build
the IR from scratch?

If the later, I have a workaround for you in case this doesn't get in:

You can inject the address of someFunction into your bitcode when you create
it, rather than referencing someFunction:

I.e., Where you would have made a call to @someFunction, instead construct:

%call = call i32 inttoptr (i64 12345678 to i32 ()*)()

substituting the address of someFunction for the integer.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>