From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752540AbbHTJ4m (ORCPT ); Thu, 20 Aug 2015 05:56:42 -0400 Received: from terminus.zytor.com ([198.137.202.10]:35088 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751907AbbHTJ4j (ORCPT ); Thu, 20 Aug 2015 05:56:39 -0400 Date: Thu, 20 Aug 2015 02:56:23 -0700 From: tip-bot for Adrian Hunter Message-ID: Cc: will.deacon@arm.com, acme@redhat.com, hpa@zytor.com, mingo@kernel.org, jolsa@redhat.com, adrian.hunter@intel.com, tglx@linutronix.de, linux-kernel@vger.kernel.org Reply-To: will.deacon@arm.com, tglx@linutronix.de, jolsa@redhat.com, adrian.hunter@intel.com, mingo@kernel.org, hpa@zytor.com, acme@redhat.com, linux-kernel@vger.kernel.org In-Reply-To: <1439556606-11297-1-git-send-email-adrian.hunter@intel.com> References: <1439556606-11297-1-git-send-email-adrian.hunter@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf symbols: Fix annotation of vdso Git-Commit-ID: f0ee3b467ab7a74ffce75190259eb59dbf30ecad X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: f0ee3b467ab7a74ffce75190259eb59dbf30ecad Gitweb: http://git.kernel.org/tip/f0ee3b467ab7a74ffce75190259eb59dbf30ecad Author: Adrian Hunter AuthorDate: Fri, 14 Aug 2015 15:50:06 +0300 Committer: Arnaldo Carvalho de Melo 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 Cc: Jiri Olsa Cc: Will Deacon Link: http://lkml.kernel.org/r/1439556606-11297-1-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- 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