Skip to contentSkip to conversation

perf symbols: Use symbol type instead of map->type

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message May 2, 2018 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  18231d79466e6b183b4f3b2aa66231fb4052fb85
Gitweb:     https://git.kernel.org/tip/18231d79466e6b183b4f3b2aa66231fb4052fb85
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Thu, 26 Apr 2018 12:45:17 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 26 Apr 2018 13:47:20 -0300

perf symbols: Use symbol type instead of map->type

map->type is going away, we can derive it from map->prot, so use the same logic as in the kernel's arch/arm/kernel/module.c file:

  ELF32_ST_TYPE(sym->st_info) == STT_FUNC && !(sym->st_value & 1))

This was introduced in b2f8fb237e9c ("perf symbols: Fix annotation of thumb code"), that fix is maintained with this change.

---
 tools/perf/util/symbol-elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/symbol-elf.c +1 -1
index cf2e6f428bb4..82a1aadc245f 100644
@@ -982,7 +982,7 @@ int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
 		/* On ARM, symbols for thumb functions have 1 added to
 		 * the symbol address as a flag - remove it */
 		if ((ehdr.e_machine == EM_ARM) &&
-		    (map->type == MAP__FUNCTION) &&
+		    (GELF_ST_TYPE(sym.st_info) == STT_FUNC) &&
 		    (sym.st_value & 1))
 			--sym.st_value;