mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>, Jiri Olsa <jolsa@kernel.org>
Cc: Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org,
	Milian Wolff <milian.wolff@kdab.com>,
	Pablo Galindo <pablogsal@gmail.com>,
	Fangrui Song <maskray@google.com>
Subject: [PATCH 3/3] perf unwind-libunwind: Fix base address for .eh_frame
Date: Mon, 11 Dec 2023 23:05:46 -0800	[thread overview]
Message-ID: <20231212070547.612536-4-namhyung@kernel.org> (raw)
In-Reply-To: <20231212070547.612536-1-namhyung@kernel.org>

The base address of a DSO mapping should start at the start of the file.
Usually DSOs are mapped from the pgoff 0 so it doesn't matter when it
uses the start of the map address.  But generated DSOs for JIT codes
doesn't start from the 0 so it should subtract the offset to calculate
the .eh_frame table offsets correctly.

Fixes: dc2cf4ca866f ("perf unwind: Fix segbase for ld.lld linked objects")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/unwind-libunwind-local.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
index c0641882fd2f..5e5c3395a499 100644
--- a/tools/perf/util/unwind-libunwind-local.c
+++ b/tools/perf/util/unwind-libunwind-local.c
@@ -327,7 +327,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct unwind_info *ui,
 
 	maps__for_each_entry(thread__maps(ui->thread), map_node) {
 		struct map *map = map_node->map;
-		u64 start = map__start(map);
+		u64 start = map__start(map) - map__pgoff(map);
 
 		if (map__dso(map) == dso && start < base_addr)
 			base_addr = start;
-- 
2.43.0.472.g3155946c3a-goog


  parent reply	other threads:[~2023-12-12  7:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12  7:05 [PATCH 0/3] perf tools: Random fixes for DWARF unwind Namhyung Kim
2023-12-12  7:05 ` [PATCH 1/3] perf genelf: Set ELF program header addresses properly Namhyung Kim
2023-12-12 18:07   ` Ian Rogers
2023-12-12  7:05 ` [PATCH 2/3] perf unwind-libdw: Handle JIT-generated DSOs properly Namhyung Kim
2023-12-12 18:07   ` Ian Rogers
2023-12-13 22:13     ` Namhyung Kim
2023-12-12  7:05 ` Namhyung Kim [this message]
2023-12-12 18:08   ` [PATCH 3/3] perf unwind-libunwind: Fix base address for .eh_frame Ian Rogers
2023-12-12 18:10 ` [PATCH 0/3] perf tools: Random fixes for DWARF unwind Ian Rogers
2023-12-13  0:54   ` Pablo Galindo Salgado
2023-12-13 22:07     ` Namhyung Kim
2023-12-14 22:07 ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231212070547.612536-4-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=maskray@google.com \
    --cc=milian.wolff@kdab.com \
    --cc=mingo@kernel.org \
    --cc=pablogsal@gmail.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®