This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Symbols in .so even when using fvisibility=hidden
Ian Lance Taylor wrote:
[..]
> Thanks for the test case. I see what is happening. Your class and
> its functions are hidden. What is not hidden is the standard library
> template functions which your code instantiates.
>
> Template instantations are a tricky case for visibility. It's
> possible to pass template objects from one shared library to another,
> so the instantiations all have to be compatible. And they aren't
> symbols that you are defining yourself, so it's not clear whether
> -fvisibility=hidden should apply to them. So I don't know what the
> right behaviour is here.
>
> To really get what you want--to hide all the symbols, even the
> implicit template instantiations--you will need to pass a version
> script to the linker. You may also want to consider
> -fno-implicit-templates and -fno-implicit-inline-templates, although
> then you will have to ensure that some other object instantiates the
> required templates.
Thanks. I just saw that someone else already done that with ld's -version-
script
--
Robert Wohlrab