This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -fvisibility=hidden vs. extern "C"


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]