Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Nov 1995 11:48:19 EDT
From:      "Kaleb S. KEITHLEY" <kaleb@x.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        hackers@freefall.FreeBSD.org
Subject:   Re: gcc 2.1.7 (and libg++) 
Message-ID:  <199511281648.QAA15023@exalt.x.org>
In-Reply-To: Your message of Wed, 29 Nov 1995 02:28:15 EDT. <199511281528.CAA02383@godzilla.zeta.org.au> 

next in thread | previous in thread | raw e-mail | index | archive | help

> >    Bruce> I just deleted ASM_WEAKEN_LABEL() for 2.7.0.  This may have
> >    Bruce> broken the C++ feature that depends on weak symbols.
> 
> >My compiler implementation days are long gone ... what the heck is a
> >weak symbol?
> 
> It has something to do with allowing user functions to replace library
> functions.
> 

It's really for library developers. A programmer has always been able 
to replace library functions with his or her own functions, which may 
or may not be a good thing.

One use of weak symbols for example, is if you build X on a platform 
with threads libX11 and libXt will reference thread functions. But a 
non-threaded program usually doesn't want to link with the thread 
library for performance (threads in a non-threaded program does add 
overhead) and other reasons. Stub routines in libc (with #pragma weak) 
allow the references in libX11 and libXt to be resolved without linking
the threads library.

But a real threaded program will link with the thread library and the 
semantics of weak will allow the symbols in the threads library to take
precedence over the weak symbols in libc. (It took Sun a couple revs of 
Solaris to get this right, and Unixware 2.x didn't learn from Sun's 
mistakes.)

--

Kaleb KEITHLEY



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