<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] Symbol linked in despite no strong references"
href="https://bugs.llvm.org/show_bug.cgi?id=40494">40494</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[Wasm] Symbol linked in despite no strong references
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>other
</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>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dan433584@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org, sbc@chromium.org
</td>
</tr></table>
<p>
<div>
<pre>An extern weak alias appears to be pulling in otherwise unneeded definitions
from archive files. This is inconsistent with ELF platforms, at least.
$ cat test_start.c
extern void foo(void) __attribute__((weak));
void _start(void) {
if (&foo) {
foo();
}
}
$ cat foo.c
void foo(void) {}
$ clang --target=wasm32-unknown-unknown -nostdlib test_start.c
$ wasm2wat a.out |grep foo
(func $undefined_function_foo (type 0)
call $undefined_function_foo
$ clang --target=wasm32-unknown-unknown -c foo.c
$ llvm-ar crus libfoo.a foo.o
$ clang --target=wasm32-unknown-unknown test_start.c -nostdlib -L. -lfoo
$ wasm2wat a.out |grep foo
call $foo
(func $foo (type 0)
(elem (;0;) (i32.const 1) $foo))
$
So even though there's no strong reference to foo, whole-archive mode is not
enabled, adding -lfoo is enough to cause function foo to be linked in.</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>