Subject: Re: ELF prebinding round 2: shared object prerelocation
To: Jason R Thorpe <>
From: Matt Thomas <>
List: tech-userlevel
Date: 09/21/2002 20:42:21
At 06:52 PM 9/21/2002, Jason R Thorpe wrote:
>On Sat, Sep 21, 2002 at 04:21:10PM +0900, Bang Jun-Young wrote:
>  > A shared object now has preferred base address, which gives a hint
>  > to ld.elf_so where to load the object. This information must be known
>  > to ld.elf_so before shared object is actually loaded, so I decided to
>  > put it in p_paddr of the first PT_LOAD entry. This field has unspecifed
>  > contents and is ignored, according to SysV ABI spec (in normal case
>  > p_paddr == p_vaddr).
>Hm.  This seems like ... not the best way.  The problem is that
>the preferred address could be very different based on the program
>that uses the lib, not the lib itself.

What really needs to be done is to prerelocate all the libraries
based on the linkage tree.  Of course, DT_NEEDED will help with this
considerably.  Except we don't link shared libraries so they state
their dependencies.

>...but, ignoring that part... :-)
>I'm not particularly keen on the idea of using the "paddr" in the first
>phdr to indicate the preferred address -- seems like it would be better
>to insert a new entry into .dynamic which contained the necessary info.

It seems to me, that you would change vaddr to be the biased address.
Of course, then we should really change the reloc's to subtract relocbase
(which is gotten from vaddr) before they add mapbase.

Matt Thomas               Internet:
3am Software Foundry      WWW URL:
Cupertino, CA             Disclaimer: I avow all knowledge of this message