This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM long branch stubs: shared libs


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.

Is this a hitherto undiscovered requirement on the ARM dynamic linker?

> - then, the reference from ARM code is turned into a jump to the next  
> instruction
> - but references from THUMB code aren't. There is a comment saying "A  
> branch to an undefined weak symbol is turned into a jump to the next  
> instruction unless a PLT entry will be created"
>
> Why is there a different handling of a ARM call vs a THUMB call in this  
> case?

There shouldn't be.  It sounds like you've found another bug.  The
Thumb version makes more sense.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]