Whether the behaviour is intuitive really depends upon what you are
trying to do. For example, there are debugging malloc libraries which
work by setting LD_PRELOAD to point to the malloc library. That kind
of thing would fail if libc.so were linked with -symbolic. Sometimes
you want calls to always be local, sometimes you want to permit other
symbols to be interposed. Explicit symbol visibility lets you choose.
You can specify symbol visibility either in the source code or in a
linker script.
I have a function defined in a shared library which is exported. I also
call the function from within the shared library. I am having the issue
where, when linked from a certain executable, the calls originating
within the shared library are calling some other function, defined
elsewhere. It sounds like -symbolic is what I want.
However, when I try to link with -symbolic, I get this
gcc: unrecognized option '-symbolic'
I realize from the documentation, that -symbolic is not supported on all
platforms. Could you briefly explain, or point out some documentation
explaining how to achieve the same effect as -symbolic using a linker
script?
thanks
-Todd