Subject: weak stuff
To: None <tech-userlevel@netbsd.org>
From: Paul Kranenburg <pk@cs.few.eur.nl>
List: tech-userlevel
Date: 12/24/1994 22:36:15
Over the past few days, I have checked in a number of changes to the
as and ld sources that deal with "weak" symbols.

Weak symbols are like normal global symbols (ie. externally visible),
except that:

1) Global symbols take precedence over weak symbols when resolving
   references.
2) Weak symbols do not cause `multiple defined' diagnostics on a name
   clash.
3) Undefined weak symbols do not cause library members to get pulled in.

Obviously, the traditional a.out format does not cater for all this, so
I've fudged the struct nlist's `n_other' field to contain a WEAK bit.

Having weak symbols around will make it easier to clean up library name
space pollution (less intrusive than using N_INDR types, anyway).
gcc's `#pragma weak ...' support can be used to qualify a symbol as weak.

I'm currently running such a "#pragmatic" C library on a NetBSD sparc
machine; I have not yet tried other machines or libraries.

-pk