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: plt for arm gnu thumb


On Tue, 2006-04-18 at 12:58, johnmc@sidsa.es wrote:
> hello
> 
> 
> I have just finished a shared library system using the gnu tools for a
> system using  arm thumb code but I have found that there is a problem in
> that the plt is produced for arm code and it does not work correctly .
> question - can I force the gnu tools to produce thumb code plt.
> 
> I am using
> arm-elf-gcc (GCC) 4.0.1
> GNU ld version 2.16.1

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.

R.


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