<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 - Misplaced orphaned sections in output with lld 8.0"
   href="https://bugs.llvm.org/show_bug.cgi?id=42327">42327</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Misplaced orphaned sections in output with lld 8.0
          </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>All
          </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>ELF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>royger@freebsd.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>lld 8.0 seems to misplace orphaned sections, according to GNU ld manual,
orphaned sections should be placed at the end of the output:

<a href="https://sourceware.org/binutils/docs/ld/Orphan-Sections.html">https://sourceware.org/binutils/docs/ld/Orphan-Sections.html</a>

lld 8.0 however seems to place some of them at the start, for example giving
the following (start) of a linker file:

SECTIONS
{
  [...]
  .text : AT(...) {

lld 8.0 produces the following section headers:

  [ 0]                   NULL            0000000000000000 000000 000000 00     
0   0  0
  [ 1] .reloc            PROGBITS        ffff82d080000000 001000 000008 00   A 
0   0  4
  [ 2] .init.rodata.cst8 PROGBITS        ffff82d080000008 001008 000008 08  AM 
0   0  8
  [ 3] .text             PROGBITS        ffff82d080200000 201000 1631ba 00  AX 
0   0 4096
[...]

Placing the orphaned .reloc and .init.rodata.cst8 before the linker script
defined sections. Note that previos lld versions did not exhibit this
behaviour. The output of LLD_REPRODUCE can be found at:

<a href="http://xenbits.xen.org/people/royger/xen-lld-repro.tar.gz">http://xenbits.xen.org/people/royger/xen-lld-repro.tar.gz</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>