[Bug c++/13905] Use of __attribute__ ((visibility("X"))) in class and struct declarations

s_gccbugzilla at nedprod dot com gcc-bugzilla@gcc.gnu.org
Wed Jan 28 23:52:00 GMT 2004


------- Additional Comments From s_gccbugzilla at nedprod dot com  2004-01-28 23:52 -------
(In reply to comment #6)
> But every thing is default to export, sorry try again.

I had actually thought there was already a -fvisibility command line option in 
GCC, but I was wrong. Ok to restate (this time clearly):

1. Addition of:

-fvisibility=external
-fvisibility=default
-fvisibility=protected
-fvisibility=hidden
-fvisibility=internal

... to available command line options in GCC. These are chosen for compatibility 
with Intel's C++ compiler. When specified, the default attribute for all symbols 
is whichever.

2. Addition of being able to specify __attribute__ ((visibility("X"))) in class 
and struct declarations where X is one of:

external, default, protected, hidden, internal.

Now you can specify -fvisibility=hidden to GCC. All symbols will by default be 
hidden in the ELF export table unless the code manually specifies __attribute__ 
((visibility("export"))).

The result: much cleaner ELF images output. Faster dynamic linking times. More 
scope for GCC to optimise object files as it now knows what RTTI info it can 
discard as well as improved COMDAT folding etc.

I in particular suffer from this as GCC generates binaries nearly twice as big 
than MSVC for identical code :( (I think it's the RTTI info for all the 
templates plus not being able to COMDAT fold most of the symbols)

References: http://people.redhat.com/drepper/dsohowto.pdf

Cheers,
Niall


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13905



More information about the Gcc-bugs mailing list