<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58684>58684</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [ORC] lli crashes when running with lazy compilation and ORC runtimes (ELF/x86-64)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          lucasreis1
      </td>
    </tr>
</table>

<pre>
    I've been trying to replicate the new `ELFNixPlatform` and after running some tests on lljit, it seems that the new platforms cannot handle execution while running orc in lazy mode. The backtrace is very large, so I've decided to attach it as a txt here:[stackdump.txt](https://github.com/llvm/llvm-project/files/9892496/stackdump.txt)

The test case is located at `compiler_rt/test/orc/TestCases/Linux/x86-64/lljit-initialize-deinitialize.ll`.

If I run it using orc (non-lazy), everything works fine:

```
$ lli --jit-kind=orc --jit-linker=jitlink --orc-runtime=llvm-15/install/lib/clang/15.0.4/lib/x86_64-unknown-linux-gnu/libclang_rt.orc.a lljit-initialize-deinitialize.ll
constructor
main

destructor
```


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVMFuozAQ_Rq4WCAghMCBQ7fZSpWq3dWq98rAAG6MHdmmSfr1-0ySNt3LahVk4xnPm3mPmTS6O9WPQbZ5I9YQKebMSaiBOc0M7aVouSPmRmKKDiwoku9PDz_E8ZfkrtdmgoFx1THeOzLMzEr5WKsnxJB1lmnFpHwVLsjumXDMEk0WcNx9YO4vUJa1XCnt2AhASYyO1M5OAOAwCpyv4Nq0TACVv5_YpDuK2TOQGt7unOEtMWHZG5kTLpiBfFqr2YVfR63oqPPcuHO8HX1J3DLO3BF5yVCwugvW3yx8u26e9jHswXobZOXo3N56b_aAZxBunJu41RMOUr5dt2hv9Cu1YPvQo2aLvSqrLK8KvH1Fzaog2QbJ3Xn1FLxg0MAuFKT2wkNY50VHoj3wzIvx0P4iNgiB9RmHewT5XE9CzUfsx7KIinypCdJHQgknuBTvFHX0eYilBHR8W8Zjzx690F6X2V7VBn2lVeQV92VDUvIKu9FfOGizs6wXatHuBgvYl-d8zHJ0gmBR5EvaCdUFq61HPxukUDsyMOHg32GGM0ItTkyA3i7ypmuQEgpKonbQEw3WVnI1YE_XcRLnH2aI8FLk0ax2Sh-UTzAfo0HN5wtLEOSMkSXm7J9CLRxajdRmbp02Z8PEhbrl3NFX_98aLGtIdVoUmyRJq6IMu3rVVauKhw7EqUb3_fx9j55bxGoNtyNZTAAG8zoABzTfuf3PbcGXIfFTiEh2Ucz6r4ZZvemGKpyNrP-7kYW189Jd67Io83Cs003frPHryiRpmlXZ5k2a9ut1z6tNCksoeUPSeirgEYo6S7IsTbIqSZIiKeNsw_GaU1VSlW94F-QJQUgZ-8T4HkNo6qWGZh4snFLgj-TTya0VgyK64vPZjRoRM0bHkLBpuFRcL-X-AR02lWE">