Make default symbol visibility to hidden with explicit public visibility specified.

Add missing static scope to a few more places.
This commit is contained in:
Moinak Ghosh 2013-06-03 20:51:00 +05:30
parent c859cf35d5
commit 7743792018
7 changed files with 26 additions and 18 deletions

1
.gitignore vendored
View file

@ -4,6 +4,7 @@ files.lst
*.o *.o
*.so *.so
pcompress pcompress
libpcompress*
Makefile Makefile
test.log test.log
test/datafiles test/datafiles

View file

@ -215,8 +215,8 @@ DEBUG_CPPFLAGS = $(COMMON_CPPFLAGS)
DEBUG_FPTR_FLAG = DEBUG_FPTR_FLAG =
RELEASE_LINK = g++ -pthread @LIBBSCGEN_OPT@ @EXTRA_OPT_FLAGS@ -fopenmp -fPIC RELEASE_LINK = g++ -pthread @LIBBSCGEN_OPT@ @EXTRA_OPT_FLAGS@ -fopenmp -fPIC
RELEASE_COMPILE = gcc -c @EXTRA_OPT_FLAGS@ -fPIC RELEASE_COMPILE = gcc -c @EXTRA_OPT_FLAGS@ -fPIC -fvisibility=hidden
RELEASE_COMPILE_cpp = g++ -c @EXTRA_OPT_FLAGS@ -fPIC RELEASE_COMPILE_cpp = g++ -c @EXTRA_OPT_FLAGS@ -fPIC -fvisibility=hidden
RELEASE_VEC_FLAGS = $(COMMON_VEC_FLAGS) RELEASE_VEC_FLAGS = $(COMMON_VEC_FLAGS)
RELEASE_LOOP_OPTFLAGS = $(COMMON_LOOP_OPTFLAGS) RELEASE_LOOP_OPTFLAGS = $(COMMON_LOOP_OPTFLAGS)
RELEASE_CPPFLAGS = $(COMMON_CPPFLAGS) -DNDEBUG RELEASE_CPPFLAGS = $(COMMON_CPPFLAGS) -DNDEBUG

View file

@ -78,7 +78,7 @@ static void * writer_thread(void *dat);
static int init_algo(pc_ctx_t *pctx, const char *algo, int bail); static int init_algo(pc_ctx_t *pctx, const char *algo, int bail);
extern uint32_t lzma_crc32(const uint8_t *buf, uint64_t size, uint32_t crc); extern uint32_t lzma_crc32(const uint8_t *buf, uint64_t size, uint32_t crc);
void void DLL_EXPORT
usage(pc_ctx_t *pctx) usage(pc_ctx_t *pctx)
{ {
fprintf(stderr, fprintf(stderr,
@ -686,7 +686,7 @@ cont:
*/ */
#define UNCOMP_BAIL err = 1; goto uncomp_done #define UNCOMP_BAIL err = 1; goto uncomp_done
int int DLL_EXPORT
start_decompress(pc_ctx_t *pctx, const char *filename, const char *to_filename) start_decompress(pc_ctx_t *pctx, const char *filename, const char *to_filename)
{ {
char algorithm[ALGO_SZ]; char algorithm[ALGO_SZ];
@ -1689,7 +1689,7 @@ do_cancel:
*/ */
#define COMP_BAIL err = 1; goto comp_done #define COMP_BAIL err = 1; goto comp_done
int int DLL_EXPORT
start_compress(pc_ctx_t *pctx, const char *filename, uint64_t chunksize, int level) start_compress(pc_ctx_t *pctx, const char *filename, uint64_t chunksize, int level)
{ {
struct wdata w; struct wdata w;
@ -2516,7 +2516,7 @@ init_algo(pc_ctx_t *pctx, const char *algo, int bail)
/* /*
* Pcompress context handling functions. * Pcompress context handling functions.
*/ */
pc_ctx_t * pc_ctx_t DLL_EXPORT *
create_pc_context(void) create_pc_context(void)
{ {
pc_ctx_t *ctx = (pc_ctx_t *)malloc(sizeof (pc_ctx_t)); pc_ctx_t *ctx = (pc_ctx_t *)malloc(sizeof (pc_ctx_t));
@ -2537,7 +2537,7 @@ create_pc_context(void)
return (ctx); return (ctx);
} }
void void DLL_EXPORT
destroy_pc_context(pc_ctx_t *pctx) destroy_pc_context(pc_ctx_t *pctx)
{ {
if (pctx->do_compress) if (pctx->do_compress)
@ -2549,7 +2549,7 @@ destroy_pc_context(pc_ctx_t *pctx)
slab_cleanup(pctx->hide_mem_stats); slab_cleanup(pctx->hide_mem_stats);
} }
int int DLL_EXPORT
init_pc_context_argstr(pc_ctx_t *pctx, char *args) init_pc_context_argstr(pc_ctx_t *pctx, char *args)
{ {
int ac; int ac;
@ -2568,7 +2568,7 @@ init_pc_context_argstr(pc_ctx_t *pctx, char *args)
return (0); return (0);
} }
int int DLL_EXPORT
init_pc_context(pc_ctx_t *pctx, int argc, char *argv[]) init_pc_context(pc_ctx_t *pctx, int argc, char *argv[])
{ {
int opt, num_rem, err, my_optind; int opt, num_rem, err, my_optind;
@ -2859,7 +2859,7 @@ init_pc_context(pc_ctx_t *pctx, int argc, char *argv[])
return (0); return (0);
} }
int int DLL_EXPORT
start_pcompress(pc_ctx_t *pctx) start_pcompress(pc_ctx_t *pctx)
{ {
int err; int err;
@ -2877,7 +2877,7 @@ start_pcompress(pc_ctx_t *pctx)
/* /*
* Setter functions for various parameters in the context. * Setter functions for various parameters in the context.
*/ */
void void DLL_EXPORT
pc_set_userpw(pc_ctx_t *pctx, unsigned char *pwdata, int pwlen) pc_set_userpw(pc_ctx_t *pctx, unsigned char *pwdata, int pwlen)
{ {
pctx->user_pw = pwdata; pctx->user_pw = pwdata;

View file

@ -34,7 +34,7 @@
/* /*
* PPMd model order to working set memory size mappings. * PPMd model order to working set memory size mappings.
*/ */
unsigned int ppmd8_mem_sz[] = { static unsigned int ppmd8_mem_sz[] = {
(16 << 20), (16 << 20),
(16 << 20), (16 << 20),
(32 << 20), (32 << 20),

View file

@ -62,7 +62,7 @@
#define XOP_FLAG 0x800 #define XOP_FLAG 0x800
#define AES_FLAG 0x2000000 #define AES_FLAG 0x2000000
void static void
exec_cpuid(uint32_t *regs) exec_cpuid(uint32_t *regs)
{ {
#ifdef __GNUC__ #ifdef __GNUC__

View file

@ -93,7 +93,6 @@ struct cpu_raw_data_t {
char vendor_str[VENDOR_STR_MAX]; char vendor_str[VENDOR_STR_MAX];
}; };
void exec_cpuid(uint32_t *regs);
void cpuid_get_raw_data(struct cpu_raw_data_t* data); void cpuid_get_raw_data(struct cpu_raw_data_t* data);
void cpuid_basic_identify(processor_info_t *pc); void cpuid_basic_identify(processor_info_t *pc);

View file

@ -134,6 +134,14 @@ typedef int32_t bsize_t;
# endif # endif
#endif #endif
#ifdef __GNUC__
#define DLL_EXPORT __attribute__ ((visibility ("default")))
#define DLL_LOCAL __attribute__ ((visibility ("hidden")))
#else
#define DLL_EXPORT
#define DLL_LOCAL
#endif
#define ISP2(x) ((x != 0) && ((x & (~x + 1)) == x)) #define ISP2(x) ((x != 0) && ((x & (~x + 1)) == x))
#ifdef DEBUG_STATS #ifdef DEBUG_STATS