Symbol hiding and unit tests

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Fri Jul 3 03:22:52 UTC 2015


Ciao,

Il Dom, 21 Giugno 2015 10:12 pm, Torbjörn Granlund ha scritto:
> I am finally doing something about hiding internal GMP symbols for
> the shared gmplib.{so,lib,dll}.

Great!

> The good effects of this are:
> 1. The symbols cannot be reached from outside of the shared lib.
> 2. The internal references are resolved at library creation time instead
>    of at application startup time
> 3. The internal references do not need an indirection (via a PLT in the
>    case of functions, or a GOT in the case of data).

> An undesirable effect is that our unit tests can no longer reach
> __gmpn_toom22_mul of the shared library.  It can still reach it in
> the static library (as symbol hiding has no meaning there).

> If we don't want to do that, we need to provide a "backdoor" to the
> internal functions.  We could then provide an alias (using
> __attribute__((alias(...)))).  This, of course, re-enables user code's
> access to the same internals.  The other benefit (points 2 and 3) remain.

I believe benefits 2 and 3 are important. If it's not too much
complicated, I'd prefer to see this "alias" approach first, for the
functions that we are actually testing. Hiding "most" of the internal
functions is a good goal.
What about tune/speed and tune/tuneup?

-- 
http://bodrato.it/






More information about the gmp-devel mailing list