<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 - Crash on exit when compiling with ThinLTO"
   href="https://bugs.llvm.org/show_bug.cgi?id=43927">43927</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash on exit when compiling with ThinLTO
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>Runtime Library
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>aaronpuchert@alice-dsl.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When building with

    -DLLVM_ENABLE_PROJECTS="clang;openmp" \
    -DLLVM_ENABLE_LTO=Thin \
    -DLLVM_USE_LINKER=gold

programs using libomp.so crash on exit in a call from _dl_fini in glibc. That
is because

$ readelf -d libomp.so

Dynamic section at offset 0xeec80 contains 32 entries:
  Tag        Type                         Name/Value
 [...]
 0x000000000000000c (INIT)               0x1af00
 0x000000000000000d (FINI)               0x0
 [...]

So it calls into offset 0x0 of the binary, which has to go wrong. Now why does
that happen? In openmp/runtime/cmake/LibompHandleFlags.cmake,

     -Wl,-fini=__kmp_internal_end_fini

is added to LDFLAGS. Now

    readelf -s llvm/lib/libomp.so | grep __kmp_internal_end_fini

indicates that this function isn't there. That is probably because LTO sees
that the function is unused and not exported, so it can be removed.

I don't know if this is a bug in LTO (i.e. the argument to -fini should be
kept) or if we need to export this function.</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>