This is an archive of the discontinued LLVM Phabricator instance.

[BOLT][perf2bolt] Fix base address calculation for shared objects
ClosedPublic

Authored by maksfb on Apr 13 2022, 7:39 PM.

Details

Summary

When processing profile data for shared object or PIE, perf2bolt needs
to calculate base address of the binary based on the map info reported
by the perf tool. When the mapping data provided is for the second
(or any other than the first) segment and the segment's file offset
does not match its memory offset, perf2bolt uses wrong assumption
about the binary base address.

Add a function to calculate binary base address using the reported
memory mapping and use the returned base for further address
adjustments.

Diff Detail

Event Timeline

maksfb created this revision.Apr 13 2022, 7:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2022, 7:39 PM
Herald added a subscriber: mgorny. · View Herald Transcript
maksfb requested review of this revision.Apr 13 2022, 7:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2022, 7:39 PM
yota9 accepted this revision.Apr 14 2022, 4:14 AM

Great, thanks!

This revision is now accepted and ready to land.Apr 14 2022, 4:14 AM