<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 - lld drops the weak symbol"
href="https://bugs.llvm.org/show_bug.cgi?id=34301">34301</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>lld drops the weak symbol
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>ELF
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sylvestre@debian.org
</td>
</tr>
<tr>
<th>CC</th>
<td>davide@freebsd.org, joker.eph@gmail.com, llvm-bugs@lists.llvm.org, ruiu@google.com
</td>
</tr></table>
<p>
<div>
<pre>Reported here:
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1391183#c3">https://bugzilla.mozilla.org/show_bug.cgi?id=1391183#c3</a>
------
here's what main looks like in that dummy:
00000000002010f8 <main>:
2010f8: 31 c0 xor %eax,%eax
2010fa: e9 01 ef df ff jmpq 0
2010ff: cc int3
Here's what it's expected to look like:
00000000000006e0 <main>:
6e0: 55 push %rbp
6e1: 48 89 e5 mov %rsp,%rbp
6e4: b8 00 00 00 00 mov $0x0,%eax
6e9: e8 b2 fe ff ff callq 5a0 <print_status@plt>
6ee: 5d pop %rbp
6ef: c3 retq
And dummy.c is:
extern __attribute__((visibility("default"), weak)) int print_status();
int main() {
return print_status();
}
This is what objdump -dr dummy.o looks like on my machine:
0000000000000000 <main>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: b8 00 00 00 00 mov $0x0,%eax
9: e8 00 00 00 00 callq e <main+0xe>
a: R_X86_64_PLT32 print_status-0x4
e: 5d pop %rbp
f: c3 retq
And what it looks like on yours:
0000000000000000 <main>:
0: 31 c0 xor %eax,%eax
2: e9 00 00 00 00 jmpq 7 <main+0x7>
3: R_X86_64_PLT32 print_status-0x4
The code is fine, but lld is completely dropping the weak symbol.
------</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>