aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol-elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/symbol-elf.c')
-rw-r--r--tools/perf/util/symbol-elf.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 759456728703..516d19fb999b 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -151,15 +151,15 @@ Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
151 151
152 gelf_getshdr(sec, shp); 152 gelf_getshdr(sec, shp);
153 str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name); 153 str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name);
154 if (!strcmp(name, str)) { 154 if (str && !strcmp(name, str)) {
155 if (idx) 155 if (idx)
156 *idx = cnt; 156 *idx = cnt;
157 break; 157 return sec;
158 } 158 }
159 ++cnt; 159 ++cnt;
160 } 160 }
161 161
162 return sec; 162 return NULL;
163} 163}
164 164
165#define elf_section__for_each_rel(reldata, pos, pos_mem, idx, nr_entries) \ 165#define elf_section__for_each_rel(reldata, pos, pos_mem, idx, nr_entries) \
@@ -751,6 +751,8 @@ int dso__load_sym(struct dso *dso, struct map *map,
751 if (strcmp(elf_name, kmap->ref_reloc_sym->name)) 751 if (strcmp(elf_name, kmap->ref_reloc_sym->name))
752 continue; 752 continue;
753 kmap->ref_reloc_sym->unrelocated_addr = sym.st_value; 753 kmap->ref_reloc_sym->unrelocated_addr = sym.st_value;
754 map->reloc = kmap->ref_reloc_sym->addr -
755 kmap->ref_reloc_sym->unrelocated_addr;
754 break; 756 break;
755 } 757 }
756 } 758 }
@@ -922,6 +924,7 @@ int dso__load_sym(struct dso *dso, struct map *map,
922 (u64)shdr.sh_offset); 924 (u64)shdr.sh_offset);
923 sym.st_value -= shdr.sh_addr - shdr.sh_offset; 925 sym.st_value -= shdr.sh_addr - shdr.sh_offset;
924 } 926 }
927new_symbol:
925 /* 928 /*
926 * We need to figure out if the object was created from C++ sources 929 * We need to figure out if the object was created from C++ sources
927 * DWARF DW_compile_unit has this, but we don't always have access 930 * DWARF DW_compile_unit has this, but we don't always have access
@@ -933,7 +936,6 @@ int dso__load_sym(struct dso *dso, struct map *map,
933 if (demangled != NULL) 936 if (demangled != NULL)
934 elf_name = demangled; 937 elf_name = demangled;
935 } 938 }
936new_symbol:
937 f = symbol__new(sym.st_value, sym.st_size, 939 f = symbol__new(sym.st_value, sym.st_size,
938 GELF_ST_BIND(sym.st_info), elf_name); 940 GELF_ST_BIND(sym.st_info), elf_name);
939 free(demangled); 941 free(demangled);