Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fdf1a34

Browse files
author
Stefan Krah
committed
Issue #16745: Hide symbols in _decimal.so.
1 parent fb7f580 commit fdf1a34

12 files changed

Lines changed: 95 additions & 1 deletion

File tree

Modules/_decimal/libmpdec/basearith.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
#include "typearith.h"
3636

3737

38+
/* Internal header file: all symbols have local scope in the DSO */
39+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
40+
41+
3842
mpd_uint_t _mpd_baseadd(mpd_uint_t *w, const mpd_uint_t *u, const mpd_uint_t *v,
3943
mpd_size_t m, mpd_size_t n);
4044
void _mpd_baseaddto(mpd_uint_t *w, const mpd_uint_t *u, mpd_size_t n);
@@ -209,6 +213,9 @@ _mpd_isallnine(const mpd_uint_t *data, mpd_ssize_t len)
209213
}
210214

211215

216+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
217+
218+
212219
#endif /* BASEARITH_H */
213220

214221

Modules/_decimal/libmpdec/constants.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#include "mpdecimal.h"
3434

3535

36+
/* Internal header file: all symbols have local scope in the DSO */
37+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
38+
39+
3640
/* choice of optimized functions */
3741
#if defined(CONFIG_64)
3842
/* x64 */
@@ -77,6 +81,9 @@ extern const mpd_uint_t LH_P1P2;
7781
extern const mpd_uint_t UH_P1P2;
7882

7983

84+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
85+
86+
8087
#endif /* CONSTANTS_H */
8188

8289

Modules/_decimal/libmpdec/convolute.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,18 @@
3333
#include "mpdecimal.h"
3434
#include <stdio.h>
3535

36-
#define SIX_STEP_THRESHOLD 4096
3736

37+
/* Internal header file: all symbols have local scope in the DSO */
38+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
39+
40+
41+
#define SIX_STEP_THRESHOLD 4096
3842

3943
int fnt_convolute(mpd_uint_t *c1, mpd_uint_t *c2, mpd_size_t n, int modnum);
4044
int fnt_autoconvolute(mpd_uint_t *c1, mpd_size_t n, int modnum);
4145

4246

47+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
48+
49+
4350
#endif

Modules/_decimal/libmpdec/crt.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@
3434
#include <stdio.h>
3535

3636

37+
/* Internal header file: all symbols have local scope in the DSO */
38+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
39+
40+
3741
void crt3(mpd_uint_t *x1, mpd_uint_t *x2, mpd_uint_t *x3, mpd_size_t nmemb);
3842

3943

44+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
45+
46+
4047
#endif

Modules/_decimal/libmpdec/difradix2.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@
3535
#include "numbertheory.h"
3636

3737

38+
/* Internal header file: all symbols have local scope in the DSO */
39+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
40+
41+
3842
void fnt_dif2(mpd_uint_t a[], mpd_size_t n, struct fnt_params *tparams);
3943

4044

45+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
46+
47+
4148
#endif

Modules/_decimal/libmpdec/fnt.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,16 @@
3434
#include <stdio.h>
3535

3636

37+
/* Internal header file: all symbols have local scope in the DSO */
38+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
39+
40+
3741
int std_fnt(mpd_uint_t a[], mpd_size_t n, int modnum);
3842
int std_inv_fnt(mpd_uint_t a[], mpd_size_t n, int modnum);
3943

4044

45+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
46+
47+
4148
#endif
4249

Modules/_decimal/libmpdec/fourstep.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,15 @@
3434
#include <stdio.h>
3535

3636

37+
/* Internal header file: all symbols have local scope in the DSO */
38+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
39+
40+
3741
int four_step_fnt(mpd_uint_t *a, mpd_size_t n, int modnum);
3842
int inv_four_step_fnt(mpd_uint_t *a, mpd_size_t n, int modnum);
3943

4044

45+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
46+
47+
4148
#endif

Modules/_decimal/libmpdec/memory.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,18 @@
3333
#include "mpdecimal.h"
3434

3535

36+
/* Internal header file: all symbols have local scope in the DSO */
37+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
38+
39+
3640
int mpd_switch_to_dyn(mpd_t *result, mpd_ssize_t size, uint32_t *status);
3741
int mpd_switch_to_dyn_zero(mpd_t *result, mpd_ssize_t size, uint32_t *status);
3842
int mpd_realloc_dyn(mpd_t *result, mpd_ssize_t size, uint32_t *status);
3943

4044

45+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
46+
47+
4148
#endif
4249

4350

Modules/_decimal/libmpdec/mpdecimal.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,24 @@ extern "C" {
6767
#else
6868
#define UNUSED
6969
#endif
70+
#if defined(__GNUC__) && __GNUC__ >= 4 && !defined(__INTEL_COMPILER)
71+
#define MPD_PRAGMA(x) _Pragma(x)
72+
#define MPD_HIDE_SYMBOLS_START "GCC visibility push(hidden)"
73+
#define MPD_HIDE_SYMBOLS_END "GCC visibility pop"
74+
#else
75+
#define MPD_PRAGMA(x)
76+
#define MPD_HIDE_SYMBOLS_START
77+
#define MPD_HIDE_SYMBOLS_END
78+
#endif
7079
#define EXTINLINE
7180
#endif
7281

7382

83+
/* This header file is internal for the purpose of building _decimal.so.
84+
* All symbols should have local scope in the DSO. */
85+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
86+
87+
7488
#if !defined(LEGACY_COMPILER)
7589
#if !defined(UINT64_MAX)
7690
/* The following #error is just a warning. If the compiler indeed does
@@ -789,6 +803,9 @@ int mpd_resize(mpd_t *result, mpd_ssize_t size, mpd_context_t *ctx);
789803
int mpd_resize_zero(mpd_t *result, mpd_ssize_t size, mpd_context_t *ctx);
790804

791805

806+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
807+
808+
792809
#ifdef __cplusplus
793810
} /* END extern "C" */
794811
#endif

Modules/_decimal/libmpdec/numbertheory.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
#include "mpdecimal.h"
3535

3636

37+
/* Internal header file: all symbols have local scope in the DSO */
38+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_START)
39+
40+
3741
/* transform parameters */
3842
struct fnt_params {
3943
int modnum;
@@ -66,6 +70,9 @@ std_setmodulus(int modnum, mpd_uint_t *umod)
6670
#endif
6771

6872

73+
MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */
74+
75+
6976
#endif
7077

7178

0 commit comments

Comments
 (0)