Changes in V2: - Updated mailing list distribution
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 | 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_*