<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 data pruning"
href="https://bugs.llvm.org/show_bug.cgi?id=35535">35535</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wasm backend duplicate data 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 data is
removed.
In a function like this:
inline const char* inlineStringFn() { return "string"; }
extern void importedFn(int* dat);
inline void inlineArrayFn() {
const int dat[] = {1,2,3,4,5,6,7,8,9};
importedFn(dat);
}
the string data is NOT part of a COMDAT, surprisingly. It does go in its own
section named ".rodata.<mangled inlineFn>". However, there isn't a clear
command to the linker, as far as I can see, to ensure that the duplicate data
is pruned. Again, in the case inlineArrayFn() it looks like the front-end is
relying on the linker to do some kind of de-deplication, because the read-only
data is put in a separate section but not put in a COMDAT, so LLD is going to
have to de-duplicate it in some other way.
In any case, string data is a special case that deserves special attention,
regardless of inline functions.
LLD needs to ensure that when linking Wasm, strings and other read-only data
sections with duplicate contents are merged. I think ld has a pass for
de-duping constant data, and is able to special-case string data by
string-by-string de-duping, and for other data sections is able to hash the
whole section and avoid linking in duplicate data.</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>