identifying symbol versions available to dlvsym

Manuel Arriaga manuelarriaga1980@gmail.com
Mon Dec 3 18:14:00 GMT 2007


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?

Thank you for any help,

Cheers

Manuel




On Dec 3, 2007 12:48 PM, Manuel Arriaga <manuelarriaga1980@gmail.com> wrote:
> Hello everyone,
>
> I am trying to determine which versions of a given symbol (in this
> case, fopen) are available in a system's GNU libc for loading through
> dlvsym().  How can I do that?
>
> I thought I could get this from objdump
>
>
> $ objdump -T /lib/libc-2.6.1.so |grep " fopen$"
> 000575f0 g    DF .text  00000032  GLIBC_2.1   fopen
> 000f9380 g    DF .text  00000097 (GLIBC_2.0)  fopen
>
>
> but then I tried running the attached program on the two versions
> listed for fopen (GLIBC_2.0 and GLIBC_2.1) and it failed
>
> $ ./dlvsym fopen GLIBC_2.1
> fp= 0
> dlerror()==NULL
> $ ./dlvsym fopen GLIBC_2.0
> fp= 0
> dlerror()==NULL
>
> Through "brute-force"ing version numbers, I identified the version
> GLIBC_2.2.5 as available on this system:
>
> $ ./dlvsym fopen GLIBC_2.2.5
> fp= 1772397760
> dlerror()==NULL
>
> But then I have another system with an earlier GNU libc version
> (2.3.5) in which objdump lists the same symbol versions yet I can only
> load fopen version GLIBC_2.1 using dlvsym.
>
> What is the correct way to identify which versions of a given function
> I can load with dlvsym?
>
> Thank you for any help
>
> Manuel
>



More information about the Binutils mailing list