aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r--tools/perf/util/symbol.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index fd3d9c8e90fc..226f44a2357d 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -324,8 +324,7 @@ static inline int elf_sym__is_function(const GElf_Sym *sym)
324{ 324{
325 return elf_sym__type(sym) == STT_FUNC && 325 return elf_sym__type(sym) == STT_FUNC &&
326 sym->st_name != 0 && 326 sym->st_name != 0 &&
327 sym->st_shndx != SHN_UNDEF && 327 sym->st_shndx != SHN_UNDEF;
328 sym->st_size != 0;
329} 328}
330 329
331static inline int elf_sym__is_label(const GElf_Sym *sym) 330static inline int elf_sym__is_label(const GElf_Sym *sym)
@@ -414,7 +413,7 @@ static int dso__synthesize_plt_symbols(struct dso *self, int v)
414 if (fd < 0) 413 if (fd < 0)
415 goto out; 414 goto out;
416 415
417 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); 416 elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
418 if (elf == NULL) 417 if (elf == NULL)
419 goto out_close; 418 goto out_close;
420 419
@@ -534,7 +533,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name,
534 Elf *elf; 533 Elf *elf;
535 int nr = 0, kernel = !strcmp("[kernel]", self->name); 534 int nr = 0, kernel = !strcmp("[kernel]", self->name);
536 535
537 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); 536 elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
538 if (elf == NULL) { 537 if (elf == NULL) {
539 if (v) 538 if (v)
540 fprintf(stderr, "%s: cannot read %s ELF file.\n", 539 fprintf(stderr, "%s: cannot read %s ELF file.\n",
@@ -676,7 +675,7 @@ static char *dso__read_build_id(struct dso *self, int v)
676 if (fd < 0) 675 if (fd < 0)
677 goto out; 676 goto out;
678 677
679 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); 678 elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
680 if (elf == NULL) { 679 if (elf == NULL) {
681 if (v) 680 if (v)
682 fprintf(stderr, "%s: cannot read %s ELF file.\n", 681 fprintf(stderr, "%s: cannot read %s ELF file.\n",
@@ -833,7 +832,7 @@ int dso__load_modules(struct dso *self, symbol_filter_t filter, int v)
833 struct mod_dso *mods = mod_dso__new_dso("modules"); 832 struct mod_dso *mods = mod_dso__new_dso("modules");
834 struct module *pos; 833 struct module *pos;
835 struct rb_node *next; 834 struct rb_node *next;
836 int err; 835 int err, count = 0;
837 836
838 err = mod_dso__load_modules(mods); 837 err = mod_dso__load_modules(mods);
839 838
@@ -852,14 +851,16 @@ int dso__load_modules(struct dso *self, symbol_filter_t filter, int v)
852 break; 851 break;
853 852
854 next = rb_next(&pos->rb_node); 853 next = rb_next(&pos->rb_node);
854 count += err;
855 } 855 }
856 856
857 if (err < 0) { 857 if (err < 0) {
858 mod_dso__delete_modules(mods); 858 mod_dso__delete_modules(mods);
859 mod_dso__delete_self(mods); 859 mod_dso__delete_self(mods);
860 return err;
860 } 861 }
861 862
862 return err; 863 return count;
863} 864}
864 865
865static inline void dso__fill_symbol_holes(struct dso *self) 866static inline void dso__fill_symbol_holes(struct dso *self)
@@ -913,8 +914,15 @@ int dso__load_kernel(struct dso *self, const char *vmlinux,
913 914
914 if (vmlinux) { 915 if (vmlinux) {
915 err = dso__load_vmlinux(self, vmlinux, filter, v); 916 err = dso__load_vmlinux(self, vmlinux, filter, v);
916 if (err > 0 && use_modules) 917 if (err > 0 && use_modules) {
917 err = dso__load_modules(self, filter, v); 918 int syms = dso__load_modules(self, filter, v);
919
920 if (syms < 0) {
921 fprintf(stderr, "dso__load_modules failed!\n");
922 return syms;
923 }
924 err += syms;
925 }
918 } 926 }
919 927
920 if (err <= 0) 928 if (err <= 0)