Introduce SECP256K1_LOCAL_VAR macro
This change makes the `-fvisibility=hidden` compiler option unnecessary.
This commit is contained in:
@@ -47,6 +47,7 @@ noinst_HEADERS += src/assumptions.h
|
||||
noinst_HEADERS += src/checkmem.h
|
||||
noinst_HEADERS += src/testutil.h
|
||||
noinst_HEADERS += src/util.h
|
||||
noinst_HEADERS += src/util_local_visibility.h
|
||||
noinst_HEADERS += src/int128.h
|
||||
noinst_HEADERS += src/int128_impl.h
|
||||
noinst_HEADERS += src/int128_native.h
|
||||
|
||||
@@ -13,6 +13,8 @@ extern "C" {
|
||||
|
||||
#include "ecmult.h"
|
||||
#include "group.h"
|
||||
#include "util_local_visibility.h"
|
||||
|
||||
#if defined(EXHAUSTIVE_TEST_ORDER)
|
||||
# if EXHAUSTIVE_TEST_ORDER == 7
|
||||
# define WINDOW_G 3
|
||||
@@ -27,8 +29,8 @@ static secp256k1_ge_storage secp256k1_pre_g[ECMULT_TABLE_SIZE(WINDOW_G)];
|
||||
static secp256k1_ge_storage secp256k1_pre_g_128[ECMULT_TABLE_SIZE(WINDOW_G)];
|
||||
#else /* !defined(EXHAUSTIVE_TEST_ORDER) */
|
||||
# define WINDOW_G ECMULT_WINDOW_SIZE
|
||||
extern const secp256k1_ge_storage secp256k1_pre_g[ECMULT_TABLE_SIZE(WINDOW_G)];
|
||||
extern const secp256k1_ge_storage secp256k1_pre_g_128[ECMULT_TABLE_SIZE(WINDOW_G)];
|
||||
SECP256K1_LOCAL_VAR const secp256k1_ge_storage secp256k1_pre_g[ECMULT_TABLE_SIZE(WINDOW_G)];
|
||||
SECP256K1_LOCAL_VAR const secp256k1_ge_storage secp256k1_pre_g_128[ECMULT_TABLE_SIZE(WINDOW_G)];
|
||||
#endif /* defined(EXHAUSTIVE_TEST_ORDER) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -13,10 +13,12 @@ extern "C" {
|
||||
|
||||
#include "group.h"
|
||||
#include "ecmult_gen.h"
|
||||
#include "util_local_visibility.h"
|
||||
|
||||
#ifdef EXHAUSTIVE_TEST_ORDER
|
||||
static secp256k1_ge_storage secp256k1_ecmult_gen_prec_table[COMB_BLOCKS][COMB_POINTS];
|
||||
#else
|
||||
extern const secp256k1_ge_storage secp256k1_ecmult_gen_prec_table[COMB_BLOCKS][COMB_POINTS];
|
||||
SECP256K1_LOCAL_VAR const secp256k1_ge_storage secp256k1_ecmult_gen_prec_table[COMB_BLOCKS][COMB_POINTS];
|
||||
#endif /* defined(EXHAUSTIVE_TEST_ORDER) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
12
src/util_local_visibility.h
Normal file
12
src/util_local_visibility.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef SECP256K1_LOCAL_VISIBILITY_H
|
||||
#define SECP256K1_LOCAL_VISIBILITY_H
|
||||
|
||||
/* Global variable visibility */
|
||||
/* See: https://github.com/bitcoin-core/secp256k1/issues/1181 */
|
||||
#if !defined(_WIN32) && defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
# define SECP256K1_LOCAL_VAR extern __attribute__ ((visibility ("hidden")))
|
||||
#else
|
||||
# define SECP256K1_LOCAL_VAR extern
|
||||
#endif
|
||||
|
||||
#endif /* SECP256K1_LOCAL_VISIBILITY_H */
|
||||
Reference in New Issue
Block a user