Build installs different "gmp.h" for 32- and 64-bit ABI's.

Andreev Konstantin andreev at swemel.ru
Tue Jun 23 13:38:47 CEST 2009


Hello.

Here is a difference between "gmp.h" for 32- and 64-bit builds:

---( begin cite )-------------------------------------
[andreev at jabba gcc]$ gdiff -ubB iroot*/usr/include/*
--- iroot32/usr/include/gmp.h	2009-06-23 14:29:31.518886232 +0400
+++ iroot64/usr/include/gmp.h	2009-06-23 13:04:46.167900018 +0400
@@ -28,10 +28,10 @@
 
 /* Instantiated by configure. */
 #if ! defined (__GMP_WITHIN_CONFIGURE)
-#define __GMP_BITS_PER_MP_LIMB             32
+#define __GMP_BITS_PER_MP_LIMB             64
 #define __GMP_HAVE_HOST_CPU_FAMILY_power   0
 #define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0
-#define GMP_LIMB_BITS                      32
+#define GMP_LIMB_BITS                      64
 #define GMP_NAIL_BITS                      0
 #endif
 #define GMP_NUMB_BITS     (GMP_LIMB_BITS - GMP_NAIL_BITS)
@@ -2210,7 +2210,7 @@
 
 /* Define CC and CFLAGS which were used to build this version of GMP */
 #define __GMP_CC "cc"
-#define __GMP_CFLAGS "-O"
+#define __GMP_CFLAGS "-xO3 -m64"
---( end cite )-------------------------------------

Here is a rationales:

1) some software depends from affected symbols (__GMP_BITS_PER_MP_LIMB, GMP_LIMB_BITS).
2) on most 64-bit platforms 32-bit applications co-exist in parallel:
   - linux, solaris on x86_64 runs i386 applications
   - solaris on sparcv9 runs sparcv8 applications
   - ...

So, which "gmp.h" should be installed in /usr/include/gmp.h on a platform where 32- and 64-bit applications co-exist ?

It's hardly possible to manage two separate copies of "gmp.h": sooner or later you will misconfigure dependend package with incorrect "gmp.h". Distro vendors works around this problem. For example, Sun Microsystems delivers the following "gmp.h":

---( begin cite )-------------------------------------
/* Instantiated by configure. */
#if ! defined (__GMP_WITHIN_CONFIGURE)
#if defined(__amd64) || defined(__sparcv9)
#define __GMP_BITS_PER_MP_LIMB 64
#else
#define __GMP_BITS_PER_MP_LIMB 32
#endif
#define __GMP_HAVE_HOST_CPU_FAMILY_power   0
#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0
#if defined(__amd64) || defined(__sparcv9)
#define GMP_LIMB_BITS 64
#else
#define GMP_LIMB_BITS 32
#endif
#define GMP_NAIL_BITS                      0
#endif
---( end cite )-------------------------------------

I suppose, gmp should deliver unified "gmp.h" for all "instructions sets" of "target platform" out-of-the-box.

Best regards,
--
Konstantin Andreev.



More information about the gmp-bugs mailing list