From: Steve Clevenger <scclevenger@os.amperecomputing.com>
To: james.clark@linaro.org, mike.leach@linaro.org
Cc: suzuki.poulose@arm.com, leo.yan@arm.com,
ilkka@os.amperecomputing.com, coresight@lists.linaro.org,
linux-perf-users@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH V3 2/4] Force MAPPING_TYPE__IDENTIY for PIE
Date: Tue, 27 Aug 2024 19:50:15 -0600 [thread overview]
Message-ID: <85c2c76685f9aa55ada3178af8cd109f3dc7b0b0.1724808513.git.scclevenger@os.amperecomputing.com> (raw)
In-Reply-To: <cover.1724808513.git.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 Clevenger <scclevenger@os.amperecomputing.com>
---
tools/perf/util/map.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index e781c8d56a9a..c846faec177b 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -173,8 +173,8 @@ struct map *map__new(struct machine *machine, u64 start, u64 len,
assert(!dso__kernel(dso));
map__init(result, start, start + len, pgoff, dso, prot, flags);
- if (anon || no_dso) {
- map->mapping_type = MAPPING_TYPE__IDENTITY;
+ if (anon || no_dso || dso__is_pie(dso)) {
+ map__set_mapping_type(map, MAPPING_TYPE__IDENTITY);
/*
* Set memory without DSO as loaded. All map__find_*
--
2.25.1
next prev parent reply other threads:[~2024-08-28 1:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-28 1:50 [PATCH V3 0/4] arm-cs-trace-disasm.py/perf must accommodate non-zero DSO text offset Steve Clevenger
2024-08-28 1:50 ` [PATCH V3 4/4] Adjust objdump start/end range per map pgoff parameter Steve Clevenger
2024-08-28 1:50 ` [PATCH V3 3/4] Add map pgoff to python dictionary based on MAPPING_TYPE Steve Clevenger
2024-08-28 5:09 ` Steve Clevenger
2024-08-28 1:50 ` Steve Clevenger [this message]
2024-08-28 1:50 ` [PATCH V3 1/4] Add dso__is_pie call to identify ELF PIE 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=85c2c76685f9aa55ada3178af8cd109f3dc7b0b0.1724808513.git.scclevenger@os.amperecomputing.com \
--to=scclevenger@os.amperecomputing.com \
--cc=coresight@lists.linaro.org \
--cc=ilkka@os.amperecomputing.com \
--cc=james.clark@linaro.org \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-perf-users@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;
as well as URLs for NNTP newsgroup(s).