Subject: Re: New idea on ELF prebinding
To: David Laight <david@l8s.co.uk>
From: Bang Jun-Young <junyoung@netbsd.org>
List: tech-userlevel
Date: 11/23/2002 15:18:26
On Fri, Nov 22, 2002 at 08:04:40PM +0000, David Laight wrote:
> Could you take this one stage further?
> 
> For a program [1] you wish to 'prebind' generate a file that contains:
> - the names of each elf object that makes it up with the offset,
>   size and address of each area that need mmap()ing readonly shared
> - a data area containing all the writable area of the entire program
>   (including the shared libraries that will be loaded) already fixed
>   up for the addresses the libraries will be mapped to
> - symbol tables for each namespace (for dlsym)

Would the size be really necessary? Different objects have different
checksums, so my gut feeling is that size doesn't need to be compared.

Otherwise, sounds good.

> 
> This would be an executable file that is basically elf, but uses
> a special interpreter to find the correct files and map segments
> of them to the correct addresses.
> 
> Executing this version of the program would not require any
> code or data fixups.

I feel the idea of prebinding is getting similar to "hibernation". ;-)

> 
> (clearly you need to be able to detect whether any of the files
> have been overwritten since you generated the image)

It's very easy to detect if the file is overwritten with a new one.
They will have different checksums anyway.

> 
> 	David
> 
> [1] you have to do this far each program, not shared library due to
> the symbol lookup rules.

Yeah, my previous prebind(1) did that for shared library, so it broke
the ABI. ;-(

Jun-Young

-- 
Bang Jun-Young <junyoung@netbsd.org>