This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ARM long branch stubs: shared libs
- From: Daniel Jacobowitz <drow at false dot org>
- To: Christophe LYON <christophe dot lyon at st dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Thu, 2 Apr 2009 12:11:55 -0400
- Subject: Re: ARM long branch stubs: shared libs
- References: <49B69FF6.4050903@st.com> <49B920AD.80705@st.com> <20090401154059.GA4965@caradoc.them.org> <49D4D460.30103@st.com>
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