<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - lli with -jit-kind=orc-lazy can't symbol 'atexit' for c++ program"
   href="https://bugs.llvm.org/show_bug.cgi?id=48938">48938</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lli with -jit-kind=orc-lazy can't symbol 'atexit' for c++ program
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </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>lli
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>harry.linxd@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ cat main.cpp 

```
#include <iostream>

int main(int argc, char** argv) {
    std::cout << "hi c++ from jit: " << argv[0] << std::endl;
    return 0;
}
```

Compile with 'no-use-cxa-atexit'
$ clang++ -S -emit-llvm main.cpp -stdlib=libstdc++ -fno-use-cxa-atexit

the 'main.ll' load fine with lli 'orc-mcjit' and 'mcjit'
$ lli --jit-kind=orc-mcjit ./main.ll 
hi c++ from jit: ./main.ll

$lli --jit-kind=mcjit ./main.ll 
hi c++ from jit: ./main.ll

while with orc-lazy, I get undefined symbol

$lli --jit-kind=orc-lazy ./main.ll 
JIT session error: Symbols not found: [ atexit ]
JIT session error: Failed to materialize symbols: { (0x23e0c50, {
__orc_lcl.__cxx_global_var_init.0, _GLOBAL__sub_I_main.cpp }) }

The issue can be found on both clang10 and clang11.</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>