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.
Our use of weak symbols in libc is incomplete. Although syscalls like
read() have _read() as the strong symbol and read() as the weak one,
we continue to call read() in other areas of libc. This means that
a user can create their own read() function and they won't get a clash
when they link against libc, but other functions in libc that really
want to call the _read() syscall will call the user's read() function
instead. That's broken. We really need to change libc in the way that
NetBSD did with their namespace.h stuff. This ensures that the internals
of libc call the hidden names, not the weakly exported ones.