ARM long branch stubs: shared libs
Christophe LYON
christophe.lyon@st.com
Fri Apr 3 09:28:00 GMT 2009
On 02.04.2009 18:11, Daniel Jacobowitz wrote:
> 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.
>
I have read again the ELF spec and discovered that indeed weak symbols
are preemtible and thus need to use a PLT entry.
> Is this a hitherto undiscovered requirement on the ARM dynamic linker?
Isn't this requirement common to all targets?
>> 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.
>
I am giving a look at it, and I hope to be able to submit a patch soon.
Thanks for your help,
Christophe.
More information about the Binutils
mailing list