On 26/08/2005, at 1:47 PM, H. J. Lu wrote:
On Fri, Aug 26, 2005 at 01:34:04PM -0700, Geoffrey Keating wrote:
"H. J. Lu" <hjl@xxxxxxxxx> writes:
The current visibility scheme doesn't work too well with symbols
system headers. In most cases, symbols from system headers are
in libraries which always have default visibility. But when
-fvisibililty= or "#pragma GCC visibililty push" is used, symbols
system headers may have non-default visibility. This leads to
or run-time problems. This patch adds -fsystem-header-
can be used to set the symbols from system headers with different
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
first in a long line of patches which end up with command-line
to control visibility for everything individually.
It is impractical to change all those header files come with all
Really? I mean, it's not like 'system headers which define symbols
and require those symbols to be visible' is an unknowably large set.
On most of the platforms on which GCC runs, that's limited to libstdc+
+, and not all of libstdc++. On Linux, the set is larger, but it's
not infinitely large, and you have the source available.
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
You don't have to do that, you can use __attribute__ instead. But...
since you can't use more than 16 nested pushes with gcc 4.0.
I agree that's a problem, but you should fix that problem rather than
trying to find a workaround.
Isn't that bug fixed? The bugzilla has some patches in it...
(In particular, I don't see why 'system' headers should be treated
Does -flibrary-visibility sound better? Some C++ symbols don't come
from header files. They are generated by gcc automatically.
See, this is the other problem with doing things specially based on
system header or not system header. How can you tell if something is
a 'library' or not?
We've had lots of problems like this before when we tried to do
things based on system header-ness. Look at the problems we had with