Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 696b97a5 authored by Dave Martin's avatar Dave Martin Committed by Arnaldo Carvalho de Melo
Browse files

perf symbols: Ignore mapping symbols on ARM



ARM ELF files use symbols with special names $a, $t, $d to identify regions of
ARM code, Thumb code and data within code sections.  This can cause confusing
output from the perf tools, especially for partially stripped binaries, or
binaries containing user-added zero-sized symbols (which may occur in
hand-written assembler which hasn't been fully annotated with .size
directives).

This patch filters out these symbols at load time.

LKML-Reference: <1281352878-8735-2-git-send-email-dave.martin@linaro.org>
Signed-off-by: default avatarDave Martin <dave.martin@linaro.org>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent b1b02673
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1079,6 +1079,16 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
		if (!is_label && !elf_sym__is_a(&sym, map->type))
			continue;

		/* Reject ARM ELF "mapping symbols": these aren't unique and
		 * don't identify functions, so will confuse the profile
		 * output: */
		if (ehdr.e_machine == EM_ARM) {
			if (!strcmp(elf_name, "$a") ||
			    !strcmp(elf_name, "$d") ||
			    !strcmp(elf_name, "$t"))
				continue;
		}

		if (opdsec && sym.st_shndx == opdidx) {
			u32 offset = sym.st_value - opdshdr.sh_addr;
			u64 *opd = opddata->d_buf + offset;