On Thu, Apr 02, 2009 at 05:06:08PM +0200, Christophe LYON wrote:
Because I didn't want to change a behaviour I didn't completely master.
As the usual rule applies: what is not tested does not work.
But... I have tried your suggestion (ie. mark the undef symbol with .weak
in the testcase), and I get an error message from the linker (relocation
truncated to fit).
Now, if I handle undefweak and undef symbols in the same way, I observed
that:
- in allocate_dynrelocs, a PLT entry is created for the undefweak,
despite the comment "Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic."
This part is correct. The comment is not clear, but the goal is to
mark undefined weak symbols as dynamic at this point. Branches should
go to the PLT entry. I'm not sure what happens if you call that PLT
entry, though, and there is no definition at runtime. Ideally,
nothing would happen, but I'm sure glibc does not implement that.