<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 - Non-constructor function pointers in .ctors are dropped"
   href="https://bugs.llvm.org/show_bug.cgi?id=48096">48096</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Non-constructor function pointers in .ctors are dropped
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </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>ELF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dlj@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, maskray@google.com, smithp352@googlemail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>LLD seems to drop function pointers in the `.ctors` section that are not C++
constructors.

Example:

<a href="https://compiler-explorer.com/z/9dcG7c">https://compiler-explorer.com/z/9dcG7c</a>

There's a lot going on here with priority ordering, but the upshot that BFD LD
preserves function pointers (which are not C++ constructors) explicitly placed
into `.ctors` or `.ctors.*` with both GCC and Clang, but Clang+LLD drops them.

(The same happens with C, where there are no actual C++ constructors:
<a href="https://compiler-explorer.com/z/Yrsbbx">https://compiler-explorer.com/z/Yrsbbx</a>)</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>