[PATCH] D124663: LNT: Only use text segment when isSO
Tamar Christina via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 29 02:22:28 PDT 2022
tnfchris created this revision.
tnfchris added reviewers: cmatthews, thopre.
Herald added a subscriber: dkolesnichenko.
Herald added a project: All.
tnfchris requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Limit the segment calculation uses to only when the binary is relocatable.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124663
Files:
lnt/testing/profile/cPerf.cpp
Index: lnt/testing/profile/cPerf.cpp
===================================================================
--- lnt/testing/profile/cPerf.cpp
+++ lnt/testing/profile/cPerf.cpp
@@ -361,6 +361,7 @@
struct Map {
uint64_t Start, End, Adjust;
+ bool isSO;
const char *Filename;
};
@@ -528,10 +529,15 @@
void reset(Map *M) {
clear();
// Fetch both dynamic and static symbols, sort and unique them.
- uint64_t segmentStart = fetchExecSegment (M);
- /* Adjust the symbol to a value relative to the start of the load address
- to match up with registerNewMapping. */
- M->Adjust -= segmentStart;
+ /* If we're a relocatable object then take the actual start of the text
+ segment into account. */
+ if (M->isSO)
+ {
+ uint64_t segmentStart = fetchExecSegment (M);
+ /* Adjust the symbol to a value relative to the start of the load address
+ to match up with registerNewMapping. */
+ M->Adjust -= segmentStart;
+ }
fetchSymbols(M);
std::sort(begin(), end());
@@ -852,7 +858,7 @@
bool IsSO = IsSharedObject(BinaryCacheRoot + std::string(Filename));
uint64_t End = E->start + E->extent;
uint64_t Adjust = IsSO ? E->start - E->pgoff : 0;
- Maps.push_back({E->start, End, Adjust, Filename});
+ Maps.push_back({E->start, End, Adjust, IsSO, Filename});
unsigned char *EndOfEvent = Buf + E->header.size;
// FIXME: The first EventID is used for every event.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124663.425997.patch
Type: text/x-patch
Size: 1467 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220429/448e669d/attachment.bin>
More information about the llvm-commits
mailing list