<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-ld: error: test.o: relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol version_getter; recompile with -fPIC"
href="https://bugs.llvm.org/show_bug.cgi?id=43393">43393</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>wasm-ld: error: test.o: relocation R_WASM_MEMORY_ADDR_LEB cannot be used against symbol version_getter; recompile with -fPIC
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>9.0
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mail@joachim-breitner.de
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>This used to work at revision 358327, but seems to have stopped working with
the 9 release. Consider the file (test.c:
int get_version() { return 0; }
int (*version_getter)() = &get_version;
__attribute__ ((visibility("default"))) int version() { return
(*version_getter)(); }
Compiling this with
clang-9 --compile -fpic -fvisibility=hidden
--target=wasm32-unknown-unknown-wasm -fno-builtin -ffreestanding test.c -o
test.o
wasm-ld -o test.wasm --import-memory --shared --no-entry --gc-sections
--export=__wasm_call_ctors test.o
yields
wasm-ld: error: test.o: relocation R_WASM_MEMORY_ADDR_LEB cannot be used
against symbol version_getter; recompile with -fPIC
But note that I am compiling it with -fPIC (and it used to work).</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>