This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: plt for arm gnu thumb
On Tue, Apr 18, 2006 at 04:13:47PM +0100, Richard Earnshaw wrote:
> There's only ever going to be a problem if you try to run on an
> Architecture v4T device. These chips cannot transition to Thumb mode
> when loading a PC value from memory, but need instead to use a BX
> instruction. The problem is that for a shared library trampoline we
> need to:
>
> - preserve all of r0-r11, r13 and r14
> - have the 'index' of the called function in ip
>
> There's simply no way to achieve all that efficiently and support proper
> interworking on these devices. (v5 and later chips can swap from ARM to
> Thumb on a load into the PC, so there is no problem there).
>
> We investigated this quite thoroughly as part of the EABI development.
> We concluded that given that the standard trampoline would work on all
> v4 and earlier chips and all v5 or later chips (ie everything but v4T),
> and that on v4T the sequence works if the target of the call is entered
> in ARM state, the best solution overall was to mandate that on a v4T
> device, the called address must be an ARM instruction (it can transition
> to Thumb state immediately thereafter).
>
> In theory this could all be handled by the linker when constructing the
> library, but currently the GNU linker does not do this.
Oh, right; I forgot about this issue.
I did once implement alternate PLT sequences which could target Thumb,
even on v4t. However, they are mighty awkward, so I would strongly
prefer not to submit the patch. John, are you really using v4t?
--
Daniel Jacobowitz
CodeSourcery