Finding the path of the current binary?

Roland McGrath roland@redhat.com
Fri Mar 7 22:24:00 GMT 2003


> Doesn't that require the library knows its own soname? 

That's not really an unreasonable requirement.  It would just be one
argument to a general function.  But as has been pointed out, it's not
really required because a function can be written that examines the
_DYNAMIC table itself.  If that function lives in another shared library,
it needs to take &_DYNAMIC as an argument from code in the library that
wants to know about itself.

> > That said, it might indeed be nice to have a library interface for
> > substituting $ORIGIN and similar magic bits.
> 
> That would be idea really. Any idea how complex such a patch would be?

Adding something to glibc would be trivial if an interface is chosen.
The Solaris `dlinfo' interface looks reasonable at a glance.  I could add that.



More information about the Libc-alpha mailing list