Subject: Re: 'prebind' implementation (was Re: HEADS UP: migration to fully dynamic linked "base" system)
To: Andrew Brown <atatat@atatdot.net>
From: Bang Jun-Young <junyoung@mogua.com>
List: current-users
Date: 08/28/2002 21:28:26
On Tue, Aug 27, 2002 at 11:08:57PM -0400, Andrew Brown wrote:
> > > yes, but is foo to expect that libc will be at 0x48056000 every time
> > > foo is executed?
> > > 
> > > i have actually managed to get mine to load at 0xbdb48000 tonight.  :)
> >
> >Oh, just because you're hacking on UVM :-)
> 
> zakly.  :)
> 
> >For prebinding to work, yes, you expect it to be loaded at the same place
> >each time, and encode them as doing so.  And prebinding would use a fixed
> >mapping at the specified location in order to make that work.
> 
> how about if, instead of using fixed, it specified a hint and "bailed"
> if the returned address wasn't what it wanted?  even the mmap(2) man
> page says that the use of MAP_FIXED is discouraged...

More thoughts on prebinding:
 
 - '.pgot' would be better than '.pplt'. First, '.got' is mapped 
   read-writable but '.plt' read-only, and second, it's much easier to
   deal with GOT entries than PLT entries. '.plt' is code section so
   you should know how jmp instruction is encoded for each archtecture. 

 - Save base addresses of shared objects in some place of the binary,
   and if they are different than actual base addresses of shared objects
   mapped in memory, dynamic linker performs additional fixup process by
   adding/subtracting delta to/from each entry in '.pgot'. This would
   be simple and not be a time-taking job. 

Jun-Young

-- 
Bang Jun-Young <junyoung@mogua.com>