This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Add -fsystem-header-visibility=
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Geoffrey Keating <geoffk at geoffk dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 26 Aug 2005 13:47:45 -0700
- Subject: Re: PATCH: Add -fsystem-header-visibility=
- References: <20050824212710.GA6163@lucon.org> <m2irxssair.fsf@greed.local>
On Fri, Aug 26, 2005 at 01:34:04PM -0700, Geoffrey Keating wrote:
> "H. J. Lu" <hjl@lucon.org> writes:
>
> > The current visibility scheme doesn't work too well with symbols from
> > system headers. In most cases, symbols from system headers are defined
> > in libraries which always have default visibility. But when
> > -fvisibililty= or "#pragma GCC visibililty push" is used, symbols from
> > system headers may have non-default visibility. This leads to link-time
> > or run-time problems. This patch adds -fsystem-header-visibility=. It
> > can be used to set the symbols from system headers with different
> > visibility.
>
> I think this would be better dealt with in another way, for instance
> by changing the headers in question. Otherwise I see that this is the
> first in a long line of patches which end up with command-line options
> to control visibility for everything individually.
It is impractical to change all those header files come with all
libraries. The only other approach is to require
#pragma GCC visibililty push(default)
#pragma GCC visibililty pop
when a library header file is included. That brings to
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20303
since you can't use more than 16 nested pushes with gcc 4.0.
>
> (In particular, I don't see why 'system' headers should be treated
> specially.)
Does -flibrary-visibility sound better? Some C++ symbols don't come
from header files. They are generated by gcc automatically.
H.J.