Lazy linking issues

Alan Modra alan@linuxcare.com.au
Tue, 26 Sep 2000 15:32:43 +1100 (EST)


On 25 Sep 2000, David Huggins-Daines wrote:

> This means that my old idea of storing the index of the IPLT
> relocation in each PLT slot in elf_machine_runtime_setup() was
> essentially correct, but then we have the problem of how to get at the
> reserved area of the GOT.  There is basically no way to do this that I
> can think of without adding another word to the PLT slot (which might
> not be a bad idea, actually).

The easiest thing would be to make PLTGOT always point to the start of
.got, which is what most other architectures do.  Having PLTGOT (and
hence the linkage table pointer) point elsewhere is just an optimisation
of dubious value.  At the moment we don't try to remove the addil's from
import stubs anyway, and in any case, positioning the LTP at the start of
the .got (which is also the end of the .plt) is a fairly good choice for
addressing both .plt and .got with 14-bit offsets.

Is this enough for lazy linking?  No, because each jump through a plt
entry needs to pass it's .got (struct link_map really) as well as pltrel
offset to the fixup routine.  I think the dynamic linker needs some help
from the linker.  Again stealing ideas from other architectures, let's
modify the linker to set up the .plt function pointers to point back to
the start of the plt.  We'll reserve some space at the start of the plt
for code to load any necessary pointers into registers.
elf_machine_runtime_setup will need to relocate the .plt function
pointers, and also the code at the start of the plt unless I can make it
PIC.

Alan Modra
-- 
Linuxcare.  Support for the Revolution.