Skip to contentSkip to conversation

Patch "perf symbols: Fix annotation of objects with debuginfo files" has been added to the 4.7-stable tree

PATCH [email protected] 1 participant 1 message Sep 5, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

perf symbols: Fix annotation of objects with debuginfo files

to the 4.7-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
perf-symbols-fix-annotation-of-objects-with-debuginfo-files.patch
and it can be found in the queue-4.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 50de1a0c54cdbc69a6dbcbc323f53daf95a4050e Mon Sep 17 00:00:00 2001

From: Anton Blanchard <[email protected]>
Date: Sat, 13 Aug 2016 11:55:33 +1000
Subject: perf symbols: Fix annotation of objects with debuginfo files

From: Anton Blanchard <[email protected]>

commit 50de1a0c54cdbc69a6dbcbc323f53daf95a4050e upstream.

Commit 73cdf0c6ea9c ("perf symbols: Record text offset in dso to calculate objdump address") started storing the offset of the text section for all DSOs:

       if (elf_section_by_name(elf, &ehdr, &tshdr, ".text", NULL))
               dso->text_offset = tshdr.sh_addr - tshdr.sh_offset;

Unfortunately this breaks debuginfo files, because we need to calculate the offset of the text section in the associated executable file. As a result perf annotate returns junk for all debuginfo files.

Fix this by using runtime_ss->elf which should point at the executable when parsing a debuginfo file.

Cc Peter Zijlstra <[email protected]>
Cc Ravi Bangoria <[email protected]>
Fixes 73cdf0c6ea9c ("perf symbols: Record text offset in dso to calculate objdump address")
---
 tools/perf/util/symbol-elf.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/symbol-elf.c +2 -1
@@ -827,7 +827,8 @@ int dso__load_sym(struct dso *dso, struc
 	sec = syms_ss->symtab;
 	shdr = syms_ss->symshdr;
 
-	if (elf_section_by_name(elf, &ehdr, &tshdr, ".text", NULL))
+	if (elf_section_by_name(runtime_ss->elf, &runtime_ss->ehdr, &tshdr,
+				".text", NULL))
 		dso->text_offset = tshdr.sh_addr - tshdr.sh_offset;
 
 	if (runtime_ss->opdsec)

Patches currently in stable-queue which might be from [email protected] are

queue-4.7/perf-symbols-fix-annotation-of-objects-with-debuginfo-files.patch