mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf tools: Fix annotation of vdso
@ 2015-08-14 12:50 Adrian Hunter
  2015-08-20  9:56 ` [tip:perf/core] perf symbols: " tip-bot for Adrian Hunter
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Hunter @ 2015-08-14 12:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, Jiri Olsa, Will Deacon

Older kernels attempt to prelink vdso to its virtual address.
To permit annotation using objdump, the map__rip_2objdump()
calculation must result in that same address which we can
infer from the start and offset of the text section.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/util/symbol-elf.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index b0ad810f04dd..53bb5f59ec58 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -875,6 +875,17 @@ int dso__load_sym(struct dso *dso, struct map *map,
 		}
 	}
 
+	/*
+	 * Handle any relocation of vdso necessary because older kernels
+	 * attempted to prelink vdso to its virtual address.
+	 */
+	if (dso__is_vdso(dso)) {
+		GElf_Shdr tshdr;
+
+		if (elf_section_by_name(elf, &ehdr, &tshdr, ".text", NULL))
+			map->reloc = map->start - tshdr.sh_addr + tshdr.sh_offset;
+	}
+
 	dso->adjust_symbols = runtime_ss->adjust_symbols || ref_reloc(kmap);
 	/*
 	 * Initial kernel and module mappings do not map to the dso.  For
-- 
1.9.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip:perf/core] perf symbols: Fix annotation of vdso
  2015-08-14 12:50 [PATCH] perf tools: Fix annotation of vdso Adrian Hunter
@ 2015-08-20  9:56 ` tip-bot for Adrian Hunter
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Adrian Hunter @ 2015-08-20  9:56 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: will.deacon, acme, hpa, mingo, jolsa, adrian.hunter, tglx, linux-kernel

Commit-ID:  f0ee3b467ab7a74ffce75190259eb59dbf30ecad
Gitweb:     http://git.kernel.org/tip/f0ee3b467ab7a74ffce75190259eb59dbf30ecad
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Fri, 14 Aug 2015 15:50:06 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 17 Aug 2015 11:07:38 -0300

perf symbols: Fix annotation of vdso

Older kernels attempt to prelink vdso to its virtual address.  To permit
annotation using objdump, the map__rip_2objdump() calculation must
result in that same address which we can infer from the start and offset
of the text section.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Link: http://lkml.kernel.org/r/1439556606-11297-1-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol-elf.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index b0ad810..53bb5f5 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -875,6 +875,17 @@ int dso__load_sym(struct dso *dso, struct map *map,
 		}
 	}
 
+	/*
+	 * Handle any relocation of vdso necessary because older kernels
+	 * attempted to prelink vdso to its virtual address.
+	 */
+	if (dso__is_vdso(dso)) {
+		GElf_Shdr tshdr;
+
+		if (elf_section_by_name(elf, &ehdr, &tshdr, ".text", NULL))
+			map->reloc = map->start - tshdr.sh_addr + tshdr.sh_offset;
+	}
+
 	dso->adjust_symbols = runtime_ss->adjust_symbols || ref_reloc(kmap);
 	/*
 	 * Initial kernel and module mappings do not map to the dso.  For

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-20  9:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-14 12:50 [PATCH] perf tools: Fix annotation of vdso Adrian Hunter
2015-08-20  9:56 ` [tip:perf/core] perf symbols: " tip-bot for Adrian Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome