[LLVMbugs] [Bug 9352] New: [MC assembler] relocations for weak symbols not generated
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Mar 1 06:43:35 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=9352
Summary: [MC assembler] relocations for weak symbols not
generated
Product: new-bugs
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: dimitry at andric.com
CC: llvmbugs at cs.uiuc.edu
Clang's integrated assembler does not always generate external
relocations for weak symbols, even when that is required.
Test case:
.weak foo
.equ foo, foo_stub
.text
foo_stub:
ret
bar:
call foo
ret
Here, the "call foo" should be resolved at link time, so the assembler
should put in a relocation. GNU as assembles this to:
0000000000000000 <foo>:
0: c3 retq
0000000000000001 <bar>:
1: e8 00 00 00 00 callq 6 <bar+0x5>
6: c3 retq
and it creates the following relocation for the call:
relocation with addend (.rela.text):
entry: 0
r_offset: 0x2
r_info: 2
r_addend: -4
In contrast, clang r126742 integrated-as produces:
0000000000000000 <foo>:
0: c3 retq
0000000000000001 <bar>:
1: e8 fa ff ff ff callq 0 <foo>
6: c3 retq
so does not create any relocation; it short-circuits the "call foo"
directly.
On FreeBSD, this breaks our malloc very, very badly. :)
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list