binary compatibility

Paolo Bonzini bonzini at gnu.org
Fri Jan 8 18:11:39 CET 2010


On 01/08/2010 05:33 PM, Torbjorn Granlund wrote:
> Paolo Bonzini<bonzini at gnu.org>  writes:
>
>    I also noticed that GMP 5 is using an interface "age" of 6.  This is
>    wrong since interface 9 is not backwards compatible with interface
>    8. The fact that mpn_bdivmod was documented as mutable does not
>    matter: distributions will want to provide libgmp.so.3 and libgmp.so.9
>    for a while, and this is not possible if GMP 5 says it is binary
>    compatible with 4.3.2.
>
>    I suggest that the attached patch is applied before distributions
>    start to complain.
>
> We consider mpn_bdivmod is not part of the official API of any GMP
> release.  Therefore, we did not zero age.  This was a deliberate
> decision.

It doesn't matter, for various reasons:

1) Since you are not hiding symbols using things such as libtool's 
--export-symbols or ELF visibilities, libgmp.so exports all internal 
functions.  So, one could say that the ABI includes all the internal 
functions and that AGE should be zeroed even if you remove an internal 
function!

To avoid similar pitfalls, I suggest that you start using 
--export-symbols or ELF visibilities to hide symbols that you do not 
want to publish (and zero the age in the process).

2) you made a conscious decision to break the API, and that's fine---I 
have no problem with programs that do not compile anymore because they 
used mpn_bdivmod, they should have expected it.  However, the age field 
is about not breaking the ABI, and this is a more mechanical fact.  Your 
decision not to reset the age means that there is no way to keep 
existing programs that use mpn_bdivmod while installing new programs 
that will use new interfaces introduced in GMP 5.  Another way to say 
this is, "installing GMP 5 may break existing binaries on the system, so 
the age should be reset".

3) the function was while documented to change in the future, however it 
was also documented to be there for now.  I think that you are setting 
too high a price for having used an unstable but documented interface. 
Maybe the mistake was to document mpn_bdivmod in the first place, but 
now you have to live with it.

4) distributions _will_ notice the problem since they have automated 
tools to detect ABI breakage.  They may decide to waive it, or they 
could fix the problem by resetting the age themselves or by adding back 
mpn_bdivmod.  In any case, it's best to fix the problem upstream.

Paolo


More information about the gmp-discuss mailing list