<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 - ThinLTO duplicates WebAssembly custom sections"
href="https://bugs.llvm.org/show_bug.cgi?id=38184">38184</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ThinLTO duplicates WebAssembly custom sections
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</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>Backend: WebAssembly
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>alex@crichton.co
</td>
</tr>
<tr>
<th>CC</th>
<td>dan433584@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>We've recently upgraded to LLVM 7 in the Rust compiler and have started seeing
some odd behavior on WebAssembly combined with ThinLTO. We're using LLVM's
`wasm.custom_sections` metadata to create custom sections, but the encoding via
a MDNode seems to cause ThinLTO passes to duplicate it accidentally.
Specifically what we're seeing is that we've got two modules A and B. We define
a wasm custom section metadata node in module A, but if B imports some
functions from A during the ThinLTO passes then it will *also* import the named
MDNode instances from A, causing both A and B to have wasm custom sections
defined.
I believe the relevant code is around here --
<a href="https://github.com/llvm-mirror/llvm/blob/e5c7b32694a7580b9e7fcd0f1654ac205fc4eea0/lib/Linker/IRMover.cpp#L1105-L1117">https://github.com/llvm-mirror/llvm/blob/e5c7b32694a7580b9e7fcd0f1654ac205fc4eea0/lib/Linker/IRMover.cpp#L1105-L1117</a>.
Would it be possible to add a special case there to ignore the
wasm.custom_section metadata? Or should we be preventing this through some
other means?</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>