From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19429 invoked by alias); 3 Dec 2007 18:14:33 -0000 Received: (qmail 19420 invoked by uid 22791); 3 Dec 2007 18:14:32 -0000 X-Spam-Check-By: sourceware.org Received: from rv-out-0910.google.com (HELO rv-out-0910.google.com) (209.85.198.187) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 03 Dec 2007 18:14:28 +0000 Received: by rv-out-0910.google.com with SMTP id l15so2711459rvb for ; Mon, 03 Dec 2007 10:14:25 -0800 (PST) Received: by 10.141.153.16 with SMTP id f16mr5807661rvo.1196705665909; Mon, 03 Dec 2007 10:14:25 -0800 (PST) Received: by 10.140.166.7 with HTTP; Mon, 3 Dec 2007 10:14:25 -0800 (PST) Message-ID: <43d106a20712031014t559cbbbaid13be33547e7a9c3@mail.gmail.com> Date: Mon, 03 Dec 2007 18:14:00 -0000 From: "Manuel Arriaga" To: binutils@sourceware.org Subject: Re: identifying symbol versions available to dlvsym In-Reply-To: <43d106a20712030948x2ec458f6j7564cb6db41fa018@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <43d106a20712030948x2ec458f6j7564cb6db41fa018@mail.gmail.com> X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2007-12/txt/msg00013.txt.bz2 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 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 >