<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW " title="NEW --- - MCJit and thread_local hangs indefinitely" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24017&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=imm_lgW4-atVdoMVbxK9RAltP7-vGSa2raFxSlTsErY&s=IuSoSngTQ-_MwLp7BbkiGAvU84BkTftvZ03_jINfpWs&e=">24017</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>MCJit and thread_local hangs indefinitely
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>MCJIT
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>llvm@dav1d.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14547" name="attach_14547" title="IR code of the bug">attachment 14547</a> <a href="attachment.cgi?id=14547&action=edit" title="IR code of the bug">[details]</a></span>
IR code of the bug

I tried to run this code via MCJit:

; ModuleID = 'ohm'
@Vv3ohm1xi = thread_local global i32 3

define i32 @main() #0 {
entry:
  %0 = load i32* @Vv3ohm1xi
  ret i32 %0
}

LLVMRunFunction and LLVMGetFunctionAddress seem to hang indefinitely for the
function `main`, while LLVMFindFunction returns a handle.

The same code with 

@Vv3ohm1xi = global i32 3

instead works as expected.

The default interpreter can run the code but does not initialize the global to
the set value (3 in this case). I can open a new issue for this problem if
wanted.


Steps to reproduce:
Save code to `bug.ir`
Run: `lli bug.ir` (I assume this uses the mc-jit)</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>