[llvm-bugs] [Bug 35534] New: Wasm backend duplicate function pruning

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 5 10:11:08 PST 2017


            Bug ID: 35534
           Summary: Wasm backend duplicate function pruning
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: ncw at realvnc.com
                CC: llvm-bugs at lists.llvm.org

This is as a follow-on to COMDAT support
(https://bugs.llvm.org/show_bug.cgi?id=35533). 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.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171205/1e4418a1/attachment-0001.html>

More information about the llvm-bugs mailing list