mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steve Clevenger <scclevenger@os.amperecomputing.com>
To: james.clark@arm.com, mike.leach@linaro.org
Cc: suzuki.poulose@arm.com, leo.yan@linaro.org,
	ilkka@os.ampercomputing.com, coresight@lists.linaro.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	"steve.c.clevenger.ampere" <scclevenger@os.amperecomputing.com>
Subject: [PATCH 3/5] Force MAPPING_TYPE__IDENTIY for PIE
Date: Tue, 20 Aug 2024 16:11:33 -0600	[thread overview]
Message-ID: <95df5a08acc2c87e8ff9e374f9ae1c56cdc59470.1724104248.git.scclevenger@os.amperecomputing.com> (raw)
In-Reply-To: <cover.1724104248.git.scclevenger@os.amperecomputing.com>

From: "steve.c.clevenger.ampere" <scclevenger@os.amperecomputing.com>

Use dso__is_pie() to check whether the DSO file is a Position
Independent Executable (PIE). If PIE, change the MAPPING_TYPE to
MAPPING_TYPE__IDENTITY so a zero map pgoff (text offset) is passed
into the script.

Signed-off-by: steve.c.clevenger.ampere <scclevenger@os.amperecomputing.com>
---
 tools/perf/util/map.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index e1d14936a60d..df7c06fc373e 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -171,8 +171,11 @@ struct map *map__new(struct machine *machine, u64 start, u64 len,
 		assert(!dso__kernel(dso));
 		map__init(result, start, start + len, pgoff, dso);
 
+		if (map->pgoff && !no_dso)
+			no_dso = dso__is_pie(dso);	// PIE check
+
 		if (anon || no_dso) {
-			map->mapping_type = MAPPING_TYPE__IDENTITY;
+			map__set_mapping_type(map, MAPPING_TYPE__IDENTITY);
 
 			/*
 			 * Set memory without DSO as loaded. All map__find_*
-- 
2.25.1


  parent reply	other threads:[~2024-08-20 22:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20 22:11 [PATCH 0/5] arm-cs-trace-disasm.py/perf must accommodate non-zero DSO text offset Steve Clevenger
2024-08-20 22:11 ` [PATCH 5/5] Adjust objdump start/end range per map pgoff parameter Steve Clevenger
2024-08-20 22:11 ` [PATCH 4/5] Add map pgoff to python dictionary based on MAPPING_TYPE Steve Clevenger
2024-08-20 22:11 ` Steve Clevenger [this message]
2024-08-20 22:11 ` [PATCH 2/5] Add dso__is_pie prototype Steve Clevenger
2024-08-20 22:11 ` [PATCH 1/5] Add dso__is_pie call to identify ELF PIE Steve Clevenger
2024-08-26 13:13   ` Leo Yan
2024-08-26 21:33     ` Steve Clevenger

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=95df5a08acc2c87e8ff9e374f9ae1c56cdc59470.1724104248.git.scclevenger@os.amperecomputing.com \
    --to=scclevenger@os.amperecomputing.com \
    --cc=coresight@lists.linaro.org \
    --cc=ilkka@os.ampercomputing.com \
    --cc=james.clark@arm.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.leach@linaro.org \
    --cc=suzuki.poulose@arm.com \
    /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®