<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 - lld ignores /usr/lib/rcrt1.o crt file"
   href="https://bugs.llvm.org/show_bug.cgi?id=35828">35828</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lld ignores /usr/lib/rcrt1.o crt file
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>bjornpagen@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In musl-1.1.10 and foward, musl provides rcrt1 in addition to crt{1,i,n}. This
new crt start file, rcrt1.o, is provided for producing static-linked position
independent executables (PIE). [1] 

rcrt1.o is a dependency of musl, and musl will not compile unless it is able to
access the __dls2 function that is defined in it.

GNU linkers such as bfd and gold have added support for including this file,
and musl compiles with no issue. But when I tried to use lld as a drop in
replacement, the build fails, and the lld throws this error:

/usr/bin/x86_64-gentoo-linux-musl-ld: error: undefined symbol: __dls2
<span class="quote">>>> referenced by ld-temp.o
>>>               lto.tmp:(_dlstart_c)</span >
clang-5.0: error: linker command failed with exit code 1 (use -v to see
invocation)


A couple grep -R's in lld's source code didn't reveal anything concerning
rcrt1, so I am assuming it has not been implemented yet.

lld version is 5.0.1

[1] <a href="https://www.musl-libc.org/oldversions.html">https://www.musl-libc.org/oldversions.html</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>