The shared library should only make the functions and variable visible that are actually part of the interfaces to the outside world. Anything that is visible to the outside could potentially be used (or abused) by code linking with the library. Making the internal functions and variables hidden gives more flexibility to change how the code is implemented and improves portability. --- lib/pfmlib_amd64.c | 7 ++++++- lib/pfmlib_amd64_priv.h | 5 +++++ lib/pfmlib_arm_priv.h | 4 ++++ lib/pfmlib_cell_priv.h | 4 ++++ lib/pfmlib_ia64_priv.h | 5 +++++ lib/pfmlib_intel_netburst_priv.h | 4 ++++ lib/pfmlib_intel_snbep_unc.c | 4 ++++ lib/pfmlib_intel_snbep_unc_priv.h | 4 ++++ lib/pfmlib_intel_x86_perf_event.c | 4 ++++ lib/pfmlib_intel_x86_priv.h | 4 ++++ lib/pfmlib_itanium2_priv.h | 4 ++++ lib/pfmlib_itanium_priv.h | 4 ++++ lib/pfmlib_mips_priv.h | 4 ++++ lib/pfmlib_montecito_priv.h | 4 ++++ lib/pfmlib_powerpc_perf_event.c | 4 ++++ lib/pfmlib_priv.h | 4 ++++ lib/pfmlib_s390x_priv.h | 4 ++++ lib/pfmlib_sicortex_priv.h | 6 ++++++ lib/pfmlib_sparc_priv.h | 5 +++++ 19 files changed, 83 insertions(+), 1 deletion(-)
diff --git a/lib/pfmlib_amd64.c b/lib/pfmlib_amd64.c index 1383804..0bbbee2 100644 --- a/lib/pfmlib_amd64.c +++ b/lib/pfmlib_amd64.c @@ -34,6 +34,8 @@ #include "pfmlib_priv.h" /* library private */ #include "pfmlib_amd64_priv.h" /* architecture private */ +#pragma GCC visibility push(hidden) + const pfmlib_attr_desc_t amd64_mods[]={ PFM_ATTR_B("k", "monitor at priv level 0"), /* monitor priv level 0 */ PFM_ATTR_B("u", "monitor at priv level 1, 2, 3"), /* monitor priv level 1, 2, 3 */ @@ -278,7 +280,8 @@ amd64_attr2mod(void *this, int pidx, int attr_idx) return x; } -void amd64_display_reg(void *this, pfmlib_event_desc_t *e, pfm_amd64_reg_t reg) +static void +amd64_display_reg(void *this, pfmlib_event_desc_t *e, pfm_amd64_reg_t reg) { pfmlib_pmu_t *pmu = this; @@ -858,3 +861,5 @@ int pfm_amd64_get_num_events(void *this) num++; return num; } + +#pragma GCC visibility pop diff --git a/lib/pfmlib_amd64_priv.h b/lib/pfmlib_amd64_priv.h index 66ca49e..2e08d4f 100644 --- a/lib/pfmlib_amd64_priv.h +++ b/lib/pfmlib_amd64_priv.h @@ -25,6 +25,8 @@ #ifndef __PFMLIB_AMD64_PRIV_H__ #define __PFMLIB_AMD64_PRIV_H__ +#pragma GCC visibility push(hidden) + #define AMD64_MAX_GRP 4 /* must be < 32 (int) */ typedef struct { @@ -214,4 +216,7 @@ extern int pfm_amd64_get_perf_encoding(void *this, pfmlib_event_desc_t *e); extern void pfm_amd64_perf_validate_pattrs(void *this, pfmlib_event_desc_t *e); extern void pfm_amd64_nb_perf_validate_pattrs(void *this, pfmlib_event_desc_t *e); extern int pfm_amd64_family_detect(void *this); + +#pragma GCC visibility pop + #endif /* __PFMLIB_AMD64_PRIV_H__ */ diff --git a/lib/pfmlib_arm_priv.h b/lib/pfmlib_arm_priv.h index 81a9df9..06cab1d 100644 --- a/lib/pfmlib_arm_priv.h +++ b/lib/pfmlib_arm_priv.h @@ -25,6 +25,8 @@ #ifndef __PFMLIB_ARM_PRIV_H__ #define __PFMLIB_ARM_PRIV_H__ +#pragma GCC visibility push(hidden) + /* * This file contains the definitions used for ARM processors */ @@ -100,4 +102,6 @@ arm_has_plm(void *this, pfmlib_event_desc_t *e) return pe[e->event].modmsk & ARM_ATTR_PLM_ALL; } +#pragma GCC visibility pop + #endif /* __PFMLIB_ARM_PRIV_H__ */ diff --git a/lib/pfmlib_cell_priv.h b/lib/pfmlib_cell_priv.h index c479aec..ec0ee38 100644 --- a/lib/pfmlib_cell_priv.h +++ b/lib/pfmlib_cell_priv.h @@ -23,6 +23,8 @@ #ifndef __PFMLIB_CELL_PRIV_H__ #define __PFMLIB_CELL_PRIV_H__ +#pragma GCC visibility push(hidden) + #define PFM_CELL_PME_FREQ_PPU_MFC 0 #define PFM_CELL_PME_FREQ_SPU 1 #define PFM_CELL_PME_FREQ_HALF 2 @@ -81,4 +83,6 @@ typedef struct { #define WORD_0_AND_2 5 /* 0101 */ #define WORD_NONE 0 +#pragma GCC visibility pop + #endif /* __PFMLIB_CELL_PRIV_H__ */ diff --git a/lib/pfmlib_ia64_priv.h b/lib/pfmlib_ia64_priv.h index 75bc49a..3c91b92 100644 --- a/lib/pfmlib_ia64_priv.h +++ b/lib/pfmlib_ia64_priv.h @@ -25,6 +25,8 @@ #ifndef __PFMLIB_PRIV_IA64_H__ #define __PFMLIB_PRIV_IA64_H__ +#pragma GCC visibility push(hidden) + /* * architected PMC register structure */ @@ -849,4 +851,7 @@ pfm_ia64_fls (unsigned long x) return exp - 0xffff; } + +#pragma GCC visibility pop + #endif /* __PFMLIB_PRIV_IA64_H__ */ diff --git a/lib/pfmlib_intel_netburst_priv.h b/lib/pfmlib_intel_netburst_priv.h index 65d73bc..7588198 100644 --- a/lib/pfmlib_intel_netburst_priv.h +++ b/lib/pfmlib_intel_netburst_priv.h @@ -28,6 +28,8 @@ #ifndef _PFMLIB_INTEL_NETBURST_PRIV_H_ #define _PFMLIB_INTEL_NETBURST_PRIV_H_ +#pragma GCC visibility push(hidden) + /* ESCR: Event Selection Control Register * * These registers are used to select which event to count along with options @@ -230,4 +232,6 @@ extern int pfm_netburst_get_encoding(void *this, pfmlib_event_desc_t *e); extern int pfm_netburst_get_perf_encoding(void *this, pfmlib_event_desc_t *e); extern void pfm_netburst_perf_validate_pattrs(void *this, pfmlib_event_desc_t *e); +#pragma GCC visibility pop + #endif diff --git a/lib/pfmlib_intel_snbep_unc.c b/lib/pfmlib_intel_snbep_unc.c index c61065e..cb0e77f 100644 --- a/lib/pfmlib_intel_snbep_unc.c +++ b/lib/pfmlib_intel_snbep_unc.c @@ -32,6 +32,8 @@ #include "pfmlib_intel_x86_priv.h" #include "pfmlib_intel_snbep_unc_priv.h" +#pragma GCC visibility push(hidden) + const pfmlib_attr_desc_t snbep_unc_mods[]={ PFM_ATTR_B("e", "edge detect"), /* edge */ PFM_ATTR_B("i", "invert"), /* invert */ @@ -660,3 +662,5 @@ pfm_intel_snbep_unc_get_event_attr_info(void *this, int pidx, int attr_idx, pfm_ return PFM_SUCCESS; } + +#pragma GCC visibility pop diff --git a/lib/pfmlib_intel_snbep_unc_priv.h b/lib/pfmlib_intel_snbep_unc_priv.h index 13875f5..13f06a4 100644 --- a/lib/pfmlib_intel_snbep_unc_priv.h +++ b/lib/pfmlib_intel_snbep_unc_priv.h @@ -24,6 +24,8 @@ #ifndef __PFMLIB_INTEL_SNBEP_UNC_PRIV_H__ #define __PFMLIB_INTEL_SNBEP_UNC_PRIV_H__ +#pragma GCC visibility push(hidden) + /* * Intel x86 specific pmu flags (pmu->flags 16 MSB) */ @@ -344,4 +346,6 @@ is_cbo_filt_event(void *this, pfm_intel_x86_reg_t reg) && (sel == 0x35 || sel == 0x36 || sel == 0x34); } +#pragma GCC visibility pop + #endif /* __PFMLIB_INTEL_SNBEP_UNC_PRIV_H__ */ diff --git a/lib/pfmlib_intel_x86_perf_event.c b/lib/pfmlib_intel_x86_perf_event.c index f346d4f..0a53239 100644 --- a/lib/pfmlib_intel_x86_perf_event.c +++ b/lib/pfmlib_intel_x86_perf_event.c @@ -32,6 +32,8 @@ #include "pfmlib_intel_x86_priv.h" #include "pfmlib_perf_event_priv.h" +#pragma GCC visibility push(hidden) + static int find_pmu_type_by_name(const char *name) { @@ -325,3 +327,5 @@ pfm_intel_x86_perf_detect(void *this) snprintf(file,sizeof(file), "/sys/devices/%s", pmu->perf_name); return access(file, R_OK|X_OK) ? PFM_ERR_NOTSUPP : PFM_SUCCESS; } + +#pragma GCC visibility pop diff --git a/lib/pfmlib_intel_x86_priv.h b/lib/pfmlib_intel_x86_priv.h index 74aab3e..47849d9 100644 --- a/lib/pfmlib_intel_x86_priv.h +++ b/lib/pfmlib_intel_x86_priv.h @@ -25,6 +25,8 @@ #ifndef __PFMLIB_INTEL_X86_PRIV_H__ #define __PFMLIB_INTEL_X86_PRIV_H__ +#pragma GCC visibility push(hidden) + /* * This file contains the definitions used for all Intel X86 processors */ @@ -348,4 +350,6 @@ extern void pfm_intel_x86_perf_validate_pattrs(void *this, pfmlib_event_desc_t * extern int pfm_intel_x86_can_auto_encode(void *this, int pidx, int uidx); extern int pfm_intel_x86_model_detect(void *this); +#pragma GCC visibility pop + #endif /* __PFMLIB_INTEL_X86_PRIV_H__ */ diff --git a/lib/pfmlib_itanium2_priv.h b/lib/pfmlib_itanium2_priv.h index cacd309..2b571e5 100644 --- a/lib/pfmlib_itanium2_priv.h +++ b/lib/pfmlib_itanium2_priv.h @@ -25,6 +25,8 @@ #ifndef __PFMLIB_ITANIUM2_PRIV_H__ #define __PFMLIB_ITANIUM2_PRIV_H__ +#pragma GCC visibility push(hidden) + /* * Event type definitions * @@ -110,4 +112,6 @@ typedef struct { #define event_iarr_ok(e) ((e)->pme_qualifiers.pme_qual.pme_iar==1) #define event_darr_ok(e) ((e)->pme_qualifiers.pme_qual.pme_dar==1) +#pragma GCC visibility pop + #endif /* __PFMLIB_ITANIUM2_PRIV_H__ */ diff --git a/lib/pfmlib_itanium_priv.h b/lib/pfmlib_itanium_priv.h index cdc0716..9176d2c 100644 --- a/lib/pfmlib_itanium_priv.h +++ b/lib/pfmlib_itanium_priv.h @@ -25,6 +25,8 @@ #ifndef __PFMLIB_ITANIUM_PRIV_H__ #define __PFMLIB_ITANIUM_PRIV_H__ +#pragma GCC visibility push(hidden) + /* * Itanium encoding structure * (code must be first 8 bits) @@ -91,4 +93,6 @@ typedef struct { #define event_iarr_ok(e) ((e)->pme_qualifiers.pme_qual.pme_iar==1) #define event_darr_ok(e) ((e)->pme_qualifiers.pme_qual.pme_dar==1) +#pragma GCC visibility pop + #endif /* __PFMLIB_ITANIUM_PRIV_H__ */ diff --git a/lib/pfmlib_mips_priv.h b/lib/pfmlib_mips_priv.h index c5112f5..f00bc0c 100644 --- a/lib/pfmlib_mips_priv.h +++ b/lib/pfmlib_mips_priv.h @@ -25,6 +25,8 @@ #ifndef __PFMLIB_MIPS_PRIV_H__ #define __PFMLIB_MIPS_PRIV_H__ +#pragma GCC visibility push(hidden) + /* * This file contains the definitions used for MIPS processors */ @@ -114,4 +116,6 @@ extern unsigned int pfm_mips_get_event_nattrs(void *this, int pidx); extern void pfm_mips_perf_validate_pattrs(void *this, pfmlib_event_desc_t *e); extern int pfm_mips_get_perf_encoding(void *this, pfmlib_event_desc_t *e); +#pragma GCC visibility pop + #endif /* __PFMLIB_MIPS_PRIV_H__ */ diff --git a/lib/pfmlib_montecito_priv.h b/lib/pfmlib_montecito_priv.h index 65a1076..8d9acc4 100644 --- a/lib/pfmlib_montecito_priv.h +++ b/lib/pfmlib_montecito_priv.h @@ -25,6 +25,8 @@ #ifndef __PFMLIB_MONTECITO_PRIV_H__ #define __PFMLIB_MONTECITO_PRIV_H__ +#pragma GCC visibility push(hidden) + /* * Event type definitions * @@ -115,4 +117,6 @@ typedef struct { #define event_all_ok(e) ((e)->pme_qualifiers.pme_qual.pme_all==1) #define event_mesi_ok(e) ((e)->pme_qualifiers.pme_qual.pme_mesi==1) +#pragma GCC visibility pop + #endif /* __PFMLIB_MONTECITO_PRIV_H__ */ diff --git a/lib/pfmlib_powerpc_perf_event.c b/lib/pfmlib_powerpc_perf_event.c index 642439b..d5a482a 100644 --- a/lib/pfmlib_powerpc_perf_event.c +++ b/lib/pfmlib_powerpc_perf_event.c @@ -31,6 +31,8 @@ #include "pfmlib_power_priv.h" /* architecture private */ #include "pfmlib_perf_event_priv.h" +#pragma GCC visibility push(hidden) + int pfm_gen_powerpc_get_perf_encoding(void *this, pfmlib_event_desc_t *e) { @@ -144,3 +146,5 @@ pfm_gen_powerpc_perf_validate_pattrs(void *this, pfmlib_event_desc_t *e) } } } + +#pragma GCC visibility pop diff --git a/lib/pfmlib_priv.h b/lib/pfmlib_priv.h index 4c075a2..143c8bf 100644 --- a/lib/pfmlib_priv.h +++ b/lib/pfmlib_priv.h @@ -27,6 +27,8 @@ #include <perfmon/pfmlib.h> #include <string.h> +#pragma GCC visibility push(hidden) + #define PFM_PLM_ALL (PFM_PLM0|PFM_PLM1|PFM_PLM2|PFM_PLM3|PFM_PLMH) #define PFMLIB_ATTR_DELIM ':' /* event attribute delimiter */ @@ -481,4 +483,6 @@ is_empty_attr(const pfmlib_attr_desc_t *a) return !a || !a->name || strlen(a->name) == 0 ? 1 : 0; } +#pragma GCC visibility pop + #endif /* __PFMLIB_PRIV_H__ */ diff --git a/lib/pfmlib_s390x_priv.h b/lib/pfmlib_s390x_priv.h index 22c775a..da93e8f 100644 --- a/lib/pfmlib_s390x_priv.h +++ b/lib/pfmlib_s390x_priv.h @@ -1,6 +1,8 @@ #ifndef __PFMLIB_S390X_PRIV_H__ #define __PFMLIB_S390X_PRIV_H__ +#pragma GCC visibility push(hidden) + #define CPUMF_COUNTER_MAX 256 typedef struct { uint64_t ctrnum; /* counter number */ @@ -12,4 +14,6 @@ typedef struct { #define min(a, b) ((a) < (b) ? (a) : (b)) extern int pfm_s390x_get_perf_encoding(void *this, pfmlib_event_desc_t *e); +#pragma GCC visibility pop + #endif /* __PFMLIB_S390X_PRIV_H__ */ diff --git a/lib/pfmlib_sicortex_priv.h b/lib/pfmlib_sicortex_priv.h index 809fae1..bf4313f 100644 --- a/lib/pfmlib_sicortex_priv.h +++ b/lib/pfmlib_sicortex_priv.h @@ -25,6 +25,9 @@ */ #ifndef __PFMLIB_SICORTEX_PRIV_H__ #define __PFMLIB_SICORTEX_PRIV_H__ + +#pragma GCC visibility push(hidden) + #include "pfmlib_gen_mips64_priv.h" #define PFMLIB_SICORTEX_MAX_UMASK 5 @@ -135,4 +138,7 @@ static pme_sicortex_umask_t sicortex_scb_umasks[PFMLIB_SICORTEX_MAX_UMASK] = { "HIST_EDGE","Histogram on edges of the specified event",0x1 } }; + +#pragma GCC visibility pop + #endif /* __PFMLIB_GEN_MIPS64_PRIV_H__ */ diff --git a/lib/pfmlib_sparc_priv.h b/lib/pfmlib_sparc_priv.h index 7de9b3d..a09e0e3 100644 --- a/lib/pfmlib_sparc_priv.h +++ b/lib/pfmlib_sparc_priv.h @@ -1,6 +1,8 @@ #ifndef __PFMLIB_SPARC_PRIV_H__ #define __PFMLIB_SPARC_PRIV_H__ +#pragma GCC visibility push(hidden) + typedef struct { char *uname; /* mask name */ char *udesc; /* mask description */ @@ -51,4 +53,7 @@ extern unsigned int pfm_sparc_get_event_nattrs(void *this, int pidx); extern void pfm_sparc_perf_validate_pattrs(void *this, pfmlib_event_desc_t *e); extern int pfm_sparc_get_perf_encoding(void *this, pfmlib_event_desc_t *e); + +#pragma GCC visibility pop + #endif /* __PFMLIB_SPARC_PRIV_H__ */ -- 2.5.0 ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 _______________________________________________ perfmon2-devel mailing list perfmon2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perfmon2-devel