ideas about threading lib switching

Steve O'Hara-Smith steve at sohara.org
Wed Apr 11 14:26:02 PDT 2007


On Wed, 11 Apr 2007 22:19:22 +0200
"Simon 'corecode' Schubert" <corecode at fs.ei.tum.de> wrote:

> Steve O'Hara-Smith wrote:
> >> However, I don't know how we can do this.  Does anybody have input,
> >> ideas?  One way would be to use rtld/libmap, like in FreeBSD, but I
> >> don't 100% like this approach.  I'd like to find something more
> >> elegant.  But I'm kind of stuck here, maybe somebody has some ideas to
> >> contribute?
> > 
> > 	The thought that comes immediately to mind is that variant
> > symlinks may be of help here.
> 
> varsyms do not necessarily help here, because at link time the soname
> might be stored in the binary, which means that the varsym is not being
> used at runtime.  We would need some way to have a proxy lib at link
> time, but a varsym at runtime.
> 
> AH! (bulb lights up)
> 
> how about:
> 
> libpthread.so
> 	proxy lib.  ONLY used for linking, not for runtime usage.
> 	has set its soname to "librealpthread.so.0"
> 
> librealpthread.so.0
> 	is a varsym link to either one of the threading libs.

	Hmm - "All problems in computer science can be solved by adding
another level of indirection" :)

> -pthread would translate to -lpthread.  however, libpthread.so has set a
> soname, so that this soname will be used by the rtld.  this means that
> all binaries in general obey the ABI (defined functions) defined by
> libpthread.so, however they will use the lib pointed to by
> librealpthread.so.0, which then can be libc_r.so.5 or libthread_xu.so.1.
> 
> makes sense?

	Sounds good to me.

-- 
C:>WIN                                      |   Directable Mirror Arrays
The computer obeys and wins.                | A better way to focus the sun
You lose and Bill collects.                 |    licences available see
                                            |    http://www.sohara.org/





More information about the Kernel mailing list