This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: -fvisibility=hidden vs. extern "C"
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Cc: jason at redhat dot com, libstdc++ at gcc dot gnu dot org
- Date: Fri, 21 Jul 2006 02:42:53 -0400
- Subject: Re: -fvisibility=hidden vs. extern "C"
- References: <20060721010103.21c79138.bkoz@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Jul 21, 2006 at 01:01:03AM -0500, Benjamin Kosnik wrote:
>
>
> Hey. Tracking down the -fvisibility=hidden failure mode for
> __gxx_personality_v0, I add the attributes to this function, but it appears to be ignored.
Um, building libstdc++ with -fvisibility=hidden doesn't make sense,
you specifically want to export the vast majority of stuff in it.
In the eh_personality.ii you posted with -fvisibility the prototype
of __gxx_personality_v0 is marked with default visibility (as it is
surrounded by #pragma GCC visibility {push(default), pop} pair),
but the actual definition is not marked in any way. As it is a definition,
-fvisibility=hidden causes its visibility to be specified to hidden,
and as hidden is stronger visibility than default, hidden wins.
If you put a #pragma GCC visibility {push(default), pop} also
around the body of eh_personality.cc rather than just headers, the
function will have default visibility even with -fvisibility=hidden.
But, you'd need to mark the vast majority of libstdc++ code that way.
For libstdc++, it is far better to see what symbols you do not want
to export and force hidden visibility on those (or anon namespace).
Jakub