This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Symbol visibility question
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>
- Date: Mon, 5 Nov 2012 22:37:08 +0100
- Subject: Re: Symbol visibility question
- References: <50982D9A.9010802@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Nov 05, 2012 at 02:20:26PM -0700, Jeff Law wrote:
> Per Roland's suggestion here:
>
> http://sourceware.org/ml/libc-alpha/2012-06/msg00207.html
>
> I need to create a trivial little function that svc_{tcp,udp,unix}
> can use for failures. Let's call it __svc_accept_failed.
>
> That function needs to be visible to the svc_{tcp,udp,unix}.c files,
> but must not be visible outside glibc or sunrpc.
If it is only for use within a single library (say libc.so.6), and
you don't need to export it, then just put attribute_hidden to its
prototype.
*hidden_proto/*hidden_def/*hidden_ver macros are for the case where you
want some symbol to act as improved protected visibility (normal protected
visibility is expensive, because of function pointer comparison guarantees).
Functions with *hidden_proto macro used after the prototype and *hidden_def
(resp. *hidden_ver after the definition) are both exported and have a hidden
alias, where uses within the same library are bound to the hidden alias.
If you need a function defined in one library used from another library, but
don't want to make it a public API, just use GLIBC_PRIVATE symbol version
for it.
Jakub