public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Richard Earnshaw <rearnsha@arm.com>
To: johnmc@sidsa.es
Cc: binutils@sources.redhat.com
Subject: Re: plt for arm gnu thumb
Date: Tue, 18 Apr 2006 15:45:00 -0000	[thread overview]
Message-ID: <1145373227.14054.16.camel@pc960.cambridge.arm.com> (raw)
In-Reply-To: <4385.195.53.86.158.1145361498.squirrel@webmail>

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.

  parent reply	other threads:[~2006-04-18 15:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-18 13:06 johnmc
2006-04-18 13:10 ` Daniel Jacobowitz
2006-04-18 15:14   ` johnmc
2006-04-18 15:45 ` Richard Earnshaw [this message]
2006-04-18 15:49   ` Daniel Jacobowitz
2006-04-18 16:01     ` Richard Earnshaw
2006-04-18 16:49       ` Daniel Jacobowitz
     [not found]         ` <4596.195.53.86.158.1145376723.squirrel@webmail>
     [not found]           ` <20060418203900.GA23304@nevyn.them.org>
     [not found]             ` <1178.195.53.86.158.1145458815.squirrel@webmail>
     [not found]               ` <20060419150716.GA13655@nevyn.them.org>
2006-04-20 14:32                 ` johnmc
2006-04-20 14:38                   ` Richard Earnshaw
     [not found]                     ` <1507.195.53.86.158.1145536917.squirrel@webmail>
     [not found]                       ` <1145538390.16122.39.camel@pc960.cambridge.arm.com>
     [not found]                         ` <1576.195.53.86.158.1145540607.squirrel@webmail>
     [not found]                           ` <1145541382.16122.62.camel@pc960.cambridge.arm.com>
2006-04-24 18:23                             ` johnmc
2006-04-25 17:19                               ` Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1145373227.14054.16.camel@pc960.cambridge.arm.com \
    --to=rearnsha@arm.com \
    --cc=binutils@sources.redhat.com \
    --cc=johnmc@sidsa.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).