Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Oct 1998 09:00:59 -0500
From:      "Kaleb S. KEITHLEY" <kaleb@ics.com>
To:        hackers@FreeBSD.ORG
Subject:   Re: ld for loading dynamic library changed in 3.0-RELEASE?
Message-ID:  <3635D21B.961D038@ics.com>
References:  <98Oct26.192829edt.37768-3361@qew.cs.toronto.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
David Holland wrote:
> 
>  > On that note one thing I've noticed is that the ELF ld refuses to
>  > recognize shared libs unless they end in .so.  What would the chances be
>  > of having it check for libfoo.so.x where x is the greatest value (assuming
>  > libfoo.so doesn't exist)?  This is rather annoying, as the a.out ld
>  > doesn't do this, and the Linux ld apparently doesn't do this, and that
>  > covers quite a lot of software one might want to compile.  mico is a prime
>  > example.

By definition, with ELF, ld always links with the .so.

ld uses the SO_NAME in the .so if it's available, otherwise it uses the
real name of the library, i.e. libmumble.so.mumble, and stores that as a
NEEDED in the program file. At runtime ld.so loads all the NEEDED
libraries using the libmumble.so.mumble name.

(Note that libmumble.so need not be a symlink to libmumble.so.mumble, in
which case ld.so just loads libmumble.so.)

> The Linux ld (has has been noted already) is the same as the freebsd
> one. It also requires that you have a *.so filename present. The
> reason is that ELF does not enforce any semantics on the SONAME of a
> library, so it's perfectly legitimate to have a libfoo.so.5-pizza-6.
> 
> Now, if you have libfoo.so.5-pizza-6 and libfoo.so.5-sushi-3, how is
> ld supposed to guess which one is the "greatest" value?

It doesn't. With ELF, ld.so loads the precise library that was recorded
as NEEDED by ld. 

There is no automatic runtime linking with newer versions as there is
with SunOS and *BSD-style shared libraries.

If you don't want N copies of a particular library sitting in your
/usr/lib then you use (sym)links using the older names to the newest
library.

-- 
Kaleb S. KEITHLEY

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3635D21B.961D038>