<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 - After r320437, lld links FreeBSD kernel incorrectly"
   href="https://bugs.llvm.org/show_bug.cgi?id=35766">35766</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>After r320437, lld links FreeBSD kernel incorrectly
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dimitry@andric.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Linking the FreeBSD kernel with recent lld, I noticed complaints from ctfmerge:

ERROR: ctfmerge: kernel.full.ctf: Cannot finalize temp file: Layout constraint
violation

Running GNU objcopy on such a kernel image shows:

/usr/local/bin/objcopy: kernel.test: section .init_array lma 0x1733000 adjusted
to 0x17330f0
/usr/local/bin/objcopy: kernel.test: section .fini_array lma 0x1733000 adjusted
to 0x17330f0
/usr/local/bin/objcopy: kernel.test: section .data.rel.ro lma 0x1733000
adjusted to 0x17330f0
/usr/local/bin/objcopy: kernel.test: section .preinit_array lma 0x1733000
adjusted to 0x17330f0

I bisected and found <a href="https://reviews.llvm.org/rL320437">https://reviews.llvm.org/rL320437</a> ("[ELF] Change default
output section type to SHT_NOBITS") to be the cause.

Maybe it is due to the linker script the FreeBSD kernel uses?  I will attach or
upload the reproduction files.</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>