* [PATCH 0/1] perf symbols: ignore mapping symbols on ARM
@ 2010-08-09 11:21 Dave Martin
2010-08-09 11:21 ` [PATCH 1/1] " Dave Martin
0 siblings, 1 reply; 4+ messages in thread
From: Dave Martin @ 2010-08-09 11:21 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, Dave Martin
Applies to linux-2.6-tip/master or acme/perf-core
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.
Addressing architecture-specific cases in this way could get
quite messy-- if one architecture-specific hack is needed in
the symbol loading loop, more might be needed over time.
Adding a generic per-architecture symbol filtering hook might
help to mitigate this if more cases need to be supported.
Switching to libbfd as a generic image-handling backend for all
architectures might be a better long-term solution, since
libelf seems to be essentially a low-level parsing library only
at this stage, and doesn't deal with all the architecture
specifics. There's a generic bfd_is_target_special_symbol()
function which is used by binutils to filter out architecture-
specific symbols which are not "normal" symbols, which could
help us for this case.
Dave Martin (1):
perf symbols: ignore mapping symbols on ARM
tools/perf/util/symbol.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] perf symbols: ignore mapping symbols on ARM
2010-08-09 11:21 [PATCH 0/1] perf symbols: ignore mapping symbols on ARM Dave Martin
@ 2010-08-09 11:21 ` Dave Martin
2010-08-09 14:53 ` Arnaldo Carvalho de Melo
2010-08-11 7:41 ` [tip:perf/core] perf symbols: Ignore " tip-bot for Dave Martin
0 siblings, 2 replies; 4+ messages in thread
From: Dave Martin @ 2010-08-09 11:21 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, Dave Martin
Applies to linux-2.6-tip/master or acme/perf-core
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.
Signed-off-by: Dave Martin <dave.martin@linaro.org>
---
tools/perf/util/symbol.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b6f5970..1a36773 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -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;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/1] perf symbols: ignore mapping symbols on ARM
2010-08-09 11:21 ` [PATCH 1/1] " Dave Martin
@ 2010-08-09 14:53 ` Arnaldo Carvalho de Melo
2010-08-11 7:41 ` [tip:perf/core] perf symbols: Ignore " tip-bot for Dave Martin
1 sibling, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-08-09 14:53 UTC (permalink / raw)
To: Dave Martin; +Cc: linux-kernel
Em Mon, Aug 09, 2010 at 12:21:18PM +0100, Dave Martin escreveu:
> + /* 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;
> + }
> +
Thanks, applied.
^ permalink raw reply [flat|nested] 4+ messages in thread* [tip:perf/core] perf symbols: Ignore mapping symbols on ARM
2010-08-09 11:21 ` [PATCH 1/1] " Dave Martin
2010-08-09 14:53 ` Arnaldo Carvalho de Melo
@ 2010-08-11 7:41 ` tip-bot for Dave Martin
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Dave Martin @ 2010-08-11 7:41 UTC (permalink / raw)
To: linux-tip-commits; +Cc: acme, linux-kernel, dave.martin, hpa, mingo, tglx
Commit-ID: 696b97a5d2de9e2b22699300835e675dfffe8592
Gitweb: http://git.kernel.org/tip/696b97a5d2de9e2b22699300835e675dfffe8592
Author: Dave Martin <dave.martin@linaro.org>
AuthorDate: Mon, 9 Aug 2010 12:21:18 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 10 Aug 2010 16:10:36 -0300
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: Dave Martin <dave.martin@linaro.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/symbol.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b6f5970..1a36773 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -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;
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-11 7:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-09 11:21 [PATCH 0/1] perf symbols: ignore mapping symbols on ARM Dave Martin
2010-08-09 11:21 ` [PATCH 1/1] " Dave Martin
2010-08-09 14:53 ` Arnaldo Carvalho de Melo
2010-08-11 7:41 ` [tip:perf/core] perf symbols: Ignore " tip-bot for Dave Martin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox