<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 - Add option for the behavior of __register_frame/__deregister_frame in ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp"
   href="https://bugs.llvm.org/show_bug.cgi?id=44074">44074</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Add option for the behavior of __register_frame/__deregister_frame in ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>9.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>MCJIT
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>albert.jin@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>1101.debian@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I use the full set of libraries from LLVM working under Linux with no
dependency of gcc. While making use of LLVM MCJIT, I observed that there would
be an error message from `LLVMRunFunction`,

  libunwind: __unw_add_dynamic_fde: bad fde: FDE is really a CIE

By searching LLVM source code, I got two facts as follows.

- This message is produced by function `__unw_add_dynamic_fde()` in
`libunwind/src/libunwind.cpp`.
- In `llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp`, it is
assumed that the behavior of `__register_frame`/`__deregister_frame` from
libunwind depends on OS. It is checked by `#ifdef __APPLE__`.

libunwind, however, is actually a runtime shared library chosen at compile
time. For example, it can be specified to use libgcc or libunwind according to
the build option `CLANG_DEFAULT_UNWINDLIB`. It's true that the native libunwind
on macOS is from LLVM, and on Linux it is from gcc. But this does not prevent
programs for macOS from using the set of runtime libraries from gcc, and vice
versa.

I have made a fix by adding a new cmake option
`EXECUTION_ENGINE_USE_LLVM_UNWINDER`. My suggested patch is as attached.</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>