[PATCH 15/20] Convert the mpn/generic subdirectory to __GMP_*_DEFINE and include changes

Richard Henderson rth at twiddle.net
Mon Mar 4 19:41:45 CET 2013


---
 mpn/generic/add.c                          |  4 ++--
 mpn/generic/add_1.c                        |  4 ++--
 mpn/generic/add_err1_n.c                   |  2 +-
 mpn/generic/add_err2_n.c                   |  2 +-
 mpn/generic/add_err3_n.c                   |  2 +-
 mpn/generic/add_n.c                        |  3 ++-
 mpn/generic/add_n_sub_n.c                  |  2 +-
 mpn/generic/addcnd_n.c                     |  2 +-
 mpn/generic/addmul_1.c                     |  4 ++--
 mpn/generic/bdiv_dbm1c.c                   |  3 +--
 mpn/generic/bdiv_q.c                       |  2 +-
 mpn/generic/bdiv_q_1.c                     |  4 ++--
 mpn/generic/bdiv_qr.c                      |  3 ++-
 mpn/generic/binvert.c                      |  3 ++-
 mpn/generic/broot.c                        |  3 ++-
 mpn/generic/brootinv.c                     |  2 +-
 mpn/generic/bsqrt.c                        |  2 +-
 mpn/generic/bsqrtinv.c                     |  2 +-
 mpn/generic/cmp.c                          |  4 ++--
 mpn/generic/com.c                          |  3 +--
 mpn/generic/comb_tables.c                  |  5 ++++-
 mpn/generic/copyd.c                        |  2 +-
 mpn/generic/copyi.c                        |  2 +-
 mpn/generic/dcpi1_bdiv_q.c                 |  4 +++-
 mpn/generic/dcpi1_bdiv_qr.c                |  4 +++-
 mpn/generic/dcpi1_div_q.c                  |  4 ++--
 mpn/generic/dcpi1_div_qr.c                 |  4 ++--
 mpn/generic/dcpi1_divappr_q.c              |  4 ++--
 mpn/generic/div_q.c                        |  3 +--
 mpn/generic/div_qr_2.c                     |  3 +--
 mpn/generic/div_qr_2n_pi1.c                |  3 +--
 mpn/generic/div_qr_2u_pi1.c                |  3 +--
 mpn/generic/dive_1.c                       |  3 +--
 mpn/generic/diveby3.c                      |  3 ++-
 mpn/generic/divexact.c                     |  4 ++--
 mpn/generic/divis.c                        |  3 +--
 mpn/generic/divrem.c                       |  3 +--
 mpn/generic/divrem_1.c                     |  3 +--
 mpn/generic/divrem_2.c                     |  3 +--
 mpn/generic/dump.c                         |  4 ++--
 mpn/generic/fib2_ui.c                      |  3 +--
 mpn/generic/gcd.c                          |  3 +--
 mpn/generic/gcd_1.c                        |  3 +--
 mpn/generic/gcd_subdiv_step.c              |  5 +----
 mpn/generic/gcdext.c                       |  3 +--
 mpn/generic/gcdext_1.c                     |  4 ++--
 mpn/generic/gcdext_lehmer.c                |  4 ++--
 mpn/generic/get_d.c                        |  3 +--
 mpn/generic/get_str.c                      |  3 +--
 mpn/generic/hgcd.c                         |  4 ++--
 mpn/generic/hgcd2.c                        |  4 ++--
 mpn/generic/hgcd2_jacobi.c                 |  3 +--
 mpn/generic/hgcd_appr.c                    |  4 ++--
 mpn/generic/hgcd_jacobi.c                  |  3 +--
 mpn/generic/hgcd_matrix.c                  |  7 +++++--
 mpn/generic/hgcd_reduce.c                  |  4 ++--
 mpn/generic/hgcd_step.c                    |  3 +--
 mpn/generic/invert.c                       |  3 +--
 mpn/generic/invertappr.c                   |  6 ++----
 mpn/generic/jacbase.c                      |  4 ++--
 mpn/generic/jacobi.c                       |  4 ++--
 mpn/generic/jacobi_2.c                     |  4 ++--
 mpn/generic/logops_n.c                     | 30 +++++++++++-------------------
 mpn/generic/lshift.c                       |  2 +-
 mpn/generic/lshiftc.c                      |  2 +-
 mpn/generic/matrix22_mul.c                 |  5 +++--
 mpn/generic/matrix22_mul1_inverse_vector.c |  3 +--
 mpn/generic/mod_1.c                        |  3 +--
 mpn/generic/mod_1_1.c                      |  5 +++--
 mpn/generic/mod_1_2.c                      |  4 ++--
 mpn/generic/mod_1_3.c                      |  4 ++--
 mpn/generic/mod_1_4.c                      |  4 ++--
 mpn/generic/mod_34lsub1.c                  |  2 +-
 mpn/generic/mode1o.c                       |  4 ++--
 mpn/generic/mu_bdiv_q.c                    |  3 ++-
 mpn/generic/mu_bdiv_qr.c                   |  3 ++-
 mpn/generic/mu_div_q.c                     |  4 ++--
 mpn/generic/mu_div_qr.c                    |  7 +++++--
 mpn/generic/mu_divappr_q.c                 |  6 ++++--
 mpn/generic/mul.c                          |  2 +-
 mpn/generic/mul_1.c                        |  4 ++--
 mpn/generic/mul_basecase.c                 |  2 +-
 mpn/generic/mul_fft.c                      |  6 +++++-
 mpn/generic/mul_n.c                        |  3 +--
 mpn/generic/mullo_basecase.c               |  2 +-
 mpn/generic/mullo_n.c                      |  2 +-
 mpn/generic/mulmid.c                       |  2 +-
 mpn/generic/mulmid_basecase.c              |  3 +--
 mpn/generic/mulmid_n.c                     |  2 +-
 mpn/generic/mulmod_bnm1.c                  |  5 +++--
 mpn/generic/neg.c                          |  4 ++--
 mpn/generic/nussbaumer_mul.c               |  2 +-
 mpn/generic/perfpow.c                      |  3 +--
 mpn/generic/perfsqr.c                      |  5 +----
 mpn/generic/popham.c                       |  2 +-
 mpn/generic/pow_1.c                        |  3 +--
 mpn/generic/powlo.c                        |  3 +--
 mpn/generic/powm.c                         |  3 +--
 mpn/generic/powm_sec.c                     |  4 ++--
 mpn/generic/pre_divrem_1.c                 |  3 +--
 mpn/generic/pre_mod_1.c                    |  3 +--
 mpn/generic/random.c                       |  2 +-
 mpn/generic/random2.c                      |  2 +-
 mpn/generic/redc_1.c                       |  2 +-
 mpn/generic/redc_2.c                       |  5 +++--
 mpn/generic/redc_n.c                       |  2 +-
 mpn/generic/remove.c                       |  2 +-
 mpn/generic/rootrem.c                      |  5 +----
 mpn/generic/rshift.c                       |  2 +-
 mpn/generic/sb_div_sec.c                   |  3 +--
 mpn/generic/sbpi1_bdiv_q.c                 |  2 +-
 mpn/generic/sbpi1_bdiv_qr.c                |  2 +-
 mpn/generic/sbpi1_div_q.c                  |  3 +--
 mpn/generic/sbpi1_div_qr.c                 |  3 +--
 mpn/generic/sbpi1_div_sec.c                |  3 +--
 mpn/generic/sbpi1_divappr_q.c              |  3 +--
 mpn/generic/scan0.c                        |  3 +--
 mpn/generic/scan1.c                        |  3 +--
 mpn/generic/set_str.c                      |  6 ++++--
 mpn/generic/sqr.c                          |  3 +--
 mpn/generic/sqr_basecase.c                 |  4 ++--
 mpn/generic/sqrmod_bnm1.c                  |  4 ++--
 mpn/generic/sqrtrem.c                      |  7 +------
 mpn/generic/sub.c                          |  4 ++--
 mpn/generic/sub_1.c                        |  4 ++--
 mpn/generic/sub_err1_n.c                   |  2 +-
 mpn/generic/sub_err2_n.c                   |  2 +-
 mpn/generic/sub_err3_n.c                   |  2 +-
 mpn/generic/sub_n.c                        |  3 ++-
 mpn/generic/subcnd_n.c                     |  2 +-
 mpn/generic/submul_1.c                     |  4 ++--
 mpn/generic/tabselect.c                    |  2 +-
 mpn/generic/tdiv_qr.c                      |  3 +--
 mpn/generic/toom22_mul.c                   |  2 +-
 mpn/generic/toom2_sqr.c                    |  2 +-
 mpn/generic/toom32_mul.c                   |  2 +-
 mpn/generic/toom33_mul.c                   |  2 +-
 mpn/generic/toom3_sqr.c                    |  2 +-
 mpn/generic/toom42_mul.c                   |  2 +-
 mpn/generic/toom42_mulmid.c                |  2 +-
 mpn/generic/toom43_mul.c                   |  2 +-
 mpn/generic/toom44_mul.c                   |  2 +-
 mpn/generic/toom4_sqr.c                    |  2 +-
 mpn/generic/toom52_mul.c                   |  2 +-
 mpn/generic/toom53_mul.c                   |  2 +-
 mpn/generic/toom54_mul.c                   |  2 +-
 mpn/generic/toom62_mul.c                   |  2 +-
 mpn/generic/toom63_mul.c                   |  2 +-
 mpn/generic/toom6_sqr.c                    |  2 +-
 mpn/generic/toom6h_mul.c                   |  3 ++-
 mpn/generic/toom8_sqr.c                    |  3 ++-
 mpn/generic/toom8h_mul.c                   |  3 ++-
 mpn/generic/toom_couple_handling.c         |  2 +-
 mpn/generic/toom_eval_dgr3_pm1.c           |  2 +-
 mpn/generic/toom_eval_dgr3_pm2.c           |  2 +-
 mpn/generic/toom_eval_pm1.c                |  2 +-
 mpn/generic/toom_eval_pm2.c                |  2 +-
 mpn/generic/toom_eval_pm2exp.c             |  2 +-
 mpn/generic/toom_eval_pm2rexp.c            |  2 +-
 mpn/generic/toom_interpolate_12pts.c       |  2 +-
 mpn/generic/toom_interpolate_16pts.c       |  2 +-
 mpn/generic/toom_interpolate_5pts.c        |  2 +-
 mpn/generic/toom_interpolate_6pts.c        |  2 +-
 mpn/generic/toom_interpolate_7pts.c        |  2 +-
 mpn/generic/toom_interpolate_8pts.c        |  2 +-
 mpn/generic/trialdiv.c                     |  2 +-
 mpn/generic/udiv_w_sdiv.c                  |  4 ++--
 mpn/generic/zero.c                         |  2 +-
 168 files changed, 256 insertions(+), 284 deletions(-)

diff --git a/mpn/generic/add.c b/mpn/generic/add.c
index 8065ccf..1e8cfef 100644
--- a/mpn/generic/add.c
+++ b/mpn/generic/add.c
@@ -18,6 +18,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 #define __GMP_FORCE_mpn_add 1
-
-#include "gmp.h"
 #include "gmp-impl.h"
+
+__GMP_PUBLIC_DEFINE (mpn_add)
diff --git a/mpn/generic/add_1.c b/mpn/generic/add_1.c
index 2d3fa76..58554e8 100644
--- a/mpn/generic/add_1.c
+++ b/mpn/generic/add_1.c
@@ -18,6 +18,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 #define __GMP_FORCE_mpn_add_1 1
-
-#include "gmp.h"
 #include "gmp-impl.h"
+
+__GMP_PUBLIC_DEFINE (mpn_add_1)
diff --git a/mpn/generic/add_err1_n.c b/mpn/generic/add_err1_n.c
index 8ccba70..5080ed1 100644
--- a/mpn/generic/add_err1_n.c
+++ b/mpn/generic/add_err1_n.c
@@ -23,7 +23,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /*
@@ -88,3 +87,4 @@ mpn_add_err1_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
 
   return cy;
 }
+__GMP_INTERN_DEFINE (mpn_add_err1_n)
diff --git a/mpn/generic/add_err2_n.c b/mpn/generic/add_err2_n.c
index b5dfba7..03e2dae 100644
--- a/mpn/generic/add_err2_n.c
+++ b/mpn/generic/add_err2_n.c
@@ -23,7 +23,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /*
@@ -104,3 +103,4 @@ mpn_add_err2_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
 
   return cy;
 }
+__GMP_INTERN_DEFINE (mpn_add_err2_n)
diff --git a/mpn/generic/add_err3_n.c b/mpn/generic/add_err3_n.c
index 612b821..67ab8ab 100644
--- a/mpn/generic/add_err3_n.c
+++ b/mpn/generic/add_err3_n.c
@@ -23,7 +23,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /*
@@ -119,3 +118,4 @@ mpn_add_err3_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
 
   return cy;
 }
+__GMP_INTERN_DEFINE (mpn_add_err3_n)
diff --git a/mpn/generic/add_n.c b/mpn/generic/add_n.c
index 47b6df6..e52c04c 100644
--- a/mpn/generic/add_n.c
+++ b/mpn/generic/add_n.c
@@ -18,7 +18,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -78,3 +77,5 @@ mpn_add_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
 }
 
 #endif
+
+__GMP_PUBLIC_DEFINE (mpn_add_n)
diff --git a/mpn/generic/add_n_sub_n.c b/mpn/generic/add_n_sub_n.c
index 21437c6..c54b5a7 100644
--- a/mpn/generic/add_n_sub_n.c
+++ b/mpn/generic/add_n_sub_n.c
@@ -21,7 +21,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 #ifndef L1_CACHE_SIZE
@@ -125,6 +124,7 @@ mpn_add_n_sub_n (mp_ptr r1p, mp_ptr r2p, mp_srcptr s1p, mp_srcptr s2p, mp_size_t
 
   return 2 * acyo + scyo;
 }
+__GMP_INTERN_DEFINE (mpn_add_n_sub_n)
 
 #ifdef MAIN
 #include <stdlib.h>
diff --git a/mpn/generic/addcnd_n.c b/mpn/generic/addcnd_n.c
index 256cfbb..f7b11d4 100644
--- a/mpn/generic/addcnd_n.c
+++ b/mpn/generic/addcnd_n.c
@@ -24,7 +24,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 mp_limb_t
@@ -60,3 +59,4 @@ mpn_addcnd_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t cnd)
 
   return cy;
 }
+__GMP_INTERN_DEFINE (mpn_addcnd_n)
diff --git a/mpn/generic/addmul_1.c b/mpn/generic/addmul_1.c
index 861e1bc..c49e871 100644
--- a/mpn/generic/addmul_1.c
+++ b/mpn/generic/addmul_1.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 #if GMP_NAIL_BITS == 0
@@ -127,3 +125,5 @@ mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
 }
 
 #endif
+
+__GMP_PUBLIC_DEFINE (mpn_addmul_1)
diff --git a/mpn/generic/bdiv_dbm1c.c b/mpn/generic/bdiv_dbm1c.c
index 23cb6f1..d551698 100644
--- a/mpn/generic/bdiv_dbm1c.c
+++ b/mpn/generic/bdiv_dbm1c.c
@@ -22,9 +22,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 mp_limb_t
@@ -46,3 +44,4 @@ mpn_bdiv_dbm1c (mp_ptr qp, mp_srcptr ap, mp_size_t n, mp_limb_t bd, mp_limb_t h)
 
   return h;
 }
+__GMP_INTERN_DEFINE (mpn_bdiv_dbm1c)
diff --git a/mpn/generic/bdiv_q.c b/mpn/generic/bdiv_q.c
index 7cb62e8..09079aa 100644
--- a/mpn/generic/bdiv_q.c
+++ b/mpn/generic/bdiv_q.c
@@ -23,7 +23,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -55,6 +54,7 @@ mpn_bdiv_q (mp_ptr qp,
     }
   return;
 }
+__GMP_INTERN_DEFINE (mpn_bdiv_q)
 
 mp_size_t
 mpn_bdiv_q_itch (mp_size_t nn, mp_size_t dn)
diff --git a/mpn/generic/bdiv_q_1.c b/mpn/generic/bdiv_q_1.c
index 727f9f0..489bbe3 100644
--- a/mpn/generic/bdiv_q_1.c
+++ b/mpn/generic/bdiv_q_1.c
@@ -22,9 +22,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 mp_limb_t
 mpn_pi1_bdiv_q_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t d,
@@ -89,6 +87,7 @@ mpn_pi1_bdiv_q_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t d,
 
   return c;
 }
+__GMP_INTERN_DEFINE (mpn_pi1_bdiv_q_1)
 
 mp_limb_t
 mpn_bdiv_q_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t d)
@@ -113,3 +112,4 @@ mpn_bdiv_q_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t d)
   binvert_limb (di, d);
   return mpn_pi1_bdiv_q_1 (rp, up, n, d, di, shift);
 }
+__GMP_INTERN_DEFINE (mpn_bdiv_q_1)
diff --git a/mpn/generic/bdiv_qr.c b/mpn/generic/bdiv_qr.c
index 8bac03e..922b2b0 100644
--- a/mpn/generic/bdiv_qr.c
+++ b/mpn/generic/bdiv_qr.c
@@ -24,7 +24,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -63,6 +62,7 @@ mpn_bdiv_qr (mp_ptr qp, mp_ptr rp,
 
   return rh;
 }
+__GMP_INTERN_DEFINE (mpn_bdiv_qr)
 
 mp_size_t
 mpn_bdiv_qr_itch (mp_size_t nn, mp_size_t dn)
@@ -72,3 +72,4 @@ mpn_bdiv_qr_itch (mp_size_t nn, mp_size_t dn)
   else
     return  mpn_mu_bdiv_qr_itch (nn, dn);
 }
+__GMP_INTERN_DEFINE (mpn_bdiv_qr_itch)
diff --git a/mpn/generic/binvert.c b/mpn/generic/binvert.c
index 2ed91f3..f70374c 100644
--- a/mpn/generic/binvert.c
+++ b/mpn/generic/binvert.c
@@ -24,7 +24,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -48,6 +47,7 @@ mpn_binvert_itch (mp_size_t n)
   mp_size_t itch_out = mpn_mulmod_bnm1_itch (itch_local, n, (n + 1) >> 1);
   return itch_local + itch_out;
 }
+__GMP_INTERN_DEFINE (mpn_binvert_itch)
 
 void
 mpn_binvert (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_ptr scratch)
@@ -90,3 +90,4 @@ mpn_binvert (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_ptr scratch)
       mpn_neg (rp + rn, rp + rn, newrn - rn);
     }
 }
+__GMP_INTERN_DEFINE (mpn_binvert)
diff --git a/mpn/generic/broot.c b/mpn/generic/broot.c
index cc1a4c0..25cb28a 100644
--- a/mpn/generic/broot.c
+++ b/mpn/generic/broot.c
@@ -23,7 +23,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Computes a^e (mod B). Uses right-to-left binary algorithm, since
@@ -158,6 +157,7 @@ mpn_broot_invm1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t k)
     }
   TMP_FREE;
 }
+__GMP_INTERN_DEFINE (mpn_broot_invm1)
 
 /* Computes a^{1/k} (mod B^n). Both a and k must be odd. */
 void
@@ -184,3 +184,4 @@ mpn_broot (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t k)
 
   TMP_FREE;
 }
+__GMP_INTERN_DEFINE (mpn_broot)
diff --git a/mpn/generic/brootinv.c b/mpn/generic/brootinv.c
index a98cb8d..5dc26f6 100644
--- a/mpn/generic/brootinv.c
+++ b/mpn/generic/brootinv.c
@@ -19,7 +19,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Computes a^e (mod B). Uses right-to-left binary algorithm, since
@@ -127,3 +126,4 @@ mpn_brootinv (mp_ptr rp, mp_srcptr yp, mp_size_t bn, mp_limb_t k, mp_ptr tp)
       mpn_pi1_bdiv_q_1 (rp, tp2, bn, k, kinv, 0);
     }
 }
+__GMP_INTERN_DEFINE (mpn_brootinv)
diff --git a/mpn/generic/bsqrt.c b/mpn/generic/bsqrt.c
index a9f49e6..ad1b0b3 100644
--- a/mpn/generic/bsqrt.c
+++ b/mpn/generic/bsqrt.c
@@ -17,7 +17,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -35,3 +34,4 @@ mpn_bsqrt (mp_ptr rp, mp_srcptr ap, mp_bitcnt_t nb, mp_ptr tp)
   mpn_bsqrtinv (sp, ap, nb, tp);
   mpn_mullo_n (rp, sp, ap, n);
 }
+__GMP_INTERN_DEFINE (mpn_bsqrt)
diff --git a/mpn/generic/bsqrtinv.c b/mpn/generic/bsqrtinv.c
index 2dfd02b..cb3e0b8 100644
--- a/mpn/generic/bsqrtinv.c
+++ b/mpn/generic/bsqrtinv.c
@@ -19,7 +19,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Compute r such that r^2 * y = 1 (mod 2^{b+1}).
@@ -92,3 +91,4 @@ mpn_bsqrtinv (mp_ptr rp, mp_srcptr yp, mp_bitcnt_t bnb, mp_ptr tp)
     }
   return 1;
 }
+__GMP_INTERN_DEFINE (mpn_bsqrtinv)
diff --git a/mpn/generic/cmp.c b/mpn/generic/cmp.c
index d352076..9f3dc8f 100644
--- a/mpn/generic/cmp.c
+++ b/mpn/generic/cmp.c
@@ -18,6 +18,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 #define __GMP_FORCE_mpn_cmp 1
-
-#include "gmp.h"
 #include "gmp-impl.h"
+
+__GMP_PUBLIC_DEFINE (mpn_cmp)
diff --git a/mpn/generic/com.c b/mpn/generic/com.c
index ed817e6..bf642d8 100644
--- a/mpn/generic/com.c
+++ b/mpn/generic/com.c
@@ -17,11 +17,9 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 #undef mpn_com
-#define mpn_com __MPN(com)
 
 void
 mpn_com (mp_ptr rp, mp_srcptr up, mp_size_t n)
@@ -32,3 +30,4 @@ mpn_com (mp_ptr rp, mp_srcptr up, mp_size_t n)
       *rp++ = ~ul & GMP_NUMB_MASK;
   } while (--n != 0);
 }
+__GMP_PUBLIC_DEFINE (mpn_com)
diff --git a/mpn/generic/comb_tables.c b/mpn/generic/comb_tables.c
index de725d0..2c337db 100644
--- a/mpn/generic/comb_tables.c
+++ b/mpn/generic/comb_tables.c
@@ -20,7 +20,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Entry i contains (i!/2^t) where t is chosen such that the parenthesis
@@ -35,3 +34,7 @@ const mp_limb_t __gmp_odd2fac_table[] = { ONE_LIMB_ODD_DOUBLEFACTORIAL_TABLE };
 const unsigned char __gmp_fac2cnt_table[] = { TABLE_2N_MINUS_POPC_2N };
 
 const mp_limb_t __gmp_limbroots_table[] = { NTH_ROOT_NUMB_MASK_TABLE };
+
+__GMP_INTERN_DEFINE (__gmp_oddfac_table)
+__GMP_INTERN_DEFINE (__gmp_odd2fac_table)
+__GMP_INTERN_DEFINE (__gmp_fac2cnt_table)
diff --git a/mpn/generic/copyd.c b/mpn/generic/copyd.c
index 2a08ef4..0c89d55 100644
--- a/mpn/generic/copyd.c
+++ b/mpn/generic/copyd.c
@@ -17,7 +17,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 void
@@ -28,3 +27,4 @@ mpn_copyd (mp_ptr rp, mp_srcptr up, mp_size_t n)
   for (i = n - 1; i >= 0; i--)
     rp[i] = up[i];
 }
+__GMP_PUBLIC_DEFINE (mpn_copyd)
diff --git a/mpn/generic/copyi.c b/mpn/generic/copyi.c
index c0a047b..a0fa982 100644
--- a/mpn/generic/copyi.c
+++ b/mpn/generic/copyi.c
@@ -17,7 +17,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 void
@@ -30,3 +29,4 @@ mpn_copyi (mp_ptr rp, mp_srcptr up, mp_size_t n)
   for (i = -n; i != 0; i++)
     rp[i] = up[i];
 }
+__GMP_PUBLIC_DEFINE (mpn_copyi)
diff --git a/mpn/generic/dcpi1_bdiv_q.c b/mpn/generic/dcpi1_bdiv_q.c
index 2bc85ef..dc559c7 100644
--- a/mpn/generic/dcpi1_bdiv_q.c
+++ b/mpn/generic/dcpi1_bdiv_q.c
@@ -24,7 +24,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -34,6 +33,7 @@ mpn_dcpi1_bdiv_q_n_itch (mp_size_t n)
   /* NOTE: Depends on mullo_n interface */
   return n;
 }
+__GMP_INTERN_DEFINE (mpn_dcpi1_bdiv_q_n_itch)
 
 /* Computes Q = N / D mod B^n, destroys N.
 
@@ -70,6 +70,7 @@ mpn_dcpi1_bdiv_q_n (mp_ptr qp,
     }
   mpn_sbpi1_bdiv_q (qp, np, n, dp, n, dinv);
 }
+__GMP_INTERN_DEFINE (mpn_dcpi1_bdiv_q_n)
 
 /* Computes Q = N / D mod B^nn, destroys N.
 
@@ -147,3 +148,4 @@ mpn_dcpi1_bdiv_q (mp_ptr qp,
 
   TMP_FREE;
 }
+__GMP_INTERN_DEFINE (mpn_dcpi1_bdiv_q)
diff --git a/mpn/generic/dcpi1_bdiv_qr.c b/mpn/generic/dcpi1_bdiv_qr.c
index 28cc82e..d5dc87d 100644
--- a/mpn/generic/dcpi1_bdiv_qr.c
+++ b/mpn/generic/dcpi1_bdiv_qr.c
@@ -24,7 +24,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -46,6 +45,7 @@ mpn_dcpi1_bdiv_qr_n_itch (mp_size_t n)
 {
   return n;
 }
+__GMP_INTERN_DEFINE (mpn_dcpi1_bdiv_qr_n_itch)
 
 mp_limb_t
 mpn_dcpi1_bdiv_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
@@ -80,6 +80,7 @@ mpn_dcpi1_bdiv_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
 
   return rh;
 }
+__GMP_INTERN_DEFINE (mpn_dcpi1_bdiv_qr_n)
 
 mp_limb_t
 mpn_dcpi1_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn,
@@ -164,3 +165,4 @@ mpn_dcpi1_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn,
   TMP_FREE;
   return rr + cy;
 }
+__GMP_INTERN_DEFINE (mpn_dcpi1_bdiv_qr)
diff --git a/mpn/generic/dcpi1_div_q.c b/mpn/generic/dcpi1_div_q.c
index 9e5cea5..63b5f51 100644
--- a/mpn/generic/dcpi1_div_q.c
+++ b/mpn/generic/dcpi1_div_q.c
@@ -1,4 +1,4 @@
-/* mpn_dc_div_q -- divide-and-conquer division, returning exact quotient
+/* mpn_dcpi1_div_q -- divide-and-conquer division, returning exact quotient
    only.
 
    Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
@@ -24,7 +24,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -74,3 +73,4 @@ mpn_dcpi1_div_q (mp_ptr qp, mp_ptr np, mp_size_t nn,
   TMP_FREE;
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_dcpi1_div_q)
diff --git a/mpn/generic/dcpi1_div_qr.c b/mpn/generic/dcpi1_div_qr.c
index 815173e..529fed5 100644
--- a/mpn/generic/dcpi1_div_qr.c
+++ b/mpn/generic/dcpi1_div_qr.c
@@ -24,9 +24,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 mp_limb_t
@@ -75,6 +73,7 @@ mpn_dcpi1_div_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
 
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_dcpi1_div_qr_n)
 
 mp_limb_t
 mpn_dcpi1_div_qr (mp_ptr qp,
@@ -236,3 +235,4 @@ mpn_dcpi1_div_qr (mp_ptr qp,
   TMP_FREE;
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_dcpi1_div_qr)
diff --git a/mpn/generic/dcpi1_divappr_q.c b/mpn/generic/dcpi1_divappr_q.c
index a0f79ed..f7dda12 100644
--- a/mpn/generic/dcpi1_divappr_q.c
+++ b/mpn/generic/dcpi1_divappr_q.c
@@ -24,9 +24,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 mp_limb_t
@@ -70,6 +68,7 @@ mpn_dcpi1_divappr_q_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
 
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_dcpi1_divappr_q_n)
 
 mp_limb_t
 mpn_dcpi1_divappr_q (mp_ptr qp, mp_ptr np, mp_size_t nn,
@@ -244,3 +243,4 @@ mpn_dcpi1_divappr_q (mp_ptr qp, mp_ptr np, mp_size_t nn,
   TMP_FREE;
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_dcpi1_divappr_q)
diff --git a/mpn/generic/div_q.c b/mpn/generic/div_q.c
index b2a0fff..bbc28cb 100644
--- a/mpn/generic/div_q.c
+++ b/mpn/generic/div_q.c
@@ -23,9 +23,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 /* Compute Q = N/D with truncation.
@@ -310,3 +308,4 @@ mpn_div_q (mp_ptr qp,
 
   TMP_FREE;
 }
+__GMP_INTERN_DEFINE (mpn_div_q)
diff --git a/mpn/generic/div_qr_2.c b/mpn/generic/div_qr_2.c
index ca61d6b..262a71b 100644
--- a/mpn/generic/div_qr_2.c
+++ b/mpn/generic/div_qr_2.c
@@ -27,9 +27,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #ifndef DIV_QR_2_PI2_THRESHOLD
 /* Disabled unless explicitly tuned. */
@@ -321,3 +319,4 @@ mpn_div_qr_2 (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
       return mpn_div_qr_2u_pi1 (qp, rp, np, nn, d1, d0, shift, dinv.inv32);
     }
 }
+__GMP_PUBLIC_DEFINE (mpn_div_qr_2)
diff --git a/mpn/generic/div_qr_2n_pi1.c b/mpn/generic/div_qr_2n_pi1.c
index ac8dc3d..36cbb50 100644
--- a/mpn/generic/div_qr_2n_pi1.c
+++ b/mpn/generic/div_qr_2n_pi1.c
@@ -26,9 +26,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 /* 3/2 loop, for normalized divisor */
@@ -74,3 +72,4 @@ mpn_div_qr_2n_pi1 (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
 
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_div_qr_2n_pi1)
diff --git a/mpn/generic/div_qr_2u_pi1.c b/mpn/generic/div_qr_2u_pi1.c
index 568bf42..f02c532 100644
--- a/mpn/generic/div_qr_2u_pi1.c
+++ b/mpn/generic/div_qr_2u_pi1.c
@@ -25,9 +25,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 /* 3/2 loop, for unnormalized divisor. Caller must pass shifted d1 and
@@ -65,3 +63,4 @@ mpn_div_qr_2u_pi1 (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
 
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_div_qr_2u_pi1)
diff --git a/mpn/generic/dive_1.c b/mpn/generic/dive_1.c
index f246b09..1b910f0 100644
--- a/mpn/generic/dive_1.c
+++ b/mpn/generic/dive_1.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 
@@ -146,3 +144,4 @@ mpn_divexact_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, mp_limb_t divisor)
       while (i < size);
     }
 }
+__GMP_INTERN_DEFINE (mpn_divexact_1)
diff --git a/mpn/generic/diveby3.c b/mpn/generic/diveby3.c
index 6293f65..f054180 100644
--- a/mpn/generic/diveby3.c
+++ b/mpn/generic/diveby3.c
@@ -17,7 +17,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 #if DIVEXACT_BY3_METHOD == 0
@@ -161,3 +160,5 @@ mpn_divexact_by3c (mp_ptr restrict rp, mp_srcptr restrict up, mp_size_t un, mp_l
 }
 
 #endif
+
+__GMP_PUBLIC_DEFINE (mpn_divexact_by3c)
diff --git a/mpn/generic/divexact.c b/mpn/generic/divexact.c
index ae80dc7..12cd82e 100644
--- a/mpn/generic/divexact.c
+++ b/mpn/generic/divexact.c
@@ -26,9 +26,7 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #if 1
 void
@@ -281,3 +279,5 @@ mpn_divexact (mp_ptr qp,
   TMP_FREE;
 }
 #endif
+
+__GMP_INTERN_DEFINE (mpn_divexact)
diff --git a/mpn/generic/divis.c b/mpn/generic/divis.c
index e6d08f7..55c4625 100644
--- a/mpn/generic/divis.c
+++ b/mpn/generic/divis.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 /* Determine whether A={ap,an} is divisible by D={dp,dn}.  Must have both
@@ -188,3 +186,4 @@ mpn_divisible_p (mp_srcptr ap, mp_size_t an,
   TMP_FREE;
   return 1;
 }
+__GMP_INTERN_DEFINE (mpn_divisible_p)
diff --git a/mpn/generic/divrem.c b/mpn/generic/divrem.c
index 57ab525..7d748c2 100644
--- a/mpn/generic/divrem.c
+++ b/mpn/generic/divrem.c
@@ -19,9 +19,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 mp_limb_t
 mpn_divrem (mp_ptr qp, mp_size_t qxn,
@@ -96,3 +94,4 @@ mpn_divrem (mp_ptr qp, mp_size_t qxn,
       return qhl;
     }
 }
+__GMP_PUBLIC_DEFINE (mpn_divrem)
diff --git a/mpn/generic/divrem_1.c b/mpn/generic/divrem_1.c
index e66ed80..bd009f5 100644
--- a/mpn/generic/divrem_1.c
+++ b/mpn/generic/divrem_1.c
@@ -18,9 +18,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 /* The size where udiv_qrnnd_preinv should be used rather than udiv_qrnnd,
@@ -242,3 +240,4 @@ mpn_divrem_1 (mp_ptr qp, mp_size_t qxn,
 	}
     }
 }
+__GMP_PUBLIC_DEFINE (mpn_divrem_1)
diff --git a/mpn/generic/divrem_2.c b/mpn/generic/divrem_2.c
index 51a1e78..ca0e88a 100644
--- a/mpn/generic/divrem_2.c
+++ b/mpn/generic/divrem_2.c
@@ -25,9 +25,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 /* Divide num {np,nn} by den {dp,2} and write the nn-2 least significant
@@ -108,3 +106,4 @@ mpn_divrem_2 (mp_ptr qp, mp_size_t qxn,
 
   return most_significant_q_limb;
 }
+__GMP_PUBLIC_DEFINE (mpn_divrem_2)
diff --git a/mpn/generic/dump.c b/mpn/generic/dump.c
index 3830999..a21932f 100644
--- a/mpn/generic/dump.c
+++ b/mpn/generic/dump.c
@@ -20,8 +20,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include <stdio.h>
-#include "gmp.h"
 #include "gmp-impl.h"
 
 #if GMP_NUMB_BITS % 4 == 0
@@ -87,3 +85,5 @@ mpn_dump (mp_srcptr p, mp_size_t n)
 }
 
 #endif
+
+__GMP_INTERN_DEFINE (mpn_dump)
diff --git a/mpn/generic/fib2_ui.c b/mpn/generic/fib2_ui.c
index ddf93fa..0ed1763 100644
--- a/mpn/generic/fib2_ui.c
+++ b/mpn/generic/fib2_ui.c
@@ -21,8 +21,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include <stdio.h>
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* change this to "#define TRACE(x) x" for diagnostics */
@@ -176,3 +174,4 @@ mpn_fib2_ui (mp_ptr fp, mp_ptr f1p, unsigned long int n)
 
   return size;
 }
+__GMP_INTERN_DEFINE (mpn_fib2_ui)
diff --git a/mpn/generic/gcd.c b/mpn/generic/gcd.c
index bf69e3a..8148ecd 100644
--- a/mpn/generic/gcd.c
+++ b/mpn/generic/gcd.c
@@ -18,9 +18,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* Uses the HGCD operation described in
 
@@ -297,3 +295,4 @@ done:
   TMP_FREE;
   return ctx.gn;
 }
+__GMP_PUBLIC_DEFINE (mpn_gcd)
diff --git a/mpn/generic/gcd_1.c b/mpn/generic/gcd_1.c
index 8131bdc..1baeb16 100644
--- a/mpn/generic/gcd_1.c
+++ b/mpn/generic/gcd_1.c
@@ -17,9 +17,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #ifndef GCD_1_METHOD
 #define GCD_1_METHOD 2
@@ -186,3 +184,4 @@ mpn_gcd_1 (mp_srcptr up, mp_size_t size, mp_limb_t vlimb)
  done:
   return vlimb << zero_bits;
 }
+__GMP_PUBLIC_DEFINE (mpn_gcd_1)
diff --git a/mpn/generic/gcd_subdiv_step.c b/mpn/generic/gcd_subdiv_step.c
index 3db3407..04f8633 100644
--- a/mpn/generic/gcd_subdiv_step.c
+++ b/mpn/generic/gcd_subdiv_step.c
@@ -21,11 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include <stdlib.h>		/* for NULL */
-
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* Used when mpn_hgcd or mpn_hgcd2 has failed. Then either one of a or
    b is small, or the difference is small. Perform one subtraction
@@ -192,3 +188,4 @@ mpn_gcd_subdiv_step (mp_ptr ap, mp_ptr bp, mp_size_t n, mp_size_t s,
   hook (ctx, NULL, 0, tp, qn, swapped);
   return an;
 }
+__GMP_INTERN_DEFINE (mpn_gcd_subdiv_step)
diff --git a/mpn/generic/gcdext.c b/mpn/generic/gcdext.c
index 48f7b77..c610dcc 100644
--- a/mpn/generic/gcdext.c
+++ b/mpn/generic/gcdext.c
@@ -18,9 +18,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* Computes (r;b) = (a; b) M. Result is of size n + M->n +/- 1, and
    the size is returned (if inputs are non-normalized, result may be
@@ -545,3 +543,4 @@ mpn_gcdext (mp_ptr gp, mp_ptr up, mp_size_t *usizep,
       return gn;
     }
 }
+__GMP_PUBLIC_DEFINE (mpn_gcdext)
diff --git a/mpn/generic/gcdext_1.c b/mpn/generic/gcdext_1.c
index 3bb4d21..ee4be8e 100644
--- a/mpn/generic/gcdext_1.c
+++ b/mpn/generic/gcdext_1.c
@@ -18,9 +18,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #ifndef GCDEXT_1_USE_BINARY
 #define GCDEXT_1_USE_BINARY 0
@@ -316,3 +314,5 @@ mpn_gcdext_1 (mp_limb_signed_t *up, mp_limb_signed_t *vp,
     }
 }
 #endif /* !GCDEXT_1_USE_BINARY */
+
+__GMP_PUBLIC_DEFINE (mpn_gcdext_1)
diff --git a/mpn/generic/gcdext_lehmer.c b/mpn/generic/gcdext_lehmer.c
index 101dd49..f11cbf0 100644
--- a/mpn/generic/gcdext_lehmer.c
+++ b/mpn/generic/gcdext_lehmer.c
@@ -18,9 +18,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* Here, d is the index of the cofactor to update. FIXME: Could use qn
    = 0 for the common case q = 1. */
@@ -125,6 +123,7 @@ mpn_gcdext_hook (void *p, mp_srcptr gp, mp_size_t gn,
       ctx->un = un + (cy > 0);
     }
 }
+__GMP_INTERN_DEFINE (mpn_gcdext_hook)
 
 /* Temporary storage: 3*(n+1) for u. If hgcd2 succeeds, we need n for
    the matrix-vector multiplication adjusting a, b. If hgcd fails, we
@@ -324,3 +323,4 @@ mpn_gcdext_lehmer_n (mp_ptr gp, mp_ptr up, mp_size_t *usize,
       return 1;
     }
 }
+__GMP_INTERN_DEFINE (mpn_gcdext_lehmer_n)
diff --git a/mpn/generic/get_d.c b/mpn/generic/get_d.c
index 73eb819..e4fec1b 100644
--- a/mpn/generic/get_d.c
+++ b/mpn/generic/get_d.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #ifndef _GMP_IEEE_FLOATS
 #define _GMP_IEEE_FLOATS 0
@@ -399,3 +397,4 @@ mpn_get_d (mp_srcptr up, mp_size_t size, mp_size_t sign, long exp)
     }
 #endif
 }
+__GMP_INTERN_DEFINE (mpn_get_d)
diff --git a/mpn/generic/get_str.c b/mpn/generic/get_str.c
index e17497c..cec406a 100644
--- a/mpn/generic/get_str.c
+++ b/mpn/generic/get_str.c
@@ -25,9 +25,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* Conversion of U {up,un} to a string in base b.  Internally, we convert to
    base B = b^m, the largest power of b that fits a limb.  Basic algorithms:
@@ -540,3 +538,4 @@ mpn_get_str (unsigned char *str, int base, mp_ptr up, mp_size_t un)
 
   return out_len;
 }
+__GMP_PUBLIC_DEFINE (mpn_get_str)
diff --git a/mpn/generic/hgcd.c b/mpn/generic/hgcd.c
index f51bbde..2cdecf2 100644
--- a/mpn/generic/hgcd.c
+++ b/mpn/generic/hgcd.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 /* Size analysis for hgcd:
@@ -63,6 +61,7 @@ mpn_hgcd_itch (mp_size_t n)
 
   return 20 * ((n+3) / 4) + 22 * k + HGCD_THRESHOLD;
 }
+__GMP_INTERN_DEFINE (mpn_hgcd_itch)
 
 /* Reduces a,b until |a-b| fits in n/2 + 1 limbs. Constructs matrix M
    with elements of size at most (n+1)/2 - 1. Returns new size of a,
@@ -170,3 +169,4 @@ mpn_hgcd (mp_ptr ap, mp_ptr bp, mp_size_t n,
       success = 1;
     }
 }
+__GMP_INTERN_DEFINE (mpn_hgcd)
diff --git a/mpn/generic/hgcd2.c b/mpn/generic/hgcd2.c
index 08641cc..8c2e87c 100644
--- a/mpn/generic/hgcd2.c
+++ b/mpn/generic/hgcd2.c
@@ -22,9 +22,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #if GMP_NAIL_BITS == 0
 
@@ -402,6 +400,7 @@ mpn_hgcd2 (mp_limb_t ah, mp_limb_t al, mp_limb_t bh, mp_limb_t bl,
 
   return 1;
 }
+__GMP_INTERN_DEFINE (mpn_hgcd2)
 
 /* Sets (r;b) = (a;b) M, with M = (u00, u01; u10, u11). Vector must
  * have space for n + 1 limbs. Uses three buffers to avoid a copy*/
@@ -435,3 +434,4 @@ mpn_hgcd_mul_matrix1_vector (const struct hgcd_matrix1 *M,
   n += (ah | bh) > 0;
   return n;
 }
+__GMP_INTERN_DEFINE (mpn_hgcd_mul_matrix1_vector)
diff --git a/mpn/generic/hgcd2_jacobi.c b/mpn/generic/hgcd2_jacobi.c
index c888deb..d099f61 100644
--- a/mpn/generic/hgcd2_jacobi.c
+++ b/mpn/generic/hgcd2_jacobi.c
@@ -22,9 +22,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #if GMP_NAIL_BITS > 0
 #error Nails not supported.
@@ -354,3 +352,4 @@ mpn_hgcd2_jacobi (mp_limb_t ah, mp_limb_t al, mp_limb_t bh, mp_limb_t bl,
 
   return 1;
 }
+__GMP_INTERN_DEFINE (mpn_hgcd2_jacobi)
diff --git a/mpn/generic/hgcd_appr.c b/mpn/generic/hgcd_appr.c
index bb8536a..ab8df4e 100644
--- a/mpn/generic/hgcd_appr.c
+++ b/mpn/generic/hgcd_appr.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* Identical to mpn_hgcd_itch. FIXME: Do we really need to add
    HGCD_THRESHOLD at the end? */
@@ -46,6 +44,7 @@ mpn_hgcd_appr_itch (mp_size_t n)
       return 20 * ((n+3) / 4) + 22 * k + HGCD_THRESHOLD;
     }
 }
+__GMP_INTERN_DEFINE (mpn_hgcd_appr_itch)
 
 /* Destroys inputs. */
 int
@@ -256,3 +255,4 @@ mpn_hgcd_appr (mp_ptr ap, mp_ptr bp, mp_size_t n,
 	}
     }
 }
+__GMP_INTERN_DEFINE (mpn_hgcd_appr)
diff --git a/mpn/generic/hgcd_jacobi.c b/mpn/generic/hgcd_jacobi.c
index 728755a..0d2280e 100644
--- a/mpn/generic/hgcd_jacobi.c
+++ b/mpn/generic/hgcd_jacobi.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* This file is almost a copy of hgcd.c, with some added calls to
    mpn_jacobi_update */
@@ -231,3 +229,4 @@ mpn_hgcd_jacobi (mp_ptr ap, mp_ptr bp, mp_size_t n,
       success = 1;
     }
 }
+__GMP_INTERN_DEFINE (mpn_hgcd_jacobi)
diff --git a/mpn/generic/hgcd_matrix.c b/mpn/generic/hgcd_matrix.c
index 9eee8ff..86740d3 100644
--- a/mpn/generic/hgcd_matrix.c
+++ b/mpn/generic/hgcd_matrix.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* For input of size n, matrix elements are of size at most ceil(n/2)
    - 1, but we need two limbs extra. */
@@ -41,6 +39,7 @@ mpn_hgcd_matrix_init (struct hgcd_matrix *M, mp_size_t n, mp_ptr p)
 
   M->p[0][0][0] = M->p[1][1][0] = 1;
 }
+__GMP_INTERN_DEFINE (mpn_hgcd_matrix_init)
 
 /* Update column COL, adding in Q * column (1-COL). Temporary storage:
  * qn + n <= M->alloc, where n is the size of the largest element in
@@ -114,6 +113,7 @@ mpn_hgcd_matrix_update_q (struct hgcd_matrix *M, mp_srcptr qp, mp_size_t qn,
 
   ASSERT (M->n < M->alloc);
 }
+__GMP_INTERN_DEFINE (mpn_hgcd_matrix_update_q)
 
 /* Multiply M by M1 from the right. Since the M1 elements fit in
    GMP_NUMB_BITS - 1 bits, M grows by at most one limb. Needs
@@ -134,6 +134,7 @@ mpn_hgcd_matrix_mul_1 (struct hgcd_matrix *M, const struct hgcd_matrix1 *M1,
   M->n = MAX(n0, n1);
   ASSERT (M->n < M->alloc);
 }
+__GMP_INTERN_DEFINE (mpn_hgcd_matrix_mul_1)
 
 /* Multiply M by M1 from the right. Needs 3*(M->n + M1->n) + 5 limbs
    of temporary storage (see mpn_matrix22_mul_itch). */
@@ -182,6 +183,7 @@ mpn_hgcd_matrix_mul (struct hgcd_matrix *M, const struct hgcd_matrix *M1,
 
   M->n = n + 1;
 }
+__GMP_INTERN_DEFINE (mpn_hgcd_matrix_mul)
 
 /* Multiplies the least significant p limbs of (a;b) by M^-1.
    Temporary space needed: 2 * (p + M->n)*/
@@ -253,3 +255,4 @@ mpn_hgcd_matrix_adjust (const struct hgcd_matrix *M,
   ASSERT (ap[n-1] > 0 || bp[n-1] > 0);
   return n;
 }
+__GMP_INTERN_DEFINE (mpn_hgcd_matrix_adjust)
diff --git a/mpn/generic/hgcd_reduce.c b/mpn/generic/hgcd_reduce.c
index ec201f5..cbfe2a8 100644
--- a/mpn/generic/hgcd_reduce.c
+++ b/mpn/generic/hgcd_reduce.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* Computes R -= A * B. Result must be non-negative. Normalized down
    to size an, and resulting size is returned. */
@@ -209,6 +207,7 @@ mpn_hgcd_reduce_itch (mp_size_t n, mp_size_t p)
     }
   return itch;
 }
+__GMP_INTERN_DEFINE (mpn_hgcd_reduce_itch)
 
 /* FIXME: Document storage need. */
 mp_size_t
@@ -234,3 +233,4 @@ mpn_hgcd_reduce (struct hgcd_matrix *M,
     }
   return 0;
 }
+__GMP_INTERN_DEFINE (mpn_hgcd_reduce)
diff --git a/mpn/generic/hgcd_step.c b/mpn/generic/hgcd_step.c
index 740c56b..02bd469 100644
--- a/mpn/generic/hgcd_step.c
+++ b/mpn/generic/hgcd_step.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 static void
@@ -115,3 +113,4 @@ mpn_hgcd_step (mp_size_t n, mp_ptr ap, mp_ptr bp, mp_size_t s,
 
   return mpn_gcd_subdiv_step (ap, bp, n, s, hgcd_hook, M, tp);
 }
+__GMP_INTERN_DEFINE (mpn_hgcd_step)
diff --git a/mpn/generic/invert.c b/mpn/generic/invert.c
index ac62d23..0676ee6 100644
--- a/mpn/generic/invert.c
+++ b/mpn/generic/invert.c
@@ -23,9 +23,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 void
 mpn_invert (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr scratch)
@@ -78,3 +76,4 @@ mpn_invert (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr scratch)
     TMP_FREE;
   }
 }
+__GMP_INTERN_DEFINE (mpn_invert)
diff --git a/mpn/generic/invertappr.c b/mpn/generic/invertappr.c
index 6430d2e..0ccd635 100644
--- a/mpn/generic/invertappr.c
+++ b/mpn/generic/invertappr.c
@@ -31,11 +31,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 /* FIXME: Remove NULL and TMP_*, as soon as all the callers properly
    allocate and pass the scratch to the function. */
-#include <stdlib.h>		/* for NULL */
-
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* FIXME: The iterative version splits the operand in two slighty unbalanced
    parts, the use of log_2 (or counting the bits) underestimate the maximum
@@ -275,6 +271,7 @@ mpn_ni_invertappr (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr scratch)
   return cy;
 #undef rp
 }
+__GMP_INTERN_DEFINE (mpn_ni_invertappr)
 
 mp_limb_t
 mpn_invertappr (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr scratch)
@@ -301,3 +298,4 @@ mpn_invertappr (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr scratch)
   TMP_FREE;
   return res;
 }
+__GMP_INTERN_DEFINE (mpn_invertappr)
diff --git a/mpn/generic/jacbase.c b/mpn/generic/jacbase.c
index 0cd80d8..97694bb 100644
--- a/mpn/generic/jacbase.c
+++ b/mpn/generic/jacbase.c
@@ -20,9 +20,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 /* Use the simple loop by default.  The generic count_trailing_zeros is not
@@ -230,3 +228,5 @@ mpn_jacobi_base (mp_limb_t a, mp_limb_t b, int bit)
   return 1-2*(bit & 1);
 }
 #endif /* JACOBI_BASE_METHOD == 4 */
+
+__GMP_INTERN_DEFINE (mpn_jacobi_base)
diff --git a/mpn/generic/jacobi.c b/mpn/generic/jacobi.c
index 478f063..a640226 100644
--- a/mpn/generic/jacobi.c
+++ b/mpn/generic/jacobi.c
@@ -22,9 +22,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #ifndef JACOBI_DC_THRESHOLD
 #define JACOBI_DC_THRESHOLD GCD_DC_THRESHOLD
@@ -118,6 +116,7 @@ static const struct
 const unsigned char jacobi_table[208] = {
 #include "jacobitab.h"
 };
+__GMP_INTERN_DEFINE (jacobi_table)
 
 #define BITS_FAIL 31
 
@@ -282,3 +281,4 @@ mpn_jacobi_n (mp_ptr ap, mp_ptr bp, mp_size_t n, unsigned bits)
       return res;
     }
 }
+__GMP_INTERN_DEFINE (mpn_jacobi_n)
diff --git a/mpn/generic/jacobi_2.c b/mpn/generic/jacobi_2.c
index 9a8a2b5..e89edd5 100644
--- a/mpn/generic/jacobi_2.c
+++ b/mpn/generic/jacobi_2.c
@@ -22,9 +22,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #ifndef JACOBI_2_METHOD
 #define JACOBI_2_METHOD 2
@@ -340,3 +338,5 @@ mpn_jacobi_2 (mp_srcptr ap, mp_srcptr bp, unsigned bit)
 #else
 #error Unsupported value for JACOBI_2_METHOD
 #endif
+
+__GMP_INTERN_DEFINE (mpn_jacobi_2)
diff --git a/mpn/generic/logops_n.c b/mpn/generic/logops_n.c
index 618efe5..79d5ea3 100644
--- a/mpn/generic/logops_n.c
+++ b/mpn/generic/logops_n.c
@@ -17,51 +17,43 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 #ifdef OPERATION_and_n
-#define func __MPN(and_n)
-#define call mpn_and_n
+#define func mpn_and_n
 #endif
 
 #ifdef OPERATION_andn_n
-#define func __MPN(andn_n)
-#define call mpn_andn_n
+#define func mpn_andn_n
 #endif
 
 #ifdef OPERATION_nand_n
-#define func __MPN(nand_n)
-#define call mpn_nand_n
+#define func mpn_nand_n
 #endif
 
 #ifdef OPERATION_ior_n
-#define func __MPN(ior_n)
-#define call mpn_ior_n
+#define func mpn_ior_n
 #endif
 
 #ifdef OPERATION_iorn_n
-#define func __MPN(iorn_n)
-#define call mpn_iorn_n
+#define func mpn_iorn_n
 #endif
 
 #ifdef OPERATION_nior_n
-#define func __MPN(nior_n)
-#define call mpn_nior_n
+#define func mpn_nior_n
 #endif
 
 #ifdef OPERATION_xor_n
-#define func __MPN(xor_n)
-#define call mpn_xor_n
+#define func mpn_xor_n
 #endif
 
 #ifdef OPERATION_xnor_n
-#define func __MPN(xnor_n)
-#define call mpn_xnor_n
+#define func mpn_xnor_n
 #endif
 
 void
-func (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
+(func) (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
 {
-  call (rp, up, vp, n);
+  func (rp, up, vp, n);
 }
+__GMP_PUBLIC_DEFINE (func)
diff --git a/mpn/generic/lshift.c b/mpn/generic/lshift.c
index fdc7e44..2ef8839 100644
--- a/mpn/generic/lshift.c
+++ b/mpn/generic/lshift.c
@@ -18,7 +18,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Shift U (pointed to by up and n limbs long) cnt bits to the left
@@ -61,3 +60,4 @@ mpn_lshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
 
   return retval;
 }
+__GMP_PUBLIC_DEFINE (mpn_lshift)
diff --git a/mpn/generic/lshiftc.c b/mpn/generic/lshiftc.c
index 80c1efe..1ac7e7a 100644
--- a/mpn/generic/lshiftc.c
+++ b/mpn/generic/lshiftc.c
@@ -18,7 +18,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Shift U (pointed to by up and n limbs long) cnt bits to the left
@@ -61,3 +60,4 @@ mpn_lshiftc (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
 
   return retval;
 }
+__GMP_INTERN_DEFINE (mpn_lshiftc)
diff --git a/mpn/generic/matrix22_mul.c b/mpn/generic/matrix22_mul.c
index 6e0e675..53c634b 100644
--- a/mpn/generic/matrix22_mul.c
+++ b/mpn/generic/matrix22_mul.c
@@ -23,9 +23,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #define MUL(rp, ap, an, bp, bn) do {		\
   if (an >= bn)					\
@@ -74,6 +72,7 @@ mpn_matrix22_mul_itch (mp_size_t rn, mp_size_t mn)
   else
     return 3*(rn + mn) + 5;
 }
+__GMP_INTERN_DEFINE (mpn_matrix22_mul_itch)
 
 /* Algorithm:
 
@@ -265,6 +264,7 @@ mpn_matrix22_mul_strassen (mp_ptr r0, mp_ptr r1, mp_ptr r2, mp_ptr r3, mp_size_t
     }
   ASSERT (r2[mn-1] < 2);
 }
+__GMP_INTERN_DEFINE (mpn_matrix22_mul_strassen)
 
 void
 mpn_matrix22_mul (mp_ptr r0, mp_ptr r1, mp_ptr r2, mp_ptr r3, mp_size_t rn,
@@ -309,3 +309,4 @@ mpn_matrix22_mul (mp_ptr r0, mp_ptr r1, mp_ptr r2, mp_ptr r3, mp_size_t rn,
     mpn_matrix22_mul_strassen (r0, r1, r2, r3, rn,
 			       m0, m1, m2, m3, mn, tp);
 }
+__GMP_INTERN_DEFINE (mpn_matrix22_mul)
diff --git a/mpn/generic/matrix22_mul1_inverse_vector.c b/mpn/generic/matrix22_mul1_inverse_vector.c
index c8a5811..3707d3c 100644
--- a/mpn/generic/matrix22_mul1_inverse_vector.c
+++ b/mpn/generic/matrix22_mul1_inverse_vector.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* Sets (r;b) = M^{-1}(a;b), with M^{-1} = (u11, -u01; -u10, u00) from
    the left. Uses three buffers, to avoid a copy. */
@@ -52,3 +50,4 @@ mpn_matrix22_mul1_inverse_vector (const struct hgcd_matrix1 *M,
   n -= (rp[n-1] | bp[n-1]) == 0;
   return n;
 }
+__GMP_INTERN_DEFINE (mpn_matrix22_mul1_inverse_vector)
diff --git a/mpn/generic/mod_1.c b/mpn/generic/mod_1.c
index 66c332e..9ea66ad 100644
--- a/mpn/generic/mod_1.c
+++ b/mpn/generic/mod_1.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 /* The size where udiv_qrnnd_preinv should be used rather than udiv_qrnnd,
@@ -268,3 +266,4 @@ mpn_mod_1 (mp_srcptr ap, mp_size_t n, mp_limb_t b)
 	}
     }
 }
+__GMP_PUBLIC_DEFINE (mpn_mod_1)
diff --git a/mpn/generic/mod_1_1.c b/mpn/generic/mod_1_1.c
index d0e885d..b0b9d42 100644
--- a/mpn/generic/mod_1_1.c
+++ b/mpn/generic/mod_1_1.c
@@ -25,9 +25,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #ifndef MOD_1_1P_METHOD
 # define MOD_1_1P_METHOD 1    /* need to make sure this is 2 for asm testing */
@@ -309,3 +307,6 @@ mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4])
   return r >> cnt;
 }
 #endif /* MOD_1_1P_METHOD == 2 */
+
+__GMP_INTERN_DEFINE (mpn_mod_1_1p_cps)
+__GMP_INTERN_DEFINE (mpn_mod_1_1p)
diff --git a/mpn/generic/mod_1_2.c b/mpn/generic/mod_1_2.c
index 7fec950..68f7bd5 100644
--- a/mpn/generic/mod_1_2.c
+++ b/mpn/generic/mod_1_2.c
@@ -26,9 +26,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 void
 mpn_mod_1s_2p_cps (mp_limb_t cps[5], mp_limb_t b)
@@ -69,6 +67,7 @@ mpn_mod_1s_2p_cps (mp_limb_t cps[5], mp_limb_t b)
   }
 #endif
 }
+__GMP_INTERN_DEFINE (mpn_mod_1s_2p_cps)
 
 mp_limb_t
 mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[5])
@@ -136,3 +135,4 @@ mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[5])
 
   return r >> cnt;
 }
+__GMP_INTERN_DEFINE (mpn_mod_1s_2p)
diff --git a/mpn/generic/mod_1_3.c b/mpn/generic/mod_1_3.c
index 75d1cca..d431577 100644
--- a/mpn/generic/mod_1_3.c
+++ b/mpn/generic/mod_1_3.c
@@ -26,9 +26,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 void
 mpn_mod_1s_3p_cps (mp_limb_t cps[6], mp_limb_t b)
@@ -72,6 +70,7 @@ mpn_mod_1s_3p_cps (mp_limb_t cps[6], mp_limb_t b)
   }
 #endif
 }
+__GMP_INTERN_DEFINE (mpn_mod_1s_3p_cps)
 
 mp_limb_t
 mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[6])
@@ -144,3 +143,4 @@ mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[6])
 
   return r >> cnt;
 }
+__GMP_INTERN_DEFINE (mpn_mod_1s_3p)
diff --git a/mpn/generic/mod_1_4.c b/mpn/generic/mod_1_4.c
index 570ff43..2f7f4d5 100644
--- a/mpn/generic/mod_1_4.c
+++ b/mpn/generic/mod_1_4.c
@@ -26,9 +26,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 void
 mpn_mod_1s_4p_cps (mp_limb_t cps[7], mp_limb_t b)
@@ -75,6 +73,7 @@ mpn_mod_1s_4p_cps (mp_limb_t cps[7], mp_limb_t b)
   }
 #endif
 }
+__GMP_INTERN_DEFINE (mpn_mod_1s_4p_cps)
 
 mp_limb_t
 mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
@@ -158,3 +157,4 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
 
   return r >> cnt;
 }
+__GMP_INTERN_DEFINE (mpn_mod_1s_4p)
diff --git a/mpn/generic/mod_34lsub1.c b/mpn/generic/mod_34lsub1.c
index 6bd1498..fcd61aa 100644
--- a/mpn/generic/mod_34lsub1.c
+++ b/mpn/generic/mod_34lsub1.c
@@ -22,7 +22,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -116,5 +115,6 @@ mpn_mod_34lsub1 (mp_srcptr p, mp_size_t n)
     PARTS0 (a0) + PARTS1 (a1) + PARTS2 (a2)
     + PARTS1 (c0) + PARTS2 (c1) + PARTS0 (c2);
 }
+__GMP_INTERN_DEFINE (mpn_mod_34lsub1)
 
 #endif
diff --git a/mpn/generic/mode1o.c b/mpn/generic/mode1o.c
index e8978a4..ebf889d 100644
--- a/mpn/generic/mode1o.c
+++ b/mpn/generic/mode1o.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 /* Calculate an r satisfying
@@ -223,3 +221,5 @@ mpn_modexact_1c_odd (mp_srcptr src, mp_size_t size, mp_limb_t d, mp_limb_t h)
 }
 
 #endif
+
+__GMP_INTERN_DEFINE (mpn_modexact_1c_odd)
diff --git a/mpn/generic/mu_bdiv_q.c b/mpn/generic/mu_bdiv_q.c
index 01df1e3..0945c8e 100644
--- a/mpn/generic/mu_bdiv_q.c
+++ b/mpn/generic/mu_bdiv_q.c
@@ -33,7 +33,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
    for developing quotient bits.  This algorithm was presented at ICMS 2006.
 */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -213,6 +212,7 @@ mpn_mu_bdiv_q (mp_ptr qp,
 #undef scratch_out
     }
 }
+__GMP_INTERN_DEFINE (mpn_mu_bdiv_q)
 
 mp_size_t
 mpn_mu_bdiv_q_itch (mp_size_t nn, mp_size_t dn)
@@ -258,3 +258,4 @@ mpn_mu_bdiv_q_itch (mp_size_t nn, mp_size_t dn)
       return in + MAX (itches, itch_binvert);
     }
 }
+__GMP_INTERN_DEFINE (mpn_mu_bdiv_q_itch)
diff --git a/mpn/generic/mu_bdiv_qr.c b/mpn/generic/mu_bdiv_qr.c
index fabdc46..19bb8b4 100644
--- a/mpn/generic/mu_bdiv_qr.c
+++ b/mpn/generic/mu_bdiv_qr.c
@@ -33,7 +33,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
    for developing quotient bits.  This algorithm was presented at ICMS 2006.
 */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -231,6 +230,7 @@ mpn_mu_bdiv_qr (mp_ptr qp,
 #undef scratch_out
     }
 }
+__GMP_INTERN_DEFINE (mpn_mu_bdiv_qr)
 
 mp_size_t
 mpn_mu_bdiv_qr_itch (mp_size_t nn, mp_size_t dn)
@@ -276,3 +276,4 @@ mpn_mu_bdiv_qr_itch (mp_size_t nn, mp_size_t dn)
   itches = tn + itch_out;
   return in + MAX (itches, itch_binvert);
 }
+__GMP_INTERN_DEFINE (mpn_mu_bdiv_qr_itch)
diff --git a/mpn/generic/mu_div_q.c b/mpn/generic/mu_div_q.c
index 86182ac..cc179ad 100644
--- a/mpn/generic/mu_div_q.c
+++ b/mpn/generic/mu_div_q.c
@@ -52,8 +52,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
      then would need to be amended.
 */
 
-#include <stdlib.h>		/* for NULL */
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -201,6 +199,7 @@ mpn_mu_div_q (mp_ptr qp,
   TMP_FREE;
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_mu_div_q)
 
 mp_size_t
 mpn_mu_div_q_itch (mp_size_t nn, mp_size_t dn, int mua_k)
@@ -220,3 +219,4 @@ mpn_mu_div_q_itch (mp_size_t nn, mp_size_t dn, int mua_k)
       return itch1;
     }
 }
+__GMP_INTERN_DEFINE (mpn_mu_div_q_itch)
diff --git a/mpn/generic/mu_div_qr.c b/mpn/generic/mu_div_qr.c
index b7aaa70..4e8ea88 100644
--- a/mpn/generic/mu_div_qr.c
+++ b/mpn/generic/mu_div_qr.c
@@ -60,8 +60,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define STAT(x)
 #endif
 
-#include <stdlib.h>		/* for NULL */
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -142,6 +140,7 @@ mpn_mu_div_qr (mp_ptr qp,
 
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_mu_div_qr)
 
 static mp_limb_t
 mpn_mu_div_qr2 (mp_ptr qp,
@@ -345,6 +344,7 @@ mpn_preinv_mu_div_qr (mp_ptr qp,
 
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_preinv_mu_div_qr)
 
 /* In case k=0 (automatic choice), we distinguish 3 cases:
    (a) dn < qn:         in = ceil(qn / ceil(qn/dn))
@@ -384,6 +384,7 @@ mpn_mu_div_qr_choose_in (mp_size_t qn, mp_size_t dn, int k)
 
   return in;
 }
+__GMP_INTERN_DEFINE (mpn_mu_div_qr_choose_in)
 
 mp_size_t
 mpn_mu_div_qr_itch (mp_size_t nn, mp_size_t dn, int mua_k)
@@ -394,6 +395,7 @@ mpn_mu_div_qr_itch (mp_size_t nn, mp_size_t dn, int mua_k)
 
   return in + itch_local + itch_out;
 }
+__GMP_INTERN_DEFINE (mpn_mu_div_qr_itch)
 
 mp_size_t
 mpn_preinv_mu_div_qr_itch (mp_size_t nn, mp_size_t dn, mp_size_t in)
@@ -403,3 +405,4 @@ mpn_preinv_mu_div_qr_itch (mp_size_t nn, mp_size_t dn, mp_size_t in)
 
   return itch_local + itch_out;
 }
+__GMP_INTERN_DEFINE (mpn_preinv_mu_div_qr_itch)
diff --git a/mpn/generic/mu_divappr_q.c b/mpn/generic/mu_divappr_q.c
index 0e9afa3..732ee5b 100644
--- a/mpn/generic/mu_divappr_q.c
+++ b/mpn/generic/mu_divappr_q.c
@@ -56,8 +56,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define STAT(x)
 #endif
 
-#include <stdlib.h>		/* for NULL */
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -144,6 +142,7 @@ mpn_mu_divappr_q (mp_ptr qp,
 
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_mu_divappr_q)
 
 mp_limb_t
 mpn_preinv_mu_divappr_q (mp_ptr qp,
@@ -294,6 +293,7 @@ mpn_preinv_mu_divappr_q (mp_ptr qp,
 
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_preinv_mu_divappr_q)
 
 /* In case k=0 (automatic choice), we distinguish 3 cases:
    (a) dn < qn:         in = ceil(qn / ceil(qn/dn))
@@ -333,6 +333,7 @@ mpn_mu_divappr_q_choose_in (mp_size_t qn, mp_size_t dn, int k)
 
   return in;
 }
+__GMP_INTERN_DEFINE (mpn_mu_divappr_q_choose_in)
 
 mp_size_t
 mpn_mu_divappr_q_itch (mp_size_t nn, mp_size_t dn, int mua_k)
@@ -350,3 +351,4 @@ mpn_mu_divappr_q_itch (mp_size_t nn, mp_size_t dn, int mua_k)
   itch_out = mpn_mulmod_bnm1_itch (itch_local, dn, in);
   return in + dn + itch_local + itch_out;
 }
+__GMP_INTERN_DEFINE (mpn_mu_divappr_q_itch)
diff --git a/mpn/generic/mul.c b/mpn/generic/mul.c
index 8e8ce58..1ac7c77 100644
--- a/mpn/generic/mul.c
+++ b/mpn/generic/mul.c
@@ -20,7 +20,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -415,3 +414,4 @@ mpn_mul (mp_ptr prodp,
 
   return prodp[un + vn - 1];	/* historic */
 }
+__GMP_PUBLIC_DEFINE (mpn_mul)
diff --git a/mpn/generic/mul_1.c b/mpn/generic/mul_1.c
index b8290cc..122715a 100644
--- a/mpn/generic/mul_1.c
+++ b/mpn/generic/mul_1.c
@@ -19,9 +19,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 #if GMP_NAIL_BITS == 0
@@ -85,3 +83,5 @@ mpn_mul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
 }
 
 #endif
+
+__GMP_PUBLIC_DEFINE (mpn_mul_1)
diff --git a/mpn/generic/mul_basecase.c b/mpn/generic/mul_basecase.c
index 0eac224..cab595f 100644
--- a/mpn/generic/mul_basecase.c
+++ b/mpn/generic/mul_basecase.c
@@ -22,7 +22,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -154,3 +153,4 @@ mpn_mul_basecase (mp_ptr rp,
       rp += 1, vp += 1, vn -= 1;
     }
 }
+__GMP_INTERN_DEFINE (mpn_mul_basecase)
diff --git a/mpn/generic/mul_fft.c b/mpn/generic/mul_fft.c
index e2555c7..381b2c6 100644
--- a/mpn/generic/mul_fft.c
+++ b/mpn/generic/mul_fft.c
@@ -56,7 +56,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 #define TRACE(x)
 #endif
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 #ifdef WANT_ADDSUB
@@ -150,6 +149,8 @@ mpn_fft_best_k (mp_size_t n, int sqr)
 }
 #endif
 
+__GMP_INTERN_DEFINE (mpn_fft_best_k)
+
 /*****************************************************************************/
 
 
@@ -165,6 +166,7 @@ mpn_fft_next_size (mp_size_t pl, int k)
   pl = 1 + ((pl - 1) >> k); /* ceil (pl/2^k) */
   return pl << k;
 }
+__GMP_INTERN_DEFINE (mpn_fft_next_size)
 
 
 /* Initialize l[i][j] with bitrev(j) */
@@ -884,6 +886,7 @@ mpn_mul_fft (mp_ptr op, mp_size_t pl,
   TMP_FREE;
   return h;
 }
+__GMP_INTERN_DEFINE (mpn_mul_fft)
 
 #if WANT_OLD_FFT_FULL
 /* multiply {n, nl} by {m, ml}, and put the result in {op, nl+ml} */
@@ -989,4 +992,5 @@ mpn_mul_fft_full (mp_ptr op,
   /* since the final result has at most pl limbs, no carry out below */
   mpn_add_1 (op + pl2, op + pl2, pl - pl2, (mp_limb_t) c2);
 }
+__GMP_INTERN_DEFINE (mpn_mul_fft_full)
 #endif
diff --git a/mpn/generic/mul_n.c b/mpn/generic/mul_n.c
index 80cfb08..18f7308 100644
--- a/mpn/generic/mul_n.c
+++ b/mpn/generic/mul_n.c
@@ -18,9 +18,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 void
 mpn_mul_n (mp_ptr p, mp_srcptr a, mp_srcptr b, mp_size_t n)
@@ -84,3 +82,4 @@ mpn_mul_n (mp_ptr p, mp_srcptr a, mp_srcptr b, mp_size_t n)
       mpn_fft_mul (p, a, n, b, n);
     }
 }
+__GMP_PUBLIC_DEFINE (mpn_mul_n)
diff --git a/mpn/generic/mullo_basecase.c b/mpn/generic/mullo_basecase.c
index ceea829..f64603a 100644
--- a/mpn/generic/mullo_basecase.c
+++ b/mpn/generic/mullo_basecase.c
@@ -22,7 +22,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /*
@@ -39,3 +38,4 @@ mpn_mullo_basecase (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
   for (i = 1; i < n; i++)
     mpn_addmul_1 (rp + i, up, n - i, vp[i]);
 }
+__GMP_INTERN_DEFINE (mpn_mullo_basecase)
diff --git a/mpn/generic/mullo_n.c b/mpn/generic/mullo_n.c
index 8c39b2b..ee98fdf 100644
--- a/mpn/generic/mullo_n.c
+++ b/mpn/generic/mullo_n.c
@@ -24,7 +24,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -243,3 +242,4 @@ mpn_mullo_n (mp_ptr rp, mp_srcptr xp, mp_srcptr yp, mp_size_t n)
       TMP_FREE;
     }
 }
+__GMP_INTERN_DEFINE (mpn_mullo_n)
diff --git a/mpn/generic/mulmid.c b/mpn/generic/mulmid.c
index 67afd09..0c4ef3e 100644
--- a/mpn/generic/mulmid.c
+++ b/mpn/generic/mulmid.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -243,3 +242,4 @@ mpn_mulmid (mp_ptr rp,
         }
     }
 }
+__GMP_INTERN_DEFINE (mpn_mulmid)
diff --git a/mpn/generic/mulmid_basecase.c b/mpn/generic/mulmid_basecase.c
index e926cc4..0f0c3dd 100644
--- a/mpn/generic/mulmid_basecase.c
+++ b/mpn/generic/mulmid_basecase.c
@@ -24,9 +24,7 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* Middle product of {up,un} and {vp,vn}, write result to {rp,un-vn+3}.
    Must have un >= vn >= 1.
@@ -70,3 +68,4 @@ mpn_mulmid_basecase (mp_ptr rp,
   rp[un] = lo;
   rp[un + 1] = hi;
 }
+__GMP_INTERN_DEFINE (mpn_mulmid_basecase)
diff --git a/mpn/generic/mulmid_n.c b/mpn/generic/mulmid_n.c
index b78f007..e76a0e1 100644
--- a/mpn/generic/mulmid_n.c
+++ b/mpn/generic/mulmid_n.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -49,3 +48,4 @@ mpn_mulmid_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
       TMP_FREE;
     }
 }
+__GMP_INTERN_DEFINE (mpn_mulmid_n)
diff --git a/mpn/generic/mulmod_bnm1.c b/mpn/generic/mulmod_bnm1.c
index 18bc3ed..131f0f6 100644
--- a/mpn/generic/mulmod_bnm1.c
+++ b/mpn/generic/mulmod_bnm1.c
@@ -25,9 +25,7 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* Inputs are {ap,rn} and {bp,rn}; output is {rp,rn}, computation is
    mod B^rn - 1, and values are semi-normalised; zero is represented
@@ -47,6 +45,7 @@ mpn_bc_mulmod_bnm1 (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t rn,
    * be no overflow when adding in the carry. */
   MPN_INCR_U (rp, rn, cy);
 }
+__GMP_INTERN_DEFINE (mpn_bc_mulmod_bnm1)
 
 
 /* Inputs are {ap,rn+1} and {bp,rn+1}; output is {rp,rn+1}, in
@@ -322,6 +321,7 @@ mpn_mulmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_srcptr
 #undef sp1
     }
 }
+__GMP_INTERN_DEFINE (mpn_mulmod_bnm1)
 
 mp_size_t
 mpn_mulmod_bnm1_next_size (mp_size_t n)
@@ -342,3 +342,4 @@ mpn_mulmod_bnm1_next_size (mp_size_t n)
 
   return 2 * mpn_fft_next_size (nh, mpn_fft_best_k (nh, 0));
 }
+__GMP_INTERN_DEFINE (mpn_mulmod_bnm1_next_size)
diff --git a/mpn/generic/neg.c b/mpn/generic/neg.c
index 980e59e..9e2256c 100644
--- a/mpn/generic/neg.c
+++ b/mpn/generic/neg.c
@@ -18,6 +18,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 #define __GMP_FORCE_mpn_neg 1
-
-#include "gmp.h"
 #include "gmp-impl.h"
+
+__GMP_PUBLIC_DEFINE (mpn_neg)
diff --git a/mpn/generic/nussbaumer_mul.c b/mpn/generic/nussbaumer_mul.c
index 131faf8..7151fd6 100644
--- a/mpn/generic/nussbaumer_mul.c
+++ b/mpn/generic/nussbaumer_mul.c
@@ -25,7 +25,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Multiply {ap,an} by {bp,bn}, and put the result in {pp, an+bn} */
@@ -58,3 +57,4 @@ mpn_nussbaumer_mul (mp_ptr pp,
 
   TMP_FREE;
 }
+__GMP_INTERN_DEFINE (mpn_nussbaumer_mul)
diff --git a/mpn/generic/perfpow.c b/mpn/generic/perfpow.c
index b62dee8..31cb3a2 100644
--- a/mpn/generic/perfpow.c
+++ b/mpn/generic/perfpow.c
@@ -19,9 +19,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #define SMALL 20
 #define MEDIUM 100
@@ -404,3 +402,4 @@ mpn_perfect_power_p (mp_srcptr np, mp_size_t n)
   TMP_FREE;
   return ans;
 }
+__GMP_PUBLIC_DEFINE (mpn_perfect_power_p)
diff --git a/mpn/generic/perfsqr.c b/mpn/generic/perfsqr.c
index 892da1a..4b15db5 100644
--- a/mpn/generic/perfsqr.c
+++ b/mpn/generic/perfsqr.c
@@ -19,11 +19,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include <stdio.h> /* for NULL */
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
-
 #include "perfsqr.h"
 
 
@@ -227,3 +223,4 @@ mpn_perfect_square_p (mp_srcptr up, mp_size_t usize)
     return res;
   }
 }
+__GMP_PUBLIC_DEFINE (mpn_perfect_square_p)
diff --git a/mpn/generic/popham.c b/mpn/generic/popham.c
index 4aa0674..55239a9 100644
--- a/mpn/generic/popham.c
+++ b/mpn/generic/popham.c
@@ -18,7 +18,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 #if OPERATION_popcount
@@ -113,3 +112,4 @@ FNAME (mp_srcptr up,
 
   return result;
 }
+__GMP_PUBLIC_DEFINE (FNAME)
diff --git a/mpn/generic/pow_1.c b/mpn/generic/pow_1.c
index d379836..2ca4602 100644
--- a/mpn/generic/pow_1.c
+++ b/mpn/generic/pow_1.c
@@ -22,9 +22,7 @@ You should have received a copy of the GNU Lesser General Public License along
 with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 mp_size_t
 mpn_pow_1 (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp)
@@ -119,3 +117,4 @@ mpn_pow_1 (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp)
 
   return rn;
 }
+__GMP_PUBLIC_DEFINE (mpn_pow_1)
diff --git a/mpn/generic/powlo.c b/mpn/generic/powlo.c
index f6cc2bd..0fa70de 100644
--- a/mpn/generic/powlo.c
+++ b/mpn/generic/powlo.c
@@ -18,9 +18,7 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 #define getbit(p,bi) \
@@ -161,3 +159,4 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp,
  done:
   TMP_FREE;
 }
+__GMP_INTERN_DEFINE (mpn_powlo)
diff --git a/mpn/generic/powm.c b/mpn/generic/powm.c
index 14a7393..78741d1 100644
--- a/mpn/generic/powm.c
+++ b/mpn/generic/powm.c
@@ -70,9 +70,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
      mod M.
 */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #undef MPN_REDC_1
 #define MPN_REDC_1(rp, up, mp, n, invm)					\
@@ -577,3 +575,4 @@ mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
 
   TMP_FREE;
 }
+__GMP_INTERN_DEFINE (mpn_powm)
diff --git a/mpn/generic/powm_sec.c b/mpn/generic/powm_sec.c
index ba7c0c7..c087d17 100644
--- a/mpn/generic/powm_sec.c
+++ b/mpn/generic/powm_sec.c
@@ -54,9 +54,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
      slowdown.
 */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #undef MPN_REDC_1_SEC
 #define MPN_REDC_1_SEC(rp, up, mp, n, invm)				\
@@ -420,6 +418,7 @@ mpn_powm_sec (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
   cnd = mpn_sub_n (tp, rp, mp, n);	/* we need just retval */
   mpn_subcnd_n (rp, rp, mp, n, !cnd);
 }
+__GMP_INTERN_DEFINE (mpn_powm_sec)
 
 mp_size_t
 mpn_powm_sec_itch (mp_size_t bn, mp_size_t en, mp_size_t n)
@@ -444,3 +443,4 @@ mpn_powm_sec_itch (mp_size_t bn, mp_size_t en, mp_size_t n)
 
   return MAX (itch, redcify_itch);
 }
+__GMP_INTERN_DEFINE (mpn_powm_sec_itch)
diff --git a/mpn/generic/pre_divrem_1.c b/mpn/generic/pre_divrem_1.c
index 134b4cb..fc9bd86 100644
--- a/mpn/generic/pre_divrem_1.c
+++ b/mpn/generic/pre_divrem_1.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 /* Don't bloat a shared library with unused code. */
@@ -131,5 +129,6 @@ mpn_preinv_divrem_1 (mp_ptr qp, mp_size_t xsize,
 
   return r >> shift;
 }
+__GMP_INTERN_DEFINE (mpn_preinv_divrem_1)
 
 #endif /* USE_PREINV_DIVREM_1 */
diff --git a/mpn/generic/pre_mod_1.c b/mpn/generic/pre_mod_1.c
index 1486d6e..24dab7b 100644
--- a/mpn/generic/pre_mod_1.c
+++ b/mpn/generic/pre_mod_1.c
@@ -20,9 +20,7 @@ for more details.
 You should have received a copy of the GNU Lesser General Public License along
 with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 /* This function used to be documented, but is now considered obsolete.  It
@@ -49,3 +47,4 @@ mpn_preinv_mod_1 (mp_srcptr up, mp_size_t un, mp_limb_t d, mp_limb_t dinv)
     }
   return r;
 }
+__GMP_PUBLIC_DEFINE (mpn_preinv_mod_1)
diff --git a/mpn/generic/random.c b/mpn/generic/random.c
index c0b85ea..e6c036e 100644
--- a/mpn/generic/random.c
+++ b/mpn/generic/random.c
@@ -17,7 +17,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 void
@@ -38,3 +37,4 @@ mpn_random (mp_ptr ptr, mp_size_t size)
   while (ptr[size-1] == 0)
     _gmp_rand (&ptr[size-1], rands, GMP_NUMB_BITS);
 }
+__GMP_PUBLIC_DEFINE (mpn_random)
diff --git a/mpn/generic/random2.c b/mpn/generic/random2.c
index 5d7eb7e..fb2834d 100644
--- a/mpn/generic/random2.c
+++ b/mpn/generic/random2.c
@@ -19,7 +19,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 static void gmp_rrandomb (mp_ptr, gmp_randstate_t, mp_bitcnt_t);
@@ -52,6 +51,7 @@ mpn_random2 (mp_ptr rp, mp_size_t n)
 
   gmp_rrandomb (rp, rstate, n * GMP_NUMB_BITS - bit_pos);
 }
+__GMP_PUBLIC_DEFINE (mpn_random2)
 
 static void
 gmp_rrandomb (mp_ptr rp, gmp_randstate_t rstate, mp_bitcnt_t nbits)
diff --git a/mpn/generic/redc_1.c b/mpn/generic/redc_1.c
index 8c84aea..4dfa61d 100644
--- a/mpn/generic/redc_1.c
+++ b/mpn/generic/redc_1.c
@@ -22,7 +22,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 mp_limb_t
@@ -45,3 +44,4 @@ mpn_redc_1 (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_limb_t invm)
   cy = mpn_add_n (rp, up, up - n, n);
   return cy;
 }
+__GMP_INTERN_DEFINE (mpn_redc_1)
diff --git a/mpn/generic/redc_2.c b/mpn/generic/redc_2.c
index efc1e92..f3145a0 100644
--- a/mpn/generic/redc_2.c
+++ b/mpn/generic/redc_2.c
@@ -22,9 +22,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 #if GMP_NAIL_BITS != 0
@@ -35,6 +33,8 @@ you lose
    available.  */
 #ifndef HAVE_NATIVE_mpn_addmul_2
 #undef mpn_addmul_2
+#define mpn_addmul_2  local_addmul_2
+
 static mp_limb_t
 mpn_addmul_2 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_srcptr vp)
 {
@@ -98,3 +98,4 @@ mpn_redc_2 (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_srcptr mip)
   cy = mpn_add_n (rp, up, up - n, n);
   return cy;
 }
+__GMP_INTERN_DEFINE (mpn_redc_2)
diff --git a/mpn/generic/redc_n.c b/mpn/generic/redc_n.c
index debfba2..ac16fce 100644
--- a/mpn/generic/redc_n.c
+++ b/mpn/generic/redc_n.c
@@ -21,7 +21,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /*
@@ -68,3 +67,4 @@ mpn_redc_n (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_srcptr ip)
 
   TMP_FREE;
 }
+__GMP_INTERN_DEFINE (mpn_redc_n)
diff --git a/mpn/generic/remove.c b/mpn/generic/remove.c
index 3b55aa4..896a8d4 100644
--- a/mpn/generic/remove.c
+++ b/mpn/generic/remove.c
@@ -24,7 +24,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 #if GMP_LIMB_BITS > 50
@@ -159,3 +158,4 @@ mpn_remove (mp_ptr wp, mp_size_t *wn,
 
   return pwr;
 }
+__GMP_INTERN_DEFINE (mpn_remove)
diff --git a/mpn/generic/rootrem.c b/mpn/generic/rootrem.c
index b366412..0e3f7c5 100644
--- a/mpn/generic/rootrem.c
+++ b/mpn/generic/rootrem.c
@@ -30,11 +30,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
      is M(n), whereas it should be M(n/k) on average.
 */
 
-#include <stdio.h>		/* for NULL */
-
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 static mp_size_t mpn_rootrem_internal (mp_ptr, mp_ptr, mp_srcptr, mp_size_t,
 				       mp_limb_t, int);
@@ -114,6 +110,7 @@ mpn_rootrem (mp_ptr rootp, mp_ptr remp,
       return mpn_rootrem_internal (rootp, remp, up, un, k, 0);
     }
 }
+__GMP_INTERN_DEFINE (mpn_rootrem)
 
 /* if approx is non-zero, does not compute the final remainder */
 static mp_size_t
diff --git a/mpn/generic/rshift.c b/mpn/generic/rshift.c
index 6225665..47ee99d 100644
--- a/mpn/generic/rshift.c
+++ b/mpn/generic/rshift.c
@@ -18,7 +18,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Shift U (pointed to by up and N limbs long) cnt bits to the right
@@ -58,3 +57,4 @@ mpn_rshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
 
   return retval;
 }
+__GMP_PUBLIC_DEFINE (mpn_rshift)
diff --git a/mpn/generic/sb_div_sec.c b/mpn/generic/sb_div_sec.c
index 8455d12..293a175 100644
--- a/mpn/generic/sb_div_sec.c
+++ b/mpn/generic/sb_div_sec.c
@@ -25,9 +25,7 @@ for more details.
 You should have received a copy of the GNU Lesser General Public License along
 with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #if OPERATION_sb_div_qr_sec
 /* Needs (nn + dn + 1) + mpn_sbpi1_div_qr_sec's needs of (2nn' - dn + 1) for a
@@ -112,3 +110,4 @@ FNAME (Q(mp_ptr qp)
     qp[nn - dn] = qh;
 #endif
 }
+__GMP_INTERN_DEFINE (FNAME)
diff --git a/mpn/generic/sbpi1_bdiv_q.c b/mpn/generic/sbpi1_bdiv_q.c
index 013eb81..d6e9697 100644
--- a/mpn/generic/sbpi1_bdiv_q.c
+++ b/mpn/generic/sbpi1_bdiv_q.c
@@ -24,7 +24,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -87,3 +86,4 @@ mpn_sbpi1_bdiv_q (mp_ptr qp,
   qp[0] = ~q;
   mpn_add_1 (qp - nn + 1, qp - nn + 1, nn, 1);
 }
+__GMP_INTERN_DEFINE (mpn_sbpi1_bdiv_q)
diff --git a/mpn/generic/sbpi1_bdiv_qr.c b/mpn/generic/sbpi1_bdiv_qr.c
index 666f801..a236f3e 100644
--- a/mpn/generic/sbpi1_bdiv_qr.c
+++ b/mpn/generic/sbpi1_bdiv_qr.c
@@ -24,7 +24,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -106,3 +105,4 @@ mpn_sbpi1_bdiv_qr (mp_ptr qp,
       return cy - rh;
     }
 }
+__GMP_INTERN_DEFINE (mpn_sbpi1_bdiv_qr)
diff --git a/mpn/generic/sbpi1_div_q.c b/mpn/generic/sbpi1_div_q.c
index 595a03f..052876d 100644
--- a/mpn/generic/sbpi1_div_q.c
+++ b/mpn/generic/sbpi1_div_q.c
@@ -25,9 +25,7 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 mp_limb_t
 mpn_sbpi1_div_q (mp_ptr qp,
@@ -290,3 +288,4 @@ mpn_sbpi1_div_q (mp_ptr qp,
 
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_sbpi1_div_q)
diff --git a/mpn/generic/sbpi1_div_qr.c b/mpn/generic/sbpi1_div_qr.c
index 7e53aae..3702ed3 100644
--- a/mpn/generic/sbpi1_div_qr.c
+++ b/mpn/generic/sbpi1_div_qr.c
@@ -25,9 +25,7 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 mp_limb_t
 mpn_sbpi1_div_qr (mp_ptr qp,
@@ -97,3 +95,4 @@ mpn_sbpi1_div_qr (mp_ptr qp,
 
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_sbpi1_div_qr)
diff --git a/mpn/generic/sbpi1_div_sec.c b/mpn/generic/sbpi1_div_sec.c
index ec63e5e..f7ea757 100644
--- a/mpn/generic/sbpi1_div_sec.c
+++ b/mpn/generic/sbpi1_div_sec.c
@@ -25,9 +25,7 @@ for more details.
 You should have received a copy of the GNU Lesser General Public License along
 with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 #if OPERATION_sbpi1_div_qr_sec
 /* Needs (dn + 1) + (nn - dn) + (nn - dn) = 2nn - dn + 1 limbs at tp. */
@@ -149,3 +147,4 @@ FNAME (Q(mp_ptr qp)
   return;
 #endif
 }
+__GMP_INTERN_DEFINE (FNAME)
diff --git a/mpn/generic/sbpi1_divappr_q.c b/mpn/generic/sbpi1_divappr_q.c
index 53d4a25..8ba8c06 100644
--- a/mpn/generic/sbpi1_divappr_q.c
+++ b/mpn/generic/sbpi1_divappr_q.c
@@ -26,9 +26,7 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 mp_limb_t
 mpn_sbpi1_divappr_q (mp_ptr qp,
@@ -186,3 +184,4 @@ mpn_sbpi1_divappr_q (mp_ptr qp,
 
   return qh;
 }
+__GMP_INTERN_DEFINE (mpn_sbpi1_divappr_q)
diff --git a/mpn/generic/scan0.c b/mpn/generic/scan0.c
index 234ba9b..5285e14 100644
--- a/mpn/generic/scan0.c
+++ b/mpn/generic/scan0.c
@@ -17,9 +17,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* Argument constraints:
    1. U must sooner or later have a limb with a clear bit.
@@ -47,3 +45,4 @@ mpn_scan0 (mp_srcptr up, mp_bitcnt_t starting_bit)
   count_trailing_zeros (cnt, alimb);
   return (p - up - 1) * GMP_NUMB_BITS + cnt;
 }
+__GMP_PUBLIC_DEFINE (mpn_scan0)
diff --git a/mpn/generic/scan1.c b/mpn/generic/scan1.c
index 9fb2446..99f42c4 100644
--- a/mpn/generic/scan1.c
+++ b/mpn/generic/scan1.c
@@ -17,9 +17,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* Argument constraints:
    1. U must sooner or later have a limb != 0.
@@ -47,3 +45,4 @@ mpn_scan1 (mp_srcptr up, mp_bitcnt_t starting_bit)
   count_trailing_zeros (cnt, alimb);
   return (p - up - 1) * GMP_NUMB_BITS + cnt;
 }
+__GMP_PUBLIC_DEFINE (mpn_scan1)
diff --git a/mpn/generic/set_str.c b/mpn/generic/set_str.c
index fd3c595..15693bd 100644
--- a/mpn/generic/set_str.c
+++ b/mpn/generic/set_str.c
@@ -53,9 +53,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
       cubes, not squares.
 */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 mp_size_t
 mpn_set_str (mp_ptr rp, const unsigned char *str, size_t str_len, int base)
@@ -123,6 +121,7 @@ mpn_set_str (mp_ptr rp, const unsigned char *str, size_t str_len, int base)
       return size;
     }
 }
+__GMP_PUBLIC_DEFINE (mpn_set_str)
 
 void
 mpn_set_str_compute_powtab (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un, int base)
@@ -205,6 +204,7 @@ mpn_set_str_compute_powtab (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un, i
       powtab[pi].shift = shift;
     }
 }
+__GMP_INTERN_DEFINE (mpn_set_str_compute_powtab)
 
 mp_size_t
 mpn_dc_set_str (mp_ptr rp, const unsigned char *str, size_t str_len,
@@ -263,6 +263,7 @@ mpn_dc_set_str (mp_ptr rp, const unsigned char *str, size_t str_len,
   n = hn + powtab->n + sn;
   return n - (rp[n - 1] == 0);
 }
+__GMP_INTERN_DEFINE (mpn_dc_set_str)
 
 mp_size_t
 mpn_bc_set_str (mp_ptr rp, const unsigned char *str, size_t str_len, int base)
@@ -361,3 +362,4 @@ mpn_bc_set_str (mp_ptr rp, const unsigned char *str, size_t str_len, int base)
     }
   return size;
 }
+__GMP_INTERN_DEFINE (mpn_bc_set_str)
diff --git a/mpn/generic/sqr.c b/mpn/generic/sqr.c
index 504dbfb..c85679b 100644
--- a/mpn/generic/sqr.c
+++ b/mpn/generic/sqr.c
@@ -18,9 +18,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 void
 mpn_sqr (mp_ptr p, mp_srcptr a, mp_size_t n)
@@ -86,3 +84,4 @@ mpn_sqr (mp_ptr p, mp_srcptr a, mp_size_t n)
       mpn_fft_mul (p, a, n, a, n);
     }
 }
+__GMP_PUBLIC_DEFINE (mpn_sqr)
diff --git a/mpn/generic/sqr_basecase.c b/mpn/generic/sqr_basecase.c
index 660ab4c..f752e80 100644
--- a/mpn/generic/sqr_basecase.c
+++ b/mpn/generic/sqr_basecase.c
@@ -23,9 +23,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 #if HAVE_NATIVE_mpn_sqr_diagonal
@@ -312,3 +310,5 @@ mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
     }
 }
 #endif
+
+__GMP_INTERN_DEFINE (mpn_sqr_basecase)
diff --git a/mpn/generic/sqrmod_bnm1.c b/mpn/generic/sqrmod_bnm1.c
index 824cb11..9badb5e 100644
--- a/mpn/generic/sqrmod_bnm1.c
+++ b/mpn/generic/sqrmod_bnm1.c
@@ -25,9 +25,7 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 /* Input is {ap,rn}; output is {rp,rn}, computation is
    mod B^rn - 1, and values are semi-normalised; zero is represented
@@ -280,6 +278,7 @@ mpn_sqrmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_ptr tp)
 #undef sp1
     }
 }
+__GMP_INTERN_DEFINE (mpn_sqrmod_bnm1)
 
 mp_size_t
 mpn_sqrmod_bnm1_next_size (mp_size_t n)
@@ -300,3 +299,4 @@ mpn_sqrmod_bnm1_next_size (mp_size_t n)
 
   return 2 * mpn_fft_next_size (nh, mpn_fft_best_k (nh, 1));
 }
+__GMP_INTERN_DEFINE (mpn_sqrmod_bnm1_next_size)
diff --git a/mpn/generic/sqrtrem.c b/mpn/generic/sqrtrem.c
index 57041c9..d91715b 100644
--- a/mpn/generic/sqrtrem.c
+++ b/mpn/generic/sqrtrem.c
@@ -29,13 +29,7 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 /* See "Karatsuba Square Root", reference in gmp.texi.  */
 
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 static const unsigned char invsqrttab[384] = /* The common 0x100 was removed */
 {
@@ -344,3 +338,4 @@ mpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr np, mp_size_t nn)
   TMP_FREE;
   return rn;
 }
+__GMP_PUBLIC_DEFINE (mpn_sqrtrem)
diff --git a/mpn/generic/sub.c b/mpn/generic/sub.c
index ada3e91..5dc6168 100644
--- a/mpn/generic/sub.c
+++ b/mpn/generic/sub.c
@@ -18,6 +18,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 #define __GMP_FORCE_mpn_sub 1
-
-#include "gmp.h"
 #include "gmp-impl.h"
+
+__GMP_PUBLIC_DEFINE (mpn_sub)
diff --git a/mpn/generic/sub_1.c b/mpn/generic/sub_1.c
index 4ed2eab..637761d 100644
--- a/mpn/generic/sub_1.c
+++ b/mpn/generic/sub_1.c
@@ -18,6 +18,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 #define __GMP_FORCE_mpn_sub_1 1
-
-#include "gmp.h"
 #include "gmp-impl.h"
+
+__GMP_PUBLIC_DEFINE (mpn_sub_1)
diff --git a/mpn/generic/sub_err1_n.c b/mpn/generic/sub_err1_n.c
index ea901bf..abde48a 100644
--- a/mpn/generic/sub_err1_n.c
+++ b/mpn/generic/sub_err1_n.c
@@ -23,7 +23,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /*
@@ -88,3 +87,4 @@ mpn_sub_err1_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
 
   return cy;
 }
+__GMP_INTERN_DEFINE (mpn_sub_err1_n)
diff --git a/mpn/generic/sub_err2_n.c b/mpn/generic/sub_err2_n.c
index 34c6198..e7c90b6 100644
--- a/mpn/generic/sub_err2_n.c
+++ b/mpn/generic/sub_err2_n.c
@@ -23,7 +23,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /*
@@ -104,3 +103,4 @@ mpn_sub_err2_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
 
   return cy;
 }
+__GMP_INTERN_DEFINE (mpn_sub_err2_n)
diff --git a/mpn/generic/sub_err3_n.c b/mpn/generic/sub_err3_n.c
index 72371ec..b4991f8 100644
--- a/mpn/generic/sub_err3_n.c
+++ b/mpn/generic/sub_err3_n.c
@@ -23,7 +23,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /*
@@ -119,3 +118,4 @@ mpn_sub_err3_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
 
   return cy;
 }
+__GMP_INTERN_DEFINE (mpn_sub_err3_n)
diff --git a/mpn/generic/sub_n.c b/mpn/generic/sub_n.c
index 3c2ed57..76782c9 100644
--- a/mpn/generic/sub_n.c
+++ b/mpn/generic/sub_n.c
@@ -18,7 +18,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -78,3 +77,5 @@ mpn_sub_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
 }
 
 #endif
+
+__GMP_PUBLIC_DEFINE (mpn_sub_n)
diff --git a/mpn/generic/subcnd_n.c b/mpn/generic/subcnd_n.c
index 89b7190..41b4a74 100644
--- a/mpn/generic/subcnd_n.c
+++ b/mpn/generic/subcnd_n.c
@@ -24,7 +24,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 mp_limb_t
@@ -60,3 +59,4 @@ mpn_subcnd_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t cnd)
 
   return cy;
 }
+__GMP_INTERN_DEFINE (mpn_subcnd_n)
diff --git a/mpn/generic/submul_1.c b/mpn/generic/submul_1.c
index 3e8e743..7608225 100644
--- a/mpn/generic/submul_1.c
+++ b/mpn/generic/submul_1.c
@@ -21,9 +21,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 #if GMP_NAIL_BITS == 0
@@ -127,3 +125,5 @@ mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
 }
 
 #endif
+
+__GMP_PUBLIC_DEFINE (mpn_submul_1)
diff --git a/mpn/generic/tabselect.c b/mpn/generic/tabselect.c
index 2ca9eb2..0017fab 100644
--- a/mpn/generic/tabselect.c
+++ b/mpn/generic/tabselect.c
@@ -20,7 +20,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -45,3 +44,4 @@ mpn_tabselect (volatile mp_limb_t *rp, volatile mp_limb_t *tab, mp_size_t n,
 	}
     }
 }
+__GMP_INTERN_DEFINE (mpn_tabselect)
diff --git a/mpn/generic/tdiv_qr.c b/mpn/generic/tdiv_qr.c
index 62d28a0..bca94d9 100644
--- a/mpn/generic/tdiv_qr.c
+++ b/mpn/generic/tdiv_qr.c
@@ -28,9 +28,7 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
 
 
 void
@@ -376,3 +374,4 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
       }
     }
 }
+__GMP_PUBLIC_DEFINE (mpn_tdiv_qr)
diff --git a/mpn/generic/toom22_mul.c b/mpn/generic/toom22_mul.c
index 36328d7..22fd4b8 100644
--- a/mpn/generic/toom22_mul.c
+++ b/mpn/generic/toom22_mul.c
@@ -25,7 +25,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Evaluate in: -1, 0, +inf
@@ -197,3 +196,4 @@ mpn_toom22_mul (mp_ptr pp,
   else
     mpn_decr_u (pp + 3 * n, 1);
 }
+__GMP_INTERN_DEFINE (mpn_toom22_mul)
diff --git a/mpn/generic/toom2_sqr.c b/mpn/generic/toom2_sqr.c
index 60ec5e4..a8f3707 100644
--- a/mpn/generic/toom2_sqr.c
+++ b/mpn/generic/toom2_sqr.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Evaluate in: -1, 0, +inf
@@ -133,3 +132,4 @@ mpn_toom2_sqr (mp_ptr pp,
   else
     mpn_decr_u (pp + 3 * n, 1);
 }
+__GMP_INTERN_DEFINE (mpn_toom2_sqr)
diff --git a/mpn/generic/toom32_mul.c b/mpn/generic/toom32_mul.c
index 77a4ca4..2cf8eff 100644
--- a/mpn/generic/toom32_mul.c
+++ b/mpn/generic/toom32_mul.c
@@ -29,7 +29,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Evaluate in: -1, 0, +1, +inf
@@ -310,3 +309,4 @@ mpn_toom32_mul (mp_ptr pp,
   else
     ASSERT (hi == 0);
 }
+__GMP_INTERN_DEFINE (mpn_toom32_mul)
diff --git a/mpn/generic/toom33_mul.c b/mpn/generic/toom33_mul.c
index 8efa57d..992a581 100644
--- a/mpn/generic/toom33_mul.c
+++ b/mpn/generic/toom33_mul.c
@@ -26,7 +26,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Evaluate in: -1, 0, +1, +2, +inf
@@ -303,3 +302,4 @@ mpn_toom33_mul (mp_ptr pp,
 
   mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + t, vm1_neg, vinf0);
 }
+__GMP_INTERN_DEFINE (mpn_toom33_mul)
diff --git a/mpn/generic/toom3_sqr.c b/mpn/generic/toom3_sqr.c
index 3d21851..c7528d7 100644
--- a/mpn/generic/toom3_sqr.c
+++ b/mpn/generic/toom3_sqr.c
@@ -25,7 +25,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Evaluate in: -1, 0, +1, +2, +inf
@@ -213,3 +212,4 @@ mpn_toom3_sqr (mp_ptr pp,
 
   mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + s, 0, vinf0);
 }
+__GMP_INTERN_DEFINE (mpn_toom3_sqr)
diff --git a/mpn/generic/toom42_mul.c b/mpn/generic/toom42_mul.c
index 138984e..e3c11f3 100644
--- a/mpn/generic/toom42_mul.c
+++ b/mpn/generic/toom42_mul.c
@@ -29,7 +29,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Evaluate in: -1, 0, +1, +2, +inf
@@ -221,3 +220,4 @@ mpn_toom42_mul (mp_ptr pp,
 
   TMP_FREE;
 }
+__GMP_INTERN_DEFINE (mpn_toom42_mul)
diff --git a/mpn/generic/toom42_mulmid.c b/mpn/generic/toom42_mulmid.c
index c77b00f..f089242 100644
--- a/mpn/generic/toom42_mulmid.c
+++ b/mpn/generic/toom42_mulmid.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -225,3 +224,4 @@ mpn_toom42_mulmid (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n,
       mpn_add_n (rp + n - 1, rp + n - 1, e, 3);
     }
 }
+__GMP_INTERN_DEFINE (mpn_toom42_mulmid)
diff --git a/mpn/generic/toom43_mul.c b/mpn/generic/toom43_mul.c
index 6723e29..fc7ba29 100644
--- a/mpn/generic/toom43_mul.c
+++ b/mpn/generic/toom43_mul.c
@@ -28,7 +28,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Evaluate in: -2, -1, 0, +1, +2, +inf
@@ -221,3 +220,4 @@ mpn_toom43_mul (mp_ptr pp,
 #undef b1
 #undef b2
 }
+__GMP_INTERN_DEFINE (mpn_toom43_mul)
diff --git a/mpn/generic/toom44_mul.c b/mpn/generic/toom44_mul.c
index c77e359..edc6ba2 100644
--- a/mpn/generic/toom44_mul.c
+++ b/mpn/generic/toom44_mul.c
@@ -25,7 +25,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Evaluate in: 0, +1, -1, +2, -2, 1/2, +inf
@@ -223,3 +222,4 @@ mpn_toom44_mul (mp_ptr pp,
 
   mpn_toom_interpolate_7pts (pp, n, flags, vm2, vm1, v2, vh, s + t, tp);
 }
+__GMP_INTERN_DEFINE (mpn_toom44_mul)
diff --git a/mpn/generic/toom4_sqr.c b/mpn/generic/toom4_sqr.c
index a97202d..65a13b2 100644
--- a/mpn/generic/toom4_sqr.c
+++ b/mpn/generic/toom4_sqr.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Evaluate in: -1, -1/2, 0, +1/2, +1, +2, +inf
@@ -151,3 +150,4 @@ mpn_toom4_sqr (mp_ptr pp,
 
   mpn_toom_interpolate_7pts (pp, n, (enum toom7_flags) 0, vm2, vm1, v2, vh, 2*s, tp);
 }
+__GMP_INTERN_DEFINE (mpn_toom4_sqr)
diff --git a/mpn/generic/toom52_mul.c b/mpn/generic/toom52_mul.c
index 24c4fdd..bdd87e3 100644
--- a/mpn/generic/toom52_mul.c
+++ b/mpn/generic/toom52_mul.c
@@ -28,7 +28,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Evaluate in: -2, -1, 0, +1, +2, +inf
@@ -244,3 +243,4 @@ mpn_toom52_mul (mp_ptr pp,
 #undef b2
 
 }
+__GMP_INTERN_DEFINE (mpn_toom52_mul)
diff --git a/mpn/generic/toom53_mul.c b/mpn/generic/toom53_mul.c
index d0a9ab4..516d42a 100644
--- a/mpn/generic/toom53_mul.c
+++ b/mpn/generic/toom53_mul.c
@@ -28,7 +28,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Evaluate in: 0, +1, -1, +2, -2, 1/2, +inf
@@ -318,3 +317,4 @@ mpn_toom53_mul (mp_ptr pp,
 
   TMP_FREE;
 }
+__GMP_INTERN_DEFINE (mpn_toom53_mul)
diff --git a/mpn/generic/toom54_mul.c b/mpn/generic/toom54_mul.c
index afda6c2..951a1c9 100644
--- a/mpn/generic/toom54_mul.c
+++ b/mpn/generic/toom54_mul.c
@@ -23,7 +23,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -130,3 +129,4 @@ mpn_toom54_mul (mp_ptr pp,
 #undef r8
 #undef ws
 }
+__GMP_INTERN_DEFINE (mpn_toom54_mul)
diff --git a/mpn/generic/toom62_mul.c b/mpn/generic/toom62_mul.c
index bf55c92..ce7bc11 100644
--- a/mpn/generic/toom62_mul.c
+++ b/mpn/generic/toom62_mul.c
@@ -28,7 +28,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Evaluate in:
@@ -298,3 +297,4 @@ mpn_toom62_mul (mp_ptr pp,
 
   TMP_FREE;
 }
+__GMP_INTERN_DEFINE (mpn_toom62_mul)
diff --git a/mpn/generic/toom63_mul.c b/mpn/generic/toom63_mul.c
index 9c21457..be67e6a 100644
--- a/mpn/generic/toom63_mul.c
+++ b/mpn/generic/toom63_mul.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Stores |{ap,n}-{bp,n}| in {rp,n}, returns the sign. */
@@ -219,3 +218,4 @@ mpn_toom63_mul (mp_ptr pp,
 #undef r8
 #undef ws
 }
+__GMP_INTERN_DEFINE (mpn_toom63_mul)
diff --git a/mpn/generic/toom6_sqr.c b/mpn/generic/toom6_sqr.c
index 9fd3a56..0219ab6 100644
--- a/mpn/generic/toom6_sqr.c
+++ b/mpn/generic/toom6_sqr.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -161,6 +160,7 @@ mpn_toom6_sqr  (mp_ptr pp, mp_srcptr ap, mp_size_t an, mp_ptr scratch)
 #undef r5
 
 }
+__GMP_INTERN_DEFINE (mpn_toom6_sqr)
 #undef TOOM6_SQR_REC
 #undef MAYBE_sqr_basecase
 #undef MAYBE_sqr_above_basecase
diff --git a/mpn/generic/toom6h_mul.c b/mpn/generic/toom6h_mul.c
index 7090e41..fc500d0 100644
--- a/mpn/generic/toom6h_mul.c
+++ b/mpn/generic/toom6h_mul.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -250,3 +249,5 @@ mpn_toom6h_mul   (mp_ptr pp,
 #undef MAYBE_mul_toom22
 #undef MAYBE_mul_toom33
 #undef MAYBE_mul_toom6h
+
+__GMP_INTERN_DEFINE (mpn_toom6h_mul)
diff --git a/mpn/generic/toom8_sqr.c b/mpn/generic/toom8_sqr.c
index d2208aa..af84cdd 100644
--- a/mpn/generic/toom8_sqr.c
+++ b/mpn/generic/toom8_sqr.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 #if GMP_NUMB_BITS < 29
@@ -213,3 +212,5 @@ mpn_toom8_sqr  (mp_ptr pp, mp_srcptr ap, mp_size_t an, mp_ptr scratch)
 #undef MAYBE_sqr_toom3
 #undef MAYBE_sqr_above_toom3
 #undef MAYBE_sqr_above_toom4
+
+__GMP_INTERN_DEFINE (mpn_toom8_sqr)
diff --git a/mpn/generic/toom8h_mul.c b/mpn/generic/toom8h_mul.c
index 2d8bddc..54bfaaa 100644
--- a/mpn/generic/toom8h_mul.c
+++ b/mpn/generic/toom8h_mul.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -293,3 +292,5 @@ mpn_toom8h_mul   (mp_ptr pp,
 #undef MAYBE_mul_toom33
 #undef MAYBE_mul_toom44
 #undef MAYBE_mul_toom8h
+
+__GMP_INTERN_DEFINE (mpn_toom8h_mul)
diff --git a/mpn/generic/toom_couple_handling.c b/mpn/generic/toom_couple_handling.c
index c347297..9baae9a 100644
--- a/mpn/generic/toom_couple_handling.c
+++ b/mpn/generic/toom_couple_handling.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Gets {pp,n} and (sign?-1:1)*{np,n}. Computes at once:
@@ -68,3 +67,4 @@ mpn_toom_couple_handling (mp_ptr pp, mp_size_t n, mp_ptr np,
   pp[n] = mpn_add_n (pp+off, pp+off, np, n-off);
   ASSERT_NOCARRY (mpn_add_1(pp+n, np+n-off, off, pp[n]) );
 }
+__GMP_INTERN_DEFINE (mpn_toom_couple_handling)
diff --git a/mpn/generic/toom_eval_dgr3_pm1.c b/mpn/generic/toom_eval_dgr3_pm1.c
index 6739506..10ea585 100644
--- a/mpn/generic/toom_eval_dgr3_pm1.c
+++ b/mpn/generic/toom_eval_dgr3_pm1.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 int
@@ -60,3 +59,4 @@ mpn_toom_eval_dgr3_pm1 (mp_ptr xp1, mp_ptr xm1,
 
   return neg;
 }
+__GMP_INTERN_DEFINE (mpn_toom_eval_dgr3_pm1)
diff --git a/mpn/generic/toom_eval_dgr3_pm2.c b/mpn/generic/toom_eval_dgr3_pm2.c
index 0148600..d29feeb 100644
--- a/mpn/generic/toom_eval_dgr3_pm2.c
+++ b/mpn/generic/toom_eval_dgr3_pm2.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Needs n+1 limbs of temporary storage. */
@@ -85,3 +84,4 @@ mpn_toom_eval_dgr3_pm2 (mp_ptr xp2, mp_ptr xm2,
 
   return neg;
 }
+__GMP_INTERN_DEFINE (mpn_toom_eval_dgr3_pm2)
diff --git a/mpn/generic/toom_eval_pm1.c b/mpn/generic/toom_eval_pm1.c
index 1c63efd..b12d463 100644
--- a/mpn/generic/toom_eval_pm1.c
+++ b/mpn/generic/toom_eval_pm1.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Evaluates a polynomial of degree k > 3, in the points +1 and -1. */
@@ -77,3 +76,4 @@ mpn_toom_eval_pm1 (mp_ptr xp1, mp_ptr xm1, unsigned k,
 
   return neg;
 }
+__GMP_INTERN_DEFINE (mpn_toom_eval_pm1)
diff --git a/mpn/generic/toom_eval_pm2.c b/mpn/generic/toom_eval_pm2.c
index 7f410d5..1573f36 100644
--- a/mpn/generic/toom_eval_pm2.c
+++ b/mpn/generic/toom_eval_pm2.c
@@ -23,7 +23,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* DO_addlsh2(d,a,b,n,cy) computes cy,{d,n} <- {a,n} + 4*(cy,{b,n}), it
@@ -116,5 +115,6 @@ mpn_toom_eval_pm2 (mp_ptr xp2, mp_ptr xm2, unsigned k,
 
   return neg;
 }
+__GMP_INTERN_DEFINE (mpn_toom_eval_pm2)
 
 #undef DO_addlsh2
diff --git a/mpn/generic/toom_eval_pm2exp.c b/mpn/generic/toom_eval_pm2exp.c
index 26c1edb..4e1a41d 100644
--- a/mpn/generic/toom_eval_pm2exp.c
+++ b/mpn/generic/toom_eval_pm2exp.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* Evaluates a polynomial of degree k > 2, in the points +2^shift and -2^shift. */
@@ -115,3 +114,4 @@ mpn_toom_eval_pm2exp (mp_ptr xp2, mp_ptr xm2, unsigned k,
 
   return neg;
 }
+__GMP_INTERN_DEFINE (mpn_toom_eval_pm2exp)
diff --git a/mpn/generic/toom_eval_pm2rexp.c b/mpn/generic/toom_eval_pm2rexp.c
index ecbe9a7..d7a8431 100644
--- a/mpn/generic/toom_eval_pm2rexp.c
+++ b/mpn/generic/toom_eval_pm2rexp.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 #if HAVE_NATIVE_mpn_addlsh_n
@@ -89,3 +88,4 @@ mpn_toom_eval_pm2rexp (mp_ptr rp, mp_ptr rm,
 
   return neg;
 }
+__GMP_INTERN_DEFINE (mpn_toom_eval_pm2rexp)
diff --git a/mpn/generic/toom_interpolate_12pts.c b/mpn/generic/toom_interpolate_12pts.c
index e4a765b..941b8eb 100644
--- a/mpn/generic/toom_interpolate_12pts.c
+++ b/mpn/generic/toom_interpolate_12pts.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 
@@ -348,3 +347,4 @@ mpn_toom_interpolate_12pts (mp_ptr pp, mp_ptr r1, mp_ptr r3, mp_ptr r5,
 #undef   r2
 #undef   r4
 }
+__GMP_INTERN_DEFINE (mpn_toom_interpolate_12pts)
diff --git a/mpn/generic/toom_interpolate_16pts.c b/mpn/generic/toom_interpolate_16pts.c
index 445479c..97cc11c 100644
--- a/mpn/generic/toom_interpolate_16pts.c
+++ b/mpn/generic/toom_interpolate_16pts.c
@@ -24,7 +24,6 @@ You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 #if GMP_NUMB_BITS < 29
@@ -514,3 +513,4 @@ mpn_toom_interpolate_16pts (mp_ptr pp, mp_ptr r1, mp_ptr r3, mp_ptr r5, mp_ptr r
 #undef   r4
 #undef   r6
 }
+__GMP_INTERN_DEFINE (mpn_toom_interpolate_16pts)
diff --git a/mpn/generic/toom_interpolate_5pts.c b/mpn/generic/toom_interpolate_5pts.c
index 8416b64..9255df6 100644
--- a/mpn/generic/toom_interpolate_5pts.c
+++ b/mpn/generic/toom_interpolate_5pts.c
@@ -25,7 +25,6 @@ for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 void
@@ -187,3 +186,4 @@ mpn_toom_interpolate_5pts (mp_ptr c, mp_ptr v2, mp_ptr vm1,
 
 #undef v0
 }
+__GMP_INTERN_DEFINE (mpn_toom_interpolate_5pts)
diff --git a/mpn/generic/toom_interpolate_6pts.c b/mpn/generic/toom_interpolate_6pts.c
index 542fb2a..d680524 100644
--- a/mpn/generic/toom_interpolate_6pts.c
+++ b/mpn/generic/toom_interpolate_6pts.c
@@ -23,7 +23,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 /* For odd divisors, mpn_divexact_1 works fine with two's complement. */
@@ -227,3 +226,4 @@ mpn_toom_interpolate_6pts (mp_ptr pp, mp_size_t n, enum toom6_flags flags,
 #undef w0
 
 }
+__GMP_INTERN_DEFINE (mpn_toom_interpolate_6pts)
diff --git a/mpn/generic/toom_interpolate_7pts.c b/mpn/generic/toom_interpolate_7pts.c
index 95a2194..2c3e827 100644
--- a/mpn/generic/toom_interpolate_7pts.c
+++ b/mpn/generic/toom_interpolate_7pts.c
@@ -24,7 +24,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 #define BINVERT_3 MODLIMB_INVERSE_3
@@ -253,3 +252,4 @@ mpn_toom_interpolate_7pts (mp_ptr rp, mp_size_t n, enum toom7_flags flags,
 #endif
     }
 }
+__GMP_INTERN_DEFINE (mpn_toom_interpolate_7pts)
diff --git a/mpn/generic/toom_interpolate_8pts.c b/mpn/generic/toom_interpolate_8pts.c
index 8e9825a..2b00e79 100644
--- a/mpn/generic/toom_interpolate_8pts.c
+++ b/mpn/generic/toom_interpolate_8pts.c
@@ -23,7 +23,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 #define BINVERT_3 MODLIMB_INVERSE_3
@@ -199,3 +198,4 @@ mpn_toom_interpolate_8pts (mp_ptr pp, mp_size_t n,
   else
     ASSERT (r3[3*n] | cy == 0);
 }
+__GMP_INTERN_DEFINE (mpn_toom_interpolate_8pts)
diff --git a/mpn/generic/trialdiv.c b/mpn/generic/trialdiv.c
index e61bc69..df08b78 100644
--- a/mpn/generic/trialdiv.c
+++ b/mpn/generic/trialdiv.c
@@ -43,7 +43,6 @@ along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
                     of the return value.
 */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 struct gmp_primes_dtab {
@@ -105,3 +104,4 @@ mpn_trialdiv (mp_srcptr tp, mp_size_t tn, mp_size_t nprimes, int *where)
     }
   return 0;
 }
+__GMP_INTERN_DEFINE (mpn_trialdiv)
diff --git a/mpn/generic/udiv_w_sdiv.c b/mpn/generic/udiv_w_sdiv.c
index f1353c6..fae7367 100644
--- a/mpn/generic/udiv_w_sdiv.c
+++ b/mpn/generic/udiv_w_sdiv.c
@@ -26,9 +26,8 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
-#include "longlong.h"
+
 
 mp_limb_t
 mpn_udiv_w_sdiv (mp_limb_t *rp, mp_limb_t a1, mp_limb_t a0, mp_limb_t d)
@@ -129,3 +128,4 @@ mpn_udiv_w_sdiv (mp_limb_t *rp, mp_limb_t a1, mp_limb_t a0, mp_limb_t d)
   *rp = r;
   return q;
 }
+__GMP_INTERN_DEFINE (mpn_udiv_w_sdiv)
diff --git a/mpn/generic/zero.c b/mpn/generic/zero.c
index 4f12b00..d08ef29 100644
--- a/mpn/generic/zero.c
+++ b/mpn/generic/zero.c
@@ -17,7 +17,6 @@ License for more details.
 You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
 
-#include "gmp.h"
 #include "gmp-impl.h"
 
 void
@@ -29,3 +28,4 @@ mpn_zero (mp_ptr rp, mp_size_t n)
   for (i = -n; i != 0; i++)
     rp[i] = 0;
 }
+__GMP_PUBLIC_DEFINE (mpn_zero)
-- 
1.8.1.2



More information about the gmp-devel mailing list