> Date: Thu, 15 May 2008 08:52:30 -1000
> From: Joseph Kowalski <jek3 at sun.com>
> Subject: Re: PSARC/2008/309 - expunge synonyms.h
> To: Darren J Moffat <Darren.Moffat at sun.com>
> Cc: "Roger A. Faulkner" <Roger.Faulkner at sun.com>, John.Plocher at sun.com,
psarc-ext at sac.sfbay.sun.com, Bart.Smaalders at sun.com, Rod.Evans at
sun.com,
Darrin.Johnson at sun.com
>
> Would be "underscore_syn.so.1" be enough?
>
> (I know we are supposed to be "linux familiar", but does that include
> "linix-prefers-really-long-and-awkward-names"? :-) :-) ;-) )
>
> - jek3
Ok. (Thanks to all.) This is my proposal, in the form of additional
material in the libc(3LIB) manual page (a stability level of
Stable would be fine with me -- it will never change):
FILES
/lib/c_synonyms.so.1
A compatibility library to provide access to obsolete
libc synonym symbols
/lib/64/c_synonyms.so.1
A 64-bit compatibility library to provide access to
obsolete libc synonym symbols
...
NOTES
The synonyms compatibility library, c_synonyms.so.1, provides
a mechanism to support old applications and libraries that
were mistakenly built using now-obsolete synonym symbols
from libc.
Before the advent of direct binding (-B direct) libc provided
many functions with two names. For example:
getpwent()
_getpwent()
These two names referred to exactly the same function in libc.
The leading-underscore symbol was intended to be used by
system libraries in order to avoid conflicting with an
application that might define its own version of getpwent()
with completely different semantics. Standards-conforming
applications may not define and use function names with
leading underscores.
Solaris system libraries are now built with direct binding.
This means that a system library that calls getpwent() will
bind directly to the instance of getpwent() in libc, even if
the application to which it is linked defines a different
getpwent() for its own use. The application binds to its
instance of getpwent() and there is no resulting conflict.
The direct binding mechanism is equally available to
libraries not delivered with Solaris.
As a result of this evolution, most of the leading-underscore
synonym symbols have been removed from libc. This means
that applications that call these now-obsolete function names
will cease to work. They will typically draw the error:
$ ./application
ld.so.1: fatal: relocation error: symbol _getpwent:
referenced symbol not found
Killed
All of the old leading-underscore symbols have been copied
to the synonyms compatibility library. This library simply
redirects the calls to the non-underscore instances of the
corresponding functions in libc. Use it as a preloaded object:
$ LD_PRELOAD=c_synonyms.so.1 ./application
The synonyms compatibility library is intended neither to
enable the generation of applications that call the obsolete
leading-underscore synonym functions, nor to endorse this
particular programming practice.