using different library symbols for different ABI

Vincent Lefevre vincent at vinc17.org
Sat May 30 10:58:36 CEST 2009


GMP can be built with different ABI's. While there are no problems
if the ABI's correspond to different ISA's (this is always the
case on x86_64) because the system linker will refuse to mix
different ISA's, errors are possible when GMP changes only the
type of a limb, e.g. between ABI=mode32 and ABI=32 on PowerPC 64.

So, if a user builds GMP with ABI=mode32, then builds some
applications (using dynamic linking to GMP), then upgrades GMP
with ABI=32, the applications will still be allowed to be run,
but may return incorrect results.

To avoid such problems, I wonder whether GMP should use a different
prefix for its library symbols (i.e. what is seen in the object
files). It currently always uses __gmp. I suggest that it use __gmp64
in ABI=mode32 (to say that the limbs are on 64 bits, instead of the
usual 32 bits). This means that if the user rebuilds GMP with a
different ABI (e.g. mode32 -> 32) but not the applications, there
will be a clear dynamic linking failure instead of incorrect results.

-- 
Vincent Lefèvre <vincent at vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


More information about the gmp-discuss mailing list