[vox-tech] Re: [vox] libc6

Jeff Newmiller vox-tech@lists.lugod.org
Thu, 24 Apr 2003 12:56:01 -0700 (PDT)


On Thu, 24 Apr 2003, Mark K. Kim wrote:

> glibc is same as libcN, where N is 6 IIRC.

C compilers may depend on two types of function calls:
implementation-specific calls that the compiler can rely on to accomplish
certain tasks, and "standard" interfaces that the programmer wants to see
(POSIX, ISO).  Often the implementation depends on macros to connect
"standard" functions to implementation-specific ones.

"libc" is a concept that combines these two needs.  Seems like a bad idea
to me, but that is the way it goes.

"libc6" is a kind of API developed by the glibc team that is supposed to
support the requirements of the "libc" concept while supporting a growing
set of available functions in the interface with backward compatibility
(old programs can use new libraries).  glibc is an implementation of the
libc6 API. Thus, a particular version of glibc can be symlinked as a
variant of libc6 and fulfill all of the requirements of equal and earlier
versions of glibc. It does this by associating the semantics (meaning) and
syntax (name, return type and parameters) of a function call with a
function name that includes the glibc version.  As long as subsequent
versions of glibc don't change the semantics of that function, it will
retain that "old version" notation.  If they introduce changes to the
semantics (correct constant values, etc) that can be covered by macros
during compilation, then they introduce an additional versioned function.  
The old binaries continue to use the old interface (so the new library may
have to alter the implementation of the old interface to work in the new
environment) while new programs will be compiled to use the new interface.

This means that you cannot look at the name of a libc6 file and know if
your binary will link to it... the binary may reference functions that
were introduced by a later version of glibc.  The symptom of new binaries
with old libraries is, unfortunately, usually a segfault.  Thus "ldd
yourbinary" is not as useful as it might seem, though "nm yourbinary" will
show you which function interfaces are in use.

You can see the API of your glibc library using "nm -D /lib/libc.so.6".

[...]

> On Thu, 24 Apr 2003, Peter Jay Salzman wrote:
> 
> > even i don't know if this is a vox or vox-tech question.  hah.  :)

Seems pretty clearly vox-tech to me.

> >
> > is the GNU C library officially called libc6 or glibc?  the debian
> > package calls it libc6 (libc version 6), but i see references to glibc
> > all over the place.  what's the official name for this library?

Depends on context.  The linkage name is libc6, and the actual library is
glibc. Both are "official". (Someone could clone the interface and supply
"salzmanlib" symlinked to libc6, but it wouldn't help them much unless
they altered the standard headers too.)

> >
> > also, do *BSD systems use GNU stuff as well?   or do they have their own
> > set of tools?

Dunno.

> > are there any other unix variants that officially use GNU stuff?

Dunno.

---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...2k
---------------------------------------------------------------------------