Rethinking GMP's configure

Niels Möller nisse at lysator.liu.se
Tue Dec 6 10:39:01 CET 2011


Torbjorn Granlund <tg at gmplib.org> writes:

> But there are some requirements from the C standard that gets into the
> way of sense here.  It is for example required that foo == bar holds if
> foo and bar are some combination of pointers or symbol names that end up
> at the same function when called.

This may get in the way, but that should not be a real problem. An
exported function like mpn_add_n should point to a wrapper which jumps
via a table. User code should never see any pointer to the internal
functions which are pointed to in that table.

So __gmpn_add_n is ELF "default", while __gmpn_bobcat_add_n (or whatever
the symbol name is) can be ELF "hidden".

Then it's even better if internal calls to mpn_add_n are macros which
jump directly via the table, and not to the mpn_add_n wrapper function.
One could also use ELF "protected" for the wrapper function, but I think
I read that Ian didn't recommended not using "protected", iirc, because
of pointer comparison complications which aren't handled efficiently by
the current ld.so.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list