Subject: how to handle namespace cleanup
To: None <tech-userlevel@netbsd.org>
From: J.T. Conklin <jtc@cygnus.com>
List: tech-userlevel
Date: 12/06/1994 16:09:17
ANSI C requires that the functions specified by the standard can not
call other functions that are in the user's namespace.  For example,
users should be able to write programs containing a function called
open() yet still expect fopen() to work properly.

If we were only interested in providing an ANSI environment, we could
prepend underscores to all the internal functions and be done with it;
but we also have to provide the traditional UN*X API.

This is typically done by using "weak symbols".  These instruct the
linker "a" is also known as "b" unless "b" has already been defined.
On systems without this linker magic, jmp or wrapper functions are
used.

Unfortunately, we don't have weak symbols --- we have indirect
symbols.  The major difference is that indirect symbols can not live
in the same files as the real definition.

Support for real weak symbols has been added to the a.out backends in
newer versions of GNU ld and gas.  I don't know how difficult it would
be to merge into NetBSD.  There has also been preliminary talk of
moving NetBSD to a more modern file executable and object file format,
but nothing is likely to come of that for some time.

Given the current state of NetBSD, I guess the only way to implement a
ANSI clean namespace is to add lots of stub files that define indirect
symbols.  

My question is should the function, lets use isinf() for this example,
be renamed _isinf() and stay in isinf.c, while the indirect symbol
mapping is put in _isinf.c.  Or should isinf.c be moved to _isinf.c,
isinf() renamed to _isinf(), and the indirect symbol mapping put in
isinf.c; with the second, the filenames match the functions inside
them.  Or does anyone have any better sugesstions?

	--jtc