diff --git a/Modules/_decimal/libmpdec/basearith.h b/Modules/_decimal/libmpdec/basearith.h --- a/Modules/_decimal/libmpdec/basearith.h +++ b/Modules/_decimal/libmpdec/basearith.h @@ -35,6 +35,7 @@ #include "typearith.h" +_Pragma(MPD_VISIBILITY_HIDDEN_START) mpd_uint_t _mpd_baseadd(mpd_uint_t *w, const mpd_uint_t *u, const mpd_uint_t *v, mpd_size_t m, mpd_size_t n); void _mpd_baseaddto(mpd_uint_t *w, const mpd_uint_t *u, mpd_size_t n); @@ -207,6 +208,7 @@ } return 1; } +_Pragma(MPD_VISIBILITY_HIDDEN_END) #endif /* BASEARITH_H */ diff --git a/Modules/_decimal/libmpdec/constants.h b/Modules/_decimal/libmpdec/constants.h --- a/Modules/_decimal/libmpdec/constants.h +++ b/Modules/_decimal/libmpdec/constants.h @@ -60,6 +60,7 @@ #define SIZE3_NTT(x0, x1, x2, w3table) std_size3_ntt(x0, x1, x2, w3table, umod) #endif +_Pragma(MPD_VISIBILITY_HIDDEN_START) /* PentiumPro (or later) gcc inline asm */ extern const float MPD_TWO63; extern const uint32_t mpd_invmoduli[3][3]; @@ -75,6 +76,7 @@ extern const mpd_uint_t INV_P1P2_MOD_P3; extern const mpd_uint_t LH_P1P2; extern const mpd_uint_t UH_P1P2; +_Pragma(MPD_VISIBILITY_HIDDEN_END) #endif /* CONSTANTS_H */ diff --git a/Modules/_decimal/libmpdec/convolute.h b/Modules/_decimal/libmpdec/convolute.h --- a/Modules/_decimal/libmpdec/convolute.h +++ b/Modules/_decimal/libmpdec/convolute.h @@ -36,8 +36,10 @@ #define SIX_STEP_THRESHOLD 4096 +_Pragma(MPD_VISIBILITY_HIDDEN_START) int fnt_convolute(mpd_uint_t *c1, mpd_uint_t *c2, mpd_size_t n, int modnum); int fnt_autoconvolute(mpd_uint_t *c1, mpd_size_t n, int modnum); +_Pragma(MPD_VISIBILITY_HIDDEN_END) #endif diff --git a/Modules/_decimal/libmpdec/crt.h b/Modules/_decimal/libmpdec/crt.h --- a/Modules/_decimal/libmpdec/crt.h +++ b/Modules/_decimal/libmpdec/crt.h @@ -34,7 +34,9 @@ #include +_Pragma(MPD_VISIBILITY_HIDDEN_START) void crt3(mpd_uint_t *x1, mpd_uint_t *x2, mpd_uint_t *x3, mpd_size_t nmemb); +_Pragma(MPD_VISIBILITY_HIDDEN_END) #endif diff --git a/Modules/_decimal/libmpdec/difradix2.h b/Modules/_decimal/libmpdec/difradix2.h --- a/Modules/_decimal/libmpdec/difradix2.h +++ b/Modules/_decimal/libmpdec/difradix2.h @@ -35,7 +35,9 @@ #include "numbertheory.h" +_Pragma(MPD_VISIBILITY_HIDDEN_START) void fnt_dif2(mpd_uint_t a[], mpd_size_t n, struct fnt_params *tparams); +_Pragma(MPD_VISIBILITY_HIDDEN_END) #endif diff --git a/Modules/_decimal/libmpdec/fnt.h b/Modules/_decimal/libmpdec/fnt.h --- a/Modules/_decimal/libmpdec/fnt.h +++ b/Modules/_decimal/libmpdec/fnt.h @@ -34,8 +34,10 @@ #include +_Pragma(MPD_VISIBILITY_HIDDEN_START) int std_fnt(mpd_uint_t a[], mpd_size_t n, int modnum); int std_inv_fnt(mpd_uint_t a[], mpd_size_t n, int modnum); +_Pragma(MPD_VISIBILITY_HIDDEN_END) #endif diff --git a/Modules/_decimal/libmpdec/fourstep.h b/Modules/_decimal/libmpdec/fourstep.h --- a/Modules/_decimal/libmpdec/fourstep.h +++ b/Modules/_decimal/libmpdec/fourstep.h @@ -34,8 +34,10 @@ #include +_Pragma(MPD_VISIBILITY_HIDDEN_START) int four_step_fnt(mpd_uint_t *a, mpd_size_t n, int modnum); int inv_four_step_fnt(mpd_uint_t *a, mpd_size_t n, int modnum); +_Pragma(MPD_VISIBILITY_HIDDEN_END) #endif diff --git a/Modules/_decimal/libmpdec/io.c b/Modules/_decimal/libmpdec/io.c --- a/Modules/_decimal/libmpdec/io.c +++ b/Modules/_decimal/libmpdec/io.c @@ -741,6 +741,7 @@ return -1; } +_Pragma(MPD_VISIBILITY_HIDDEN_START) int mpd_validate_lconv(mpd_spec_t *spec) { @@ -763,6 +764,7 @@ return 0; } +_Pragma(MPD_VISIBILITY_HIDDEN_END) int mpd_parse_fmt_str(mpd_spec_t *spec, const char *fmt, int caps) diff --git a/Modules/_decimal/libmpdec/mpdecimal.c b/Modules/_decimal/libmpdec/mpdecimal.c --- a/Modules/_decimal/libmpdec/mpdecimal.c +++ b/Modules/_decimal/libmpdec/mpdecimal.c @@ -5008,6 +5008,7 @@ mpd_qfinalize(result, ctx, status); } +_Pragma(MPD_VISIBILITY_HIDDEN_START) /* Minimum space needed for the result array in _karatsuba_rec(). */ static inline mpd_size_t _kmul_resultsize(mpd_size_t la, mpd_size_t lb) @@ -5463,6 +5464,7 @@ if (w) mpd_free(w); return result; } +_Pragma(MPD_VISIBILITY_HIDDEN_END) /* Deal with the special cases of multiplying infinities. */ diff --git a/Modules/_decimal/libmpdec/mpdecimal.h b/Modules/_decimal/libmpdec/mpdecimal.h --- a/Modules/_decimal/libmpdec/mpdecimal.h +++ b/Modules/_decimal/libmpdec/mpdecimal.h @@ -46,6 +46,10 @@ #include #include +#ifndef _Pragma + #define _Pragma(x) +#endif + #ifdef _MSC_VER #include "vccompat.h" #ifndef UNUSED @@ -64,8 +68,12 @@ #endif #if defined(__GNUC__) && !defined(__INTEL_COMPILER) #define UNUSED __attribute__((unused)) + #define MPD_VISIBILITY_HIDDEN_START "GCC visibility push(hidden)" + #define MPD_VISIBILITY_HIDDEN_END "GCC visibility pop" #else #define UNUSED + #define MPD_VISIBILITY_HIDDEN_START "" + #define MPD_VISIBILITY_HIDDEN_END "" #endif #define EXTINLINE #endif diff --git a/Modules/_decimal/libmpdec/numbertheory.h b/Modules/_decimal/libmpdec/numbertheory.h --- a/Modules/_decimal/libmpdec/numbertheory.h +++ b/Modules/_decimal/libmpdec/numbertheory.h @@ -43,9 +43,11 @@ }; +_Pragma(MPD_VISIBILITY_HIDDEN_START) mpd_uint_t _mpd_getkernel(mpd_uint_t n, int sign, int modnum); struct fnt_params *_mpd_init_fnt_params(mpd_size_t n, int sign, int modnum); void _mpd_init_w3table(mpd_uint_t w3table[3], int sign, int modnum); +_Pragma(MPD_VISIBILITY_HIDDEN_END) #ifdef PPRO diff --git a/Modules/_decimal/libmpdec/sixstep.h b/Modules/_decimal/libmpdec/sixstep.h --- a/Modules/_decimal/libmpdec/sixstep.h +++ b/Modules/_decimal/libmpdec/sixstep.h @@ -34,8 +34,10 @@ #include +_Pragma(MPD_VISIBILITY_HIDDEN_START) int six_step_fnt(mpd_uint_t *a, mpd_size_t n, int modnum); int inv_six_step_fnt(mpd_uint_t *a, mpd_size_t n, int modnum); +_Pragma(MPD_VISIBILITY_HIDDEN_END) #endif diff --git a/Modules/_decimal/libmpdec/transpose.h b/Modules/_decimal/libmpdec/transpose.h --- a/Modules/_decimal/libmpdec/transpose.h +++ b/Modules/_decimal/libmpdec/transpose.h @@ -37,9 +37,11 @@ enum {FORWARD_CYCLE, BACKWARD_CYCLE}; +_Pragma(MPD_VISIBILITY_HIDDEN_START) void std_trans(mpd_uint_t dest[], mpd_uint_t src[], mpd_size_t rows, mpd_size_t cols); int transpose_pow2(mpd_uint_t *matrix, mpd_size_t rows, mpd_size_t cols); void transpose_3xpow2(mpd_uint_t *matrix, mpd_size_t rows, mpd_size_t cols); +_Pragma(MPD_VISIBILITY_HIDDEN_END) static inline void pointerswap(mpd_uint_t **a, mpd_uint_t **b)