LWN.net Logo

Zeuthen: Writing a C library, part 2

Zeuthen: Writing a C library, part 2

Posted Jul 3, 2011 6:30 UTC (Sun) by cmccabe (guest, #60281)
In reply to: Zeuthen: Writing a C library, part 2 by hmh
Parent article: Zeuthen: Writing a C library, part 1

> And you will want to use the linker symbol versioning instead of static
> versioning, otherwise, you'd break the API all the time. BTW, it is not a
> gcc thing, it is an ELF thing, and Solaris has been doing it since forever.

from http://www.airs.com/blog/archives/220

> Ulrich Drepper and Eric Youngdale introduced a much more sophisticated
> symbol versioning scheme, which is used by the glibc, the GNU linker, and
> gold. The key differences are that versions may be specified in object
> files and that shared libraries may contain multiple independent versions
> of the same symbol

In other words, this is a gcc-specific ELF extension. I wonder if LLVM supports it yet? I found a page from 2008 that said that LLVM didn't have support for this yet, but then I got tired of using the Google.


(Log in to post comments)

Zeuthen: Writing a C library, part 2

Posted Jul 3, 2011 9:39 UTC (Sun) by nix (subscriber, #2304) [Link]

Yes, its a Linuxism (and very much more useful than Solaris symbol versions), but a lot of the syntax of the file, and the underlying idea, was a Solarisism first.

Zeuthen: Writing a C library, part 2

Posted Jul 3, 2011 17:07 UTC (Sun) by paulj (subscriber, #341) [Link]

Symbol map files are supported by several proprietary Unix toolchains, including Suns' and (iirc) HPs'. The syntax is nearly identical twixt Solaris and GNU (there's certainly a useful common subset iirc). The ELF symbol stuff is at least very very similar in concept. It might even be standardised, and/or tools may know the differing formats. Binary compatibility across different OSes tends not to be the most important of issues though..

Zeuthen: Writing a C library, part 2

Posted Jul 6, 2011 15:54 UTC (Wed) by jwakely (subscriber, #60262) [Link]

> In other words, this is a gcc-specific ELF extension.

It's not gcc-specific, it's done by GNU binutils not gcc

http://sourceware.org/binutils/docs-2.21/as/Symver.html
http://sourceware.org/binutils/docs-2.21/ld/VERSION.html

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds