<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 - Significant binary section size differences between ld.lld and ld.bfd"
   href="https://bugs.llvm.org/show_bug.cgi?id=37257">37257</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Significant binary section size differences between ld.lld and ld.bfd
          </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>ppadevski@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi,

I'm not a linker expert but I tried replacing ld.bfd with ld.lld today and
noticed a couple of differences.

For executables there isn't much difference

text       data      bss      dec        hex       filename
25679274   1969696   240249   27889219   1a98e43   exe+ld.bfd
25716658   1963032   238542   27918232   1a9ff98   exe+ld.lld
  +37384     -6664    -1707     +29013

For shared libraries, however, the difference is

text       data      bss     dec        hex       filename
31035525   3179176   46736   34261437   20ac9bd   so+ld.bfd
31419721   3185072   46736   34651529   210bd89   so+ld.lld
 +384196     +5896       0    +390092

If we take a look at both libraries via 'size -A', we'll see two differences.

so+ld.lld
section                  size
.hash                  746520
.rela.plt              427296

so+ld.bfd
section                  size
.hash                  504348

Both libraries and executables are linked with full RELRO (z relro, z now).
If I omit 'z now' when linking with the shared library with ld.bfd I can see

so+ld.bfd
section                  size
.hash                  504348
.rela.plt              427272

I have two questions:
1. Is there a way for the .hash section produced by lld to get smaller or is it
more efficient this way?
2. Is there a way to get rid of the .rela.plt section when linking with lld or
is it really needed?</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>