This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: identifying symbol versions available to dlvsym
On Fri, Dec 21, 2007 at 04:22:41PM +0000, Nick Clifton wrote:
> I am sorry that it has taken so long for us to reply to your posts.
>
> >OK, so some experimentation and additional searching showed me that
> >GNU libc's fopen does not necessarily reside on /lib/libc.so.6. By
> >looking into a different shared lib, one reads
> >
> >$ readelf -s /lib64/libc.so.6 |grep " fopen@"
> > 162: 000000000005f4c0 10 FUNC GLOBAL DEFAULT 12
> > fopen@@GLIBC_2.2.5
> >
> >which is precisely the version number that works with dlvsym().
> >
> >How could I have found this programatically? To identify the version
> >of fopen being used, can I do better than
> >
> >1) running ldd on an executable containing a call to fopen();
> >2) run readelf -s | grep fopen on each of the libs listed; and
> >3) using the first version string I find in 2) in my calls to dlvsym?
Well, usually you don't want the first version, but the default version (the
one with @@ instead of just @), because that matches the headers of the
library and what you'd normally get if you directly linked against the
library rather than using dlvsym.
Jakub