Subject: Re: COMPAT_LINUX vsyscall
To: Jason Thorpe <thorpej@shagadelic.org>
From: Ian Lance Taylor <ian@airs.com>
List: tech-kern
Date: 05/02/2005 15:37:27
Jason Thorpe <thorpej@shagadelic.org> writes:

> On May 2, 2005, at 12:52 AM, Pavel Cahyna wrote:
> 
> > How would the processes know where the functions are?
> 
> One method would be making the entry points to the functions live at
> pre-defined locations.
> 
> Another method would be for the run-time start-up code to ask for
> this information from the kernel.  But that would require re-linking
> all programs with the new crt* before they could take advantage of it.

Well, you have to relink anyhow, or you're just going to be calling
into libc.so.  Or if you just want to change libc.so, you can use the
DT_INIT in libc.so to set up the addresses without requiring them to
be predefined.  Then every program starts a little slower, but every
program automatically uses the kernel provided routines.

For what it's worth, AIX defines specific absolute addresses as entry
points for magic functions provided by the kernel.  Then it declares
the function values as absolute symbols in libc.  So any program that
links against libc automatically calls the magic functions directly.
I'm not 100% sure this would work right with ELF (AIX uses XCOFF) but
it might.

Another interesting approach would be to multi-arch the symbols in
libc, and have the dynamic linker pick the one which is best for the
current system.  I don't know of any system which does that.

Mind you, I'm not sure whether this kind of thing is really worth it,
myself.  Why not just provide versions of libc wholly compiled for
each specific architecture of interest?

Ian