This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [arm] EABI annotation of thumb symbols.
On Thu, Nov 04, 2004 at 10:42:31AM -0500, Ian Lance Taylor wrote:
> Daniel Jacobowitz <drow@false.org> writes:
>
> > > That said, I'm building Thumb shared libraries in which the PLT takes
> > > up 120K, or some 4.5% of the text section size. It's probably
> > > possible to use version scripts to force some of the symbols to be
> > > local, but this source code is neither from us nor from our customer,
> > > so that is not a simple task. Using Thumb instructions in the PLT
> > > would give me some clearly measurable size improvements.
> >
> > Would it really? Here's an alternative: in the patches I'll be
> > posting, I add support for independently sized PLT entries. It would
> > then be relatively simple (not trivial, because of relaxation problems,
> > but doable) to use a two instruction ARM PLT sequence if it is in
> > range. The largest shared library I have handy at the moment has an
> > 85K PLT using the new three-word entries, and the first word is
> > _always_ redundant. Then use interworking branches to get to the PLT.
> >
> > I doubt you'll get a Thumb PLT sequence under eight bytes.
>
> I don't know what the three-word PLT entry is.
Take a look at the PLT entries produced by any recent version of the
linker (I don't know whether it was in 2.15 or not; if not it went in
soon after). Phil contributed a three-word PLT sequence that looks
like:
add ip, pc, #OFF1
add ip, ip, #OFF2
ldr pc, [ip, #OFF3]!
> By relaxation, do you
> mean loading a GOT index into a register and then branching to the
> symbol resolution routine? That would work for the first 256 GOT
> entries, and for some subset of the subsequent ones. Or did you have
> something else in mind?
In the above sequence, OFF1 is almost always 0 unless your shared
library is pretty large. It looks like OFF2 and OFF3 give you a range
of 20 bits. Given that the PLT is placed at the beginning of the text
section, that's pretty limiting; I imagine it could be placed at the
end instead - I'm not sure why it is the usual convention to put it at
the beginning, there may be some reason I am missing.
--
Daniel Jacobowitz