Stephen Gran on 7 Mar 2006 20:15:59 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] glibc problem?


On Tue, Mar 07, 2006 at 01:49:34PM -0500, Jeff Abrahamson said:
> On Tue, Mar 07, 2006 at 03:32:14PM +0000, Stephen Gran wrote:
> > glibc uses something called 'versioned symbols' - basically this
> > means that when you want to use a c library function in one of your
> > applications, the compiler and linker find it in the c library and
> > link to it, and also link in the version of the function used.  So
> > you'll be linking to printf@glibc.2.3.2 instead of just linking to
> > printf.  Very nice, and I wish more libraries did it.
> 
> Very neat.
> 
> I see a bunch of discussion about versioned symbols, mostly on Debian
> lists.  But I don't see discussion on how to implement it in
> libraries.  Can you offer a pointer (e.g., a URL) on how to convert
> libraries to use versioned symbols for those of us who sometimes write
> libraries?  It looks like very little actually does it this way
> currently, but it would be nice to learn how.

The short answer is, use -Wl,--version-script=libfoo.vers

For a discussion of linker version scripts, take a look here:
http://www.gnu.org/software/binutils/manual/ld-2.9.1/html_mono/ld.html#SEC25

It seems relatively straightforward to do manually, at first glance, but I
haven't yet set up a library to do this from scratch (and the auto-foo
looks daunting), so I can't be sure.
-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | And so it was, later, As the miller     |
|  steve@lobefin.net             | told his tale, That her face, at first  |
|  http://www.lobefin.net/~steve | just ghostly, Turned a whiter shade of  |
|                                | pale.   -- Procol Harum                 |
 --------------------------------------------------------------------------

Attachment: signature.asc
Description: Digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug