[Xfce4-commits] <xfce4-dev-tools:master> Don't set the default visibility in XDT_FEATURE_VISIBILITY.

Brian J. Tarricone brian at tarricone.org
Fri Oct 23 01:38:23 CEST 2009


On Thu, Oct 22, 2009 at 15:10, Jannis Pohlmann <jannis at xfce.org> wrote:
>
> I'm thinking back and forth here... Nick's concern about
> -fvisibility=hidden is that exo needs HAVE_GNUC_VISIBILITY for the
> alias generation but exo's .symbols file has a few exceptions (e.g.
> exo_atomic_{inc,dec}) which are not declared visible when
> -fvisiblity=hidden is passed to the compiler. In consequence they don't
> show up in the .so file even though they would (without -fvisib...)
> because they'd not be hidden and would pass -export-regex-symbols as
> well. So there are expections where the alias stuff is used but
> -fvisibility=hidden is not desired.

I don't think I quite understand.  Why are the atomic ops not declared
visible with -fvisibility=hidden?

> Soo, for the entire afternoon I was thinking, yeah, let's drop
> -fvisibility=hidden from XDT_FEATURE_VISIBILITY(). However, without it
> XDT_FEATURE_VISIBILITY() doesn't do much anymore. I think it's all
> about how it is interpreted. If the entire point of
> XDT_FEATURE_VISIBILITY() is seen in hiding all symbols if possible,
> then yes, -fvisibility=hidden has to go back in.

Well, yes.  Personally I'm not too concerned with all the hand-wavy
PLT performance stuff, so, to me, the primary purpose of this exercise
is to only export symbols that are intended to be in the public API.
There are a few nice linking related performance gains involved in
doing only that, but those are incidental as far as I'm concerned.

Now, on top of that, we do the aliasing stuff, which requires
visibility support to work (but does not require the default
-fvisibility=hidden).  The idea is that we declare an alias to each
public symbol (prefix the name with "IA__"), and declare the
visibility of the alias as hidden.  Then (only for internal use in the
library's .c files) we #define the real symbol name to the prefixed
alias name.  This way, library-internal use of the public API doesn't
have to go through a couple redirections to "find" the functions.
Sure, that's nice to do, but it's debatable how much it actually buys
you, since it really depends on the library and whether or not it
needs to often (or rather, in potentially critical paths) call its own
API.

> I can also see how we could make it useful and more flexible by adding
> a parameter to it (e.g. a compiler flag variable), like you suggested
> on bugzilla.xfce.org. For aliasing, libraries need HAVE_GNUC_VISIBILITY
> but they may or may not want -fvisibility=hidden.

Right, that's a reasonable change that keeps the current default but
makes it flexible enough for other use.

     -brian



More information about the Xfce4-dev mailing list