aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/arch/s390/util/sym-handling.c7
-rw-r--r--tools/perf/util/symbol-elf.c8
-rw-r--r--tools/perf/util/symbol.h3
3 files changed, 17 insertions, 1 deletions
diff --git a/tools/perf/arch/s390/util/sym-handling.c b/tools/perf/arch/s390/util/sym-handling.c
index b6cd056ccf71..e103f6e46afe 100644
--- a/tools/perf/arch/s390/util/sym-handling.c
+++ b/tools/perf/arch/s390/util/sym-handling.c
@@ -19,4 +19,11 @@ bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
19 return ehdr.e_type == ET_REL || ehdr.e_type == ET_DYN; 19 return ehdr.e_type == ET_REL || ehdr.e_type == ET_DYN;
20} 20}
21 21
22void arch__adjust_sym_map_offset(GElf_Sym *sym,
23 GElf_Shdr *shdr __maybe_unused,
24 struct map *map)
25{
26 if (map->type == MAP__FUNCTION)
27 sym->st_value += map->start;
28}
22#endif 29#endif
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 98deabb9b47e..a70479061fce 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -793,6 +793,12 @@ static u64 ref_reloc(struct kmap *kmap)
793void __weak arch__sym_update(struct symbol *s __maybe_unused, 793void __weak arch__sym_update(struct symbol *s __maybe_unused,
794 GElf_Sym *sym __maybe_unused) { } 794 GElf_Sym *sym __maybe_unused) { }
795 795
796void __weak arch__adjust_sym_map_offset(GElf_Sym *sym, GElf_Shdr *shdr,
797 struct map *map __maybe_unused)
798{
799 sym->st_value -= shdr->sh_addr - shdr->sh_offset;
800}
801
796int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss, 802int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
797 struct symsrc *runtime_ss, int kmodule) 803 struct symsrc *runtime_ss, int kmodule)
798{ 804{
@@ -973,7 +979,7 @@ int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
973 979
974 /* Adjust symbol to map to file offset */ 980 /* Adjust symbol to map to file offset */
975 if (adjust_kernel_syms) 981 if (adjust_kernel_syms)
976 sym.st_value -= shdr.sh_addr - shdr.sh_offset; 982 arch__adjust_sym_map_offset(&sym, &shdr, map);
977 983
978 if (strcmp(section_name, 984 if (strcmp(section_name,
979 (curr_dso->short_name + 985 (curr_dso->short_name +
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index b221671070e2..d00a012cfdfb 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -343,6 +343,9 @@ int setup_intlist(struct intlist **list, const char *list_str,
343#ifdef HAVE_LIBELF_SUPPORT 343#ifdef HAVE_LIBELF_SUPPORT
344bool elf__needs_adjust_symbols(GElf_Ehdr ehdr); 344bool elf__needs_adjust_symbols(GElf_Ehdr ehdr);
345void arch__sym_update(struct symbol *s, GElf_Sym *sym); 345void arch__sym_update(struct symbol *s, GElf_Sym *sym);
346void arch__adjust_sym_map_offset(GElf_Sym *sym,
347 GElf_Shdr *shdr __maybe_unused,
348 struct map *map __maybe_unused);
346#endif 349#endif
347 350
348#define SYMBOL_A 0 351#define SYMBOL_A 0