Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Oct 1999 15:24:12 -0700 (PDT)
From:      patl@phoenix.volant.org
To:        John Birrell <jb@cimlogic.com.au>
Cc:        current@freebsd.org
Subject:   Re: Weak symbols (Was: World breakage in libc_r?)
Message-ID:  <ML-3.4.940026252.113.patl@asimov>
In-Reply-To: <19991016080722.E67481@freebsd1.cimlogic.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On 15-Oct-99 at 15:05, John Birrell (jb@cimlogic.com.au) wrote:
> On Fri, Oct 15, 1999 at 08:09:57PM +0200, Wilko Bulte wrote:
> > Sheer curiosity and most likely a somewhat dim question:
> > 
> > what the h* is a weak versus a strong symbol?
> 
> A weak symbol is like an alias for another (strong) symbol. The linker
> will link to strong symbols first, then, for any unresolved references,
> it will try to resolve against the weak symbols before going on to
> the next library. Weak symbols are a good way to hide things in order
> to stop polluting the name space. But they can cause problems too.

If so, then the definition has changed since they were first invented.
(Around 20 years ago, IIRC.)  Weak symbols were/are used to refer
to external objects that may or may not actually be linked in.  The
difference between a weak and a strong symbol is/was that a strong
symbol would cause the appropriate library to be loaded to ensure
that it would be defined (and generate errors if still unresolved at
the end of the link) whereas a weak symbol would not cause a library
module to be loaded and would not cause an error if left unresolved.

I don't recall any consistant name for the behavour you describe,
but it was traditionally handled by the linker control file.  (Of
course, this was on systems which had somewhat smarter linkers than
unix's.)


-Pat


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ML-3.4.940026252.113.patl>