diff options
Diffstat (limited to 'tools/perf/util/symbol-elf.c')
| -rw-r--r-- | tools/perf/util/symbol-elf.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 66a84d5846c8..dca7dfae69ad 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
| @@ -19,6 +19,20 @@ | |||
| 19 | #define EM_AARCH64 183 /* ARM 64 bit */ | 19 | #define EM_AARCH64 183 /* ARM 64 bit */ |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | #ifndef ELF32_ST_VISIBILITY | ||
| 23 | #define ELF32_ST_VISIBILITY(o) ((o) & 0x03) | ||
| 24 | #endif | ||
| 25 | |||
| 26 | /* For ELF64 the definitions are the same. */ | ||
| 27 | #ifndef ELF64_ST_VISIBILITY | ||
| 28 | #define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) | ||
| 29 | #endif | ||
| 30 | |||
| 31 | /* How to extract information held in the st_other field. */ | ||
| 32 | #ifndef GELF_ST_VISIBILITY | ||
| 33 | #define GELF_ST_VISIBILITY(val) ELF64_ST_VISIBILITY (val) | ||
| 34 | #endif | ||
| 35 | |||
| 22 | typedef Elf64_Nhdr GElf_Nhdr; | 36 | typedef Elf64_Nhdr GElf_Nhdr; |
| 23 | 37 | ||
| 24 | #ifdef HAVE_CPLUS_DEMANGLE_SUPPORT | 38 | #ifdef HAVE_CPLUS_DEMANGLE_SUPPORT |
| @@ -87,6 +101,11 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym) | |||
| 87 | return GELF_ST_TYPE(sym->st_info); | 101 | return GELF_ST_TYPE(sym->st_info); |
| 88 | } | 102 | } |
| 89 | 103 | ||
| 104 | static inline uint8_t elf_sym__visibility(const GElf_Sym *sym) | ||
| 105 | { | ||
| 106 | return GELF_ST_VISIBILITY(sym->st_other); | ||
| 107 | } | ||
| 108 | |||
| 90 | #ifndef STT_GNU_IFUNC | 109 | #ifndef STT_GNU_IFUNC |
| 91 | #define STT_GNU_IFUNC 10 | 110 | #define STT_GNU_IFUNC 10 |
| 92 | #endif | 111 | #endif |
| @@ -111,7 +130,9 @@ static inline int elf_sym__is_label(const GElf_Sym *sym) | |||
| 111 | return elf_sym__type(sym) == STT_NOTYPE && | 130 | return elf_sym__type(sym) == STT_NOTYPE && |
| 112 | sym->st_name != 0 && | 131 | sym->st_name != 0 && |
| 113 | sym->st_shndx != SHN_UNDEF && | 132 | sym->st_shndx != SHN_UNDEF && |
| 114 | sym->st_shndx != SHN_ABS; | 133 | sym->st_shndx != SHN_ABS && |
| 134 | elf_sym__visibility(sym) != STV_HIDDEN && | ||
| 135 | elf_sym__visibility(sym) != STV_INTERNAL; | ||
| 115 | } | 136 | } |
| 116 | 137 | ||
| 117 | static bool elf_sym__filter(GElf_Sym *sym) | 138 | static bool elf_sym__filter(GElf_Sym *sym) |
