提交 b2f8fb23 编写于 作者: D Dr. David Alan Gilbert 提交者: Arnaldo Carvalho de Melo

perf symbols: Fix annotation of thumb code

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.

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 )

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Dave Martin <dave.martin@linaro.org>
LKML-Reference: <20110121163922.GA31398@davesworkthinkpad>
Signed-off-by: NDr. David Alan Gilbert <david.gilbert@linaro.org>
Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 547e9fd7
......@@ -1161,6 +1161,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;
if (self->kernel != DSO_TYPE_USER || kmodule) {
char dso_name[PATH_MAX];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册