From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16827 invoked by alias); 30 Jan 2004 20:51:22 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 16774 invoked by uid 48); 30 Jan 2004 20:51:21 -0000 Date: Fri, 30 Jan 2004 20:51:00 -0000 Message-ID: <20040130205121.16769.qmail@sources.redhat.com> From: "s_gccbugzilla at nedprod dot com" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20030112104600.9283.mueller@kde.org> References: <20030112104600.9283.mueller@kde.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/9283] __attribute__((visibility ("hidden"))) not supported for class/struct X-Bugzilla-Reason: CC X-SW-Source: 2004-01/txt/msg03920.txt.bz2 List-Id: ------- Additional Comments From s_gccbugzilla at nedprod dot com 2004-01-30 20:51 ------- >>From bug #13905 which I posted I'd like to add the following: This idea of Dirk's is good but I think he's coming at it the wrong way. Instead of labouriously specifying things as hidden individually and hoping to not forget any, the *default* should be hidden and you specify things as exported individually - here if you forget you get a link error. Not uncoincidentally, I'm wishing to leverage the same semantics as Windows so that the macros commonly used on cross-platform applications merely need to be redefined from __declspec(dllexport) to __attribute__ ((visibility("export")) and no further code changes are required. To allow this to happen, GCC would need an extra command line option to set the default visibility of all symbols: -fvisibility=external -fvisibility=default -fvisibility=protected -fvisibility=hidden -fvisibility=internal These are chosen for compatibility with Intel's C++ compiler which already offers the ability to mark all symbols as default non-exported in ELF output. Why this approach is better than Dirk's: much cleaner ELF images output. Faster dynamic linking times as less symbols are exported. Much 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 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9283