<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 - Wasm backend duplicate function pruning"
   href="https://bugs.llvm.org/show_bug.cgi?id=35534">35534</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Wasm backend duplicate function pruning
          </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>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>ncw@realvnc.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is as a follow-on to COMDAT support
(<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Wasm backend COMDAT support"
   href="show_bug.cgi?id=35533">https://bugs.llvm.org/show_bug.cgi?id=35533</a>). I've split this out from bug
35533 because it's not a functional requirement; COMDAT works fine without this
refinement albeit with huge binaries.

Currently, our binary size is bigger than it need be, because duplicate
functions aren't removed.

For example, if two files both include the following code:


void __attribute__((weak)) weakFn() {}


then the output Wasm from LLD will include *both* definitions of weakFn (one
from each input file), even though relocations will ensure that all callers
only ever call the first-defined instance.

This is a result of LLD dumbly concatenating the code sections of each object
file. It should prune function definitions where the Symbol for the function is
actually defined in a different object file.

This will greatly reduce code bloat for weak symbols and COMDAT (inline)
function definitions.</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>