aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <david.gilbert@linaro.org>2011-01-21 16:40:19 +0000
committerNicolas Pitre <nicolas.pitre@linaro.org>2011-01-21 15:08:14 -0500
commit9aa8fb99e639638c55b4acfd85fa9f95d5511c36 (patch)
tree78f7b2e2363a962beec458d776dde2e81e90a884
parent708c1e9f2b24bb34d75b36475ccd53b7a97a31a4 (diff)
fix perf Annotation of Thumb codelinaro-linux-2.6.37-upstream-24Jan2011
In ARM's Thumb mode the bottom bit of the symbol address is set to mark the function as Thumb; the instructions are in reality 2 or 4 byte on 2 byte alignments, and when the +1 address is used in annotate it causes objdump to disassemble invalid instructions. The patch removes that bottom bit during symbol loading. This patch is against current linus's git, (2b1caf.....). Many thinks to Dave Martin for comments on an initial version of the patch. (For reference this corresponds to this bug https://bugs.launchpad.net/linux-linaro/+bug/677547 ) Signed-off-by: Dr. David Alan Gilbert <david.gilbert@linaro.org> Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
-rw-r--r--tools/perf/util/symbol.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 439ab947daf..7c16b2182ce 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1129,6 +1129,13 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
section_name = elf_sec__name(&shdr, secstrs);
+ /* 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) &&
+ (sym.st_value & 1))
+ sym.st_value-=1;
+
if (self->kernel != DSO_TYPE_USER || kmodule) {
char dso_name[PATH_MAX];