I am using gcc version 4.3.3 for x86
-Wl,-Bsymbolic looks like it does what I want.
Be very, very careful. -Bsymbolic violates the C standard, and all
manner of very weird things can happen to your program. One symptom
is that data in a shared library that is written by an executable
fails mysteriously to be there when read by the library. This is
because you end up with two copies of the data, one in the shared
library and one in the executable, even though the data is only
defined once in the library. It is possible to solve most of these
problems by compiling the executable as PIC.
Andrew.