[llvm-bugs] [Bug 34301] New: lld drops the weak symbol
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Aug 23 14:00:30 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34301
Bug ID: 34301
Summary: lld drops the weak symbol
Product: lld
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: ELF
Assignee: unassignedbugs at nondot.org
Reporter: sylvestre at debian.org
CC: davide at freebsd.org, joker.eph at gmail.com,
llvm-bugs at lists.llvm.org, ruiu at google.com
Reported here:
https://bugzilla.mozilla.org/show_bug.cgi?id=1391183#c3
------
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 at 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.
------
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170823/3ff2685f/attachment-0001.html>
More information about the llvm-bugs
mailing list